Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (OperUtil.getCooki("vshop_openID") != "0")
            {
                this.member_ID.Value = Util.getMemberID();
            }
            else
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                    return;
                }
            }


            string sql1 = "select * from asm_member where id='" + this.member_ID.Value + "'";

            DataTable dt = DbHelperSQL.Query(sql1).Tables[0];

            if (dt.Rows.Count > 0)
            {
                this.nickname.Value = dt.Rows[0]["nickname"].ToString();
            }
        }
Beispiel #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (OperUtil.getCooki("vshop_openID") != "0")
     {
         this._companyID.Value = OperUtil.getCooki("companyID");
         this._openID.Value    = OperUtil.getCooki("vshop_openID");
         this.memberID.Value   = Util.getMemberID();
         string    sql = "select * from asm_member where id=" + this.memberID.Value;
         DataTable dd  = DbHelperSQL.Query(sql).Tables[0];
         yue = dd.Rows[0]["AvailableMoney"].ToString();
         if (dd.Rows[0]["pwd"].ToString() == "000000")
         {
             Response.Write("<script>alert('您当前交易密码为初始密码,请前往个人中心修改!');</script>");
         }
     }
     else
     {
         this._companyID.Value = OperUtil.getCooki("companyID");
         string userAgent = Request.UserAgent;
         if (userAgent.ToLower().Contains("micromessenger"))
         {
             Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
             return;
         }
     }
     if (!IsPostBack)
     {
     }
 }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                //查询该会员是否设置支付密码没有的话弹出提示框设置
                string str = Request.QueryString["req"].ToString();//trxid=111111&money=2222;
                req                   = PwdHelper.DecodeDES(str, "bingoseller");
                trxid                 = req.Split('&')[0].Split('=')[1];
                money                 = req.Split('&')[1].Split('=')[1];
                companyID             = req.Split('&')[2].Split('=')[1];
                this._money.Value     = money;
                this._trxid.Value     = trxid;
                this._companyID.Value = companyID;

                if (OperUtil.getCooki("vshop_openID") != "0")
                {
                    string    sql = "select * from asm_member where openID='" + OperUtil.getCooki("vshop_openID") + "' and companyID=" + companyID;
                    DataTable dd  = DbHelperSQL.Query(sql).Tables[0];
                    if (dd.Rows.Count <= 0)
                    {
                        //判断是否关注
                        wxHelper wx = new wxHelper(companyID);
                        if (wx.Get_UserInfo(OperUtil.getCooki("vshop_openID")).subscribe == "1")
                        {
                            Response.Redirect("WXCallback.aspx?companyID=" + this._companyID.Value);
                        }
                        else
                        {
                            //没关注
                            string    sql12 = "select * from asm_company where id=" + companyID;
                            DataTable dt    = DbHelperSQL.Query(sql12).Tables[0];
                            url = @"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=" + dt.Rows[0]["biz"].ToString() + "#wechat_redirect";
                            Util.Debuglog("关注链接=" + url, "微信回调_.txt");
                            Response.Redirect(url);
                        }
                    }
                    else
                    {
                        //正常已经关注的
                    }
                    headURL = dd.Rows[0]["headurl"].ToString();
                    ye      = dd.Rows[0]["AvailableMoney"].ToString();
                    string sql1 = "select * from asm_company where id=" + companyID;

                    DataTable d1 = DbHelperSQL.Query(sql1).Tables[0];
                    this._openID.Value = OperUtil.getCooki("vshop_openID");
                    companyName        = d1.Rows[0]["name"].ToString();
                }
                else
                {
                    Response.Redirect("weixincallback.aspx?companyID=" + companyID + "&req=" + str);
                }
            }
            catch
            {
                Response.Write("<span style='color:#FF0000;font-size:20px'>" + "参数有误,请重试" + "</span>");
            }
        }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (OperUtil.getCooki("vshop_openID") != "0")
     {
         company_ID           = OperUtil.getCooki("companyID");
         this.companyID.Value = company_ID;
         this.member_ID.Value = Util.getMemberID();
         initData();
     }
     else
     {
         string userAgent = Request.UserAgent;
         if (userAgent.ToLower().Contains("micromessenger"))
         {
             Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
             return;
         }
     }
     if (!IsPostBack)
     {
         Response.Cache.SetNoStore();
         wxHelper wx  = new wxHelper(this.companyID.Value);
         string[] str = wx.GetWXInfo(this.Request.Url.ToString(), this.companyID.Value).Split(',');
         time    = str[0];
         randstr = str[1];
         signstr = str[2];
         this.member_ID.Value = Util.getMemberID();
     }
     try
     {
         if (OperUtil.getCooki("vshop_openID") != "0")
         {
             //获取公众号的appid
             string    sql = "select * from asm_company where id=" + this.companyID.Value;
             DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
             if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["appId"].ToString()))
             {
                 this.appID.Value = dt.Rows[0]["appId"].ToString();
                 app_id           = dt.Rows[0]["appId"].ToString();
             }
             this.member_ID.Value = Util.getMemberID();
         }
         else
         {
             string userAgent = Request.UserAgent;
             if (userAgent.ToLower().Contains("micromessenger"))
             {
                 Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
                 return;
             }
         }
     }
     catch
     {
         this.member_ID.Value = Util.getMemberID();
     }
 }
Beispiel #5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (OperUtil.getCooki("vshop_openID") != "0")
     {
         this.memberID.Value = Util.getMemberID();
     }
     else
     {
         Response.Write("<script>window.location.href=homeIndex.aspx</script>");
     }
     this.companyID.Value = OperUtil.getCooki("companyID");
 }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //查询该会员是否设置支付密码没有的话弹出提示框设置
         //companyID = Request.QueryString["companyID"].ToString();
         mechineID = Request.QueryString["mechineID"].ToString();
         string    sqlCC = "select companyID from asm_mechine where id='" + mechineID + "'";
         DataTable dcc   = DbHelperSQL.Query(sqlCC).Tables[0];
         companyID             = dcc.Rows[0]["companyID"].ToString();
         this._companyID.Value = companyID;
         this._mechineID.Value = mechineID;
         this._memberID.Value  = Util.getMemberID();
         if (OperUtil.getCooki("vshop_openID") != "0")
         {
             string    sql = "select * from asm_member where openID='" + OperUtil.getCooki("vshop_openID") + "' and companyID=" + companyID;
             DataTable dd  = DbHelperSQL.Query(sql).Tables[0];
             if (dd.Rows.Count <= 0)
             {
                 //判断是否关注
                 wxHelper wx = new wxHelper(companyID);
                 if (wx.Get_UserInfo(OperUtil.getCooki("vshop_openID")).subscribe == "1")
                 {
                     Response.Redirect("WXCallback.aspx?companyID=" + this._companyID.Value);
                 }
                 else
                 {
                     //没关注
                     string    sql1 = "select * from asm_company where id=" + companyID;
                     DataTable dt   = DbHelperSQL.Query(sql1).Tables[0];
                     url = @"https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=" + dt.Rows[0]["biz"].ToString() + "#wechat_redirect";
                     Response.Redirect(url);
                 }
             }
             else
             {
                 //正常已经关注的
             }
         }
         else
         {
             Response.Redirect("WXCallback.aspx?companyID=" + this._companyID.Value);
         }
     }
     catch
     {
         Response.Write("<span style='color:#FF0000;font-size:20px'>" + "参数有误,请重试" + "</span>");
     }
     //this._mechineID.Value = "25";
     //this._memberID.Value = "37";
 }
Beispiel #7
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (OperUtil.getCooki("vshop_openID") != "0")
     {
         this.memberID.Value = Util.getMemberID();
     }
     else
     {
         string userAgent = Request.UserAgent;
         if (userAgent.ToLower().Contains("micromessenger"))
         {
             Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
             return;
         }
     }
 }
