using System; using System.Linq; using System.Web.Mvc; using DSWeb.MvcShipping.DAL.MsOpOtherDAL; using DSWeb.MvcShipping.Models.MsOpOther; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using HcUtility.Comm; using HcUtility.Core; using System.Collections.Generic; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; using DSWeb.EntityDA; using DSWeb.Models; using DSWeb.Attributes; using DSWeb.MvcShipping.Models.MsSysBillNoSet; using DSWeb.MvcShipping.DAL.MsSysBillNoSet; using DSWeb.MvcShipping.Models.MsCodeServiceFeeTemplate; using System.IO; using System.Data; using System.Data.OleDb; using DSWeb.MvcShipping.DAL.MsInfoClient; using DSWeb.MvcShipping.DAL.MsSysParamSet; using System.Web.Configuration; using DSWeb.SoftMng.DAL.SoftSysTable; using DSWeb.Areas.SysMng.DAL.SysUser; using DSWeb.MvcShipping.DAL.MsCodeOpTemplate; using DSWeb.MvcShipping.DAL.ChMonthCloseDAL; using DSWeb.MvcShipping.DAL.MsChFeeDAL; using DSWeb.Areas.Dispatch.DB; using javax.xml.crypto; using System.Data.Entity.Migrations; using DSWeb.Areas.CommMng.DAL; using DSWeb.MvcShipping.Models.MsOp_SuperVision_Truck; using static com.sun.net.httpserver.Authenticator; using DSWeb.MvcShipping.Models.MsOpSeae; using DSWeb.MvcShipping.Helper.Repository; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsOp_SuperVision_TruckController : Controller { // // GET: /CommMng/Print/ public ActionResult Index() { return View(); } public ActionResult Edit() { return View(); } public ContentResult GetDataList(int start, int limit, string sort, string condition, string CODENAME = "") { var count = 0; //var userid = Convert.ToString(Session["USERID"]); //var uid = Session["USERID"].ToString(); //var corpid = Session["COMPANYID"].ToString(); var dataList = MsOp_SuperVision_TruckDAL.GetDataList(start, limit, sort, Convert.ToString(Session["USERID"]), condition, ref count); //var dataList = MsChDuiDAL.GetDataList(start, limit, condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request), sort); //int count = MsChDuiDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), CookieConfig.GetCookie_OrgCode(Request)); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetData(string GID) { var condition = " GID='" + GID + "' "; var result = MsOp_SuperVision_TruckDAL.GetData(condition, Session); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = 1, data = result }); return new ContentResult() { Content = json }; } public ContentResult Save(string opstatus, string data, string data2, string body) { var canlogin = BasicDataRefDAL.CheckLogin(Session); if (!canlogin.Success) { return (ContentResult)canlogin.Data; } data = data.Replace("❥", "<"); var headData = JsonConvert.Deserialize(data);//(data.Replace("}", ",") + data2.Replace("{", "") var bodyList = JsonConvert.Deserialize>(body); var isPost = true; var errorstr = ""; if (isPost) { var result = MsOp_SuperVision_TruckDAL.DoSave(opstatus, headData, bodyList, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), Session["COMPANYNAME"].ToString()); if (result.Success) { var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = result.Data }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } else { var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } else { var jsonRespose = new JsonResponse { Success = false, Message = errorstr }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } public ContentResult Delete(string data) { var head = JsonConvert.Deserialize(data); var candelete = MsOp_SuperVision_TruckDAL.CanDelete(head); if (candelete.Success == false) { var _j = new JsonResponse(candelete); return new ContentResult() { Content = JsonConvert.Serialize(_j) }; } DBResult result = MsOp_SuperVision_TruckDAL.DoDelete(head); var jsonResponse = new JsonResponse(candelete); return new ContentResult() { Content = JsonConvert.Serialize(jsonResponse) }; } public ContentResult DeleteDetailList(string data) { var jsonResponse = new JsonResponse(); var bodylist = JsonConvert.Deserialize>(data); if (bodylist == null) { jsonResponse.Success = true; return new ContentResult() { Content = JsonConvert.Serialize(jsonResponse) }; } var detailgid = bodylist.Select(s => s.GID).ToArray(); var detailgidstr ="'"+ String.Join("','", bodylist)+"'"; var BSNO = bodylist[0].BSNO; var _c = BasicDataRefDAL.ExecSql("delete from OP_SuperVision_Truck_Detail where GID in(" + detailgidstr + ")"); var head = MsOp_SuperVision_TruckDAL.GetData(" GID='" + BSNO + "'"); var currDetail = MsOp_SuperVision_TruckDAL.GetBodyList(" BSNO='" + BSNO + "'"); head.setSum(currDetail); head.setDate(); head.DbOperationType = DbOperationType.DbotUpd; head.ModelUIStatus = "E"; var modb = new ModelObjectRepository(); var _result = modb.Save(head); var jsonRespose = new JsonResponse { Success = true, Message = "删除成功!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetBodyList(string BSNO) { var count = 0; var condition = " BSNO='" + BSNO + "'"; var dataList = MsOp_SuperVision_TruckDAL.GetBodyList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } } }