예제 #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;
 }
예제 #2
0
        private void cONSRTBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (ConsrtBindingSource.Current == null)
            {
                return;
            }
            GridViewConsrt.CloseEditor();
            cODETextEdit.Focus();
            // bindingNavigatorPositionItem.Focus();//trigger field leave event
            bool temp = newRec;

            if (checkForms())
            {
                errorProvider1.Clear();
                cODETextEdit.Properties.ReadOnly = true;
                GridViewConsrt.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
                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, (CONSRT)ConsrtBindingSource.Current);
            }
        }
예제 #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;
     }
 }
예제 #4
0
        private bool move()
        {
            GridViewConsrt.CloseEditor();
            cODETextEdit.Focus();
            // bindingNavigatorPositionItem.Focus();//trigger field leave event
            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);
                }
                cODETextEdit.Properties.ReadOnly = true;
                GridViewConsrt.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false;
                newRec   = false;
                modified = false;
                return(true);
            }
            return(false);
        }