private void bindingNavigatorDeleteItem_Click(object sender, System.EventArgs e) { if (SvcRestrBindingSource.Current == null) { return; } GridViewSvcRestr.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; SvcRestrBindingSource.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); ImageComboBoxEditCode.Focus(); currentVal = ImageComboBoxEditCode.Text; setReadOnly(true); modified = false; newRec = false; } }
private void sVCRESTR2BindingNavigatorSaveItem_Click(object sender, System.EventArgs e) { GridViewSvcRestr.ClearColumnsFilter(); if (SvcRestrBindingSource.Current == null) { return; } if (!checkRestrCode()) { MessageBox.Show("The restriction code for this property/service must be set to ‘A’ (agency) in order to save a record in the service restriction file."); return; } GridViewSvcRestr.CloseEditor(); ComboBoxEditType.Focus(); //bindingNavigatorPositionItem.Focus();//trigger field leave event bool temp = newRec; if (checkForms()) { ImageComboBoxEditCode.Focus(); panelControlStatus.Visible = true; LabelStatus.Text = "Record Saved"; rowStatusSave = new Timer(); rowStatusSave.Interval = 3000; rowStatusSave.Start(); rowStatusSave.Tick += TimedEventSave; setReadOnly(true); } if (!temp && !modified) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SVCRESTR)SvcRestrBindingSource.Current); } }
private void bindingNavigatorAddNewItem_Click(object sender, System.EventArgs e) { GridViewSvcRestr.ClearColumnsFilter(); if (SvcRestrBindingSource.Current == null) { SvcRestrBindingSource.DataSource = from packrec in context.SVCRESTR where packrec.CODE == "KJM987" select packrec; SvcRestrBindingSource.AddNew(); if (GridViewSvcRestr.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewSvcRestr.FocusedRowHandle = GridViewSvcRestr.RowCount - 1; } ComboBoxEditType.Focus(); newRec = true; setReadOnly(false); setValues(); return; } ComboBoxEditType.Focus(); //bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewSvcRestr.CloseEditor(); temp = newRec; if (checkForms()) { errorProvider1.Clear(); if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SVCRESTR)SvcRestrBindingSource.Current); } SvcRestrBindingSource.AddNew(); if (GridViewSvcRestr.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewSvcRestr.FocusedRowHandle = GridViewSvcRestr.RowCount - 1; } ComboBoxEditType.Focus(); newRec = true; setValues(); setReadOnly(false); } }
private bool move() { GridViewSvcRestr.CloseEditor(); ComboBoxEditType.Focus(); // bindingNavigatorPositionItem.Focus();//trigger field leave event temp = newRec; if (checkForms()) { errorProvider1.Clear(); if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (SVCRESTR)SvcRestrBindingSource.Current); } setReadOnly(true); newRec = false; modified = false; return(true); } return(false); }