Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (null != Common.Common.NoHtml(Request.QueryString["action"]))
            {
                strAction = Common.Common.NoHtml(Request.QueryString["action"]);
            }
            if (null != Common.Common.NoHtml(Request.QueryString["id"]))
            {
                strID = Common.Common.NoHtml(Request.QueryString["id"]);
            }

            MSProductOrderDAL dal = new MSProductOrderDAL();

            switch (strAction)
            {
            case "del":
                if (dal.UpdateOrderState("OrderState", strID))
                {
                    strMessage = "操作成功!";
                }
                else
                {
                    strMessage = "操作失败!";
                }
                break;
            }
            Response.Write(strMessage);
            Response.End();
        }
Exemplo n.º 2
0
        void GetHtmlPage()
        {
            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/CustomerManager.html"));

            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
            string strWhere = string.Empty;
            List <OrderCustomer> ordercustomerModel = new List <OrderCustomer>();

            if (shopid != null && shopid != "")
            {
                shopid   = " and d.[SID]='" + shopid + "' ";
                strWhere = shopid;

                MSProductOrderDAL customerDal = new MSProductOrderDAL();
                DataSet           orderds     = customerDal.GetOrderUser(strWhere);
                if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in orderds.Tables[0].Rows)
                    {
                        OrderCustomer customermodel = DataConvert.DataRowToModel <OrderCustomer>(row);
                        ordercustomerModel.Add(customermodel);
                    }
                }
            }

            context.TempData["customerlist"] = ordercustomerModel;
            context.TempData["cuid"]         = cuid;
            context.TempData["errorscript"]  = errorscript;
            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Exemplo n.º 3
0
        void GetHtmlPage()
        {
            List <SaleManagerList> OrderModel = new List <SaleManagerList>();
            MSProductOrderDAL      orderDal   = new MSProductOrderDAL();
            string strWhere = string.Empty;

            if (cuid != null && cuid != "")
            {
                cuid = " and a.CustomerID='" + cuid + "' ";
            }
            strWhere = " and a.IsReceive=1 " + cuid;
            DataSet orderds = orderDal.GetSaleManager(strWhere);

            if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in orderds.Tables[0].Rows)
                {
                    SaleManagerList salemodel = DataConvert.DataRowToModel <SaleManagerList>(row);
                    OrderModel.Add(salemodel);
                }
            }

            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/SaleManager.html"));

            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            context.TempData["orderlist"]   = OrderModel;
            context.TempData["cuid"]        = cuid;
            context.TempData["errorscript"] = errorscript;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 添加购物车
 /// </summary>
 void setAddCart()
 {
     if (customid.Trim() != null && customid.Trim() != "")
     {
         string countcost = string.Empty; string quantity = string.Empty;
         if (Request["countcost"] != null && Request["countcost"] != "")
         {
             countcost = Common.Common.NoHtml(Request["countcost"]);
         }
         if (Request["quantity"] != null && Request["quantity"] != "")
         {
             quantity = Common.Common.NoHtml(Request["quantity"]);
         }
         if (quantity.Trim() == null || quantity.Trim() == "")
         {
             Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
         }
         if (countcost.Trim() == null || countcost.Trim() == "")
         {
             Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
         }
         MSProductOrderDAL OrderDal = new MSProductOrderDAL();
         if (OrderDal.ExistOrderByUID(customid, strpid))
         {
             Response.Write("{\"error\":true,\"exist\":true}");
         }
         else
         {
             Response.Write("{\"success\":true}");
         }
         //MSShoppingCartDAL cartDal = new MSShoppingCartDAL();
         //if (!cartDal.ExistCart(strpid, customid))
         //{
         //    MSShoppingCart cartModel = new MSShoppingCart();
         //    cartModel.ID = Guid.NewGuid().ToString("N");
         //    cartModel.Pid = strpid;
         //    cartModel.CustomerID = customid;
         //    cartModel.UnitCost = decimal.Parse(countcost);
         //    cartModel.Quantity = int.Parse(quantity);
         //    if (!cartDal.AddShoppingCart(cartModel))
         //    {
         //        Response.Write("{\"error\":true,\"msg\":\"操作失败,请重新操作\"}");
         //    }
         //    else
         //    {
         //        Response.Write("{\"success\":true}");
         //    }
         //}
         //else
         //{
         //    Response.Write("{\"success\":true}");
         //}
     }
     else
     {
         setCookies();
         Response.Write("{\"error\":true,\"msg\":\"操作失败,请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}");
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// 订单收货
        /// </summary>
        void ReceiveOrder()
        {
            string oid = string.Empty;

            if (Request["oid"] != null && Request["oid"] != "")
            {
                oid = Common.Common.NoHtml(Request["oid"]);
            }
            if (oid != null && oid != "")
            {
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.UpdateOrderState("isReceive", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        if (strOpenID == null || strOpenID == "")
                        {
                            string         customerid  = OrderDal.GetOrderDetailValueByOID("CustomerID", oid).ToString();
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode("VYIGO");
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "尊敬的" + buyName));
                        paramList.Add(new TemplateMessageParam("OrderSn", oid));
                        paramList.Add(new TemplateMessageParam("OrderStatus", "已收货"));
                        paramList.Add(new TemplateMessageParam("Remark",
                                                               "请关注公众号【vgo2013】进入“服务中心进行查询”查看完整信息"));
                        wx.SendTemplateMessage(strOpenID, "wmrxCKRq1hG3cHR0BXsuUnNq1chcbVosqYLqlsBBRCc",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/CustomerOrder.aspx?receive=1",
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid +
                                                    "】已确认收货,发送模板消息到客户OpenID【" + strOpenID + "】");
                    }
                    catch (Exception)
                    {
                    }
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
            }
            Response.End();
        }
Exemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string strOpenID = string.Empty;

                if (null == Request.QueryString["openid"])
                {
                    return;
                }
                else
                {
                    if (Request.QueryString["openid"].ToString().Length > 29 || Request.QueryString["openid"].ToString().Length < 25)
                    {
                        strOpenID = Common.Common.NoHtml(Request.QueryString["openid"].ToString());
                    }
                    else
                    {
                        strOpenID = Request.QueryString["openid"].ToString();
                    }
                    Session["openid"] = strOpenID;
                }

                //取所有参加的活动列表
                List <MSChargeOrder> liPo  = new List <MSChargeOrder>();
                MSProductOrderDAL    dalPo = new MSProductOrderDAL();
                DataSet ds = dalPo.GetPOListByOpid(strOpenID);

                if (null != ds && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        MSChargeOrder model = DataConvert.DataRowToModel <MSChargeOrder>(row);
                        liPo.Add(model);
                    }
                }

                string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/ChargeOrder.html"));
                JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();
                context.TempData["Po_list"] = liPo;
                context.TempData["OpenID"]  = strOpenID;
                JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
                t.Render(Response.Output);
            }
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 收货信息修改
        /// </summary>
        void EditeOrder()
        {
            string buyname = string.Empty; string phone = string.Empty; string pac = string.Empty;
            string address = string.Empty; string leveamsg = string.Empty; string zipcode = string.Empty;

            #region -获取请求值
            if (Request["buyname"] != null && Request["buyname"] != "")
            {
                buyname = Request["buyname"];
            }
            if (Request["phone"] != null && Request["phone"] != "")
            {
                phone = Request["phone"];
            }
            if (Request["pac"] != null && Request["pac"] != "")
            {
                pac = Request["pac"];
            }
            if (Request["address"] != null && Request["address"] != "")
            {
                address = Request["address"];
            }
            if (Request["leveamsg"] != null && Request["leveamsg"] != "")
            {
                leveamsg = Request["leveamsg"];
            }
            if (Request["zipcode"] != null && Request["zipcode"] != "")
            {
                zipcode = Request["zipcode"];
            }
            #endregion
            MSProductOrderDAL OrderDal = new MSProductOrderDAL();
            if (OrderDal.UpdateCustomer(oid, phone, buyname, pac + "-" + address, leveamsg, zipcode))
            {
                Response.Write("{\"success\":true}");
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"收货信息修改失败,请核对后再操作\"}");
            }
            Response.End();
        }
Exemplo n.º 9
0
        /// <summary>
        /// 验证订单
        /// </summary>
        void valiteordernum()
        {
            string ordernum = string.Empty; string cid = string.Empty;

            if (Request["ordernum"] != null && Request["ordernum"] != "")
            {
                ordernum = Request["ordernum"];
            }
            if (Request["cid"] != null && Request["cid"] != "")
            {
                cid = Request["cid"];
            }
            if (ordernum != null && ordernum != "")
            {
                MSProductOrderDAL   OrderDal     = new MSProductOrderDAL();
                MSOrderLogisticsDAL logisticsDal = new MSOrderLogisticsDAL();
                if (!OrderDal.ExsitOrderNum(ordernum))
                {
                    Response.Write("{\"error\":true,\"msg\":\"该订单无效\"}");
                }
                else
                {
                    if (logisticsDal.ExistOID(cid, ordernum))
                    {
                        Response.Write("{\"error\":true,\"msg\":\"该订单已提交过\"}");
                    }
                    else
                    {
                        Response.Write("{\"success\":true}");
                    }
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"请输入正确的订单\"}");
            }
            Response.End();
        }
Exemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                errormsg = "";
                #region ------------获取请求信息----------------
                if (Request["pname"] != null && Request["pname"] != "")
                {
                    pname = Request["pname"];
                }
                if (Request["ordernum"] != null && Request["ordernum"] != "")
                {
                    ordernum = Request["ordernum"];
                }
                if (Request["countcost"] != null && Request["countcost"] != "")
                {
                    countcost = Request["countcost"];
                }
                if (Request["customid"] != null && Request["customid"] != "")
                {
                    customid = Request["customid"];
                }
                #endregion
                #region -获取用户openid
                if (Session["OpenID"] == null || Session["OpenID"].ToString() == "")
                {
                    if (customid != null && customid != "")
                    {
                        MSCustomersDAL customerDal = new MSCustomersDAL();
                        try
                        {
                            strOpenID = customerDal.GetCustomerValueByID("OpenID", customid).ToString();
                        }
                        catch (Exception)
                        {
                        }
                    }
                }
                else
                {
                    strOpenID = Session["OpenID"].ToString();
                }
                #endregion
                if (Request["action"] != null && Request["action"] != "")
                {
                    action = Request["action"];
                    string            strSiteCode = "VYIGO";
                    WXJSAPIPay        wxpay       = new WXJSAPIPay(strSiteCode);
                    MSProductOrderDAL ptitleDal   = new MSProductOrderDAL();
                    switch (action.Trim().ToLower())
                    {
                    case "alipay":
                        //ptitleDal.UpdateOrderPayWay(ordernum, "alipay");
                        //payway= WapPayHelper.BuildRequest(pname, ordernum, countcost, customid);
                        AliWapPay pay           = new AliWapPay("VYIGO");
                        string    notify_url    = "http://www.vgo2013.com/PalmShop/ShopCode/NotifyUrl.aspx";
                        string    call_back_url = "http://www.vgo2013.com/PalmShop/ShopCode/Alipayreturn.aspx";
                        pay.DirectAliWayPay(this.Response, pname, ordernum, countcost, customid, call_back_url, notify_url);
                        break;

                    case "wxpay":
                        ptitle = ptitleDal.GetOrderTitleByOID(ordernum);
                        strIP  = System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
                        decimal countcostx = decimal.Parse(countcost);
                        int     v          = (Int32)Math.Round(countcostx * 100, 0);

                        try
                        {
                            wxpay.DirectWXJSAPIPay(this.Response, ptitle, ordernum, v,
                                                   strIP, strOpenID, "http://www.vgo2013.com/PalmShop/ShopCode/PayState.aspx", null, "");
                        }
                        catch (Exception emsg)
                        {
                            errormsg = JQDialog.alertOKMsgBox(5, emsg.Message, "", "error");
                        }

                        break;
                    }
                }
                GetHtmlPage();
            }
        }
Exemplo n.º 11
0
        void GetHtmlPage()
        {
            string customerid = string.Empty; string strWhere = string.Empty;

            #region -获取用户信息
            if (strOpenID != null && strOpenID != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    customerid = customerDal.GetCustomerValueByOpenID("ID", strOpenID).ToString();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                if (Session["customerID"] != null && Session["customerID"].ToString() != "")
                {
                    customerid = Session["customerID"].ToString();
                }
                else
                {
                    JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2);
                    errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                      "UserLogin.aspx", "error");
                }
            }
            #endregion

            List <MyOrderList>   myorderlistModel = new List <MyOrderList>();
            List <MSProductPara> paralist         = new List <MSProductPara>();
            if (customerid != null && customerid != "")
            {
                MSProductOrderDAL orderDal = new MSProductOrderDAL();
                strWhere += " and a.CustomerID='" + customerid + "' and PayState=1 ";
                DataSet orderds = orderDal.GetCustomerOrderList(strWhere);
                if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow item in orderds.Tables[0].Rows)
                    {
                        MyOrderList ordermodel = DataConvert.DataRowToModel <MyOrderList>(item);
                        myorderlistModel.Add(ordermodel);
                    }
                }
            }
            else
            {
                JQDialog.SetCookies("pageurl", "MyConsume.aspx", 2);
                errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                  "UserLogin.aspx", "error");
            }

            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/MyConsume.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            //context.TempData["artList"] = liArtList;
            context.TempData["errormsg"]    = errormsg;
            context.TempData["myorderlist"] = myorderlistModel;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Exemplo n.º 12
