private void aIRSEGBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (AirSegBindingSource.Current == null) { return; } GridViewAirSeg.CloseEditor(); ImageComboBoxEditAir.Focus(); //bindingNavigatorPositionItem.Focus();//trigger field leave event bool temp = newRec; if (checkForms()) { lockGrid(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, (AIRSEG)AirSegBindingSource.Current); } }
private void AirSegForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && GridViewAirSeg.IsFilterRow(GridViewAirSeg.FocusedRowHandle)) { executeQuery(); } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (AirSegBindingSource.Current == null) { return; } GridViewAirSeg.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; AirSegBindingSource.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); } lockGrid(true); ImageComboBoxEditAir.Focus(); currentVal = ImageComboBoxEditAir.Text; modified = false; newRec = false; }
private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (!GridViewAirSeg.IsFilterRow(e.RowHandle)) { modified = true; } labelControl17.Text = DateTime.Today.ToShortDateString(); labelControl19.Text = username; }
private void setValues() { GridViewAirSeg.SetFocusedRowCellValue("CODE", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("SEG", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("CAT", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("H_L", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("YEAR", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("DESC", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("ADG_RATE", 0); GridViewAirSeg.SetFocusedRowCellValue("ADN_RATE", 0); GridViewAirSeg.SetFocusedRowCellValue("COMMENT1", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("COMMENT2", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("OPERATOR", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("AGENCY", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("COMM_FLG", string.Empty); GridViewAirSeg.SetFocusedRowCellValue("COMM_PCT", 0); }
private bool move() { GridViewAirSeg.CloseEditor(); ImageComboBoxEditAir.Focus(); // bindingNavigatorPositionItem.Focus();//trigger field leave event temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current); } lockGrid(true); newRec = false; modified = false; return(true); } return(false); }
private void executeQuery() { this.Cursor = Cursors.WaitCursor; string colName = GridViewAirSeg.FocusedColumn.FieldName; string value = String.Empty; if (!string.IsNullOrWhiteSpace(GridViewAirSeg.GetFocusedDisplayText())) { value = GridViewAirSeg.GetFocusedDisplayText(); } if (!string.IsNullOrWhiteSpace(value)) { string query = String.Format("it.CAT like '{0}%'", GridViewAirSeg.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CAT")); var special = context.AIRSEG.Where(query); if (!string.IsNullOrWhiteSpace(GridViewAirSeg.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE"))) { query = String.Format("it.{0} like '{1}%'", "CODE", GridViewAirSeg.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "CODE")); special = special.Where(query); } if (!string.IsNullOrWhiteSpace(GridViewAirSeg.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "SEG"))) { query = String.Format("it.{0} like '{1}%'", "SEG", GridViewAirSeg.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "SEG")); special = special.Where(query); } int count = special.Count(); if (count > 0) { AirSegBindingSource.DataSource = special; GridViewAirSeg.ClearColumnsFilter(); } else { MessageBox.Show("No records in database."); GridViewAirSeg.ClearColumnsFilter(); } } this.Cursor = Cursors.Default; }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { GridViewAirSeg.ClearColumnsFilter(); if (AirSegBindingSource.Current == null) { //fake query in order to create a link between the database table and the binding source AirSegBindingSource.DataSource = from opt in context.AIRSEG where opt.CODE == "KJM9" select opt; AirSegBindingSource.AddNew(); if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1; } setValues(); ImageComboBoxEditAir.Focus(); lockGrid(false); newRec = true; return; } ImageComboBoxEditAir.Focus(); // bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewAirSeg.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (AIRSEG)AirSegBindingSource.Current); } AirSegBindingSource.AddNew(); if (GridViewAirSeg.FocusedRowHandle == GridControl.AutoFilterRowHandle) { GridViewAirSeg.FocusedRowHandle = GridViewAirSeg.RowCount - 1; } ImageComboBoxEditAir.Focus(); lockGrid(false); newRec = true; } }