public AjaxMessage ReInviteEmployee(string employeeId, string customerId) { AjaxMessage ajax = new AjaxMessage(); ajax.IsSuccess = false; try { if (!string.IsNullOrEmpty(employeeId)) { int empId = employeeId.ToInt32(); if (customerId.Contains(",")) //批量改派 { string[] customer = customerId.Split(','); List <string> cus_list = new List <string>(); for (int i = 0; i < customer.Length; i++) { cus_list.Add(customer[i]); } #region 邀约表 //修改实体类(邀约表) FL_Invite m_invite = new FL_Invite(); m_invite.EmployeeId = empId; //条件 Expression <Func <FL_Invite, bool> > where = c => cus_list.Contains(c.CustomerID.ToString()); //修改字段 string prop = "EmployeeId"; string[] property = new string[] { prop };; #endregion #region 统计表 //修改实体类(统计表) SS_Report m_report = new SS_Report(); m_report.InviteEmployee = m_invite.EmployeeId; //条件 Expression <Func <SS_Report, bool> > wheres = c => cus_list.Contains(c.CustomerId.ToString()); //修改字段 string props = "InviteEmployee"; string[] propertys = new string[] { props }; #endregion using (TransactionScope scope = new TransactionScope()) { _inviteService.ModifyBy(m_invite, where, property); _reportService.ModifyBy(m_report, wheres, propertys); scope.Complete(); } ajax.IsSuccess = true; ajax.Message = "改派成功"; } else { FL_Invite m_invite = _inviteService.GetByCustomerId(new Guid(customerId)); m_invite.EmployeeId = empId; SS_Report m_report = _reportService.GetByCustomerId(new Guid(customerId)); m_report.InviteEmployee = empId; using (TransactionScope scope = new TransactionScope()) { _inviteService.Update(m_invite); _reportService.Update(m_report); scope.Complete(); } ajax.IsSuccess = true; ajax.Message = "改派成功"; } } } catch (Exception e) { ajax.Message = e.Message; } return(ajax); }