Esempio n. 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_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>
        /// <returns></returns>
        public DNNGo_DNNGalleryPro_Layer SetDataItem()
        {
            Int32 LayerResult = 0;

            DNNGo_DNNGalleryPro_Layer Layer = LayerItem;

            Layer.Options = SetItemSettings();


            Layer.LastIP   = WebHelper.UserHost;
            Layer.LastTime = xUserTime.UtcTime();
            Layer.LastUser = UserId;

            if (Layer.ID > 0)
            {
                LayerResult = Layer.Update();
            }
            else
            {
                Layer.CreateTime = xUserTime.UtcTime();
                Layer.CreateUser = UserId;

                Layer.ModuleId = ModuleId;
                Layer.PortalId = PortalId;

                Layer.SliderID = SliderID;

                Layer.Status = (Int32)EnumStatus.Activated;


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


                Layer.ID = Layer.Insert();
            }



            return(Layer);
        }
Esempio n. 3
0
        /// <summary>
        /// 排序列表
        /// </summary>
        public void LayerListSort()
        {
            Int32 ReturnString = 0;

            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                String SortList = WebHelper.GetStringParam(Request, "json", "");
                if (!String.IsNullOrEmpty(SortList))
                {
                    JavaScriptSerializer jsSerializer = new JavaScriptSerializer();

                    try
                    {
                        object[] Sorts = jsSerializer.DeserializeObject(SortList) as object[];

                        if (Sorts != null && Sorts.Length > 0)
                        {
                            foreach (object so in Sorts)
                            {
                                Dictionary <string, object> SortDict = so as Dictionary <string, object>;

                                if (SortDict != null && SortDict.Count == 2)
                                {
                                    String setClause   = String.Format(" {0} = {1} ", DNNGo_DNNGalleryPro_Layer._.Sort, SortDict[DNNGo_DNNGalleryPro_Layer._.Sort]);
                                    String whereClause = String.Format(" {0} = {1} ", DNNGo_DNNGalleryPro_Layer._.ID, SortDict[DNNGo_DNNGalleryPro_Layer._.ID]);

                                    ReturnString += DNNGo_DNNGalleryPro_Layer.Update(setClause, whereClause);
                                }
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }
Esempio n. 4
0
        /// <summary>
        /// 选中激活LayerItem
        /// </summary>
        public void CheckedLayerItem()
        {
            String ReturnString = "0";

            Int32 SliderID = WebHelper.GetIntParam(Request, "SliderID", 0);

            if (SliderID > 0)
            {
                Int32 LayerID = WebHelper.GetIntParam(Request, "LayerID", 0);
                if (LayerID > 0)
                {
                    DNNGo_DNNGalleryPro_Layer Layer = DNNGo_DNNGalleryPro_Layer.FindByKeyForEdit(LayerID);


                    Layer.Status = WebHelper.GetBooleanParam(Request, "checked", false) ? (Int32)EnumStatus.Activated : (Int32)EnumStatus.Hidden;


                    ReturnString = Layer.Update().ToString();
                }
            }
            Response.Clear();
            Response.Write(ReturnString);
            Response.End();
        }
Esempio n. 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_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.Clicks += 1;
                            SliderItem.Update();
                        }
                        //层下载技术
                        LayerItem.Clicks += 1;
                        LayerItem.Update();
                        //取出层中的下载链接
                        SettingValue = ViewLayerSettingT <String>(LayerItem, SettingName, "");
                    }
                    else
                    {
                        //没有找到文件记录
                    }
                }
                else if (SliderID > 0)
                {
                    SliderItem = DNNGo_DNNGalleryPro_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
            {
                //没有找到文件参数
            }
        }