protected void Page_Load(object sender, EventArgs e) { int tid = Convert.ToInt32(Request["tupianid"]); int pid = Convert.ToInt32(Request["zhiwuid"]); BLL.ZhiWuTuPian zhiWuTuPian = new BLL.ZhiWuTuPian(); BLL.ZhiWuXinXi zhiWuXinXi = new BLL.ZhiWuXinXi(); //先删除植物图片里的地址 zhiWuTuPian.Delete(tid); //遍历植物图片里的图片地址,并把植物信息里的植物地址修改成遍历出来的第一个地址 List <Model.ZhiWuTuPian> modellist = zhiWuTuPian.GetModelList(pid.ToString()); Model.ZhiWuXinXi model = zhiWuXinXi.GetModel(pid); if (modellist != null) { //遍历删除之后剩下的地址,将第一个赋值 foreach (var item in modellist) { model.Mu = item.DiZhi; break; } } else { model.Mu = null; } zhiWuXinXi.Update(model); Response.Redirect("addplantImage.aspx?id=" + pid); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string url = context.Request["url"]; if (url.Length > 50) { int id = Convert.ToInt32(context.Request["id"]); Model.ZhiWuTuPian img = new Model.ZhiWuTuPian(); BLL.ZhiWuXinXi zhiWuXinXi = new BLL.ZhiWuXinXi(); if (zhiWuXinXi.GetModel(id) != null) { Model.ZhiWuXinXi zhiwumodel = zhiWuXinXi.GetModel(id); zhiwumodel.Mu = url; zhiWuXinXi.Update(zhiwumodel); } img.DiZhi = url; img.ZWBianHao = id; BLL.ZhiWuTuPian zhiWuTuPian = new BLL.ZhiWuTuPian(); zhiWuTuPian.Add(img); context.Response.Write("上传成功!!!"); } else { context.Response.Write("请选择图片!!!"); } }
protected void savebtn_Click(object sender, EventArgs e) { int id = Int32.Parse(Request["id"] ?? "0"); var model = ZhiWuXinXi.GetModel(id); model.ZYJiaZhi = this.zyjz.Text; ZhiWuXinXi.Update(model); Context.Response.Redirect("Zhiwulist.aspx"); }
protected void savebtn_Click(object sender, EventArgs e) { int id = Int32.Parse(Request["id"] ?? "0"); MainKey = id; var model = ZhiWuXinXi.GetModel(id); model.Xiaoqu = school.Items[school.SelectedIndex].Value; //获取Value model.ZWXueMing = Request["zhiwuName"]; model.JingDu = jingdu.Text; model.WeiDu = weidu.Text; model.YingWenMing = Request["zhiwueName"]; model.FBQuYu = this.plantsDetail.Text; ZhiWuXinXi.Update(model); Context.Response.Redirect("ZhiwuList.aspx"); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int id = int.Parse(context.Request["id"]); BLL.ZhiWuTuPian pic = new BLL.ZhiWuTuPian(); var plantpic = pic.GetModel(id); var plantpic2 = pic.GetModelList(id.ToString()); //浏览次数 BLL.ZhiWuXinXi xinxi = new BLL.ZhiWuXinXi(); if (plantpic == null) { string str = new JavaScriptSerializer().Serialize("error"); context.Response.Write(str); } else { Model.ZhiWuXinXi model = xinxi.GetModel(plantpic.ZWBianHao); int ViewCount = int.Parse(model.BeiZhu); ViewCount = ViewCount + 1; model.BeiZhu = ViewCount.ToString(); xinxi.Update(model); var plantintroduce = xinxi.GetModel(plantpic.ZWBianHao); plantintroduce.FBQuYu = Common.UBB2Html.Decode(plantintroduce.FBQuYu); plantintroduce.SZXiXing = Common.UBB2Html.Decode(plantintroduce.SZXiXing); plantintroduce.SCHuanJing = Common.UBB2Html.Decode(plantintroduce.SCHuanJing); plantintroduce.XTTeZheng = Common.UBB2Html.Decode(plantintroduce.XTTeZheng); plantintroduce.ZPJiShu = Common.UBB2Html.Decode(plantintroduce.ZPJiShu); plantintroduce.ZYJiaZhi = Common.UBB2Html.Decode(plantintroduce.ZYJiaZhi); plantintroduce.FZFangFa = Common.UBB2Html.Decode(plantintroduce.FZFangFa); var plant = new { pic = plantpic, itd = plantintroduce, pic2 = plantpic2 }; string jsonstr = new JavaScriptSerializer().Serialize(plant); context.Response.Write(jsonstr); } }