Esempio n. 1
0
        /// <summary>
        /// 创建
        /// </summary>
        /// <param name="FieldItem"></param>
        /// <param name="ControlName"></param>
        /// <returns></returns>
        public String ViewCreateIconPicker(SettingEntity FieldItem, String ControlName, String ControlID)
        {
            StringBuilder ControlHtml = new StringBuilder();//控件的HTML


            ControlHtml.AppendFormat("<select id=\"{0}\" name=\"{1}\" class=\"form-control search-select search-select-auto {2}\" ", ControlID, ControlName, ViewVerification(FieldItem));


            ControlHtml.AppendFormat(" style=\"width:{0}px;\" >", FieldItem.Width);


            List <OptionItem> Optins = new List <OptionItem>();

            if (String.IsNullOrEmpty(FieldItem.ListContent))//没有列表项的时候,需要加载默认的字体
            {
                String    xml_url = BaseModule.Server.MapPath(String.Format("{0}Resource/xml/SelectIcons.xml", BaseModule.ModulePath));
                XmlFormat xf      = new XmlFormat(xml_url);

                Optins = xf.ToList <OptionItem>();
            }
            else if (!String.IsNullOrEmpty(FieldItem.ListContent))
            {
                List <String> list = Common.GetList(FieldItem.ListContent.Replace(",", "|").Replace("\r\n", "|").Replace("\r", "|"), "|");

                for (Int32 i = 0; i < list.Count; i++)
                {
                    if (!String.IsNullOrEmpty(list[i]))
                    {
                        OptionItem Optin = new OptionItem();
                        Optin.Text  = list[i];
                        Optin.Value = list[i];
                        //判断是否包含有键值对,将键值对分离开
                        if (list[i].IndexOf(":") >= 0)
                        {
                            List <String> ItemKeyValue = Common.GetList(list[i], ":");
                            Optin.Text  = ItemKeyValue[0];
                            Optin.Value = ItemKeyValue[1];
                        }
                        Optins.Add(Optin);
                    }
                }
            }

            ControlHtml.Append("<option value=\"\" >== select icon ==</option>").AppendLine();
            List <String> selectValues = WebHelper.GetList(FieldItem.DefaultValue);

            foreach (var Optin in Optins)
            {
                String DisabledStr = String.IsNullOrEmpty(Optin.Value) ? "disabled=\"disabled\"" : "";


                String CheckedStr = selectValues.Exists(r => r.ToLower() == Optin.Value.ToLower()) ? "selected=\"selected\"" : "";
                //String CheckedStr = !String.IsNullOrEmpty(Optin.Value) && !String.IsNullOrEmpty(FieldItem.DefaultValue) && FieldItem.DefaultValue  == Optin.Value ? "selected=\"selected\"" : "";
                ControlHtml.AppendFormat("<option value=\"{0}\" {2} {3}> {1}</option>", Optin.Value, Optin.Text, CheckedStr, DisabledStr).AppendLine();
            }

            ControlHtml.Append("</select>");

            return(ControlHtml.ToString());
        }
Esempio n. 2
0
        /// <summary>
        /// 获取XML文件中的页面数据
        /// </summary>
        /// <returns></returns>
        public List <TabInfo> GetXmlTabs()
        {
            List <TabInfo> tabs = new List <TabInfo>();
            FileInfo       file = new FileInfo(XmlPath);

            if (file.Exists)
            {
                XmlFormat xf = new XmlFormat(file.FullName);

                tabs = ConvertToTab(xf.ToList <TabEntity>());
            }
            return(tabs);
        }
        /// <summary>
        /// 获取XML配置文件
        /// </summary>
        /// <param name="dirs">文件夹列表</param>
        /// <returns></returns>
        public static List <XmlDBEntity> GetXmlDB(DirectoryInfo[] dirs)
        {
            List <XmlDBEntity> XmlDBs = new List <XmlDBEntity>();

            foreach (DirectoryInfo EffectDir in dirs)
            {
                if (EffectDir.Exists)
                {
                    //获取效果数据的XML
                    String XmlDBPath = String.Format("{0}\\EffectDB.xml", EffectDir.FullName);
                    if (File.Exists(XmlDBPath))
                    {
                        XmlFormat xf = new XmlFormat(XmlDBPath);
                        XmlDBs.Add(xf.ToItem <XmlDBEntity>());
                    }
                }
            }
            return(XmlDBs);
        }
Esempio n. 4
0
        /// <summary>
        /// 参数列表
        /// </summary>
        /// <param name="_SkinFileName"></param>
        /// <returns></returns>
        public List <SettingEntity> _OptionList(String _SkinFileName)
        {
            XmlFormat xf = new XmlFormat(_ItemSettingXmlPath(_SkinFileName));

            return(xf.ToList <SettingEntity>());
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    if (!String.IsNullOrEmpty(Token))
                    {
                        String           XmlPath    = MapPath(string.Format("{0}Resource/xml/Service.xml", ModulePath));
                        XmlFormat        xf         = new XmlFormat(XmlPath);
                        List <ServiceDB> ServiceDBs = xf.ToList <ServiceDB>();
                        if (ServiceDBs != null && ServiceDBs.Count > 0 && ServiceDBs.Exists(r => r.Token.ToLower() == Token.ToLower()))
                        {
                            ServiceDB serDB = ServiceDBs.Find(r => r.Token.ToLower() == Token.ToLower());

                            if (serDB != null && !String.IsNullOrEmpty(serDB.Token))
                            {
                                //取出需要调用的服务
                                iService Ser = (iService)Activator.CreateInstance(serDB.assemblyName, serDB.typeName).Unwrap();
                                if (Ser != null && !String.IsNullOrEmpty(serDB.Name))
                                {
                                    //执行服务
                                    Ser.Execute(this);

                                    if (Ser.IsResponseWrite)
                                    {
                                        if (!String.IsNullOrEmpty(Ser.ResponseString))
                                        {
                                            //输出字符串
                                            Response.Clear();
                                            Response.Write(Ser.ResponseString);
                                        }
                                        else
                                        {
                                            //错误,没有输出
                                        }
                                    }
                                    else
                                    {
                                        //这里会用其他方式输出
                                    }
                                }
                                else
                                {
                                    //没有找到相应的服务
                                }
                            }
                            else
                            {
                                //没有找到相应的服务
                            }
                        }
                        else
                        {
                            //没有找到相应的服务
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(String.Format("Exception:{0}", ex.Source));
            }
            finally
            {
                Response.End();
            }
        }