예제 #1
0
 /// <summary>
 /// 填充数据
 /// </summary>
 /// <param name="cmd"></param>
 void ProcessInitLoadData(CtrlPlatformCommandInfo cmd)
 {
     _ItemsSource = DynamicallyGeneratedClass.ToList(cmd.ExecSql[0].Result);
     UpdateComboBoxItemsSource(cmd);
     if (null != _ConditionByWhere)
     {
         UpdateComboBoxItemsSource(_ConditionByWhere);
     }
 }
예제 #2
0
        void _FillDataGrid(CtrlExecSQLCmd ctrlExecSQLCmd)
        {
            var _columns = DynamicallyGeneratedClass.GetDataTableColumnCollection(ctrlExecSQLCmd.Result);

            if (null == _columns)
            {
                this.xtn_Data.ItemsSource = null;
                return;
            }
            if (_columns.Count != _Columns.Count && _columns.Count != this.xtn_Data.Columns.Count)
            {
                //-->这里要进行转换
                int i = 0;
                Dictionary <int, MetaDataColumnInfo> _DictData = new Dictionary <int, MetaDataColumnInfo>();
                foreach (var xtnCol in this.xtn_Data.Columns)
                {
                    var dgCol  = xtnCol as DataGridTextColumn;
                    var path   = dgCol.Binding.Path.Path;
                    var conver = _InitLoadParameter.ControlInfo.Convert.Where(p => p.ColumnName.ToLower().Equals(path.ToLower())).GetFirst <ColumnDBConvertInfo>();
                    i++;
                    if (null == conver)
                    {
                        continue;
                    }
                    dgCol.Visibility = System.Windows.Visibility.Collapsed;
                    MetaDataColumnInfo col = new MetaDataColumnInfo();
                    col.column_name    = string.Format("{0}_{1}", conver.RelationField, conver.ColumnName).ToLower();// conver.DisplayField;
                    col.column_comment = dgCol.Header.ToString();
                    col.data_type      = "varchar";
                    _DictData.Add(i, col);
                    i++;
                }
                foreach (var dict in _DictData)
                {
                    var test = this.GetDataGridTextColumn(dict.Value);
                    if (null == test)
                    {
                        continue;
                    }
                    this.xtn_Data.Columns.Insert(dict.Key, test);
                }
            }
            var items = DynamicallyGeneratedClass.ToList(ctrlExecSQLCmd.Result, _columns);

            this.xtn_Data.ItemsSource = items;
        }