Exemplo n.º 1
0
 private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
 {
     if (ConsrtBindingSource.Current == null)
     {
         return;
     }
     GridViewConsrt.CloseEditor();
     if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         modified = false;
         newRec   = false;
         ConsrtBindingSource.RemoveCurrent();
         errorProvider1.Clear();
         context.SaveChanges();
         cODETextEdit.Properties.ReadOnly = true;
         GridViewConsrt.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
         panelControlStatus.Visible = true;
         LabelStatus.Text           = "Record Deleted";
         rowStatusDelete            = new Timer();
         rowStatusDelete.Interval   = 3000;
         rowStatusDelete.Start();
         rowStatusDelete.Tick += new EventHandler(TimedEventDelete);
         //bindingNavigatorPositionItem.Focus();
     }
     currentVal = cODETextEdit.Text;
 }
Exemplo n.º 2
0
 private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e)
 {
     if (move())
     {
         ConsrtBindingSource.MoveLast();
     }
 }
Exemplo n.º 3
0
 private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
 {
     GridViewConsrt.ClearColumnsFilter();
     if (ConsrtBindingSource.Current == null)
     {
         //fake query in order to create a link between the database table and the binding source
         ConsrtBindingSource.DataSource = from opt in context.CONSRT where opt.CODE == "KJM9" select opt;
         ConsrtBindingSource.AddNew();
         if (GridViewConsrt.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewConsrt.FocusedRowHandle = GridViewConsrt.RowCount - 1;
         }
         cODETextEdit.Focus();
         cODETextEdit.Properties.ReadOnly = false;
         GridViewConsrt.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true;
         newRec = true;
         return;
     }
     cODETextEdit.Focus();
     // bindingNavigatorPositionItem.Focus();  //trigger field leave event
     GridViewConsrt.CloseEditor();
     temp = newRec;
     //if (validCheck.saveRoutine(cONSRTBindingSource, cONSRTBindingNavigator, context, errorProvider1, ref newRec, ref modified, (( CONSRT)cONSRTBindingSource.Current).checkAll, splitContainerControl1.Panel2.Controls, validCheck.dummy))
     if (checkForms())
     {
         errorProvider1.Clear();
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( CONSRT)ConsrtBindingSource.Current);
         }
         ConsrtBindingSource.AddNew();
         if (GridViewConsrt.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         {
             GridViewConsrt.FocusedRowHandle = GridViewConsrt.RowCount - 1;
         }
         cODETextEdit.Focus();
         cODETextEdit.Properties.ReadOnly = false;
         GridViewConsrt.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true;
         newRec = true;
     }
 }