private void VouchGenForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter && GridViewVouch.IsFilterRow(GridViewVouch.FocusedRowHandle)) { executeQuery(); } }
private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e) { if (VoucherBindingSource.Current == null) { VoucherBindingSource.AddNew(); TextEditAgyNo.Focus(); //agyNoTextEdit.Properties.ReadOnly = false; //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = true; newRec = true; return; } TextEditAgyNo.Focus(); //bindingNavigatorPositionItem.Focus(); //trigger field leave event GridViewVouch.CloseEditor(); temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (VOUCHER)VoucherBindingSource.Current); } VoucherBindingSource.AddNew(); TextEditAgyNo.Focus(); //agyNoTextEdit.Properties.ReadOnly = false; //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = true; newRec = true; } }
private void gridView1_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (!GridViewVouch.IsFilterRow(e.RowHandle)) { modified = true; } }
private void vOUCHERBindingNavigatorSaveItem_Click(object sender, EventArgs e) { if (VoucherBindingSource.Current == null) { return; } GridViewVouch.CloseEditor(); TextEditAgyNo.Focus(); bool temp = newRec; // bindingNavigatorPositionItem.Focus();//trigger field leave event if (checkForms()) { TextEditAgyNo.Focus(); //agyNoTextEdit.Properties.ReadOnly = true; //gridView1.Columns.ColumnByName(colName1).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, (VOUCHER)VoucherBindingSource.Current); } }
private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e) { if (VoucherBindingSource.Current == null) { return; } GridViewVouch.CloseEditor(); if (MessageBox.Show("Are you sure you want to delete?", "CONFIRM", MessageBoxButtons.YesNo) == DialogResult.Yes) { modified = false; newRec = false; VoucherBindingSource.RemoveCurrent(); errorProvider1.Clear(); context.SaveChanges(); //agyNoTextEdit.Properties.ReadOnly = true; //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = false; panelControlStatus.Visible = true; LabelStatus.Text = "Record Deleted"; rowStatusDelete = new Timer(); rowStatusDelete.Interval = 3000; rowStatusDelete.Start(); rowStatusDelete.Tick += new EventHandler(TimedEventDelete); } currentVal = TextEditAgyNo.Text; }
private void executeQuery() { this.Cursor = Cursors.WaitCursor; string colName = GridViewVouch.FocusedColumn.FieldName; string value = String.Empty; if (!string.IsNullOrWhiteSpace(GridViewVouch.GetFocusedDisplayText())) { value = GridViewVouch.GetFocusedDisplayText(); } if (!string.IsNullOrWhiteSpace(value)) { string query = String.Format("it.VoucherNo like '{0}%'", GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "VoucherNo")); var special = context.HRATES.Where(query); if (!string.IsNullOrWhiteSpace(GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "AgyNo"))) { query = String.Format("it.{0} like '{1}%'", "AgyNo", GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "AgyNo")); special = special.Where(query); } if (!string.IsNullOrWhiteSpace(GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "Code"))) { query = String.Format("it.{0} like '{1}%'", "Code", GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "Code")); special = special.Where(query); } if (!string.IsNullOrWhiteSpace(GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "StartDate"))) { string validDate = GridViewVouch.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, "StartDate"); string values = validCheck.convertDate(validDate); if (!string.IsNullOrWhiteSpace(values)) { DateTime startDate = Convert.ToDateTime(values); special = special.Where("it.StartDate >= @date", new ObjectParameter("date", startDate)); } } int count = special.Count(); if (count > 0) { VoucherBindingSource.DataSource = special; GridViewVouch.SetRowCellValue(GridControl.AutoFilterRowHandle, colName, value); GridViewVouch.FocusedRowHandle = 0; GridViewVouch.FocusedColumn.FieldName = colName; } else { MessageBox.Show("No records in database."); GridViewVouch.ClearColumnsFilter(); } } this.Cursor = Cursors.Default; }
private bool move() { GridViewVouch.CloseEditor(); TextEditAgyNo.Focus(); //bindingNavigatorPositionItem.Focus();//trigger field leave event temp = newRec; if (checkForms()) { if (!temp) { context.Refresh(System.Data.Entity.Core.Objects.RefreshMode.StoreWins, (VOUCHER)VoucherBindingSource.Current); } //agyNoTextEdit.Properties.ReadOnly = true; //gridView1.Columns.ColumnByName(colName1).OptionsColumn.AllowEdit = false; newRec = false; modified = false; return(true); } return(false); }