public ActionResult AjaxCreate(ContactRequireViewModel model) { ServiceResult result = new ServiceResult(); if (!ModelState.IsValid) { result.Message = "表单输入有误,请仔细填写表单!"; result.AddServiceError("表单输入有误,请仔细填写表单!"); } else { try { ContactRequireService.Create(model); result.Message = "追加回复成功!"; } catch (Exception ex) { result.Message = "追加回复失败!"; result.AddServiceError(Utilities.GetInnerMostException(ex)); LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "追加回复失败!", ex); } } return Json(result); }
public ActionResult AjaxCreate(int ID) { var currentModel = ContactRequireService.Find(ID); var model = new ContactRequireViewModel() { CompanyID = currentModel.CompanyID, DepartmentID = currentModel.DepartmentID, IsRoot = 0, ResolveID = currentModel.ResolveID, SenderID = currentModel.SenderID, Name = "回复:" + currentModel.Name, PID = ID }; return PartialView(model); }
public ActionResult Edit(CustomerCompanyViewModel model) { ServiceResult result = new ServiceResult(); TempData["Service_Result"] = result; if (!ModelState.IsValid) { result.Message = "表单输入有误,请仔细填写表单!"; result.AddServiceError("表单输入有误,请仔细填写表单!"); } else { try { CustomerCompanyService.Update(model); //标记为已合作客户 if (model.CustomerCateID == 5) { var contact = new ContactRequireViewModel() { CompanyID = model.ID, //财务部 DepartmentID = 8, Name = model.Name + "财务合同请求", Description = model.Name + "财务合同请求", SenderID = CookieHelper.MemberID, IsRoot = 1 }; ContactRequireService.Create(contact); } result.Message = "编辑客户成功!"; return RedirectToAction("index"); } catch (Exception ex) { result.Message = "编辑客户失败!"; result.AddServiceError(Utilities.GetInnerMostException(ex)); LogHelper.WriteLog("用户:" + CookieHelper.MemberID + "编辑客户失败!", ex); } } ViewBag.Data_RelationID = Utilities.GetSelectListData(RelationCateService.GetALL(), x => x.ID, x => x.CateName, model.RelationID, true); ViewBag.Data_CustomerCateID = Utilities.GetSelectListData(CustomerCateService.GetALL(), x => x.ID, x => x.CateName, model.CustomerCateID, true); return View(model); }