Esempio n. 1
0
        private void ExecuteQuery()
        {
            Cursor = Cursors.WaitCursor;
            string query = "1=1";

            foreach (DevExpress.XtraGrid.Columns.GridColumn col in GridViewLookup.VisibleColumns)
            {
                string value = GridViewLookup.GetRowCellDisplayText(GridControl.AutoFilterRowHandle, col.FieldName);
                if (!string.IsNullOrEmpty(value))
                {
                    query += $" and it.[{col.FieldName}] like '%{value}%'";
                }
            }
            query += " order by it.Product_Type, it.Product_Code, it.Position";

            var records = _context.RelatedProduct.Where(query);

            if (records.Count() > 0)
            {
                BindingSource.DataSource = records;
                GridViewLookup.ClearColumnsFilter();
            }
            else
            {
                ClearBindings();
                DisplayHelper.DisplayInfo(this, "No matching records found.");
            }
            this.Cursor = Cursors.Default;
        }
Esempio n. 2
0
 private void LanguageForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && GridViewLookup.IsFilterRow(GridViewLookup.FocusedRowHandle)) {
         ExecuteQuery();
         e.Handled = true;
     }
 }
Esempio n. 3
0
 private void BarButtonItemDown_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_selectedRecord.ID != 0)
     {
         RelatedProduct nextProduct = (RelatedProduct)GridViewLookup.GetRow(GridViewLookup.FocusedRowHandle + 1);
         nextProduct.Position     -= 1;
         _selectedRecord.Position += 1;
     }
 }
Esempio n. 4
0
 private void BarButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     _ignoreLeaveRow = true;       //so that when the grid row changes it doesn't try to save again
     if (SaveRecord(true))
     {
         GridViewLookup.ClearColumnsFilter();
         BindingSource.AddNew();
         GridViewLookup.FocusedRowHandle = GridViewLookup.RowCount - 1;
         comboBoxEditMasterType.Focus();
         SetReadOnly(false);
     }
     _ignoreLeaveRow = false;
 }
Esempio n. 5
0
 private void BarButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     _ignoreLeaveRow = true;       //so that when the grid row changes it doesn't try to save again
     if (SaveRecord(true)) {
         GridViewLookup.ClearColumnsFilter();    //so that the new record will show even if it doesn't match the filter
         BindingSource.AddNew();
         //if (GridViewRoute.FocusedRowHandle == GridControl.AutoFilterRowHandle)
         GridViewLookup.FocusedRowHandle = GridViewLookup.RowCount - 1;
         SetReadOnlyKeyFields(false);
         TextEditCode.Focus();
         SetReadOnly(false);
     }
     ErrorProvider.Clear();
     _ignoreLeaveRow = false;
 }
Esempio n. 6
0
 private void BarButtonItemUp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_selectedRecord.Position == null || _selectedRecord.Position > 0)
     {
         var prior = GridViewLookup.GetRow(GridViewLookup.FocusedRowHandle - 1);
         if (prior != null)
         {
             RelatedProduct priorProduct = (RelatedProduct)prior;
             if (priorProduct.Product_Code == _selectedRecord.Product_Code && priorProduct.Product_Type == _selectedRecord.Product_Type &&
                 priorProduct.Position != null)
             {
                 priorProduct.Position += 1;
             }
             if (_selectedRecord.Position != null)
             {
                 _selectedRecord.Position -= 1;
             }
         }
     }
 }