private void InitContent() { try { Transaction t = new Transaction(); T_PRODUCTEntity Rehouse = new T_PRODUCTEntity(); Rehouse.ID = Convert.ToDecimal(hidId.Value); Rehouse.Retrieve(); lbReqHuID.Value = Rehouse.PROID; txtSUBTITLE.Text = Rehouse.BAND; ddlTITLECOLOR.SelectedValue = Rehouse.PROTYPE; txtProstatus.Text = Rehouse.PROSTATUS.ToString(); txtTITLE.Text = Rehouse.PRONAME; txtINTRODUCE.Text = Rehouse.INTRODUCE.ToString(); string PicSql = "select * from T_PRODUCTPIC where PROID='" + lbReqHuID.Value + "'"; DataTable PicDt = PersistenceLayer.Query.ProcessSql(PicSql, Names.DBName); if (PicDt.Rows.Count > 0) { for (int i = 0; i < PicDt.Rows.Count; i++) { ImageShow.Items.Add(PicDt.Rows[i]["PICURL"].ToString()); } BtnDelete.Visible = true; ImageShow.Items[0].Selected = true; ImageShow1.ImageUrl = SiteInfo.VirtualPath() + "\\uploadfile\\PictureSite\\" + ImageShow.SelectedItem.Text; } } catch { } }
protected void BtnUpload_Click(object sender, EventArgs e) { Random AA = new Random(); string fullname = FileUpload.FileName.ToString(); string fn = DateTime.Now.ToString("yyyyMMddHHmmss") + AA.Next(10000000); string typ2 = fullname.Substring(fullname.LastIndexOf(".") + 1); if (typ2 == "gif" || typ2 == "jpg" || typ2 == "bmp" || typ2 == "png") { FileUpload.SaveAs(Server.MapPath("~") + "\\uploadfile\\PictureSite\\" + fn + "." + typ2); string webFilePath = Server.MapPath("~") + "\\uploadfile\\PictureSite\\" + fn + "." + typ2; string webFilePath_s = Server.MapPath("~") + "\\uploadfile\\PictureSite\\SamllPicture\\" + fn + "." + typ2; string webFilePath_h = Server.MapPath("~") + "\\uploadfile\\PictureSite\\BigPicture\\" + fn + "." + typ2; MakeThumbnail(webFilePath, webFilePath_s, 35, 35, "Cut"); MakeThumbnail(webFilePath, webFilePath_h, 620, 378, "Cut"); //txtPicUrl.Text = fn + "." + typ2; ImageShow.Items.Add(fn + "." + typ2); //int hj=1; //ImageShow.Items[hj].Selected = true; ImageShow1.ImageUrl = SiteInfo.VirtualPath() + "\\uploadfile\\PictureSite\\" + fn + "." + typ2; T_PRODUCTPICEntity MT = new T_PRODUCTPICEntity(); MT.ID = Sequence.GetNextValue("SEQ_T_PRODUCTPIC"); MT.PROID = lbReqHuID.Value; //MT.SUBTITLE = txtPicUrl.Text; MT.PICURL = fn + "." + typ2; MT.ISTOP = Convert.ToDecimal(RadioFM.SelectedValue); MT.Save(); BtnDelete.Visible = true; } else { } }
private void NewsInfoBind() { string ID = Request.QueryString["ID"]; int i = 0; if (int.TryParse(ID, out i)) { T_PRODUCTEntity FM = new T_PRODUCTEntity(); FM.ID = int.Parse(ID); FM.Retrieve(); if (FM.IsPersistent) { newstitle.InnerHtml = "<span style='color: #000000';font-size:18px;font-family:SimSun'>" + FM.PRONAME + "</span>"; nodename.InnerText = FM.PRONAME; newsinfo.InnerHtml = " 发布人:" + FM.MEMBERID + " 发布时间: " + FM.INSERTTIME.ToString() + " 点击率: " + FM.HITS.ToString(); newsinfo1.InnerHtml = "产品品牌:" + FM.BAND.ToString() + "<br />" + " 产品类型:" + RentalHouse.GetST_PROTYPE(FM.PROTYPE) + "<br />"; newscontent.InnerHtml = FM.INTRODUCE; FM.HITS = FM.HITS + 1; FM.Save(); } string PicSql = "select * from T_PRODUCTPIC where PROID='" + FM.PROID + "'"; DataTable PicDt = PersistenceLayer.Query.ProcessSql(PicSql, Names.DBName); if (PicDt.Rows.Count > 0) { for (int j = 0; j < PicDt.Rows.Count; j++) { newsimage.InnerHtml += "<image src='" + SiteInfo.VirtualPath() + "\\uploadfile\\PictureSite\\" + PicDt.Rows[j]["PICURL"].ToString() + "' />"; } } } }
protected void ImageShow_SelectedIndexChanged(object sender, EventArgs e) { ImageShow1.ImageUrl = SiteInfo.VirtualPath() + "\\uploadfile\\PictureSite\\" + ImageShow.SelectedItem.Text; BtnDelete.Visible = true; }