Beispiel #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (OperUtil.getCooki("vshop_openID") != "0")
            {
                memberID = Util.getMemberID();
            }
            else
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                    return;
                }
            }
            this._companyID.Value = OperUtil.getCooki("companyID");
            this.member_ID.Value  = memberID;
            try
            {
                //获取会员信息
                string sqlM = "select * from asm_member where id=" + memberID;

                DataTable dm = DbHelperSQL.Query(sqlM).Tables[0];
                headURL = dm.Rows[0]["headurl"].ToString();
                ye      = dm.Rows[0]["AvailableMoney"].ToString();
                string    sql1 = "select * from asm_company where id=" + this._companyID.Value;
                DataTable d1   = DbHelperSQL.Query(sql1).Tables[0];
                companyName = d1.Rows[0]["name"].ToString();
                //订单生成
                pszq                   = Request.QueryString["pszq"].ToString();
                qsDate                 = Request.QueryString["qsDate"].ToString().Replace("/", "-");
                zdDate                 = Request.QueryString["zdDate"].ToString();
                psStr                  = Request.QueryString["psStr"].ToString();
                psfs                   = Request.QueryString["psfs"].ToString();
                selDate                = Request.QueryString["selDate"].ToString();
                orderNO                = Request.QueryString["orderNO"].ToString();
                productID              = Request.QueryString["productID"].ToString();
                mechineID              = Request.QueryString["mechineID"].ToString();
                createTime             = Request.QueryString["createTime"].ToString();
                yhfs                   = Request.QueryString["yhfs"].ToString();
                this.mechine_id.Value  = mechineID;
                this.product_id.Value  = productID;
                this._pszq.Value       = pszq;
                this._qsDate.Value     = qsDate;
                this._zdDate.Value     = zdDate;
                this._psStr.Value      = psStr;
                this._psfs.Value       = psfs;
                this._selDate.Value    = selDate;
                this._orderNO.Value    = orderNO;
                this._createTime.Value = createTime;
                this._fkzt.Value       = fkzt;
                this._yhfs.Value       = yhfs;
                syNum                  = pszq;
                string trxid = ConvertDateTimeToInt(DateTime.Now).ToString() + mechineID;
                this._trxid.Value = trxid;
                string    sql = "select * from asm_mechine where id=" + mechineID;
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    qhAddress = dt.Rows[0]["addres"].ToString();
                }
                string sqlkf = "select * from asm_opera where id=" + dt.Rows[0]["operaID"].ToString();
                phone = DbHelperSQL.Query(sqlkf).Tables[0].Rows[0]["linkphone"].ToString();
                //初始化商品
                string    sql11 = "select * from asm_product where productID=" + productID;
                DataTable dd    = DbHelperSQL.Query(sql11).Tables[0];
                if (dd.Rows.Count > 0)
                {
                    productName          = dd.Rows[0]["proName"].ToString();
                    this._proName.Value  = productName;
                    description          = dd.Rows[0]["description"].ToString();
                    half_price           = double.Parse(dd.Rows[0]["price2"].ToString()) / 2;
                    this.halfPrice.Value = half_price.ToString();
                    totalMoney           = (double.Parse(dd.Rows[0]["price2"].ToString()) * double.Parse(pszq)).ToString("f2");
                    if (yhfs.IndexOf('折') > -1)
                    {
                        string zk = yhfs.Replace("打", "").Replace("折", "");
                        totalMoney = (double.Parse(totalMoney) * double.Parse(zk) / 10).ToString("f2");
                    }
                    httpImgUrl             = dd.Rows[0]["httpImageUrl"].ToString();
                    this._totalMoney.Value = totalMoney;
                }
                initData();
            }
            catch {
                if (OperUtil.getCooki("vshop_openID") != "0")
                {
                    this.member_ID.Value = Util.getMemberID();
                    memberID             = Util.getMemberID();
                }
                else
                {
                    string userAgent = Request.UserAgent;
                    if (userAgent.ToLower().Contains("micromessenger"))
                    {
                        Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                        return;
                    }
                }

                orderNO = Request.QueryString["orderNO"].ToString();

                string    sql2 = "select * from asm_order where memberID=" + memberID + " and orderNO='" + orderNO + "'";
                DataTable dt2  = DbHelperSQL.Query(sql2).Tables[0];
                if (dt2.Rows.Count > 0)
                {
                    syNum                  = dt2.Rows[0]["syNum"].ToString();
                    pszq                   = dt2.Rows[0]["zq"].ToString();
                    qsDate                 = dt2.Rows[0]["qsDate"].ToString();
                    zdDate                 = dt2.Rows[0]["zdDate"].ToString();
                    psStr                  = dt2.Rows[0]["psStr"].ToString();
                    psfs                   = dt2.Rows[0]["psfs"].ToString();
                    orderNO                = dt2.Rows[0]["orderNO"].ToString();
                    productID              = dt2.Rows[0]["productID"].ToString();
                    mechineID              = dt2.Rows[0]["mechineID"].ToString();
                    createTime             = dt2.Rows[0]["createTime"].ToString();
                    this.mechine_id.Value  = dt2.Rows[0]["mechineID"].ToString();
                    this.product_id.Value  = dt2.Rows[0]["productID"].ToString();
                    this._pszq.Value       = dt2.Rows[0]["zq"].ToString();
                    this._qsDate.Value     = dt2.Rows[0]["qsDate"].ToString();
                    this._zdDate.Value     = dt2.Rows[0]["zdDate"].ToString();
                    this._psStr.Value      = dt2.Rows[0]["psStr"].ToString();
                    this._psfs.Value       = dt2.Rows[0]["psfs"].ToString();
                    this._orderNO.Value    = dt2.Rows[0]["orderNO"].ToString();
                    this._createTime.Value = dt2.Rows[0]["createTime"].ToString();
                    this._fkzt.Value       = dt2.Rows[0]["fkzt"].ToString();

                    qhAddress = dt2.Rows[0]["qhAddress"].ToString();

                    string    sql12 = "select * from asm_mechine where id=" + mechineID;
                    DataTable dt    = DbHelperSQL.Query(sql12).Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        string sqlkf = "select * from asm_opera where id=" + dt.Rows[0]["operaID"].ToString();
                        phone = DbHelperSQL.Query(sqlkf).Tables[0].Rows[0]["linkphone"].ToString();
                    }

                    //初始化商品
                    string    sql1 = "select * from asm_product where productID=" + productID;
                    DataTable dd   = DbHelperSQL.Query(sql1).Tables[0];
                    if (dd.Rows.Count > 0)
                    {
                        productName            = dd.Rows[0]["proName"].ToString();
                        this._proName.Value    = productName;
                        description            = dd.Rows[0]["description"].ToString();
                        half_price             = double.Parse(dd.Rows[0]["price2"].ToString()) / 2;
                        httpImgUrl             = dd.Rows[0]["httpImageUrl"].ToString();
                        this.halfPrice.Value   = half_price.ToString();
                        totalMoney             = dt2.Rows[0]["totalMoney"].ToString();
                        this._totalMoney.Value = dt2.Rows[0]["totalMoney"].ToString();
                    }
                    //查询该订单的详细
                    string    sql = "select * from asm_orderDetail where orderNO='" + orderNO + "' and memberID=" + dt2.Rows[0]["memberID"].ToString();
                    DataTable ds  = DbHelperSQL.Query(sql).Tables[0];
                    if (ds.Rows.Count > 0)
                    {
                        string time = "";
                        for (int i = 0; i < ds.Rows.Count; i++)
                        {
                            time += ds.Rows[i]["createTime"].ToString() + ",";
                        }
                        time = time.Substring(0, time.Length - 1);
                        this._selDate.Value = time;
                        selDate             = time;
                    }
                    string    sql3 = "select * from asm_orderDetail where zt=3 and orderNO='" + orderNO + "' and memberID=" + dt2.Rows[0]["memberID"].ToString();
                    DataTable ds3  = DbHelperSQL.Query(sql3).Tables[0];
                    if (ds3.Rows.Count > 0)
                    {
                        string time = "";
                        for (int i = 0; i < ds3.Rows.Count; i++)
                        {
                            time += ds3.Rows[i]["createTime"].ToString() + ",";
                        }
                        time = time.Substring(0, time.Length - 1);
                        this._selDate.Value = time;
                        yzsDate             = time;
                    }
                    string    sql4 = "select * from asm_orderDetail where zt=2 and orderNO='" + orderNO + "' and memberID=" + dt2.Rows[0]["memberID"].ToString();
                    DataTable ds4  = DbHelperSQL.Query(sql4).Tables[0];
                    if (ds4.Rows.Count > 0)
                    {
                        string time = "";
                        for (int i = 0; i < ds4.Rows.Count; i++)
                        {
                            time += ds4.Rows[i]["createTime"].ToString() + ",";
                        }
                        time = time.Substring(0, time.Length - 1);
                        this._sxDate.Value = time;
                        sxDate             = time;
                    }
                    string    sql5 = "select * from asm_orderDetail where zt=1 and orderNO='" + orderNO + "' and memberID=" + dt2.Rows[0]["memberID"].ToString();
                    DataTable ds5  = DbHelperSQL.Query(sql5).Tables[0];
                    if (ds5.Rows.Count > 0)
                    {
                        string time = "";
                        for (int i = 0; i < ds5.Rows.Count; i++)
                        {
                            time += ds5.Rows[i]["createTime"].ToString() + ",";
                        }
                        time = time.Substring(0, time.Length - 1);
                        this._wcDate.Value = time;
                        wcDate             = time;
                    }
                    string    sql6 = "select * from asm_orderDetail where zt=4 and orderNO='" + orderNO + "' and memberID=" + dt2.Rows[0]["memberID"].ToString();
                    DataTable ds6  = DbHelperSQL.Query(sql6).Tables[0];
                    if (ds6.Rows.Count > 0)
                    {
                        string time = "";
                        for (int i = 0; i < ds6.Rows.Count; i++)
                        {
                            time += ds6.Rows[i]["createTime"].ToString() + ",";
                        }
                        time = time.Substring(0, time.Length - 1);
                        this._dqhDate.Value = time;
                        dqhDate             = time;
                    }
                    initData();
                }
            }
        }
