Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Action == "edit")
            {
                int categoryid            = HYRequest.GetQueryInt("categoryid", 0);
                ProductCategoryModel cate = ProductCategoryFactory.Get(categoryid);
                cate.categoryname = this.txtcategoryname.Text.Trim();
                cate.orderid      = Int32.Parse(this.txtorderid.Text.Trim());
                cate.parentid     = Int32.Parse(this.ddlParentCategory.SelectedValue);

                ProductCategoryFactory.Update(cate);

                ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('修改分类成功!');window.location='productcategorylist.aspx';</script>");
            }
            else if (this.Action == "add")
            {
                ProductCategoryModel cate = new ProductCategoryModel();
                cate.categoryname = this.txtcategoryname.Text.Trim();
                cate.orderid      = Int32.Parse(this.txtorderid.Text.Trim());
                cate.parentid     = Int32.Parse(this.ddlParentCategory.SelectedValue);

                ProductCategoryFactory.Add(cate);

                ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('添加分类成功!');window.location='productcategorylist.aspx';</script>");
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string action = HYRequest.GetQueryString("action");
                if (action == "cancelorder") //取消订单
                {
                    int orderid = HYRequest.GetQueryInt("orderid", 0);
                    OrderFactory.UpdateStatus(99, orderid);
                    Response.Redirect("user_order.aspx");
                }

                int s          = HYRequest.GetQueryInt("s", 0);
                int pageindex  = HYRequest.GetQueryInt("p", 1);
                int pagesize   = 5;
                int totalcount = 0;
                if (s == 0)
                {
                    OrderList = OrderFactory.GetOrderList(pagesize, pageindex, " where uid=" + this.LoginUser.uid + " and orderstatus>1 ", " order by orderid desc ", out totalcount);
                }
                else if (s == 1) //已下单未付款
                {
                    OrderList = OrderFactory.GetOrderList(pagesize, pageindex, " where uid=" + this.LoginUser.uid + " and (orderstatus=2 or orderstatus=3) ", " order by orderid desc ", out totalcount);
                }
                else if (s == 2) //已付款
                {
                    OrderList = OrderFactory.GetOrderList(pagesize, pageindex, " where uid=" + this.LoginUser.uid + " and orderstatus=5 ", " order by orderid desc ", out totalcount);
                }
            }
        }
Exemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Action == "add")
            {
                LinkModel info = new LinkModel();
                info.possymbol  = possymbol;
                info.includepic = this.txtincludepic.Text.Trim();
                info.linkurl    = this.txtlinkurl.Text.Trim();
                info.orderno    = Int32.Parse(this.txtorderno.Text.Trim());
                info.linkname   = this.txttitle.Text.Trim();
                info.createtime = DateTime.Now;

                LinkFactory.Add(info);

                ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('添加成功!');window.location='linklist.aspx?pb=" + possymbol + "';</script>");
            }
            else if (this.Action == "edit")
            {
                int       linkid = HYRequest.GetInt("linkid", 0);
                LinkModel info   = LinkFactory.Get(linkid);

                info.includepic = this.txtincludepic.Text.Trim();
                info.linkurl    = this.txtlinkurl.Text.Trim();
                info.orderno    = Int32.Parse(this.txtorderno.Text.Trim());
                info.linkname   = this.txttitle.Text.Trim();

                LinkFactory.Update(info);
                ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('修改成功!');window.location='linklist.aspx?pb=" + possymbol + "';</script>");
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    totalcount = 0;
                int    pagesize   = 10;
                int    pageindex  = HYRequest.GetQueryInt("p", 1);
                string kw         = Utils.SafeCheckSearchKw(HYRequest.GetQueryString("kw"));
                this.SearchKw = kw;
                string whereSql = string.Empty;

                //List<ProductModel> list;
                if (!string.IsNullOrEmpty(kw))
                {
                    whereSql       = string.Format(" where productname like '%{0}%' ", kw);
                    searchProducts = ProductFactory.GetList(pagesize, pageindex, whereSql, " order by productid desc ", out totalcount);
                }
                else
                {
                    searchProducts = ProductFactory.GetList(10, string.Empty);
                }

                PagerHtml = Utils.BuildProductListPager(totalcount, pagesize, pageindex, "search.aspx?p={0}&kw=" + kw);
            }
        }
