コード例 #1
0
ファイル: caRateCopyForm.cs プロジェクト: mdgiles/TraceOffice
 private void cARRATEBindingNavigatorSaveItem_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure you want to save these changes?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         gridView2.MoveFirst();
         gridView2.MoveLast();
         CarRatesBindingSource.EndEdit();
         context.SaveChanges();
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Saved";
         rowStatusSave          = new Timer();
         rowStatusSave.Interval = 3000;
         rowStatusSave.Start();
         rowStatusSave.Tick += TimedEventSave;
     }
 }
コード例 #2
0
ファイル: caRateCopyForm.cs プロジェクト: mdgiles/TraceOffice
        private void SaveButton_Click(object sender, System.EventArgs e)
        {
            bool overlapFlag = false;

            for (int val = 0; val < gridView2.RowCount; val++)
            {
                ColumnView view = gridView2 as ColumnView;
                string     best = gridView2.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)
            {
                gridView2.MoveFirst();
                gridView2.MoveLast();
                CarRatesBindingSource.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;
                gridControl2.DataSource        = null;
                MessageBox.Show("Operation completed succesfully.");
                ImageComboBoxEditLoadCode.Focus();
            }
        }