public JsonResult ExportExcel(ExcelModel eModel) { var curModel = new T_CGMX(); if (eModel.SCQYID != null) { T_SupQY qycp = new T_SupQY(); qycp.SupID = (int)eModel.SCQYID; curModel.T_SupQY1 = qycp; } if (eModel.CPID != null) { curModel.CPID = (int)eModel.CPID; } int pagesize = eModel.PageSize; int pagecount = 0; int currentPage = eModel.PageNum; var DataList = T_CGMXDomain.GetInstance().PageT_CGMX(curModel, eModel.StartDate, eModel.EndDate, currentPage, pagesize, out pagecount, out resultCount); var str = ExportExcelPR(DataList); //调用输出Excel表的方法 ExportToExcel("application/vnd.ms-excel", "采购汇总.xls", str); return(Json("true")); }
public JsonResult GetYLCPDetailsByMXID(int mxid) { var mxModel = T_CGMXDomain.GetInstance().GetModelById(mxid); if (mxModel != null) { T_YLCP cp = T_YLCPDomain.GetInstance().GetCpDetailsById(mxModel.CPID); if (cp != null) { string resultStr = JsonConvert.SerializeObject(new { CPID = cp.CPID, CPBH = cp.CPBH, SCQYMC = (cp.T_SupQY1 != null && !string.IsNullOrEmpty(cp.T_SupQY1.SupMC)) ? cp.T_SupQY1.SupMC : "", CPGG = cp.CPGG, CPXH = cp.CPXH, CPDW = cp.CPDW, XKZH = (cp.T_SupQY1 != null && !string.IsNullOrEmpty(cp.T_SupQY1.SupXKZBH)) ? cp.T_SupQY1.SupXKZBH : "", ZCZH = cp.CPZCZ, SCQYID = cp.CPSCQYID, CPPrice = cp.CPPrice, SUPQYID = cp.CPGYSID, SUPQYMC = (cp.T_SupQY != null && !string.IsNullOrEmpty(cp.T_SupQY.SupMC)) ? cp.T_SupQY.SupMC : "", XSJG = cp.XSJG, CPMC = cp.CPMC, CPNUM = mxModel.CPNUM }); return(Json(resultStr)); } } return(Json("")); }
public ActionResult Index(T_CGMXModels evalModel, string id) { try { evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string order = ""; try { order = Request["orderField"].ToString(); } catch { } if (order.Trim() == "${param.orderField}") { order = ""; } int pagesize = Convert.ToInt32(evalModel.pageSize); int pagecount = Convert.ToInt32(evalModel.pagecount); int currentPage = Convert.ToInt32(evalModel.currentPage); ViewBag.CGDID = id; evalModel.DataModel = evalModel.DataModel ?? new T_CGMX(); evalModel.DataList = T_CGMXDomain.GetInstance().PageT_CGMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount).Where(p => p.CGID == int.Parse(id)).ToList(); evalModel.resultCount = resultCount; return(View("~/Views/T_CGMX/Index.cshtml", evalModel)); }
public void Save(T_CGMXModels model) { int result = 0; string guid = string.Empty; try { if (model.Tag == "Add") { model.DataModel.GUID = Guid.NewGuid().ToString("N"); guid = model.DataModel.GUID; result = T_CGMXDomain.GetInstance().AddModelByCgdh(model.DataModel, model.CGDH); } else if (model.Tag == "Edit") { result = T_CGMXDomain.GetInstance().UpdateModel(model.DataModel, model.DataModel.MXID); } } catch { } Response.ContentType = "text/json"; if (result > 0) { string resultStr = JsonConvert.SerializeObject(new { statusCode = "200", message = "操作成功", guid = guid }); Response.Write(resultStr); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public void Delete(System.Int32 id) { //var rCode = GetRoleCode(); //if (rCode != "1") //{ var temp = T_YLCPDomain.GetInstance().GetModelById(id); if (temp != null && (temp.CPStatus == 1)) { Response.Write("{\"statusCode\":\"300\", \"message\":\"已审批通过的数据不能删除!\"}"); return; } //} Expression <Func <T_CGMX, bool> > whereCGD = p => (p.CPID == id); var lstCGMX = T_CGMXDomain.GetInstance().GetAllModels <int>(whereCGD); if (lstCGMX != null && lstCGMX.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该产品已存在与采购单,不能删除!\"}"); return; } T_YLCPModels model = new T_YLCPModels(); model.DataModel = new T_YLCP(); if (id != 0) { model.DataModel = T_YLCPDomain.GetInstance().GetModelById(id); } if (!string.IsNullOrEmpty(model.DataModel.CPTP)) { string filePath = Path.Combine(Server.MapPath("~/UploadFiles/"), "供货商产品图片", model.DataModel.CPTP); if (System.IO.File.Exists(filePath)) { System.IO.File.Delete(filePath); } } if (!string.IsNullOrEmpty(model.DataModel.CPFJ)) { string filePath1 = Path.Combine(Server.MapPath("~/UploadFiles/"), "供货商产品附件", model.DataModel.CPFJ); if (System.IO.File.Exists(filePath1)) { System.IO.File.Delete(filePath1); } } int result = T_YLCPDomain.GetInstance().DeleteModelById(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_YLCP/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Save(System.Int32 id, string tag) { T_CGDModels model = new T_CGDModels(); model.DataModel = new T_CGD(); CurUser = Session["UserModel"] as SysUser; //id是否为0,区分增加和修改功能 if (id != 0) { model.CGMXList = T_CGMXDomain.GetInstance().GetT_CGMXByCgid(id); model.DataModel = T_CGDDomain.GetInstance().GetModelById(id); } else { model.DataModel.CGDH = T_CGDDomain.GetInstance().GetCgOrderNum("CP", CurUser); model.DataModel.CGCJR = CurUser.UserAccount; model.DataModel.CGCJRQ = DateTime.Now; } //加载产品列表 //T_YLCPModels ylcpmode = new T_YLCPModels(); //ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP(); //ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel); //ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC"); //加载企业列表 T_SupQYModels supmode = new T_SupQYModels(); supmode.DataModel = supmode.DataModel ?? new T_SupQY(); supmode.DataList = T_SupQYDomain.GetInstance().GetAllT_SupQY(supmode.DataModel).Where(p => p.SupStatus == 1).ToList(); ViewData["SupID"] = new SelectList(supmode.DataList, "SupID", "SupMC"); //获取用户信息(包含单位ID) SysUser UserModel = Session["UserModel"] as SysUser; //获取本企业下的人员列表 T_Person person = new T_Person(); if (UserModel.UserCompanyID != null) { person.PsQYID = (int)UserModel.UserCompanyID; } ViewBag.Persons = new SelectList(T_PersonDomain.GetInstance().GetAllT_Person(person), "PsMZ", "PsMZ"); //Expression<Func<T_PackingUnit, bool>> where = PredicateBuilder.True<T_PackingUnit>(); //ViewBag.PackingUnit = new SelectList(T_PackingUnitDomain.GetInstance().GetAllModels<int>(where), "PUName", "PUName"); model.Tag = tag; model.RoleCode = GetRoleCode(); return(View("~/Views/T_CGD/Save.cshtml", model)); }
public ActionResult Save(System.Int32 id, string tag) { T_CGMXModels model = new T_CGMXModels(); model.DataModel = new T_CGMX(); Int32 did = id; if (tag != "Add") { model.DataModel = T_CGMXDomain.GetInstance().GetModelById(id); did = model.DataModel.CGID; } //加载产品列表 T_YLCPModels ylcpmode = new T_YLCPModels(); ylcpmode.DataModel = ylcpmode.DataModel ?? new T_YLCP(); ylcpmode.DataList = T_YLCPDomain.GetInstance().GetAllT_YLCP(ylcpmode.DataModel); ViewData["YLCP"] = new SelectList(ylcpmode.DataList, "CPID", "CPMC"); //加载企业列表 T_SupQYModels supmode = new T_SupQYModels(); supmode.DataModel = supmode.DataModel ?? new T_SupQY(); supmode.DataList = T_SupQYDomain.GetInstance().GetAllT_SupQY(supmode.DataModel).Where(p => p.SupStatus == 1).ToList(); ViewData["SupID"] = new SelectList(supmode.DataList, "SupID", "SupMC"); //加载采购单列表 T_CGDModels cgdQymode = new T_CGDModels(); cgdQymode.DataModel = cgdQymode.DataModel ?? new T_CGD(); T_CGD cgd = T_CGDDomain.GetInstance().GetModelById(did); cgdQymode.DataList = new List <T_CGD>(); cgdQymode.DataList.Add(cgd); ViewData["CGD"] = new SelectList(cgdQymode.DataList, "CGID", "CGDMC"); //if (id != 0) //{ // model.DataModel = T_CGMXDomain.GetInstance().GetModelById(id); //} model.Tag = tag; return(View("~/Views/T_CGMX/Save.cshtml", model)); }
public void Delete(string Guid) { int result = T_CGMXDomain.GetInstance().DeleteModelByGuid(Guid); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_CGD/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult CGMXTable(System.Int32 id, string cgdh, int canEdit, int isSH) { T_CGDModels model = new T_CGDModels(); model.DataModel = new T_CGD(); model.DataModel.ISSH = isSH; if (id != 0) { model.CGMXList = T_CGMXDomain.GetInstance().GetT_CGMXByCgid(id); } else { model.CGMXList = T_CGMXDomain.GetInstance().GetT_YSMXByCgdh(cgdh); } ViewBag.canEdit = canEdit; model.RoleCode = GetRoleCode(); return(View("~/Views/T_CGMX/CGMXTable.cshtml", model)); }
public ActionResult CGDSPIndex(System.Int32 id, string tag) { T_CGDModels model = new T_CGDModels(); model.DataModel = new T_CGD(); T_CGMX cgmodel = new T_CGMX(); if (id != 0) { model.DataModel = T_CGDDomain.GetInstance().GetModelById(id); model.CGMXList = T_CGMXDomain.GetInstance().GetAllT_CGMX(cgmodel); if (model.CGMXList.Count > 0) { model.CGMXList = model.CGMXList.Where(p => p.CGID == id).ToList(); } } model.Tag = tag; return(View("~/Views/T_CGD/CGDSPIndex.cshtml", model)); }
public void Delete(System.Int32 id) { //var rCode = GetRoleCode(); //if (rCode != "1") //{ var temp = T_SupQYDomain.GetInstance().GetModelById(id); if (temp != null && (temp.SupStatus == 1)) { Response.Write("{\"statusCode\":\"300\", \"message\":\"已审批通过的数据不能删除!\"}"); return; } //} Expression <Func <T_YLCP, bool> > where = p => (p.CPGYSID == id || p.CPSCQYID == id); var list = T_YLCPDomain.GetInstance().GetAllModels <int>(where); if (list != null && list.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该企业下已有产品,不能删除!\"}"); return; } Expression <Func <T_CGMX, bool> > whereCGD = p => (p.SupID == id || p.CPSCQYID == id); var lstCGMX = T_CGMXDomain.GetInstance().GetAllModels <int>(whereCGD); if (lstCGMX != null && lstCGMX.Count > 0) { Response.Write("{\"statusCode\":\"300\", \"message\":\"该企业下已有采购单,不能删除!\"}"); return; } int result = T_SupQYDomain.GetInstance().Delete(id); Response.ContentType = "text/json"; if (result > 0) { Response.Write("{\"statusCode\":\"200\", \"message\":\"操作成功\",\"callbackType\":\"forward\",\"forwardUrl\":\"/T_SupQY/Index\"}"); } else { Response.Write("{\"statusCode\":\"300\", \"message\":\"操作失败\"}"); } }
public ActionResult Details(ExcelModel eModel) { var curModel = new T_CGMX(); if (eModel.SCQYID != null) { T_SupQY qycp = new T_SupQY(); qycp.SupID = (int)eModel.SCQYID; curModel.T_SupQY1 = qycp; } if (eModel.CPID != null) { curModel.CPID = (int)eModel.CPID; } int pagesize = eModel.PageSize; int pagecount = 0; int currentPage = eModel.PageNum; var DataList = T_CGMXDomain.GetInstance().PageT_CGMX(curModel, eModel.StartDate, eModel.EndDate, currentPage, pagesize, out pagecount, out resultCount); ViewData["ParaStr"] = ExportExcelPR(DataList); return(View("~/Views/T_CGHZ/Details.cshtml", eModel)); }
public int resultCount = 0; // 总条数 // GET: T_CGHZ public ActionResult Index(T_CGMXModels evalModel) { try { evalModel.currentPage = int.Parse(Request["pageNum"].ToString()); } catch { } string order = ""; string qyid = ""; try { order = Request["orderField"].ToString(); } catch { } if (order.Trim() == "${param.orderField}") { order = ""; } evalModel.DataModel = evalModel.DataModel ?? new T_CGMX(); //加载产品生产企业 T_SupQYModels qymode = new T_SupQYModels(); qymode.DataModel = qymode.DataModel ?? new T_SupQY(); qymode.DataList = T_SupQYDomain.GetInstance().GetAllT_SupQY(qymode.DataModel); ViewData["QY"] = new SelectList(qymode.DataList, "SupID", "SupMC"); if (Request["QYList"] != null) { qyid = Request["QYList"].ToString(); if (!String.IsNullOrEmpty(qyid)) { T_SupQY qycp = new T_SupQY(); qycp.SupID = int.Parse(qyid); evalModel.DataModel.T_SupQY1 = qycp; } } ViewData["QYList"] = qyid; Expression <Func <T_YLCP, bool> > where = PredicateBuilder.True <T_YLCP>(); var lst = T_YLCPDomain.GetInstance().GetAllModels <int>(where); ViewData["CGHZ_YLCP"] = new SelectList(lst, "CPID", "CPMC"); var cpid = ""; if (Request["CGHZ_CPID"] != null) { cpid = Request["CGHZ_CPID"].ToString(); if (!String.IsNullOrEmpty(cpid)) { evalModel.DataModel.CPID = int.Parse(cpid); } } ViewData["CGHZ_CPID"] = cpid; int pagesize = Convert.ToInt32(evalModel.pageSize); int pagecount = Convert.ToInt32(evalModel.pagecount); int currentPage = Convert.ToInt32(evalModel.currentPage); evalModel.DataModel = evalModel.DataModel ?? new T_CGMX(); evalModel.DataList = T_CGMXDomain.GetInstance().PageT_CGMX(evalModel.DataModel, evalModel.StartTime, evalModel.EndTime, currentPage, pagesize, out pagecount, out resultCount); evalModel.resultCount = resultCount; var totalNum = 0; if (evalModel.DataList != null && evalModel.DataList.Count > 0) { evalModel.DataList.ForEach(p => { totalNum += p.CPNUM == null ? 0 : (int)p.CPNUM; }); } ViewBag.TotalNum = totalNum; return(View("~/Views/T_CGHZ/Index.cshtml", evalModel)); }