Exemple #1
0
        /// <summary>
        /// 获取数据定义
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        //public DataDefine GetDataDefine(string xPath)
        //{
        //    DataDefine dataDefine = new DataDefine();
        //    foreach (XmlNode xmlnode in distFormXmlParser.GetNode(xPath))
        //    {
        //        DataDefineClass dataDefineClass = new DataDefineClass();
        //        dataDefineClass.Description = xmlnode.Attributes["description"].Value;
        //        dataDefineClass.Name = xmlnode.Attributes["name"].Value;
        //        foreach (XmlNode cxmlnode in xmlnode.ChildNodes)
        //        {
        //            ClassProperty classProperty=new ClassProperty();
        //            classProperty.Name=cxmlnode.Attributes["name"].Value;
        //            classProperty.Column = cxmlnode.Attributes["column"].Value;
        //            classProperty.Type = cxmlnode.Attributes["type"].Value;
        //            if(cxmlnode.Attributes["length"]!=null)
        //            classProperty.Length = cxmlnode.Attributes["length"].Value;
        //            dataDefineClass.Propertys.Add(classProperty);

        //        }
        //        dataDefine.Add(dataDefineClass);
        //    }
        //    return dataDefine;

        //}

        /// <summary>
        /// 获取数据源定义
        /// </summary>
        /// <returns></returns>
        //public DataSourceDefines GetDataSourceDefine(string xPath)
        //{
        //    DataSourceDefines dataSourceDefines = new DataSourceDefines();
        //    XmlNode Nodelist= distFormXmlParser.GetNode(xPath);
        //    foreach (XmlNode node in Nodelist)
        //    {
        //        CustomDataSourceDefine customDataSourceDefine = new CustomDataSourceDefine();
        //        customDataSourceDefine.Id = node.Attributes["id"].Value;
        //        customDataSourceDefine.Refer = node.Attributes["refer"].Value;
        //        List<Dictionary<string, string>> lis = new List<Dictionary<string, string>>();
        //        foreach (XmlNode nodeRow in node.ChildNodes)
        //        {
        //            Dictionary<string, string> dic = new Dictionary<string, string>();
        //            foreach (XmlNode nodeProperty in nodeRow.ChildNodes)
        //            {
        //                dic.Add(nodeProperty.Attributes["name"].Value,nodeProperty.InnerText);
        //            }
        //            lis.Add(dic);
        //        }
        //        dataSourceDefines.Add(customDataSourceDefine.Id, customDataSourceDefine);
        //    }
        //    return dataSourceDefines;
        //}

        /// <summary>
        /// 获取绑定数据集
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        //public FormDataCollection GetFormDataCollection(string xPath)
        //{
        //    FormDataCollection formDataCollection = new FormDataCollection();
        //    foreach (XmlNode xmlnode in distFormXmlParser.GetNode(xPath))
        //    {
        //        if (xmlnode.Name == "SingleItem")
        //        {
        //            SingleDataBindAttribute dataBindAttribute = new SingleDataBindAttribute(xmlnode.Attributes["id"].Value);
        //            dataBindAttribute.Value = xmlnode.Attributes["value"].Value;
        //            dataBindAttribute.Formatter = xmlnode.Attributes["formatter"].Value;
        //            dataBindAttribute.Datasource = xmlnode.Attributes["datasource"].Value;
        //            formDataCollection.Add(xmlnode.Attributes["id"].Value, dataBindAttribute);
        //        }
        //        else if (xmlnode.Name == "GridItem")
        //        {
        //            GridDataBindAttribute dataBindAttribute = new GridDataBindAttribute(xmlnode.Attributes["id"].Value);
        //            dataBindAttribute.Value = xmlnode.Attributes["value"].Value;
        //            foreach (XmlNode childnode in xmlnode.FirstChild)
        //            {
        //                GridColumnAttribute GridColumnAttribute = new GridColumnAttribute();
        //                GridColumnAttribute.Value = childnode.Attributes["value"].Value;
        //                if (childnode.Attributes["valueDescription"] != null)
        //                {
        //                    GridColumnAttribute.Description = childnode.Attributes["valueDescription"].Value;
        //                }
        //                GridColumnAttribute.Datasource = childnode.Attributes["datasource"].Value;
        //                dataBindAttribute.AddColumn(GridColumnAttribute);
        //            }
        //            formDataCollection.Add(xmlnode.Attributes["id"].Value, dataBindAttribute);
        //        }
        //    }
        //    return formDataCollection;
        //}

        /// <summary>
        /// 获取数据验证集
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        //public FormValidatesCollection GetFormValidatesCollection(string xPath)
        //{
        //    FormValidatesCollection formValidatesCollection = new FormValidatesCollection();
        //    foreach (XmlNode xmlnode in distFormXmlParser.GetNode(xPath))
        //    {
        //        ValidatesAttribute dataBindAttribute = new ValidatesAttribute(xmlnode.Attributes["id"].Value,xmlnode.Attributes["val"].Value);
        //        formValidatesCollection.Add(xmlnode.Attributes["id"].Value, dataBindAttribute);
        //    }
        //    return formValidatesCollection;
        //}

        /// <summary>
        /// 获取权限绑定集
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        //public FormRightsCollection GetFormRightsCollection(string xPath)
        //{
        //    FormRightsCollection formRightsCollection = new FormRightsCollection();
        //    foreach (XmlNode xmlnode in distFormXmlParser.GetNode(xPath))
        //    {
        //        StateCategory stateCategory = new StateCategory();
        //        stateCategory.Name = xmlnode.Attributes["name"].Value;
        //        stateCategory.Right = xmlnode.Attributes["right"].Value;
        //        foreach (XmlNode childXmlNode in xmlnode)
        //        {
        //            RightAttribute rightAttribute = new RightAttribute();
        //            rightAttribute.Id=childXmlNode.Attributes["id"].Value;
        //            rightAttribute.Right=childXmlNode.Attributes["right"].Value;
        //            rightAttribute.States = xmlnode.Attributes["name"].Value;
        //            stateCategory.Add(childXmlNode.Attributes["id"].Value, rightAttribute);
        //        }
        //        formRightsCollection.Add(xmlnode.Attributes["name"].Value, stateCategory);
        //    }
        //    return formRightsCollection;
        //}

        /// <summary>
        /// DataGrid 控件解析
        /// </summary>
        /// <param name="xmlnode"></param>
        /// <returns></returns>
        private DataGridControlAttribute AppendGrid(XmlNode xmlnode)
        {
            AddControl(xmlnode);
            DataGridControlAttribute dataGridControlAttribute = new DataGridControlAttribute();

            //dataGridControlAttribute.Left = Convert.ToInt32(xmlnode.Attributes["x"].Value);
            //dataGridControlAttribute.Top = Convert.ToInt32(xmlnode.Attributes["y"].Value);
            //dataGridControlAttribute.Height = Convert.ToInt32(xmlnode.Attributes["height"].Value);
            //dataGridControlAttribute.Width = Convert.ToInt32(xmlnode.Attributes["width"].Value);
            //dataGridControlAttribute.FormItemId = Convert.ToInt32(xmlnode.Attributes["id"].Value);
            //dataGridControlAttribute.FormItemType = Convert.ToInt16(DAP2ControlMapping.GetInstance().GetFormItemType(xmlnode.Name));
            //if (xmlnode.Attributes["extensionType"] != null)
            //{
            //    string enttype = DAP2ControlMapping.GetInstance().GetExtensionTypeId(dataGridControlAttribute.FormItemType.ToString()
            //        , xmlnode.Attributes["extensionType"].Value);
            //    if (!string.IsNullOrEmpty(enttype))
            //        dataGridControlAttribute.ExtensionType = Convert.ToInt16(enttype);
            //}
            //foreach (XmlNode node in xmlnode.ChildNodes)
            //{
            //    if (node.Name=="Columns")
            //    {
            //        foreach (XmlNode ColumnNode in node.ChildNodes)
            //        {
            //            Column Column = new Column();
            //            Column.Text = ColumnNode.Attributes["text"].Value;
            //            Column.Width = ColumnNode.Attributes["width"].Value;
            //            Column.Input = ColumnNode.Attributes["input"].Value;
            //            if (ColumnNode.Attributes["default"] != null)
            //            {
            //                Column.DefaultValue = ColumnNode.Attributes["default"].Value;
            //            }
            //            if (ColumnNode.Attributes["readonly"] != null)
            //            {
            //                Column.ReadOnly = ColumnNode.Attributes["readonly"].Value;
            //            }
            //            if (ColumnNode.Attributes["sum"]!=null)
            //            {
            //                Column.Sum = ColumnNode.Attributes["sum"].Value;
            //            }
            //            dataGridControlAttribute.AddColumn(Column);
            //        }
            //    }
            //    if (node.Name == "Rows")
            //    {
            //        if (_formDesignerWorkbenchWindow.GridRowDefine.ContainsKey(dataGridControlAttribute.FormItemId))
            //        {
            //            _formDesignerWorkbenchWindow.GridRowDefine.Remove(dataGridControlAttribute.FormItemId);
            //        }
            //        _formDesignerWorkbenchWindow.GridRowDefine.Add(dataGridControlAttribute.FormItemId, node);
            //    }
            //}

            return(dataGridControlAttribute);
        }
