static ParentWorkItem GetParentData(DataTable dt, int rowindex, int columnindex) { ParentWorkItem workItem = new ParentWorkItem(); if (columnindex > 0) { for (int i = rowindex; i >= 0; i--) { DataRow dr = dt.Rows[i]; int colindex = columnindex; while (colindex > 0) { int index = colindex - 1; if (!string.IsNullOrEmpty(dr[TitleColumns[index]].ToString())) { workItem.Id = int.Parse(dr["ID"].ToString()); workItem.Title = dr[TitleColumns[index]].ToString(); break; } colindex--; } if (!string.IsNullOrEmpty(workItem.Title)) { break; } } } return(workItem); }
private void ExecuteClose(object sender, ExecutedRoutedEventArgs e) { if (IsClosed) { return; } if (IsRunningClose) { return; } IsRunningClose = true; ValidationErrors = WorkItem.Validate(); if (ValidationErrors.Count == 0) { IsClosed = true; if (!IsClosing) { Close(); } } else { var result = MessageBox.Show(this, Properties.Resources.WorkItemWindowValidationErrorOnCloseMessage, Properties.Resources.WorkItemWindowValidationErrorOnCloseTitle, MessageBoxButton.YesNo, MessageBoxImage.Exclamation, MessageBoxResult.No); // If the user wanted to close without fixing the error just close, otherwise do nothing if (result == MessageBoxResult.Yes) { IsClosed = true; if (!IsClosing) { Close(); } } } IsRunningClose = false; // Discard changes on parent work item if (ParentWorkItem != null) { ParentWorkItem.Reset(); } }
private void ExecuteSave(object sender, ExecutedRoutedEventArgs e) { if (WorkItem == null) { return; } if (!WorkItem.IsDirty) { return; } if (!WorkItem.IsValid()) { return; } WorkItem.Save(); if (ParentWorkItem != null && LinkType != null) { ParentWorkItem.Links.Add(new RelatedLink(LinkType, WorkItem.Id)); ParentWorkItem.Save(); } }