Example #1
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();
        }
        /// <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);
            }
        }
        /// <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);
            }
        }
Example #4
0
        /// <Description>
        /// 保存文章
        /// </Description>
        /// <param name="ArticleStatus">文章状态(为-1的时候取选项的值)</param>
        private Int32 SaveDataItem(Int32 ArticleStatus, ref DNNGo_DNNGalleryProGame_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.Relations = hfRelations.Value;

            //更新项
            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_DNNGalleryProGame_Slider._.Sort;
                Sqp.OrderType    = 1;
                Sqp.Where.Add(new SearchParam(DNNGo_DNNGalleryProGame_Slider._.ModuleId, ModuleId, SearchType.Equal));
                Article.Sort = Convert.ToInt32(DNNGo_DNNGalleryProGame_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);
        }
Example #5
0
        /// <summary>
        /// 媒体库文件下载
        /// </summary>
        public void FileDownLoads()
        {
            Int32  SliderID    = WebHelper.GetIntParam(Request, "SliderID", 0);
            Int32  LayerID     = WebHelper.GetIntParam(Request, "LayerID", 0);
            String SettingName = WebHelper.GetStringParam(Request, "SettingName", "");

            if (!String.IsNullOrEmpty(SettingName))
            {
                String SettingValue = String.Empty;

                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.Clicks += 1;
                            SliderItem.Update();
                        }
                        //层下载技术
                        LayerItem.Clicks += 1;
                        LayerItem.Update();
                        //取出层中的下载链接
                        SettingValue = ViewLayerSettingT <String>(LayerItem, SettingName, "");
                    }
                    else
                    {
                        //没有找到文件记录
                    }
                }
                else if (SliderID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryProGame_Slider.FindByKeyForEdit(SliderID);
                    if (SliderItem != null && SliderItem.ID > 0)
                    {
                        SliderItem.Clicks += 1;
                        SliderItem.Update();
                        //取出背景中的下载链接
                        SettingValue = ViewSliderSettingT <String>(SliderItem, SettingName, "");
                    }
                }

                if (!String.IsNullOrEmpty(SettingValue))
                {
                    String DownLoadUrl = HttpUtility.UrlDecode(ViewLinkUrl(SettingValue, false));
                    if (!String.IsNullOrEmpty(DownLoadUrl))
                    {
                        //记录下载信息到日志表里面***暂时忽略


                        if (SettingValue.IndexOf("MediaID=", StringComparison.CurrentCultureIgnoreCase) == 0)
                        {
                            String ServerPath = MapPath(DownLoadUrl);

                            if (false)
                            {
                                FileSystemUtils.DownloadFile(ServerPath, Path.GetFileName(ServerPath));//下载媒体库中的文件
                            }
                            else
                            {
                                Response.Redirect(DownLoadUrl);
                            }
                        }
                        else
                        {
                            Response.Redirect(DownLoadUrl);//除了媒体库中的文件,其他一律跳转
                        }
                    }
                    else
                    {
                        //下载链接不存在
                    }
                }
                else
                {
                    //没有取到下载链接
                }
            }
            else
            {
                //没有找到文件参数
            }
        }