using System; using System.Linq; using System.Web.Mvc; using DSWeb.TruckMng.DAL.MsCustTruckConsignee; using DSWeb.TruckMng.Models.CodeTruckConsignee; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using System.Collections.Generic; using HcUtility.Comm; using System.Data; using DSWeb.Areas.RptMng.Comm; using DSWeb.Areas.CommMng.DAL; using System.Text; namespace DSWeb.Areas.TruckMng.Controllers { [JsonRequestBehavior] public class MsCustTruckConsigneeController : Controller { // // GET: public ActionResult Index() { return View(); } // // GET: / public ActionResult Edit() { return View(); } // // GET: public ContentResult GetDataList(int start, int limit, string sort, string condition) { var dataList = MsCustTruckConsigneeDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]), sort); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetDataListRm(string CODENAME = "", string condition = "") { if (CODENAME == "") { } else { if (condition.Trim() == "") condition = " CONSIGNEENAME like '%" + CODENAME + "%' "; else condition = condition + " and CONSIGNEENAME like '%" + CODENAME + "%' "; } var dataList = MsCustTruckConsigneeDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"])); 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 GetData(string handle, string condition) { CodeTruckConsignee head = null; if (handle == "edit") { var list = MsCustTruckConsigneeDAL.GetDataList(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"])); if (list.Count > 0) head = list[0]; } if (head == null) { head = new CodeTruckConsignee(); head.CREATEUSER = Convert.ToString(Session["USERID"]); head.CREATEUSERREF = Convert.ToString(Session["SHOWNAME"]); } var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = head }); return new ContentResult() { Content = json }; } public ContentResult Save(string data) { var bodyList = JsonConvert.Deserialize>(data); DBResult result = MsCustTruckConsigneeDAL.SaveDetail(bodyList, Convert.ToString(Session["USERID"])); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult Delete(string data) { var headData = JsonConvert.Deserialize(data); DBResult result = MsCustTruckConsigneeDAL.DeleteDetail(headData); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } public ContentResult GetTruckList(string condition, string CODENAME = "") { if (CODENAME == "") { } else { if (string.IsNullOrEmpty(condition)) condition = " TRUCKNO like '%" + CODENAME + "%' "; else condition = condition + " and TRUCKNO like '%" + CODENAME + "%' "; } var strSql = new StringBuilder(); strSql.Append("SELECT * FROM (SELECT DISTINCT P.DRIVER,P.TRUCKNO,P.DRIVERTEL FROM op_truck_bulk_pc p ) V "); if (!string.IsNullOrEmpty(condition)) { strSql.Append(" WHERE " + condition); } strSql.Append(" order by TRUCKNO "); var dbparams = new List(); var paramps_sSQL = new CustomDbParamter(); paramps_sSQL.ParameterName = "@sSQL"; paramps_sSQL.DbType = DbType.String; paramps_sSQL.Direction = ParameterDirection.Input; paramps_sSQL.Value = strSql.ToString(); dbparams.Add(paramps_sSQL); var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set"); var json = RptHelper.GetRptJsonResult(0, 100, dbRptResult, "Result_Set", true); return new ContentResult() { Content = json }; } #region 参照部分 #endregion } }