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

            GridViewSeaport.CloseEditor();
            if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                modified = false;
                newRec   = false;
                SeaPortBindingSource.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);
            }
            currentVal = codeTextEdit.Text;
        }
Ejemplo n.º 2
0
        private void BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            if (SeaPortBindingSource.Current == null)
            {
                return;
            }

            GridViewSeaport.CloseEditor();
            codeTextEdit.Focus();
            //bindingNavigatorPositionItem.Focus();//trigger field leave event
            bool temp = newRec;

            if (checkForms())
            {
                codeTextEdit.Focus();
                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, (SeaPort)SeaPortBindingSource.Current);
            }
        }
Ejemplo n.º 3
0
 private bool move()
 {
     GridViewSeaport.CloseEditor();
     codeTextEdit.Focus();
     // bindingNavigatorPositionItem.Focus();//trigger field leave event
     temp = newRec;
     if (checkForms())
     {
         if (!temp)
         {
             context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( SeaPort)SeaPortBindingSource.Current);
         }
         setReadOnly(true);
         newRec   = false;
         modified = false;
         return(true);
     }
     return(false);
 }
Ejemplo n.º 4
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            GridViewSeaport.ClearColumnsFilter();
            if (SeaPortBindingSource.Current == null)
            {
                //fake query in order to create a link between the database table and the binding source
                SeaPortBindingSource.DataSource = from opt in context.SeaPort where opt.Code == "KJM9" select opt;
                SeaPortBindingSource.AddNew();
                if (GridViewSeaport.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewSeaport.FocusedRowHandle = GridViewSeaport.RowCount - 1;
                }
                setValues();
                codeTextEdit.Focus();
                setReadOnly(false);
                newRec = true;
                return;
            }
            // bindingNavigatorPositionItem.Focus();  //trigger field leave event
            codeTextEdit.Focus();
            GridViewSeaport.CloseEditor();
            temp = newRec;
            if (checkForms())
            {
                if (!temp)
                {
                    context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( SeaPort)SeaPortBindingSource.Current);
                }
                SeaPortBindingSource.AddNew();
                if (GridViewSeaport.FocusedRowHandle == GridControl.AutoFilterRowHandle)
                {
                    GridViewSeaport.FocusedRowHandle = GridViewSeaport.RowCount - 1;
                }
                setValues();

                codeTextEdit.Focus();
                setReadOnly(false);
                newRec = true;
            }
        }