private string GetMailAuditInfoByExchange(HttpContext context) { string strJsonResult = string.Empty; string userAccount = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); Guid transactionid = Guid.NewGuid(); string funname = "GetMailAuditInfoByExchange"; try { do { string strAccesstoken = context.Request["accessToken"]; //判断AccessToken if (string.IsNullOrEmpty(strAccesstoken)) { error.Code = ErrorCode.TokenEmpty; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } AdminInfo admin = new AdminInfo(); if (!TokenManager.ValidateUserToken(transactionid, strAccesstoken, out admin, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); break; } Stream str = context.Request.InputStream; // Find number of bytes in stream. Int32 strLen = Convert.ToInt32(str.Length); // Create a byte array. byte[] strArr = new byte[strLen]; // Read stream into byte array. str.Read(strArr, 0, strLen); string body = System.Text.Encoding.UTF8.GetString(strArr); MailAuditInfo info = JsonConvert.DeserializeObject <MailAuditInfo>(body); MailAuditManager manager = new MailAuditManager(ClientIP); manager.GetMailAuditInfoByExchange(transactionid, admin, info, out strJsonResult); } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAudit.ashx调用接口GetMailAuditInfoByExchange异常", context.Request.RawUrl, ex.ToString(), transactionid); LoggerHelper.Info(userAccount, funname, context.Request.RawUrl, Convert.ToString(error.Code), false, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); } return(strJsonResult); }
public bool GetMailAuditInfo(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"ID:{mailAuditInfo.ID}"; string funname = "GetMailAuditInfo"; try { do { MailAuditDBProvider Provider = new MailAuditDBProvider(); if (!Provider.GetMailAuditInfo(transactionid, admin, ref mailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } error.Code = ErrorCode.None; string json = JsonConvert.SerializeObject(mailAuditInfo); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info, json); result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用GetMailAuditInfo异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public bool DeleteMailAudit(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out ErrorCodeInfo error) { error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||ID:{mailAuditInfo.ID}"; string strError = string.Empty; bool bResult = true; try { CParameters paras = new CParameters(); SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID); paras.Add(paraAdminID); SqlParameter paraID = new SqlParameter("@ID", mailAuditInfo.ID); paras.Add(paraID); CBaseDB _db = new CBaseDB(Conntection.strConnection); do { DataSet ds = new DataSet(); if (!_db.ExcuteByTransaction(paras, "dbo.[prc_DeleteMailAudit]", out ds, out strError)) { strError = "DeleteMailAudit异常,Error:" + strError; LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, strError, transactionid); bResult = false; error.Code = ErrorCode.SQLException; break; } if (ds != null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { int iResult = 0; iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]); switch (iResult) { case 1: bResult = true; break; case -1: bResult = false; error.Code = ErrorCode.HaveSameGroup; break; case -9999: bResult = false; error.Code = ErrorCode.SQLException; LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, "-9999", transactionid); break; default: bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid); } } while (false); } catch (Exception ex) { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAuditDBProvider调用DeleteMailAudit异常", string.Empty, ex.ToString(), transactionid); } return(bResult); }
public bool GetMailAuditInfo(Guid transactionid, AdminInfo admin, ref MailAuditInfo mailAuditInfo, out ErrorCodeInfo error) { error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||ID:{mailAuditInfo.ID}"; string strError = string.Empty; bool bResult = true; try { CParameters paras = new CParameters(); SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID); paras.Add(paraAdminID); SqlParameter paraID = new SqlParameter("@ID", mailAuditInfo.ID); paras.Add(paraID); CBaseDB _db = new CBaseDB(Conntection.strConnection); do { DataSet ds = new DataSet(); if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailAuditInfo]", out ds, out strError)) { strError = "GetMailAuditInfo异常,Error:" + strError; LoggerHelper.Error("MailAuditDBProvider调用GetMailAuditInfo异常", paramstr, strError, transactionid); bResult = false; error.Code = ErrorCode.SQLException; break; } if (ds != null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { int iResult = 0; iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]); switch (iResult) { case 1: bResult = true; if (ds.Tables.Count > 1) { DataRow sdr = ds.Tables[1].Rows[0]; mailAuditInfo.ID = Guid.Parse(Convert.ToString(sdr["ID"])); mailAuditInfo.Group.GroupID = Guid.Parse(Convert.ToString(sdr["GroupID"])); mailAuditInfo.Group.DisplayName = Convert.ToString(sdr["GroupName"]); mailAuditInfo.Group.Account = Convert.ToString(sdr["GroupAccount"]); mailAuditInfo.CreateTime = Convert.ToDateTime(sdr["CreateTime"]); mailAuditInfo.UpdateTime = Convert.ToDateTime(sdr["UpdateTime"]); mailAuditInfo.CreateUserID = Guid.Parse(Convert.ToString(sdr["CreateUserID"])); mailAuditInfo.RoleID = Guid.Parse(Convert.ToString(sdr["RoleID"])); foreach (DataRow dr in ds.Tables[2].Rows) { UserInfo user = new UserInfo(); user.UserID = Guid.Parse(Convert.ToString(dr["UserID"])); user.DisplayName = Convert.ToString(dr["DisplayName"]); user.UserAccount = Convert.ToString(dr["Account"]); mailAuditInfo.Audits.Add(user); mailAuditInfo.AuditUsers += user.DisplayName + "(" + user.UserAccount + "),"; } mailAuditInfo.AuditUsers = mailAuditInfo.AuditUsers.Remove(mailAuditInfo.AuditUsers.LastIndexOf(','), 1); } break; case -1: bResult = false; error.Code = ErrorCode.HaveSameOu; break; case -9999: bResult = false; error.Code = ErrorCode.SQLException; LoggerHelper.Error("MailAuditDBProvider调用GetMailAuditInfo异常", paramstr, "-9999", transactionid); break; default: bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("SensitiveMailDBProvider调用GetSensitiveMailInfo异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid); } } while (false); } catch (Exception ex) { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("SensitiveMailDBProvider调用GetSensitiveMailInfo异常", paramstr, ex.ToString(), transactionid); } return(bResult); }
public bool GetMailAuditList(Guid transactionid, AdminInfo admin, int curpage, int pagesize, string searchstr, out BaseListInfo lists, out ErrorCodeInfo error) { error = new ErrorCodeInfo(); lists = new BaseListInfo(); string strError = string.Empty; bool bResult = true; try { CParameters paras = new CParameters(); SqlParameter paraAdminID = new SqlParameter("@AdminID", admin.UserID); paras.Add(paraAdminID); SqlParameter paraPageIndex = new SqlParameter("@PageIndex", curpage); paras.Add(paraPageIndex); SqlParameter paraPageSize = new SqlParameter("@PageSize", pagesize); paras.Add(paraPageSize); SqlParameter paraSearchstr = new SqlParameter("@Searchstr", $"%{searchstr}%"); paras.Add(paraSearchstr); SqlParameter paraRecordCount = new SqlParameter("@RecordCount", SqlDbType.Int); paraRecordCount.Direction = ParameterDirection.Output; paras.Add(paraRecordCount); SqlParameter paraPageCount = new SqlParameter("@PageCount", SqlDbType.Int); paraPageCount.Direction = ParameterDirection.Output; paras.Add(paraPageCount); CBaseDB _db = new CBaseDB(Conntection.strConnection); do { DataSet ds = new DataSet(); if (!_db.ExcuteByTransaction(paras, "dbo.[prc_GetMailAuditList]", out ds, out strError)) { strError = "prc_GetMailAuditList数据库执行失败,Error:" + strError; bResult = false; error.Code = ErrorCode.SQLException; break; } lists.RecordCount = (int)paraRecordCount.Value; lists.PageCount = (int)paraPageCount.Value; if (ds != null && ds.Tables.Count > 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { DataRow sdr = ds.Tables[0].Rows[i]; MailAuditInfo info = new MailAuditInfo(); info.ID = Guid.Parse(Convert.ToString(sdr["ID"])); info.Group.GroupID = Guid.Parse(Convert.ToString(sdr["GroupID"])); info.Group.DisplayName = Convert.ToString(sdr["GroupName"]); info.Group.Account = Convert.ToString(sdr["GroupAccount"]); info.CreateTime = Convert.ToDateTime(sdr["CreateTime"]); info.UpdateTime = Convert.ToDateTime(sdr["UpdateTime"]); info.CreateUserID = Guid.Parse(Convert.ToString(sdr["CreateUserID"])); info.RoleID = Guid.Parse(Convert.ToString(sdr["RoleID"])); DataRow[] drArr = ds.Tables[1].Select("MailAuditID='" + info.ID + "'"); foreach (DataRow dr in drArr) { UserInfo user = new UserInfo(); user.UserID = Guid.Parse(Convert.ToString(dr["UserID"])); user.DisplayName = Convert.ToString(dr["DisplayName"]); user.UserAccount = Convert.ToString(dr["Account"]); info.Audits.Add(user); info.AuditUsers += user.DisplayName + "(" + user.UserAccount + "),"; } info.AuditUsers = string.IsNullOrEmpty(info.AuditUsers) ? string.Empty : info.AuditUsers.Remove(info.AuditUsers.LastIndexOf(','), 1); lists.Lists.Add(info); } } else { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("数据库执行prc_GetMailAuditList失败", string.Empty, "ds = null 或者 ds.Tables.Count <= 0", transactionid); } } while (false); } catch (Exception ex) { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAuditDBProvider调用prc_GetMailAuditList异常", string.Empty, ex.ToString(), transactionid); } return(bResult); }
public bool AddMailAudit(Guid transactionid, AdminInfo admin, ref MailAuditInfo mailAuditInfo, out ErrorCodeInfo error) { error = new ErrorCodeInfo(); string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||GroupID:{mailAuditInfo.Group.GroupID}"; string strError = string.Empty; bool bResult = true; try { CParameters paras = new CParameters(); SqlParameter paraGroupID = new SqlParameter("@GroupID", mailAuditInfo.Group.GroupID); paras.Add(paraGroupID); SqlParameter paraGroupName = new SqlParameter("@GroupName", mailAuditInfo.Group.DisplayName); paras.Add(paraGroupName); SqlParameter paraGroupAccount = new SqlParameter("@GroupAccount", mailAuditInfo.Group.Account); paras.Add(paraGroupAccount); SqlParameter paraRoleID = new SqlParameter("@RoleID", admin.RoleID); paras.Add(paraRoleID); SqlParameter paraUserID = new SqlParameter("@CreateUserID", admin.UserID); paras.Add(paraUserID); CBaseDB _db = new CBaseDB(Conntection.strConnection); do { DataSet ds = new DataSet(); if (!_db.ExcuteByTransaction(paras, "dbo.[prc_AddMailAudit]", out ds, out strError)) { strError = "AddMailAudit异常,Error:" + strError; LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, strError, transactionid); bResult = false; error.Code = ErrorCode.SQLException; break; } if (ds != null && ds.Tables.Count > 0) { if (ds.Tables[0].Rows.Count > 0) { int iResult = 0; iResult = Convert.ToInt32(ds.Tables[0].Rows[0][0]); switch (iResult) { case 1: bResult = true; if (ds.Tables.Count > 1) { DataRow sdr = ds.Tables[1].Rows[0]; mailAuditInfo.ID = Guid.Parse(Convert.ToString(sdr["ID"])); } break; case -1: bResult = false; error.Code = ErrorCode.HaveSameGroup; break; case -9999: bResult = false; error.Code = ErrorCode.SQLException; LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, "-9999", transactionid); break; default: bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; break; } } else { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", paramstr, "ds = null 或者 ds.Tables.Count <= 0", transactionid); } } while (false); } catch (Exception ex) { bResult = false; error.Code = ErrorCode.Exception; LoggerHelper.Error("MailAuditDBProvider调用AddMailAudit异常", string.Empty, ex.ToString(), transactionid); } return(bResult); }
public bool GetMailAuditInfoByExchange(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"ID:{mailAuditInfo.Group.GroupID}"; string funname = "GetMailAuditInfoByExchange"; try { do { ADManagerWebService.ManagerWebService webService = new ADManagerWebService.ManagerWebService(); webService.Timeout = -1; //List<string> members = new List<string>(); string[] members = new List <string>().ToArray(); if (!webService.GetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), out members, out message)) { error.Code = ErrorCode.Exception; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, message, false, transactionid); result = false; break; } if (members.Length > 0) { foreach (string user in members) { UserInfo info = new UserInfo(); byte[] strbyte; if (!webService.GetUser(transactionid, user, out strbyte, out message)) { continue; } info = (UserInfo)JsonHelper.DeserializeObject(strbyte); mailAuditInfo.Audits.Add(info); } } error.Code = ErrorCode.None; string json = JsonConvert.SerializeObject(mailAuditInfo); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info, json); result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用GetMailAuditInfo异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public bool ModifyMailAudit(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||GroupID:{mailAuditInfo.Group.GroupID}"; for (int i = 0; i < mailAuditInfo.Audits.Count; i++) { paramstr += $"||AuditID:{mailAuditInfo.Audits[i].UserID}"; } string funname = "ModifyMailAudit"; try { do { error = mailAuditInfo.ChangeCheckProp(); if (error.Code != ErrorCode.None) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } MailAuditDBProvider provider = new MailAuditDBProvider(); MailAuditInfo oldMailAuditInfo = new MailAuditInfo(); oldMailAuditInfo.ID = mailAuditInfo.ID; if (!provider.GetMailAuditInfo(transactionid, admin, ref oldMailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } //判断审批人有效性 DirectoryEntry entry = new DirectoryEntry(); CommonProvider commonProvider = new CommonProvider(); List <UserInfo> audits = new List <UserInfo>(); List <Guid> users = new List <Guid>(); if (mailAuditInfo.Audits.Count > 0) { for (int i = 0; i < mailAuditInfo.Audits.Count; i++) { if (!commonProvider.GetADEntryByGuid(mailAuditInfo.Audits[i].UserID, out entry, out message)) { continue; } mailAuditInfo.Audits[i].DisplayName = entry.Properties["cn"].Value == null ? "" : Convert.ToString(entry.Properties["cn"].Value); mailAuditInfo.Audits[i].UserAccount = entry.Properties["userPrincipalName"].Value == null ? "" : Convert.ToString(entry.Properties["userPrincipalName"].Value); mailAuditInfo.Audits[i].IsCreateMail = entry.Properties["mail"].Value == null ? false : true; if (!mailAuditInfo.Audits[i].IsCreateMail) { error.Code = ErrorCode.UserNotExchange; error.SetInfo(mailAuditInfo.Audits[i].DisplayName + "(" + mailAuditInfo.Audits[i].UserAccount + ")"); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } mailAuditInfo.AuditUsers += mailAuditInfo.Audits[i].DisplayName + "(" + mailAuditInfo.Audits[i].UserAccount + "),"; users.Add(mailAuditInfo.Audits[i].UserID); audits.Add(mailAuditInfo.Audits[i]); } } if (result) { mailAuditInfo.AuditUsers = string.IsNullOrEmpty(mailAuditInfo.AuditUsers) ? string.Empty : mailAuditInfo.AuditUsers.Remove(mailAuditInfo.AuditUsers.LastIndexOf(','), 1); DirectoryEntry groupEntry = new DirectoryEntry(); if (!commonProvider.GetADEntryByGuid(mailAuditInfo.Group.GroupID, out groupEntry, out message)) { error.Code = ErrorCode.SearchADDataError; strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("ModifyMailAudit调用GetADEntryByGuid异常", paramstr, message, transactionid); result = false; break; } mailAuditInfo.Group.Account = groupEntry.Properties["mail"].Value == null ? "" : Convert.ToString(groupEntry.Properties["mail"].Value); mailAuditInfo.Group.DisplayName = groupEntry.Properties["cn"].Value == null ? "" : Convert.ToString(groupEntry.Properties["cn"].Value); ADManagerWebService.ManagerWebService webService = new ADManagerWebService.ManagerWebService(); webService.Timeout = -1; //Set Group Exchange webService.SetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), false, new List <Guid>().ToArray(), out message); //Set Group Exchange if (!webService.SetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), true, users.ToArray(), out message)) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用AddMailAudit异常", paramstr, message, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; break; } if (!provider.ModifyMailAudit(transactionid, admin, mailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } foreach (UserInfo u in audits) { if (!provider.AddMailAuditUsers(transactionid, mailAuditInfo, u, out error)) { continue; } } error.Code = ErrorCode.None; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info); #region 操作日志 LogInfo operateLog = new LogInfo(); operateLog.AdminID = admin.UserID; operateLog.AdminAccount = admin.UserAccount; operateLog.RoleID = admin.RoleID; operateLog.ClientIP = _clientip; operateLog.OperateResult = true; operateLog.OperateType = "修改邮件审批规则"; operateLog.OperateLog = $"{admin.UserAccount}于{DateTime.Now}修改邮件审批规则。" + $"原对象:{oldMailAuditInfo.Group.DisplayName},现对象:{mailAuditInfo.Group.DisplayName};" + $"原审批人:{oldMailAuditInfo.AuditUsers},现审批人:{mailAuditInfo.AuditUsers}"; LogManager.AddOperateLog(transactionid, operateLog); #endregion result = true; } } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用ModifySensitiveMail异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }
public bool DeleteMailAudit(Guid transactionid, AdminInfo admin, MailAuditInfo mailAuditInfo, out string strJsonResult) { bool result = true; strJsonResult = string.Empty; ErrorCodeInfo error = new ErrorCodeInfo(); string message = string.Empty; string paramstr = string.Empty; paramstr += $"AdminID:{admin.UserID}"; paramstr += $"||AdminAccount:{admin.UserAccount}"; paramstr += $"||ID:{mailAuditInfo.ID}"; string funname = "DeleteMailAudit"; try { do { MailAuditDBProvider Provider = new MailAuditDBProvider(); if (!Provider.GetMailAuditInfo(transactionid, admin, ref mailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } if (!Provider.DeleteMailAudit(transactionid, admin, mailAuditInfo, out error)) { strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); result = false; break; } ADManagerWebService.ManagerWebService webService = new ADManagerWebService.ManagerWebService(); webService.Timeout = -1; //Set Group Exchange if (!webService.SetDistributionGroupModeratedBy(transactionid, mailAuditInfo.Group.GroupID.ToString(), false, new List <Guid>().ToArray(), out message)) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用AddMailAudit异常", paramstr, message, transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } error.Code = ErrorCode.None; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), true, transactionid); strJsonResult = JsonHelper.ReturnJson(true, Convert.ToInt32(error.Code), error.Info); #region 操作日志 LogInfo operateLog = new LogInfo(); operateLog.AdminID = admin.UserID; operateLog.AdminAccount = admin.UserAccount; operateLog.RoleID = admin.RoleID; operateLog.ClientIP = _clientip; operateLog.OperateResult = true; operateLog.OperateType = "删除邮件审批规则"; operateLog.OperateLog = $"{admin.UserAccount}于{DateTime.Now}删除邮件审批规则。" + $"对象:{mailAuditInfo.Group.DisplayName}," + $"审批人:{mailAuditInfo.AuditUsers}"; LogManager.AddOperateLog(transactionid, operateLog); #endregion result = true; } while (false); } catch (Exception ex) { error.Code = ErrorCode.Exception; LoggerHelper.Info(admin.UserAccount, funname, paramstr, Convert.ToString(error.Code), false, transactionid); LoggerHelper.Error("MailAuditManager调用DeleteMailAudit异常", paramstr, ex.ToString(), transactionid); strJsonResult = JsonHelper.ReturnJson(false, Convert.ToInt32(error.Code), error.Info); result = false; } return(result); }