Beispiel #9
0
        public static string setupOk(string phone, string memberID)
        {
            string sql1 = "select * from asm_member where id!='" + memberID + "' and phone='" + phone + "' and  companyID='" + OperUtil.getCooki("companyID") + "'";

            Util.Debuglog("sql1=" + sql1, "_修改手机号.txt");
            DataTable dt = DbHelperSQL.Query(sql1).Tables[0];

            if (dt.Rows.Count > 0)
            {
                return("3");
            }
            string sql = "update asm_member set phone='" + phone + "' where id='" + memberID + "'";

            Util.Debuglog("update=" + sql, "_修改手机号.txt");
            int a = DbHelperSQL.ExecuteSql(sql);

            if (a > 0)
            {
                string    sql3 = "select * from asm_member where id='" + memberID + "'";
                DataTable dd   = DbHelperSQL.Query(sql3).Tables[0];
                if (dd.Rows.Count > 0)
                {
                    if (!dd.Rows[0]["certF"].ToString().Contains("phone"))
                    {
                        string sql2 = "update asm_member set certF=isnull(certF,'')+',phone' where id='" + memberID + "'";
                        DbHelperSQL.ExecuteSql(sql2);
                    }
                }
                return("1");
            }
            else
            {
                return("2");
            }
        }
Beispiel #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary <String, String> reqParams = new Dictionary <String, String>();

            /**
             * 此处注意,因为通联收银宝以后可能增加字段,所以,这里一定要动态遍历获取所有的请求参数
             *
             * */
            for (int i = 0; i < Request.Form.Count; i++)
            {
                reqParams.Add(Request.Form.Keys[i], Request.Form[i].ToString());
            }
            if (!reqParams.ContainsKey("sign"))//如果不包含sign,则不进行处理
            {
                Response.Write("error");
                return;
            }
            if (reqParams.ContainsKey("trxid"))
            {
                string  json = (new JavaScriptSerializer()).Serialize(reqParams);
                JObject jo   = (JObject)JsonConvert.DeserializeObject(json);
                string  sql  = "select p.trxid,p.activityID,o.productID,p.unionID,p.companyID,o.activityID acID,o.psMode,o.startTime,o.mechineID,o.memberID,o.orderNO,o.companyID,o.totalNum,o.source  from asm_pay_info p left join asm_orderlist o on p.trxid=o.trxid"
                               + " where p.trxid = '" + jo["trxid"] + "' and o.trxid = '" + jo["trxid"] + "' and statu = 0";
                DataTable dtInfo = DbHelperSQL.Query(sql).Tables[0];
                if (dtInfo.Rows.Count > 0)
                {
                    string    sql111          = "select top 1 * from asm_duihuan  where newOrderNo='" + dtInfo.Rows[0]["orderNO"].ToString() + "'    order by dhTime desc ";
                    DataTable asm_duihuanInfo = DbHelperSQL.Query(sql111).Tables[0];
                    if (asm_duihuanInfo.Rows.Count > 0 && (!string.IsNullOrEmpty(asm_duihuanInfo.Rows[0]["oldOrderNo"].ToString())))
                    {
                        Util.Debuglog("sql111=" + sql111, "dhProduct.txt");
                        List <string> list = new List <string>();
                        string        sql2 = "update asm_orderlist set orderZT=4 where orderNO='" + asm_duihuanInfo.Rows[0]["oldOrderNo"].ToString() + "'";
                        string        sql3 = "update asm_orderlistDetail set zt=7 where  zt=5 and orderNO='" + asm_duihuanInfo.Rows[0]["oldOrderNo"].ToString() + "'";
                        list.Add(sql2);
                        list.Add(sql3);
                        Util.Debuglog("list=" + sql2 + sql3, "dhProduct.txt");
                        int a = DbHelperSQL.ExecuteSqlTran(list);
                    }
                    string trxdate   = Request.Form["trxdate"];
                    string paytime   = Request.Form["paytime"];
                    string acct      = Request.Form["acct"];
                    string chnltrxid = Request.Form["chnltrxid"];
                    double trxamtY   = double.Parse(Request.Form["trxamt"]) / 100;
                    //更新asm_pay_info asm_orderlist支付状态
                    string update1 = "update asm_pay_info set statu=1,paytime='" + paytime + "',productID='" + dtInfo.Rows[0]["productID"].ToString() + "',mechineID='" + dtInfo.Rows[0]["mechineID"].ToString() + "' where trxid='" + jo["trxid"].ToString() + "'";
                    DbHelperSQL.ExecuteSql(update1);
                    string update2 = "update asm_orderlist set fkzt=1  where trxid='" + jo["trxid"].ToString() + "'";
                    DbHelperSQL.ExecuteSql(update2);
                    //需要更新会员的消费信息
                    string update = "update asm_member set sumConsume=sumConsume+" + trxamtY + ",LastTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',mechineID='" + dtInfo.Rows[0]["mechineID"].ToString() + "' where minOpenID='" + acct + "'";
                    DbHelperSQL.ExecuteSql(update);

                    string sqlActivity = "select * from asm_activity where status=1 and id=" + dtInfo.Rows[0]["activityID"].ToString();
                    //DataTable dactivity = DbHelperSQL.Query(sqlActivity).Tables[0];



                    string[] selDate = OperUtil.getSelDate(dtInfo.Rows[0]["totalNum"].ToString(), dtInfo.Rows[0]["psMode"].ToString(), dtInfo.Rows[0]["startTime"].ToString()).Split(',');
                    if (selDate.Length > 0)
                    {
                        DataTable dtNew;
                        for (int j = 0; j < dtInfo.Rows.Count; j++)
                        {
                            string sql14 = "select * from asm_orderlistDetail where id=0";
                            dtNew = DbHelperSQL.Query(sql14).Tables[0];

                            for (int i = 0; i < selDate.Length; i++)
                            {
                                int code = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999);
                                //zt   1-已完成;2-已失效;3-已转售;4-待取货;5-待配送
                                DataRow dr = dtNew.NewRow();
                                dr["mechineID"]  = dtInfo.Rows[j]["mechineID"].ToString(); //通过索引赋值
                                dr["productID"]  = dtInfo.Rows[j]["productID"].ToString();
                                dr["createTime"] = delTime(selDate[i]);                    //
                                //dr["code"] = code;//
                                dr["memberID"] = dtInfo.Rows[j]["memberID"].ToString();    //通过索引赋值
                                if (delTime(selDate[i]) == DateTime.Now.ToString("yyyy-MM-dd"))
                                {
                                    dr["zt"]   = "4";
                                    dr["code"] = code;//
                                }
                                else
                                {
                                    dr["zt"] = "5";
                                }

                                dr["ldNO"]      = "";                                   //
                                dr["orderNO"]   = dtInfo.Rows[j]["orderNO"].ToString(); //
                                dr["statu"]     = "0";                                  //通过索引赋值
                                dr["sellPrice"] = 0.0;
                                dr["sellTime"]  = "";
                                dr["bz"]        = "";
                                dr["companyID"] = dtInfo.Rows[j]["companyID"].ToString();
                                dtNew.Rows.Add(dr);
                            }
                            DbHelperSQL.BatchInsertBySqlBulkCopy(dtNew, "[dbo].[asm_orderlistDetail]");
                            string    sql1 = "select * from asm_orderlistDetail where orderNO in ('" + dtInfo.Rows[j]["orderNO"].ToString() + "') ORDER BY createTime DESC ";
                            DataTable d1   = DbHelperSQL.Query(sql1).Tables[0];
                            if (d1.Rows.Count > 0)
                            {
                                string update12 = "UPDATE asm_orderlist set endTime='" + d1.Rows[0]["createTime"].ToString() + "' WHERE orderNO in ('" + dtInfo.Rows[j]["orderNO"].ToString() + "')";
                                DbHelperSQL.ExecuteSql(update12);
                            }
                            if (dtInfo.Rows[j]["startTime"].ToString() == DateTime.Now.ToString("yyyy-MM-dd"))
                            {
                                string updagte = "UPDATE asm_orderlist set orderzt=1 where orderno='" + dtInfo.Rows[j]["orderNO"].ToString() + "'";
                                DbHelperSQL.ExecuteSql(updagte);
                            }
                        }
                    }


                    if (dtInfo.Rows[0]["source"].ToString() != "1")
                    {
                        Util.growUpMemberBYDG(acct, int.Parse(dtInfo.Rows[0]["totalNum"].ToString()) * dtInfo.Rows.Count, dtInfo.Rows[0]["companyID"].ToString());
                    }

                    //发送模板消息
                    string    sqlM = "select * from asm_member where minOpenID='" + acct + "'";
                    DataTable dM   = DbHelperSQL.Query(sqlM).Tables[0];
                    //插入参加的活动记录
                    string activityID = dtInfo.Rows[0]["activityID"].ToString();
                    //兑换的产品不在继续参加活动source!=1
                    if (!string.IsNullOrEmpty(activityID) && dtInfo.Rows[0]["source"].ToString() != "1")
                    {
                        string    sqlAc = "select * from asm_activity where statu=1 and id='" + activityID + "'";
                        DataTable dac   = DbHelperSQL.Query(sqlAc).Tables[0];
                        if (dac.Rows.Count > 0)
                        {
                            string status = "1";
                            if (dac.Rows[0]["type"].ToString() == "3")
                            {
                                status = "0";
                            }
                            else
                            {
                                try
                                {
                                    //发通知
                                    if (!string.IsNullOrEmpty(dM.Rows[0]["openID"].ToString()))
                                    {
                                        string   companyID = dM.Rows[0]["companyID"].ToString();
                                        string   openID    = dM.Rows[0]["openID"].ToString();
                                        wxHelper wx        = new wxHelper(companyID);
                                        string   data      = TemplateMessage.getPrize(openID, "hPFDCcfuANnDAGaIaAjsAnDKfgFXK-Y0SYGK12iIsAM", "活动奖励通知", dac.Rows[0]["payName"].ToString(), dac.Rows[0]["tag"].ToString(), "请尽快到小程序查看奖励");
                                        TemplateMessage.SendTemplateMsg(wx.IsExistAccess_Token(dM.Rows[0]["companyID"].ToString()), data);
                                    }
                                }
                                catch { }
                            }
                            string zsType        = dac.Rows[0]["type"].ToString();
                            string sqlActivityIn = "insert into asm_partActivity(memberID,partTime,type,activityContent,companyID,zsType,status,activityName,totalMoney) values('" + dtInfo.Rows[0]["memberID"].ToString() + "','" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',1,'" + dac.Rows[0]["activitytag"].ToString() + "','" + dac.Rows[0]["companyID"].ToString() + "'," + zsType + "," + status + ",'" + dac.Rows[0]["activityname"].ToString() + "'," + trxamtY + ")";
                            DbHelperSQL.ExecuteSql(sqlActivityIn);
                        }
                    }

                    if (dM.Rows.Count > 0)
                    {
                        if (!string.IsNullOrEmpty(dM.Rows[0]["openID"].ToString()))
                        {
                            string    openID    = dM.Rows[0]["openID"].ToString();
                            string    companyID = dM.Rows[0]["companyID"].ToString();
                            string    sqlp      = "select o.*,p.proName from asm_orderlist o left join asm_product p on o.productID=p.productID where trxid='" + jo["trxid"].ToString() + "'";
                            DataTable dp        = DbHelperSQL.Query(sqlp).Tables[0];
                            wxHelper  wx        = new wxHelper(companyID);
                            string    data      = TemplateMessage.comsume(openID, OperUtil.getMessageID(companyID, "OPENTM401313503"), "亲,你的购买的商品信息如下",
                                                                          "" + dp.Rows[0]["proName"].ToString() + "", dp.Rows[0]["totalMoney"].ToString(), dp.Rows[0]["orderNO"].ToString(), dp.Rows[0]["mechineName"].ToString(), "“生鲜时逐”订奶订单已生成,鲜活即将配送到家");
                            TemplateMessage.SendTemplateMsg(wx.IsExistAccess_Token(OperUtil.getCooki("companyID")), data);
                        }
                    }
                }
            }
        }
