protected void gridView_RowCommand(object sender, GridViewCommandEventArgs e) { Cultural.Model.HomeImg homeImg = new Cultural.Model.HomeImg(); if (e.CommandName == "HomePicDelete") { homeImg = homePicBll.GetModel(int.Parse(e.CommandArgument.ToString())); homeImg.Status = "0"; homePicBll.Update(homeImg); BindData(); } if (e.CommandName == "HomePicShow") { homeImg = homePicBll.GetModel(int.Parse(e.CommandArgument.ToString())); homeImg.Status = homeImg.Status == "2" ? "1" : "2"; if (homeImg.Status == "2") { int num = homePicBll.GetRecordCount(" Status ='2' "); if (num >= 6) { Maticsoft.Common.MessageBox.Show(this.Page, "首页最多显示6张图片,目前已达到6张!请取消部分图片首页显示!"); } else { homePicBll.Update(homeImg); BindData(); } } else { homePicBll.Update(homeImg); BindData(); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string id = Request.QueryString["id"]; if (id != null && id.ToString().Trim() != "") { homeImg = homeImgBLL.GetModel(int.Parse(id)); if (homeImg != null) { Imghome.ImageUrl = Maticsoft.Common.CommonFun.URLConverToServer("../../Image/News/" + homeImg.ImgURL); txtDesc.Text = homeImg.ImgDesc; } else { Maticsoft.Common.MessageBox.ShowAndRedirect(this.Page, "网络错误!请重试!", "HomePicMana.aspx"); } } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string paraFID = context.Request["FID"]; //读取参数PageSize if (paraFID != null && paraFID.Trim() == "HomePic") //中心概括界面 { Cultural.BLL.HomeImg homeBll = new Cultural.BLL.HomeImg(); string paraImgDesc = context.Request["ImgDesc"] == null ? "" : context.Request["ImgDesc"]; //读取参数图片描述 string paraImgURL = context.Request["ImgURL"] == null ? "" : context.Request["ImgURL"]; //读取参数图片路径 if (paraImgURL != null && paraImgURL.ToString().Trim() != "") { try { Cultural.Model.HomeImg homeImg = new Cultural.Model.HomeImg(); homeImg.ImgDesc = CommonFun.ClearHtml(paraImgDesc); homeImg.ImgURL = paraImgURL; homeImg.Status = "1"; homeBll.Add(homeImg); } catch { context.Response.Write(JsonHelper.Serialize("error")); } } context.Response.Write(JsonHelper.Serialize("success")); } else if (paraFID != null && paraFID.Trim() == "DownInfo") { string Title = context.Request["Title"] == null ? "" : context.Request["Title"]; string Desc = context.Request["Desc"] == null ? "" : context.Request["Desc"]; int BoardID = context.Request["BoardID"] == null ? 0 : int.Parse(context.Request["BoardID"]); int Author = context.Request["Author"] == null ? 0 : int.Parse(context.Request["Author"]); Cultural.BLL.DownCenter downCBll = new Cultural.BLL.DownCenter(); Cultural.Model.DownCenter downCenter = new Cultural.Model.DownCenter(); downCenter.Author = Author; downCenter.BoardID = BoardID; downCenter.DownDesc = Desc; downCenter.DownTitle = Title; downCenter.PubTime = string.Format("{0}-{1}-{2} {3}:{4}", DateTime.Now.Year, DateTime.Now.Month.ToString().PadLeft(2, '0'), DateTime.Now.Day.ToString().PadLeft(2, '0'), DateTime.Now.Hour.ToString().PadLeft(2, '0'), DateTime.Now.Minute.ToString().PadLeft(2, '0')); downCenter.Status = "1"; try { List <Cultural.Model.DownCenter> tdList = new List <Cultural.Model.DownCenter>(); tdList = downCBll.GetModelList(string.Format(" DownTitle='{0}' ", downCenter.DownTitle)); if (tdList != null && tdList.Count > 0) { context.Response.Write(JsonHelper.Serialize("error")); } else { downCBll.Add(downCenter); List <Cultural.Model.DownCenter> dList = new List <Cultural.Model.DownCenter>(); dList = downCBll.GetModelList(string.Format(" Author={0} and BoardID={1} and DownTitle='{2}' order by PubTime desc ", downCenter.Author, downCenter.BoardID, downCenter.DownTitle)); if (dList != null && dList.Count > 0) { context.Response.Write(JsonHelper.Serialize(dList[0].DownID)); } else { context.Response.Write(JsonHelper.Serialize("error")); } } } catch { context.Response.Write(JsonHelper.Serialize("error")); } } else if (paraFID != null && paraFID.Trim() == "DownFile") { string FileOriName = context.Request["FileOriName"] == null ? "" : context.Request["FileOriName"]; string FilePath = context.Request["FilePath"] == null ? "" : context.Request["FilePath"]; int DownID = context.Request["DownID"] == null ? 0 : int.Parse(context.Request["DownID"]); if (DownID != 0) { Cultural.BLL.DownFile downFBll = new Cultural.BLL.DownFile(); Cultural.Model.DownFile downFile = new Cultural.Model.DownFile(); downFile.DownID = DownID; downFile.FileOriName = FileOriName; downFile.FilePath = FilePath; downFile.Status = "1"; try { downFBll.Add(downFile); context.Response.Write(JsonHelper.Serialize("success")); } catch { context.Response.Write(JsonHelper.Serialize("error")); } } } else { context.Response.Write(JsonHelper.Serialize("error")); } }