Exemple #2
0
        /// <summary>
        /// 获取控件信息集
        /// </summary>
        /// <param name="xPath"></param>
        /// <returns></returns>
        public ControlCollection GetControls(DockFormDesigner dockFormDesigner, string xPath, out Dictionary <string, string> panelProperty)
        {
            _dockFormDesigner = dockFormDesigner;
            ControlCollection controlCollection = new ControlCollection();
            XmlNode           contorlNodes      = formXmlParser.GetNode(xPath);

            panelProperty = new Dictionary <string, string>();
            //textBoxsType = new TextBoxsType();
            panelProperty.Add("width", contorlNodes.Attributes["width"].Value);
            panelProperty.Add("height", contorlNodes.Attributes["height"].Value);
            DockFormDesigner.controlDictionary.Clear();
            foreach (XmlNode xmlnode in contorlNodes)
            {
                GeneralAttribute generalAttribute = new GeneralAttribute();

                Int16 ItemType = 0;
                ItemType = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name));

                switch (ItemType)
                {
                case 5:
                    #region ItemType=5
                    TableContorlAttribute tableContorlAttribute = new TableContorlAttribute();
                    BindGeneralAttribute(tableContorlAttribute, xmlnode, Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(xmlnode.Name)));
                    foreach (XmlNode groupNode in xmlnode)
                    {
                        Group group = new Group();
                        group.Name = groupNode.Attributes["name"].Value;
                        foreach (XmlNode childNode in groupNode)
                        {
                            Int16 ItemTypec;
                            //if (childNode.Name == "DateTimePicker")
                            //{
                            //    ItemTypec = 1;
                            //    textBoxsType.AddTextBox(childNode.Attributes["id"].Value);
                            //}
                            //else
                            ItemTypec = Convert.ToInt16(ControlMapping.GetInstance().GetFormItemType(childNode.Name));
                            switch (ItemTypec)
                            {
                            case 7:
                                DataGridControlAttribute DataGridControlAttribute = AppendGrid(childNode);
                                group.AddGroupControl(DataGridControlAttribute.ControlId, DataGridControlAttribute);
                                break;

                            case 20:
                                RadioButtonListAttribute rbtlist = AppendRadioButton(childNode);
                                group.AddGroupControl(rbtlist.ControlId, rbtlist);
                                break;

                            default:

                                GeneralAttribute childContrlAttribute = new GeneralAttribute();
                                BindGeneralAttribute(childContrlAttribute, childNode, ItemTypec);
                                group.AddGroupControl(childContrlAttribute.ControlId, childContrlAttribute);
                                break;
                            }
                        }
                        tableContorlAttribute.AddGroup(group.Name, group);
                    }
                    generalAttribute = tableContorlAttribute;
                    #endregion
                    break;

                case 7:
                    generalAttribute = AppendGrid(xmlnode);
                    break;

                case 20:
                    generalAttribute = AppendRadioButton(xmlnode);
                    break;

                default:
                    BindGeneralAttribute(generalAttribute, xmlnode, ItemType);
                    break;
                }
                controlCollection.Add(xmlnode.Attributes["id"].Value, generalAttribute);
            }
            return(controlCollection);
        }