bool UpdateMetaDataInfo()
        {
            var fields = this.lboxFields.Tag as List <MetaDataColumnInfo>;

            if (null == fields || 0 == fields.Count)
            {
                Wrapper.ShowDialog("字符参数为空");
                return(false);
            }
            var          dt  = fields[0];
            MetaDataInfo mdi = new MetaDataInfo();

            //-->克隆出数据。
            mdi.Item          = fields.CloneList <MetaDataColumnInfo>();
            mdi.table_comment = dt.table_comment;
            mdi.table_name    = dt.table_name;
            mdi.table_type    = dt.table_type;
            foreach (var data in mdi.Item)
            {
                data.table_comment = string.Empty;
                data.table_name    = string.Empty;
                data.table_type    = string.Empty;
            }
            var xml = IDesignFramework.GetCurrentXmlTemplate();
            var ci  = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName);

            if (null == ci)
            {
                Wrapper.ShowDialog("找不着控件信息。");
                return(false);
            }
            ci.MetaData   = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData;
            ci.ColumnName = ci.ColumnName.IsNullOrEmpty() ? _SaveField : ci.ColumnName;

            ci.ControlDataSourceTableName = mdi.table_name;
            //-->判断tableName是否已经增加了
            MetaDataInfo old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name);

            if (null == old_mdi)
            {
                xml.MetaDataItem.Add(mdi);
            }
            else
            {
                //-->判断列是否已经存在。
                foreach (var column in mdi.Item)
                {
                    var col = old_mdi.Item.Where(p => p.column_name.Equals(column.column_name)).GetFirst <MetaDataColumnInfo>();
                    if (null != col)
                    {
                        old_mdi.Item.Remove(col);
                    }
                    old_mdi.Item.Add(column);
                }
            }
            IDesignFramework.UpdateCurrentTemplate();
            return(true);
        }
示例#2
0
        void lb_Controls1Function_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            sp_Children.Children.Clear();
            ListBoxItemExtend controls = lb_Controls1.SelectedItem as ListBoxItemExtend;
            var parameterItem          = controls.Tag as List <MetaDataColumnInfo>;

            if (null != parameterItem)
            {
                foreach (var v in parameterItem)
                {
                    ParameterSelected ps = new ParameterSelected();
                    ps.txtParamName.Text = string.Format("{0}【{1}】", v.column_name, v.column_comment);
                    ps.OrgMetaDataColumn = v;
                    ps.FieldName         = v.column_name;
                    ps.DeleteClick      += ps_DeleteClick;
                    ps.ModifyClick      += ps_ModifyClick;
                    sp_Children.Children.Add(ps);
                }
            }

            var ci = controls.ControlInfo;

            /******************************************************************************
             *
             * 控件的参数就是控件MetaData里的row信息,
             *
             * ControlDataSourceTable 所处在的 MetaData信息也要取出来。
             *
             * *****************************************************************************/
            if (!ci.ControlDataSourceTableName.IsNullOrEmpty())
            {
                var mdi = IDesignFramework.GetMetaDataInfoByTableName(ci.ControlDataSourceTableName);
                if (null != mdi && null != mdi.Item && 0 < mdi.Item.Count)
                {
                    Label lbl = new Label();
                    lbl.Height     = 2;
                    lbl.Background = new SolidColorBrush(Colors.Black);
                    sp_Children.Children.Add(lbl);
                    foreach (var item in mdi.Item)
                    {
                        ParameterSelected ps = new ParameterSelected();
                        ps.txtParamName.Text = string.Format("{0}【{1}】", item.column_name, item.column_comment);
                        ps.OrgMetaDataColumn = item;
                        ps.FieldName         = item.column_name;
                        ps.OrgIsDataSource   = true;
                        ps.DeleteClick      += ps_DeleteClick;
                        ps.ModifyClick      += ps_ModifyClick;
                        sp_Children.Children.Add(ps);
                    }
                }
            }
            if (sp_Children.Children.Count > 0)
            {
                _CurrentParamterSelected = sp_Children.Children[0] as ParameterSelected;
            }
        }
        void LoadCtrlParam(ControlInfo ci, List <MetaDataColumnInfo> paramItem)
        {
            if (ci.MetaData.IsNotEmpty())
            {
                foreach (var v in paramItem)
                {
                    var ps = new ParameterSelected();
                    ps.txtParamName.Text = string.Format("{0}【{1}】", v.column_name, v.column_comment);
                    ps.OrgMetaDataColumn = v;
                    ps.FieldName         = v.column_name;
                    ps.DeleteClick      += ps_DeleteClick;
                    ps.ModifyClick      += ps_ModifyClick;
                    spCtrlParams.Children.Add(ps);
                }
            }

            /******************************************************************************
             *
             * 控件的参数就是控件MetaData里的row信息,
             *
             * ControlDataSourceTable 所处在的 MetaData信息也要取出来。
             *
             * *****************************************************************************/
            if (ci.ControlDataSourceTableName.IsNotEmpty())
            {
                var mdi = IDesignFramework.GetMetaDataInfoByTableName(ci.ControlDataSourceTableName);
                if (null != mdi && null != mdi.Item && 0 < mdi.Item.Count)
                {
                    Label lbl = new Label();
                    lbl.Height     = 2;
                    lbl.Background = new SolidColorBrush(Colors.Black);
                    spCtrlParams.Children.Add(lbl);
                    foreach (var item in mdi.Item)
                    {
                        ParameterSelected ps = new ParameterSelected();
                        ps.txtParamName.Text = string.Format("{0}【{1}】", item.column_name, item.column_comment);
                        ps.OrgMetaDataColumn = item;
                        ps.FieldName         = item.column_name;
                        ps.OrgIsDataSource   = true;
                        ps.DeleteClick      += ps_DeleteClick;
                        ps.ModifyClick      += ps_ModifyClick;
                        spCtrlParams.Children.Add(ps);
                    }
                }
            }
        }