Exemplo n.º 5
0
        private void UpLoadFile(HttpContext context)
        {
            //Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();
            string         _delfile     = HYRequest.GetString("DelFilePath");
            HttpPostedFile _upfile      = context.Request.Files["Filedata"];
            bool           _iswater     = false; //默认不打水印
            bool           _isthumbnail = false; //默认不生成缩略图

            if (HYRequest.GetQueryString("IsWater") == "1")
            {
                _iswater = true;
            }
            if (HYRequest.GetQueryString("IsThumbnail") == "1")
            {
                _isthumbnail = true;
            }
            if (_upfile == null)
            {
                context.Response.Write("{\"status\": 0, \"msg\": \"请选择要上传文件!\"}");
                return;
            }
            UpLoad upFiles = new UpLoad();
            string msg     = upFiles.fileSaveAs(_upfile, _isthumbnail, _iswater);

            //删除已存在的旧文件,旧文件不为空且应是上传文件,防止跨目录删除
            if (!string.IsNullOrEmpty(_delfile) && _delfile.IndexOf("../") == -1 &&
                _delfile.ToLower().StartsWith(SiteConfig.Instance().FileUpLoadPath.ToLower()))
            {
                Utils.DeleteUpFile(_delfile);
            }
            //返回成功信息
            context.Response.Write(msg);
            context.Response.End();
        }
Exemplo n.º 6
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.FileUpload1.FileContent.Length > 0)
            {
                //文件存放规则:attachments + 年月 + 文件名+ 后缀
                string fileext  = Path.GetExtension(this.FileUpload1.FileName).ToLower();
                string filename = Utils.GetRandomFilename(this.FileUpload1.FileName);

                string year  = DateTime.Now.Year.ToString();
                string month = DateTime.Now.Month.ToString();

                string rootPath = Path.Combine("/attachments", year.ToString() + month.ToString());
                rootPath = Server.MapPath(rootPath);

                if (!Directory.Exists(rootPath))
                {
                    Directory.CreateDirectory(rootPath);
                }

                //保存文件的路径
                string savePath = Path.Combine(rootPath, filename);

                this.FileUpload1.SaveAs(savePath);

                //需返回到父页面的路径
                string returnPath = string.Format("/{0}/{1}{2}/{3}", "attachments", year, month, filename); //string.Format("{0}{1}/{2}", year, month, filename);
                string parentobj  = HYRequest.GetString("parentobj");
                ClientScript.RegisterStartupScript(this.GetType(), "UpfileTips", "<script language=\"javascript\">window.parent.opener.document.getElementById(\"" + parentobj + "\").value=\"" + returnPath + "\";window.close();</script>");
            }
        }
Exemplo n.º 7
0
 public WebPageBase()
 {
     //用户未登陆,则跳转到
     if (LoginUser == null)
     {
         string url   = HYRequest.GetUrl();
         string reurl = SiteConfig.Instance().SiteDomain + "login.aspx?reurl=" + url;
         HttpContext.Current.Response.Redirect("https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + SiteConfig.Instance().WxAppId + "&redirect_uri=" + reurl + "&response_type=code&scope=snsapi_userinfo&state=1#wechat_redirect");
     }
 }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                UserModel userInfo = this.LoginUser;
                string    orderno  = HYRequest.GetQueryString("orderno");

                CartOrder = OrderFactory.Get(orderno);

                //需要判断是否选中所有产品,如不是,则新增加一个订单作为购物车,保留未选中的产品;
                if (CartOrder != null && CartOrder.orderstatus == 1) //购物车订单
                {
                    if (!CartOrder.selectallproduct)
                    {
                        OrderModel om = new OrderModel();
                        om.orderstatus  = 1;                 //购物车
                        om.address      = userInfo.address;  //CartOrder.address;
                        om.createtime   = CartOrder.createtime;
                        om.customername = userInfo.fullname; //CartOrder.customername;
                        om.tel          = userInfo.tel;
                        om.uid          = CartOrder.uid;
                        om.orderno      = Utils.GenerateOutTradeNo(CartOrder.uid);

                        foreach (OrderProduct op in CartOrder.productlist)
                        {
                            if (!op.isselected)
                            {
                                om.productlist.Add(op);
                            }
                        }

                        foreach (OrderProduct op in om.productlist)
                        {
                            CartOrder.productlist.Remove(op);
                        }

                        CartOrder.orderstatus = 2; //更新为已下单
                        CartOrder.createtime  = DateTime.Now;
                        OrderFactory.Update(CartOrder);

                        OrderFactory.Add(om);
                    }
                }

                //if (CartOrder != null && CartOrder.orderstatus == 1) //购物车订单
                //    OrderFactory.UpdateStatus(2, CartOrder.orderid);//更新为已下单

                this.txtaddress.Value      = userInfo.address; //CartOrder.address;
                this.txtcustomername.Value = userInfo.fullname;
                this.txttel.Value          = userInfo.tel;
                this.txtordermessage.Value = CartOrder.ordermessage;

                //this.ltlPostAge.Text = vsconfig.PostAge.ToString();
            }
        }
Exemplo n.º 9
0
        }                                        //H5调起JS API参数
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //string openid = Request.QueryString["openid"];
                string     orderno   = HYRequest.GetQueryString("orderno");
                OrderModel orderinfo = OrderFactory.Get(orderno);

                int total_fee = HYRequest.GetQueryInt("total_fee", 0); //单位为分

                //若传递了相关参数,则调统一下单接口,获得后续相关接口的入口参数
                JsApiPay jsApiPay = new JsApiPay(this);

                if (orderinfo != null && orderinfo.productlist.Count > 0)
                {
                    jsApiPay.body_desc = orderinfo.productlist[0].productinfo.productname + "等";
                }
                else
                {
                    jsApiPay.body_desc = shopconfig.ShopName + "购物";
                }

                //单独测试,先微信登陆一下,整合后,有openid了,就无需重复获取授权了。
                //jsApiPay.GetOpenidAndAccessToken();
                jsApiPay.openid = this.LoginUser.openid;

                jsApiPay.total_fee    = total_fee;
                jsApiPay.out_trade_no = orderno; //WxPayApi.GenerateOutTradeNo(321);  //此处订单号,整合到系统后,从订单产生开始就确立,无需在支付页面生成

                //JSAPI支付预处理
                try
                {
                    WxPayData unifiedOrderResult = jsApiPay.GetUnifiedOrderResult();
                    wxJsApiParam = jsApiPay.GetJsApiParameters();//获取H5调起JS API参数
                    //在页面上显示订单信息
                    //Response.Write("<span style='color:#00CD00;font-size:20px'>订单详情:</span><br/>");
                    //Response.Write("<span style='color:#00CD00;font-size:20px'>" + unifiedOrderResult.ToPrintStr() + "</span>");
                    //Response.Write(string.Format("<span style='color:#00CD00;font-size:20px'>订单号:{0}</span><br/>", orderinfo.orderno));
                    //Response.Write(string.Format("<span style='color:#00CD00;font-size:20px'>支付额:{0}</span><br/>", orderinfo.totalyfprice));

                    System.Text.StringBuilder sbtips = new System.Text.StringBuilder();
                    sbtips.Append("<span style='color:#00CD00;font-size:20px'>订单详情:</span><br/>");
                    sbtips.Append(string.Format("<span style='color:#00CD00;font-size:16px'>订单编号:{0}</span><br/>", orderinfo.orderno));
                    sbtips.Append(string.Format("<span style='color:#00CD00;font-size:16px'>支付总额:{0}</span><br/>", orderinfo.totalyfprice));

                    this.ltlTips.Text = sbtips.ToString();
                }
                catch
                {
                    this.ltlTips.Text = "<span style='color:#FF0000;font-size:20px'>" + "下单失败,请返回重试" + "</span>";
                }
            }
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int id = HYRequest.GetQueryInt("id", 0);
                if (id == 0)
                {
                    Response.Redirect("index.aspx");
                }

                this.productinfo = ProductFactory.Get(id);
            }
        }
Exemplo n.º 11
0
        private void LoadData()
        {
            if (this.Action == "edit")
            {
                int       linkid = HYRequest.GetInt("linkid", 0);
                LinkModel info   = LinkFactory.Get(linkid);

                this.txtincludepic.Text = info.includepic;
                this.txtlinkurl.Text    = info.linkurl;
                this.txtorderno.Text    = info.orderno.ToString();
                this.txttitle.Text      = info.linkname;
            }
        }
Exemplo n.º 12
0
        public void ProcessRequest(HttpContext context)
        {
            Security.CheckAdministerAndCloseReq();

            //取得处事类型
            string action = HYRequest.GetQueryString("action");

            switch (action)
            {
            default:     //普通上传
                UpLoadFile(context);
                break;
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Security.CheckAdministerAndRedirect();
            if (!Page.IsPostBack)
            {
                if (this.Action == "edit")
                {
                    int        adminid = HYRequest.GetQueryInt("adminid", 0);
                    AdminModel info    = AdminFactory.Get(adminid);

                    this.txtusername.Text    = info.username;
                    this.txtusername.Enabled = false;
                }
            }
        }
Exemplo n.º 14
0
        private void LoadCateData()
        {
            if (this.Action == "edit")
            {
                int categoryid            = HYRequest.GetQueryInt("categoryid", 0);
                ProductCategoryModel cate = ProductCategoryFactory.Get(categoryid);
                if (cate != null)
                {
                    this.txtcategoryname.Text = cate.categoryname;
                    this.txtorderid.Text      = cate.orderid.ToString();

                    this.ddlParentCategory.Items.FindByValue(cate.parentid.ToString()).Selected = true;
                }
            }
        }
Exemplo n.º 15
0
        private void LoadListData()
        {
            string searchkw = this.txtSearchKeyword.Text.Trim();

            string searchstatus = HYRequest.GetQueryInt("status", 5).ToString();

            string whereSql = " where orderstatus=" + searchstatus;

            if (searchkw != string.Empty)
            {
                whereSql += string.Format(" and (customername like '%{0}%' or tel like '%{0}%' or address like '%{0}%')", searchkw);
            }

            this.dgOrderList.DataSource = OrderFactory.GetOrderList(whereSql); //OrderFactory.GetList(whereSql);
            this.dgOrderList.DataBind();
        }
Exemplo n.º 16
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            decimal amount      = HYRequest.GetDecimalByParams("amount");
            int     totalAmount = Convert.ToInt32(amount * 100);

            if (totalAmount <= 0)
            {
                var data = new { code = "1", message = "金额不能小于等于0" };
                context.Response.Write(JsonConvert.SerializeObject(data));
            }
            else
            {
                string returnRes = prePayCanada(totalAmount.ToString());
                context.Response.Write(returnRes);
            }
        }
