public void XSMXSave(T_THMXModels model) { int result = 0; try { if (model.Tag == "Add") { model.DataModel.FLAG = 2; result = T_THMXDomain.GetInstance().AddModel(model.DataModel); T_KC KCmodel = new T_KC(); KCmodel = T_KCDomain.GetInstance().GetKCid(model.DataModel.CKID); KCmodel.CPNUM = KCmodel.CPNUM + 1; T_KCDomain.GetInstance().UpdateModel(KCmodel, KCmodel.CKID); } else if (model.Tag == "Edit") { model.DataModel.FLAG = 2; result = T_THMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.CPID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_THMX/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void GetCkByCPPH(string cpid, string ckid) { string result1 = ""; Dictionary <string, string> dict = new Dictionary <string, string>(); try { StringBuilder result = new StringBuilder(); result.Append("[[\"\",\"请选择\"]"); //result.Append("["); if (string.IsNullOrEmpty(cpid) || string.IsNullOrEmpty(ckid)) { result.Append("]"); result1 = result.ToString(); } T_KC kc = new T_KC(); kc.CPID = int.Parse(cpid); kc.CKID = int.Parse(ckid); var list = T_KCDomain.GetInstance().GetAllT_KC(kc); foreach (var item in list) { result.Append(",["); result.Append("\"" + item.CPPH + "\","); result.Append("\"" + item.CPPH + "\""); result.Append("]"); } result.Append("]"); result1 = result.ToString(); } catch (Exception ex) { } Response.ContentType = "text/json"; Response.Write(result1); }
public void Save(T_KCModels model) { int result = 0; try { if (model.Tag == "Add") { result = T_KCDomain.GetInstance().AddModel(model.DataModel); } else if (model.Tag == "Edit") { result = T_KCDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.CKID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"closeCurrentReloadTab\",\"forwardUrl\":\"/T_KC/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Save(System.Int32 id, string tag) { //加载购买商商企业列表 T_YLCPModels ylcpQymode = new T_YLCPModels(); ylcpQymode.DataModel = ylcpQymode.DataModel ?? new T_YLCP(); ylcpQymode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpQymode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList(); ViewData["YLCP"] = new SelectList(ylcpQymode.DataList, "CPID", "CPMC"); //加载购买商商企业列表 T_CKModels ckmode = new T_CKModels(); ckmode.DataModel = ckmode.DataModel ?? new T_CK(); ckmode.DataList = T_CKDomain.GetInstance().GetAllT_CK(ckmode.DataModel); ViewData["CK"] = new SelectList(ckmode.DataList, "CKID", "CKMC"); T_KCModels model = new T_KCModels(); model.DataModel = new T_KC(); if (id != 0) { model.DataModel = T_KCDomain.GetInstance().GetModelById(id); } model.Tag = tag; return(View("~/Views/T_KC/Save.cshtml", model)); }
public void Delete(System.Int32 id) { int result = T_KCDomain.GetInstance().DeleteModelById(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_KC/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void GetCkByCPID(string id) { string result1 = ""; Dictionary <string, string> dict = new Dictionary <string, string>(); try { StringBuilder result = new StringBuilder(); result.Append("[[\"\",\"请选择\"]"); //result.Append("["); if (string.IsNullOrEmpty(id)) { result.Append("]"); result1 = result.ToString(); } T_KC kc = new T_KC(); kc.CPID = int.Parse(id); var list = T_KCDomain.GetInstance().GetAllT_KC(kc); if (list != null && list.Count > 0) { Hashtable ht = new Hashtable(); foreach (var item in list) { if (!ht.ContainsKey(item.T_CK.CKID)) { ht.Add(item.T_CK.CKID, item.T_CK.CKMC); } } foreach (var key in ht.Keys) { result.Append(",["); result.Append("\"" + key + "\","); result.Append("\"" + ht[key].ToString() + "\""); result.Append("]"); } } result.Append("]"); result1 = result.ToString(); } catch (Exception ex) { } Response.ContentType = "text/json"; Response.Write(result1); }
public void Delete(System.Int32 id) { Expression <Func <T_RKMX, bool> > where = p => (p.CKID == id); var lst = T_RKMXDomain.GetInstance().GetAllModels <int>(where); if (lst != null && lst.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有入库数据,不能删除!\"}"); return; } Expression <Func <T_CKMX, bool> > whereCKMX = p => (p.CKID == id); var lstCKMX = T_CKMXDomain.GetInstance().GetAllModels <int>(whereCKMX); if (lstCKMX != null && lstCKMX.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有出库数据,不能删除!\"}"); return; } Expression <Func <T_KC, bool> > whereKC = p => (p.CKID == id); var lstKC = T_KCDomain.GetInstance().GetAllModels <int>(whereKC); if (lstKC != null && lstKC.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该仓库已有库存数据,不能删除!\"}"); return; } int result = T_CKDomain.GetInstance().DeleteModelById(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CK/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public JsonResult GetKCInfo(int ckid, int cpid, string cpph) { var mlist = T_KCDomain.GetInstance().GetAllModels <int>(p => p.CKID == ckid && p.CPID == cpid && p.CPPH == cpph); if (mlist != null && mlist.Count > 0) { var mkc = mlist.First(); if (mkc != null) { string resultStr = JsonConvert.SerializeObject(new { CKGLY = mkc.T_CK.CKGLY, KCNUM = mkc.CPNUM }); return(Json(resultStr)); } } T_CK ck = T_CKDomain.GetInstance().GetModelById(ckid); if (ck != null) { string resultStr = JsonConvert.SerializeObject(new { CKGLY = ck.CKGLY, KCNUM = 0 }); return(Json(resultStr)); } return(Json("")); }
public JsonResult GetCPByCPPH(string cpid, string ckid, string cpph) { if (string.IsNullOrEmpty(cpid) || string.IsNullOrEmpty(ckid) || string.IsNullOrEmpty(cpph)) { return(Json("")); } T_KC kc = new T_KC(); kc.CPID = int.Parse(cpid); kc.CKID = int.Parse(ckid); kc.CPPH = cpph; var list = T_KCDomain.GetInstance().GetAllT_KC(kc); if (list.Count > 0) { T_KC kcp = list[0]; string resultStr = JsonConvert.SerializeObject(new { CPBH = (kcp.T_YLCP != null && kcp.T_YLCP.CPBH != null) ? kcp.T_YLCP.CPBH : "", SupMC = (kcp.T_SupQY1 != null && !string.IsNullOrEmpty(kcp.T_SupQY1.SupMC)) ? kcp.T_SupQY1.SupMC : "", CPGG = (kcp.T_YLCP != null && kcp.T_YLCP.CPGG != null) ? kcp.T_YLCP.CPGG : "", CPXH = (kcp.T_YLCP != null && kcp.T_YLCP.CPXH != null) ? kcp.T_YLCP.CPXH : "", CPDW = (kcp.T_YLCP != null && kcp.T_YLCP.CPDW != null) ? kcp.T_YLCP.CPDW : "", CPNUM = kcp.CPNUM ?? 0, CPSCRQ = kcp.CPSCRQ.HasValue ? kcp.CPSCRQ.Value.ToString("yyyy/MM/dd") : "", CPYXQ = kcp.CPYXQ.HasValue ? kcp.CPYXQ.Value.ToString("yyyy/MM/dd") : "", CPZCZ = (kcp.T_YLCP != null && kcp.T_YLCP.CPZCZ != null) ? kcp.T_YLCP.CPZCZ : "", SupXKZBH = (kcp.T_SupQY1 != null && kcp.T_SupQY1.SupXKZBH != null) ? kcp.T_SupQY1.SupXKZBH : "" }); return(Json(resultStr)); } else { return(Json("")); } }
public ActionResult Index(T_KCModels evalModel) { try { evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string ckid = ""; string qyid = ""; string cpid = ""; string order = ""; try { order = Request["orderField"].ToString(); } catch { } if (order.Trim() == "${param.orderField}") { order = ""; } //加载购买商商企业列表 T_YLCPModels ylcpQymode = new T_YLCPModels(); ylcpQymode.DataModel = ylcpQymode.DataModel ?? new T_YLCP(); ylcpQymode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpQymode.DataModel).Where(p => p.CPStatus == Convert.ToInt32("1")).ToList(); ViewData["YLCP"] = new SelectList(ylcpQymode.DataList, "CPID", "CPMC"); //加载购买商商企业列表 T_CKModels ckmode = new T_CKModels(); ckmode.DataModel = ckmode.DataModel ?? new T_CK(); ckmode.DataList = T_CKDomain.GetInstance().GetAllT_CK(ckmode.DataModel); ViewData["CK"] = new SelectList(ckmode.DataList, "CKID", "CKMC"); //加载产品生产企业 T_SupQYModels qymode = new T_SupQYModels(); qymode.DataModel = qymode.DataModel ?? new T_SupQY(); qymode.DataList = T_SupQYDomain.GetInstance().GetAllT_SupQY(qymode.DataModel).Where(p => p.SupStatus == 1).ToList(); ViewData["QY"] = new SelectList(qymode.DataList, "SupID", "SupMC"); int pagesize = Convert.ToInt32(evalModel.pageSize); int pagecount = Convert.ToInt32(evalModel.pagecount); int currentPage = Convert.ToInt32(evalModel.currentPage); evalModel.DataModel = evalModel.DataModel ?? new T_KC(); if (Request["CKList"] != null) { ckid = Request["CKList"].ToString(); if (!String.IsNullOrEmpty(ckid)) { evalModel.DataModel.CKID = Convert.ToInt16(ckid); } } if (Request["CPList"] != null) { cpid = Request["CPList"].ToString(); if (!String.IsNullOrEmpty(cpid)) { evalModel.DataModel.CPID = Convert.ToInt16(cpid); } } if (Request["QYList"] != null) { qyid = Request["QYList"].ToString(); if (!String.IsNullOrEmpty(qyid)) { evalModel.DataModel.ScqyID = Convert.ToInt16(qyid); } } var supid = ""; if (Request["strKCSupQY"] != null) { supid = Request["strKCSupQY"].ToString(); if (!String.IsNullOrEmpty(supid)) { evalModel.DataModel.SupID = Convert.ToInt16(supid); } } ViewData["CKList"] = ckid; ViewData["CPList"] = cpid; ViewData["QYList"] = qyid; ViewData["strKCSupQY"] = supid; evalModel.DataList = T_KCDomain.GetInstance().PageT_KC(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount); evalModel.resultCount = resultCount; return(View("~/Views/T_KC/Index.cshtml", evalModel)); }