private void cPRATEBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure you want to save these changes?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { GridViewCopy.MoveFirst(); GridViewCopy.MoveLast(); CpRatesBindingSource.EndEdit(); context.SaveChanges(); panelControlStatus.Visible = true; LabelStatus.Text = "Record Saved"; rowStatusSave = new Timer(); rowStatusSave.Interval = 3000; rowStatusSave.Start(); rowStatusSave.Tick += TimedEventSave; } }
private void SaveButton_Click(object sender, EventArgs e) { bool overlapFlag = false; for (int val = 0; val < GridViewCopy.RowCount; val++) { ColumnView view = GridViewCopy as ColumnView; string best = GridViewCopy.GetRowCellDisplayText(val, "Over"); if (best == "Checked") { overlapFlag = true; } } // if (overlapFlag) { MessageBox.Show("There is a potential overlap. Please correct the values before attempting to save."); return; } if (MessageBox.Show("Are you sure you want to save these changes?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { GridViewCopy.MoveFirst(); GridViewCopy.MoveLast(); CpRatesBindingSource.EndEdit(); context.SaveChanges(); panelControlStatus.Visible = true; LabelStatus.Text = "Record Saved"; rowStatusSave = new Timer(); rowStatusSave.Interval = 3000; rowStatusSave.Start(); rowStatusSave.Tick += TimedEventSave; ImageComboBoxEditLoadCode.Text = string.Empty; ImageComboBoxEditCopyCode.Text = string.Empty; GridControlCopy.DataSource = null; MessageBox.Show("Operation completed succesfully."); ImageComboBoxEditLoadCode.Focus(); } }