예제 #1
0
        /// <summary>
        /// 删除相册
        /// </summary>
        /// <param name="m_where"></param>
        /// <returns></returns>
        public static Result DeleteImageAlbum(string m_where)
        {
            Result r = new Result();

            try
            {
                var imgas = ImageAlbumView.GetModelList(m_where);
                foreach (var imga in imgas)
                {
                    try
                    {
                        Voodoo.IO.File.Delete(HttpContext.Current.Server.MapPath(BasePage.GetImageUrl(imga, imga.GetClass())));//删除相册HTML页面
                        DeleteImage(string.Format("AlbumID={0}", imga.ID));
                    }
                    catch { }
                }
                r.Success = true;
                r.Text    = string.Format("成功删除{0}条记录", imgas.Count);
            }
            catch (Exception ex)
            {
                r.Success = false;
                r.Text    = ex.Message;
            }

            ImageAlbumView.Del(m_where);

            return(r);
        }
예제 #2
0
        /// <summary>
        /// 加载信息
        /// </summary>
        protected void LoadInfo()
        {
            ddl_Class.DataSource     = NewsAction.NewsClass.Where(p => p.IsLeafClass && p.ModelID == 2);
            ddl_Class.DataTextField  = "ClassName";
            ddl_Class.DataValueField = "ID";
            ddl_Class.DataBind();

            ddl_Class.SelectedValue = cls.ToS();

            ddl_Author.DataSource     = SysUserView.GetModelList();
            ddl_Author.DataTextField  = "UserName";
            ddl_Author.DataValueField = "ID";
            ddl_Author.DataBind();

            ImageAlbum imga = ImageAlbumView.GetModelByID(id.ToS());

            //txt_Title.Text = imga.Title;
            //ddl_Author.SelectedValue = imga.AuthorID.ToS();
            //txt_Folder.Text = imga.Folder;
            //txt_Keyword.Text=imga.

            if (id > 0)
            {
                ddl_Class.SelectedValue = imga.ClassID.ToS();
                txt_Title.Text          = imga.Title;
                ddl_Author.Text         = imga.AuthorID.ToS();
                //txt_Folder.Text = imga.Folder;
                txt_Keyword.Text    = imga.KeyWords;
                txt_ClickCount.Text = imga.ClickCount.ToS();
                txt_ReplyCount.Text = imga.ClickCount.ToS();
                txt_Intro.Text      = imga.Intro;

                rp_list.DataSource = ImagesView.GetModelList(string.Format("AlbumID={0} order by id", imga.ID));
                rp_list.DataBind();
            }
            else
            {
                ImageAlbumView.Del("AuthorID=0 and CreateTime<'" + DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + "'");
                imga = new ImageAlbum()
                {
                    ClassID = cls, ClickCount = 0, ReplyCount = 0, ZtID = 0, CreateTime = DateTime.Now, AuthorID = 0, UpdateTime = DateTime.Now
                };
                ImageAlbumView.Insert(imga);
                Response.Redirect(string.Format("ImageEdit.aspx?class={0}&id={1}", cls, imga.ID));
            }
        }