private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (CarRateBindingSource.Current == null) { return; } if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; CarRateBindingSource.RemoveCurrent(); errorProvider1.Clear(); context.SaveChanges(); sTART_DATEDateEdit.Properties.ReadOnly = true; setReadOnly(true); panelControlStatus.Visible = true; LabelStatus.Text = "Record Deleted"; rowStatusDelete = new Timer(); rowStatusDelete.Interval = 3000; rowStatusDelete.Start(); rowStatusDelete.Tick += new EventHandler(TimedEventDelete); } ImageComboBoxEditCode.Focus();//currentVal currentVal = ImageComboBoxEditCode.Text; modified = false; newRec = false; }
private void bindingNavigatorMoveLastItem_Click(object sender, EventArgs e) { if (move()) { CarRateBindingSource.MoveLast(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { AdvBandedGridViewCarRate.ClearColumnsFilter(); if (CarRateBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source CarRateBindingSource.DataSource = from opt in context.CARRATES where opt.CODE == "KJM9" select opt; CarRateBindingSource.AddNew(); if (AdvBandedGridViewCarRate.FocusedRowHandle == GridControl.AutoFilterRowHandle) { AdvBandedGridViewCarRate.FocusedRowHandle = AdvBandedGridViewCarRate.RowCount - 1; } setValues(); ImageComboBoxEditCode.Focus(); setReadOnly(false); sTART_DATEDateEdit.Properties.ReadOnly = false; newRec = true; return; } ImageComboBoxEditCode.Focus(); // bindingNavigatorPositionItem.Focus(); //trigger field leave event temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( CARRATES)CarRateBindingSource.Current); } CarRateBindingSource.AddNew(); if (AdvBandedGridViewCarRate.FocusedRowHandle == GridControl.AutoFilterRowHandle) { AdvBandedGridViewCarRate.FocusedRowHandle = AdvBandedGridViewCarRate.RowCount - 1; } setValues(); ImageComboBoxEditCode.Focus(); setReadOnly(false); sTART_DATEDateEdit.Properties.ReadOnly = false; newRec = true; } }