using System; using System.Linq; using System.Web.Mvc; using DSWeb.MvcShipping.Models.CodeLhCustRate; using DSWeb.MvcShipping.DAL.MsCodeLhCustRateDAL; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using System.Collections.Generic; using DSWeb.SoftMng.Filter; using HcUtility.Comm; using HcUtility.Core; using DSWeb.SoftMng.Filter; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsCodeLhCustRateController : Controller { // // GET: //[ModuleAuthFilter(Name = "modCodeBltype")]//权限过滤器 public ActionResult Index() { return View(); } public ActionResult LhCustCrStlDateIndex() { return View(); } // // GET: / public ActionResult Edit() { return View(); } // // GET: [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetDataList(string condition,string sort) { var dataList = MsCodeLhCustRateDAL.GetDataList(condition, 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) { CodeLhCustRate head = null; if (handle == "edit") { var list = MsCodeLhCustRateDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"])); if (list.Count > 0) head = list[0]; } if (head == null) { head = new CodeLhCustRate(); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult Save(string opstatus, string data) { var headData = JsonConvert.Deserialize(data); 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; DBResult result = modb.Save(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = MsCodeLhCustRateDAL.GetData("GID='" + GID + "'") }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult Delete(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 SaveDetail(string body) { var bodyList = JsonConvert.Deserialize>(body); DBResult result = MsCodeLhCustRateDAL.SaveDetail(bodyList,Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #region [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetLhCustCrStlDateDataList(string condition, string sort) { var dataList = MsCodeLhCustRateDAL.GetLhCustCrStlDateDataList(condition, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteLhCustCrStlDate(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 SaveLhCustCrStlDateDetail(string body) { var bodyList = JsonConvert.Deserialize>(body); DBResult result = MsCodeLhCustRateDAL.SaveLhCustCrStlDateDetail(bodyList, Convert.ToString(Session["USERID"])); 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 GetLhCustCrStlDateDataDetailList(string condition, string sort) { var dataList = MsCodeLhCustRateDAL.GetLhCustCrStlDateDataDetailList(condition, sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult DeleteCodeLhCustCrStlDateDetail(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 SaveLhCustCrStlDateBsSouceDetail(string body) { var bodyList = JsonConvert.Deserialize>(body); DBResult result = MsCodeLhCustRateDAL.SaveLhCustCrStlDateBsSouceDetail(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } #endregion #region 参照部分 #endregion } }