Advertisement
vilgelmbb

TaskCommentForm

Apr 20th, 2015
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.38 KB | None | 0 0
  1.     protected string UseTaskCommentForm()
  2.         {
  3.             string comment = string.Empty;
  4.             Type taskCommentFormType =
  5.                 typeof(MainControl).Assembly.GetType("DocsVision.BackOffice.Cards.CardTask.TaskCommentForm");
  6.             if (taskCommentFormType != null)
  7.             {
  8.                 ConstructorInfo method = taskCommentFormType.GetConstructor(
  9.                         BindingFlags.Public | BindingFlags.Instance,
  10.                         null,
  11.                         new[] { typeof(ObjectContext), typeof(string), typeof(StaffEmployee), typeof(DateTime), typeof(bool) },
  12.                         null
  13.                     );
  14.                 object o = method.Invoke(new object[] { Context, comment, StaffService.GetCurrentEmployee(), DateTime.Now, false });
  15.  
  16.                 var taskCommentForm = o as XtraForm;
  17.                 if (taskCommentForm.ShowDialog() == DialogResult.OK)
  18.                 {
  19.                     var prop = taskCommentForm.GetType().GetProperty("Comment");
  20.                     if (prop != null)
  21.                     {
  22.                         comment = prop.GetValue(taskCommentForm, null).ToString();
  23.                     }
  24.                 }
  25.                 else
  26.                 {
  27.                     comment = "Cancel";
  28.                 }
  29.                 taskCommentForm.Dispose();
  30.             }
  31.             return comment;
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement