private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (HtlBrandBindingSource.Current == null) { return; } GridViewHtlBrand.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; HtlBrandBindingSource.RemoveCurrent(); errorProvider1.Clear(); context.SaveChanges(); HtlBrandBindingSource.EndEdit(); cODETextEdit.Properties.ReadOnly = true; GridViewHtlBrand.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false; panelControlStatus.Visible = true; LabelStatus.Text = "Record Deleted"; rowStatusDelete = new Timer(); rowStatusDelete.Interval = 3000; rowStatusDelete.Start(); rowStatusDelete.Tick += new EventHandler(TimedEventDelete); } currentVal = cODETextEdit.Text; }
private void hTLBRANDBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (HtlBrandBindingSource.Current == null) { return; } GridViewHtlBrand.CloseEditor(); cODETextEdit.Focus(); //bindingNavigatorPositionItem.Focus(); ((HTLBRAND)HtlBrandBindingSource.Current).ImagesRoot = imagesRoot; bool temp = newRec; if (checkForms()) { cODETextEdit.Focus(); cODETextEdit.Properties.ReadOnly = true; GridViewHtlBrand.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false; 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, (HTLBRAND)HtlBrandBindingSource.Current); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewHtlBrand.ClearColumnsFilter(); if (HtlBrandBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source HtlBrandBindingSource.DataSource = from opt in context.HTLBRAND where opt.CODE == "KJM9" select opt; HtlBrandBindingSource.AddNew(); if (GridViewHtlBrand.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewHtlBrand.FocusedRowHandle = GridViewHtlBrand.RowCount - 1; } setValues(); cODETextEdit.Focus(); cODETextEdit.Properties.ReadOnly = false; GridViewHtlBrand.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true; newRec = true; return; } cODETextEdit.Focus(); //bindingNavigatorPositionItem.Focus(); GridViewHtlBrand.CloseEditor(); temp = newRec; ((HTLBRAND)HtlBrandBindingSource.Current).ImagesRoot = imagesRoot; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (HTLBRAND)HtlBrandBindingSource.Current); } HtlBrandBindingSource.AddNew(); if (GridViewHtlBrand.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewHtlBrand.FocusedRowHandle = GridViewHtlBrand.RowCount - 1; } setValues(); cODETextEdit.Focus(); cODETextEdit.Properties.ReadOnly = false; GridViewHtlBrand.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = true; newRec = true; } }
private bool move() { GridViewHtlBrand.CloseEditor(); cODETextEdit.Focus(); //bindingNavigatorPositionItem.Focus(); temp = newRec; ((HTLBRAND)HtlBrandBindingSource.Current).ImagesRoot = imagesRoot; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, ( HTLBRAND)HtlBrandBindingSource.Current); } cODETextEdit.Properties.ReadOnly = true; GridViewHtlBrand.Columns.ColumnByName(colName).OptionsColumn.AllowEdit = false; newRec = false; modified = false; return(true); } return(false); }