예제 #1
0
 public ActionResult Index(int? pageIndex, int? photoClassId)
 {
     ((dynamic) base.ViewBag).Title = "图片";
     Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
     Maticsoft.ViewModel.CMS.Photo model = new Maticsoft.ViewModel.CMS.Photo();
     model.PhotoClassList = new Maticsoft.BLL.CMS.PhotoClass().GetTopList(10, "Depth=1", "Sequence");
     ((dynamic) base.ViewBag).PhotoClassId = photoClassId;
     int pageSize = this._basePageSize + this._waterfallSize;
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     pageIndex = new int?((pageIndex.HasValue && (pageIndex.Value > 1)) ? pageIndex.Value : 1);
     int startIndex = (pageIndex.Value > 1) ? (((pageIndex.Value - 1) * pageSize) + 1) : 0;
     int endIndex = (pageIndex.Value > 1) ? ((startIndex + this._basePageSize) - 1) : this._basePageSize;
     int totalItemCount = 0;
     string strWhere = photoClassId.HasValue ? ("ClassID=" + photoClassId.Value) : "";
     totalItemCount = photo.GetRecordCount(strWhere);
     ((dynamic) base.ViewBag).CurrentPageAjaxStartIndex = endIndex;
     int num5 = pageIndex.Value * pageSize;
     ((dynamic) base.ViewBag).CurrentPageAjaxEndIndex = (num5 > totalItemCount) ? totalItemCount : num5;
     List<Maticsoft.Model.CMS.Photo> items = photo.GetListModelByPage(strWhere, "PhotoID DESC", startIndex, endIndex);
     int? nullable = pageIndex;
     model.PhotoPagedList = new PagedList<Maticsoft.Model.CMS.Photo>(items, nullable.HasValue ? nullable.GetValueOrDefault() : 1, pageSize, totalItemCount);
     if (base.Request.IsAjaxRequest())
     {
         return this.PartialView("PhotoList", model);
     }
     return base.View(model);
 }
예제 #2
0
 protected override void ProcessSub(HttpContext context, string fileName)
 {
     HttpRequest request = context.Request;
     if (!string.IsNullOrWhiteSpace(request.Params["album"]))
     {
         string s = request.Params["album"];
         if (!string.IsNullOrWhiteSpace(request.Params["userId"]))
         {
             string str2 = request.Params["userId"];
             string str3 = context.Request.Params["folder"];
             Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
             HttpPostedFile file = context.Request.Files["Filedata"];
             Maticsoft.Model.CMS.Photo photo3 = new Maticsoft.Model.CMS.Photo {
                 PhotoName = file.FileName,
                 ImageUrl = str3 + "/" + fileName,
                 Description = "",
                 AlbumID = int.Parse(s),
                 State = 1,
                 CreatedUserID = int.Parse(str2),
                 CreatedDate = DateTime.Now,
                 PVCount = 0,
                 ClassID = 1,
                 ThumbImageUrl = str3 + "/T_" + fileName,
                 NormalImageUrl = str3 + "/N_" + fileName,
                 Sequence = new int?(photo.GetMaxSequence()),
                 IsRecomend = false,
                 CommentCount = 0,
                 Tags = ""
             };
             Maticsoft.Model.CMS.Photo model = photo3;
             int num = photo.Add(model);
             context.Response.Write(num.ToString());
         }
     }
 }
예제 #3
0
 public void btnSave_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(this.txtPhotoName.Text))
     {
         MessageBox.ShowFailTip(this, CMSPhoto.ErrorImageNameNull);
     }
     else if (string.IsNullOrWhiteSpace(this.txtDescription.Text))
     {
         MessageBox.ShowFailTip(this, CMSPhoto.ErrorIntroductionNull);
     }
     else if (!PageValidate.IsNumber(this.txtSequence.Text))
     {
         MessageBox.ShowFailTip(this, CMSPhoto.ErrorOrderFormat);
     }
     else if (string.IsNullOrWhiteSpace(this.txtTags.Text))
     {
         MessageBox.ShowFailTip(this, CMSPhoto.ErrorLabel);
     }
     else
     {
         string text = this.txtPhotoName.Text;
         string str2 = this.txtDescription.Text;
         int num = int.Parse(this.ddlAlbum.SelectedValue);
         int num2 = int.Parse(this.ddlState.SelectedValue);
         int num3 = int.Parse(this.lblPVCount.Text);
         int num4 = 0;
         if (!string.IsNullOrWhiteSpace(this.ddlPhotoClass.SelectedValue))
         {
             num4 = int.Parse(this.ddlPhotoClass.SelectedValue);
         }
         int num5 = int.Parse(this.txtSequence.Text);
         bool flag = this.chkIsRecomend.Checked;
         string str3 = this.txtTags.Text;
         Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
         Maticsoft.Model.CMS.Photo model = photo.GetModel(this.PhotoID);
         if (model != null)
         {
             model.PhotoName = text;
             model.Description = str2;
             model.AlbumID = num;
             model.State = num2;
             model.PVCount = num3;
             model.ClassID = num4;
             model.Sequence = new int?(num5);
             model.IsRecomend = new bool?(flag);
             model.Tags = str3;
             if (photo.Update(model))
             {
                 MessageBox.ResponseScript(this, "parent.location.href='list.aspx?AlbumID=" + num + "'");
             }
         }
     }
 }
예제 #4
0
 public ActionResult Detail(int id)
 {
     Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
     Maticsoft.Model.CMS.Photo model = new Maticsoft.Model.CMS.Photo();
     model = photo.GetModel(id);
     if (model == null)
     {
         return new EmptyResult();
     }
     List<Maticsoft.Model.CMS.Photo> list = photo.GetListAroundPhotoId(10, id, model.ClassID);
     return base.View(list);
 }
예제 #5
0
 public ActionResult PhotoListWaterfall(int startIndex, int? photoClassId)
 {
     Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
     Maticsoft.ViewModel.CMS.Photo model = new Maticsoft.ViewModel.CMS.Photo();
     ((dynamic) base.ViewBag).BasePageSize = this._basePageSize;
     startIndex = (startIndex > 1) ? (startIndex + 1) : 0;
     int endIndex = (startIndex > 1) ? ((startIndex + this._waterfallDetailCount) - 1) : this._waterfallDetailCount;
     string strWhere = photoClassId.HasValue ? ("ClassID=" + photoClassId.Value) : "";
     if (photo.GetRecordCount(strWhere) < 1)
     {
         return new EmptyResult();
     }
     model.PhotoListWaterfall = photo.GetListModelByPage(strWhere, "PhotoID DESC", startIndex, endIndex);
     return base.View(model);
 }
예제 #6
0
 public ActionResult AjaxLikePhoto(int PhotoId)
 {
     Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo();
     Maticsoft.Model.CMS.Photo model = new Maticsoft.Model.CMS.Photo();
     if (photo.Exists(PhotoId))
     {
         model = photo.GetModel(PhotoId);
         model.FavouriteCount++;
         if (photo.Update(model))
         {
             return base.Content("True");
         }
     }
     return base.Content("False");
 }
예제 #7
0
 private void ShowInfo(int PhotoID)
 {
     Maticsoft.Model.CMS.Photo model = new Maticsoft.BLL.CMS.Photo().GetModel(PhotoID);
     this.lblPhotoID.Text = model.PhotoID.ToString();
     this.lblPhotoName.Text = model.PhotoName;
     this.lblImageUrl.Text = model.ImageUrl;
     this.lblDescription.Text = model.Description;
     this.lblAlbumID.Text = model.AlbumID.ToString();
     this.lblState.Text = model.State.ToString();
     this.lblCreatedUserID.Text = model.CreatedUserID.ToString();
     this.lblCreatedDate.Text = model.CreatedDate.ToString();
     this.lblPVCount.Text = model.PVCount.ToString();
     this.lblClassID.Text = model.ClassID.ToString();
     this.lblThumbImageUrl.Text = model.ThumbImageUrl;
     this.lblNormalImageUrl.Text = model.NormalImageUrl;
     this.lblSequence.Text = model.Sequence.ToString();
     this.lblIsRecomend.Text = model.IsRecomend.Value ? Site.lblTrue : Site.lblFalse;
     this.lblCommentCount.Text = model.CommentCount.ToString();
     this.lblTags.Text = model.Tags;
 }
예제 #8
0
 private void ShowInfo(int AlbumID)
 {
     Maticsoft.Model.CMS.PhotoAlbum model = new Maticsoft.BLL.CMS.PhotoAlbum().GetModel(AlbumID);
     this.txtAlbumName.Text = model.AlbumName;
     this.txtDescription.Text = model.Description;
     Maticsoft.Model.CMS.Photo photo2 = new Maticsoft.BLL.CMS.Photo().GetModel(model.CoverPhoto.Value);
     if (photo2 != null)
     {
         this.imgCoverPhoto.ImageUrl = FileHelper.GeThumbImage(photo2.ThumbImageUrl, "T235x1280_");
     }
     this.radlState.SelectedValue = model.State.ToString();
     this.lblCreatedUserID.Text = model.CreatedUserID.ToString();
     this.lblCreatedDate.Text = model.CreatedDate.ToString();
     this.lblPVCount.Text = model.PVCount.ToString();
     this.txtSequence.Text = model.Sequence.ToString();
     this.radlPrivacy.SelectedValue = model.Privacy.ToString();
     this.lblLastUpdatedDate.Text = model.LastUpdatedDate.ToString();
 }
예제 #9
0
 private void ShowInfo()
 {
     Maticsoft.Model.CMS.Photo model = new Maticsoft.BLL.CMS.Photo().GetModel(this.PhotoID);
     if (model != null)
     {
         this.txtPhotoName.Text = model.PhotoName;
         this.ShowImage.HRef = model.ImageUrl;
         this.txtDescription.Text = model.Description;
         this.ddlState.SelectedValue = model.State.ToString();
         this.lblCreatedUserID.Text = model.CreatedUserName;
         this.lblCreatedDate.Text = model.CreatedDate.ToString();
         this.lblPVCount.Text = model.PVCount.ToString();
         if (model.ClassID != 1)
         {
             this.ddlPhotoClass.SelectedValue = model.ClassID.ToString();
         }
         this.ThumbImage.ImageUrl = FileHelper.GeThumbImage(model.ThumbImageUrl, "T235x1280_");
         if (model.Sequence.HasValue)
         {
             this.txtSequence.Text = model.Sequence.ToString();
         }
         if (model.IsRecomend.HasValue)
         {
             this.chkIsRecomend.Checked = model.IsRecomend.Value;
         }
         this.txtTags.Text = model.Tags;
         this.ddlAlbum.SelectedValue = model.AlbumID.ToString();
     }
 }