/// <summary>
        /// 相册XML转数据实体
        /// </summary>
        /// <returns></returns>
        public DNNGo_DNNGalleryProGame_Slider XmlToEntity(XmlSliserEntity ContentXml)
        {
            DNNGo_DNNGalleryProGame_Slider ContentItem = new DNNGo_DNNGalleryProGame_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.Title       = ContentXml.Title;
            ContentItem.FriendlyUrl = ContentXml.FriendlyUrl;
            ContentItem.Relations   = ContentXml.Relations;

            ContentItem.ModuleId = ModuleID;
            ContentItem.PortalId = DNNGalleryProGame_PortalSettings.PortalId;

            ContentItem.LastIP   = WebHelper.UserHost;
            ContentItem.LastTime = xUserTime.UtcTime();
            ContentItem.LastUser = UserId;
            return(ContentItem);
        }
Beispiel #2
0
        protected new void Page_PreRender(System.Object sender, System.EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    TemplateFormat xf = new TemplateFormat(this);

                    DNNGo_DNNGalleryProGame_Slider SliderItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);

                    if (!(SliderItem != null && SliderItem.ID > 0) && !String.IsNullOrEmpty(FriendlyUrl))
                    {
                        SliderItem = DNNGo_DNNGalleryProGame_Slider.FindItemByFriendlyUrl(FriendlyUrl, Settings_ModuleID);
                    }

                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        Page.Title = String.Format("{0} - Games", xf.ViewSliderSettingT <String>(SliderItem, "Title", SliderItem.Title));
                    }

                    base.Page_PreRender(sender, e);
                }
            }
            catch (Exception ex) //Module failed to load
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
Beispiel #3
0
        public String GoFriendlyUrl(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            if (!String.IsNullOrEmpty(SliderItem.FriendlyUrl))
            {
                var PortalSettings = bpm.PortalSettings;

                String FriendlyUrls = String.Empty;

                String ArticleTitle = SliderItem.FriendlyUrl;

                if (String.IsNullOrEmpty(ArticleTitle) && !String.IsNullOrEmpty(SliderItem.Title))
                {
                    ArticleTitle = Common.FriendlySlug(SliderItem.Title);
                }


                if (PortalSettings != null && PortalSettings.DefaultLanguage != Common.GetCurrentCulture())
                {
                    FriendlyUrls = Globals.ApplicationURL(bpm.Settings_TabID) + "&language=" + Common.GetCurrentCulture();
                }
                else
                {
                    FriendlyUrls = Globals.ApplicationURL(bpm.Settings_TabID);
                }

                return(Globals.FriendlyUrl(bpm.Settings_TabInfo, FriendlyUrls, String.Format("{0}.aspx", ArticleTitle), PortalSettings));
            }
            return(GoUrl(SliderItem.ID));
        }
Beispiel #4
0
        /// <summary>
        /// 绑定数据项到前台
        /// </summary>
        public void BindDataItem(EffectDBEntity EffectDB)
        {
            Hashtable      Puts = new Hashtable();
            TemplateFormat xf   = new TemplateFormat(this);

            xf.PhContent = PhContent;


            DNNGo_DNNGalleryProGame_Slider SliderItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);

            if (!(SliderItem != null && SliderItem.ID > 0) && !String.IsNullOrEmpty(FriendlyUrl))
            {
                SliderItem = DNNGo_DNNGalleryProGame_Slider.FindItemByFriendlyUrl(FriendlyUrl, Settings_ModuleID);
            }

            //if (SliderItem != null && SliderItem.ID > 0)
            //{
            //    Page.Title = String.Format("{0} - Games", xf.ViewSliderSettingT<String>(SliderItem, "Title", SliderItem.Title));
            //}

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

            Puts.Add("LayerList", EffectDB.Layers ? GetLayerList(SliderItem) : new List <DNNGo_DNNGalleryProGame_Layer>());
            liContent.Text = HttpUtility.HtmlDecode(ViewTemplate(EffectDB, "Layer.html", Puts, xf));
        }
Beispiel #5
0
        /// <Description>
        /// 更新文章
        /// </Description>
        protected void cmdPublish_Click(object sender, EventArgs e)
        {
            try
            {
                // 设置方案项

                DNNGo_DNNGalleryProGame_Slider Article = new DNNGo_DNNGalleryProGame_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);
            }
        }
        protected void lbSort_Click(object sender, EventArgs e)
        {
            LinkButton ImgbutSort = (LinkButton)sender;

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

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

                    mTips.LoadMessage("DownMoveGallerySuccess", EnumTips.Success, this, new String[] { "" });
                }
                //绑定一下
                BindDataList();
            }
        }
Beispiel #7
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_DNNGalleryProGame_Slider ContentItem = DNNGo_DNNGalleryProGame_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);
        }