0
        /// <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);
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// 把购物车添加到订单
        /// </summary>
        void setAddOrder()
        {
            string uname = string.Empty; string uphone = string.Empty; string address = string.Empty;
            string payway = string.Empty; string carryway = string.Empty; string countcost = string.Empty;
            string leavemsg = string.Empty; string zipcode = string.Empty; string num = string.Empty;

            #region --------------获取请求信息---------------
            if (Request["num"] != null && Request["num"] != "")
            {
                num = Request["num"];
            }
            if (Request["uname"] != null && Request["uname"] != "")
            {
                uname = Common.Common.NoHtml(Request["uname"]);
            }
            if (Request["uphone"] != null && Request["uphone"] != "")
            {
                uphone = Common.Common.NoHtml(Request["uphone"]);
            }
            if (Request["address"] != null && Request["address"] != "")
            {
                address = Request["address"];
            }
            if (Request["payway"] != null && Request["payway"] != "")
            {
                payway = Common.Common.NoHtml(Request["payway"]);
            }
            if (Request["carryway"] != null && Request["carryway"] != "")
            {
                carryway = Common.Common.NoHtml(Request["carryway"]);
            }
            if (Request["countcost"] != null && Request["countcost"] != "")
            {
                countcost = Common.Common.NoHtml(Request["countcost"]);
            }
            if (Request["leavemsg"] != null && Request["leavemsg"] != "")
            {
                leavemsg = Common.Common.NoHtml(Request["leavemsg"]);
            }
            if (Request["zipcode"] != null && Request["zipcode"] != "")
            {
                zipcode = Common.Common.NoHtml(Request["zipcode"]);
            }
            #endregion
            if (customid.Trim() != null && customid.Trim() != "")
            {
                MSShoppingCartDAL cartDal  = new MSShoppingCartDAL();
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.ExistOrderByUID(customid, strpid))
                {
                    Response.Write("{\"error\":true,\"exist\":true}");
                }
                else
                {
                    try
                    {
                        string strOrdernum = cartDal.SubOrder(customid, uname, uphone, leavemsg,
                                                              address, zipcode, strpid, countcost, num, mid);
                        if (strOrdernum != null && strOrdernum != "")
                        {
                            strSiteCode = "VYIGO";
                            MSOrderLogDAL.AddMSOrderLog("客户【" + customid + "】下单成功,订单号为【" + strOrdernum + "】");
                            MSProductDAL productDal = new MSProductDAL();
                            string       pnam       = string.Empty;
                            if (strpid != null && strpid != "")
                            {
                                pnam = productDal.GetMSProductVaueByID("Ptitle", strpid).ToString();
                            }

                            #region -发消息到店铺注册用户
                            string p_uid = string.Empty; string p_openid = string.Empty;
                            if (strpid != null && strpid != "")
                            {
                                try
                                {
                                    p_uid = productDal.GetMSProductVaueByID("CustomerID", strpid).ToString();
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (p_uid != null && p_uid != "")
                            {
                                MSCustomersDAL P_UDal = new MSCustomersDAL();
                                try
                                {
                                    p_openid = P_UDal.GetCustomerValueByID("OpenID", p_uid).ToString();
                                }
                                catch (Exception)
                                {
                                }
                            }
                            if (p_openid != null && p_openid != "" && strSiteCode != null && strSiteCode != "")
                            {
                                JQDialog.SendWeiXinMsg(strSiteCode, p_openid,
                                                       "亲爱的店长大人,您的宝贝【" + pnam + "】已于" +
                                                       DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") +
                                                       "被" + uname + "成功买下,单号【" + strOrdernum + "】赶紧去小店看看吧!");
                            }
                            MSOrderLogDAL.AddMSOrderLog("下单成功,通知到OpenID为【" + p_openid + "】的店长");
                            #endregion

                            #region -产品属性
                            MSProductParaDAL paraDal = new MSProductParaDAL();
                            int stock = 0;
                            if (paraDal.ExistMSPPara("", strpid) && mid != null && mid != "")
                            {
                                try
                                {
                                    stock = int.Parse(paraDal.GetMSPParaValueByID("Stock", mid).ToString());
                                }
                                catch (Exception)
                                {
                                }
                                if (stock > 0)
                                {
                                    int buynum = 0;
                                    try
                                    {
                                        buynum = Convert.ToInt32(quantity);
                                    }
                                    catch (Exception)
                                    {
                                    }
                                    if (buynum != 0 && buynum < stock)
                                    {
                                        stock = stock - buynum;
                                        paraDal.UpdateStock(stock, mid);
                                    }
                                }
                            }
                            #endregion
                            DataSet orderds     = cartDal.GetMyOrderDetail(strOrdernum);
                            string  payinfo     = string.Empty;
                            string  productname = string.Empty; //用户购买的商品名称
                            string  ordernum    = string.Empty; //订单号
                            if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                            {
                                productname = orderds.Tables[0].Rows[0]["Ptitle"].ToString();
                                ordernum    = orderds.Tables[0].Rows[0]["ID"].ToString();
                                //payinfo= WapPayHelper.BuildRequest(productname, ordernum, countcost, customid);
                            }
                            if (productname.Trim() != null && productname.Trim() != "" && ordernum != null && ordernum != "")
                            {
                                //Response.Write("{\"success\":true,\"payinfo\":\"" + payinfo + "\"}");
                                Response.Write("{\"success\":true,\"pname\":\"" + productname +
                                               "\",\"ordernum\":\"" + ordernum + "\",\"countcost\":\"" + countcost +
                                               "\",\"customid\":\"" + customid + "\",\"openid\":\"" + openid + "\"}");
                            }
                        }
                        else
                        {
                            Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}");
                        }
                    }
                    catch (Exception)
                    {
                        Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}");
                    }
                }
            }
            else
            {
                setCookies();
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}");
            }
            Response.End();
        }
