Advertisement
vilgelmbb

Send notification from card

Dec 15th, 2014
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.92 KB | None | 0 0
  1.     public void SendEmail_ItemClick(object sender, ItemClickEventArgs e)
  2.         {
  3.             var comment = UseTaskCommentForm();
  4.             if (string.IsNullOrWhiteSpace(comment))
  5.             {
  6.                 UiService.ShowMessage(Resources.Resources.EmptyCommentError);
  7.                 return;
  8.             }
  9.             else if (string.CompareOrdinal(comment, "Cancel") == 0)
  10.             {
  11.                 return;
  12.             }
  13.             LayoutControl.Enabled = false;
  14.             RibbonControl.Enabled = false;
  15.             GenerateNotificationToInitiator(comment);
  16.             LayoutControl.Enabled = true;
  17.             RibbonControl.Enabled = true;
  18.         }
  19.  
  20.     internal void GenerateNotificationToInitiator(string comment)
  21.         {
  22.             var docId = GetApprovingDocumentId();
  23.             if (!docId.HasValue) return;
  24.             var doc = Context.GetObject<Document>(docId.Value);
  25.             var recipient = doc.MainInfo.Author;
  26.             List<string> recEmail = new List<string>();
  27.             List<string> ccEmail = new List<string>();
  28.             if (recipient.Email != string.Empty) recEmail.Add(recipient.Email);
  29.             ccEmail.Add(!string.IsNullOrEmpty(StaffService.GetCurrentEmployee().Email)
  30.                 ? StaffService.GetCurrentEmployee().Email
  31.                 : string.Empty);
  32.             // Выгружаем файлы
  33.             string filesPath = GetFilesInTask(Task);
  34.  
  35.             if (recEmail.Count > 0)
  36.             {
  37.                 string templateName = "Lawyer_1";
  38.                 ExtensionManagerHelper.SendNotificationForApprovingProcess(Session, DateTime.Now, templateName,
  39.                     new Dictionary<string, string>()
  40.                     {
  41.                         {"{Digest}", doc.Description},
  42.                         {"{attachfolder}", filesPath},
  43.                         {"{Comment}", comment}
  44.                     }, recEmail, ccEmail);
  45.             }
  46.  
  47.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement