using System; using System.Linq; using System.Web.Mvc; using System.Collections.Generic; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.Import.DAL; using DSWeb.Areas.Import.DAL.CargoName; using DSWeb.Areas.Import.Models.CargoName; using DSWeb.TruckMng.Comm.Cookie; using DSWeb.TruckMng.Helper; using HcUtility.Comm; using HcUtility.Core; using DSWeb.TruckMng.Helper.Repository; using DSWeb.SoftMng.Filter; namespace DSWeb.Areas.Import.Controllers { /// /// /// [JsonRequestBehavior] public class CargoNameController : Controller { // // GET: /Import/cargoinfo/ public ActionResult Index() { return View(); } // // GET: /Import/cargoinfo/Edit public ActionResult Edit() { return View(); } // // GET:/Import/cargoinfo/GetDataList [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetFactoryNoList(int start, int limit, string sort, string condition) { var dataList = CargoNameDAL.GetFactoryNoList(condition); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } [SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器 public ContentResult GetCargoNameList(int start, int limit, string sort, string condition) { var dataList = CargoNameDAL.GetCargoNameList(condition); var list = dataList.Skip(start).Take(limit); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() }); return new ContentResult() { Content = json }; } // // GET:/Import/Cargoinfo/GetData/ // // GET:/Import/CargoInfo/Save public ContentResult Save(string CLIENTGID, string FactoryNobody, string FactoryNoDelbody , string CargoNamebody, string CargoNameDelbody) { var FactoryNoList = JsonConvert.Deserialize>(FactoryNobody); var FactoryNoDelList = JsonConvert.Deserialize>(FactoryNoDelbody); var CargoNameList = JsonConvert.Deserialize>(CargoNamebody); var CargoNameDelList = JsonConvert.Deserialize>(CargoNameDelbody); var modb = new ModelObjectRepository(); DBResult result = modb.SaveComm("CLIENTGID", CLIENTGID, ModelObjectConvert.ToModelObjectList(FactoryNoList), ModelObjectConvert.ToModelObjectList(FactoryNoDelList), ModelObjectConvert.ToModelObjectList(CargoNameList), ModelObjectConvert.ToModelObjectList(CargoNameDelList) ); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message/*, Data = CargoinfoDAL.GetHeadDataByBillNo(Convert.ToString(headData.ID))*/ }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetGoodCode ( string CLIENTGID) { var _count = 0; _count = CargoNameDAL.GetGoodCode(CLIENTGID,Session["USERID"].ToString()); var jsonRespose = new JsonResponse { Success = true, Message = ""/*, Data = CargoinfoDAL.GetHeadDataByBillNo(Convert.ToString(headData.ID))*/ }; if (_count>0){ jsonRespose.Success=true; }else{ jsonRespose.Success=false; } return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } // // GET:/Import/Cargoinfo/Delete /* 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 GetBodyList(int cargoid) { var condition = " CargoinfoID="+cargoid; List list = CargoinfoDAL.GetBodyList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = list.Count, data = list.ToList() }); return new ContentResult() { Content = json }; }*/ #region 参照部分 #endregion } }