Exemplo n.º 14
0
        void GetHtmlPage()
        {
            string strWhere = string.Empty; string productmodelid = string.Empty;
            string orderstate = string.Empty; string paystate = string.Empty; string receive = string.Empty;
            string oid = string.Empty;//支付成功返回订单

            #region -获取用户信息
            if (strOpenID != null && strOpenID != "")
            {
                MSCustomersDAL customerDal = new MSCustomersDAL();
                try
                {
                    customerid = customerDal.GetCustomerValueByOpenID("ID", strOpenID).ToString();
                }
                catch (Exception)
                {
                }
            }
            else
            {
                if (Session["customerID"] != null && Session["customerID"].ToString() != "")
                {
                    customerid = Session["customerID"].ToString();
                }
                else
                {
                    JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2);
                    errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                      "UserLogin.aspx", "error");
                }
            }
            #endregion
            List <MyOrderList> myorderlistModel = new List <MyOrderList>();
            if (customerid != null && customerid != "")
            {
                MSProductOrderDAL orderDal = new MSProductOrderDAL();
                #region -获取请求信息
                if (Request["oid"] != null && Request["oid"] != "")
                {
                    oid = Common.Common.NoHtml(Request["oid"]);
                }
                if (Request["orderstate"] != null && Request["orderstate"] != "")
                {
                    orderstate = Common.Common.NoHtml(Request["orderstate"]);
                }
                if (Request["paystate"] != null && Request["paystate"] != "")
                {
                    paystate = Common.Common.NoHtml(Request["paystate"]);
                }
                if (Request["receive"] != null && Request["receive"] != "")
                {
                    receive = Common.Common.NoHtml(Request["receive"]);
                }
                strWhere = " and a.CustomerID='" + customerid + "' ";
                if (orderstate.Trim() != null && orderstate.Trim() != "")
                {
                    strWhere += " and OrderState=" + orderstate;
                }
                if (paystate.Trim() != null && paystate.Trim() != "")
                {
                    strWhere += " and PayState=" + paystate;
                }
                else
                {
                    strWhere += " and PayState=1 ";
                }
                if (receive.Trim() != null && receive.Trim() != "")
                {
                    strWhere += " and IsReceive=" + receive;
                }
                else
                {
                    strWhere += " and IsReceive=0 ";
                }
                if (oid.Trim() != null && oid.Trim() != "")
                {
                    strWhere += " and a.ID='" + oid + "' ";
                }
                #endregion
                strWhere += " and a.CustomerID='" + customerid + "' ";
                DataSet orderds = orderDal.GetCustomerOrderList(strWhere);
                if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0)
                {
                    foreach (DataRow item in orderds.Tables[0].Rows)
                    {
                        MyOrderList ordermodel = DataConvert.DataRowToModel <MyOrderList>(item);
                        productmodelid = ordermodel.Mid;
                        if (ordermodel.Ptitle.Length > 10)
                        {
                            ordermodel.Ptitle = ordermodel.Ptitle.ToString().Substring(0, 10) + "..";
                        }
                        myorderlistModel.Add(ordermodel);
                    }
                }
            }
            else
            {
                JQDialog.SetCookies("pageurl", "CustomerOrder.aspx", 2);
                errormsg = JQDialog.alertOKMsgBox(5, "操作失败<br/>请登录后再操作!",
                                                  "UserLogin.aspx", "error");
            }

            string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/CustomerOrder.html"));
            JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext();

            //context.TempData["artList"] = liArtList;
            context.TempData["myorderlist"] = myorderlistModel;
            context.TempData["errormsg"]    = errormsg;
            context.TempData["customerid"]  = customerid;

            JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text);
            t.Render(Response.Output);
        }