Beispiel #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                openID              = Request.QueryString["openID"].ToString();
                companyID           = Request.QueryString["companyID"].ToString();
                money               = Request.QueryString["money"].ToString();
                dzMoney             = Request.QueryString["dzMoney"].ToString();
                this._money.Value   = money;
                this._dzMOney.Value = dzMoney;

                JsApiPay jsApiPayGet = new JsApiPay(this);
                try
                {
                    if (OperUtil.getCooki("vshop_openID") != "0")
                    {
                        this._companyID.Value = Request.QueryString["companyID"].ToString();
                        this._openID.Value    = OperUtil.getCooki("vshop_openID");
                        openID = OperUtil.getCooki("vshop_openID");
                    }
                    else
                    {
                        string userAgent = Request.UserAgent;
                        if (userAgent.ToLower().Contains("micromessenger"))
                        {
                            Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                            return;
                        }
                    }

                    int fen = 0;
                    try
                    {
                        fen = int.Parse(money) * 100;
                        //获取收货地址js函数入口参数
                        this._openID.Value = openID;
                        string                      url        = "https://wx.bingoseller.com/pay/Notify.aspx";
                        SybWxPayService             sybService = new SybWxPayService(companyID);
                        Dictionary <String, String> rsp        = sybService.pay(fen, DateTime.Now.ToFileTime().ToString(), "W02", "会员充值", "备注", openID, "", url, "");
                        string                      json       = (new JavaScriptSerializer()).Serialize(rsp);
                        Util.Debuglog("json=" + json, "_充值日志.txt");
                        JObject jo = (JObject)JsonConvert.DeserializeObject(json);
                        if (jo["retcode"].ToString() == "SUCCESS")
                        {
                            string appid = jo["appid"].ToString();
                            string cusid = jo["cusid"].ToString();
                            string trxid = jo["trxid"].ToString();
                            string reqsn = jo["reqsn"].ToString();
                            //插入预订单信息 为了避免插入失败循环插入5次
                            for (int i = 0; i < 10; i++)
                            {
                                string    sql = "select * from asm_pay_info where trxid='" + trxid + "'";
                                DataTable ds  = DbHelperSQL.Query(sql).Tables[0];
                                if (ds.Rows.Count <= 0)
                                {
                                    string insertSQL = @"insert into asm_pay_info(appid,cusid,trxid,acct,statu,reqsn,[type],payType,trxamt,dzMoney)
                                            values('" + appid + "','" + cusid + "','" + trxid + "','" + openID + "','0','" + reqsn + "',1,3," + fen + "," + dzMoney + ")";
                                    Util.Debuglog("insertSQL=" + insertSQL, "_充值日志.txt");
                                    DbHelperSQL.ExecuteSql(insertSQL);
                                }
                                else
                                {
                                    break;
                                }
                                Thread.Sleep(300);
                            }
                        }
                        foreach (var item in rsp)
                        {
                            if (item.Key == "payinfo")
                            {
                                wxJsApiParam = item.Value;
                            }
                        }
                    }
                    catch {
                        Response.Write("<span style='color:#FF0000;font-size:20px'>" + "金额有误,请重试" + "</span>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + "</span>");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (OperUtil.getCooki("vshop_openID") != "0")
            {
                memberID = Util.getMemberID();
            }
            else
            {
                string userAgent = Request.UserAgent;
                if (userAgent.ToLower().Contains("micromessenger"))
                {
                    Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                    return;
                }
            }

            pszq       = Request.QueryString["pszq"].ToString();
            qsDate     = Request.QueryString["qsDate"].ToString().Replace("/", "-");
            zdDate     = Request.QueryString["zdDate"].ToString();
            psStr      = Request.QueryString["psStr"].ToString();
            psfs       = Request.QueryString["psfs"].ToString();
            selDate    = Request.QueryString["selDate"].ToString();
            orderNO    = Request.QueryString["orderNO"].ToString();;
            productID  = Request.QueryString["productID"].ToString();
            mechineID  = Request.QueryString["mechineID"].ToString();
            createTime = Request.QueryString["createTime"].ToString();
            yhfs       = Request.QueryString["yhfs"].ToString();

            //验证单号是否存在没有添加
            if (!IsPostBack)
            {
                string    sql = "select * from asm_order where orderNO='" + orderNO + "'";
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                if (dt.Rows.Count <= 0)
                {
                    string    sqlMechine = "select * from asm_mechine where id='" + mechineID + "'";
                    DataTable dm         = DbHelperSQL.Query(sqlMechine).Tables[0];
                    if (dm.Rows.Count > 0)
                    {
                        //计算总金额
                        string    sql11 = "select * from asm_product where productID=" + productID;
                        DataTable dd    = DbHelperSQL.Query(sql11).Tables[0];
                        if (dd.Rows.Count > 0)
                        {
                            totalMoney = (double.Parse(dd.Rows[0]["price2"].ToString()) * double.Parse(pszq)).ToString("f2");
                            if (yhfs.IndexOf('折') > -1)
                            {
                                string zk = yhfs.Replace("打", "").Replace("折", "");
                                totalMoney = (double.Parse(totalMoney) * double.Parse(zk) / 10).ToString("f2");
                            }
                        }

                        //添加订单
                        string sql1 = "insert into asm_order(mechineID,productID,memberID,totalNum,consumeNum,syNum,createTime,zq,qsDate,zdDate,psStr,psfs,orderNO,fkzt,zt,qhAddress,totalMoney,yhfs)"
                                      + "values('" + mechineID + "','" + productID + "','" + memberID + "'," + pszq + ",0," + pszq + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + pszq + ",'" + qsDate + "','" + zdDate + "','" + psStr + "','" + psfs + "','" + orderNO + "',0,0,'" + dm.Rows[0]["addres"].ToString() + "'," + totalMoney + ",'" + yhfs + "')";
                        int a = DbHelperSQL.ExecuteSql(sql1);
                        if (a > 0)
                        {
                            //订单添加成功  此处没有往订单明细表生成记录
                        }
                    }
                }
            }
        }
Beispiel #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //支付信息

                this._orderNO.Value    = Request.QueryString["orderNO"].ToString();
                this._syMoney.Value    = Request.QueryString["syMoney"].ToString();
                this._need_money.Value = Request.QueryString["need_money"].ToString();//实际花费
                this._zq.Value         = Request.QueryString["zq"].ToString();
                this._productID.Value  = Request.QueryString["productID"].ToString();
                this._yhfs.Value       = Request.QueryString["yhfs"].ToString();
                this._mechineID.Value  = Request.QueryString["mechineID"].ToString();
                string sql = "select * from asm_mechine where id=" + this._mechineID.Value;

                DataTable dt = DbHelperSQL.Query(sql).Tables[0];
                companyID = dt.Rows[0]["companyID"].ToString();
                money     = this._need_money.Value;
                string sqlpro = "select * from asm_product where productID=" + this._productID.Value;
                proname = DbHelperSQL.Query(sqlpro).Tables[0].Rows[0]["proName"].ToString();

                JsApiPay jsApiPayGet = new JsApiPay(this);
                try
                {
                    if (OperUtil.getCooki("vshop_openID") != "0")
                    {
                        this._companyID.Value = OperUtil.getCooki("companyID");
                        this._openID.Value    = OperUtil.getCooki("vshop_openID");
                        openID = OperUtil.getCooki("vshop_openID");
                    }
                    else
                    {
                        string userAgent = Request.UserAgent;
                        if (userAgent.ToLower().Contains("micromessenger"))
                        {
                            Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                            return;
                        }
                    }
                    double fen = 0;
                    try
                    {
                        fen = (double.Parse(money) - double.Parse(this._syMoney.Value)) * 100;
                        //获取收货地址js函数入口参数
                        this._openID.Value = openID;
                        string                      url        = "https://wx.bingoseller.com/pay/dhpayNotify.aspx";
                        SybWxPayService             sybService = new SybWxPayService(companyID);
                        Dictionary <String, String> rsp        = sybService.pay((int)fen, DateTime.Now.ToFileTime().ToString(), "W02", "会员商品兑换", proname, openID, "", url, "");
                        string                      json       = (new JavaScriptSerializer()).Serialize(rsp);
                        JObject                     jo         = (JObject)JsonConvert.DeserializeObject(json);
                        if (jo["retcode"].ToString() == "SUCCESS")
                        {
                            string appid = jo["appid"].ToString();
                            string cusid = jo["cusid"].ToString();
                            string trxid = jo["trxid"].ToString();
                            string reqsn = jo["reqsn"].ToString();
                            this._trxid.Value = trxid;
                            // //插入预订单信息
                            string insertSQL = @"insert into asm_pay_info(appid,cusid,trxid,acct,statu,reqsn,[type],payType,trxamt)
                                            values('" + appid + "','" + cusid + "','" + trxid + "','" + openID + "','0','" + reqsn + "',2,3," + fen + ")";
                            DbHelperSQL.ExecuteSql(insertSQL);
                        }
                        foreach (var item in rsp)
                        {
                            if (item.Key == "payinfo")
                            {
                                wxJsApiParam = item.Value;
                            }
                        }
                    }
                    catch
                    {
                        Response.Write("<span style='color:#FF0000;font-size:20px'>" + "金额有误,请重试" + "</span>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + "</span>");
                }
            }
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //支付信息
                this.mechine_id.Value = Request.QueryString["mechine_id"].ToString();
                this.product_id.Value = Request.QueryString["product_id"].ToString();
                Util.Debuglog("机器id=" + this.mechine_id.Value + ";产品id=" + this.product_id.Value + ";", "会员下订单.txt");
                this._pszq.Value = Request.QueryString["_pszq"].ToString();
                Util.Debuglog("配送周期=" + this._pszq.Value, "会员下订单.txt");
                this._qsDate.Value = Request.QueryString["_qsDate"].ToString();
                Util.Debuglog("起送周期=" + this._qsDate.Value, "会员下订单.txt");
                this._zdDate.Value = Request.QueryString["_zdDate"].ToString();
                Util.Debuglog("止订周期=" + this._zdDate.Value, "会员下订单.txt");
                this._psStr.Value = Request.QueryString["_psStr"].ToString();
                Util.Debuglog("配送方式_psStr=" + this._psStr.Value, "会员下订单.txt");
                this._psfs.Value = Request.QueryString["_psfs"].ToString();
                Util.Debuglog("_psfs=" + this._psfs.Value, "会员下订单.txt");
                //this._selDate.Value = Request.QueryString["_selDate"].ToString();
                //Util.Debuglog("_selDate=" + this._selDate.Value, "会员下订单.txt");
                this._orderNO.Value = Request.QueryString["_orderNO"].ToString();
                Util.Debuglog("_orderNO=" + this._orderNO.Value, "会员下订单.txt");
                this._createTime.Value = Request.QueryString["_createTime"].ToString();
                Util.Debuglog("_createTime=" + this._createTime.Value, "会员下订单.txt");
                this._fkzt.Value = Request.QueryString["_fkzt"].ToString();
                Util.Debuglog("_fkzt=" + this._fkzt.Value, "会员下订单.txt");
                this._totalMoney.Value = Request.QueryString["_totalMoney"].ToString();
                Util.Debuglog("_totalMoney=" + this._totalMoney.Value, "会员下订单.txt");
                this._yhfs.Value = Request.QueryString["_yhfs"].ToString();
                Util.Debuglog("_yhfs=" + this._yhfs.Value, "会员下订单.txt");

                string    sql = "select * from asm_mechine where id=" + this.mechine_id.Value;
                DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                companyID = dt.Rows[0]["companyID"].ToString();
                money     = Request.QueryString["money"].ToString();
                proname   = Request.QueryString["proname"].ToString();
                JsApiPay jsApiPayGet = new JsApiPay(this);
                try
                {
                    if (OperUtil.getCooki("vshop_openID") != "0")
                    {
                        this._companyID.Value = Request.QueryString["companyID"].ToString();
                        this._openID.Value    = OperUtil.getCooki("vshop_openID");
                        openID = OperUtil.getCooki("vshop_openID");
                    }
                    else
                    {
                        string userAgent = Request.UserAgent;
                        if (userAgent.ToLower().Contains("micromessenger"))
                        {
                            Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                            return;
                        }
                    }
                    double fen = 0;
                    try
                    {
                        fen = double.Parse(money) * 100;

                        //获取收货地址js函数入口参数
                        this._openID.Value = openID;
                        Util.Debuglog("openID=" + openID + ":companyID=" + companyID + "fen=" + fen, "微信支付.txt");
                        string          url        = "https://wx.bingoseller.com/pay/OrderNotify.aspx";
                        SybWxPayService sybService = new SybWxPayService(companyID);
                        Util.Debuglog("111=", "微信支付.txt");
                        Dictionary <String, String> rsp = sybService.pay((int)fen, DateTime.Now.ToFileTime().ToString(), "W02", "会员购物", proname, openID, "", url, "");
                        Util.Debuglog("rsp=" + rsp, "微信支付.txt");
                        string json = (new JavaScriptSerializer()).Serialize(rsp);
                        Util.Debuglog("json=" + json, "微信支付.txt");
                        JObject jo = (JObject)JsonConvert.DeserializeObject(json);

                        if (jo["retcode"].ToString() == "SUCCESS")
                        {
                            string appid = jo["appid"].ToString();
                            string cusid = jo["cusid"].ToString();
                            string trxid = jo["trxid"].ToString();
                            string reqsn = jo["reqsn"].ToString();
                            this._trxid.Value = trxid;
                            //插入预订单信息
                            string insertSQL = @"insert into asm_pay_info(appid,cusid,trxid,acct,statu,reqsn,type,payType,trxamt)
                                            values('" + appid + "','" + cusid + "','" + trxid + "','" + openID + "','0','" + reqsn + "',2,3," + fen + ")";
                            Util.Debuglog("insertSQL=" + insertSQL, "微信支付.txt");
                            //根据订单编号更新 订单表  在回调方法里添加订单明细记录
                            string update = "update asm_order set trxID='" + trxid + "' where orderNO='" + this._orderNO.Value + "'";
                            Util.Debuglog("update11111=" + update, "_11.txt");
                            DbHelperSQL.ExecuteSql(insertSQL);
                            DbHelperSQL.ExecuteSql(update);
                        }
                        foreach (var item in rsp)
                        {
                            if (item.Key == "payinfo")
                            {
                                wxJsApiParam = item.Value;
                                Util.Debuglog("wxJsApiParam=" + wxJsApiParam, "微信下单支付_.txt");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Util.Debuglog("ex错误=" + ex.Message, "微信支付.txt");
                        Response.Write("<span style='color:#FF0000;font-size:20px'>" + "金额有误,请重试" + "</span>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + "</span>");
                }
            }
        }
Beispiel #15
0
        public void createOrder(HttpContext context)
        {
            string mechine_id = context.Request["mechine_id"].ToString();

            Util.Debuglog("mechine_id=" + mechine_id, "_.参数.txt");
            string product_id = context.Request["product_id"].ToString();

            Util.Debuglog("product_id=" + product_id, "_.参数.txt");

            string _orderNO = context.Request["_orderNO"].ToString();

            Util.Debuglog("_orderNO=" + _orderNO, "_.参数.txt");

            string _totalMoney = context.Request["_totalMoney"].ToString();

            Util.Debuglog("_totalMoney=" + _totalMoney, "_.参数.txt");

            string _trxID = context.Request["_trxID"].ToString();

            Util.Debuglog("_trxID=" + _trxID, "_.参数.txt");

            string memberID = Util.getMemberID();

            if (memberID == "0")
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"result\":\"3\""); //当前没有登录
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());

                return;
            }
            //根据机器id获取机器地址
            string    sql1 = "select * from asm_mechine where id=" + mechine_id;
            DataTable dt   = DbHelperSQL.Query(sql1).Tables[0];

            string sql12 = "select * from asm_order where orderNO='" + _orderNO + "'";

            DataTable d12 = DbHelperSQL.Query(sql12).Tables[0];

            if (d12.Rows.Count <= 0)
            {
            }
            else
            {
                //判断当前的优惠方式如果是赠送天数的话需要更新totalNum
                if (d12.Rows[0]["yhfs"].ToString().Contains("赠送"))
                {
                    string num = d12.Rows[0]["yhfs"].ToString();
                    num = num.Replace("赠送", "").Replace("天", "");
                    string update = "update asm_order set fkzt=1,trxID='" + _trxID + "',totalNum=totalNum+" + num + ",syNum=syNum+" + num + " where id=" + d12.Rows[0]["id"].ToString();
                    DbHelperSQL.ExecuteSql(update);
                }
                else
                {
                    string update = "update asm_order set fkzt=1,trxID='" + _trxID + "' where id=" + d12.Rows[0]["id"].ToString();
                    DbHelperSQL.ExecuteSql(update);
                }
                //更新状态
            }
            if (1 == 1)
            {
                d12 = DbHelperSQL.Query(sql12).Tables[0];
                //更新商品销售数量
                string ss = "update asm_product set ljxs=CONVERT(float,ISNULL(ljxs,0))+1 where productID=" + product_id;
                DbHelperSQL.ExecuteSql(ss);
                //string[] selDate = _selDate.Split(',');

                string[] selDate = insertIntoOrderDetail(d12.Rows[0]["psfs"].ToString(), d12.Rows[0]["psStr"].ToString(), d12.Rows[0]["totalNum"].ToString(), d12.Rows[0]["qsDate"].ToString()).Split(',');

                Util.Debuglog(insertIntoOrderDetail(d12.Rows[0]["psfs"].ToString(), d12.Rows[0]["psStr"].ToString(), d12.Rows[0]["totalNum"].ToString(), d12.Rows[0]["qsDate"].ToString()), "时间格式.txt");
                if (selDate.Length > 0)
                {
                    string    sql14 = "select * from asm_orderDetail where id=0";
                    DataTable dtNew = DbHelperSQL.Query(sql14).Tables[0];
                    for (int i = 0; i < selDate.Length; i++)
                    {
                        int code = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999);
                        //zt   1-已完成;2-已失效;3-已转售;4-待取货;5-待配送
                        DataRow dr = dtNew.NewRow();
                        dr["mechineID"]  = mechine_id;          //通过索引赋值
                        dr["productID"]  = product_id;
                        dr["createTime"] = delTime(selDate[i]); //
                        dr["code"]       = code;                //
                        dr["memberID"]   = memberID;            //通过索引赋值
                        dr["zt"]         = "5";
                        dr["ldNO"]       = "";                  //
                        dr["orderNO"]    = _orderNO;            //
                        dr["statu"]      = "0";                 //通过索引赋值
                        dr["sellPrice"]  = 0.0;
                        dr["sellTime"]   = "";
                        dr["bz"]         = "";
                        dtNew.Rows.Add(dr);
                    }
                    DbHelperSQL.BatchInsertBySqlBulkCopy(dtNew, "[dbo].[asm_orderDetail]");
                }
                //给会员绑定机器
                string sql4 = "update asm_member set mechineID=" + mechine_id + ",LastTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',consumeCount=consumeCount+1,sumConsume=sumConsume+" + _totalMoney + " where id=" + memberID;
                Util.Debuglog("会员绑定机器=" + sql4, "_.插入订购订单.txt");
                DbHelperSQL.ExecuteSql(sql4);
                string    sql5    = "select * from asm_product where productID=" + product_id;
                DataTable dd5     = DbHelperSQL.Query(sql5).Tables[0];
                Thread    threadB = new Thread(
                    () =>
                {
                    wxHelper wx = new wxHelper(OperUtil.getCooki("companyID"));
                    string data = TemplateMessage.comsume(OperUtil.getCooki("vshop_openID"), "ti4Dkcm1ELNqaskSYsCYMzqL87nPqapNeOgwhvSci_Q", "亲,你的购买的商品信息如下", "" + dd5.Rows[0]["proName"].ToString() + "", _totalMoney, _orderNO, dt.Rows[0]["bh"].ToString(), "欢迎惠顾");
                    TemplateMessage.SendTemplateMsg(wx.IsExistAccess_Token(OperUtil.getCooki("companyID")), data);
                });
                threadB.Start();
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"result\":\"4\""); //订单提交成功
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
            else
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("{");
                stringBuilder.Append("\"result\":\"2\""); //订单提交失败
                stringBuilder.Append("}");
                context.Response.Write(stringBuilder.ToString());
            }
        }
