Exemple #1
0
        protected void lbSort_Click(object sender, EventArgs e)
        {
            LinkButton ImgbutSort = (LinkButton)sender;

            if (ImgbutSort != null)
            {
                //查出当前要排序的字段
                DNNGo_DNNGalleryPro_Slider objC = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(ImgbutSort.CommandArgument);

                mTips.IsPostBack = true;//回发时就要触发
                if (ImgbutSort.ToolTip == "up")
                {
                    DNNGo_DNNGalleryPro_Slider.MoveField(objC, EnumMoveType.Up, ModuleId, ArticleStatus);
                    //字段上移成功
                    mTips.LoadMessage("UpMoveGallerySuccess", EnumTips.Success, this, new String[] { "" });
                }
                else
                {
                    DNNGo_DNNGalleryPro_Slider.MoveField(objC, EnumMoveType.Down, ModuleId, ArticleStatus);
                    //字段下移成功

                    mTips.LoadMessage("DownMoveGallerySuccess", EnumTips.Success, this, new String[] { "" });
                }
                //绑定一下
                BindDataList();
            }
        }
        /// <summary>
        /// 显示图片文件的大小 kb/mb
        /// </summary>
        /// <param name="DataItem"></param>
        /// <param name="FieldName"></param>
        /// <returns></returns>
        public String PictureSize(DNNGo_DNNGalleryPro_Slider DataItem, String FieldName)
        {
            String _PictureSize = "0kb";
            String _PictureUrl  = Convert.ToString(ViewSliderSetting(DataItem, FieldName, ""));

            if (!String.IsNullOrEmpty(_PictureUrl) && _PictureUrl.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) >= 0)
            {
                int MediaID = 0;
                if (int.TryParse(_PictureUrl.Replace("MediaID=", ""), out MediaID) && MediaID > 0)
                {
                    DNNGo_DNNGalleryPro_Files Multimedia = DNNGo_DNNGalleryPro_Files.FindByID(MediaID);
                    if (Multimedia != null && Multimedia.ID > 0 && Multimedia.FileSize > 0)
                    {
                        if (Multimedia.FileSize > (1024 * 1024))
                        {
                            _PictureSize = String.Format("{0:N}gb", Convert.ToSingle(Multimedia.FileSize) / (1024 * 1024));
                        }
                        else if (Multimedia.FileSize > 1024)
                        {
                            _PictureSize = String.Format("{0:N}mb", Convert.ToSingle(Multimedia.FileSize) / Convert.ToSingle(1024));
                        }
                        else
                        {
                            _PictureSize = String.Format("{0}kb", Multimedia.FileSize);
                        }
                    }
                }
            }
            return(_PictureSize);
        }
