本文整理汇总了C#中TugDataModel.TugDataEntities类的典型用法代码示例。如果您正苦于以下问题:C# TugDataEntities类的具体用法?C# TugDataEntities怎么用?C# TugDataEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TugDataEntities类属于TugDataModel命名空间,在下文中一共展示了TugDataEntities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddCustomData
public ActionResult AddCustomData(string CustomName, string CustomValue)
{
this.Internationalization();
TugDataEntities db = new TugDataEntities();
try
{
System.Linq.Expressions.Expression<Func<CustomField, bool>> exp = u => u.CustomName == CustomName && u.CustomLabel == CustomValue;
CustomField tmpCustom = db.CustomField.Where(exp).FirstOrDefault();
if (tmpCustom != null)
{
throw new Exception(CustomValue + "已存在!");
}
CustomField custom = new CustomField();
custom.CustomName = CustomName;
custom.CustomValue = "";
custom.CustomLabel = CustomValue;
custom.Description = "";
custom.UserID = Session.GetDataFromSession<int>("userid");
custom.CreateDate = custom.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
custom = db.CustomField.Add(custom);
db.SaveChanges();
return Json(new { code = Resources.Common.SUCCESS_CODE, message = Resources.Common.SUCCESS_MESSAGE });
}
catch (Exception ex)
{
throw ex;
}
}
示例2: GetAlert
public ActionResult GetAlert()
{
int curUserId = 0;
int NeedApprovedCount, RejectBillingCount, RejectOrderCount;
curUserId = Session.GetDataFromSession<int>("userid");
TugDataEntities db = new TugDataEntities();
//待审核任务
List<V_NeedApproveBilling> objs = db.V_NeedApproveBilling.Where(u => u.FlowUserID == curUserId && u.Phase != 0).OrderByDescending(u => u.IDX).ToList<V_NeedApproveBilling>();
NeedApprovedCount = objs.Count;
//被驳回账单
List<Billing> rejectBilling = db.Billing.Where(u => u.UserID == curUserId && u.Phase == 0 && u.Status == "被駁回").OrderByDescending(u => u.IDX).ToList<Billing>();
RejectBillingCount = rejectBilling.Count;
//被驳回订单
//List<V_OrderService> rejectOrder = db.V_OrderService.Where(u => u.OrderUserId == curUserId && (u.ServiceJobStateLabel == "被駁回" || u.ServiceJobStateValue == "3")).ToList<V_OrderService>();
List<V_OrderService> rejectOrder = db.V_OrderService.Where(u => (u.ServiceJobStateLabel == "被駁回" || u.ServiceJobStateValue == "3")).ToList<V_OrderService>();
RejectOrderCount = rejectOrder.Count;
return Json(new
{
code = Resources.Common.SUCCESS_CODE,
message = Resources.Common.SUCCESS_MESSAGE,
NeedApprovedCount,
RejectBillingCount,
RejectOrderCount
}, JsonRequestBehavior.AllowGet);
}
示例3: AmountSumAdd_Update
//这个Tuple类型数组的amountlist中依次存储 int SchedulerID, int TugID, float Amount, float Hours
//一个账单调用一次
public void AmountSumAdd_Update(int CustomerID, int CustomerShipID, int BillingID, DateTime BillingDate, Tuple<int, int, float, float>[] amountlist)
{
try
{
TugDataEntities db = new TugDataEntities();
//先删除
System.Linq.Expressions.Expression<Func<AmountSum, bool>> exp = u => u.BillingID == BillingID;
var entitys = db.AmountSum.Where(exp);
entitys.ToList().ForEach(entity => db.Entry(entity).State = System.Data.Entity.EntityState.Deleted); //不加这句也可以
db.AmountSum.RemoveRange(entitys);
db.SaveChanges();
//新增
foreach(var obj in amountlist)
{
TugDataModel.AmountSum newobj = new AmountSum();
newobj.CustomerID = CustomerID;
newobj.CustomerShipID = CustomerShipID;
newobj.BillingID = BillingID;
newobj.BillingDateTime = BillingDate;
newobj.SchedulerID = obj.Item1;//SchedulerID;
newobj.TugID = obj.Item2;;
newobj.Amount = obj.Item3; ;
newobj.Hours = obj.Item4; ;
newobj.OwnerID = -1;
newobj.CreateDate = newobj.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ;//.ToString("yyyy-MM-dd");
newobj.UserID = Session.GetDataFromSession<int>("userid");
newobj.UserDefinedCol1 = "";
newobj.UserDefinedCol2 = "";
newobj.UserDefinedCol3 = "";
newobj.UserDefinedCol4 = "";
//if (Request.Form["UserDefinedCol5"].Trim() != "")
// newobj.UserDefinedCol5 = Convert.ToDouble(Request.Form["UserDefinedCol5"].Trim());
//if (Request.Form["UserDefinedCol6"].Trim() != "")
// newobj.UserDefinedCol6 = Util.toint(Request.Form["UserDefinedCol6"].Trim());
//if (Request.Form["UserDefinedCol7"].Trim() != "")
// newobj.UserDefinedCol7 = Util.toint(Request.Form["UserDefinedCol7"].Trim());
//if (Request.Form["UserDefinedCol8"].Trim() != "")
// newobj.UserDefinedCol8 = Util.toint(Request.Form["UserDefinedCol8"].Trim());
newobj.UserDefinedCol9 = "";
newobj.UserDefinedCol10 = "";
newobj = db.AmountSum.Add(newobj);
}
db.SaveChanges();
//var ret = new { code = Resources.Common.SUCCESS_CODE, message = Resources.Common.SUCCESS_MESSAGE };
//Response.Write(@Resources.Common.SUCCESS_MESSAGE);
//return Json(ret);
}
catch (Exception ex)
{
throw ex;
}
}
示例4: ApproveCount
public ActionResult ApproveCount()
{
int curUserId = 0, ApprovedCount;
TugDataEntities db = new TugDataEntities();
curUserId = Session.GetDataFromSession<int>("userid"); //當前用戶ID
List<Approve> ApproveList = db.Approve.Where(u => u.PersonID == curUserId).Select(u => u).ToList<Approve>();
if (ApproveList.Count != 0)
{
List<Billing> BillList = db.Billing.Where(u => u.IDX == -1).Select(u => u).ToList<Billing>();
foreach (Approve obj in ApproveList)
{
if (Convert.ToInt32(obj.Accept) > 2) continue;
System.Linq.Expressions.Expression<Func<Billing, bool>> expB = u => u.IDX == obj.BillingID;
Billing billData = db.Billing.Where(expB).FirstOrDefault();
if (billData != null)
{
//撤销提交的为待提交任务
if (Convert.ToInt32(billData.Phase) == 0 && billData.Status == "已撤销提交") continue;
//驳回或撤销通过的为待完成任务
if (Convert.ToInt32(billData.Phase) == 0 && billData.Status.ToString().Length >= 3) continue;
BillList.Add(billData);
}
}
ApprovedCount = BillList.Count;
return Json(new { message = ApprovedCount });
}
else
{
Response.StatusCode = 404;
return Json(new { message = "0" });
}
}
示例5: GetDatatableBySql
/// <summary>
/// 用于执行单条sql语句,并返回datatable...
/// </summary>
/// <param name="sql"></param>
/// <returns></returns>
public static DataTable GetDatatableBySql(string sql)
{
if (sql.Trim() == string.Empty) return null;
DataTable dt = null;
System.Data.DataSet ds = new System.Data.DataSet();
try
{
using (TugDataEntities db = new TugDataEntities())
{
DbConnection con = db.Database.Connection;
DbCommand cmd = con.CreateCommand();
cmd.CommandText = sql;
cmd.CommandType = System.Data.CommandType.Text;
System.Data.Common.DbDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(ds);
}
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
ds.Tables.RemoveAt(0);
}
return dt;
}
catch (System.Exception ex)
{
throw ex;
}
}
示例6: GetDatatableBySP
public static DataTable GetDatatableBySP(string spName, SqlParameter[] param = null)
{
DataTable dt = null;
System.Data.DataSet ds = new System.Data.DataSet();
try
{
//TugDataEntities db = new TugDataEntities();
using (TugDataEntities db = new TugDataEntities())
{
DbConnection con = db.Database.Connection;
DbCommand cmd = con.CreateCommand();
cmd.CommandText = spName;
cmd.CommandType = System.Data.CommandType.StoredProcedure;
if (param != null && param.Length > 0) cmd.Parameters.AddRange(param);
System.Data.Common.DbDataAdapter adapter = new System.Data.SqlClient.SqlDataAdapter();
adapter.SelectCommand = cmd;
adapter.Fill(ds);
}
if (ds.Tables.Count > 0)
{
dt = ds.Tables[0];
ds.Tables.RemoveAt(0);
if (dt != null) dt.TableName = spName;
}
return dt;
}
catch (System.Exception ex)
{
throw ex;
}
}
示例7: AddCredit
public ActionResult AddCredit(int billingId, string billingCode, string creditContent, double creditAmount, string creditdate, string remark)
{
TugDataModel.Credit credit;
this.Internationalization();
try
{
TugDataEntities db = new TugDataEntities();
{
credit = new Credit();
credit.BillingID = billingId;
credit.CreditCode = "C" + billingCode.Substring(1, billingCode.Length - 1 );
credit.CreditContent = creditContent;
credit.CreditAmount = creditAmount;
credit.UserDefinedCol10 = creditdate;
credit.Remark = remark;
credit.CreateDate = credit.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
credit.OwnerID = -1;
credit.UserID = credit.UserID = Session.GetDataFromSession<int>("userid");
//credit.UserDefinedCol1 = "";
//credit.UserDefinedCol2 = "";
//credit.UserDefinedCol3 = "";
//credit.UserDefinedCol4 = "";
//credit.UserDefinedCol5 = 0;
//credit.UserDefinedCol6 = 0;
//credit.UserDefinedCol7 = 0;
//credit.UserDefinedCol8 = 0;
//credit.UserDefinedCol9 = "";
//credit.UserDefinedCol10 = "";
credit = db.Credit.Add(credit);
db.SaveChanges();
//更新账单中的回扣金额
{
TugBusinessLogic.Module.FinanceLogic.UpdateTotalRebateOfBilling(billingId);
}
}
var ret = new { code = Resources.Common.SUCCESS_CODE, message = Resources.Common.SUCCESS_MESSAGE, billing_id = credit.IDX };
return Json(ret, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
var ret = new { code = Resources.Common.EXCEPTION_CODE, message = Resources.Common.EXCEPTION_MESSAGE };
return Json(ret, JsonRequestBehavior.AllowGet);
}
}
示例8: GetTugSchedulerBusyState
/// <summary>
/// 获取拖轮一日的时间安排状态
/// </summary>
/// <param name="tugId">拖轮ID</param>
/// <param name="tugEx">拖轮对象</param>
/// <param name="workDate">指定日期</param>
/// <returns></returns>
public static TugEx GetTugSchedulerBusyState(int tugId, TugEx tugEx, string workDate)
{
TugDataEntities db = new TugDataEntities();
//string now = DateTime.Now.ToString("yyyy-MM-dd");
List<V_OrderScheduler> schedulers = db.V_OrderScheduler.Where(u => u.TugID == tugId && u.ServiceWorkDate == workDate)
.Select(u => u).OrderByDescending(u => u.IDX).ToList<V_OrderScheduler>();
//schedulers[0].DepartBaseTime;
//schedulers[0].ArrivalBaseTime;
if(schedulers != null)
{
foreach (V_OrderScheduler item in schedulers)
{
if(item.DepartBaseTime != null && item.ArrivalBaseTime != null)
tugEx = SetTugBusyState(item.DepartBaseTime.Trim(), item.ArrivalBaseTime.Trim(), tugEx);
//tugEx = SetTugBusyState("00:20", "00:30", tugEx);
}
}
return tugEx;
}
示例9: AddEditService2
public ActionResult AddEditService2()
{
this.Internationalization();
#region Edit
using (System.Transactions.TransactionScope trans = new System.Transactions.TransactionScope())
{
if (Request.Form["oper"].Equals("edit"))
{
try
{
TugDataEntities db = new TugDataEntities();
int idx = Util.toint(Request.Form["OrderServiceID"].Trim());
int orderid = Util.toint(Request.Form["OrderID"].Trim());
var customerName = Request.Form["CustomerName"].Trim();
var shipName = Request.Form["ShipName"].Trim();
int customerid;// = Util.toint(Request.Form["CustomerID"].Trim());
int shipid;//= Util.toint(Request.Form["ShipID"].Trim());
//判断客户名称是否存在
System.Linq.Expressions.Expression<Func<Customer, bool>> expctm = u => u.Name1 == customerName;
Customer objctm = db.Customer.Where(expctm).FirstOrDefault();
if (objctm == null)
{
//throw new Exception("客戶名稱不存在!");
return Json(new { code = Resources.Common.ERROR_CODE, message = "客戶名稱不存在!" });
}
else
customerid = objctm.IDX;
//判断客户船名称是否存在//
System.Linq.Expressions.Expression<Func<CustomerShip, bool>> expcts = u => u.Name1 == shipName;
CustomerShip objcts = db.CustomerShip.Where(expcts).FirstOrDefault();
if (objcts == null)
{
//throw new Exception("客戶船名稱不存在!");
return Json(new { code = Resources.Common.ERROR_CODE, message = "客戶船名稱不存在!" });
}
else
shipid = objcts.IDX;
OrderService aOrderService = db.OrderService.Where(u => u.IDX == idx).FirstOrDefault();
if (aOrderService == null)
{
return Json(new { code = Resources.Common.ERROR_CODE, message = Resources.Common.ERROR_MESSAGE });
}
else
{
aOrderService.ServiceWorkDate = Request.Form["ServiceWorkDate"];
aOrderService.ServiceWorkTime = Request.Form["ServiceWorkTime"];
aOrderService.ServiceNatureID = TugBusinessLogic.Module.Util.toint(Request.Form["ServiceNatureID"]);
aOrderService.ServiceWorkPlace = Request.Form["ServiceWorkPlace"];
aOrderService.BigTugNum = Util.toint(Request.Form["BigTugNum"].Trim());
aOrderService.MiddleTugNum = Util.toint(Request.Form["MiddleTugNum"].Trim());
aOrderService.SmallTugNum = Util.toint(Request.Form["SmallTugNum"].Trim());
aOrderService.UserDefinedCol9 = Request.Form["TugIDs"];
aOrderService.UserDefinedCol10 = Request.Form["TugNames"];
aOrderService.OwnerID = -1;
aOrderService.UserID = Session.GetDataFromSession<int>("userid");
aOrderService.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
db.Entry(aOrderService).State = System.Data.Entity.EntityState.Modified;
if (0 < db.SaveChanges()) //修改成功
{
//更新订单
OrderInfor aOrder = db.OrderInfor.Where(u => u.IDX == orderid).FirstOrDefault();
if (aOrder != null)
{
aOrder.CustomerID = customerid;// Util.toint(Request.Form["CustomerID"].Trim());
aOrder.CustomerName = Request.Form["CustomerName"].Trim();
aOrder.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
////aOrder.IsGuest = Request.Form["IsGuest"].Trim();
aOrder.LinkMan = Request.Form["LinkMan"].Trim();
aOrder.LinkPhone = Request.Form["LinkPhone"].Trim();
aOrder.LinkEmail = Request.Form["LinkEmail"].Trim();
//aOrder.OrdDate = Request.Form["OrdDate"].Trim();
aOrder.ShipID = shipid;//Util.toint(Request.Form["ShipID"].Trim());
aOrder.ShipName = Request.Form["ShipName"].Trim();
//aOrder.Remark = Request.Form["Remark"].Trim();
//aOrder.UserDefinedCol1 = Request.Form["UserDefinedCol1"].Trim();
//aOrder.UserDefinedCol2 = Request.Form["UserDefinedCol2"].Trim();
//aOrder.UserDefinedCol3 = Request.Form["UserDefinedCol3"].Trim();
//aOrder.UserDefinedCol4 = Request.Form["UserDefinedCol4"].Trim();
//if (Request.Form["UserDefinedCol5"].Trim() != "")
// aOrder.UserDefinedCol5 = Convert.ToDouble(Request.Form["UserDefinedCol5"].Trim());
//if (Request.Form["UserDefinedCol6"].Trim() != "")
// aOrder.UserDefinedCol6 = Util.toint(Request.Form["UserDefinedCol6"].Trim());
//if (Request.Form["UserDefinedCol7"].Trim() != "")
// aOrder.UserDefinedCol7 = Util.toint(Request.Form["UserDefinedCol7"].Trim());
//if (Request.Form["UserDefinedCol8"].Trim() != "")
//.........这里部分代码省略.........
示例10: AddEditScheduler
public ActionResult AddEditScheduler()
{
this.Internationalization();
#region Add
if (Request.Form["oper"].Equals("add"))
{
try
{
TugDataEntities db = new TugDataEntities();
{
TugDataModel.Scheduler aScheduler = new Scheduler();
aScheduler.ArrivalBaseTime = Request.Form["ArrivalBaseTime"].Trim();
aScheduler.ArrivalShipSideTime = Request.Form["ArrivalShipSideTime"].Trim();
aScheduler.CaptainConfirmTime = Request.Form["CaptainConfirmTime"].Trim();
aScheduler.DepartBaseTime = Request.Form["DepartBaseTime"].Trim();
aScheduler.InformCaptainTime = Request.Form["InformCaptainTime"].Trim();
aScheduler.WorkCommencedTime = Request.Form["WorkCommencedTime"].Trim();
aScheduler.WorkCompletedTime = Request.Form["WorkCompletedTime"].Trim();
aScheduler.JobStateID = Util.toint(Request.Form["JobStateID"].Trim()); ;
//aScheduler.OrderID = Util.toint(Request.Form["OrderID"].Trim());
aScheduler.OwnerID = -1;
aScheduler.UserID = Session.GetDataFromSession<int>("userid");
aScheduler.Remark = Request.Form["Remark"].Trim(); ;
//aScheduler.RopeUsed = Request.Form["RopeUsed"].Trim();
//if (aScheduler.RopeUsed.Equals("是"))
// aScheduler.RopeNum = Util.toint(Request.Form["RopeNum"].Trim());
//else
// aScheduler.RopeNum = 0;
//aScheduler.ServiceNatureID = Util.toint(Request.Form["ServiceNatureLabel"].Trim().Split('~')[0]);
aScheduler.TugID = Util.toint(Request.Form["TugID"].Trim());
aScheduler.CreateDate = aScheduler.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
aScheduler.UserDefinedCol1 = Request.Form["UserDefinedCol1"].Trim();
aScheduler.UserDefinedCol2 = Request.Form["UserDefinedCol2"].Trim();
aScheduler.UserDefinedCol3 = Request.Form["UserDefinedCol3"].Trim();
aScheduler.UserDefinedCol4 = Request.Form["UserDefinedCol4"].Trim();
if (Request.Form["UserDefinedCol5"].Trim() != "")
aScheduler.UserDefinedCol5 = Convert.ToDouble(Request.Form["UserDefinedCol5"].Trim());
if (Request.Form["UserDefinedCol6"].Trim() != "")
aScheduler.UserDefinedCol6 = Util.toint(Request.Form["UserDefinedCol6"].Trim());
if (Request.Form["UserDefinedCol7"].Trim() != "")
aScheduler.UserDefinedCol7 = Util.toint(Request.Form["UserDefinedCol7"].Trim());
if (Request.Form["UserDefinedCol8"].Trim() != "")
aScheduler.UserDefinedCol8 = Util.toint(Request.Form["UserDefinedCol8"].Trim());
aScheduler.UserDefinedCol9 = Request.Form["UserDefinedCol9"].Trim();
aScheduler.UserDefinedCol10 = Request.Form["UserDefinedCol10"].Trim();
aScheduler = db.Scheduler.Add(aScheduler);
db.SaveChanges();
{
//更新订单状态
//OrderInfor tmpOrder = db.OrderInfor.Where(u => u.IDX == aScheduler.OrderID).FirstOrDefault();
//if(tmpOrder != null)
//{
// tmpOrder.WorkStateID = 3; //已排船
// db.Entry(tmpOrder).State = System.Data.Entity.EntityState.Modified;
// db.SaveChanges();
//}
}
{
//OrderService os = db.OrderService.Where(u => u.OrderID == aScheduler.OrderID && u.ServiceNatureID == aScheduler.ServiceNatureID).FirstOrDefault();
//if (os == null)
//{
// os = new OrderService();
// os.CreateDate = os.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// os.OrderID = aScheduler.OrderID;
// os.OwnerID = -1;
// os.ServiceNatureID = aScheduler.ServiceNatureID;
// os.ServiceWorkDate = Request.Form["ServiceWorkDate"].Trim();
// os.ServiceWorkPlace = Request.Form["ServiceWorkPlace"].Trim();
// os.UserID = Session.GetDataFromSession<int>("userid");
// os = db.OrderService.Add(os);
// db.SaveChanges();
//}
//else
//{
// os.ServiceWorkDate = Request.Form["ServiceWorkDate"].Trim();
// os.ServiceWorkPlace = Request.Form["ServiceWorkPlace"].Trim();
// os.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
// db.Entry(os).State = System.Data.Entity.EntityState.Modified;
// db.SaveChanges();
//}
}
var ret = new { code = Resources.Common.SUCCESS_CODE, message = Resources.Common.SUCCESS_MESSAGE };
//Response.Write(@Resources.Common.SUCCESS_MESSAGE);
return Json(ret);
//.........这里部分代码省略.........
示例11: IsWanGong
//判断订单下的服务是否有已完工
public ActionResult IsWanGong()
{
var f = Request.Form;
bool IsWanGong = false;
//int idx = Util.toint(Request.Form["orderId"]);
string oderMark = Request.Form["ordermark"];
TugDataEntities db = new TugDataEntities();
//System.Linq.Expressions.Expression<Func<V_OrderService_Scheduler, bool>> exps = u => u.OrderID == idx;
System.Linq.Expressions.Expression<Func<V_OrderService, bool>> exps = u => u.UserDefinedCol1 == oderMark & (u.ServiceJobStateLabel == "已完工" || u.ServiceJobStateValue=="2");
List<V_OrderService> objs = db.V_OrderService.Where(exps).Select(u => u).ToList<V_OrderService>();
if (objs.Count != 0)
{
IsWanGong = true; //已有排船信息
return Json(new { code = Resources.Common.SUCCESS_CODE, message = IsWanGong });
}
else
{
return Json(new { code = Resources.Common.SUCCESS_CODE, message = IsWanGong });
}
}
示例12: GetUnCompleteServiceState
public ActionResult GetUnCompleteServiceState(bool _search, string sidx, string sord, int page, int rows)
{
this.Internationalization();
//string s = Request.QueryString[6];
try
{
TugDataEntities db = new TugDataEntities();
////List<V_OrderService> objs = db.V_OrderService.Where(u => u.ServiceJobStateLabel!="已完工").Select(u => u).OrderByDescending(u => u.ServiceWorkDate).OrderByDescending(u=>u.ServiceWorkTime).ToList<V_OrderService>();
//List<V_OrderService> objs = db.V_OrderService.Where(u => u.ServiceJobStateLabel != "已完工").Select(u => u).OrderByDescending(u => u.ServiceWorkDate).ThenByDescending(u => u.ServiceWorkTime).ToList<V_OrderService>();
//int totalRecordNum = objs.Count;
//if (page != 0 && totalRecordNum % rows == 0) page -= 1;
//int pageSize = rows;
//int totalPageNum = (int)Math.Ceiling((double)totalRecordNum / pageSize);
////List<V_OrderService> page_V_OrderServices = V_OrderServices.Skip((page - 1) * rows).Take(rows).OrderBy(u => u.IDX).ToList<V_OrderService>();
//var jsonData = new { page = page, records = totalRecordNum, total = totalPageNum, rows = objs };
//return Json(jsonData, JsonRequestBehavior.AllowGet);
if (_search == true)
{
string searchOption = Request.QueryString["filters"];
//List<V_OrderService> objs = db.V_OrderService.Where(u => u.ServiceJobStateLabel != "已完工").Select(u => u)
// .OrderByDescending(u => u.ServiceWorkDate).ThenByDescending(u => u.ServiceWorkTime).ToList<V_OrderService>();
List<V_OrderService> objs = TugBusinessLogic.Module.OrderLogic.SearchForServiceScheduler2(sidx, sord, searchOption);
int totalRecordNum = objs.Count;
if (page != 0 && totalRecordNum % rows == 0) page -= 1;
int pageSize = rows;
int totalPageNum = (int)Math.Ceiling((double)totalRecordNum / pageSize);
List<V_OrderService> page_orders = objs.Skip((page - 1) * rows).Take(rows).ToList<V_OrderService>();
var jsonData = new { page = page, records = totalRecordNum, total = totalPageNum, rows = page_orders };
return Json(jsonData, JsonRequestBehavior.AllowGet);
//return Json(new { code = Resources.Common.ERROR_CODE, message = Resources.Common.ERROR_MESSAGE }, JsonRequestBehavior.AllowGet);
}
else
{
//List<V_OrderInfor> orders = db.V_OrderInfor.Select(u => u).OrderByDescending(u => u.IDX).ToList<V_OrderInfor>();
//List<V_OrderService> objs = db.V_OrderService.Where(u => u.ServiceJobStateLabel != "已完工")
// .Select(u => u).OrderByDescending(u => u.ServiceWorkDate).ThenByDescending(u => u.ServiceWorkTime).ToList<V_OrderService>();
List<V_OrderService> objs = TugBusinessLogic.Module.OrderLogic.LoadDataForServiceScheduler2(sidx, sord);
int totalRecordNum = objs.Count;
if (page != 0 && totalRecordNum % rows == 0) page -= 1;
int pageSize = rows;
int totalPageNum = (int)Math.Ceiling((double)totalRecordNum / pageSize);
List<V_OrderService> page_orders = objs.Skip((page - 1) * rows).Take(rows).ToList<V_OrderService>();
var jsonData = new { page = page, records = totalRecordNum, total = totalPageNum, rows = page_orders };
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
}
catch (Exception)
{
return Json(new { code = Resources.Common.EXCEPTION_CODE, message = Resources.Common.EXCEPTION_MESSAGE });
}
}
示例13: GetTugRelatedOrders
public ActionResult GetTugRelatedOrders(bool _search, string sidx, string sord, int page, int rows, int tugId, string workDate)
{
this.Internationalization();
try
{
TugDataEntities db = new TugDataEntities();
if (_search == true)
{
string s = Request.QueryString["filters"];
return Json(new { code = Resources.Common.ERROR_CODE, message = Resources.Common.ERROR_MESSAGE }, JsonRequestBehavior.AllowGet);
}
else
{
//string now = DateTime.Now.ToString("yyyy-MM-dd");
List<V_OrderScheduler> schedulers = db.V_OrderScheduler.Where(u => u.TugID == tugId && u.ServiceWorkDate == workDate)
.Select(u => u).OrderByDescending(u => u.IDX).ToList<V_OrderScheduler>();
//List<V_OrderScheduler> orders = TugBusinessLogic.Module.OrderLogic.LoadDataForOrderScheduler(sidx, sord, orderId);
List<V_OrderInfor> orders = new List<V_OrderInfor>();
if (schedulers != null)
{
foreach (V_OrderScheduler item in schedulers)
{
orders.AddRange(db.V_OrderInfor.Where(u => u.IDX == item.OrderID).Select(u => u).OrderByDescending(u => u.IDX).ToList<V_OrderInfor>());
};
}
int totalRecordNum = orders.Count;
if (page != 0 && totalRecordNum % rows == 0) page -= 1;
int pageSize = rows;
int totalPageNum = (int)Math.Ceiling((double)totalRecordNum / pageSize);
//List<V_OrderScheduler> page_orders = orders.Skip((page - 1) * rows).Take(rows).ToList<V_OrderScheduler>();
var jsonData = new { page = page, records = totalRecordNum, total = totalPageNum, rows = orders };
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
}
catch (Exception)
{
return Json(new { code = Resources.Common.EXCEPTION_CODE, message = Resources.Common.EXCEPTION_MESSAGE }, JsonRequestBehavior.AllowGet);
}
}
示例14: GetServiceState
public ActionResult GetServiceState(bool _search, string sidx, string sord, int page, int rows)
{
this.Internationalization();
//string s = Request.QueryString[6];
try
{
TugDataEntities db = new TugDataEntities();
//List<V_OrderService> objs = db.V_OrderService.Where(u => u.ServiceJobStateLabel!="已完工").Select(u => u).OrderByDescending(u => u.ServiceWorkDate).OrderByDescending(u=>u.ServiceWorkTime).ToList<V_OrderService>();
List<V_OrderService> objs = db.V_OrderService.Select(u => u).OrderByDescending(u => u.ServiceWorkDate).ThenByDescending(u => u.ServiceWorkTime).ToList<V_OrderService>();
int totalRecordNum = objs.Count;
if (page != 0 && totalRecordNum % rows == 0) page -= 1;
int pageSize = rows;
int totalPageNum = (int)Math.Ceiling((double)totalRecordNum / pageSize);
//List<V_OrderService> page_V_OrderServices = V_OrderServices.Skip((page - 1) * rows).Take(rows).OrderBy(u => u.IDX).ToList<V_OrderService>();
var jsonData = new { page = page, records = totalRecordNum, total = totalPageNum, rows = objs };
return Json(jsonData, JsonRequestBehavior.AllowGet);
}
catch (Exception)
{
return Json(new { code = Resources.Common.EXCEPTION_CODE, message = Resources.Common.EXCEPTION_MESSAGE });
}
}
示例15: AddEdit
public ActionResult AddEdit()
{
this.Internationalization();
#region Add
if (Request.Form["oper"].Equals("add"))
{
try
{
TugDataEntities db = new TugDataEntities();
{
TugDataModel.OrderInfor aOrder = new OrderInfor();
aOrder.Code = TugBusinessLogic.Utils.AutoGenerateOrderSequenceNo();
aOrder.CreateDate = aOrder.LastUpDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
aOrder.CustomerID = Util.toint(Request.Form["CustomerID"]);
aOrder.CustomerName = Request.Form["CustomerName"].Trim();
aOrder.OrdDate = Request.Form["OrdDate"].Trim();
//aOrder.WorkDate = Request.Form["WorkDate"].Trim();
//aOrder.WorkTime = Request.Form["WorkTime"].Trim();
//aOrder.EstimatedCompletionTime = Request.Form["EstimatedCompletionTime"].Trim();
aOrder.IsGuest = "否"; // Request.Form["IsGuest"].Trim();
aOrder.LinkMan = Request.Form["LinkMan"].Trim();
aOrder.LinkPhone = Request.Form["LinkPhone"].Trim();
aOrder.LinkEmail = Request.Form["LinkEmail"].Trim();
//if (Request.Form["BigTugNum"].Trim() != "")
// aOrder.BigTugNum = Util.toint(Request.Form["BigTugNum"].Trim());
//if (Request.Form["MiddleTugNum"].Trim() != "")
// aOrder.MiddleTugNum = Util.toint(Request.Form["MiddleTugNum"].Trim());
//if (Request.Form["SmallTugNum"].Trim() != "")
// aOrder.SmallTugNum = Util.toint(Request.Form["SmallTugNum"].Trim());
aOrder.OwnerID = -1;
aOrder.Remark = Request.Form["Remark"].Trim();
aOrder.ShipID = Util.toint(Request.Form["ShipID"].Trim());
aOrder.ShipName = Request.Form["ShipName"].Trim();
aOrder.UserID = Session.GetDataFromSession<int>("userid");
//aOrder.WorkPlace = Request.Form["WorkPlace"].Trim();
//Dictionary<string, string> dic = TugBusinessLogic.Utils.ResolveServices(Request.Form["ServiceNatureNames"].Trim());
//aOrder.ServiceNatureIDS = dic["ids"];
//aOrder.ServiceNatureNames = dic["labels"];
//aOrder.WorkStateID = Util.toint(Request.Form["WorkStateID"].Trim());
aOrder.WorkStateID = 2; //CustomField表里面的OrderInfor.WorkStateID的IDX
aOrder.UserDefinedCol1 = Request.Form["UserDefinedCol1"].Trim();
aOrder.UserDefinedCol2 = Request.Form["UserDefinedCol2"].Trim();
aOrder.UserDefinedCol3 = Request.Form["UserDefinedCol3"].Trim();
aOrder.UserDefinedCol4 = Request.Form["UserDefinedCol4"].Trim();
if (Request.Form["UserDefinedCol5"].Trim() != "")
aOrder.UserDefinedCol5 = Convert.ToDouble(Request.Form["UserDefinedCol5"].Trim());
if (Request.Form["UserDefinedCol6"].Trim() != "")
aOrder.UserDefinedCol6 = Util.toint(Request.Form["UserDefinedCol6"].Trim());
if (Request.Form["UserDefinedCol7"].Trim() != "")
aOrder.UserDefinedCol7 = Util.toint(Request.Form["UserDefinedCol7"].Trim());
if (Request.Form["UserDefinedCol8"].Trim() != "")
aOrder.UserDefinedCol8 = Util.toint(Request.Form["UserDefinedCol8"].Trim());
aOrder.UserDefinedCol9 = Request.Form["UserDefinedCol9"].Trim();
aOrder.UserDefinedCol10 = Request.Form["UserDefinedCol10"].Trim();
aOrder = db.OrderInfor.Add(aOrder);
db.SaveChanges();
var ret = new { code = Resources.Common.SUCCESS_CODE, message = Resources.Common.SUCCESS_MESSAGE };
//Response.Write(@Resources.Common.SUCCESS_MESSAGE);
return Json(ret);
}
}
catch (Exception)
{
var ret = new { code = Resources.Common.EXCEPTION_CODE, message = Resources.Common.EXCEPTION_MESSAGE };
//Response.Write(@Resources.Common.EXCEPTION_MESSAGE);
return Json(ret);
}
}
#endregion Add
#region Edit
if (Request.Form["oper"].Equals("edit"))
{
try
{
TugDataEntities db = new TugDataEntities();
int idx = Util.toint(Request.Form["IDX"].Trim());
OrderInfor aOrder = db.OrderInfor.Where(u => u.IDX == idx).FirstOrDefault();
if (aOrder == null)
//.........这里部分代码省略.........