示例#4
0
        void SetParameterSelectedValue(ParameterSelected ps, ParamInfo pi)
        {
            var _target_ci = IDesignFramework.GetControlInfoByControlName(pi.TargetCtrlName);

            if (null == _target_ci)
            {
                return;
            }
            var _target_mdi = IDesignFramework.GetMetaDataInfoByTableName(_target_ci.MetaData);

            if (null == _target_mdi)
            {
                return;
            }
            var _target_mdc = _target_mdi.Item.Where(p => p.column_name.Equals(pi.TargetFieldName)).GetFirst <MetaDataColumnInfo>();

            if (null == _target_mdc)
            {
                return;
            }
            ps.InitLoadValue = pi;
            ps.Text          = _target_mdc.column_comment;
        }
示例#5
0
        List <MetaDataColumnInfo> _GetControlParameter(string MetaData, string ColumnName)
        {
            if (MetaData.IsNullOrEmpty() || ColumnName.IsNullOrEmpty())
            {
                return(null);
            }
            //-->查找 metadata 里 row里的信息
            var row = IDesignFramework.GetMetaDataInfoByTableName(MetaData);

            if (null == row)
            {
                return(null);
            }
            var items = ColumnName.Split('|');

            if (1 < items.Length)
            {
                List <MetaDataColumnInfo> columns = new List <MetaDataColumnInfo>();
                foreach (var item in items)
                {
                    foreach (var column in row.Item)
                    {
                        if (column.column_name.Equals(item))
                        {
                            columns.Add(column);
                            break;
                        }
                    }
                }
                return(columns);
            }
            else
            {
                return(row.Item.Where(p => p.column_name.Equals(ColumnName)).GetTList <MetaDataColumnInfo>());
            }
        }
示例#6
0
        /// <summary>
        /// 获取控件参数
        /// </summary>
        /// <param name="xml"></param>
        /// <param name="MetaData"></param>
        /// <param name="ColumnName"></param>
        /// <returns></returns>
        List <MetaDataColumnInfo> _GetControlParameter(XmlTemplate xml, string MetaData, string ColumnName)
        {
            if (MetaData.IsNullOrEmpty() || ColumnName.IsNullOrEmpty())
            {
                return(null);
            }
            //-->查找 metadata 里 row里的信息
            var mdis = IDesignFramework.GetMetaDataInfoByTableName(MetaData);

            if (null == mdis)
            {
                return(null);
            }
            var items = ColumnName.Split('|');

            if (1 < items.Length)
            {
                List <MetaDataColumnInfo> datas = new List <MetaDataColumnInfo>();
                foreach (var field in items)
                {
                    foreach (var mdci in mdis.Item)
                    {
                        if (mdci.column_name.Equals(field))
                        {
                            datas.Add(mdci);
                            break;
                        }
                    }
                }
                return(datas);
            }
            else
            {
                return(mdis.Item.Where(p => p.column_name.Equals(ColumnName)).GetTList <MetaDataColumnInfo>());
            }
        }
        bool UpdateXml()
        {
            if (null == metadata_username)
            {
                Wrapper.ShowDialog("请选择要关联的用户名字段!");
                return(false);
            }
            if (null == metadata_password)
            {
                Wrapper.ShowDialog("请选择要关联的密码字段!");
                return(false);
            }

            var fields = xtnTableField.Fields;

            if (null == fields || 0 == fields.Count)
            {
                Wrapper.ShowDialog("字符参数为空");
                return(false);
            }
            var dt  = fields[0];
            var mdi = new MetaDataInfo();

            //-->克隆出数据。
            mdi.Item          = fields.CloneList <MetaDataColumnInfo>();
            mdi.table_comment = dt.table_comment;
            mdi.table_name    = dt.table_name;
            mdi.table_type    = dt.table_type;
            foreach (var data in mdi.Item)
            {
                data.table_comment = string.Empty;
                data.table_name    = string.Empty;
                data.table_type    = string.Empty;
            }
            var xml = IDesignFramework.GetCurrentXmlTemplate();
            var ci  = IDesignFramework.GetControlInfoByControlName(this.CurrentSelectedControlName);

            if (null == ci)
            {
                Wrapper.ShowDialog("找不着控件信息。");
                return(false);
            }

            ci.MetaData   = ci.MetaData.IsNullOrEmpty() ? _TableName : ci.MetaData;
            ci.ColumnName = string.Format("{0}|{1}", _UserField, _PasswordField);

            ci.ControlDataSourceTableName = mdi.table_name;
            //-->判断tableName是否已经增加了
            var old_mdi = IDesignFramework.GetMetaDataInfoByTableName(mdi.table_name);

            if (null == old_mdi)
            {
                xml.MetaDataItem.Add(mdi);
            }
            IDesignFramework.UpdateCurrentTemplate();

            string value = string.Format("{0}|{1}|{2}", this.xtnTableField.TableName, _UserField, _PasswordField);

            _EvaluationContent = new XElement("DataAssociated", value);

            return(true);
        }