Beispiel #8
0
        /// <summary>
        /// 保存草稿
        /// </summary>
        protected void cmdSaveDraft_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 ArticleStatus = (Int32)EnumStatus.Hidden;
                DNNGo_DNNGalleryProGame_Slider Article = new DNNGo_DNNGalleryProGame_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);
            }
        }
        /// <summary>
        /// Gallery数据转XML实体
        /// </summary>
        /// <param name="ContentItem"></param>
        /// <returns></returns>
        public XmlSliserEntity EntityToXml(DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_Group.FindGroupsBySliderID(ContentItem.ID);

            ContentXml.Extension = ContentItem.Extension;

            ContentXml.Title       = ContentItem.Title;
            ContentXml.FriendlyUrl = ContentItem.FriendlyUrl;
            ContentXml.Relations   = ContentItem.Relations;

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

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

            return(ContentXml);
        }
Beispiel #10
0
        /// <summary>
        /// 显示图片文件的大小 kb/mb
        /// </summary>
        /// <param name="DataItem"></param>
        /// <param name="FieldName"></param>
        /// <returns></returns>
        public String PictureSize(DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_Files Multimedia = DNNGo_DNNGalleryProGame_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);
        }
Beispiel #11
0
 public String GoUrl(DNNGo_DNNGalleryProGame_Slider SliderItem)
 {
     if (!String.IsNullOrEmpty(SliderItem.FriendlyUrl))
     {
         return(GoFriendlyUrl(SliderItem));
     }
     return(GoUrl(SliderItem.ID));
 }
Beispiel #12
0
        public String GetPictureUrl(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            String PictureUrl = String.Empty;



            return(PictureUrl);
        }
        /// <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_DNNGalleryProGame_Slider> ArticleList = DNNGo_DNNGalleryProGame_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 DNNGalleryProGame_Settings.Keys)
                    {
                        if (!xmlSettingList.Exists(r1 => r1.SettingName == key) && key.IndexOf("Gallery") != 0)
                        {
                            xmlSettingList.Add(new GallerySettingsEntity(key, Convert.ToString(DNNGalleryProGame_Settings[key])));
                        }
                    }
                }



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

                foreach (DNNGo_DNNGalleryProGame_Group GroupItem in DNNGo_DNNGalleryProGame_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);
        }
Beispiel #14
0
 /// <summary>
 /// 下载文件
 /// </summary>
 /// <param name="SliderItem"></param>
 /// <param name="SettingName"></param>
 /// <returns></returns>
 public String GoDownloadUrl(DNNGo_DNNGalleryProGame_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));
 }
Beispiel #15
0
 /// <summary>
 /// 热度的链接
 /// </summary>
 /// <param name="SliderItem"></param>
 /// <param name="Heat">热度+1 或者 -1</param>
 /// <returns></returns>
 public String GoHeatsUrl(DNNGo_DNNGalleryProGame_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>
        protected void btnRemove_Click(object sender, EventArgs e)
        {
            try
            {
                LinkButton btnRemove = (LinkButton)sender;

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

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

                    if (Article != null && Article.ID > 0)
                    {
                        if (Article.Status == (Int32)EnumStatus.RecycleBin)
                        {
                            if (Article.Delete() > 0)
                            {
                                //删除相关的的层
                                DNNGo_DNNGalleryProGame_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);
            }
        }
Beispiel #17
0
        /// <Description>
        /// 绑定数据项
        /// </Description>
        private void BindDataItem()
        {
            DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_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();


            //关联集合
            hfRelations.Value = Article.Relations;
        }
Beispiel #18
0
 /// <summary>
 /// 显示内容
 /// </summary>
 public String ViewContent(String FieldName, DNNGo_DNNGalleryProGame_Slider DataItem)
 {
     if (DataItem != null && DataItem.ID > 0)
     {
         if (DataItem[FieldName] != null)
         {
             return(Convert.ToString(DataItem[FieldName]));//找出一般属性
         }
     }
     return(string.Empty);
 }
Beispiel #19
0
        public String ViewPictureUrl(DNNGo_DNNGalleryProGame_Slider DataItem)
        {
            String PictureUrl = ViewSliderSettingT <String>(DataItem, "Picture", "");

            if (String.IsNullOrEmpty(PictureUrl))
            {
                PictureUrl = ViewSliderSettingT <String>(DataItem, "Thumbnails", "");
            }

            return(ViewLinkUrl(PictureUrl, ""));
        }
Beispiel #20
0
        /// <summary>
        /// 显示扩展信息列表
        /// </summary>
        /// <param name="DataItem"></param>
        /// <returns></returns>
        public List <KeyValueEntity> ViewExtensionList(DNNGo_DNNGalleryProGame_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);
        }
Beispiel #21
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_DNNGalleryProGame_Slider SliderItem = new DNNGo_DNNGalleryProGame_Slider();

            if (LayerID > 0)
            {
                DNNGo_DNNGalleryProGame_Layer LayerItem = DNNGo_DNNGalleryProGame_Layer.FindByKeyForEdit(LayerID);
                if (LayerItem != null && LayerItem.ID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryProGame_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_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);
                if (SliderItem != null && SliderItem.ID > 0)
                {
                    SliderItem.Heats += Heat;
                    SliderItem.Update();

                    Heats = SliderItem.Heats;
                }
            }


            Response.Clear();
            Response.Write(Heats);
            Response.End();
        }
Beispiel #22
0
        /// <summary>
        /// Layer列表
        /// </summary>
        /// <returns></returns>
        public List <DNNGo_DNNGalleryProGame_Layer> GetLayerList(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            QueryParam qp = new QueryParam();

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

            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Layer._.ModuleId, Settings_ModuleID, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Layer._.Status, (Int32)EnumStatus.Activated, SearchType.Equal));
            qp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Layer._.SliderID, SliderItem.ID, SearchType.Equal));

            return(DNNGo_DNNGalleryProGame_Layer.FindAll(qp, out RecordCount));
        }