Exemplo n.º 15
0
        /// <summary>
        /// 删除订单
        /// </summary>
        void DelOrder()
        {
            string oid = string.Empty; string uid = string.Empty;

            if (Request["oid"] != null && Request["oid"] != "")
            {
                oid = Common.Common.NoHtml(Request["oid"]);
            }
            if (Request["uid"] != null && Request["uid"] != "")
            {
                uid = Common.Common.NoHtml(Request["uid"]);
            }
            if (oid != null && oid != "" && uid != null && uid != "")
            {
                MSProductOrderDAL OrderDal = new MSProductOrderDAL();
                if (OrderDal.UpdateOrderStateByUID(uid, oid))
                {
                    int orderquantity = 0; string mid = string.Empty; int quantity = 0;
                    #region -更新库存
                    MSProductParaDAL paraDal = new MSProductParaDAL();
                    try
                    {
                        orderquantity = Convert.ToInt32(OrderDal.GetOrderDetailValueByOID("Quantity", oid).ToString());
                    }
                    catch (Exception)
                    {
                    }
                    if (orderquantity != null && orderquantity > 0)
                    {
                        try
                        {
                            mid = OrderDal.GetOrderDetailValueByOID("MID", oid).ToString();
                        }
                        catch (Exception)
                        {
                        }
                    }
                    if (mid != null && mid != "")
                    {
                        try
                        {
                            quantity = Convert.ToInt32(paraDal.GetMSPParaValueByID("Stock", mid).ToString());
                        }
                        catch (Exception)
                        {
                        }
                    }
                    #endregion
                    if (quantity >= 0 && orderquantity > 0)
                    {
                        quantity = quantity + orderquantity;
                        try
                        {
                            paraDal.UpdateStock(quantity, mid);
                        }
                        catch (Exception)
                        {
                        }
                    }
                    MSOrderLogDAL.AddMSOrderLog("订单【" + oid +
                                                "】已被客户【" + uid + "】OpenID-【" + strOpenID + "】取消,库存更新");
                    Response.Write("{\"success\":true}");
                }
                else
                {
                    Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}");
                }
            }
            else
            {
                Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}");
            }
            Response.End();
        }
