예제 #1
0
        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (AirSegBindingSource.Current == null)
            {
                return;
            }

            GridViewAirSeg.CloseEditor();
            if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                modified = false;
                newRec   = false;
                AirSegBindingSource.RemoveCurrent();
                errorProvider1.Clear();
                context.SaveChanges();
                panelControlStatus.Visible = true;
                LabelStatus.Text           = "Record Deleted";
                rowStatusDelete            = new Timer();
                rowStatusDelete.Interval   = 3000;
                rowStatusDelete.Start();
                rowStatusDelete.Tick += new EventHandler(TimedEventDelete);
            }
            lockGrid(true);
            ImageComboBoxEditAir.Focus();
            currentVal = ImageComboBoxEditAir.Text;
            modified   = false;
            newRec     = false;
        }
예제 #2
0
 private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e)
 {
     if (move())
     {
         AirSegBindingSource.MoveLast();
     }
 }
예제 #3
0
 private void aIRSEGBindingNavigatorSaveItem_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();
         AirSegBindingSource.EndEdit();
         context.SaveChanges();
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Saved";
         rowStatusSave          = new Timer();
         rowStatusSave.Interval = 3000;
         rowStatusSave.Start();
         rowStatusSave.Tick += TimedEventSave;
     }
 }
예제 #4
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            GridViewAirSeg.ClearColumnsFilter();
            if (AirSegBindingSource.Current == null)
            {
                //fake query in order to create a link between the database table and the binding source
                AirSegBindingSource.DataSource = from opt in context.AIRSEG where opt.CODE == "KJM9" select opt;
                AirSegBindingSource.AddNew();
                if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1;
                }
                setValues();
                ImageComboBoxEditAir.Focus();
                lockGrid(false);
                newRec = true;
                return;
            }
            ImageComboBoxEditAir.Focus();

            // bindingNavigatorPositionItem.Focus();  //trigger field leave event
            GridViewAirSeg.CloseEditor();
            temp = newRec;
            if (checkForms())
            {
                if (!temp)
                {
                    context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current);
                }
                AirSegBindingSource.AddNew();
                if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1;
                }
                ImageComboBoxEditAir.Focus();
                lockGrid(false);
                newRec = true;
            }
        }