Exemplo n.º 17
0
        private void LoadProductInfo()
        {
            if (this.Action == "edit")
            {
                int          productid = HYRequest.GetQueryInt("productid", 0);
                ProductModel info      = ProductFactory.Get(productid);

                this.txtincludepicpath.Text = info.includepicpath;
                this.txtprice.Text          = info.price.ToString();
                this.txtitemprice.Text      = info.itemprice;
                this.txtproductname.Text    = info.productname;
                this.txtsalecount.Text      = info.salecount.ToString();
                this.txtproductcount.Text   = info.productcount.ToString();
                //this.txtspecification.Text = info.specification;
                this.chkiscommend.Checked = info.iscommend == 1 ? true : false;

                this.editorcontent.Value = info.specification;

                try
                {
                    this.rblproductcode.Items.FindByValue(info.productcode.ToString()).Selected    = true;
                    this.ddlProductCategory.Items.FindByValue(info.categoryid.ToString()).Selected = true;
                }
                catch { }

                if (info.productpics.Length > 5)
                {
                    string[]  picarr = info.productpics.Split(new string[] { "|" }, StringSplitOptions.RemoveEmptyEntries);
                    DataTable dt     = new DataTable();
                    dt.Columns.Add("picsrc", typeof(System.String));

                    foreach (string pic in picarr)
                    {
                        DataRow dr = dt.NewRow();
                        dr["picsrc"] = pic;

                        dt.Rows.Add(dr);
                    }

                    this.rptAlbumList.DataSource = dt;
                    this.rptAlbumList.DataBind();
                }
            }
        }
Exemplo n.º 18
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Action == "edit")
            {
                int       uid = HYRequest.GetQueryInt("uid", 0);
                UserModel u   = UserFactory.Get(uid);

                u.nickname = this.txtnickname.Text;
                u.fullname = this.txtfullname.Text;
                u.sex      = this.txtsex.Text;
                u.tel      = this.txttel.Text;
                u.address  = this.txtaddress.Text;
                u.jfnum    = Int32.Parse(this.txtjfnum.Text.Trim());
                u.usertype = Int32.Parse(this.rblusertype.SelectedValue);

                UserFactory.Update(u);

                ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('用户信息修改成功!');window.location='userlist.aspx';</script>");
            }
        }
Exemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.ddlParentCategory.DataTextField  = "categoryname";
                this.ddlParentCategory.DataValueField = "categoryid";

                this.ddlParentCategory.DataSource = ProductCategoryFactory.GetAll(0);
                this.ddlParentCategory.DataBind();

                this.ddlParentCategory.Items.Insert(0, new ListItem("作为顶级分类", "0"));

                this.LoadCateData();

                int parentid = HYRequest.GetQueryInt("parentid", 0);
                if (parentid != 0)
                {
                    this.ddlParentCategory.Items.FindByValue(parentid.ToString()).Selected = true;
                }
            }
        }