Exemple #3
0
        /// <summary>
        /// 相册XML转数据实体
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Slider XmlToEntity(XmlSliserEntity ContentXml)
        {
            DNNGo_DNNGalleryPro_Slider ContentItem = new DNNGo_DNNGalleryPro_Slider();


            ContentItem.Sort   = ContentXml.Sort;
            ContentItem.Status = ContentXml.Status;



            ContentItem.Options = ConvertOptions_XML(Common.XmlDecode(ContentXml.Options), Setting_SliderSettingDB);

            ContentItem.Extension  = ContentXml.Extension;
            ContentItem.CreateTime = ContentXml.CreateTime;
            ContentItem.StartTime  = ContentXml.StartTime;
            ContentItem.EndTime    = ContentXml.EndTime;

            ContentItem.ModuleId = ModuleID;
            ContentItem.PortalId = DNNGalleryPro_PortalSettings.PortalId;

            ContentItem.LastIP   = WebHelper.UserHost;
            ContentItem.LastTime = xUserTime.UtcTime();
            ContentItem.LastUser = UserId;
            return(ContentItem);
        }
        /// <Description>
        /// 更新文章
        /// </Description>
        protected void cmdPublish_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置方案项

                DNNGo_DNNGalleryPro_Slider Article = new DNNGo_DNNGalleryPro_Slider();
                Int32 SaveResult = SaveDataItem(-1, ref Article);

                if (SaveResult > 0)
                {
                    mTips.LoadMessage("SaveSliderSuccess", EnumTips.Success, this);
                    if (SliderID == 0)
                    {
                        Response.Redirect(xUrl("ID", Article.ID.ToString(), "AddNew"), false);
                    }
                    else
                    {
                        Response.Redirect(xUrl("ManagerList"), false);
                    }
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveSliderError", EnumTips.Success, this, new String[] { "" });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
        /// <summary>
        /// 保存草稿
        /// </summary>
        protected void cmdSaveDraft_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 ArticleStatus = (Int32)EnumStatus.Hidden;
                DNNGo_DNNGalleryPro_Slider Article = new DNNGo_DNNGalleryPro_Slider();
                Int32 SaveResult = SaveDataItem(ArticleStatus, ref Article);



                if (SaveResult > 0)
                {
                    mTips.LoadMessage("SaveSliderSuccess", EnumTips.Success, this, new String[] { "" });
                    Response.Redirect(xUrl("ID", Article.ID.ToString(), "AddNew"), false);
                }
                else
                {
                    mTips.IsPostBack = false;
                    mTips.LoadMessage("SaveSliderError", EnumTips.Success, this, new String[] { "" });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Exemple #6
0
        /// <summary>
        /// 缩略图的生成
        /// </summary>
        private void PushThumbnail()
        {
            //根据ID查询出缩略的方式
            Int32  ItemID    = WebHelper.GetIntParam(Request, "ID", 0);
            Int32  Width     = WebHelper.GetIntParam(Request, "width", 200);
            Int32  height    = WebHelper.GetIntParam(Request, "height", 200);
            String Mode      = WebHelper.GetStringParam(Request, "mode", "AUTO");
            String PhotoType = WebHelper.GetStringParam(Request, "Type", "p").ToLower();

            String ImagePath = MapPath(String.Format("{0}/Resource/images/no_image.png", TemplateSourceDirectory));



            if (ItemID > 0)
            {
                DNNGo_DNNGalleryPro_Slider ContentItem = DNNGo_DNNGalleryPro_Slider.FindByID(ItemID);
                if (ContentItem != null && ContentItem.ID > 0)
                {
                    //if (PhotoType == "p")
                    //    ImagePath = ViewLinkUrl(ContentItem.Picture, ContentItem.PortalId);
                    //else
                    //    ImagePath = ViewLinkUrl(ContentItem.Thumbnails, ContentItem.PortalId);
                }
            }
            GenerateThumbnail.PushThumbnail(Server.UrlDecode(ImagePath), Width, height, Mode);
        }
Exemple #7
0
        /// <summary>
        /// 导出
        /// </summary>
        public String Export()
        {
            String PostContent = String.Empty;

            //查询字段的数据,填充待导出的XML实体
            QueryParam qp = new QueryParam();

            qp.OrderType = 0;
            Int32 RecordCount = 0;

            qp.Where.Add(new SearchParam("ModuleId", ModuleID, SearchType.Equal));
            List <DNNGo_DNNGalleryPro_Slider> ArticleList = DNNGo_DNNGalleryPro_Slider.FindAll(qp, out RecordCount);

            if (ArticleList != null && ArticleList.Count > 0)
            {
                List <XmlSliserEntity>       xmlContentList = new List <XmlSliserEntity>();
                List <GallerySettingsEntity> xmlSettingList = new List <GallerySettingsEntity>();
                List <GalleryGroupEntity>    xmlGroupList   = new List <GalleryGroupEntity>();


                //查询出所有的配置项
                List <SettingEntity> EffectSettingDB = Setting_EffectSettingDB;
                if (EffectSettingDB != null && EffectSettingDB.Count > 0)
                {
                    foreach (SettingEntity SettingItem in EffectSettingDB)
                    {
                        String SettingValue = ViewXmlSetting(SettingItem.Name, SettingItem.DefaultValue).ToString();
                        xmlSettingList.Add(new GallerySettingsEntity(EffectSettingsFormat(Settings_EffectName, SettingItem.Name), SettingValue));
                    }

                    foreach (String key in DNNGalleryPro_Settings.Keys)
                    {
                        if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0)
                        {
                            xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryPro_Settings[key])));
                        }
                    }
                }



                foreach (DNNGo_DNNGalleryPro_Slider ContentItem in ArticleList)
                {
                    xmlContentList.Add(EntityToXml(ContentItem));
                }

                foreach (DNNGo_DNNGalleryPro_Group GroupItem in DNNGo_DNNGalleryPro_Group.FindAllByModuleID(ModuleID))
                {
                    xmlGroupList.Add(new GalleryGroupEntity(GroupItem));
                }

                XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/SliderEntity.xml", ModulePath)));
                //将字段列表转换成XML的实体
                PostContent = xf.ToXml <XmlSliserEntity>(xmlContentList, xmlSettingList, xmlGroupList);
            }

            return(PostContent);
        }
 /// <summary>
 /// 下载文件
 /// </summary>
 /// <param name="SliderItem"></param>
 /// <param name="SettingName"></param>
 /// <returns></returns>
 public String GoDownloadUrl(DNNGo_DNNGalleryPro_Slider SliderItem, String SettingName)
 {
     return(String.Format("{0}Resource_Service.aspx?Token=download&PortalID={1}&TabID={2}&ModuleID={3}&SliderID={4}&SettingName={5}",
                          bpm.ModulePath,
                          bpm.Settings_PortalID,
                          bpm.Settings_TabID,
                          bpm.Settings_ModuleID,
                          SliderItem.ID,
                          SettingName));
 }
 /// <summary>
 /// 热度的链接
 /// </summary>
 /// <param name="SliderItem"></param>
 /// <param name="Heat">热度+1 或者 -1</param>
 /// <returns></returns>
 public String GoHeatsUrl(DNNGo_DNNGalleryPro_Slider SliderItem, Int32 Heat)
 {
     return(String.Format("{0}Resource_Service.aspx?Token=heats&PortalID={1}&TabID={2}&ModuleID={3}&SliderID={4}&Heat={5}",
                          bpm.ModulePath,
                          bpm.Settings_PortalID,
                          bpm.Settings_TabID,
                          bpm.Settings_ModuleID,
                          SliderItem.ID,
                          Heat));
 }
        /// <summary>
        /// 显示扩展信息列表
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <KeyValueEntity> ViewExtensionList(DNNGo_DNNGalleryPro_Slider DataItem)
        {
            List <KeyValueEntity> ExtensionSettings = new List <KeyValueEntity>();

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Extension))
            {
                //取出扩展项
                ExtensionSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(DataItem.Extension);
            }
            return(ExtensionSettings);
        }
Exemple #11
0
        /// <summary>
        /// 列表上的项删除事件
        /// </summary>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

                if (btnRemove != null && !String.IsNullOrEmpty(btnRemove.CommandArgument))
                {
                    mTips.IsPostBack = true;

                    DNNGo_DNNGalleryPro_Slider Article = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(btnRemove.CommandArgument);

                    if (Article != null && Article.ID > 0)
                    {
                        if (Article.Status == (Int32)EnumStatus.RecycleBin)
                        {
                            if (Article.Delete() > 0)
                            {
                                //删除相关的的层
                                DNNGo_DNNGalleryPro_Layer.Deletes(Article);

                                //操作成功
                                mTips.LoadMessage("DeleteGallerySuccess", EnumTips.Success, this);
                            }
                            else
                            {
                                //操作失败
                                mTips.LoadMessage("DeleteGalleryError", EnumTips.Success, this);
                            }
                        }
                        else
                        {
                            Article.Status = (Int32)EnumStatus.RecycleBin;
                            if (Article.Update() > 0)
                            {
                                //移动到回收站操作成功
                                mTips.LoadMessage("DeleteGallerySuccess", EnumTips.Success, this);
                            }
                            else
                            {
                                //移动到回收站操作失败
                                mTips.LoadMessage("DeleteGalleryError", EnumTips.Success, this);
                            }
                        }

                        BindDataList();
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
 /// <summary>
 /// 显示内容
 /// </summary>
 public String ViewContent(String FieldName, DNNGo_DNNGalleryPro_Slider DataItem)
 {
     if (DataItem != null && DataItem.ID > 0)
     {
         if (DataItem[FieldName] != null)
         {
             return(Convert.ToString(DataItem[FieldName]));//找出一般属性
         }
     }
     return(string.Empty);
 }
Exemple #13
0
        /// <summary>
        /// 点赞
        /// </summary>
        public void ClickHeats()
        {
            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);
            Int32 LayerID  = WebHelper.GetIntParam(Request, "LayerID", 0);
            Int32 Heat     = WebHelper.GetIntParam(Request, "Heat", 1);//热度+1 或者 -1


            Int32 Heats = 0;

            DNNGo_DNNGalleryPro_Slider SliderItem = new DNNGo_DNNGalleryPro_Slider();

            if (LayerID > 0)
            {
                DNNGo_DNNGalleryPro_Layer LayerItem = DNNGo_DNNGalleryPro_Layer.FindByKeyForEdit(LayerID);
                if (LayerItem != null && LayerItem.ID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        //背景下载技术
                        SliderItem.Heats += Heat;
                        SliderItem.Update();
                    }
                    //层下载技术
                    LayerItem.Heats += Heat;
                    LayerItem.Update();

                    Heats = LayerItem.Heats;
                }
                else
                {
                    //没有找到文件记录
                }
            }
            else if (SliderID > 0)
            {
                SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);
                if (SliderItem != null && SliderItem.ID > 0)
                {
                    SliderItem.Heats += Heat;
                    SliderItem.Update();

                    Heats = SliderItem.Heats;
                }
            }


            Response.Clear();
            Response.Write(Heats);
            Response.End();
        }
        /// <summary>
        ///  显示时间
        /// </summary>
        /// <param name="FieldName">字段名</param>
        /// <param name="DataItem">数据项</param>
        /// <param name="TimeFormat">时间格式</param>
        /// <returns></returns>
        public String ViewDateTime(String FieldName, DNNGo_DNNGalleryPro_Slider DataItem, String TimeFormat)
        {
            String   Content = ViewContent(FieldName, DataItem);//先取内容
            DateTime Temp    = xUserTime.LocalTime();

            if (DateTime.TryParse(Content, out Temp))
            {
                return(Temp.ToString(TimeFormat));
            }
            else
            {
                return(String.Empty);
            }
        }
        /// <Description>
        /// 绑定数据项
        /// </Description>
        private void BindDataItem()
        {
            DNNGo_DNNGalleryPro_Slider Article = SliderItem;

            //验证文章是否存在
            if (SliderID > 0 && (Article == null || SliderID != Article.ID))
            {
                //需要给出提示,载入文章错误
                mTips.LoadMessage("LoadingGalleryError", EnumTips.Error, this, new String[] { "" });
                Response.Redirect(xUrl("ManagerList"), false);
            }

            if (Article == null)
            {
                Article = new DNNGo_DNNGalleryPro_Slider();
            }


            if (divGroups.Visible)
            {
                BindTreeGroups(Article);
            }


            cbPermissionsAllUsers.Checked = Article.Per_AllUsers == 0 ? true : false;

            //List<String> Per_Roles = Common.GetList(Article.Per_Roles, "|");
            WebHelper.SelectedListMultiByValue(cblPermissionsRoles, Article.Per_Roles);


            //文章状态
            liArticleStatus.Text = EnumHelper.GetEnumTextVal(Article.Status, typeof(EnumStatus));
            WebHelper.SelectedListByValue(ddlArticleStatus, Article.Status);//管理员看到的文章状态

            //发布时间和结束时间
            if (SliderID > 0 && Article != null && Article.ID > 0)
            {
                liStartDateTime.Text   = Article.StartTime.ToString("MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false)); //Thread.CurrentThread.CurrentCulture
                liDisableDateTime.Text = Article.EndTime.ToString("MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false));   //Thread.CurrentThread.CurrentCulture
            }
            txtStartDate.Text = Article.StartTime.ToString("MM/dd/yyyy", new CultureInfo("en-US", false));
            txtStartTime.Text = Article.StartTime.ToString("hh:mm tt", new CultureInfo("en-US", false));

            txtDisableDate.Text = Article.EndTime.ToString("MM/dd/yyyy", new CultureInfo("en-US", false));
            txtDisableTime.Text = Article.EndTime.ToString("hh:mm tt", new CultureInfo("en-US", false));


            txtHeatNumber.Text     = Article.Heats.ToString();
            txtDownloadNumber.Text = Article.Clicks.ToString();
        }
Exemple #16
0
        /// <summary>
        /// 状态应用按钮事件
        /// </summary>
        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 Status = WebHelper.GetIntParam(Request, ddlStatus.UniqueID, -1);

                if (Status >= 0)
                {
                    string   Checkbox_Value       = WebHelper.GetStringParam(Request, "Checkbox", "");
                    string[] Checkbox_Value_Array = Checkbox_Value.Split(',');
                    Int32    IDX = 0;
                    for (int i = 0; i < Checkbox_Value_Array.Length; i++)
                    {
                        if (Int32.TryParse(Checkbox_Value_Array[i], out IDX))
                        {
                            DNNGo_DNNGalleryPro_Slider Article = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(IDX);
                            if (Article != null && Article.ID > 0)
                            {
                                if (Article.Status == (Int32)EnumStatus.RecycleBin && Status == (Int32)EnumStatus.RecycleBin)
                                {
                                    if (Article.Delete() > 0)
                                    {
                                        //删除相关的的层
                                        DNNGo_DNNGalleryPro_Layer.Deletes(Article);
                                    }
                                }
                                else
                                {
                                    Article.Status = Status;
                                    if (Article.Update() > 0)
                                    {
                                    }
                                }
                            }
                        }
                    }
                    BindDataList();

                    mTips.IsPostBack = true;
                    mTips.LoadMessage("ApplyStatusSuccess", EnumTips.Success, this, new String[] { EnumHelper.GetEnumTextVal(Status, typeof(EnumStatus)) });
                }
            }
            catch (Exception ex)
            {
                ProcessModuleLoadException(ex);
            }
        }
Exemple #17
0
        /// <summary>
        /// 删除相关的的层
        /// </summary>
        /// <param name="SliderItem"></param>
        /// <returns></returns>
        public static Int32 Deletes(DNNGo_DNNGalleryPro_Slider SliderItem)
        {
            QueryParam qp = new QueryParam();

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderItem.ID, SearchType.Equal));

            Int32 RecordCount = 0;
            List <DNNGo_DNNGalleryPro_Layer> ListLayer = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);

            foreach (var Layer in ListLayer)
            {
                Layer.Delete();
            }


            return(RecordCount);
        }
Exemple #18
0
        /// <summary>
        /// 绑定数据项到前台
        /// </summary>
        public void BindDataItem(EffectDBEntity EffectDB)
        {
            Hashtable      Puts = new Hashtable();
            TemplateFormat xf   = new TemplateFormat(this);

            xf.PhContent = PhContent;


            DNNGo_DNNGalleryPro_Slider SliderItem = DNNGo_DNNGalleryPro_Slider.FindByKeyForEdit(SliderID);


            Puts.Add("ThemeName", Settings_EffectThemeName);
            Puts.Add("SliderItem", SliderItem);
            Puts.Add("EffectName", Settings_EffectName);

            Puts.Add("LayerList", EffectDB.Layers ? GetLayerList() : new List <DNNGo_DNNGalleryPro_Layer>());
            liContent.Text = HttpUtility.HtmlDecode(ViewTemplate(EffectDB, "Layer.html", Puts, xf));
        }
        /// <summary>
        /// 加载分组,并取消空格
        /// </summary>
        /// <param name="_Value"></param>
        /// <returns></returns>
        public String ToGroups(DNNGo_DNNGalleryPro_Slider DataItem)
        {
            StringBuilder sb = new StringBuilder();

            List <DNNGo_DNNGalleryPro_Group> list = DNNGo_DNNGalleryPro_Group.FindAllBySliderID(DataItem.ID);

            if (list != null && list.Count > 0)
            {
                foreach (DNNGo_DNNGalleryPro_Group item in list)
                {
                    if (!String.IsNullOrEmpty(item.Name))
                    {
                        sb.AppendFormat(" {0}", ToTrim2(item.Name));
                    }
                }
            }

            return(sb.ToString());
        }
        /// <Description>
        /// 拼接数据项的设置参数
        /// </Description>
        /// <returns></returns>
        public void SetItemSettings(ref DNNGo_DNNGalleryPro_Slider Article)
        {
            //获取效果参数
            List <SettingEntity>  ItemSettingDB = Setting_SliderSettingDB;
            List <KeyValueEntity> list          = new List <KeyValueEntity>();

            if (ItemSettingDB != null && ItemSettingDB.Count > 0)
            {
                ControlHelper ControlItem = new ControlHelper(ModuleId);

                foreach (SettingEntity ri in ItemSettingDB)
                {
                    KeyValueEntity item = new KeyValueEntity();
                    item.Key   = ri.Name;
                    item.Value = ControlHelper.GetWebFormValue(ri, this);
                    list.Add(item);
                }
            }
            Article.Options = ConvertTo.Serialize <List <KeyValueEntity> >(list);

            if (list.Exists(r => r.Key == "Attribute1"))
            {
                KeyValueEntity Attribute1       = list.Find(r => r.Key == "Attribute1");
                Int32          Attribute1_Value = 0;
                if (int.TryParse(Attribute1.Value.ToString(), out Attribute1_Value))
                {
                    Article.Attribute1 = Attribute1_Value;
                }
            }

            if (list.Exists(r => r.Key == "Attribute2"))
            {
                KeyValueEntity Attribute2 = list.Find(r => r.Key == "Attribute2");
                Article.Attribute2 = Attribute2.Value.ToString();
            }

            if (list.Exists(r => r.Key == "Title"))
            {
                KeyValueEntity TitleEntity = list.Find(r => r.Key == "Title");
                Article.Title = TitleEntity.Value.ToString();
            }
        }
Exemple #21
0
        /// <summary>
        /// 读取数据项参数
        /// </summary>
        /// <param name="DataItem">数据项</param>
        /// <param name="Name">参数名</param>
        /// <param name="DefaultValue">默认值</param>
        /// <returns></returns>
        public object ViewSliderSetting(DNNGo_DNNGalleryPro_Slider DataItem, String Name, object DefaultValue)
        {
            object o = DefaultValue;

            if (DataItem != null && DataItem.ID > 0 && !String.IsNullOrEmpty(DataItem.Options))
            {
                try
                {
                    List <KeyValueEntity> ItemSettings = ConvertTo.Deserialize <List <KeyValueEntity> >(DataItem.Options);
                    KeyValueEntity        KeyValue     = ItemSettings.Find(r1 => r1.Key.ToLower() == Name.ToLower());
                    if (KeyValue != null && !String.IsNullOrEmpty(KeyValue.Key))
                    {
                        o = KeyValue.Value;
                    }
                }
                catch
                {
                }
            }
            return(o);
        }
        /// <Description>
        /// 绑定树分类
        /// </Description>
        private void BindTreeGroups(DNNGo_DNNGalleryPro_Slider Article)
        {
            List <Int32>  SelectList = new List <Int32>();
            StringBuilder select     = new StringBuilder();

            if (Article != null && Article.ID > 0)
            {
                //填充分类的关系
                List <DNNGo_DNNGalleryPro_Slider_Group> Relationships = DNNGo_DNNGalleryPro_Slider_Group.FindAllByArticleID(Article.ID);
                foreach (DNNGo_DNNGalleryPro_Slider_Group Groups in Relationships)
                {
                    SelectList.Add(Groups.GroupID);
                    select.AppendFormat("{0},", Groups.GroupID);
                }
            }

            //绑定所有分类到页面
            QueryParam qp = new QueryParam();

            qp.Orderfld  = DNNGo_DNNGalleryPro_Group._.Sort;
            qp.OrderType = 0;
            int RecordCount = 0;

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ModuleId, SearchType.Equal));
            List <DNNGo_DNNGalleryPro_Group> lst = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount);


            //拼接顶级分类的方法
            StringBuilder sb = new StringBuilder();

            sb.Append("<div id=\"Groups-all\" class=\"tabs-panel\">");
            String ttString = CreateGroupsJson(lst, 0, SelectList);

            if (!String.IsNullOrEmpty(ttString))
            {
                sb.Append(ttString);
            }
            sb.Append("</div>");
            liGroups.Text = sb.ToString();
        }
