protected override Durados.Workflow.EmailParameters GetEmailParameters(object controller, Dictionary <string, Durados.Parameter> parameters, Durados.View view, Dictionary <string, object> values, DataRow prevRow, string pk, string siteWithoutQueryString, string connectionString) { Durados.Workflow.EmailParameters emailParameters = base.GetEmailParameters(controller, parameters, view, values, prevRow, pk, siteWithoutQueryString, connectionString); if (view.Name == "Issue") { emailParameters.Cc = GetIssueCc(view, values, pk, emailParameters); } return(emailParameters); }
protected override Durados.Workflow.EmailParameters GetEmailParameters(object controller, Dictionary <string, Parameter> parameters, Durados.View view, Dictionary <string, object> values, DataRow prevRow, string pk, string siteWithoutQueryString, string mainSiteWithoutQueryString, string connectionString, string currentUserId, string currentUsername, string currentUserRole) { Durados.Workflow.EmailParameters emailParameters = new Durados.Workflow.EmailParameters(); Dictionary <string, string> to = new Dictionary <string, string>(); Dictionary <string, string> cc = new Dictionary <string, string>(); if (parameters.ContainsKey("DistributionLists")) { string[][] distributionLists = GetDistributionLists(parameters["DistributionLists"].Value, (Database)view.Database); if (distributionLists[0] != null) { foreach (string email in distributionLists[0]) { if (!to.ContainsKey(email)) { to.Add(email, email); } } } if (distributionLists[1] != null) { foreach (string email in distributionLists[1]) { if (!cc.ContainsKey(email)) { cc.Add(email, email); } } } //emailParameters.To = distributionLists[0]; //emailParameters.Cc = distributionLists[1]; } if (parameters.ContainsKey("to")) { foreach (string email in GetEmailsFromParameter((Durados.Workflow.INotifier)controller, parameters["to"].Value, view, values, prevRow, pk, connectionString, currentUserId, currentUsername, currentUserRole)) { if (!to.ContainsKey(email)) { to.Add(email, email); } } } // emailParameters.To = parameters["to"].Split(';'); if (parameters.ContainsKey("cc")) { foreach (string email in GetEmailsFromParameter((Durados.Workflow.INotifier)controller, parameters["cc"].Value, view, values, prevRow, pk, connectionString, currentUserId, currentUsername, currentUserRole)) { if (!cc.ContainsKey(email)) { cc.Add(email, email); } } } // emailParameters.Cc = parameters["cc"].Split(';'); if (parameters.ContainsKey("bcc")) { emailParameters.Bcc = GetEmailsFromParameter((Durados.Workflow.INotifier)controller, parameters["bcc"].Value, view, values, prevRow, pk, connectionString, currentUserId, currentUsername, currentUserRole); } emailParameters.To = to.Values.ToArray(); emailParameters.Cc = cc.Values.ToArray(); try { if (parameters.ContainsKey("from")) { emailParameters.From = GetEmailsFromParameter((Durados.Workflow.INotifier)controller, parameters["from"].Value, view, values, prevRow, pk, connectionString, currentUserId, currentUsername, currentUserRole).FirstOrDefault(); } } catch { } if (parameters.ContainsKey("subject")) { emailParameters.Subject = GetMessage((Durados.Workflow.INotifier)controller, parameters["subject"].Value, view, values, pk, siteWithoutQueryString, mainSiteWithoutQueryString); } if (parameters.ContainsKey("message")) { emailParameters.Message = GetMessage((Durados.Workflow.INotifier)controller, parameters["message"].Value, view, values, pk, siteWithoutQueryString, mainSiteWithoutQueryString); } //} //else //{ // throw new DuradosException("No distribution list"); //} return(emailParameters); }
private string[] GetIssueCc(Durados.View view, Dictionary <string, object> values, string pk, Durados.Workflow.EmailParameters emailParameters) { string reportedUserEmail = GetUserEmail(view, pk); string[] cc = emailParameters.Cc; List <string> ccList = new List <string>(cc); ccList.Add(reportedUserEmail); return(ccList.ToArray()); }