Exemplo n.º 20
0
        protected void lnkBuy_Click(object sender, EventArgs e)
        {
            bool      iswxpay  = true; //this.payment_2.Checked; //是否微信支付
            string    orderno  = HYRequest.GetQueryString("orderno");
            UserModel userInfo = this.LoginUser;

            CartOrder              = OrderFactory.Get(orderno);
            CartOrder.address      = this.txtaddress.Value;
            CartOrder.customername = this.txtcustomername.Value;
            CartOrder.tel          = this.txttel.Value;
            CartOrder.shippingdesc = "快递"; //this.shipping_1.Checked ? "市内" : "市外";
            CartOrder.paymentdesc  = iswxpay ? "微信支付" : "货到付款";
            CartOrder.ordermessage = this.txtordermessage.Value;
            //CartOrder.ordersysdesc = userInfo.usertypedesc;
            CartOrder.orderpostage = CartOrder.postage.ToString();

            //如果用户信息不全,则补充完整
            if (string.IsNullOrEmpty(userInfo.fullname) || string.IsNullOrEmpty(userInfo.tel) || string.IsNullOrEmpty(userInfo.address))
            {
                userInfo.fullname = (string.IsNullOrEmpty(userInfo.fullname) ? CartOrder.customername : userInfo.fullname);
                userInfo.tel      = (string.IsNullOrEmpty(userInfo.tel) ? CartOrder.tel : userInfo.tel);
                userInfo.address  = (string.IsNullOrEmpty(userInfo.address) ? CartOrder.address : userInfo.address);

                UserFactory.Update(userInfo);
            }

            if (iswxpay)
            {
                CartOrder.totalprice   = CartOrder.productprice;
                CartOrder.totalyfprice = CartOrder.productprice + CartOrder.postage;
                CartOrder.orderstatus  = 3;
                //CartOrder.totalyfprice = getyifuprice(CartOrder.totalprice);

                OrderFactory.Update(CartOrder);

                //前往微信支付JS API接口页面
                string url = "pay/wxpay.aspx?orderno=" + CartOrder.orderno + "&total_fee=" + (CartOrder.totalyfprice * 100).ToString("0");
                Response.Redirect(url);
            }
        }
Exemplo n.º 21
0
 /// <summary>
 /// Init
 /// </summary>
 /// <param name="e"></param>
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     #region
     //如果在微信浏览器中才走下面的微信步骤
     if (Request.UserAgent.ToLower().Contains("micromessenger"))
     {
         string openId = WeChatVerifyHelper.GetUserOpenIdCookie();
         string wechat = HYRequest.GetStringByParams("wechat");
         //Oauth验证链接
         if (string.IsNullOrEmpty(openId) && string.IsNullOrEmpty(wechat))
         {
             string redirect_url = HttpContext.Current.Request.Url.AbsoluteUri;
             if (redirect_url.Contains("?"))
             {
                 redirect_url = redirect_url + "&wechat=1";
             }
             else
             {
                 redirect_url = redirect_url + "?wechat=1";
             }
             string url = string.Format(@"https://open.weixin.qq.com/connect/oauth2/authorize?appid=" + PayConfig.AppId + "&redirect_uri=" + HttpContext.Current.Server.UrlEncode(redirect_url) + "&response_type=code&scope=snsapi_base&state=123#wechat_redirect");
             HttpContext.Current.Response.Redirect(url);
         }
         //用户Oauth验证
         if (string.IsNullOrEmpty(openId) && !string.IsNullOrEmpty(wechat))
         {
             string      oauth_code = HYRequest.GetStringByParams("code");
             OAuthEntity entity     = SeniorService.UserOAuthInfo(PayConfig.AppId, PayConfig.AppSecret, oauth_code);
             if (entity.result)
             {
                 openId = entity.openid;
                 WeChatVerifyHelper.AddUserOpenIdCookie(openId);
             }
         }
         Log.WriteLog("OpenId", openId);
     }
     #endregion
 }
Exemplo n.º 22
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Action == "edit")
            {
                int        adminid = HYRequest.GetQueryInt("adminid", 0);
                AdminModel info    = AdminFactory.Get(adminid);
                if (info != null)
                {
                    string pwdstr = this.txtpassword.Text.Trim();
                    if (!string.IsNullOrEmpty(pwdstr))
                    {
                        info.userpwd = Utils.MD5(pwdstr);
                    }

                    AdminFactory.Update(info);
                    Response.Redirect("adminlist.aspx");
                }
            }
            else if (this.Action == "add")
            {
                //验证是否存在同名的帐号
                AdminModel info     = null;
                string     username = this.txtusername.Text.Trim();
                info = AdminFactory.Get(username);
                if (info != null)
                {
                    ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">alert('已存在相同的帐号!');window.location='adminedit.aspx?action=add';</script>");
                    return;
                }

                info          = new AdminModel();
                info.username = this.txtusername.Text.Trim();
                info.userpwd  = Utils.MD5(this.txtpassword.Text.Trim());

                AdminFactory.Add(info);

                Response.Redirect("adminlist.aspx");
            }
        }
Exemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Security.CheckAdministerAndRedirect();
            if (!Page.IsPostBack)
            {
                if (this.Action == "edit")
                {
                    int       uid = HYRequest.GetQueryInt("uid", 0);
                    UserModel u   = UserFactory.Get(uid);

                    this.ltlUid.Text      = uid.ToString();
                    this.txtnickname.Text = u.nickname;
                    this.txtfullname.Text = u.fullname;
                    this.txtsex.Text      = u.sex;
                    this.txttel.Text      = u.tel;
                    this.txtaddress.Text  = u.address;
                    this.txtjfnum.Text    = u.jfnum.ToString();

                    this.rblusertype.Items.FindByValue(u.usertype.ToString()).Selected = true;
                }
            }
        }
Exemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int u = HYRequest.GetQueryInt("u", 0);
                if (u == 0)
                {
                    return;
                }

                string rootUrl = SiteConfig.Instance().SiteDomain;
                if (!rootUrl.EndsWith("/"))
                {
                    rootUrl += "/";
                }

                //string url = rootUrl + "vshop/share.aspx?u=" + u;
                string url = rootUrl + "vshop/index.aspx";

                var qrCodeEncoder = new QRCodeEncoder
                {
                    QRCodeEncodeMode   = QRCodeEncoder.ENCODE_MODE.BYTE,
                    QRCodeScale        = 4,
                    QRCodeVersion      = 8,
                    QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M
                };
                Bitmap image = qrCodeEncoder.Encode(url);

                //输出到浏览器
                System.IO.MemoryStream ms = new System.IO.MemoryStream();
                image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
                Response.ClearContent();
                Response.ContentType = "image/Jpeg";
                Response.BinaryWrite(ms.ToArray());
                image.Dispose();
            }
        }
Exemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                UserModel  userInfo = this.LoginUser;
                OrderModel myorder  = OrderFactory.GetCartOrder(userInfo.uid);

                int    pid      = HYRequest.GetQueryInt("pid", 0);
                int    itemflag = HYRequest.GetQueryInt("itemflag", 0);
                string action   = HYRequest.GetQueryString("action");

                if (action == "add") //添加商品
                {
                    OrderModel myof = myorder;
                    if (myof == null)
                    {
                        myof              = new OrderModel();
                        myof.orderno      = Utils.GenerateOutTradeNo(userInfo.uid); //Utils.GetRandomOrderNo();
                        myof.uid          = userInfo.uid;
                        myof.customername = userInfo.fullname;
                        myof.tel          = userInfo.tel;
                        myof.address      = userInfo.address;
                    }

                    ProductModel p  = ProductFactory.Get(pid);
                    OrderProduct op = new OrderProduct();
                    op.count       = 1;
                    op.productinfo = p;
                    op.price       = p.price;

                    //判断是否有属性
                    if (itemflag > 0)
                    {
                        int tmpflag = 1;
                        foreach (KeyValuePair <string, decimal> kvp in p.itempricelist)
                        {
                            if (itemflag == tmpflag)
                            {
                                op.item  = kvp.Key;
                                op.price = kvp.Value;
                                break;
                            }
                            tmpflag++;
                        }
                    }

                    CheckIsAdd(myof.productlist, op);

                    if (myorder == null)
                    {
                        OrderFactory.Add(myof);
                    }
                    else
                    {
                        OrderFactory.Update(myof);
                    }

                    Response.Redirect("cart.aspx");
                }
                else if (action == "del")
                {
                    OrderModel   myof = myorder;
                    ProductModel p    = ProductFactory.Get(pid);

                    OrderProduct op = new OrderProduct();
                    op.productinfo = p;
                    op.item        = HYRequest.GetQueryString("item");

                    CheckIsDel(myof.productlist, op);

                    OrderFactory.Update(myof);
                    Response.Redirect("cart.aspx");
                }
                else if (action == "ajaxupdate")   //更新数量
                {
                    int    goods_selected = HYRequest.GetInt("goods_selected", 1);
                    int    goods_number   = HYRequest.GetInt("goods_number", 1);
                    int    rec_id         = HYRequest.GetInt("rec_id", 0);
                    string item           = HYRequest.GetString("item");

                    OrderModel   myof = myorder;
                    ProductModel p    = ProductFactory.Get(rec_id);
                    OrderProduct op   = new OrderProduct();
                    op.isselected  = (goods_selected == 1) ? true : false;
                    op.count       = goods_number;
                    op.item        = item;
                    op.productinfo = p;
                    CheckIsUpdate(myof.productlist, op);

                    OrderFactory.Update(myof);

                    string json = "{\"rec_id\":" + rec_id + ",\"goods_number\":" + goods_number + ",\"total_number\":" + myof.productcount + ",\"total_desc\":" + myof.productprice.ToString() + ",\"postage\":" + myof.postage.ToString() + ",\"error\":0}";
                    Response.Write(json);
                    Response.Flush();
                    Response.End();
                    return;
                }
                else if (action == "ajaxupdateall")  //全选状态处理
                {
                    int        goods_selected = HYRequest.GetInt("goods_selected", 1);
                    int        rec_id         = HYRequest.GetInt("rec_id", 0);
                    OrderModel myof           = myorder;
                    foreach (OrderProduct o in myof.productlist)
                    {
                        o.isselected = (goods_selected == 1) ? true : false;
                    }

                    OrderFactory.Update(myof);

                    string json = "{\"rec_id\":" + rec_id + ",\"total_number\":" + myof.productcount + ",\"total_desc\":" + myof.productprice.ToString() + ",\"postage\":" + myof.postage.ToString() + ",\"error\":0}";
                    Response.Write(json);
                    Response.Flush();
                    Response.End();
                    return;
                }

                if (myorder != null && myorder.productcount > 0)
                {
                    this.phNoProduct.Visible = false;
                    CartOrder = myorder;
                }
                else
                {
                    this.phNoProduct.Visible = true;
                }
            }
        }
