public ActionResult Delete(string idList) { var json = new JsonHelper() { Status = "n", Msg = "删除客户成功" }; try { //是否为空 if (string.IsNullOrEmpty(idList)) { json.Msg = "未找到要删除的客户"; return(Json(json)); } var id = idList.Trim(',').Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries).Select(p => int.Parse(p)).ToList(); using (TransactionScope ts = new TransactionScope()) { try { foreach (var item in id) { //删除客户公司简介 var entity = BussinessCustomerManage.Get(p => p.ID == item); ContentManage.Delete(p => p.FK_RELATIONID == entity.FK_RELATIONID && p.FK_TABLE == "SYS_BUSSINESSCUSTOMER"); } //删除客户信息 BussinessCustomerManage.Delete(p => id.Contains(p.ID)); WriteLog(Common.Enums.enumOperator.Remove, "删除客户:" + json.Msg, Common.Enums.enumLog4net.WARN); ts.Complete(); } catch (Exception e) { json.Msg = "删除客户发生内部错误!"; WriteLog(Common.Enums.enumOperator.Remove, "删除客户:", e); } } } catch (Exception e) { json.Msg = "删除客户发生内部错误!"; WriteLog(Common.Enums.enumOperator.Remove, "删除客户:", e); } return(Json(json)); }
public ActionResult Detail(int?id) { //初始化客户 var entity = new Domain.SYS_BUSSINESSCUSTOMER() { ChargePersionSex = 1 }; if (id != null && id > 0) { //客户实体 entity = BussinessCustomerManage.Get(p => p.ID == id); //公司介绍 ViewData["CompanyInstroduce"] = ContentManage.Get(p => p.FK_RELATIONID == entity.FK_RELATIONID && p.FK_TABLE == "SYS_BUSSINESSCUSTOMER") ?? new Domain.COM_CONTENT(); } //客户类型 ViewBag.KHLX = this.CodeManage.LoadAll(p => p.CODETYPE == "LXRLX").OrderBy(p => p.SHOWORDER).ToList(); return(View(entity)); }