using System; using System.Linq; using System.Web.Mvc; using DSWeb.MvcShipping.Models.InfoSaleProfitSharePlan; using DSWeb.MvcShipping.Models.InfoSaleProfitShareSet; using DSWeb.MvcShipping.DAL.MsInfoSaleProfitShareSet; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using System.Collections.Generic; using HcUtility.Comm; using HcUtility.Core; using DSWeb.SoftMng.Filter; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsInfoSaleProfitShareSetController : Controller { // // GET: public ActionResult Index() { return View(); } // // GET: / public ActionResult Edit() { return View(); } public ActionResult PlanIndex() { return View(); } // // GET: [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetDataList(string condition,string sort) { var dataList = MsInfoSaleProfitShareSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]), sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } // // GET:/TruckMng/MsWlTyreAcc/GetData/ [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetData(string handle, string condition) { InfoSaleProfitSharePlan head = null; if (handle == "edit") { var list = MsInfoSaleProfitShareSetDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"])); if (list.Count > 0) head = list[0]; } if (head == null) { head = new InfoSaleProfitSharePlan(); head.CREATEUSER = Convert.ToString(Session["SHOWNAME"]); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult Save(string opstatus, string data, string body, string bodywork,string bodycq) { var headData = JsonConvert.Deserialize(data); var bodyList = JsonConvert.Deserialize>(body); var worklist = JsonConvert.Deserialize>(bodywork); var cqlist = JsonConvert.Deserialize>(bodycq); if (opstatus == "add") { headData.DbOperationType = DbOperationType.DbotIns; } else if (opstatus == "edit") { headData.DbOperationType = DbOperationType.DbotUpd; headData.ModelUIStatus = "E"; } else { headData.DbOperationType = DbOperationType.DbotDel; } var modb = new ModelObjectDB(); var GID = headData.GID; headData.COMPANYID = Convert.ToString(Session["COMPANYID"]); DBResult result = modb.Save(headData); result = MsInfoSaleProfitShareSetDAL.SaveDetail(bodyList, GID); result = MsInfoSaleProfitShareSetDAL.SaveLxDetail(worklist, GID); result = MsInfoSaleProfitShareSetDAL.SaveCqDetail(cqlist, GID); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = MsInfoSaleProfitShareSetDAL.GetData("GID='" + GID + "'", Convert.ToString(Session["COMPANYID"])) }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult Delete(string data) { var headData = JsonConvert.Deserialize(data); DBResult result = MsInfoSaleProfitShareSetDAL.DeleteDetail(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #region 方案明细 [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetSaleProfitDetailDataList(string condition, string sort) { var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitDetailDataList(condition, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteSaleProfitDetail(string data) { var headData = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); DBResult result = modb.Delete(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 方案利息 [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetSaleProfitLxDataList(string condition, string sort) { var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitLxDataList(condition, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteSaleProfitLx(string data) { var headData = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); DBResult result = modb.Delete(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 方案超期 [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetSaleProfitCqDataList(string condition, string sort) { var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitCqDataList(condition, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteSaleProfitCq(string data) { var headData = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); DBResult result = modb.Delete(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 方案设置 [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetSaleProfitSetDataList(string condition, string sort) { var dataList = MsInfoSaleProfitShareSetDAL.GetSaleProfitSetDataList(condition, Convert.ToString(Session["COMPANYID"]), sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } // // GET:/TruckMng/MsWlTyreAcc/GetData/ public ContentResult DeleteSaleProfitSet(string data) { var headData = JsonConvert.Deserialize(data); var modb = new ModelObjectDB(); DBResult result = modb.Delete(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult SaveSaleProfitSet(string body) { var bodyList = JsonConvert.Deserialize>(body); DBResult result = MsInfoSaleProfitShareSetDAL.SaveSaleProfitSet(bodyList, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 参照部分 #endregion } }