Beispiel #23
0
        /// <summary>
        ///  显示时间
        /// </summary>
        /// <param name="FieldName">字段名</param>
        /// <param name="DataItem">数据项</param>
        /// <param name="TimeFormat">时间格式</param>
        /// <returns></returns>
        public String ViewDateTime(String FieldName, DNNGo_DNNGalleryProGame_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);
            }
        }
Beispiel #24
0
        /// <summary>
        /// 列表行创建
        /// </summary>
        protected void gvEventList_RowCreated(object sender, GridViewRowEventArgs e)
        {
            Int32 DataIDX = 0;

            if (e.Row.RowType == DataControlRowType.Header)
            {
                //增加check列头全选
                TableCell cell = new TableCell();
                cell.Width = Unit.Pixel(5);
                cell.Text  = " <input id='CheckboxAll' value='0' type='checkbox' onclick='SelectAll()'/>";
                e.Row.Cells.AddAt(0, cell);

                foreach (TableCell var in e.Row.Cells)
                {
                    if (var.Controls.Count > 0 && var.Controls[0] is LinkButton)
                    {
                        string Colume = ((LinkButton)var.Controls[0]).CommandArgument;
                        if (Colume == Orderfld)
                        {
                            LinkButton l = (LinkButton)var.Controls[0];
                            l.Text += string.Format("<i class=\"fa {0}{1}\"></i>", Orderfld == "Title" ? "fa-sort-alpha-" : "fa-sort-amount-", (OrderType == 0) ? "asc" : "desc");
                        }
                    }
                }
            }
            else
            {
                DNNGo_DNNGalleryProGame_Slider Slider = e.Row.DataItem as DNNGo_DNNGalleryProGame_Slider;

                if (Slider != null && Slider.ID > 0)
                {
                    TemplateFormat xf = new TemplateFormat(this);


                    TableCell cell = new TableCell();
                    cell.Width = Unit.Pixel(5);
                    cell.Text  = string.Format(" <input name='Checkbox' id='Checkbox' value='{0}' type='checkbox' title='{1}' data-json='{2}'  />", Slider.ID, Slider.Title,
                                               new JavaScriptSerializer().Serialize(new GridItem()
                    {
                        ID      = Slider.ID,
                        Title   = Slider.Title,
                        Picture = xf.ViewPictureUrl(Slider),
                        Groups  = xf.ToGroups(Slider)
                    })
                                               );
                    e.Row.Cells.AddAt(0, cell);
                }
            }
        }
Beispiel #25
0
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindDataList()
        {
            QueryParam qp = new QueryParam();

            qp.OrderType = OrderType;
            if (!String.IsNullOrEmpty(Orderfld))
            {
                qp.Orderfld = Orderfld;
            }
            else
            {
                qp.Orderfld = DNNGo_DNNGalleryProGame_Slider._.ID;
            }

            #region "分页的一系列代码"


            int RecordCount = 0;
            int pagesize    = qp.PageSize = 10;
            qp.PageIndex = PageIndex;


            #endregion

            //查询的方法
            qp.Where = BindSearch();

            List <DNNGo_DNNGalleryProGame_Slider> Events = DNNGo_DNNGalleryProGame_Slider.FindAll(qp, out RecordCount);
            qp.RecordCount      = RecordCount;
            RecordPages         = qp.Pages;
            lblRecordCount.Text = String.Format("{0} {2} / {1} {3}", RecordCount, RecordPages, ViewResourceText("Title_Items", "Items"), ViewResourceText("Title_Pages", "Pages"));


            //Boolean is_admin = !IsAdministrator && !IsAdmin;



            //ctlPagingControl.TotalRecords = RecordCount;

            //if (RecordCount <= pagesize)
            //{
            //    ctlPagingControl.Visible = false;

            //}

            gvEventList.DataSource = Events;
            gvEventList.DataBind();
            BindGridViewEmpty <DNNGo_DNNGalleryProGame_Slider>(gvEventList, new DNNGo_DNNGalleryProGame_Slider());
        }