Exemple #23
0
        /// <summary>
        /// 插入单项
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <param name="GroupName"></param>
        /// <returns></returns>
        public static Int32 InsertItem(DNNGo_DNNGalleryPro_Slider ContentItem, String GroupName)
        {
            int RecordCount = 0;

            if (!String.IsNullOrEmpty(GroupName))
            {
                List <String> GroupNames = Common.GetList(GroupName);

                if (GroupNames != null && GroupNames.Count > 0)
                {
                    StringBuilder sb = new StringBuilder();
                    foreach (String GroupString in GroupNames)
                    {
                        sb.AppendFormat("'{0}',", GroupString);
                    }

                    QueryParam qp = new QueryParam();
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.ModuleId, ContentItem.ModuleId, SearchType.Equal));
                    qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Group._.Name, sb.ToString().Trim(','), SearchType.In));

                    List <DNNGo_DNNGalleryPro_Group> Groups = DNNGo_DNNGalleryPro_Group.FindAll(qp, out RecordCount);

                    if (Groups != null && Groups.Count > 0)
                    {
                        RecordCount = 0;
                        foreach (DNNGo_DNNGalleryPro_Group GroupItem in Groups)
                        {
                            DNNGo_DNNGalleryPro_Slider_Group Content_Group = new DNNGo_DNNGalleryPro_Slider_Group();
                            Content_Group.GroupID  = GroupItem.ID;
                            Content_Group.SliderID = ContentItem.ID;
                            if (Content_Group.Insert() > 0)
                            {
                                RecordCount++;
                            }
                        }
                    }
                }
            }
            return(RecordCount);
        }
