public ActionResult UpdateCcontract(合同记录 model) { if (!ModelState.IsValid) { return(Content(string.Format("2004".GetMessage(), model.合同编号))); } 合同记录 updmodel = MSSQLManager.GetDmodel().合同记录.FirstOrDefault(c => c.id == model.id); return(MSSQLManager.getMsslManager().UpdateModel(model, updmodel, IEnumMessageCode.uppdateSuccess, model.合同编号)); }
public ActionResult AddC_contract(合同记录 model) { if (model.签订时间 != null && ModelState.IsValid) { model.合同编号 = GetContractId(model); return(MSSQLManager.getMsslManager().SaveModel(model, EntityState.Added, IEnumMessageCode.addSucess, model.合同编号)); } else { return(PartialView()); } }
private string GetContractId(合同记录 model) { StringBuilder id = new StringBuilder(); id.Append(MSSQLManager.GetDmodel().合同类别.FirstOrDefault(c => c.id == model.合同类别).code.Trim()); id.Append(MSSQLManager.GetDmodel().区域代码.FirstOrDefault(c => c.id == model.合同区域).code.Trim()); id.Append(model.签订时间.Value.Year); int count = 1; List <合同记录> list = MSSQLManager.GetDmodel().合同记录.Where(c => c.合同类别 == model.合同类别 && c.合同区域 == model.合同区域).ToList <合同记录>(); if (list != null && list.Count > 0) { count = list.Count + 1; } id.Append(count.ToString().PadLeft(4, '0')); return(id.ToString()); }
private string GetContractId(合同记录 model) { StringBuilder id = new StringBuilder(); id.Append(DB.Context.From <合同类别>().Where(c => c.id == model.合同类别).First().code.Trim()); id.Append(DB.Context.From <区域代码>().Where(c => c.id == model.合同区域).First().code.Trim()); id.Append(model.签订时间.Value.Year); int count = 1; List <合同记录> list = DB.Context.From <合同记录>().Where(c => c.合同类别 == model.合同类别 && c.合同区域 == model.合同区域).ToList <合同记录>(); if (list != null && list.Count > 0) { count = list.Count + 1; } id.Append(count.ToString().PadLeft(4, '0')); return(id.ToString()); }
public ActionResult AddContract(合同记录 model) { if (string.IsNullOrEmpty(model.甲方)) { List <合同类别> contracttypes = DB.Context.From <合同类别>().ToList(); List <区域代码> contracttareas = DB.Context.From <区域代码>().ToList(); ViewBag.contracttypes = contracttypes; ViewBag.contracttareas = contracttareas; return(View()); } model.合同编号 = GetContractId(model); if (DB.Context.Insert <合同记录>(model) > 0) { return(Json(new { title = "成功", message = "成功添加角色:" + model.甲方 })); } return(Json(new { title = "失败", message = "未能添加角色:" + model.甲方 })); }
public ActionResult UpdateContract(合同记录 model) { if (string.IsNullOrEmpty(model.甲方)) { 合同记录 oldmodel = DB.Context.From <合同记录>().Where(c => c.id == model.id).First(); List <合同类别> contracttypes = DB.Context.From <合同类别>().ToList(); List <区域代码> contracttareas = DB.Context.From <区域代码>().ToList(); ViewBag.contracttypes = contracttypes; ViewBag.contracttareas = contracttareas; return(View(oldmodel)); } if (DB.Context.Update <合同记录>(model) > 0) { return(Json(new { title = "成功", message = "成功修改合同甲方:" + model.甲方 })); } return(Json(new { title = "失败", message = "修改失败合同甲方:" + model.甲方 })); }
public ActionResult DelContracts(long id) { 合同记录 model = MSSQLManager.GetDmodel().合同记录.FirstOrDefault(c => c.id == id); return(MSSQLManager.getMsslManager().SaveModel(model, EntityState.Deleted, IEnumMessageCode.DeleteSuccess, model.合同编号, IEnumMessageCode.back, "ListContracts")); }