private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e) { if (move()) { RoleBindingSource.MoveLast(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewRole.ClearColumnsFilter(); if (RoleBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source RoleBindingSource.DataSource = from opt in context.ROLE where opt.CODE == "KJM9" select opt; RoleBindingSource.AddNew(); if (GridViewRole.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewRole.FocusedRowHandle = GridViewRole.RowCount - 1; } tYPEComboBoxEdit.Focus(); setReadOnly(false); newRec = true; return; } tYPEComboBoxEdit.Focus(); //bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewRole.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( ROLE)RoleBindingSource.Current); } RoleBindingSource.AddNew(); if (GridViewRole.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewRole.FocusedRowHandle = GridViewRole.RowCount - 1; } tYPEComboBoxEdit.Focus(); setReadOnly(false); newRec = true; } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (RoleBindingSource.Current == null) { return; } GridViewRole.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; RoleBindingSource.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 = tYPEComboBoxEdit.Text; }