/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Translate from bbCode to html Resources.BBCode bbc = new Resources.BBCode(); DTO.Body = bbc.Transform(DTO.Body); List <string> groupCodes = new List <string>(); GroupAccount_ADO gAdo = new GroupAccount_ADO(); foreach (var code in DTO.GroupCodes) { groupCodes.Add(code.GrpCode); } //Get accounts associated with the Group(s) ADO_readerOutput readGroupAccounts = gAdo.ReadMultiple(Ado, groupCodes); Account_ADO accAdo = new Account_ADO(); Account_DTO_Read dtoRead = new Account_DTO_Read(); dtoRead.PrvCode = Resources.Constants.C_SECURITY_PRIVILEGE_POWER_USER; ADO_readerOutput readPowerUsers = accAdo.Read(Ado, dtoRead); //Get the AD data associated with the users, specifically ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref readGroupAccounts); adAdo.MergeAdToUsers(ref readPowerUsers); eMail email = new eMail(); if (!readGroupAccounts.hasData && !readPowerUsers.hasData) { Response.data = JSONRPC.success; Log.Instance.Debug("No email addresses found"); return(true); } foreach (var user in readGroupAccounts.data) { email.Bcc.Add(user.CcnEmail.ToString()); } foreach (var user in readPowerUsers.data) { email.Bcc.Add(user.CcnEmail.ToString()); } email.Subject = DTO.Subject; email.Body = DTO.Body; sendMail(email, Configuration_BSO.GetCustomConfig("title"), DTO.Subject, DTO.Body); Response.data = JSONRPC.success; return(true); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { //Validation of parameters and user have been successful. We may now proceed to read from the database var adoWorkflow = new Workflow_ADO(); ADO_readerOutput result = adoWorkflow.ReadLive(Ado, SamAccountName, DTO); if (!result.hasData) { return(false); } var adoAd = new ActiveDirectory_ADO(); adoAd.MergeAdToUsers(ref result); Response.data = result.data; return(true); }
/// <summary> /// For a list of users, get their emails from ActiveDirectory /// </summary> /// <param name="releaseDTO"></param> /// <param name="users"></param> /// <returns></returns> private List <string> getEmailAddresses(ADO_readerOutput users) { List <string> emails = new List <string>(); ADO ado = new ADO("defaultConnection"); try { ActiveDirectory_ADO adAdo = new ActiveDirectory_ADO(); adAdo.MergeAdToUsers(ref users); } catch (Exception ex) { throw ex; } finally { ado.Dispose(); } foreach (var v in users.data) { //Only send mails if the user notification flag is set in their profile if ((bool)v.CcnNotificationFlag) { emails.Add(v.CcnEmail.ToString()); } } return(emails); }
/// <summary> /// Execute /// </summary> /// <returns></returns> protected override bool Execute() { var adoWorkflow = new Workflow_ADO(); var result = adoWorkflow.ReadWorkInProgress(Ado, SamAccountName, DTO.LngIsoCode); var adoAd = new ActiveDirectory_ADO(); adoAd.MergeAdToUsers(ref result); Response.data = result.data; return(true); }