Exemplo n.º 26
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Action == "add")
            {
                ProductModel info = new ProductModel();

                info.salecount      = Int32.Parse(this.txtsalecount.Text.Trim());
                info.productcount   = Int32.Parse(this.txtproductcount.Text.Trim());
                info.productname    = this.txtproductname.Text;
                info.price          = Decimal.Parse(this.txtprice.Text.Trim());
                info.itemprice      = this.txtitemprice.Text;
                info.includepicpath = this.txtincludepicpath.Text.Trim();
                info.createtime     = DateTime.Now;
                info.categoryid     = Int32.Parse(this.ddlProductCategory.SelectedItem.Value);
                info.iscommend      = this.chkiscommend.Checked ? 1 : 0;
                info.productcode    = Int32.Parse(this.rblproductcode.SelectedValue);
                info.specification  = this.editorcontent.Value;

                //产品相册
                string[] albumArr = Request.Form.GetValues("hid_photo_name");
                if (albumArr.Length > 0)
                {
                    string pics   = string.Empty;
                    string dotstr = "";
                    foreach (string sp in albumArr)
                    {
                        pics  += dotstr + sp;
                        dotstr = "|";
                    }

                    info.productpics = pics;
                }

                ProductFactory.Add(info);
            }
            else if (this.Action == "edit")
            {
                int          productid = HYRequest.GetQueryInt("productid", 0);
                ProductModel info      = ProductFactory.Get(productid);

                info.salecount      = Int32.Parse(this.txtsalecount.Text.Trim());
                info.productcount   = Int32.Parse(this.txtproductcount.Text.Trim());
                info.productname    = this.txtproductname.Text;
                info.price          = Decimal.Parse(this.txtprice.Text.Trim());
                info.itemprice      = this.txtitemprice.Text;
                info.includepicpath = this.txtincludepicpath.Text.Trim();
                info.createtime     = DateTime.Now;
                info.categoryid     = Int32.Parse(this.ddlProductCategory.SelectedItem.Value);
                info.iscommend      = this.chkiscommend.Checked ? 1 : 0;
                info.productcode    = Int32.Parse(this.rblproductcode.SelectedValue);
                info.specification  = this.editorcontent.Value;

                //产品相册
                string[] albumArr = Request.Form.GetValues("hid_photo_name");
                if (albumArr.Length > 0)
                {
                    string pics   = string.Empty;
                    string dotstr = "";
                    foreach (string sp in albumArr)
                    {
                        pics  += dotstr + sp;
                        dotstr = "|";
                    }

                    info.productpics = pics;
                }

                ProductFactory.Update(info);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "AddEditTips", "<script language=\"javascript\">window.location='productlist.aspx';</script>");
        }
