protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] != null && Session["customerID"].ToString() != "") { if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; switch (action.Trim().ToLower()) { case "del": delProduct(); break; } } errorscript = ""; GetInfo(); } else { setCookies(); errorscript = JQDialog.alertOKMsgBox(2, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); GetInfo(); } } }
void GetHtmlPage() { string oid = string.Empty; MSOrderLogistics OLDetail = new MSOrderLogistics(); if (Request["oid"] != null && Request["oid"] != "") { oid = Common.Common.NoHtml(Request["oid"]); } if (oid != null && oid != "") { MSOrderLogisticsDAL OLdetail = new MSOrderLogisticsDAL(); DataSet ds = OLdetail.GetMSODetailByOID(oid); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { OLDetail = DataConvert.DataRowToModel <MSOrderLogistics>(ds.Tables[0].Rows[0]); } } else { errormsg = JQDialog.alertOKMsgBox(5, "无效的请求方式", "", "error"); } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/CopyOrder.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["errormsg"] = errormsg; context.TempData["oldetail"] = OLDetail; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["fid"] != null && Request["fid"] != "") { errorscript = ""; strfid = Common.Common.NoHtml(Request["fid"]); } else { errorscript = JQDialog.alertOkMsgBoxClearBody(2, "操作失败<br/>请核对后再操作!"); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { strUid = Common.Common.NoHtml(Session["customerID"].ToString()); if (Request["action"] != null && Request["action"] != "" && Request["action"].ToString().ToLower() == "edite") { editeCustomerinfo(); } } else { JQDialog.SetCookies("pageurl", "../../Comment/Customerinfo.aspx?fid=" + strfid, 2); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "../PalmShop/ShopCode/UserLogin.aspx", "error"); } getTemplate(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["like"] != null && Request["like"] != "") { AspNetPager1.CurrentPageIndex = 1; like = Common.Common.NoHtml(Request["like"]); like = " and a.ptitle like '%" + like + "%' "; if (Request["cid"] != null && Request["cid"] != "") { cid = " and a.CID='" + Request["cid"] + "' "; } string where = string.Empty; where = like + upid + cid; ViewState[vsKey] = where; errorscript = ""; LoadData(where); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>您暂时没有权限访问!", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["fid"] != null && Request["fid"] != "") { errorscript = ""; strfid = Common.Common.NoHtml(Request["fid"]); } else { errorscript = JQDialog.alertOkMsgBoxClearBody(2, "操作失败<br/>请核对后再操作!"); } if (Request["uid"] != null && Request["uid"] != "") { strUid = Common.Common.NoHtml(Request["uid"]); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(2, "操作失败<br/>请核对后再操作!", true); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { strMyUid = Session["customerID"].ToString(); } getTemplate(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["fid"] != null && Request["fid"] != "") { errorscript = ""; strfid = Common.Common.NoHtml(Request["fid"]); } else { errorscript = JQDialog.alertOkMsgBoxClearBody(2, "操作失败<br/>请核对后再操作!"); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { strUID = Session["customerID"].ToString(); } if (Request["action"] != null && Request["action"] != "" && Request["tid"] != null && Request["tid"] != "") { action = Request["action"]; if (strUID != null && strUID != "") { TopicLoveOrLike(); Response.End(); } else { JQDialog.SetCookies("pageurl", "../../Comment/Index.aspx?fid=" + strfid, 2); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "../PalmShop/ShopCode/UserLogin.aspx", "error"); } } GetTopicList(); } }
/// <summary> /// 图集上传 /// </summary> /// <returns></returns> private Boolean SaveImages() { HttpFileCollection files = HttpContext.Current.Request.Files; try { MSForumTopicAtlas atlasModel = new MSForumTopicAtlas(); atlasModel.TID = strTid; for (int iFile = 0; iFile < files.Count; iFile++) { //检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension, file_oldid, file_id; //取出精确到毫秒的时间做文件的名称 string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff") + iFile.ToString(); fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); file_id = my_file_id + fileExtension; if (fileName != "" && fileName != null && fileName.Length > 0) { fileExtension = System.IO.Path.GetExtension(fileName); string saveurl, modelimgurl; saveurl = modelimgurl = "ForumImg/"; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } int length = postedFile.ContentLength; if (length > 512000) { file_oldid = "old" + file_id; postedFile.SaveAs(saveurl + file_oldid); JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15); File.Delete(saveurl + file_oldid); } else { postedFile.SaveAs(saveurl + file_id); } atlasModel.ID = Guid.NewGuid().ToString("N").ToUpper(); atlasModel.ImgState = 0; atlasModel.ImgUrl = modelimgurl + file_id; atlasModel.ImgName = topictitle; MSForumTopicAtlasDAL atlasDal = new MSForumTopicAtlasDAL(); atlasDal.AddMSForumTopicAtlas(atlasModel); } } return(true); } catch (System.Exception Ex) { return(false); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errorscript = ""; if (Request["sid"] != null && Request["sid"].ToString() != "") { sid = Request["sid"].ToString(); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customerid = Session["customerID"].ToString(); if (Request["pid"] != null && Request["pid"].ToString() != "") { pid = Request["pid"].ToString(); } else { JQDialog.SetCookies("pageurl", "MyShop.aspx", 1); errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请登录后再操作!", true); } if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; } if (action.Trim() != null && action.Trim() != "") { switch (action.ToLower().Trim()) { case "getcateoption": GetOptionList(); break; case "edite": ProductEdite(); break; case "delimg": DelImg(); break; case "delpara": DelPara(); break; } } } else { JQDialog.SetCookies("pageurl", "MyShop.aspx", 1); errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } GetHtmlInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] != null && Session["customerID"].ToString() != "") { if (Request["pid"] != null && Request["pid"] != "") { pid = Common.Common.NoHtml(Request["pid"]); if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; } if (Request["ishand"] != null && Request["action"] != "") { try { ishand = Convert.ToInt32(Request["ishand"]); } catch (Exception) { } } if (action.Trim() != null && action.Trim() != "") { switch (action.ToLower().Trim()) { case "getcateoption": GetOptionList(); break; case "delimg": DelImg(); break; } } getinfo(); errorscript = ""; } else { JQDialog.SetCookies("pageurl", "PubSecHandEdit.aspx?ishand=" + ishand, 2); getinfo(); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); return; } } else { JQDialog.SetCookies("pageurl", "PubSecHandEdit.aspx?ishand=" + ishand, 2); getinfo(); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); return; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["mid"] != null && Request["mid"] != "") { mid = Common.Common.NoHtml(Request["mid"]); } if (Request["pid"] != null && Request["pid"] != "" && Request["num"] != null && Request["num"] != "") { errorscript = ""; strpid = Common.Common.NoHtml(Request["pid"]); quantity = Common.Common.NoHtml(Request["num"]); if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customid = Session["customerID"].ToString(); GetOpenId(); if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; action = action.ToLower().Trim(); switch (action) { case "setorder": setAddOrder(); return; case "setda": setUserAddress(); return; case "updalist": setUserAddress(); return; case "getdalist": GetUserAddress(); return; } } } else { setCookies(); errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>您暂时没有权限访问!", true); } GetInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errormsg = ""; if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customerid = Session["customerID"].ToString(); } if (Request["sid"] != null && Request["sid"] != "") { shopid = Common.Common.NoHtml(Request["sid"]); } else { if (Session["SID"] != null && Session["SID"].ToString() != "") { shopid = Session["SID"].ToString(); } else { GetShopID(); if (shopid == null || shopid == "") { JQDialog.SetCookies("pageurl", "MyShop.aspx", 1); errormsg = JQDialog.alertOKMsgBox(5, "您还没开通微店,请开通后再操作", "ApplyShop.aspx?action=apply", "error"); } } } if (Request["pid"] != null && Request["pid"] != "") { pid = Common.Common.NoHtml(Request["pid"]); } if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; switch (action.ToLower().Trim()) { case "delproduct": DelProduct(); break; } } GetInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] == null || Session["customerID"].ToString() == "") { JQDialog.SetCookies("pageurl", "Vcoin.aspx", 2); errormsg = JQDialog.alertOKMsgBox(5, "您还没有登<br/>请登录后再操作!", "UserLogin.aspx", "error"); } else { struid = Session["customerID"].ToString(); } GetHtmlPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errorscript = ""; if (Session["customerID"] != null && Session["customerID"].ToString() != "") { cuid = Session["customerID"].ToString(); } else { JQDialog.SetCookies("pageurl", "SaleManager.aspx", 2); errorscript = JQDialog.alertOKMsgBox(2, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } GetHtmlPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errowmsg = ""; try { if (Session["OpenID"] == null || Session["OpenID"].ToString() == "") { GetUserOpenID(); } else { strOpenID = Session["OpenID"].ToString(); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { uid = Common.Common.NoHtml(Session["customerID"].ToString()); if (Session["SID"] == null || Session["SID"].ToString() == "") { GetShopID(); if (sid != null && sid != "") { JQDialog.SetCookies("pageurl", "ShopIndex.aspx", 5); errowmsg = JQDialog.alertOKMsgBox(5, "您还没开通微店,请开通后再操作", "ApplyShop.aspx?action=reg", "error"); } } } else { JQDialog.SetCookies("pageurl", "ShopIndex.aspx", 2); errowmsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } } catch (Exception ex) { errowmsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } getHtmlpage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errorscript = ""; if (Session["SID"] != null && Session["SID"].ToString() != "") { sid = Session["SID"].ToString(); } else { JQDialog.SetCookies("pageurl", "MyShop.aspx", 5); errorscript = JQDialog.alertOKMsgBox(5, "您还没开通微店,请开通后再操作?", "ApplyShop.aspx?action=reg", "error"); } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customerid = Session["customerID"].ToString(); if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; } if (action.Trim() != null && action.Trim() != "") { switch (action.ToLower().Trim()) { case "getcateoption": GetOptionList(); break; case "publish": PublicProduct(); break; } } } else { JQDialog.SetCookies("pageurl", "MyShop.aspx", 1); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } GetHtmlInfo(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request["oid"] != null && Request["oid"] != "") { oid = Common.Common.NoHtml(Request["oid"]); } else { errormsg = JQDialog.alertOKMsgBox(5, "无效的请求方式", "CustomerOrder.aspx", "error"); } if (oid != null && oid != "") { try { if (Session["customerID"] != null || Session["customerID"].ToString() != "") { struid = Session["customerID"].ToString(); } } catch (Exception) { } } if (Request["action"] != null && Request["action"] != "") { action = Common.Common.NoHtml(Request["action"]); } if (action != null && action != "") { action = action.Trim().ToLower(); switch (action) { case "edite": EditeOrder(); break; } } GetHtmlPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customid = Session["customerID"].ToString(); } if (Request["pid"] != null && Request["pid"] != "") { strpid = Common.Common.NoHtml(Request["pid"]); errorscript = ""; if (Request["action"] != null && Request["action"] != "") { action = Common.Common.NoHtml(Request["action"]); if (action.ToLower().Trim() == "setcart") { if (customid != null && customid.ToString() != "") { setAddCart(); } else { setCookies(); Response.Write("{\"error\":true,\"msg\":\"操作失败," + "请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}"); } Response.End(); } } else { GetProductDetail(); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(2, "操作失败<br/>您暂时没有权限访问该页面!", true); GetProductDetail(); return; } } }
void GetHtmlPage() { MSProductOrderDAL orderDal = new MSProductOrderDAL(); MyOrderList myorderlistModel = new MyOrderList(); string strWhere = string.Empty; string payway = string.Empty; if (struid != null && struid != "") { struid = " and a.CustomerID='" + struid + "' "; } strWhere = struid + " and a.ID='" + oid + "' "; DataSet orderds = orderDal.GetCustomerOrderList(strWhere); if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { myorderlistModel = DataConvert.DataRowToModel <MyOrderList>(orderds.Tables[0].Rows[0]); payway = myorderlistModel.PayWay; string[] way = payway.Split('|'); try { payway = way[1].ToString(); } catch (Exception) { } } else { errormsg = JQDialog.alertOKMsgBox(5, "无效的请求方式", "CustomerOrder.aspx", "error"); } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/OrderDetail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["errormsg"] = errormsg; context.TempData["uid"] = struid; context.TempData["payway"] = payway; context.TempData["orderdetail"] = myorderlistModel; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] != null && Session["customerID"].ToString() != "") { errorscript = ""; customerid = Session["customerID"].ToString(); GetOrderHandleList(); } else { setCookies(); errorscript = JQDialog.alertOKMsgBox(2, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); GetOrderHandleList(); return; } } }
void repcomment() { string commentdesc = string.Empty; StreamReader rd = new StreamReader(Server.MapPath("emotion/key.txt")); string keyword = rd.ReadLine(); try { commentdesc = HttpContext.Current.Request.Form.Get("commentdesc").ToString(); } catch (Exception) { commentdesc = ""; } if (commentdesc.Trim() != null && commentdesc.Trim() != "") { commentdesc = JQDialog.FilterKeyWord(commentdesc, keyword); commentdesc = JQDialog.GetTextFromHTML(commentdesc); MSForumComment commentModel = new MSForumComment(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); commentModel.ID = Guid.NewGuid().ToString("N").ToUpper(); commentModel.Ctext = commentdesc; commentModel.Review = 1; commentModel.TID = strTid; commentModel.UID = strUid; commentModel.UpID = strupid; commentModel.Cstate = 0; if (commentDal.AddComment(commentModel)) { errorscript = JQDialog.alertOKMsgBox(3, "回复成功", "MyCommentList.aspx?fid=" + strfid, "error"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请重新再操作!", true); } }
void pubcomment() { string commentdesc = string.Empty; try { commentdesc = HttpContext.Current.Request.Form.Get("commentdesc").ToString(); } catch (Exception) { commentdesc = ""; } if (commentdesc.Trim() != null && commentdesc.Trim() != "") { MSForumComment commentModel = new MSForumComment(); MSForumCommentDAL commentDal = new MSForumCommentDAL(); strcommid = Guid.NewGuid().ToString("N").ToUpper(); commentModel.ID = strcommid; commentModel.Ctext = commentdesc; commentModel.Review = 1; commentModel.TID = strTid; commentModel.UID = strUid; commentModel.UpID = ""; commentModel.Cstate = 0; SaveImages(); if (commentDal.AddComment(commentModel)) { errorscript = JQDialog.alertOKMsgBox(3, "评论成功", "CommentList.aspx?fid=" + strfid + "&tid=" + strTid, "succeed"); } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请核对后再操作!", true); } } else { errorscript = JQDialog.alertOKMsgBoxGoBack(3, "操作失败<br/>请重新再操作!", true); } }
string UploadImg(string strImgName) { HttpFileCollection files = Request.Files; string fileName, fileExtension, file_oldid; string file_id = string.Empty; if (strImgName != null && strImgName != "") { //检查文件扩展名字 HttpPostedFile postedFile = files[strImgName]; //取出精确到毫秒的时间做文件的名称 string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff"); fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); file_id = my_file_id + fileExtension; if (fileName != "" && fileName != null && fileName.Length > 0) { fileExtension = System.IO.Path.GetExtension(fileName); string saveurl; saveurl = "ShopLogo/"; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } int length = postedFile.ContentLength; if (length > 512000) { file_oldid = "old" + file_id; postedFile.SaveAs(saveurl + file_oldid); JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15); File.Delete(saveurl + file_oldid); } else { postedFile.SaveAs(saveurl + file_id); } } } return(file_id); }
public void ProcessRequest(HttpContext context) { string CookiesName = string.Empty; string RequestUrl = string.Empty; int time = 0; HttpRequest Request = context.Request; HttpResponse Response = context.Response; if (Request["cname"] != null && Request["cname"] != "") { CookiesName = Request["cname"]; } else { CookiesName = "pageurl"; } if (Request["curl"] != null && Request["curl"] != "") { RequestUrl = Request["curl"]; } if (Request["time"] != null && Request["time"] != "") { try { time = Convert.ToInt32(Request["time"]); } catch (Exception) { time = 2; } } else { time = 2; } JQDialog.SetCookies(CookiesName, RequestUrl, time); Response.Write("{\"succeed\":true,\"logurl\":\"../PalmShop/ShopCode/UserLogin.aspx\"}"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errormsg = ""; if (Session["customerID"] != null && Session["customerID"].ToString() != "") { customerid = Session["customerID"].ToString(); GetOpenId(); } else { JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2); errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } if (Request["action"] != null && Request["action"] != "") { action = Request["action"]; action = action.ToLower().Trim(); switch (action) { case "receive": ReceiveOrder(); break; case "pubol": //submitOrder(); break; case "delorder": DelOrder(); break; } } GetHtmlPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Session["customerID"] != null && Session["customerID"].ToString() != "") { strUid = Common.Common.NoHtml(Session["customerID"].ToString()); } else { JQDialog.SetCookies("pageurl", "ShopIndex.aspx", 2); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } if (Request["sid"] != null && Request["sid"] != "") { strSID = Common.Common.NoHtml(Request["sid"]); } else { if (Session["SID"] != null && Session["SID"].ToString() != "") { strSID = Common.Common.NoHtml(Session["SID"].ToString()); } } if (Request["action"] != null && Request["action"] != "") { action = Common.Common.NoHtml(Request["action"]); action = action.Trim().ToLower(); } if (action == "uapply" || action == "uedite") { RegOrUpdateShop(); } GetHtmlPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { errorscript = ""; string pageurl = string.Empty; if (Request["sid"] != null && Request["sid"] != "") { shopid = Common.Common.NoHtml(Request["sid"]); pageurl = "?sid=" + shopid; } else { if (Session["SID"] != null && Session["SID"].ToString() != "") { shopid = Session["SID"].ToString(); pageurl = "?sid=" + shopid; } else { JQDialog.SetCookies("pageurl", "CustomerManager.aspx" + pageurl, 1); errorscript = JQDialog.alertOKMsgBox(3, "操作失败,请登录后再操作", "UserLogin.aspx", "error"); } } if (Session["customerID"] != null && Session["customerID"].ToString() != "") { cuid = Session["customerID"].ToString(); } else { JQDialog.SetCookies("pageurl", "CustomerManager.aspx" + pageurl, 2); errorscript = JQDialog.alertOKMsgBox(2, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); } GetHtmlPage(); } }
/// <summary> /// 图集上传 /// </summary> /// <returns></returns> bool SaveImages() { bool result = false; if (customerid != null && customerid != "") { MSCustomersDAL customer = new MSCustomersDAL(); phone = customer.GetCustomerValueByID("Phone", customerid).ToString() + "/"; } HttpFileCollection files = HttpContext.Current.Request.Files; try { MSProductAtlas atlasModel = new MSProductAtlas(); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); atlasModel.PID = pid; for (int iFile = 0; iFile < files.Count; iFile++) { //检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension, file_oldid, file_id; //取出精确到毫秒的时间做文件的名称 string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff") + iFile.ToString(); fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); file_id = my_file_id + fileExtension; if (fileName != "" && fileName != null) { fileExtension = System.IO.Path.GetExtension(fileName); string saveurl, modelimgurl; saveurl = modelimgurl = "Atlas/" + phone; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } int length = postedFile.ContentLength; if (length > 512000) { file_oldid = "old" + file_id; postedFile.SaveAs(saveurl + file_oldid); JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15); File.Delete(saveurl + file_oldid); } else { postedFile.SaveAs(saveurl + file_id); } atlasModel.ID = Guid.NewGuid().ToString("N").ToUpper(); if (iFile == 0) { if (!atlasDal.IsExitDefaultImg(pid)) { atlasModel.IsDefault = 1; } } atlasModel.ImgState = 0; atlasModel.PimgUrl = modelimgurl + file_id; atlasModel.AtlasName = ""; if (atlasDal.AddMSProductAtlas(atlasModel)) { result = true; } } } } catch (System.Exception Ex) { result = false; } return(result); }
/// <summary> /// 产品发布 /// </summary> void PublicProduct() { string cid = string.Empty; string ptitle = string.Empty; string pcontent = string.Empty; string price = string.Empty; string zipcode = string.Empty; string isnull = ""; #region --------------获取值-------------------- try { cid = HttpContext.Current.Request.Form.Get("setoptionvalue").ToString(); } catch (Exception) { cid = isnull; } try { ptitle = HttpContext.Current.Request.Form.Get("ptitle").ToString(); } catch (Exception) { ptitle = isnull; } try { pcontent = HttpContext.Current.Request.Form.Get("pdesc").ToString(); } catch (Exception) { pcontent = isnull; } try { price = HttpContext.Current.Request.Form.Get("price").ToString(); } catch (Exception) { price = isnull; } try { price = HttpContext.Current.Request.Form.Get("price").ToString(); } catch (Exception) { price = isnull; } try { zipcode = HttpContext.Current.Request.Form.Get("zipcode").ToString(); } catch (Exception) { zipcode = isnull; } #endregion Random random = new Random(); int r1 = (int)(random.Next(0, 9)); int r2 = (int)(random.Next(0, 9)); string now = DateTime.Now.ToString("yyMMddhhmmssf"); String paymentID = r1.ToString() + r2.ToString() + now; pid = "R" + paymentID; if (ptitle != null && ptitle != "") { MSProduct ProductModel = new MSProduct(); MSProductDAL ProductDal = new MSProductDAL(); ProductModel.ID = pid; ProductModel.Cid = cid; ProductModel.Ptitle = ptitle; ProductModel.Pcontent = pcontent; if (price != null && price != "") { ProductModel.Price = decimal.Parse(price); } ProductModel.CustomerID = customerid; ProductModel.SiteCode = ""; ProductModel.SID = sid; ProductModel.IsSecHand = 0; ProductModel.Pstate = 0; ProductModel.Review = 1; ProductModel.ZipCode = (zipcode == "" || zipcode == null ? "包邮" : zipcode); if (SaveImages() && AddProductModel() && ProductDal.AddMSProduct(ProductModel)) { errorscript = JQDialog.alertOKMsgBox(3, "操作成功!", "MyShop.aspx", "succeed"); } else { errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error"); } } }
protected void uploadbtn_Click(object sender, EventArgs e) { #region 信息判断 if (Session["customerID"] == null || Session["customerID"].ToString() == "") { JQDialog.SetCookies("pageurl", "PubSecHand.aspx?ishand=" + ishand, 2); errorscript = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!", "UserLogin.aspx", "error"); return; } MSProduct productModel = new MSProduct(); if (setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "") { productModel.Cid = setpvalue.Value; } if (pdesc.Value.Trim() != null && pdesc.Value.Trim() != "") { productModel.Pcontent = pdesc.Value; } if (price.Value.Trim() != null && price.Value.Trim() != "") { productModel.Price = Convert.ToDecimal(price.Value); } if (ptitle.Value.Trim() != null && ptitle.Value.Trim() != "") { productModel.Ptitle = ptitle.Value; } if (price.Value.Trim() != null && price.Value.Trim() != "") { productModel.Price = Convert.ToDecimal(price.Value); } #endregion Random random = new Random(); int r1 = (int)(random.Next(0, 9)); //产生2个0-9的随机数 int r2 = (int)(random.Next(0, 9)); string now = DateTime.Now.ToString("yyMMddhhmmssf"); //一个13位的时间戳 String paymentID = r1.ToString() + r2.ToString() + now; pid = "R" + paymentID; productModel.ID = pid; productModel.IsSecHand = ishand; productModel.Pstate = 0; productModel.Review = 1; productModel.CustomerID = Session["customerID"].ToString(); MSProductDAL productDal = new MSProductDAL(); MSShopContacts contactModel = new MSShopContacts(); MSShopContactsDAL contactDal = new MSShopContactsDAL(); contactModel.ID = Guid.NewGuid().ToString("N").ToUpper(); contactModel.PID = pid; contactModel.IsDel = 0; contactModel.SID = ""; contactModel.NickName = UserName.Value; contactModel.Phone = UserPhone.Value; string pageurl = "NewProduct.aspx?ishand=" + ishand; if (productDal.AddMSProduct(productModel) && SaveImages() && contactDal.AddMSSContacts(contactModel)) { if (ishand == 1) { pageurl = "MySecHand.aspx"; } errorscript = JQDialog.alertOKMsgBox(5, "操作成功!", pageurl, "succeed"); } else { errorscript = JQDialog.alertOKMsgBox(3, "操作失败<br/>请核对后再操作!", "", "error"); return; } }
/// <summary> /// 订单提交 /// </summary> void submitOrder() { string ordernum = string.Empty; int imgcount = 0; string img1 = string.Empty; string img2 = string.Empty; string openid = string.Empty; string userid = string.Empty; if (Session["OpenID"] != null && Session["OpenID"].ToString() != "") { openid = Session["OpenID"].ToString(); } if (openid != null && openid != "") { MSCustomersDAL customerDal = new MSCustomersDAL(); try { userid = customerDal.GetCustomerValueByOpenID("ID", openid).ToString(); } catch (Exception) { } } #region -------------获取请求值------------ try { ordernum = Request.Form.Get("ordernum").ToString(); } catch (Exception) { ordernum = ""; } #endregion try { imgcount = Request.Files.Count; } catch (Exception) { } if (imgcount == 2) { img1 = UploadImg(0, "printimg", ordernum); img2 = UploadImg(1, "shareimg", ordernum); if (userid == null || userid == "" && ordernum != null && ordernum != "") { MSProductOrderDAL orderDal = new MSProductOrderDAL(); userid = orderDal.GetOrderValueByID("CustomerID", ordernum).ToString(); } if (ordernum != null && ordernum != "") { MSPhotoSubmit photoModel = new MSPhotoSubmit(); MSPhotoSubmitDAL photoDal = new MSPhotoSubmitDAL(); photoModel.OrderNum = ordernum; photoModel.Img1 = img1; photoModel.Img2 = img2; photoModel.UID = userid; photoModel.ID = Guid.NewGuid().ToString("N").ToUpper(); if (!photoDal.AddPhotoSubmit(photoModel)) { errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false); } else { errormsg = JQDialog.alertOKMsgBox(3, "操作成功,请等待审核!", "PrintImgOrder.aspx", "succeed"); } } else { errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请输入正确的订单!", false); } } else { errormsg = JQDialog.alertOKMsgBoxGoBack(3, "请选择您要打印的照片和分享的照片!", false); } }