/// <summary> /// 填充数据 /// </summary> /// <param name="cmd"></param> void ProcessInitLoadData(CtrlPlatformCommandInfo cmd) { _ItemsSource = DynamicallyGeneratedClass.ToList(cmd.ExecSql[0].Result); UpdateComboBoxItemsSource(cmd); if (null != _ConditionByWhere) { UpdateComboBoxItemsSource(_ConditionByWhere); } }
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; }
/// <summary> /// 登录操作 /// </summary> /// <param name="cmd"></param> void ProcessLogon(CtrlPlatformCommandInfo cmd) { var result = cmd.ExecSql[0]; if (result.Error.IsNotEmpty()) { _IPageRuntime.AlertMessage(result.Error); return; } var model = DynamicallyGeneratedClass.ToFirst(result.Result); if (null == model) { _IPageRuntime.AlertMessage("用户名或密码不正确。"); return; } _NotifyRuntimePage(ConstantCollection.Composite_Control_LoginSucess); }
void ProcessInitLoad(CtrlPlatformCommandInfo cmd) { var datatable = cmd.ExecSql[0].Result; //-->给控件赋值操作。 List <MetaDataColumnInfo> columns = DynamicallyGeneratedClass.GetDataTableColumnCollection(datatable);//, _MetaDataInfo.table_name); if (null == columns) { return; } var firstRow = datatable.Element("rows").Elements("row").GetFirst <XElement>(); foreach (var column in columns) { string controlName = string.Format("{0}_{1}", this.Name, column.column_name); var icc = _IPageRuntime.FindControl(controlName) as ICompositeCtrl; if (null == icc) { continue; } column.column_value = firstRow.GetAttributeValue(column.column_name.ToLower()); column.table_name = _MetaDataInfo.table_name; column.table_type = _MetaDataInfo.table_type; column.table_comment = _MetaDataInfo.table_comment; CtrlPlatformCommandInfo newCmd = new CtrlPlatformCommandInfo(); newCmd.ParamCollection = column.ToXElement(); newCmd.MetaDataInfo = new MetaDataInfo(); newCmd.MetaDataInfo.Item = new List <MetaDataColumnInfo>(); newCmd.MetaDataInfo.Item.Add(column); newCmd.ControlInfo = _IPageRuntime.GetControlInfoByControlName(controlName); icc.InputParameter(newCmd); } this._NotifyRuntimePage(ConstantCollection.COMPOSITE_CONTROL_INIT_LOAD_COMPLATE); }