Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. /// <summary>
  2. /// Set new task custom field value
  3. /// </summary>
  4. /// <param name="projectDS">Checked out single project</param>
  5. /// <param name="taskRow">Task for update</param>
  6. /// <param name="lookupTableDS">Lookup tables</param>
  7. /// <param name="mdPropRow">Enterprise task custom field</param>
  8. /// <param name="fieldValue">New value for enterprise task custom field</param>
  9. static internal void SetTaskCustomField(ProjectDataSet projectDS, ProjectDataSet.TaskRow taskRow, LookupTableMultiLangDataSet lookupTableDS, CustomFieldDataSet.CustomFieldsRow mdPropRow, string fieldValue)
  10. {
  11. var taskCustomFieldsTable = projectDS.TaskCustomFields;
  12. var projUid = taskRow.PROJ_UID;
  13. var taskUid = taskRow.TASK_UID;
  14. //...
  15. //Getting current custom field value
  16. var customFieldRow = taskCustomFieldsTable.Rows.Cast<ProjectDataSet.TaskCustomFieldsRow>().Where(x => x.MD_PROP_UID == mdPropRow.MD_PROP_UID && x.PROJ_UID == projUid && x.TASK_UID == taskUid).FirstOrDefault();
  17.  
  18. if (!string.IsNullOrEmpty(fieldValue))
  19. {
  20. //If new value for task custom field is non empty -> update custom field value. It's WORKING correct
  21. }
  22. else
  23. {
  24. if (customFieldRow != null)
  25. {
  26. try
  27. {
  28. taskCustomFieldsTable.RemoveTaskCustomFieldsRow(customFieldRow);
  29. }
  30. catch (Exception e)
  31. {
  32. //Custom logging
  33. Logger.WriteError(String.Format("SetTaskCustomField TaskUID = "{0}" Deleting Task custom field value Error", taskRow.TASK_UID.ToString()), e);
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement