Exemple #1
0
        /// <summary>
        /// 获取页面字段Html
        /// </summary>
        /// <param name="mf">页面字段信息实体</param>
        /// <returns></returns>
        public static string SelectAllTableFieldHtml(Model.M_TableField mf)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<tr role=\"row\" class=\"odd\">");
            sb.Append("<td>" + mf.FieldKey + "<div class=\"input-group input-group-sm\"><input type=\"text\" name=\"FieldKey\" class=\"form-control hidden\" value='" + mf.FieldKey + "'/></div></td>");
            sb.Append("<td class=\"form-inline\"><div class=\"input-group input-group-sm\"><input type=\"text\" name=\"FieldText\"  class=\"form-control\" value='" + mf.FieldText + "\'/></div>");
            sb.Append("<a class=\"text-primary \" href=\"javascript:void(0)\" onclick=\"setFieldOther(this,'" + mf.FieldKey + "')\">&nbsp;其他设置</a>");
            sb.Append("<input type=\"text\" class=\"form-control hidden\" name=\"TextAlign\" value='" + mf.TextAlign + "'/>");
            sb.Append("<input type=\"text\" class=\"form-control hidden\" name=\"Width\" value='" + mf.Width + "'/>");
            sb.Append("<input type=\"text\" class=\"form-control hidden\" name=\"OtherCSS\" value='" + mf.OtherCSS + "'/>");
            sb.Append("</td>");
            sb.Append("<td class=\"form-inline\">" + GetFieldDataTypeHtml(mf.FieldDataType, mf.FieldData) + "</td>");//
            sb.Append("<td class=\"form-inline\">" + GetSelectTypeHtml(mf.SelectType, mf.SelectData) + "</div>");
            sb.Append("<td>" + GetFieldStatusIDHtml(mf.FieldStatusID) + "</td>");
            sb.Append("<td><div class=\"input-group input-group-sm col-xs-2\"><input type=\"text\"  class=\"form-control input-sm\"  name=\"FieldOrder\" value='" + mf.FieldOrder + "'/></div></td>");
            return(sb.ToString());
        }
Exemple #2
0
        /// <summary>
        /// 查询页面字段信息
        /// </summary>
        /// <param name="ItemID">页面数据ID</param>
        /// <returns></returns>
        public static List <Model.M_TableField> XmlSelectAllTableFieldInfo(int ItemID)
        {
            List <Model.M_TableField> ListModel = new List <Model.M_TableField>();
            string      xmlPath = System.AppDomain.CurrentDomain.BaseDirectory + "\\DataXML\\Table.xml";
            XmlDocument xml     = new XmlDocument();

            xml.Load(xmlPath);                                                              //读取文件
            XmlElement root     = xml.DocumentElement;                                      //获取根节点
            XmlNode    rootChil = root.SelectSingleNode("OPTION[@TableID=" + ItemID + "]"); //获取指定子节点

            if (rootChil != null)
            {
                XmlNode XmlColumnsNode = rootChil.SelectSingleNode("COLUMNS");
                if (XmlColumnsNode != null)
                {
                    foreach (XmlNode xcn in XmlColumnsNode.ChildNodes)
                    {
                        Model.M_TableField mf        = new Model.M_TableField();
                        PropertyInfo[]     propertys = mf.GetType().GetProperties();
                        foreach (PropertyInfo property in propertys)
                        {
                            var attrName = property.Name;
                            if (xcn.Attributes[attrName] != null)
                            {
                                Type   columnType = property.PropertyType;
                                object obj        = Convert.ChangeType(xcn.Attributes[attrName].Value, columnType);
                                property.SetValue(mf, obj, null);
                            }
                        }
                        ListModel.Add(mf);
                    }
                }
            }
            IEnumerable <Model.M_TableField> query = from items in ListModel orderby items.FieldOrder select items;

            return(query.ToList <Model.M_TableField>());
        }