private void submitBtn_Click(object sender, EventArgs e) { DateTime expectedDate = Convert.ToDateTime(expectedDatePicker.Value.ToShortDateString() + ' ' + expectedTimePicker.Value.ToShortTimeString()); DateTime actualDate = Convert.ToDateTime(actualDatePicker.Value.ToShortDateString() + ' ' + actualTimePicker.Value.ToShortTimeString()); int employee = Convert.ToInt32(employeeComboBox.SelectedValue); bool contacted = contactedCB.Checked; if (useActual.Checked) { Database.UpdateUpdate(currentPK, expectedDate, commentsTextBox.Text, actualDate, employee, contacted, wasContacted, true, wasDone); Database.UpdateCustomer(currentCustomer, currentVersion); } else { Database.UpdateUpdate(currentPK, expectedDate, commentsTextBox.Text, employee, contacted, wasContacted, false); } MessageBox.Show("Completed!"); DataGridView dgv = updatesPage.getUpdatesGrid(); dgv.DataSource = Database.GetUpdateList(); this.Hide(); updatesPage.Show(); }
private void submitBtn_Click(object sender, EventArgs e) { try { foreach (DataGridViewRow row in CustomersGrid.Rows) { if ((row.Cells["Selected"].Value != null) && ((bool)((DataGridViewCheckBoxCell)row.Cells["Selected"]).Value)) { /*if (actualDate != null) * { * Database.UpdateCustomer(Convert.ToInt32(row.Cells["PK"].Value.ToString()), versionPK); * * }*/ int employeePK = Convert.ToInt32(row.Cells["AssignedTo"].Value); Database.AddUpdate(versionPK, Convert.ToInt32(row.Cells["PK"].Value.ToString()), expectedDate, actualDate, comment, employeePK); } } } catch (Exception ex) { System.Console.WriteLine(ex.StackTrace); } MessageBox.Show("Completed!"); DataGridView dgv = mainMenu.getUpdatesGrid(); dgv.DataSource = Database.GetUpdateList(); mainMenu.getCurrentButton().Text = "All"; this.Hide(); mainMenu.Show(); }