Advertisement
vilgelmbb

GetEmails from prop table section

Mar 6th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. private List<string> GetEmails()
  2.         {
  3.             List<string> emails=new List<string>();
  4.             var sd = GetPropertiesSection();
  5.             if (sd == null)
  6.             {
  7.                 _formResult = _formResult + Environment.NewLine + "propertiesSection==null";
  8.                 return emails;
  9.             }
  10.             RowData rd = sd.FindRow("@Name='" + DistributionListPropertyName + "'");
  11.             if (rd == null)
  12.             {
  13.                 _formResult = _formResult + Environment.NewLine + "rowData"+DistributionListPropertyName+"==null";
  14.                 return emails;
  15.             }
  16.             var sdSelectedValues = rd.ChildSections[SelectedValuesSectionId].GetAllRows();
  17.             if (!sdSelectedValues.Any())
  18.             {
  19.                 _formResult = _formResult + Environment.NewLine + "sdSelectedValues==empty";
  20.                 return emails;
  21.             }
  22.             foreach (var row in sdSelectedValues)
  23.             {
  24.                 var empObj = row.GetObject("SelectedValue");
  25.                 var empId = ConvertStringToGuid(empObj.ToString());
  26.                 var employee = empId != Guid.Empty ? ContextHelper.LocalContext.GetObject<StaffEmployee>(empId) : null;
  27.                 if(employee==null) continue;
  28.                 if(!string.IsNullOrEmpty(employee.Email))
  29.                     emails.Add(employee.Email);
  30.             }
  31.             return emails;
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement