public void btnPost_Click(object sender, EventArgs e) { ShowPicture showPicture = null; if (action == OperateType.Add) { showPicture = new ShowPicture(); } else { showPicture = ShowPictures.Get(showPictureID); } showPicture.Description = this.txtDescription.Text; showPicture.Link = this.txtLink.Text; showPicture.Title = this.txtTitle.Text; showPicture.DisplayOrder = Convert.ToInt32(this.txtDisplayOrder.Text); if (fuLogo.PostedFile != null && fuLogo.PostedFile.ContentLength > 0) { showPicture.FileName = Path.GetFileName(fuLogo.PostedFile.FileName); } if (action == OperateType.Add) { ShowPictures.Create(showPicture, fuLogo.PostedFile.InputStream); mbMessage.ShowMsg("新增展示图片信息成功,可继续填写新展示图片信息,若完成请返回!", Color.Navy); } else if (action == OperateType.Edit) { ShowPictures.Update(showPicture, fuLogo.PostedFile.InputStream); mbMessage.ShowMsg("修改展示图片信息成功,可继续修改展示图片信息,若完成请返回!", Color.Navy); } BindData(); }
void BindData() { ShowPicture showPicture = null; if (action == OperateType.Edit) { showPicture = ShowPictures.Get(showPictureID); } else { showPicture = new ShowPicture(); } this.txtDescription.Text = showPicture.Description; this.txtLink.Text = showPicture.Link; this.txtTitle.Text = showPicture.Title; this.txtDisplayOrder.Text = showPicture.DisplayOrder.ToString(); if (showPicture.File != null) { this.imgLogo.ImageUrl = SiteUrlManager.GetResizedImageUrl(showPicture.File, (int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } else { this.imgLogo.ImageUrl = SiteUrlManager.GetNoPictureUrl((int)imgLogo.Width.Value, (int)imgLogo.Height.Value); } }
public void ProcessRequest(HttpContext context) { context.Response.Clear(); List <ShowPicture> picTemp = ShowPictures.GetShowPictures(); List <ShowPicture> pics = picTemp.GetRange(0, Math.Min(5, picTemp.Count)); context.Response.Write(Newtonsoft.Json.JavaScriptConvert.SerializeObject(pics)); }
protected void egvShowPictures_RowDeleting(object sender, GridViewDeleteEventArgs e) { Guid showPictureID = (Guid)this.egvShowPictures.DataKeys[e.RowIndex].Value; DataActionStatus status = ShowPictures.Delete(showPictureID); switch (status) { default: case DataActionStatus.Success: BindData(); break; } }
void BindData() { this.egvShowPictures.DataSource = ShowPictures.GetShowPictures(); this.egvShowPictures.DataBind(); }