protected void Page_Load(object sender, EventArgs e) { string strProductID = string.Empty; string strSiteCode = string.Empty; if (null == Request.QueryString["id"]) { return; } strProductID = Common.Common.NoHtml(Request.QueryString["id"].ToString()); DAL.Album.PhotoWallDAL dal = new DAL.Album.PhotoWallDAL(); DataSet ds = dal.GetUserThumb(strProductID); 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; //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoWall/ThumbDetail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["title"] = "照片信息"; context.TempData["pDetail"] = model; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
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) { string strSiteID = string.Empty; string strSiteCode = string.Empty; string strTitle = string.Empty; string strTheme = string.Empty; string strOpenID = string.Empty; if (null == Request.QueryString["openid"]) { return; } if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25) { strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString()); } else { strOpenID = Request.QueryString["openid"].ToString(); } if (null == Request.QueryString["sitecode"]) { return; } strSiteCode = Common.Common.NoHtml(Request.QueryString["sitecode"].ToString()); //取站点相册列表 DAL.Album.UserPhotoDAL dalUserPhoto = new DAL.Album.UserPhotoDAL(); DataSet dsThumbList = dalUserPhoto.GetMyPhoto(strSiteCode, strOpenID); List <Model.Album.UserPhoto> lstThumb = new List <Model.Album.UserPhoto>(); foreach (DataRow row in dsThumbList.Tables[0].Rows) { Model.Album.UserPhoto model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(row); lstThumb.Add(model); } //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoWall/MyThumbList.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["title"] = "我的照片"; context.TempData["lstThumb"] = lstThumb; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
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>"); } }
protected void Page_Load(object sender, EventArgs e) { string strSiteID = string.Empty; string strSiteCode = string.Empty; string strTitle = string.Empty; string strTheme = string.Empty; string strAlbumTypeID = string.Empty; if (null == Request.QueryString["ID"]) { return; } strAlbumTypeID = Common.Common.NoHtml(Request.QueryString["ID"].ToString()); //取站点信息 DAL.SYS.AccountDAL dalAccount = new DAL.SYS.AccountDAL(); DAL.Album.UserPhotoDAL dalUserPhoto = new DAL.Album.UserPhotoDAL(); DataSet dsAccount = dalUserPhoto.GetAccountData(strAlbumTypeID); if (null != dsAccount && dsAccount.Tables.Count > 0 && dsAccount.Tables[0].Rows.Count > 0) { strTheme = dsAccount.Tables[0].Rows[0]["Themes"].ToString(); strTitle = dsAccount.Tables[0].Rows[0]["Name"].ToString(); strSiteCode = dsAccount.Tables[0].Rows[0]["SiteCode"].ToString(); strSiteID = dsAccount.Tables[0].Rows[0]["ID"].ToString(); Session["strSiteCode"] = dsAccount.Tables[0].Rows[0]["SiteCode"].ToString(); } //取站点相册列表 DataSet dsAlbumList = dalUserPhoto.GetUserPhoto(strAlbumTypeID); List <Model.Album.UserPhoto> liAlbumList = new List <Model.Album.UserPhoto>(); if (null != dsAlbumList && dsAlbumList.Tables.Count > 0 && dsAlbumList.Tables[0].Rows.Count > 0) { foreach (DataRow row in dsAlbumList.Tables[0].Rows) { Model.Album.UserPhoto model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(row); liAlbumList.Add(model); } } //读取模板内容 string text = string.Empty; if (!File.Exists(Server.MapPath("Themes/" + strTheme + "/UserPhoto.html"))) { text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoList/UserPhoto.html")); } else { text = System.IO.File.ReadAllText(Server.MapPath("Themes/" + strTheme + "/UserPhoto.html")); } JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = strTitle; context.TempData["siteid"] = strSiteID; context.TempData["footer"] = "奥琦微商易"; context.TempData["sitecode"] = strSiteCode; context.TempData["albumlist"] = liAlbumList; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { string strSiteID = string.Empty; string strSiteCode = string.Empty; string strTitle = string.Empty; string strTheme = string.Empty; string strOpenID = string.Empty; //订阅号 //if (null == Request.QueryString["openid"]) //{ // return; //} //if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25) //{ // strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString()); //} //else //{ // strOpenID = Request.QueryString["openid"].ToString(); //} //if (null == Request.QueryString["sitecode"]) //{ // return; //} //strSiteCode = Common.Common.NoHtml(Request.QueryString["sitecode"].ToString()); if (null == Request["state"] || Request["state"] == "") { return; } else { strSiteCode = Common.Common.NoHtml(Request.QueryString["state"].ToString()); Session["strSiteCode"] = strSiteCode; } string code = Request.QueryString["code"] as string; if (!string.IsNullOrEmpty(code)) { WXConfigDAL dal = new WXConfigDAL(); Model.WeiXin.WXConfig wxConfig = dal.GetWXConfigBySiteCode(strSiteCode); if (wxConfig != null) { WeiXinCore.Models.WeiXinConfig weixinConfig = new WeiXinCore.Models.WeiXinConfig() { ID = wxConfig.WXID, Name = wxConfig.WXName, Token = wxConfig.WXToken, AppId = wxConfig.WXAppID, AppSecret = wxConfig.WXAppSecret }; WeiXinCore.WeiXin weixin = new WeiXinCore.WeiXin(weixinConfig); Oauth2AccessToken oauth2AccessToken = weixin.GetOauth2AccessToken(code); if (oauth2AccessToken != null) { strOpenID = oauth2AccessToken.OpenID; } } } Session["OpenID"] = strOpenID; //取站点相册列表 DAL.Album.UserPhotoDAL dalUserPhoto = new DAL.Album.UserPhotoDAL(); DataSet dsThumbList = dalUserPhoto.GetMyPhoto(strSiteCode, strOpenID); List <Model.Album.UserPhoto> lstThumb = new List <Model.Album.UserPhoto>(); foreach (DataRow row in dsThumbList.Tables[0].Rows) { Model.Album.UserPhoto model = DataConvert.DataRowToModel <Model.Album.UserPhoto>(row); lstThumb.Add(model); } //读取模板内容 string text = System.IO.File.ReadAllText(Server.MapPath("Themes/PhotoWall/MyThumbList.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["sitecode"] = strSiteCode; context.TempData["title"] = "我的照片"; context.TempData["lstThumb"] = lstThumb; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }