Ejemplo n.º 1
0
 private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e)
 {
     if (move())
     {
         DeptBindingSource.MoveLast();
     }
 }
Ejemplo n.º 2
0
        private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
        {
            if (DeptBindingSource.Current == null)
            {
                return;
            }

            GridViewDept.CloseEditor();
            if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                modified = false;
                newRec   = false;
                DeptBindingSource.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);
            }

            //ockGrid(true);
            setReadOnly(true);
            codeTextBox.Focus();
            currentVal = codeTextBox.Text;
            modified   = false;
            newRec     = false;
        }
Ejemplo n.º 3
0
 private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     GridViewDept.ClearColumnsFilter();
     if (DeptBindingSource.Current == null)
     {
         //fake query in order to create a link between the database table and the binding source
         DeptBindingSource.AddNew();
         if (GridViewDept.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewDept.FocusedRowHandle = GridViewDept.RowCount - 1;
         }
         //setValues();
         codeTextBox.Focus();
         setReadOnly(false);
         // lockGrid(false);
         newRec = true;
         return;
     }
     codeTextBox.Focus();
     //bindingNavigatorPositionItem.Focus();  //trigger field leave event
     GridViewDept.CloseEditor();
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (Dept)DeptBindingSource.Current);
         }
         DeptBindingSource.AddNew();
         if (GridViewDept.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewDept.FocusedRowHandle = GridViewDept.RowCount - 1;
         }
         //  setValues();
         codeTextBox.Focus();
         setReadOnly(false);
         //  lockGrid(false);
         newRec = true;
     }
     //////////////////////
 }