public Update(MainWindow.Item currentItem) { InitializeComponent(); //this.currentItem = currentItem; loadData(currentItem); passIntoClass(currentItem); historicalData.ID = currentItem.ID; loadHistoricalData(historicalData.ID); deleteRecordButton.Visibility = deleteButtonToggle(); }
//This takes currentItem (row that was sent to this window) and puts it into a class here so that I can use it public void passIntoClass(MainWindow.Item currentItem) { item1.ID = currentItem.ID; item1.Comments = currentItem.Comments; item1.SourceID = currentItem.SourceID; item1.CID = currentItem.CID; item1.Source = currentItem.Source; item1.Destination = currentItem.Destination; item1.Packages = currentItem.Packages; item1.CreatedBy = currentItem.CreatedBy; item1.Status = currentItem.Status; item1.CreatedDate = currentItem.CreatedDate; item1.CompletedDate = currentItem.CompletedDate; item1.CompletionTime = currentItem.CompletionTime; }
public MainWindow.Item loadData(MainWindow.Item currentItem) { //This fills the boxes with the data from the row that was sent to this window int destination = 0; int package = 0; int status = 0; fillComboBox(sourceSoftwareBox, "SELECT SoftwareName FROM Software", "", "SoftwareName", "SoftwareName"); switch (currentItem.Destination) { case "ATX": destination = 0; break; case "TaxWise": destination = 1; break; case "TWO": destination = 2; break; default: destination = 3; break; } destinationSoftwareBox.SelectedIndex = destination; switch (currentItem.Packages) { case "Individual": package = 0; break; case "Business": package = 1; break; case "Both": package = 2; break; default: package = 3; break; } packagesBox.SelectedIndex = package; switch (currentItem.Status) { case "Created": status = 0; break; case "Awaiting Waiver": status = 1; break; case "Submitted": status = 2; break; case "In Progress": status = 3; break; case "Needs Resubmission": status = 4; break; case "With Devs": status = 5; break; case "Ready for Customer": status = 6; break; case "Ready - Customer Notified": status = 7; break; case "Completed": status = 8; break; default: status = 9; break; } statusBox.SelectedIndex = status; sourceSoftwareBox.SelectedIndex = Int32.Parse(currentItem.SourceID) - 1; cidBox.Text = currentItem.CID; //commentsBox.Text = currentItem.Comments; userNameLabel.Content = currentItem.CreatedBy; createdDate.Content = currentItem.CreatedDate; if ((currentItem.CompletedDate != null) && (currentItem.CompletedDate != "")) { completedDate.Content = currentItem.CompletedDate; } //Math for completion time if ((currentItem.CompletedDate != null) && (currentItem.CompletedDate != "")) { DateTime createdDateDateTime = Convert.ToDateTime(currentItem.CreatedDate); DateTime completedDateDateTime = Convert.ToDateTime(currentItem.CompletedDate); TimeSpan span = completedDateDateTime.Subtract(createdDateDateTime); completionTime.Content = span.Days + " Days, " + span.Hours + " Hours, " + span.Minutes + " Minutes"; } originalCompleteState.originalCompleteState = currentItem.Completed; if (currentItem.Completed == "True") { completeCheckBox.IsChecked = true; } else if (currentItem.Completed == "False") { completeCheckBox.IsChecked = false; } return currentItem; }