Exemplo n.º 16
0
        /// <summary>
        /// 提交订单
        /// </summary>
        void submitOrder()
        {
            string oid = string.Empty; string cid = string.Empty; string cname = string.Empty;

            #region -获取页面请求值
            try
            {
                oid = Request.Form.Get("ordernum").ToString();
            }
            catch (Exception)
            {
                oid = "";
            }
            try
            {
                cname = Request.Form.Get("cname").ToString();
            }
            catch (Exception)
            {
                cname = "";
            }
            try
            {
                cid = Request.Form.Get("cid").ToString();
            }
            catch (Exception)
            {
                cid = "";
            }
            #endregion
            strSiteCode = "VYIGO"; string customerid = string.Empty; string openid = string.Empty;
            if (oid != null && oid != "" && cid != null && cid != "")
            {
                MSOrderLogistics    olModel  = new MSOrderLogistics();
                MSOrderLogisticsDAL olDal    = new MSOrderLogisticsDAL();
                MSProductOrderDAL   OrderDal = new MSProductOrderDAL();
                olModel.ID = cid; olModel.OID = oid; olModel.CName = cname;

                customerid = OrderDal.GetOrderValueByID("CustomerID", oid).ToString();

                if (customerid != null && customerid != "")
                {
                    MSCustomersDAL customerDal = new MSCustomersDAL();
                    openid = customerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                }

                if (olDal.AddOrderLogistics(olModel) && OrderDal.UpdateOrderState("IsSend", oid))
                {
                    string buyName = string.Empty;
                    try
                    {
                        buyName = OrderDal.GetOrderValueByID("BuyName", oid).ToString();
                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first", "亲,宝贝已经启程了,好想快点来到你身边"));
                        paramList.Add(new TemplateMessageParam("delivername", cname));
                        paramList.Add(new TemplateMessageParam("ordername", cid));
                        paramList.Add(new TemplateMessageParam("remark",
                                                               "请关注公众号【vgo2013】进入“快点我”查看完整物流信息"));
                        SendTemplateMessageReturnObj temobj = wx.SendTemplateMessage(openid,
                                                                                     "k4eMeEtKReeDvDRFAf8-Li9FuuHkaFPP1xQI6t3Jomo",
                                                                                     "http://www.vgo2013.com/PalmShop/ShopCode/CopyOrder.aspx?oid=" + oid,
                                                                                     paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("提示客户订单【" + oid + "】已经发货,发送模板消息到客户OpenID【" + openid + "】");
                        bool flag = true;
                        if (flag)
                        {
                        }
                    }
                    catch { }

                    errormsg = JQDialog.alertOKMsgBox(3, "操作成功!", "OrderDelivery.aspx", "succeed");
                }
                else
                {
                    errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
                }
            }
            else
            {
                errormsg = JQDialog.alertOKMsgBoxGoBack(3, "操作失败,请重新操作!", false);
            }
        }
Exemplo n.º 17
0
        public override void OnPaySucceed(AliWapPayCallBackInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("订单号:{0},支付宝交易号:{1}",
                                        info.out_trade_no, info.trade_no);
            ExceptionLogDAL.InsertExceptionLog(log);

            if (info.result.ToLower() == "success")
            {
                oid   = info.out_trade_no;
                payid = info.trade_no;

                MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
                int paystate = 0;
                try
                {
                    paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.out_trade_no).ToString());
                }
                catch (Exception)
                {
                }
                if (paystate == 0)
                {
                    bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.out_trade_no, "alipay");
                    bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.out_trade_no, "1");
                    MSOrderLogDAL.AddMSOrderLog("订单【" + info.out_trade_no + "】支付成功,支付方式:支付宝支付");
                    if (updatepayway == true && updateOrderNum == true)
                    {
                        string countcost = string.Empty; string pid = string.Empty; string pname = string.Empty;
                        #region -获取用户数据
                        string strOpenID = string.Empty; string customerid = string.Empty;
                        try
                        {
                            customerid = ptitleDal.GetOrderValueByID("CustomerID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (customerid != null && customerid != "")
                        {
                            MSCustomersDAL CustomerDal = new MSCustomersDAL();
                            try
                            {
                                strOpenID = CustomerDal.GetCustomerValueByID("OpenID", customerid).ToString();
                            }
                            catch (Exception)
                            {
                            }
                        }
                        #endregion
                        #region -获取产品信息
                        try
                        {
                            countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        try
                        {
                            pid = ptitleDal.GetOrderDetailValueByOID("PID", info.out_trade_no).ToString();
                        }
                        catch (Exception)
                        {
                        }
                        if (pid != null && pid != "")
                        {
                            MSProductDAL ProductDal = new MSProductDAL();
                            pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                        }
                        #endregion
                        string      strSiteCode = GetSiteCode();
                        WXConfigDAL dal         = new WXConfigDAL();

                        WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                        List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                        paramList.Add(new TemplateMessageParam("first",
                                                               "我们已收到您的货款,订单号为:" + info.out_trade_no +
                                                               ";我们将尽快为您打包商品,请耐心等待: )"));
                        paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                        paramList.Add(new TemplateMessageParam("orderProductName", pname));
                        paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                        wx.SendTemplateMessage(strOpenID, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                               "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.out_trade_no,
                                               paramList.ToArray(), "");
                        MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + strOpenID + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    }
                }
            }
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <string, string> sPara = GetRequestPost();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                bool verifyResult = false;

                AlipayNotify aliNotify = new AlipayNotify();
                verifyResult = aliNotify.VerifyNotify(sPara, Request.Form["sign"]);


                if (verifyResult)//验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
                    //获取支付宝的通知返回参数,可参考技术文档中服务器异步通知参数列表

                    //解密(如果是RSA签名需要解密,如果是MD5签名则下面一行清注释掉)
                    //sPara = aliNotify.Decrypt(sPara);

                    //XML解析notify_data数据
                    try
                    {
                        XmlDocument xmlDoc = new XmlDocument();
                        xmlDoc.LoadXml(sPara["notify_data"]);
                        //商户订单号
                        string out_trade_no = xmlDoc.SelectSingleNode("/notify/out_trade_no").InnerText;
                        //支付宝交易号
                        string trade_no = xmlDoc.SelectSingleNode("/notify/trade_no").InnerText;
                        //交易状态
                        string trade_status = xmlDoc.SelectSingleNode("/notify/trade_status").InnerText;

                        if (trade_status == "TRADE_FINISHED")
                        {
                            //判断该笔订单是否在商户网站中已经做过处理
                            //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                            //如果有做过处理,不执行商户的业务程序

                            //注意:
                            //该种交易状态只在两种情况下出现
                            //1、开通了普通即时到账,买家付款成功后。
                            //2、开通了高级即时到账,从该笔交易成功时间算起,过了签约时的可退款时限(如:三个月以内可退款、一年以内可退款等)后。

                            //微商易业务逻辑
                            MSProductOrderDAL.UpdateOrderPayState(out_trade_no, "1");

                            Response.Write("success");  //请不要修改或删除
                        }
                        else if (trade_status == "TRADE_SUCCESS")
                        {
                            //判断该笔订单是否在商户网站中已经做过处理
                            //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
                            //如果有做过处理,不执行商户的业务程序

                            //注意:
                            //该种交易状态只在一种情况下出现——开通了高级即时到账,买家付款成功后。

                            //微商易业务逻辑
                            MSProductOrderDAL.UpdateOrderPayState(out_trade_no, "1");

                            Response.Write("success");  //请不要修改或删除
                        }
                        else
                        {
                            Response.Write(trade_status);
                        }
                    }
                    catch (Exception exc)
                    {
                        ExceptionLog log = new ExceptionLog();
                        log.Message = "异常:" + exc.Message;
                        ExceptionLogDAL.InsertExceptionLog(log);

                        Response.Write(exc.ToString());
                    }



                    //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    Response.Write("fail");
                }
            }
            else
            {
                Response.Write("无通知参数");
            }
        }