Exemple #24
0
        /// <summary>
        /// Gallery数据转XML实体
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public XmlSliserEntity EntityToXml(DNNGo_DNNGalleryPro_Slider ContentItem)
        {
            XmlSliserEntity ContentXml = new XmlSliserEntity();

            ContentXml.Sort   = ContentItem.Sort;
            ContentXml.Status = ContentItem.Status;

            //将Options提取出来处理后再还原
            ContentXml.Options = Common.XmlEncode(ConvertOptions(ContentItem.Options, Setting_SliderSettingDB));
            ContentXml.Groups  = DNNGo_DNNGalleryPro_Group.FindGroupsBySliderID(ContentItem.ID);

            ContentXml.Extension = ContentItem.Extension;

            //提取所有的Layers信息
            ContentXml.Layers = Common.XmlEncode(ConvertLayers(ContentItem));

            ContentXml.StartTime  = ContentItem.StartTime;
            ContentXml.EndTime    = ContentItem.EndTime;
            ContentXml.CreateTime = ContentItem.CreateTime;

            return(ContentXml);
        }
Exemple #25
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);
        }
Exemple #26
0
        public String ConvertLayers(DNNGo_DNNGalleryPro_Slider SliderItem)
        {
            String Layers_XML = String.Empty;

            if (SliderItem != null && SliderItem.ID > 0)
            {
                QueryParam qp          = new QueryParam();
                int        RecordCount = 0;
                qp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Layer._.SliderID, SliderItem.ID, SearchType.Equal));
                List <DNNGo_DNNGalleryPro_Layer> list = DNNGo_DNNGalleryPro_Layer.FindAll(qp, out RecordCount);
                if (list != null && list.Count > 0)
                {
                    List <XmlLayerEntity> LayerList = new List <XmlLayerEntity>();
                    foreach (var item in list)
                    {
                        LayerList.Add(EntityToXml(item));
                    }
                    XmlFormat xf = new XmlFormat(HttpContext.Current.Server.MapPath(String.Format("{0}Resource/xml/LayerEntity.xml", ModulePath)));
                    Layers_XML = xf.ToXml <XmlLayerEntity>(LayerList);
                }
            }
            return(Layers_XML);
        }
        /// <Description>
        /// 保存文章
        /// </Description>
        /// <param name="ArticleStatus">文章状态(为-1的时候取选项的值)</param>
        private Int32 SaveDataItem(Int32 ArticleStatus, ref DNNGo_DNNGalleryPro_Slider Article)
        {
            int ResultArticle = 0;

            Article = SliderItem;



            //数字更新
            Article.Heats  = WebHelper.GetIntParam(Request, txtHeatNumber.UniqueID, 0);
            Article.Clicks = WebHelper.GetIntParam(Request, txtDownloadNumber.UniqueID, 0);

            //权限
            Article.Per_AllUsers = cbPermissionsAllUsers.Checked ? 0 : 1;


            String textStr, idStr = String.Empty;

            WebHelper.GetSelected(cblPermissionsRoles, out textStr, out idStr);
            Article.Per_Roles = idStr;

            //文章的发布状态
            Article.Status = Convert.ToInt32(ddlArticleStatus.Items[ddlArticleStatus.SelectedIndex].Value);

            //设置属性
            SetItemSettings(ref Article);
            Article.Extension = SetExtensionSettings();



            //更新项
            Article.LastIP   = WebHelper.UserHost;
            Article.LastTime = xUserTime.UtcTime();
            Article.LastUser = UserId;

            //发布状态和时间
            DateTime oTime = xUserTime.LocalTime();

            string[] expectedFormats = { "G", "g", "f", "F" };
            string   StartDate       = WebHelper.GetStringParam(Request, txtStartDate.UniqueID, oTime.ToString("MM/dd/yyyy"));
            string   StartTime       = WebHelper.GetStringParam(Request, txtStartTime.UniqueID, oTime.ToString("hh:mm tt"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", StartDate, StartTime), "MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out oTime))
            {
                if (oTime.Second == 0)
                {
                    oTime = oTime.AddSeconds(DateTime.Now.Second);                   //补秒
                }
                Article.StartTime = oTime;
            }
            //发布状态和时间
            DateTime EndTime     = xUserTime.LocalTime().AddYears(10);
            string   DisableDate = WebHelper.GetStringParam(Request, txtDisableDate.UniqueID, EndTime.ToString("MM/dd/yyyy"));
            string   DisableTime = WebHelper.GetStringParam(Request, txtDisableTime.UniqueID, EndTime.ToString("hh:mm tt"));

            if (DateTime.TryParseExact(String.Format("{0} {1}", DisableDate, DisableTime), "MM/dd/yyyy hh:mm tt", new CultureInfo("en-US", false), DateTimeStyles.AllowWhiteSpaces, out EndTime))
            {
                if (EndTime.Second == 0)
                {
                    EndTime = EndTime.AddSeconds(DateTime.Now.Second);                     //补秒
                }
                Article.EndTime = EndTime;
            }

            //创建用户改为可以选择
            //Article.CreateUser = WebHelper.GetIntParam(Request, txtCreateUser.UniqueID, UserId);


            if (ArticleStatus == -1)//如果没有指定状态就取控件的
            {
                Article.Status = WebHelper.GetIntParam(Request, ddlArticleStatus.UniqueID, (Int32)EnumStatus.Activated);
            }
            else
            {
                Article.Status = ArticleStatus;
            }


            if (Article.ID > 0)
            {
                //更新
                ResultArticle = Article.Update();
            }
            else
            {
                //新增
                Article.CreateTime = xUserTime.UtcTime();
                Article.CreateUser = UserId;

                Article.ModuleId = ModuleId;
                Article.PortalId = PortalId;

                QueryParam Sqp = new QueryParam();
                Sqp.ReturnFields = Sqp.Orderfld = DNNGo_DNNGalleryPro_Slider._.Sort;
                Sqp.OrderType    = 1;
                Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryPro_Slider._.ModuleId, ModuleId, SearchType.Equal));
                Article.Sort = Convert.ToInt32(DNNGo_DNNGalleryPro_Slider.FindScalar(Sqp)) + 2;

                Article.ID = ResultArticle = Article.Insert();
            }



            if (ResultArticle > 0)
            {
                if (divGroups.Visible)
                {
                    //更新分类项
                    String Categorys = WebHelper.GetStringParam(Request, String.Format("post$groups${0}", ModuleId), "");
                    ManagedThreadPool.QueueUserWorkItem(new WaitCallback(ThreadUpdateGroups), new KeyValueEntity(Article.ID.ToString(), Categorys));
                }



                ////操作成功
                //mTips.LoadMessage("SaveArticleSuccess", EnumTips.Success, this, new String[] { Article.Title });

                ////操作成功需要跳转到首页
                //Response.Redirect(xUrl("Posts"));
            }
            else
            {
                //mTips.IsPostBack = false;

                ////操作失败
                //mTips.LoadMessage("SaveArticleError", EnumTips.Success, this, new String[] { Article.Title });

                ////操作失败就留在本页面
            }
            return(ResultArticle);
        }
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <typeparam name="T">参数类型</typeparam>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public T ViewSliderSettingT <T>(DNNGo_DNNGalleryPro_Slider DataItem, String Name, T DefaultValue)
 {
     return(bpm.ViewSliderSettingT <T>(DataItem, Name, DefaultValue));
 }
 /// <summary>
 /// 读取数据项参数
 /// </summary>
 /// <param name="DataItem">数据项</param>
 /// <param name="Name">参数名</param>
 /// <param name="DefaultValue">默认值</param>
 /// <returns></returns>
 public object ViewSliderSetting(DNNGo_DNNGalleryPro_Slider DataItem, String Name, object DefaultValue)
 {
     return(bpm.ViewSliderSetting(DataItem, Name, DefaultValue));
 }
 /// <summary>
 /// 显示相片的缩略图片
 /// </summary>
 /// <param name="DataItem"></param>
 /// <returns></returns>
 public String ThumbnailUrl(DNNGo_DNNGalleryPro_Slider DataItem)
 {
     return(ThumbnailUrl(DataItem, 200, 200, "AUTO"));
 }