示例#1
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);
                }
            }
        }
示例#2
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);
            }
        }
示例#3
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>");
            }
        }
示例#4
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>";
                }
            }
        }
示例#5
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);
            }
        }
示例#6
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;
                }
            }
        }
示例#7
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;
                }
            }
        }
示例#8
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();
        }
示例#9
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();
                }
            }
        }
示例#10
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>");
            }
        }
示例#11
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;
                }
            }
        }
示例#12
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");
            }
        }
示例#13
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;
                }
            }
        }
示例#14
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();
            }
        }
示例#15
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;
                }
            }
        }
示例#16
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>");
        }
示例#17
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();
            }
        }