protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoList/PhotoPrint.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = "照片信息"; context.TempData["ThumbID"] = strThumbID; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); } else { Response.Write("<script>alert('所要打印的照片不存在!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); Model.Album.UserPhoto model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode; strOpenID = model.OpenId; strFilePath = model.FilePath; //删除文件 //System.IO.FileInfo pFile = new System.IO.FileInfo("~/User_Photo/" + strFilePath); System.IO.FileInfo pFile = new System.IO.FileInfo(Server.MapPath("../User_Photo/" + strFilePath)); if (pFile.Exists) { pFile.Delete();//删除 } //删除记录 dal.DelMyThumb(strThumbID); //返回 Response.Redirect("MyThumbList.aspx?SiteCode=" + strSiteCode + "&OpenID=" + strOpenID); }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); Model.Album.UserPhoto model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode; strOpenID = model.OpenId; strFilePath = model.FilePath; //插入照片墙记录 DAL.Album.PhotoWallDAL dalPhotoWall = new DAL.Album.PhotoWallDAL(); Model.Album.PhotoWall modelPhotoWall = new Model.Album.PhotoWall(); modelPhotoWall.OpenId = model.OpenId; modelPhotoWall.Name = model.Name; modelPhotoWall.SiteCode = model.SiteCode; modelPhotoWall.OpenId = model.OpenId; modelPhotoWall.FilePath = model.FilePath; modelPhotoWall.Remark = model.Remark; modelPhotoWall.AddTime = model.AddTime; dalPhotoWall.Insert(modelPhotoWall); //复制文件 System.IO.FileInfo pFile = new System.IO.FileInfo(Server.MapPath("../User_Photo/" + strFilePath)); if (pFile.Exists) { pFile.CopyTo(Server.MapPath("../WALL_Photo/" + strFilePath), true); } Response.Write("<script>alert('照片上传照片墙完成!');window.location.href='MyThumbList.aspx?SiteCode=" + strSiteCode + "&OpenID=" + strOpenID + "'</script>"); //返回 //Response.Redirect("MyThumbList.aspx?SiteCode=" + strSiteCode + "&OpenID=" + strOpenID); }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); Model.Album.UserPhoto model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode; strOpenID = model.OpenId; this.target.Src = "~/User_Photo/" + model.FilePath; strFilePath = model.FilePath; }
protected override bool BeforeLoad() { string strProductID = string.Empty; if (null == Request.QueryString["id"]) { return(false); } strProductID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strProductID); model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } SiteCode = model.SiteCode; return(base.BeforeLoad()); }
protected void Page_Load(object sender, EventArgs e) { if (null == Request.QueryString["id"]) { return; } strThumbID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.UserPhotoDAL dal = new DAL.Album.UserPhotoDAL(); DataSet ds = dal.GetMyThumb(strThumbID); Model.Album.UserPhoto model = new Model.Album.UserPhoto(); if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(ds.Tables[0].Rows[0]); } strSiteCode = model.SiteCode.ToString(); strOpenID = model.OpenId.ToString(); strThumbMsg = Common.Common.NoHtml(Request.Form["thumbMsg"].ToString()); strClientID = "WSY08"; if (string.IsNullOrEmpty(strClientID)) { Response.Write("<script>alert('打印码已经使用过!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); return; } int iPrintCount = 1; string strPrintCode = ""; //判断如果是单数据不用输入打印码 DAL.HP.HPClientDAL dalClient = new DAL.HP.HPClientDAL(); DataSet dsClient = dalClient.GetPrintClient(strSiteCode); if (null != dsClient && dsClient.Tables.Count > 0 && dsClient.Tables[0].Rows.Count > 0) { iPrintCount = int.Parse(dsClient.Tables[0].Rows[0]["FreeAmount"].ToString()); } if (null != dsClient && dsClient.Tables.Count > 0 && dsClient.Tables[0].Rows.Count > 0) { if (dsClient.Tables[0].Rows.Count == 1) { strPrintCode = dsClient.Tables[0].Rows[0]["FreeCode"].ToString(); strClientID = dsClient.Tables[0].Rows[0]["ClientCode"].ToString(); } } DAL.HP.PhotoDAL dalPhoto = new DAL.HP.PhotoDAL(); if (dalPhoto.OpenIDPhotoCount(strOpenID) > iPrintCount) { Response.Write("<script>alert('你已经提交过打印照片!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } else { //照片处理 strSFilePath = "~/User_Photo/" + model.FilePath; strFilePath = model.FilePath; string[] urls = strSFilePath.Split('.'); string _url = strOpenID + "." + urls.Last(); string inputurl = Server.MapPath("~/User_Photo/") + strFilePath; string outputurl = Server.MapPath("~/HP_Photo/") + _url; int width = 260; int height = 260; System.IO.FileStream fs = new System.IO.FileStream(inputurl, System.IO.FileMode.Open); //ZoomAuto(fs, outputurl,width, height, "", ""); CutForCustom(fs, outputurl, width, height, 100); fs.Close(); Model.HP.Photo modelPhoto = new Model.HP.Photo() { SiteCode = strSiteCode, OpenId = strOpenID, ClientID = strClientID, PrintCode = strPrintCode, Img = strOpenID + "." + model.FilePath.Split('.').Last(), AttachText = strThumbMsg }; dalPhoto.InsertInfo(modelPhoto); Response.Write("<script>alert('提交成功!')</script>"); Response.Write("<script>document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('closeWindow');});</script>"); } }