Beispiel #16
0
        public static string dh(string orderNO, string syMoney, string need_money, string zq, string productID, string yhfs)
        {
            //1需要先把旧的的订单的状态更改为已兑换
            //2按照旧的订单的配送方式重新生成新的订单 2 天之后配送
            //3钱款多退少补
            //先判断当前状态不是完成的才可以兑换
            string    sql1 = "select * from asm_order where orderNO='" + orderNO + "' and zt in (0,1)";
            DataTable dt   = DbHelperSQL.Query(sql1).Tables[0];

            if (dt.Rows.Count <= 0)
            {
                return("2");
            }
            string sql22 = "update asm_order set zt=4 where orderNO='" + orderNO + "'";

            DbHelperSQL.ExecuteSql(sql22);
            string sql = "update asm_orderDetail set zt=7 where orderNO='" + orderNO + "' and zt=5";

            DbHelperSQL.ExecuteSql(sql);
            if (dt.Rows.Count > 0)
            {
                string   sellDate = insertIntoOrderDetail(dt.Rows[0]["psfs"].ToString(), dt.Rows[0]["psStr"].ToString(), zq);
                string[] sellArr  = sellDate.Split(',');
                string   order_NO = ((DateTime.Now.ToUniversalTime().Ticks - 621355968000000000) / 10000).ToString();
                string   fkzt     = "1";
                //创建订单
                string sqlInsert = @"INSERT INTO [dbo].[asm_order](
                                                       [mechineID],
                                                       [productID],
                                                       [memberID],
                                                       [totalNum],
                                                       [consumeNum],
                                                       [syNum],
                                                       [createTime],
                                                       [zq],
                                                       [qsDate],
                                                       [zdDate],
                                                       [psStr],
                                                       [psfs],
                                                       [orderNO],
                                                       [fkzt],
                                                       [zt],
                                                       [qhAddress],
                                                       [totalMoney],
                                                       [yhfs])
                        VALUES(" + dt.Rows[0]["mechineID"].ToString() + "," + productID + "," + dt.Rows[0]["memberID"].ToString() + "," + zq + ",0," + zq + ",'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'," + zq + ",'" + DateTime.Now.ToString("yyyy-MM-dd") + "','" + sellArr[sellArr.Length - 1] + "','" + dt.Rows[0]["psStr"].ToString() + "'," + dt.Rows[0]["psfs"].ToString() + ",'" + order_NO + "'," + fkzt + ",0,'" + dt.Rows[0]["qhAddress"].ToString() + "'," + need_money + ",'" + yhfs + "')";
                int    a         = DbHelperSQL.ExecuteSql(sqlInsert);
                if (a > 0)
                {
                    //更新商品销售数量
                    string ss = "update asm_product set ljxs=CONVERT(float,ISNULL(ljxs,0))+1 where productID=" + productID;
                    DbHelperSQL.ExecuteSql(ss);
                    string[] selDate = sellArr;
                    if (selDate.Length > 0)
                    {
                        for (int i = 0; i < selDate.Length; i++)
                        {
                            int code = new Random(Guid.NewGuid().GetHashCode()).Next(100000, 999999);
                            //zt   1-已完成;2-已失效;3-已转售;4-待取货;5-待配送
                            string sql2 = @"INSERT INTO [dbo].[asm_orderDetail](
                                                    [mechineID],
                                                    [productID],
                                                    [createTime],
                                                    [code],
                                                    [memberID],
                                                    [zt],
                                                    [ldNO],
                                                    [orderNO],
                                                    [statu],
                                                    [sellPrice])
                                VALUES('" + dt.Rows[0]["mechineID"].ToString() + "','" + productID + "','" + selDate[i] + "','" + code + "'," + dt.Rows[0]["memberID"].ToString() + ",5,'','" + order_NO + "',0,0)";
                            DbHelperSQL.ExecuteSql(sql2);
                        }
                    }
                    //给会员绑定机器
                    string sql4 = "update asm_member set mechineID=" + dt.Rows[0]["mechineID"].ToString() + ",LastTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',consumeCount=consumeCount+1,sumConsume=sumConsume+" + need_money + " where id=" + dt.Rows[0]["memberID"].ToString();
                    DbHelperSQL.ExecuteSql(sql4);
                    string    sql5 = "select * from asm_product where productID=" + productID;
                    DataTable dd5  = DbHelperSQL.Query(sql5).Tables[0];
                    string    sql6 = "select * from asm_mechine where id=" + dt.Rows[0]["mechineID"].ToString();
                    DataTable dd6  = DbHelperSQL.Query(sql6).Tables[0];
                    wxHelper  wx   = new wxHelper(OperUtil.getCooki("companyID"));
                    string    data = TemplateMessage.comsume(OperUtil.getCooki("vshop_openID"), "ti4Dkcm1ELNqaskSYsCYMzqL87nPqapNeOgwhvSci_Q", "亲,你的购买的商品信息如下", "" + dd5.Rows[0]["proName"].ToString() + "", need_money, order_NO, dd6.Rows[0]["bh"].ToString(), "欢迎惠顾");
                    TemplateMessage.SendTemplateMsg(wx.IsExistAccess_Token(OperUtil.getCooki("companyID")), data);
                    //多退少补
                    if (double.Parse(need_money) < double.Parse(syMoney))
                    {
                        //退给会员钱包
                        string sqlUpdate = "update asm_member set AvailableMoney=AvailableMoney+" + (double.Parse(need_money) - double.Parse(syMoney)) + " where id=" + dt.Rows[0]["memberID"].ToString();
                        DbHelperSQL.ExecuteSql(sqlUpdate);
                    }
                }
            }
            return("1");
        }