Exemplo n.º 19
0
        public override void OnPaySucceed(WXJSAPIPayNotifyInfo info)
        {
            ExceptionLog log = new ExceptionLog();

            log.Message = string.Format("Openid:{0},订单号:{1},附加消息:{2}",
                                        info.OpenId, info.OutTradeNo, info.Attach);
            ExceptionLogDAL.InsertExceptionLog(log);

            MSProductOrderDAL ptitleDal = new MSProductOrderDAL();
            int paystate = 0;

            try
            {
                paystate = Convert.ToInt32(ptitleDal.GetOrderValueByID("PayState", info.OutTradeNo).ToString());
            }
            catch (Exception)
            {
            }
            if (paystate == 0)
            {
                bool updatepayway   = ptitleDal.UpdateOrderPayWay(info.OutTradeNo, "wxpay");
                bool updateOrderNum = MSProductOrderDAL.UpdateOrderPayState(info.OutTradeNo, "1");
                MSOrderLogDAL.AddMSOrderLog("订单【" + info.OutTradeNo + "】支付成功,支付方式:微支付");
                if (updatepayway == true && updateOrderNum == true)
                {
                    string countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    string strSiteCode = "VYIGO";
                    string pid = string.Empty; string pname = string.Empty;

                    #region -获取产品信息
                    try
                    {
                        countcost = ptitleDal.GetOrderDetailValueByOID("UnitCost", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    try
                    {
                        pid = ptitleDal.GetOrderDetailValueByOID("PID", info.OutTradeNo).ToString();
                    }
                    catch (Exception)
                    {
                    }
                    if (pid != null && pid != "")
                    {
                        MSProductDAL ProductDal = new MSProductDAL();
                        pname = ProductDal.GetMSProductVaueByID("Ptitle", pid).ToString();
                    }
                    #endregion

                    WeiXinCore.WeiXin           wx        = WXHelper.CreateWeiXinInstanceBySiteCode(strSiteCode);
                    List <TemplateMessageParam> paramList = new List <TemplateMessageParam>();
                    paramList.Add(new TemplateMessageParam("first", "我们已收到您的货款,订单号为:" +
                                                           info.OutTradeNo + ";我们将尽快为您打包商品,请耐心等待: )"));
                    paramList.Add(new TemplateMessageParam("orderMoneySum", countcost + " 元"));
                    paramList.Add(new TemplateMessageParam("orderProductName", pname));
                    paramList.Add(new TemplateMessageParam("Remark", "如有问题请致电400-885-5790或直接在微信留言,小V将第一时间为您服务!"));
                    wx.SendTemplateMessage(info.OpenId, "IR3TlAC2Y3lW0jaksuPRwHrVHe5nmbWRcD6ZeUPZPlA",
                                           "http://www.vgo2013.com/PalmShop/ShopCode/OrderDetail.aspx?oid=" + info.OutTradeNo,
                                           paramList.ToArray(), "");
                    MSOrderLogDAL.AddMSOrderLog("发送模板消息到客户OpenID为【" + info.OpenId + "】大致为:我们已收到您的货款" + countcost + "元,产品名称【" + pname + "】我们将尽快为您打包商品,请耐心等待: )");
                    //JQDialog.SendWeiXinMsg(strSiteCode, info.OpenId,
                    //                       "您的订单号【" + info.OutTradeNo + "】已于" +
                    //                       DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") +
                    //                       "付款成功,支付金额:" + countcost +
                    //                       "元;在等待卖家发货,详情请进入我的订单查询!");
                }
            }
        }