Beispiel #26
0
        /// <summary>
        /// 列表行绑定
        /// </summary>
        protected void gvEventList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                //还原出数据
                DNNGo_DNNGalleryProGame_Slider Slider = e.Row.DataItem as DNNGo_DNNGalleryProGame_Slider;

                if (Slider != null && Slider.ID > 0)
                {
                    TemplateFormat xf = new TemplateFormat(this);


                    Image imgPicture = e.Row.FindControl("imgFileName") as Image;



                    if (!String.IsNullOrEmpty(Slider.Options))
                    {
                        imgPicture.ImageUrl = xf.ViewPictureUrl(Slider);

                        if (String.IsNullOrEmpty(imgPicture.ImageUrl))
                        {
                            imgPicture.Visible = false;
                        }
                    }



                    //发布者信息
                    e.Row.Cells[3].Text = "--";
                    if (Slider.LastUser > 0)
                    {
                        UserInfo uInfo = UserController.GetUserById(PortalId, Slider.LastUser);
                        if (uInfo != null && uInfo.UserID > 0)
                        {
                            e.Row.Cells[3].Text = String.Format("{0}<br />{1}", uInfo.Username, uInfo.DisplayName);
                        }
                    }


                    //发布时间
                    e.Row.Cells[4].Text = Slider.LastTime.ToShortDateString();

                    //状态
                    e.Row.Cells[5].Text = EnumHelper.GetEnumTextVal(Slider.Status, typeof(EnumStatus));
                }
            }
        }
        /// <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_DNNGalleryProGame_Slider Article = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(IDX);
                            if (Article != null && Article.ID > 0)
                            {
                                if (Article.Status == (Int32)EnumStatus.RecycleBin && Status == (Int32)EnumStatus.RecycleBin)
                                {
                                    if (Article.Delete() > 0)
                                    {
                                        //删除相关的的层
                                        DNNGo_DNNGalleryProGame_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);
            }
        }
        /// <summary>
        /// 删除相关的的层
        /// </summary>
        /// <param name="SliderItem"></param>
        /// <returns></returns>
        public static Int32 Deletes(DNNGo_DNNGalleryProGame_Slider SliderItem)
        {
            QueryParam qp = new QueryParam();

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

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

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


            return(RecordCount);
        }
Beispiel #29
0
        /// <summary>
        /// 绑定动态模块到页面
        /// </summary>
        private void BindRelationsToPage()
        {
            //绑定动态模块的模态窗口 Resource_Attachments|Manager_Modal_SelectDownloadFiles
            hlSelectRelations.Attributes.Add("data-href", String.Format("{0}Resource_Masters.aspx?PortalId={1}&TabId={2}&ModuleId={3}&language={4}&Master=Setting_Modal_Sliders&SliderID={5}", ModulePath, PortalId, TabId, ModuleId, language, SliderID));



            List <GridItem> Items = new List <GridItem>();

            if (SliderItem != null && SliderItem.ID > 0 && !String.IsNullOrEmpty(SliderItem.Relations))
            {
                List <String> Relations = Common.GetList(SliderItem.Relations);


                if (Relations != null && Relations.Count > 0)
                {
                    TemplateFormat xf = new TemplateFormat(this);


                    foreach (var RelationId in Relations)
                    {
                        DNNGo_DNNGalleryProGame_Slider Slider = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(RelationId);
                        if (Slider != null && Slider.ID > 0)
                        {
                            Items.Add(new GridItem()
                            {
                                ID      = Slider.ID,
                                Title   = Slider.Title,
                                Picture = xf.ViewPictureUrl(Slider),
                                Groups  = xf.ToGroups(Slider)
                            });
                        }
                    }
                }
            }

            if (Items != null && Items.Count > 0)
            {
                //绑定参数项
                RepeaterRelations.DataSource = Items;
                RepeaterRelations.DataBind();
            }
        }
Beispiel #30
0
        /// <summary>
        /// 加载分组,并取消空格
        /// </summary>
        /// <param name="_Value"></param>
        /// <returns></returns>
        public String ToGroups(DNNGo_DNNGalleryProGame_Slider DataItem)
        {
            StringBuilder sb = new StringBuilder();

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

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

            return(sb.ToString());
        }