//public DataRow FindRowByKey(string KeyField, string KeyValue) => Table.Select($"{KeyField}={KeyValue}").FirstOrDefault();

        public string GetValue(CurrentRowChangedEventArgs e, string FieldName)
        {
            string s = string.Empty;

            try { s = e.CurrentRow.Cells[Standard.GetGridColumnName(FieldName)].Value.ToString(); } catch { s = string.Empty; }
            return(s);
        }
        public void AddSorting(string fieldName, ListSortDirection sortDirection = ListSortDirection.Ascending)
        {
            SortDescriptor GridSorting1 = new SortDescriptor();

            GridSorting1.PropertyName = Standard.GetGridColumnName(fieldName);
            GridSorting1.Direction    = sortDirection;
            Grid.SortDescriptors.Add(GridSorting1);
        }
 public static void ZzFilter(this RadGridView grid, string FieldName, FilterOperator filterOperator, object value, bool ClearPreviousFilter = true)
 {
     if (ClearPreviousFilter)
     {
         grid.FilterDescriptors.Clear();
     }
     grid.FilterDescriptors.Add(Standard.GetGridColumnName(FieldName), FilterOperator.StartsWith, value);
 }
        public T CreateColumnCombobox <T>(string fieldName, string headerText, bool readOnly, BindingList <Model.SimpleEntity> list)
            where T : GridViewDataColumn, new()
        {
            T dc = new T()
            {
                FieldName  = fieldName,
                HeaderText = headerText,
                Name       = Standard.GetGridColumnName(fieldName),
                ReadOnly   = readOnly
            };

            if (list != null)
            {
                GridViewComboBoxColumn combobox = (dc as GridViewComboBoxColumn);
                if (combobox == null)
                {
                    MessageBox.Show($"Ошибка! Неправильно указан тип столбца {headerText} - должен быть GridViewComboBoxColumn.");
                }
                combobox.DataSource    = list;
                combobox.ValueMember   = nameof(Model.Classificator.IdObject);
                combobox.DisplayMember = nameof(Model.Classificator.NameObject);
            }
            return(dc);
        }
        public T CreateColumn <T>(string fieldName, string headerText, bool readOnly, DataTable table = null, string valueMember = "", string displayMember = "")
            where T : GridViewDataColumn, new()
        {
            T dc = new T()
            {
                FieldName  = fieldName,
                HeaderText = headerText,
                Name       = Standard.GetGridColumnName(fieldName),
                ReadOnly   = readOnly
            };

            if (table != null)
            {
                GridViewComboBoxColumn combobox = (dc as GridViewComboBoxColumn);
                if (combobox == null)
                {
                    MessageBox.Show("Ошибка! Неправильно указан тип столбца грида - должен быть GridViewComboBoxColumn.");
                }
                combobox.DataSource    = table;
                combobox.ValueMember   = valueMember == "" ? nameof(Model.Classificator.IdObject) : valueMember;
                combobox.DisplayMember = displayMember == "" ? nameof(Model.Classificator.NameObject) : displayMember;
            }
            return(dc);
        }
Beispiel #6
0
 public static string ZzGetCellValue(this GridViewRowInfo row, string FieldName) => row.Cells[Standard.GetGridColumnName(FieldName)].Value.ToString();
 public static int ZzGetIntegerValueByFieldName(this RadGridView grid, string FieldName, int DefaultValue) => CxConvert.ToInt32(ZzGetStringValue(grid, Standard.GetGridColumnName(FieldName)), DefaultValue);
 public static string ZzGetStringValueByFieldName(this RadGridView grid, string FieldName) => ZzGetStringValue(grid, Standard.GetGridColumnName(FieldName));