Exemplo n.º 27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int    totalcount = 0;
                int    pagesize   = 12;
                int    cid        = HYRequest.GetQueryInt("cid", 0);
                int    pageindex  = HYRequest.GetQueryInt("p", 1);
                int    od         = HYRequest.GetQueryInt("od", 0);
                string whereSql   = " where productcode=1 ";

                string orderby = " order by productid desc ";
                string url     = "productlist.aspx?p={0}";


                if (cid > 0)
                {
                    whereSql = " where productcode=1 and categoryid=" + cid;
                    url     += "&cid=" + cid;
                }

                if (od == 1)
                {
                    orderby = " order by salecount desc ";
                }
                else if (od == 2)
                {
                    orderby = " order by price desc ";
                }

                listProducts = ProductFactory.GetList(pagesize, pageindex, whereSql, orderby, out totalcount);

                //this.rptProducts.DataSource = list;
                //this.rptProducts.DataBind();

                //this.rptAddToCarPopWin.DataSource = list;
                //this.rptAddToCarPopWin.DataBind();

                pagerHtml = Utils.BuildProductListPager(totalcount, pagesize, pageindex, url);

                if (cid == 0)
                {
                    this.CategoryName = "全部商品";
                }
                else
                {
                    ProductCategoryModel pcm = ProductCategoryFactory.Get(cid);
                    if (pcm != null)
                    {
                        this.CategoryName = pcm.categoryname;
                    }
                }
            }

            string action = HYRequest.GetQueryString("action");

            if (action == "ajaxloadlist")
            {
                int cid        = HYRequest.GetInt("cid", 0);
                int pageindex  = HYRequest.GetInt("p", 1);
                int pagesize   = 12;
                int totalcount = 0;

                string wheresql = " where productcode=1 ";
                if (cid > 0)
                {
                    wheresql = string.Format(" where productcode=1 and categoryid={0} ", cid.ToString());
                }

                List <ProductModel> list   = ProductFactory.GetList(pagesize, pageindex, wheresql, string.Empty, out totalcount);
                StringBuilder       sbhtml = new StringBuilder();
                foreach (ProductModel pm in list)
                {
                    sbhtml.AppendLine("<li class=\"item\">");
                    sbhtml.AppendLine(string.Format("<a href=\"productshow.aspx?id={0}\"><img src=\"{1}\" alt=\"item\" /></a>", pm.productid, pm.includepicpath));
                    sbhtml.AppendLine(string.Format("<h4><a href=\"productshow.aspx?id={0}\">{1}</a></h4>", pm.productid, pm.productname));
                    sbhtml.AppendLine(string.Format("<span>&yen;{0}</span><del style=\"display:none\">&yen;{0}</del><em>库存:{1} &nbsp; 销量:{2}</em>", pm.price.ToString(), pm.productcount, pm.salecount));
                    sbhtml.AppendLine(string.Format("<p class=\"add-to-cart\" onClick=\"toshare({0})\"><span>添加到购物车</span></p>", pm.productid));

                    sbhtml.AppendLine("</li>");
                }
                Response.Write(sbhtml.ToString());
                Response.Flush();
                Response.End();
            }
        }
Exemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string action = HYRequest.GetQueryString("action");

                UserModel  userInfo = this.LoginUser;
                OrderModel myorder  = OrderFactory.GetCartOrder(userInfo.uid);



                if (action == "addtocart")       //添加到购物车
                {
                    #region ==addtocart==
                    int pid      = HYRequest.GetFormInt("pid", 0);
                    int buycount = HYRequest.GetFormInt("buycount", 0);
                    int itemflag = HYRequest.GetFormInt("itemflag", 0);

                    OrderModel myof = myorder;
                    if (myof == null)
                    {
                        myof              = new OrderModel();
                        myof.orderno      = Utils.GenerateOutTradeNo(this.LoginUser.uid);
                        myof.uid          = userInfo.uid;
                        myof.customername = userInfo.fullname;
                        myof.tel          = userInfo.tel;
                        myof.address      = userInfo.address;
                    }

                    ProductModel p  = ProductFactory.Get(pid);
                    OrderProduct op = new OrderProduct();
                    op.count       = buycount;
                    op.productinfo = p;
                    op.price       = p.price;

                    //判断是否有属性
                    if (itemflag > 0)
                    {
                        int tmpflag = 1;
                        foreach (KeyValuePair <string, decimal> kvp in p.itempricelist)
                        {
                            if (itemflag == tmpflag)
                            {
                                op.item  = kvp.Key;
                                op.price = kvp.Value;
                                break;
                            }
                            tmpflag++;
                        }
                    }

                    CheckIsAdd(myof.productlist, op);

                    if (myorder == null)
                    {
                        OrderFactory.Add(myof);
                    }
                    else
                    {
                        OrderFactory.Update(myof);
                    }

                    string json = "{\"shopcount\":" + myof.productlist.Count + ",\"error\":0}";
                    Response.Write(json);
                    Response.Flush();
                    Response.End();
                    return;

                    #endregion
                }
                else if (action == "addtofav")   //添加到收藏夹
                {
                    #region ==addtofav==
                    int  pid   = HYRequest.GetFormInt("pid", 0);
                    bool isfav = FavoriteFactory.IsFavorite(this.LoginUser.uid, pid);
                    if (!isfav)
                    {
                        FavoriteModel fm = new FavoriteModel();
                        fm.product   = ProductFactory.Get(pid);
                        fm.uid       = this.LoginUser.uid;
                        fm.productid = pid;

                        FavoriteFactory.Add(fm);
                    }
                    string json = "{\"favtip\":\"已收藏\",\"error\":0}";
                    Response.Write(json);
                    Response.Flush();
                    Response.End();
                    return;

                    #endregion
                }
                else if (action == "delfav")     //删除收藏夹
                {
                    int fid = HYRequest.GetFormInt("fid", 0);
                    FavoriteFactory.Delete(fid);
                }
            }
        }