/// <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("\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);
                    }
                }
            }


            foreach (var Optin in Optins)
            {
                String DisabledStr = String.IsNullOrEmpty(Optin.Value) ? "disabled=\"disabled\"" : "";
                String CheckedStr  = !String.IsNullOrEmpty(Optin.Value) && FieldItem.DefaultValue.IndexOf(Optin.Value, StringComparison.CurrentCultureIgnoreCase) >= 0 ? "selected=\"selected\"" : "";
                ControlHtml.AppendFormat("<option value=\"{0}\" {2} {3}> {1}</option>", Optin.Value, Optin.Text, CheckedStr, DisabledStr).AppendLine();
            }

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

            return(ControlHtml.ToString());
        }
Exemplo n.º 2
0
        /// <summary>
        /// 导入项
        /// </summary>
        /// <param name="Content"></param>
        /// <param name="ContentEntity"></param>
        /// <returns></returns>
        public Int32 ImportLayers(DNNGo_DNNGalleryPro_Slider Content, String ItemList)
        {
            Int32 Result = 0;

            if (Content != null && Content.ID > 0 && !String.IsNullOrEmpty(ItemList))
            {
                //还原出项的列表
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.LoadXml(Common.XmlDecode(ItemList));

                List <XmlLayerEntity> list = xf.ToList <XmlLayerEntity>();

                foreach (XmlLayerEntity itemEntity in list)
                {
                    DNNGo_DNNGalleryPro_Layer item = new DNNGo_DNNGalleryPro_Layer();

                    item.Options = ConvertOptions_XML(Common.XmlDecode(itemEntity.Options), Setting_LayerSettingDB);
                    item.Status  = itemEntity.Status;
                    item.Sort    = itemEntity.Sort;

                    item.CreateTime = itemEntity.CreateTime;

                    item.ModuleId = Content.ModuleId;
                    item.PortalId = Content.PortalId;
                    item.LastTime = Content.LastTime;
                    item.LastUser = Content.LastUser;
                    item.LastIP   = Content.LastIP;
                    item.SliderID = Content.ID;

                    //添加项
                    if (item.Insert() > 0)
                    {
                        Result++;
                    }
                }
            }
            return(Result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="XmlContent"></param>
        /// <returns></returns>
        public Int32 Import(Stream XmlContent)
        {
            //插入成功的数量
            Int32 InsertResult = 0;


            if (XmlContent != null && XmlContent.Length > 0)
            {
                //将XML转换为实体
                XmlFormat xf = new XmlFormat();
                xf.XmlDoc.Load(XmlContent);
                List <XmlSliserEntity>       XmlContentList = xf.ToList <XmlSliserEntity>();
                List <GallerySettingsEntity> XmlSettingList = xf.ToList <GallerySettingsEntity>();
                List <GalleryGroupEntity>    XmlGroupList   = xf.ToList <GalleryGroupEntity>();


                //插入分组的记录
                foreach (GalleryGroupEntity XmlGroupItem in XmlGroupList)
                {
                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleID, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, XmlGroupItem.Name, SearchType.Equal));
                    if (DNNGo_DNNGalleryPro_Group.FindCount(qp) == 0)
                    {
                        DNNGo_DNNGalleryPro_Group ContentItem = new DNNGo_DNNGalleryPro_Group();
                        ContentItem.Name        = XmlGroupItem.Name;
                        ContentItem.Description = XmlGroupItem.Description;
                        ContentItem.QuoteCount  = Convert.ToInt32(XmlGroupItem.QuoteCount);
                        ContentItem.Sort        = Convert.ToInt32(XmlGroupItem.Sort);

                        ContentItem.ModuleId = ModuleID;
                        ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;
                        ContentItem.Insert();
                    }
                }


                //插入内容的记录
                foreach (XmlSliserEntity XmlContentItem in XmlContentList)
                {
                    DNNGo_DNNGalleryPro_Slider ContentItem = XmlToEntity(XmlContentItem);
                    ContentItem.ID = ContentItem.Insert();
                    if (ContentItem.ID > 0)
                    {
                        InsertResult++;
                        ImportLayers(ContentItem, Common.XmlDecode(XmlContentItem.Layers));


                        //插入分组
                        DNNGo_DNNGalleryPro_Slider_Group.InsertItem(ContentItem, XmlContentItem.Groups);
                    }
                }



                //移除掉部分设置
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfOtherModule");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_CopyOfPortal");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_TabID");
                XmlSettingList.RemoveAll(r => r.SettingName == "DNNGalleryPro_ModuleID");

                //插入设置的记录
                foreach (GallerySettingsEntity XmlSettingItem in XmlSettingList)
                {
                    UpdateModuleSetting(ModuleID, XmlSettingItem.SettingName, XmlSettingItem.SettingValue);
                }
            }

            return(InsertResult);
        }