Beispiel #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                idArr = Request.QueryString["idArr"].ToString();
                if (string.IsNullOrEmpty(idArr))
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "参数不全" + "</span>");
                    return;
                }
                this._id.Value = idArr;
                Util.Debuglog("_id=" + idArr, "联合支付.txt");
                //根据idArr循环订单列表
                string    sql = "select sum(totalMoney) totalMoney from asm_order where id in (" + idArr + ") and fkzt=0";
                DataTable ds  = DbHelperSQL.Query(sql).Tables[0];
                if (ds.Rows.Count > 0)
                {
                    money = ds.Rows[0]["totalMoney"].ToString();
                }

                JsApiPay jsApiPayGet = new JsApiPay(this);
                try
                {
                    if (OperUtil.getCooki("vshop_openID") != "0")
                    {
                        this._companyID.Value = Request.QueryString["companyID"].ToString();
                        companyID             = this._companyID.Value;
                        this._openID.Value    = OperUtil.getCooki("vshop_openID");
                        openID = OperUtil.getCooki("vshop_openID");
                    }
                    else
                    {
                        string userAgent = Request.UserAgent;
                        if (userAgent.ToLower().Contains("micromessenger"))
                        {
                            Response.Redirect("WXCallback.aspx?companyID=" + OperUtil.getCooki("companyID"));
                            return;
                        }
                    }
                    double fen = 0;
                    try
                    {
                        fen = double.Parse(money) * 100;

                        //获取收货地址js函数入口参数
                        this._openID.Value = openID;
                        Util.Debuglog("openID=" + openID + ":companyID=" + companyID + "fen=" + fen, "联合支付.txt");
                        string          url        = "https://wx.bingoseller.com/pay/OrderNotify.aspx";
                        SybWxPayService sybService = new SybWxPayService(companyID);

                        Dictionary <String, String> rsp = sybService.pay((int)fen, DateTime.Now.ToFileTime().ToString(), "W02", "会员购物", "订单合并付款", openID, "", url, "");
                        Util.Debuglog("rsp=" + rsp, "联合支付.txt");
                        string json = (new JavaScriptSerializer()).Serialize(rsp);
                        Util.Debuglog("json=" + json, "联合支付.txt");
                        JObject jo = (JObject)JsonConvert.DeserializeObject(json);

                        if (jo["retcode"].ToString() == "SUCCESS")
                        {
                            string appid = jo["appid"].ToString();
                            string cusid = jo["cusid"].ToString();
                            string trxid = jo["trxid"].ToString();
                            string reqsn = jo["reqsn"].ToString();
                            this._trxid.Value = trxid;
                            // //插入预订单信息
                            string insertSQL = @"insert into asm_pay_info(appid,cusid,trxid,acct,statu,reqsn,[type],payType,trxamt)
                                            values('" + appid + "','" + cusid + "','" + trxid + "','" + openID + "','0','" + reqsn + "',2,3," + fen + ")";
                            Util.Debuglog("insertSQL=" + insertSQL, "联合支付.txt");
                            DbHelperSQL.ExecuteSql(insertSQL);
                        }
                        foreach (var item in rsp)
                        {
                            if (item.Key == "payinfo")
                            {
                                wxJsApiParam = item.Value;
                                Util.Debuglog("wxJsApiParam=" + wxJsApiParam, "联合支付.txt");
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Util.Debuglog("ex错误=" + ex.Message, "微信支付.txt");
                        Response.Write("<span style='color:#FF0000;font-size:20px'>" + "金额有误,请重试" + "</span>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("<span style='color:#FF0000;font-size:20px'>" + "页面加载出错,请重试" + "</span>");
                }
            }
        }
Beispiel #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                comid = Request.QueryString["companyID"].ToString();
                //comid = "13";
                OperUtil.setCooki("companyID", comid);
                this.companyID.Value = comid;
                Response.Cache.SetNoStore();
                if (OperUtil.getCooki("vshop_openID") != "0")
                {
                    string    sql3 = "select * from asm_member where openID='" + OperUtil.getCooki("vshop_openID") + "' and companyID=" + companyID.Value;
                    DataTable dd   = DbHelperSQL.Query(sql3).Tables[0];
                    if (dd.Rows.Count <= 0)
                    {
                        Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
                        return;
                    }
                    else
                    {
                        string sql4 = "update asm_member set LastTime='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "' where id=" + dd.Rows[0]["id"].ToString();
                        DbHelperSQL.ExecuteSql(sql4);
                    }
                    //获取公众号的appid
                    string    sql = "select * from asm_company where id=" + comid;
                    DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                    if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["appId"].ToString()))
                    {
                        this._jlc.Value  = dt.Rows[0]["jlc"].ToString();
                        this.appID.Value = dt.Rows[0]["appId"].ToString();
                        app_id           = dt.Rows[0]["appId"].ToString();
                        //app_id = OpenPFConfig.Appid;
                        if (dt.Rows[0]["p8"].ToString() != "")
                        {
                            this._url1.Value = "1";
                            this.url1.Src    = dt.Rows[0]["p8"].ToString();
                        }
                        if (dt.Rows[0]["p9"].ToString() != "")
                        {
                            this._url2.Value = "1";
                            this.url2.Src    = dt.Rows[0]["p9"].ToString();
                        }
                        if (dt.Rows[0]["p10"].ToString() != "")
                        {
                            this._url3.Value = "1";
                            this.url3.Src    = dt.Rows[0]["p10"].ToString();
                        }
                    }
                    this.memberID.Value = Util.getMemberID();
                    this._openID.Value  = OperUtil.getCooki("vshop_openID");
                }
                else
                {
                    Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
                }
                wxHelper wx  = new wxHelper(comid);
                string[] str = wx.GetWXInfo(this.Request.Url.ToString(), comid).Split(',');

                //this.ur.Value = this.Request.Url.ToString();
                //this.ticket.Value = wx.GetTicketPlat(comid);
                //this.te.Value = wx.IsExistAccess_Token(comid);
                time    = str[0];
                randstr = str[1];
                signstr = str[2];
                Util.Debuglog("time=" + time + ";randstr=" + randstr + ";signstr=" + signstr + ";url=" + this.Request.Url.ToString(), "微信参数.txt");
            }
            catch
            {
                comid = OperUtil.getCooki("companyID");
                this.companyID.Value = comid;
                Response.Cache.SetNoStore();
                if (OperUtil.getCooki("vshop_openID") != "0")
                {
                    string    sql3 = "select * from asm_member where openID='" + OperUtil.getCooki("vshop_openID") + "' and companyID=" + companyID.Value;
                    DataTable dd   = DbHelperSQL.Query(sql3).Tables[0];
                    if (dd.Rows.Count <= 0)
                    {
                        Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
                        return;
                    }
                    //获取公众号的appid
                    string    sql = "select * from asm_company where id=" + OperUtil.getCooki("companyID");
                    DataTable dt  = DbHelperSQL.Query(sql).Tables[0];
                    if (dt.Rows.Count > 0 && !string.IsNullOrEmpty(dt.Rows[0]["appId"].ToString()))
                    {
                        this.appID.Value = dt.Rows[0]["appId"].ToString();
                        app_id           = dt.Rows[0]["appId"].ToString();
                        //p_id = OpenPFConfig.Appid;
                        if (dt.Rows[0]["p8"].ToString() != "")
                        {
                            this._url1.Value = "1";
                            this.url1.Src    = dt.Rows[0]["p8"].ToString();
                        }
                        if (dt.Rows[0]["p9"].ToString() != "")
                        {
                            this._url2.Value = "1";
                            this.url2.Src    = dt.Rows[0]["p9"].ToString();
                        }
                        if (dt.Rows[0]["p10"].ToString() != "")
                        {
                            this._url3.Value = "1";
                            this.url3.Src    = dt.Rows[0]["p10"].ToString();
                        }
                    }
                    this.memberID.Value = Util.getMemberID();
                    this._openID.Value  = OperUtil.getCooki("vshop_openID");
                }
                else
                {
                    Response.Redirect("WXCallback.aspx?companyID=" + this.companyID.Value);
                }
                Response.Cache.SetNoStore();
                wxHelper wx = new wxHelper(OperUtil.getCooki("companyID"));
                this.companyID.Value = OperUtil.getCooki("companyID");;
                string[] str = wx.GetWXInfo(this.Request.Url.ToString(), OperUtil.getCooki("companyID")).Split(',');
                //this.ur.Value = this.Request.Url.ToString();
                //this.ticket.Value = wx.GetTicketPlat(OperUtil.getCooki("companyID"));
                //this.te.Value = wx.IsExistAccess_Token(OperUtil.getCooki("companyID"));
                time    = str[0];
                randstr = str[1];
                signstr = str[2];
                Util.Debuglog("2time=" + time + ";randstr=" + randstr + ";signstr=" + signstr + ";url=" + this.Request.Url.ToString(), "微信参数.txt");
            }
        }