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