public ActionResult AddContract(string id) { ViewBag.Classify = ListToSelect(SysDataDictService.GetContractClassify().Select(o => new SelectListItem() { Value = o.DicSN.ToString(), Text = o.Title }), emptyTitle: "请选择"); //ViewBag.Suppliers = ListToSelect(SupplierService.GetList().Where(o => o.BusinessType == 1 && o.MasterState == 1).Select(o => new SelectListItem() { Value = o.Id, Text = o.FullTitle })); var obj = new Logic.Entity.Contract(); obj.ContractBoths = new List <Logic.Entity.ContractBoth>() { new Logic.Entity.ContractBoth(), new Logic.Entity.ContractBoth() }; var curr = DateTime.Now; obj.SigningDate = curr.ToString("yyyy-MM-dd"); //obj.ContractSN = ContractBLL.CreateContractSN(); ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0"); if (!id.IsNullOrEmpty()) { obj = ContractSerivce.FindById(id); ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0"); if (obj == null) { throw new ArgumentException("传入参数不正确!"); } } return(View(obj)); }
//查看合同(合同状态为已审核、已中止、已结束状态) public ActionResult ContractDetail(string id) { var obj = ContractSerivce.FindById(id); obj.IsNullThrow(); ViewBag.Version = (obj.Version == 1) ? ("新增 v" + obj.Version + ".0") : ("续签 v" + obj.Version + ".0"); var supp = SupplierService.Find(o => o.Id == obj.SupplierId); if (supp != null) { obj.SupplierTitle = supp.Title; } var classify = SysDataDictService.Find(o => o.DicSN == obj.ClassifyId); if (classify != null) { ViewData["Classify"] = classify.Title; } return(View(obj)); }