using System; using System.Linq; using System.Web.Mvc; using DSWeb.MvcShipping.DAL.MsOpSeaeEdiDAL; using DSWeb.MvcShipping.Models.MsOpSeaeEdi; using DSWeb.MvcShipping.Models.MsOpSeae; 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 System.IO; using System.Web; using DSWeb.MvcShipping.DAL.MsOpSeaeEdiPortDAL; using DSWeb.EntityDA; using DSWeb.Areas.MvcShipping.DAL.Message.vgm; using DSWeb.MvcShipping.DAL.MsOpSeaeCustPrice; using DSWeb.MvcShipping.Models.MsOpSeaeCustPrice; using DSWeb.TruckMng.Helper.Repository; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsOpSeaeCustPriceController : Controller { // // GET: public ActionResult Index() { return View(); } public ActionResult Edit() { return View(); } public ActionResult Map() { return View(); } public ActionResult CustomVGMIndex() { return View(); } public ActionResult CustomVGMEdit() { return View(); } public ContentResult GetDataList(int start, int limit, string sort, string condition) { int count = 0; var dataList = MsOpSeaeCustPriceDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), start, limit, out count, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetData(string handle, string condition) { string userid = Convert.ToString(Session["USERID"]); if (userid == "" || userid == null) { var jsonRespose = new JsonResponse { Success = false, Message = "登陆状态失效,请重新登陆进行操作!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } string INPUTBY = Convert.ToString(Session["SHOWNAME"]); Cust_Price head = null; if (handle == "edit") { head = MsOpSeaeCustPriceDAL.GetData(condition); } if (handle == "add") { head = new Cust_Price(); head.GID = Guid.NewGuid().ToString(); head.BSTYPE = 0; head.SENDTYPE = 0; head.GiftBalance = 0; head.PRICE = 0; head.PRICEF = 0; head.PRICEQG = 0; head.PRICEFQG = 0; head.UPDATETIME = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); head.COMNAME = ""; } if (head == null) { head = new Cust_Price(); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult Save(string opstatus, string data,string body) { var headData = JsonConvert.Deserialize(data); string userid = Convert.ToString(Session["USERID"]); var isPost = true; var GID = headData.GID; if (opstatus == "add") { headData.DbOperationType = DbOperationType.DbotIns; headData.CREATE_BY = Session["SHOWNAME"].ToString(); } else { headData.DbOperationType = DbOperationType.DbotUpd; headData.MODIFY_BY = Session["SHOWNAME"].ToString(); } if (isPost) { DBResult result = MsOpSeaeCustPriceDAL.Save(headData); if (result.Success) { var bodyList = JsonConvert.Deserialize>(body); if (bodyList == null || bodyList.Count() == 0){} else { var modb = new ModelObjectRepository(); result = modb.SaveComm("LINKGID", headData.GID, ModelObjectConvert.ToModelObjectList(bodyList), null); } } var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = MsOpSeaeCustPriceDAL.GetData("GID='" + GID + "'") }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } else { var jsonRespose = new JsonResponse { Success = false, Message = "重复,不允许保存!" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } public ContentResult DeletePiLiang(string bsnos) { DBResult rs = MsOpSeaeCustPriceDAL.DeletePiLiang(bsnos); var jsonRespose = new JsonResponse { Success = rs.Success, Message = rs.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetComNameList(int start, int limit, string sort, string condition) { int count = 0; var dataList = MsOpSeaeCustPriceDAL.GetComNameList(); var timeStamp = DateTime.Now.ToShortDateString(); var json = JsonConvert.Serialize(new { success = true, Message = "查询成功", totalCount = count, data = dataList.ToList(), timeStamp = timeStamp }); return new ContentResult() { Content = json }; } public ContentResult GetBodyList(string HEADGID) { int count = 0; var dataList = MsOpSeaeCustPriceDAL.GetBodyList(" LINKGID='" + HEADGID + "'"); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteDetails(string GIDs) { DBResult rs = MsOpSeaeCustPriceDAL.DeletePiLiang(GIDs); var jsonRespose = new JsonResponse { Success = rs.Success, Message = rs.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } } }