Пример #1
0
        private void cAROFFBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (CarOffBindingSource.Current == null)
            {
                return;
            }
            GridViewCarOff.CloseEditor();
            ImageComboBoxEditCode.Focus();
            // bindingNavigatorPositionItem.Focus();//trigger field leave event
            bool temp = newRec;

            if (checkForms())
            {
                errorProvider1.Clear();
                setReadOnly(true);
                panelControlStatus.Visible = true;
                LabelStatus.Text           = "Record Saved";
                rowStatusSave          = new Timer();
                rowStatusSave.Interval = 3000;
                rowStatusSave.Start();
                rowStatusSave.Tick += TimedEventSave;
            }

            if (!temp && !modified)
            {
                context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (CAROFF)CarOffBindingSource.Current);
            }
        }
Пример #2
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (CarOffBindingSource.Current == null)
     {
         return;
     }
     GridViewCarOff.CloseEditor();
     if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         modified = false;
         newRec   = false;
         CarOffBindingSource.RemoveCurrent();
         errorProvider1.Clear();
         context.SaveChanges();
         setReadOnly(true);
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Deleted";
         rowStatusDelete            = new Timer();
         rowStatusDelete.Interval   = 3000;
         rowStatusDelete.Start();
         rowStatusDelete.Tick += new EventHandler(TimedEventDelete);
     }
     ImageComboBoxEditCode.Focus();
     currentVal = ImageComboBoxEditCode.Text;
     modified   = false;
     newRec     = false;
 }
Пример #3
0
 private bool move()
 {
     GridViewCarOff.CloseEditor();
     ImageComboBoxEditCode.Focus();
     // bindingNavigatorPositionItem.Focus();//trigger field leave event
     temp = newRec;
     if (checkForms())
     {
         errorProvider1.Clear();
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( CAROFF)CarOffBindingSource.Current);
         }
         setReadOnly(true);
         newRec   = false;
         modified = false;
         return(true);
     }
     return(false);
 }
Пример #4
0
 private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     GridViewCarOff.ClearColumnsFilter();
     if (CarOffBindingSource.Current == null)
     {
         //fake query in order to create a link between the database table and the binding source
         CarOffBindingSource.DataSource = from opt in context.CAROFF where opt.CODE == "KJM9" select opt;
         CarOffBindingSource.AddNew();
         if (GridViewCarOff.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewCarOff.FocusedRowHandle = GridViewCarOff.RowCount - 1;
         }
         setValues();
         ImageComboBoxEditCode.Focus();
         setReadOnly(false);
         newRec = true;
         return;
     }
     ImageComboBoxEditCode.Focus();
     //bindingNavigatorPositionItem.Focus();  //trigger field leave event
     GridViewCarOff.CloseEditor();
     temp = newRec;
     if (checkForms())
     {
         errorProvider1.Clear();
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( CAROFF)CarOffBindingSource.Current);
         }
         CarOffBindingSource.AddNew();
         if (GridViewCarOff.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewCarOff.FocusedRowHandle = GridViewCarOff.RowCount - 1;
         }
         setValues();
         ImageComboBoxEditCode.Focus();
         setReadOnly(false);
         newRec = true;
     }
 }