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