private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e) { if (move()) { AmenityBindingSource.MoveLast(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(sVCComboBoxEdit.Text)) { MessageBox.Show("Please select a valid service type before attempting to add a new record."); return; } string pCode = TextEditCode.Text; decimal sOrder = sORT_ORDERSpinEdit.Value; sOrder += 1; int val = 0; if (treeList1.Nodes.Count > 0) { val = treeList1.FocusedNode.Nodes.Count; } sVCComboBoxEdit.Focus(); temp = newRec; if (checkForms()) { if (AmenityBindingSource.Current != null) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AMENITY)AmenityBindingSource.Current); } } AmenityBindingSource.AddNew(); sVCComboBoxEdit.Focus(); setValues(); setreadonly(false); setItems(false); newRec = true; } sVC_TYPETextEdit.Text = sVCComboBoxEdit.Text; pARENT_CODETextEdit.Text = pCode; sORT_ORDERSpinEdit.Value = sOrder + val; }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (AmenityBindingSource.Current == null) { return; } if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; AmenityBindingSource.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); setreadonly(true); } }