示例#1
0
        public string travelending;   //目的地


        protected void Page_Load(object sender, EventArgs e)
        {
            lineid   = Request["lineid"].ConvertTo <int>(0);
            adultnum = Request["adultnum"].ConvertTo <int>(0);
            childnum = Request["childnum"].ConvertTo <int>(0);
            outdate  = Request["outdate"].ConvertTo <string>("");

            if (lineid != 0)
            {
                var prodata = new B2bComProData();
                var pro     = prodata.GetProById(lineid.ToString());

                if (pro != null)
                {
                    pro_name        = pro.Pro_name;
                    com_id          = pro.Com_id;
                    pro_state       = pro.Pro_state;
                    pro_Remark      = pro.Pro_Remark;
                    face_price      = pro.Face_price;
                    advise_price    = pro.Advise_price;
                    sms             = pro.Sms;
                    travelproductid = pro.Travelproductid;

                    //读取団期价格//根据实际选择的団期报价
                    B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), lineid);
                    if (linemode != null)
                    {
                        advise_price = linemode.Menprice;
                    }
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["id"].ConvertTo <int>(0);

            var ProData = new B2bComProData();
            var proinfo = ProData.GetProById(id.ToString());

            if (proinfo != null)
            {
                fproname = proinfo.Pro_name;
            }
        }
示例#3
0
        public int IsYouXiao        = 0; //产品是否可以提单
        protected void Page_Load(object sender, EventArgs e)
        {
            lineid   = Request["lineid"].ConvertTo <int>(0);
            adultnum = Request["adultnum"].ConvertTo <int>(0);
            childnum = Request["childnum"].ConvertTo <int>(0);
            outdate  = Request["outdate"].ConvertTo <string>("");

            //从cookie中得到微信号
            if (Request.Cookies["openid"] != null)
            {
                openid = Request.Cookies["openid"].Value;
            }


            if (lineid != 0)
            {
                var prodata = new B2bComProData();
                var pro     = prodata.GetProById(lineid.ToString());

                if (pro != null)
                {
                    int ordernum = adultnum + childnum;
                    IsYouXiao = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state, outdate, ordernum);

                    pro_name     = pro.Pro_name;
                    com_id       = pro.Com_id;
                    pro_state    = pro.Pro_state;
                    pro_Remark   = pro.Pro_Remark;
                    face_price   = pro.Face_price;
                    advise_price = pro.Advise_price;
                    childreduce  = pro.Childreduce;

                    sms             = pro.Sms;
                    travelproductid = pro.Travelproductid;

                    //读取団期价格//根据实际选择的団期报价
                    B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), lineid);
                    if (linemode != null)
                    {
                        advise_price = linemode.Menprice;
                        decimal childprice = advise_price - childreduce;
                        if (childprice < 0)
                        {
                            childprice = 0;
                        }
                        pricedetail = "成人" + advise_price + "元/人,儿童" + childprice + "元/人";
                    }


                    linepro_booktype = pro.Linepro_booktype;
                }
            }
        }
示例#4
0
        public int addrid = 0;//常用地址id,只有实物产品用到
        protected void Page_Load(object sender, EventArgs e)
        {
            proid      = Request["proid"].ConvertTo <string>("");
            Agentid    = Request["agentid"].ConvertTo <int>(0);
            comid_temp = Request["comid"].ConvertTo <int>(0);
            addrid     = Request["addrid"].ConvertTo <int>(0);


            //去除最右侧,号
            if (proid != "")
            {
                if (proid.Substring(proid.Length - 1, 1) == ",")
                {
                    proid = proid.Substring(0, proid.Length - 1);
                }
            }

            var proid_arr = proid.Split(',');
            int id        = int.Parse(proid_arr[0]);//得到第一个ID,读取基本的COMID,及公司信息


            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(id.ToString());

            if (proinfo != null)
            {
                comid_temp = proinfo.Com_id;

                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(proinfo);
            }


            //获取每个产品数量
            var list = new B2bOrderData().SearchCartList(comid_temp, Agentid, proid);

            if (list != null)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    num += list[i].U_num + ",";
                }
            }
            //去除最右侧,号
            if (num != "")
            {
                if (num.Substring(num.Length - 1, 1) == ",")
                {
                    num = num.Substring(0, num.Length - 1);
                }
            }
        }
示例#5
0
        public string travelending;   //目的地


        protected void Page_Load(object sender, EventArgs e)
        {
            lineid = Request["lineid"].ConvertTo <int>(0);

            if (lineid != 0)
            {
                var prodata = new B2bComProData();
                var pro     = prodata.GetProById(lineid.ToString());

                if (pro != null)
                {
                    pro_name           = pro.Pro_name;
                    com_id             = pro.Com_id;
                    pro_state          = pro.Pro_state;
                    server_type        = pro.Server_type;
                    pro_type           = pro.Pro_type;
                    source_type        = pro.Source_type;
                    pro_Remark         = pro.Pro_Remark;
                    pro_start          = pro.Pro_start;
                    pro_end            = pro.Pro_end;
                    face_price         = pro.Face_price;
                    advise_price       = pro.Advise_price;
                    agent1_price       = pro.Agent1_price;
                    agent2_price       = pro.Agent2_price;
                    agent3_price       = pro.Agent3_price;
                    agentsettle_price  = pro.Agentsettle_price;
                    thatDay_can        = pro.ThatDay_can;
                    thatday_can_day    = pro.Thatday_can_day;
                    service_Contain    = pro.Service_Contain;
                    service_NotContain = pro.Service_NotContain;
                    precautions        = pro.Precautions;
                    tuan_pro           = pro.Tuan_pro;
                    zhixiao            = pro.Zhixiao;
                    agentsale          = pro.Agentsale;
                    createtime         = pro.Createtime;
                    sms             = pro.Sms;
                    createuserid    = pro.Createuserid;
                    imgurl          = pro.Imgurl;
                    pro_number      = pro.Pro_number;
                    pro_explain     = pro.Pro_explain;
                    tuipiao         = pro.Tuipiao;
                    tuipiao_guoqi   = pro.Tuipiao_guoqi;
                    tuipiao_endday  = pro.Tuipiao_endday;
                    imgaddress      = FileSerivce.GetImgUrl(pro.Imgurl);
                    projectid       = pro.Projectid;
                    travelproductid = pro.Travelproductid;
                    travelstarting  = pro.Travelstarting;
                    travelending    = pro.Travelending;
                }
            }
        }
示例#6
0
        public List <B2b_com_pro_Speci> gglist = null;//规格列表


        protected void Page_Load(object sender, EventArgs e)
        {
            proid = Request["proid"].ConvertTo <int>(0);
            var prodata = new B2bComProData();

            if (proid != 0)
            {
                var proinfo = prodata.GetProById(proid.ToString());
                if (proinfo != null)
                {
                    proname   = proinfo.Pro_name;
                    manyspeci = proinfo.Manyspeci;
                    gglist    = new B2b_com_pro_SpeciData().Getgglist(proinfo.Id);
                }
            }
        }
示例#7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            comid   = Request["comid"].ConvertTo <int>(0);
            agentid = Request["agentid"].ConvertTo <int>(0);
            orderid = Request["orderid"].ConvertTo <int>(0);
            md5info = Request["md5info"].ConvertTo <string>("");

            string Returnmd5 = EncryptionHelper.ToMD5(orderid.ToString() + comid.ToString() + agentid.ToString() + "lixh1210", "UTF-8");

            if (Returnmd5 == md5info)//验证MD5
            {
                B2bOrderData orderdate  = new B2bOrderData();
                B2b_order    ordermodel = orderdate.GetOrderById(orderid);

                if (ordermodel != null)
                {
                    B2bComProData prodata  = new B2bComProData();
                    B2b_com_pro   promodel = prodata.GetProById(ordermodel.Pro_id.ToString());

                    if (promodel != null)
                    {
                        if (ordermodel.Agentid == agentid && ordermodel.Comid == comid && ordermodel.Warrant_type == 2)
                        {
                            ExcelRender.RenderToExcel(
                                ExcelSqlHelper.ExecuteDataTable(CommandType.Text, "select e_proname [产品名称],pno [票号],pnum [数量] from b2b_eticket where oid=" + orderid),
                                Context, promodel.Pro_name + ordermodel.U_subdate.Date.ToString("yyyyMMdd") + "-" + ordermodel.Id.ToString() + ".xls");
                        }
                        else
                        {
                            err = "订单参数错误";
                        }
                    }
                    else
                    {
                        err = "产品错误";
                    }
                }
                else
                {
                    err = "订单错误";
                }
            }
            else
            {
                err = "验证错误";
            }
        }
示例#8
0
        public string Pro_name = ""; //产品名称

        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            oid     = Request["oid"].ConvertTo <int>(0);
            evatype = Request["evatype"].ConvertTo <int>(0);

            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            //根据域名读取商户ID,如果没有绑定域名直接跳转后台
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
                if (comid == 0)
                {
                    comid = new WeiXinBasicData().GetWeiXinBasicByDomain(RequestUrl).Comid;
                }
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
            }

            if (openid != null && openid != "")
            {
                //只要传递过来微信ID 直接SESSION
                Session["Openid"] = openid;
            }

            if (comid != 0)
            {
                //根据公司id得到公司logo地址和公司名称
                title = B2bCompanyData.GetCompany(comid).Com_name;
                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());

                if (pro != null)
                {
                    logoimg = FileSerivce.GetImgUrl(pro.Logo.ConvertTo <int>(0));
                }


                //获取微信平台端code
                weixincode = Request["code"].ConvertTo <string>("");
                openid     = Request["openid"].ConvertTo <string>("");
                weixinpass = Request["weixinpass"].ConvertTo <string>("");

                GetMemberCard(openid, weixincode, weixinpass, comid);//登陆或得到会员信息


                //最后判断登陆
                if (AccountId == 0)
                {
                    Response.Redirect("/h5/order/login.aspx");
                }

                //读取订单
                var orderdata = new B2bOrderData();
                var orderinfo = orderdata.GetOrderById(oid);
                if (orderinfo != null)
                {
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                    if (proinfo != null)
                    {
                        Pro_name = proinfo.Pro_name;
                        if (evatype == 1)
                        {
                            Pro_name = "教练为用户提交教学档案:" + Pro_name + " 预约时间:" + orderinfo.U_traveldate.ToString("yyyy-MM-dd HH:mm");
                        }
                    }


                    uid       = orderinfo.U_id;
                    channelid = orderinfo.channelcoachid;
                }


                //权限不匹配 跳转会员登陆页面
                if (evatype == 0)
                {
                    //if (AccountId != uid)
                    //{
                    //    Response.Redirect("/h5/order/login.aspx");
                    //}
                }
                else  //如果是 教练评价 客户
                      //查询渠道是否匹配,可能遇到不针对教练预约 ,暂时不做判定,这样 出现所有教练都有可能对客户进行评价,未指定教练,如何评价



                {
                }
            }
        }
示例#9
0
        public void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            id = Request["id"].ConvertTo <int>(0);
            string md5 = Request["md5"].ConvertTo <string>("");

            string Returnmd5 = EncryptionHelper.ToMD5(id.ToString() + "lixh1210", "UTF-8");


            var orderdata = new B2bOrderData();
            var orderinfo = orderdata.GetOrderById(id);

            if (orderinfo != null)
            {
                u_name = orderinfo.U_name;

                //判断登陆状态
                //if (Session["AccountId"] != null)
                //{
                //先判断Session
                //int AccountId = int.Parse(Session["AccountId"].ToString());

                if (Returnmd5 == md5)       //必须符合加密的才能打开
                {
                    yuyuetime = orderinfo.U_traveldate.ToString("yyyy-MM-dd hh:mm:ss");
                    var prodata = new B2bComProData();
                    var proinfo = prodata.GetProById(orderinfo.Pro_id.ToString());
                    if (proinfo != null)
                    {
                        Pro_name  = proinfo.Pro_name;
                        bindiname = proinfo.bookpro_bindname;
                        bindphone = proinfo.bookpro_bindphone;

                        var managedata = new B2bCompanyManagerUserData();
                        var manageinfo = managedata.GetCompanyUserByPhone(bindphone, proinfo.Com_id);
                        if (manageinfo != null)
                        {
                            bindimg = FileSerivce.GetImgUrl(manageinfo.Headimg);
                        }
                    }
                }
                //}
            }



            uid = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip = CommonFunc.GetRealIP();

            key = Request["key"].ConvertTo <string>("");

            if (key != "")
            {
                biaoti = key;
            }

            proclass = Request["class"].ConvertTo <int>(0);
            price    = Request["price"].ConvertTo <int>(0);



            if (proclass != 0)
            {
                var prodata = new B2bComProData();
                var result  = prodata.Proclassbyid(proclass);
                if (result != null)
                {
                    biaoti = result.Classname;
                }
            }

            //获取随机用户ID
            if (Request.Cookies["temp_userid"] != null)
            {
                userid = Request.Cookies["temp_userid"].Value;
            }
            else
            {
                userid = Domain_def.HuoQu_Temp_UserId();
                //Response.Cookies("userid").val();

                HttpCookie cookie = new HttpCookie("temp_userid");     //实例化HttpCookie类并添加值
                cookie.Value   = userid;
                cookie.Expires = DateTime.Now.AddDays(365);
                Response.Cookies.Add(cookie);
            }

            buyuid  = Request["buyuid"].ConvertTo <int>(0);
            tocomid = Request["tocomid"].ConvertTo <int>(0);


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                //先通过正则表达式获取COMid
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl).ToString());
            }
            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }



            if (comid != 0)
            {
                //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);
                //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "b");
                if (model != null)
                {
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "c");
                    //商家微信支付的所有参数都存在
                    if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                    {
                        //appId = model.Wx_appid;
                        //appsecret = model.Wx_appkey;
                        //appkey = model.Wx_paysignkey;
                        //mchid = model.Wx_partnerid;
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "d");
                        issetfinancepaytype = true;
                    }
                }


                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                        weixinname     = commodel.B2bcompanyinfo.Weixinname;
                        Scenic_intro   = commodel.B2bcompanyinfo.Scenic_intro;
                    }

                    title = commodel.Com_name;
                }


                B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (pro != null)
                {
                    if (pro.Smalllogo != null && pro.Smalllogo != "")
                    {
                        comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");
                //获取微信号和一次性密码
                openid = Request["openid"].ConvertTo <string>("");
                string weixinpass = Request["weixinpass"].ConvertTo <string>("");

                //获得会员信息
                GetCrmInfo(weixincode, openid, weixinpass);
            }


            //获取BANNER,及logo
            if (comid != 0)
            {
                //根据公司id得到 直销设置
                B2b_company_saleset saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (saleset != null)
                {
                    logoimg = FileSerivce.GetImgUrl(saleset.Smalllogo.ConvertTo <int>(0));
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, comid);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                  //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, comid); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }
示例#10
0
        //str4=电话,str7=预订热线

        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["orderid"].ConvertTo <int>(0);

            B2bOrderData orderdata = new B2bOrderData();
            var          orderinfo = orderdata.GetOrderById(id);

            if (orderinfo == null)
            {
                Response.Redirect("Order.aspx");//未查询到订单
                return;
            }
            //订单数量
            ordernum = orderinfo.U_num;
            subtime  = orderinfo.U_subdate;

            B2bEticketData eticketdata = new B2bEticketData();

            //已打印数量
            printnum   = eticketdata.AlreadyPrintNumbyOrderid(id);
            unprintnum = ordernum - printnum;


            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(orderinfo.Pro_id.ToString());

            if (proinfo != null)
            {
                comid_temp = proinfo.Com_id;
                proname    = proinfo.Pro_name;
                Face_price = proinfo.Face_price;
                pro_end    = proinfo.Pro_end.ToString("yyyy年MM月dd日");
                pro_start  = proinfo.Pro_start.ToString("yyyy年MM月dd日");
                Pro_Remark = "备注: " + proinfo.pro_note;

                B2b_com_projectData projectdate = new B2b_com_projectData();
                var projectinfo = projectdate.GetProject(proinfo.Projectid, proinfo.Com_id);
                if (projectinfo != null)
                {
                    address = "地址:" + projectinfo.Address;
                    mobile  = projectinfo.Mobile;
                    //proname = projectinfo.Projectname + proname;//不增加项目信息
                }

                if (orderinfo.Agentid != 0)
                {
                    var agentinfo = AgentCompanyData.GetAgentByid(orderinfo.Agentid);
                    if (agentinfo != null)
                    {
                        mobile       = agentinfo.Mobile;//读取分销电话
                        agentcompany = agentinfo.Company;
                    }
                }
            }
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company = companyinfo.Com_name;
            }

            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                if (Agentid != orderinfo.Agentid)
                {
                    //订单与分销不匹配
                    Response.Redirect("order.aspx");
                }


                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
示例#11
0
        public int issetidcard = 0; //是否需要填写身份证
        protected void Page_Load(object sender, EventArgs e)
        {
            id = Request["id"].ConvertTo <int>(0);
            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(id.ToString());

            if (proinfo != null)
            {
                comid_temp   = proinfo.Com_id;
                pickuppoint  = proinfo.pickuppoint;
                dropoffpoint = proinfo.dropoffpoint;
                Server_type  = proinfo.Server_type;
                manyspeci    = proinfo.Manyspeci;
                face_price   = proinfo.Face_price;
                price        = proinfo.Advise_price;
                issetidcard  = proinfo.issetidcard;
                //如果多规格读取规格
                if (manyspeci == 1)
                {
                    gglist = new B2b_com_pro_SpeciData().Getgglist(proinfo.Id);
                }


                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(proinfo);
                if (proinfo.Source_type == 4)
                {
                    iscanbook = 1;
                }
                else
                {
                    iscanbook = new B2bComProData().IsYouxiao(proinfo.Id, proinfo.Server_type, proinfo.Pro_start, proinfo.Pro_end, proinfo.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                }
            }
            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company       = companyinfo.Com_name;
                contact_phone = companyinfo.B2bcompanyinfo == null ? "" : companyinfo.B2bcompanyinfo.Tel;
            }

            B2b_company_saleset pro = B2bCompanySaleSetData.GetDirectSellByComid(comid_temp.ToString());

            if (pro != null)
            {
                if (pro.Smalllogo != null && pro.Smalllogo != "")
                {
                    comlogo = FileSerivce.GetImgUrl(pro.Smalllogo.ConvertTo <int>(0));
                }
            }


            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                    Agentlevel = agenginfo.Warrant_level;;

                    //if (proinfo != null)
                    //{
                    //    if (Agentlevel == 1)
                    //    {
                    //        hotel_agent = proinfo.Agent1_price;
                    //    }
                    //    if (Agentlevel == 2)
                    //    {
                    //        hotel_agent = proinfo.Agent2_price;
                    //    }
                    //    if (Agentlevel == 3)
                    //    {
                    //        hotel_agent = proinfo.Agent3_price;
                    //    }
                    //}


                    //重新给分销按 级别默认标注,
                    if (gglist != null)
                    {
                        price      = 0;
                        face_price = 0;
                        for (int i = 0; i < gglist.Count(); i++)
                        {
                            if (Server_type == 9)//订房
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                            else if (Server_type == 10)//大巴
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                            else
                            {
                                if (Agentlevel == 1)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                }
                                if (Agentlevel == 2)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                }
                                if (Agentlevel == 3)
                                {
                                    gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                }

                                if (price == 0 || price > gglist[i].speci_advise_price)
                                {
                                    price      = gglist[i].speci_advise_price;
                                    face_price = gglist[i].speci_face_price;
                                }
                            }
                        }
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
示例#12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();
            int orderid = Request["out_trade_no"].ConvertTo <int>(0);
            //根据订单id得到订单信息
            B2bOrderData dataorder     = new B2bOrderData();
            B2b_order    modelb2border = dataorder.GetOrderById(orderid);

            //根据产品id得到产品信息
            B2bComProData datapro     = new B2bComProData();
            B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

            ////////////////////////////////////////////请求参数////////////////////////////////////////////

            //必填参数//

            //请与贵网站订单系统中的唯一订单号匹配
            string out_trade_no = orderid.ToString();
            //订单名称,显示在支付宝收银台里的“商品名称”里,显示在支付宝的交易管理的“商品名称”的列表里。
            string subject = "";

            if (modelb2border.Order_type == 2)
            {
                subject = "预付款充值";
            }
            else
            {
                subject = modelcompro.Pro_name;
            }

            //订单描述、订单详细、订单备注,显示在支付宝收银台里的“商品描述”里
            string body = "pay";
            //订单总金额,显示在支付宝收银台里的“应付总额”里
            string total_fee = String.Format("{0:N2}", (modelb2border.U_num * modelb2border.Pay_price + modelb2border.Express) - modelb2border.Integral1 - modelb2border.Imprest1); //

            if (modelb2border.Shopcartid > 0)                                                                                                                                       //如果是购物车产品重新计算费用
            {
                total_fee = String.Format("{0:N2}", dataorder.GetCartOrderMoneyById(orderid));
            }


            total_fee = total_fee.Replace(",", "");


            //扩展功能参数——默认支付方式//

            //默认支付方式,代码见“即时到帐接口”技术文档
            string paymethod = Request["paymethod"];
            //默认网银代号,代号列表见“即时到帐接口”技术文档“附录”→“银行列表”
            string defaultbank = Request["defaultbank"];

            //扩展功能参数——防钓鱼//

            //防钓鱼时间戳
            string anti_phishing_key = "";
            //获取客户端的IP地址,建议:编写获取客户端IP地址的程序
            string exter_invoke_ip = "";
            //注意:
            //请慎重选择是否开启防钓鱼功能
            //exter_invoke_ip、anti_phishing_key一旦被设置过,那么它们就会成为必填参数
            //建议使用POST方式请求数据
            //示例:
            //exter_invoke_ip = "";
            //Service aliQuery_timestamp = new Service();
            //anti_phishing_key = aliQuery_timestamp.Query_timestamp();               //获取防钓鱼时间戳函数

            //扩展功能参数——其他//

            //商品展示地址,要用http:// 格式的完整路径,不允许加?id=123这类自定义参数
            string show_url = "";
            //自定义参数,可存放任何内容(除=、&等特殊字符外),不会显示在页面上
            string extra_common_param = "";
            //默认买家支付宝账号
            string buyer_email = "";

            //扩展功能参数——分润(若要使用,请按照注释要求的格式赋值)//

            //提成类型,该值为固定值:10,不需要修改
            string royalty_type = "";
            //提成信息集
            string royalty_parameters = "";
            //注意:
            //与需要结合商户网站自身情况动态获取每笔交易的各分润收款账号、各分润金额、各分润说明。最多只能设置10条
            //各分润金额的总和须小于等于total_fee
            //提成信息集格式为:收款方Email_1^金额1^备注1|收款方Email_2^金额2^备注2
            //示例:
            //royalty_type = "10";
            //royalty_parameters = "[email protected]^0.01^分润备注一|[email protected]^0.01^分润备注二";

            ////////////////////////////////////////////////////////////////////////////////////////////////

            //把请求参数打包成数组
            SortedDictionary <string, string> sParaTemp = new SortedDictionary <string, string>();

            sParaTemp.Add("payment_type", "1");
            sParaTemp.Add("show_url", show_url);
            sParaTemp.Add("out_trade_no", out_trade_no);
            sParaTemp.Add("subject", subject);
            sParaTemp.Add("body", body);
            sParaTemp.Add("total_fee", total_fee);
            sParaTemp.Add("paymethod", paymethod);
            sParaTemp.Add("defaultbank", defaultbank);
            sParaTemp.Add("anti_phishing_key", anti_phishing_key);
            sParaTemp.Add("exter_invoke_ip", exter_invoke_ip);
            sParaTemp.Add("extra_common_param", extra_common_param);
            sParaTemp.Add("buyer_email", buyer_email);
            sParaTemp.Add("royalty_type", royalty_type);
            sParaTemp.Add("royalty_parameters", royalty_parameters);
            sParaTemp.Add("default_login", "Y");


            //写入支付数据库,先判定是否有此订单支付
            //根据订单id得到订单信息
            B2bPayData datapay    = new B2bPayData();
            B2b_pay    modelb2pay = datapay.GetPayByoId(orderid);


            if (modelb2pay == null)
            {
                B2b_pay eticket = new B2b_pay()
                {
                    Id           = 0,
                    Oid          = orderid,
                    Pay_com      = "alipay",
                    Pay_name     = modelb2border.U_name,
                    Pay_phone    = modelb2border.U_phone,
                    Total_fee    = decimal.Parse(total_fee),
                    Trade_no     = "",
                    Trade_status = "trade_pendpay",
                    Uip          = "",
                    comid        = 106
                };
                int payid = datapay.InsertOrUpdate(eticket);
            }
            else
            {
                //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                {
                    //防止金额有所改动
                    modelb2pay.comid     = 106;
                    modelb2pay.Pay_com   = "alipay";
                    modelb2pay.Total_fee = decimal.Parse(total_fee);
                    datapay.InsertOrUpdate(modelb2pay);
                }
                else
                {
                }
            }


            //构造即时到帐接口表单提交HTML数据,无需修改
            Service ali       = new Service();
            string  sHtmlText = ali.Create_direct_pay_by_user(sParaTemp);

            Response.Write(sHtmlText);
        }
示例#13
0
        public string nativePayImgurl = "/Images/defaultThumb.png"; //微信原生支付二维码
        protected void Page_Load(object sender, EventArgs e)
        {
            //返回订单号
            orderid = Request["orderid"].ConvertTo <int>(0);
            #region 正常订单支付操作
            if (orderid != 0)
            {
                string u  = Request.ServerVariables["HTTP_USER_AGENT"];
                bool   bo = detectmobilebrowser.HttpUserAgent(u);
                if (bo)
                {
                    Response.Redirect("/h5/pay.aspx?orderid=" + orderid);
                }
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                cart = modelb2border.Shopcartid;//不等于0则为购物车订单

                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString(), modelb2border.Speciid);

                if (modelcompro != null)
                {
                    Server_type = modelcompro.Server_type;
                    comid       = modelcompro.Com_id;
                    //绿野 不显示头部
                    if (modelcompro.Com_id == 2553)
                    {
                        viewtop = 0;
                    }
                    string urljson = WeiXinJsonData.getNativePayQrcode(orderid, comid, "oid");
                    try
                    {
                        XmlDocument retdoc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + urljson + "}");
                        XmlElement  retroot = retdoc.DocumentElement;
                        string      type    = retroot.SelectSingleNode("type").InnerText;
                        string      msg     = retroot.SelectSingleNode("msg").InnerText;

                        nativePayImgurl = "/ui/pmui/eticket/showtcode.aspx?pno=" + msg;
                    }
                    catch
                    { }
                }
                else
                {
                    //产品错误
                }

                //如果订单“未付款”现实支付及订单信息
                if ((int)modelb2border.Order_state == (int)OrderStatus.WaitPay)
                {
                    u_name   = modelb2border.U_name.Substring(0, 1) + "**";
                    u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);

                    ;
                    travel_date  = modelb2border.U_traveldate.ToString();
                    buy_num      = modelb2border.U_num;
                    p_totalprice = CommonFunc.OperTwoDecimal((modelb2border.U_num * modelb2border.Pay_price + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1).ToString());
                    if (modelb2border.Child_u_num > 0)//如果是旅游包含儿童的
                    {
                        p_totalprice = (Decimal.Parse(p_totalprice) + modelb2border.Child_u_num * (modelb2border.Pay_price - modelcompro.Childreduce)).ToString();
                    }

                    ordertype = modelb2border.Order_type;
                    if (ordertype == 2)
                    {
                        proname     = "预付款充值";
                        u_youxiaoqi = "";
                    }
                    else
                    {
                        proname = modelcompro.Pro_name;
                        if (modelcompro.Server_type == 10)
                        {//服务类型是:旅游大巴
                            u_youxiaoqi = modelb2border.U_traveldate.ToString("yyyy-MM-dd");
                        }
                        else
                        {
                            u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();
                        }
                    }


                    //如果是购物车订单再次处理
                    if (cart > 0)
                    {
                        proname      = dataorder.GetCartOrderProById(orderid);
                        p_totalprice = dataorder.GetCartOrderMoneyById(orderid).ToString("0.00");
                        buy_num      = 1;
                    }


                    tenpay_url = string.Format("/tenpay/payRequest.aspx?order_no={0}&product_name={1}&order_price={2}&remarkexplain={3}",
                                               orderid, Server.UrlEncode(proname), Server.UrlEncode(p_totalprice), Server.UrlEncode(proname));

                    if (Server_type == 9)
                    {
                        //订房查询入住 及离店日期
                        var hoteldata  = new B2b_order_hotelData();
                        var hotelmodel = hoteldata.GetHotelOrderByOrderId(orderid);

                        if (hotelmodel != null)
                        {
                            stardate = hotelmodel.Start_date.ToString("yyyy-MM-dd");
                            enddate  = hotelmodel.End_date.ToString("yyyy-MM-dd");
                        }
                    }
                }
            }
            #endregion
        }
示例#14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["AccountId"] != null)
            {
                AccountId   = Session["AccountId"].ToString();
                AccountName = Session["AccountName"].ToString();
                AccountCard = Session["AccountCard"].ToString();
                Today       = DateTime.Now.ToString("yyyy-MM-dd");
            }

            comid      = Request["comid"].ConvertTo <int>(0);
            proid      = Request["proid"].ConvertTo <string>("");
            orderid    = Request["orderid"].ConvertTo <int>(0);
            ordertype  = Request["ordertype"].ConvertTo <string>("1");
            RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            if (Request.QueryString["out_trade_no"] != null)
            {
                orderid = Request.QueryString["out_trade_no"].ConvertTo <int>(0);
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);
                proid = modelb2border.Pro_id.ToString();
            }


            //读产品信息
            if (proid != "")
            {
                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(proid);

                if (modelcompro != null)
                {
                    proname = modelcompro.Pro_name;
                    comid   = modelcompro.Com_id;
                }
            }

            //针对支付同步返回页,暂时无法绑定域名
            if (Request.QueryString["out_trade_no"] == null)
            {
                //根据域名读取商户ID,如果没有绑定域名直接跳转后台
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid = companyinfo.Com_id;
                }
                else
                {
                    //判定是否为自助域名规则安 shop1.etown.cn
                    if (Domain_def.Domain_yanzheng(RequestUrl))
                    {
                        comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                    }
                    else
                    {
                        if (RequestUrl == "shop.etown.cn" || RequestUrl == "test.etown.cn" || RequestUrl == "admin.etown.cn" || RequestUrl == "admin.vctrip.com")
                        {
                            Response.Redirect("/Manage/index1.html");
                        }
                        else
                        {
                            Response.Redirect("/admin/");
                        }
                    }
                }
            }



            //判断商户ID(域名未绑定)
            if (comid != 0)
            {
                B2b_company         com        = B2bCompanyData.GetAllComMsg(comid);
                B2b_company_saleset comsetinfo = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                if (com != null)
                {
                    Com_name     = com.Com_name;
                    Scenic_name  = com.Scenic_name;
                    Scenic_intro = com.B2bcompanyinfo.Scenic_intro;

                    if (comsetinfo != null)
                    {
                        if (comsetinfo.Logo != "")
                        {
                            FileUploadModel comlogo = new FileUploadData().GetFileById(int.Parse(comsetinfo.Logo));
                            if (comlogo != null)
                            {
                                Logourl = "<img src=\"" + fileUrl + comlogo.Relativepath + "\" alt=\"" + Scenic_name + "\" height=\"80\"  id=\"imglogo\" />";
                            }
                        }
                        else
                        {
                            Logourl = "";
                        }

                        Service_Phone = comsetinfo.Service_Phone;
                        if (Service_Phone != "")
                        {
                            Service_Phone = "客服电话:" + Service_Phone;
                        }

                        Copyright = comsetinfo.Copyright;
                    }
                }
            }
            else
            {
                //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。
                Response.Redirect("/Manage/index1.html");
            }
        }
示例#15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //返回订单号
            orderid      = Request["orderid"].ConvertTo <int>(0);
            agentorderid = Request["agentorderid"].ConvertTo <int>(0);
            act          = Request["act"].ConvertTo <string>("");


            if (orderid != 0)
            {
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

                //如果订单“未付款”现实支付及订单信息
                if ((int)modelb2border.Order_state == (int)OrderStatus.WaitPay)
                {
                    u_name   = modelb2border.U_name.Substring(0, 1) + "**";
                    u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);

                    ;
                    travel_date  = modelb2border.U_traveldate.ToString();
                    buy_num      = modelb2border.U_num;
                    p_totalprice = (int)(modelb2border.U_num * modelb2border.Pay_price);
                    ordertype    = modelb2border.Order_type;
                    if (ordertype == 2)
                    {
                        proname     = "预付款充值";
                        u_youxiaoqi = "";
                    }
                    else
                    {
                        proname     = modelcompro.Pro_name;
                        u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();
                    }
                }

                comid_temp = Request["comid"].ConvertTo <int>(0);

                B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);
                if (companyinfo != null)
                {
                    company = companyinfo.Com_name;
                }



                if (Session["Agentid"] != null)
                {
                    //账户信息
                    Agentid = Int32.Parse(Session["Agentid"].ToString());
                    Account = Session["Account"].ToString();

                    Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                    if (agenginfo != null)
                    {
                        yufukuan     = "您预付款:" + agenginfo.Imprest + " 元";
                        Warrant_type = agenginfo.Warrant_type;
                    }
                }
            }
        }
示例#16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string sp_billno       = Request["order_no"];
            string product_name    = Request["product_name"];
            string order_price     = Request["order_price"];;
            string remarkexplain   = Request["remarkexplain"];
            string bank_type_value = Request["bank_type_value"].ConvertTo <string>("DEFAULT");


            double money = 0;

            if (null == Request["order_price"])
            {
                Response.Write("支付金额错误!");
                Response.End();
                return;
            }
            try
            {
                money = Convert.ToDouble(order_price);
            }
            catch
            {
                Response.Write("支付金额格式错误!");
                Response.End();
                return;
            }
            if (null == sp_billno)
            {
                ////生成订单10位序列号,此处用时间和随机数生成,商户根据自己调整,保证唯一
                //sp_billno = DateTime.Now.ToString("HHmmss") + TenpayUtil.BuildRandomStr(4);
                Response.Write("订单编号错误!");
                Response.End();
                return;
            }
            else
            {
                sp_billno = Request["order_no"].ToString();
            }

            //根据订单id得到订单信息
            B2bOrderData dataorder     = new B2bOrderData();
            B2b_order    modelb2border = dataorder.GetOrderById(sp_billno.ConvertTo <int>(0));

            if (modelb2border == null)
            {
                Response.Write("订单信息获取错误!");
                Response.End();
                return;
            }
            //根据产品id得到产品信息
            B2bComProData datapro     = new B2bComProData();
            B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

            if (modelcompro == null)
            {
                Response.Write("产品信息错误!");
                Response.End();
                return;
            }

            if (modelb2border != null && modelcompro != null)
            {
                //写入支付数据库,先判定是否有此订单支付
                //根据订单id得到订单信息
                B2bPayData datapay    = new B2bPayData();
                B2b_pay    modelb2pay = datapay.GetPayByoId(sp_billno.ConvertTo <int>(0));

                if (modelb2pay != null)
                {
                    //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                    if (modelb2pay.Trade_status == "TRADE_SUCCESS")
                    {
                        Response.Write("订单已经支付过!");
                        Response.End();
                        return;
                    }
                }



                #region 获得财付通支付参数 tenpay_id,tenpay_key
                //根据产品判断商家是否含有自己的财付通支付:
                //a.含有的话支付到商家;
                //b.没有的话支付到平台财付通账户(易城账户,公司id=106)


                string tenpay_id          = "";
                string tenpay_key         = "";
                B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(modelcompro.Com_id);
                if (model != null)
                {
                    //商家财付通支付的所有参数都存在
                    if (model.Tenpay_id != "" && model.Tenpay_key != "")
                    {
                        tenpay_id  = model.Tenpay_id;
                        tenpay_key = model.Tenpay_key;
                    }
                    else
                    {
                        model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                        if (model == null)
                        {
                            Response.Write("商户财付通信息设置不完全!");
                            Response.End();
                            return;
                        }
                        else
                        {
                            //商家财付通支付的所有参数都存在
                            if (model.Tenpay_id != "" && model.Tenpay_key != "")
                            {
                                tenpay_id  = model.Tenpay_id;
                                tenpay_key = model.Tenpay_key;
                            }
                            else
                            {
                                Response.Write("商户财付通信息设置不完全!!");
                                Response.End();
                                return;
                            }
                        }
                    }
                }
                else
                {
                    model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                    if (model == null)
                    {
                        Response.Write("商户财付通信息设置不完全!");
                        Response.End();
                        return;
                    }
                    else
                    {
                        //商家财付通支付的所有参数都存在
                        if (model.Tenpay_id != "" && model.Tenpay_key != "")
                        {
                            tenpay_id  = model.Tenpay_id;
                            tenpay_key = model.Tenpay_key;
                        }
                        else
                        {
                            Response.Write("商户财付通信息设置不完全!!");
                            Response.End();
                            return;
                        }
                    }
                }

                #endregion


                if (modelb2pay == null)
                {
                    B2b_pay eticket = new B2b_pay()
                    {
                        Id           = 0,
                        Oid          = sp_billno.ConvertTo <int>(0),
                        Pay_com      = "mtenpay",
                        Pay_name     = modelb2border.U_name,
                        Pay_phone    = modelb2border.U_phone,
                        Total_fee    = (decimal)modelb2border.Pay_price * modelb2border.U_num + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1,
                        Trade_no     = "",
                        Trade_status = "trade_pendpay",
                        Uip          = "",
                        comid        = model.Com_id
                    };
                    int payid = datapay.InsertOrUpdate(eticket);
                }
                else
                {
                    //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                    if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                    {
                        //防止金额有所改动
                        modelb2pay.comid     = model.Com_id;
                        modelb2pay.Pay_com   = "mtenpay";
                        modelb2pay.Total_fee = (decimal)modelb2border.Pay_price * modelb2border.U_num + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1;
                        datapay.InsertOrUpdate(modelb2pay);
                    }
                    else
                    {
                        Response.Write("订单已经支付过!");
                        Response.End();
                        return;
                    }
                }


                //创建RequestHandler实例
                RequestHandler reqHandler = new RequestHandler(Context);
                //初始化
                reqHandler.init();
                //设置密钥
                reqHandler.setKey(tenpay_key);
                reqHandler.setGateUrl("https://gw.tenpay.com/gateway/pay.htm");


                //-----------------------------
                //设置支付参数
                //-----------------------------
                reqHandler.setParameter("partner", tenpay_id);                                                                               //商户号
                reqHandler.setParameter("out_trade_no", sp_billno);                                                                          //商家订单号
                reqHandler.setParameter("total_fee", (money * 100).ToString());                                                              //商品金额,以分为单位
                reqHandler.setParameter("return_url", "http://shop" + modelcompro.Com_id.ToString() + ".etown.cn/tenpay/payReturnUrl.aspx"); //交易完成后跳转的URL
                reqHandler.setParameter("notify_url", "http://shop" + modelcompro.Com_id.ToString() + ".etown.cn/tenpay/payNotifyUrl.aspx"); //接收财付通通知的URL
                reqHandler.setParameter("body", remarkexplain);                                                                              //商品描述
                reqHandler.setParameter("bank_type", bank_type_value);                                                                       //银行类型(中介担保时此参数无效)
                reqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress);                                                   //用户的公网ip,不是商户服务器IP
                reqHandler.setParameter("fee_type", "1");                                                                                    //币种,1人民币
                reqHandler.setParameter("subject", product_name);                                                                            //商品名称(中介交易时必填)


                //系统可选参数
                reqHandler.setParameter("sign_type", "MD5");
                reqHandler.setParameter("service_version", "1.0");
                reqHandler.setParameter("input_charset", "UTF-8");
                reqHandler.setParameter("sign_key_index", "1");

                //业务可选参数

                reqHandler.setParameter("attach", "");                                          //附加数据,原样返回
                reqHandler.setParameter("product_fee", "0");                                    //商品费用,必须保证transport_fee + product_fee=total_fee
                reqHandler.setParameter("transport_fee", "0");                                  //物流费用,必须保证transport_fee + product_fee=total_fee
                reqHandler.setParameter("time_start", DateTime.Now.ToString("yyyyMMddHHmmss")); //订单生成时间,格式为yyyymmddhhmmss
                reqHandler.setParameter("time_expire", "");                                     //订单失效时间,格式为yyyymmddhhmmss
                reqHandler.setParameter("buyer_id", "");                                        //买方财付通账号
                reqHandler.setParameter("goods_tag", "");                                       //商品标记
                reqHandler.setParameter("trade_mode", "1");                                     //交易模式,1即时到账(默认),2中介担保,3后台选择(买家进支付中心列表选择)
                reqHandler.setParameter("transport_desc", "");                                  //物流说明
                reqHandler.setParameter("trans_type", "1");                                     //交易类型,1实物交易,2虚拟交易
                reqHandler.setParameter("agentid", "");                                         //平台ID
                reqHandler.setParameter("agent_type", "");                                      //代理模式,0无代理(默认),1表示卡易售模式,2表示网店模式
                reqHandler.setParameter("seller_id", "");                                       //卖家商户号,为空则等同于partner



                //获取请求带参数的url
                string requestUrl = reqHandler.getRequestURL();

                //获取debug信息,建议把请求和debug信息写入日志,方便定位问题
                string debuginfo = reqHandler.getDebugInfo();
                //Response.Write("<br/>requestUrl:" + requestUrl + "<br/>");
                //Response.Write("<br/>debuginfo:" + debuginfo + "<br/>");

                //Get的实现方式
                string a_link = "<a target=\"_blank\" href=\"" + requestUrl + "\">" + "财付通支付" + "</a>";
                //Response.Write(a_link);
                Response.Redirect(requestUrl);

                //post实现方式

                /*  Response.Write("<form method=\"post\" action=\"" + reqHandler.getGateUrl() + "\" >\n");
                 * Hashtable ht = reqHandler.getAllParameters();
                 * foreach (DictionaryEntry de in ht)
                 * {
                 *   Response.Write("<input type=\"hidden\" name=\"" + de.Key + "\" value=\"" + de.Value + "\" >\n");
                 * }
                 * Response.Write("<input type=\"submit\" value=\"财付通支付\" >\n</form>\n");*/
            }
        }
示例#17
0
        public int Agentlevel = 0;     //分销级别
        protected void Page_Load(object sender, EventArgs e)
        {
            unum   = Request["unum"].ConvertTo <int>(1);
            addrid = Request["addrid"].ConvertTo <int>(0);
            id     = Request["id"].ConvertTo <int>(0);
            B2bComProData prodate = new B2bComProData();
            var           pro     = prodate.GetProById(id.ToString());

            if (pro != null)
            {
                servertype   = pro.Server_type;
                comid_temp   = pro.Com_id;
                pickuppoint  = pro.pickuppoint;
                dropoffpoint = pro.dropoffpoint;
                price        = pro.Advise_price;
                face_price   = pro.Face_price;
                manyspeci    = pro.Manyspeci;
                issetidcard  = pro.issetidcard;
                //如果多规格读取规格
                if (manyspeci == 1)
                {
                    gglist = new B2b_com_pro_SpeciData().Getgglist(pro.Id);
                }


                if (Session["Agentid"] != null)
                {
                    //账户信息
                    Agentid = Int32.Parse(Session["Agentid"].ToString());
                    Account = Session["Account"].ToString();
                    var           Warrant_type_str = "";
                    Agent_company agenginfo        = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                    if (agenginfo != null)
                    {
                        var yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                        var Warrant_type = agenginfo.Warrant_type;
                        if (Warrant_type == 1)
                        {
                            Warrant_type_str = "销售扣款";
                        }
                        if (Warrant_type == 2)
                        {
                            Warrant_type_str = "验证扣款";
                        }
                        Agentlevel = agenginfo.Warrant_level;;
                        //if (pro != null)
                        //{
                        //    if (Agentlevel == 1)
                        //    {
                        //        hotel_agent = pro.Agent1_price;
                        //    }
                        //    if (Agentlevel == 2)
                        //    {
                        //        hotel_agent = pro.Agent2_price;
                        //    }
                        //    if (Agentlevel == 3)
                        //    {
                        //        hotel_agent = pro.Agent3_price;
                        //    }
                        //}

                        //重新给分销按 级别默认标注,
                        if (gglist != null)
                        {
                            for (int i = 0; i < gglist.Count(); i++)
                            {
                                if (servertype == 9)//订房
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                                else if (servertype == 10)//大巴
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                                else
                                {
                                    if (Agentlevel == 1)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent1_price;
                                    }
                                    if (Agentlevel == 2)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent2_price;
                                    }
                                    if (Agentlevel == 3)
                                    {
                                        gglist[i].speci_advise_price = gglist[i].speci_agent3_price;
                                    }

                                    if (price == 0 || price > gglist[i].speci_advise_price)
                                    {
                                        price      = gglist[i].speci_advise_price;
                                        face_price = gglist[i].speci_face_price;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Response.Redirect("/Agent/Default.aspx");
                    }
                }



                ////如果含有规格读取规格价格中最低价
                //if (manyspeci == 1)
                //{
                //    if (gglist != null)
                //    {
                //        price = 0;
                //        face_price = 0;
                //        for (int i = 0; i < gglist.Count(); i++)
                //        {

                //            if (price == 0 || price > gglist[i].speci_advise_price)
                //            {
                //                price = gglist[i].speci_advise_price;
                //                face_price = gglist[i].speci_face_price;
                //            }
                //        }
                //    }
                //}

                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(pro);
                if (pro.Source_type == 4)
                {
                    iscanbook = 1;
                }
                else
                {
                    iscanbook = new B2bComProData().IsYouxiao(pro.Id, pro.Server_type, pro.Pro_start, pro.Pro_end, pro.Pro_state);//判断产品是否有效:1.票务,直接判断有效期 和产品上线状态2.酒店,跟团游,当地游 则判断是否含有有效的房态/团期 以及产品上下线状态
                }
            }
        }
示例#18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            cartid = Request["cartid"].ConvertTo <string>("");


            //去除最右侧,号
            if (cartid != "")
            {
                if (cartid.Substring(cartid.Length - 1, 1) == ",")
                {
                    cartid = cartid.Substring(0, cartid.Length - 1);
                }
            }

            var cartid_arr = cartid.Split(',');

            //如果包含规格产品
            var prospeciid = new B2bOrderData().SearchCartListBycartid(cartid);

            if (prospeciid != null)
            {
                for (int i = 0; i < prospeciid.Count; i++)
                {
                    id         += prospeciid[i].Id + ",";
                    id_speciid += prospeciid[i].Speciid + ",";

                    temp_id         = prospeciid[i].Id.ToString();
                    temp_id_speciid = prospeciid[i].Speciid.ToString();

                    num += prospeciid[i].U_num + ",";
                }
            }

            if (num != "")
            {
                if (num.Substring(num.Length - 1, 1) == ",")
                {
                    num = num.Substring(0, num.Length - 1);
                }
            }
            if (id != "")
            {
                if (id.Substring(id.Length - 1, 1) == ",")
                {
                    id = id.Substring(0, id.Length - 1);
                }
            }
            if (id_speciid != "")
            {
                if (id_speciid.Substring(id_speciid.Length - 1, 1) == ",")
                {
                    id_speciid = id_speciid.Substring(0, id_speciid.Length - 1);
                }
            }


            B2bComProData prodate = new B2bComProData();
            var           proinfo = prodate.GetProById(temp_id);

            if (proinfo != null)
            {
                comid_temp   = proinfo.Com_id;
                pickuppoint  = proinfo.pickuppoint;
                dropoffpoint = proinfo.dropoffpoint;

                //作废超时未支付订单,完成回滚操作
                int rs = new B2bComProData().CancelOvertimeOrder(proinfo);
            }



            B2b_company companyinfo = B2bCompanyData.GetAllComMsg(comid_temp);

            if (companyinfo != null)
            {
                company = companyinfo.Com_name;
            }



            if (Session["Agentid"] != null)
            {
                //账户信息
                Agentid = Int32.Parse(Session["Agentid"].ToString());
                Account = Session["Account"].ToString();

                Agent_company agenginfo = AgentCompanyData.GetAgentWarrant(Agentid, comid_temp);
                if (agenginfo != null)
                {
                    yufukuan     = "您预付款:" + agenginfo.Imprest.ToString("0.00") + " 元";
                    Warrant_type = agenginfo.Warrant_type;
                    if (Warrant_type == 1)
                    {
                        Warrant_type_str = "销售扣款";
                    }
                    if (Warrant_type == 2)
                    {
                        Warrant_type_str = "验证扣款";
                    }
                }
                else
                {
                    Response.Redirect("/Agent/Default.aspx");
                }
            }
        }
示例#19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u = Request.ServerVariables["HTTP_USER_AGENT"];

            bo = detectmobilebrowser.HttpUserAgent(u);


            Dictionary <string, string> sPara = GetRequestGet();

            if (sPara.Count > 0)//判断是否有带返回参数
            {
                Notify aliNotify    = new Notify();
                bool   verifyResult = aliNotify.VerifyReturn(sPara, Request.QueryString["sign"]);

                string trade_no = Request["trade_no"];                  //支付宝交易号
                int    order_no = Int32.Parse(Request["out_trade_no"]); //获取订单号
                orderid = order_no;
                decimal total_fee = 0;                                  //获取总金额
                if (verifyResult)                                       //验证成功
                {
                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                    //请在这里加上商户的业务逻辑程序代码


                    //获取访问的商户COMID
                    if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                    {
                        comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                    }
                    else
                    {
                        B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                        if (companyinfo != null)
                        {
                            comid = companyinfo.Com_id;
                        }
                    }



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

                    ////商户订单号
                    //string out_trade_no = Request.QueryString["out_trade_no"];

                    ////支付宝交易号
                    //string trade_no = Request.QueryString["trade_no"];

                    B2bPayData datapay    = new B2bPayData();
                    B2b_pay    modelb2pay = datapay.GetPayByoId(order_no);

                    md5 = EncryptionHelper.ToMD5(order_no.ToString() + "lixh1210", "UTF-8");

                    B2b_order orderdate = new B2bOrderData().GetOrderById(order_no);
                    if (orderdate != null)
                    {
                        order_type = orderdate.Order_type;

                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(orderdate.Comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }

                        var comdata = B2bCompanyData.GetCompany(orderdate.Comid);
                        if (saleset != null)
                        {
                            comname = comdata.Com_name;
                        }


                        //根据产品id得到产品信息
                        B2bComProData datapro     = new B2bComProData();
                        B2b_com_pro   modelcompro = datapro.GetProById(orderdate.Pro_id.ToString(), orderdate.Speciid, orderdate.channelcoachid);

                        if (modelcompro != null)
                        {
                            servertype = modelcompro.Server_type;
                        }
                    }

                    if (modelb2pay != null)
                    {
                        total_fee = modelb2pay.Total_fee;
                    }

                    ////交易状态
                    string result = Request.QueryString["result"];


                    //判断是否在商户网站中已经做过了这次通知返回的处理
                    //如果没有做过处理,那么执行商户的业务程序
                    //如果有做过处理,那么不执行商户的业务程序

                    //打印页面
                    //Response.Write("验证成功<br />");订单支付 成功!
                    string retunstr = new PayReturnSendEticketData().PayReturnSendEticket(trade_no, order_no, total_fee, result);
                    title = "订单支付 成功!";

                    //对分销充值订单支付返回,对绑定订单进行处理确认
                    var handdata = OrderJsonData.agentorderpay_Hand(order_no);

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

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                else//验证失败
                {
                    //Response.Write("验证失败");
                    title = "订单支付 出现错误";
                }
            }
            else
            {
                //Response.Write("无返回参数");
                title = "订单 没有 支付";
            }
        }
示例#20
0
        //给顾问,客户,绑定人发送通知, sentype=1 给绑定顾问,=2给客户 =3给教练
        public static void SendWxkefumsg(int orderid, int sentype, string msg, int comid)
        {
            WeiXinBasic basic  = new WeiXinBasicData().GetWxBasicByComId(comid);
            string      openid = "";


            WxMessageLogData messagelogdata = new WxMessageLogData();

            B2bOrderData orderdate = new B2bOrderData();
            var          orderinfo = orderdate.GetOrderById(orderid);

            if (orderinfo == null)
            {
                return;
            }


            //会员

            MemberCardData carddata = new MemberCardData();
            var            userdata = new B2bCrmData();

            if (sentype == 2)
            {
                var userinfo = userdata.Readuser(orderinfo.U_id, orderinfo.Comid);
                if (userinfo == null)
                {
                    return;
                }

                openid = userinfo.Weixin;

                if (openid != "")
                {
                    //微信客服 文本消息
                    string data = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                }
            }

            if (sentype == 1)
            {
                var b2bprodata = new B2bComProData();
                var proinfo    = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                if (proinfo == null)
                {
                    return;
                }

                if (proinfo.bookpro_bindphone != "")
                {
                    //var channeldata = new MemberChannelData();
                    //var channelinfo = channeldata.GetPhoneComIdChannelDetail(proinfo.bookpro_bindphone,comid);


                    //直接通过 手机查询用户
                    var userinfo_binding = userdata.GetSjKeHu(proinfo.bookpro_bindphone, orderinfo.Comid);
                    if (userinfo_binding == null)
                    {
                        return;
                    }
                    openid = userinfo_binding.Weixin;
                    if (openid != "")
                    {
                        //微信 文本消息
                        string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                    }
                }
            }

            //给教练
            if (sentype == 3)
            {
                var b2bprodata = new B2bComProData();
                var proinfo    = b2bprodata.GetProById(orderinfo.Pro_id.ToString(), orderinfo.Speciid, orderinfo.channelcoachid);
                if (proinfo == null)
                {
                    return;
                }

                if (orderinfo.channelcoachid != 0)
                {
                    var channeldata = new MemberChannelData();
                    var channelinfo = MemberChannelData.GetChannelinfo(orderinfo.channelcoachid);

                    if (channelinfo != null)
                    {
                        //直接通过 手机查询用户
                        var userinfo_binding = userdata.GetSjKeHu(channelinfo.Mobile, orderinfo.Comid);
                        if (userinfo_binding == null)
                        {
                            return;
                        }
                        openid = userinfo_binding.Weixin;
                        if (openid != "")
                        {
                            //微信 文本消息
                            string data_binding = SendWxMsg(comid, openid, 1, "", msg, "", basic.Weixinno);
                        }
                    }
                }
            }
        }
示例#21
0
        public string pricedetail = "";        //价格详情(暂时只有用来描述旅游)
        protected void Page_Load(object sender, EventArgs e)
        {
            //RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            if (Request.QueryString["code"] != null)
            {
                #region 获取用户openid
                code = Request.QueryString["code"];
                string url =
                    string.Format(
                        "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code",
                        appId, appsecret, code);
                string returnStr = HttpUtil.Send("", url);

                var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);

                url = string.Format(
                    "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={0}&grant_type=refresh_token&refresh_token={1}",
                    appId, obj.refresh_token);
                returnStr = HttpUtil.Send("", url);
                obj       = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);

                WriteFile(Server.MapPath("") + "\\Log.txt", obj.access_token);
                WriteFile(Server.MapPath("") + "\\Log.txt", obj.openid);

                //url = string.Format(
                //    "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}",
                //    obj.access_token, obj.openid);
                //returnStr = HttpUtil.Send("", url);
                //WriteFile(Server.MapPath("") + "\\Log.txt", returnStr);
                #endregion
                ///////////////////////////////////////////////////////////////////////////////////////////////

                orderid = Request["orderid"].ConvertTo <int>(0);
                if (orderid != 0)
                {
                    //根据订单id得到订单信息
                    B2bOrderData dataorder     = new B2bOrderData();
                    B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                    //根据产品id得到产品信息
                    B2bComProData datapro     = new B2bComProData();
                    B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

                    if (modelb2border != null && modelcompro != null)
                    {
                        #region    务类型订单金额
                        servertype = modelcompro.Server_type;
                        //如果服务类型是“酒店客房”,则根据酒店扩展订单表中房态信息,获取支付金额
                        if (modelcompro.Server_type == 9)
                        {
                            B2b_order_hotel hotelorder = new B2b_order_hotelData().GetHotelOrderByOrderId(orderid);
                            if (hotelorder != null)
                            {
                                string   fangtai    = hotelorder.Fangtai;
                                DateTime start_data = hotelorder.Start_date;
                                DateTime end_data   = hotelorder.End_date;
                                int      bookdaynum = hotelorder.Bookdaynum;

                                decimal  everyroomprice = 0;
                                string[] ftstr          = fangtai.Split(',');
                                for (int i = 0; i < ftstr.Length; i++)
                                {
                                    if (ftstr[i].ConvertTo <decimal>(0) > 0)
                                    {
                                        everyroomprice += ftstr[i].ConvertTo <decimal>(0);
                                    }
                                }
                                price = everyroomprice.ToString();

                                p_totalprice1 = (modelb2border.U_num * everyroomprice - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                            else
                            {
                            }
                        }
                        else if (servertype == 2 || servertype == 8)//当地游;跟团游
                        {
                            string outdate = modelb2border.U_traveldate.ToString("yyyy-MM-dd");

                            //读取団期价格,根据实际选择的団期报价
                            B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), modelcompro.Id);
                            if (linemode != null)
                            {
                                price = linemode.Menprice.ToString();
                                decimal childreduce = modelcompro.Childreduce;
                                decimal childprice  = decimal.Parse(price) - childreduce;
                                if (childprice < 0)
                                {
                                    childprice = 0;
                                }
                                pricedetail = modelb2border.U_num + "成人," + modelb2border.Child_u_num + "儿童(成人" + price + "元/人,儿童" + childprice + "元/人)";

                                p_totalprice1 = (modelb2border.U_num * (linemode.Menprice) + (modelb2border.Child_u_num) * childprice - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                        }
                        else //票务
                        {
                            p_totalprice1 = (modelb2border.U_num * modelcompro.Advise_price - modelb2border.Integral1 - modelb2border.Imprest1);
                            price         = modelcompro.Advise_price.ToString(); //modelb2border.Pay_price.ToString();
                            if (price == "0.00" || price == "0")
                            {
                                price = "";
                            }
                            else
                            {
                                price = CommonFunc.OperTwoDecimal(price);
                            }
                        }
                        #endregion

                        proname     = modelcompro.Pro_name;
                        u_name      = modelb2border.U_name.Substring(0, 1) + "**";
                        u_mobile    = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);
                        travel_date = modelb2border.U_traveldate.ToString();
                        buy_num     = modelb2border.U_num;
                        u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();

                        p_totalprice   = CommonFunc.OperTwoDecimal(p_totalprice1.ToString());
                        wxp_totalprice = (p_totalprice1 * 100).ToString("F0");
                        price          = modelb2border.Pay_price.ToString();

                        price = CommonFunc.OperTwoDecimal(price);
                        comid = modelcompro.Com_id;
                        if (comid != 0)
                        {
                            comName = B2bCompanyData.GetCompany(comid).Com_name;
                            if (bo == false)
                            {
                                Response.Redirect("http://shop" + comid + ".etown.cn");
                            }
                        }

                        if ((int)modelb2border.Order_state != (int)OrderStatus.WaitPay)
                        {
                            order_status = EnumUtils.GetName((OrderStatus)modelb2border.Order_state);
                            return;
                        }

                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }

                        //写入支付数据库,先判定是否有此订单支付
                        B2bPayData datapay    = new B2bPayData();
                        B2b_pay    modelb2pay = datapay.GetPayByoId(orderid);


                        #region  微信支付
                        //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                        B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(modelcompro.Com_id);

                        if (model != null)
                        {
                            //商家微信支付的所有参数都存在
                            if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                            {
                                appId     = model.Wx_appid;
                                appsecret = model.Wx_appkey;
                                appkey    = model.Wx_paysignkey;
                                mchid     = model.Wx_partnerid;
                            }
                            else
                            {
                                return;
                            }
                        }
                        else
                        {
                            return;
                        }



                        //创建支付应答对象
                        var packageReqHandler = new RequestHandler(Context);
                        //初始化
                        packageReqHandler.init();

                        timeStamp = TenpayUtil.getTimestamp();
                        nonceStr  = TenpayUtil.getNoncestr();


                        //设置package订单参数
                        string productname = modelcompro.Pro_name.Replace("\"", "").Replace("“", "").Replace("'", "").Replace("‘", "").Replace(";", "").Replace(";", "");
                        packageReqHandler.setParameter("body", productname); //商品信息 127字符
                        packageReqHandler.setParameter("appid", appId);
                        packageReqHandler.setParameter("mch_id", mchid);
                        packageReqHandler.setParameter("nonce_str", nonceStr.ToLower());
                        packageReqHandler.setParameter("notify_url", "http://shop" + modelcompro.Com_id + ".etown.cn/wxpay/backpaynotice.aspx");
                        packageReqHandler.setParameter("openid", obj.openid);
                        packageReqHandler.setParameter("out_trade_no", orderid.ToString());               //商家订单号
                        packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
                        packageReqHandler.setParameter("total_fee", wxp_totalprice);                      //商品金额,以分为单位(money * 100).ToString()
                        packageReqHandler.setParameter("trade_type", "JSAPI");

                        //获取package包
                        sign = packageReqHandler.CreateMd5Sign("key", appkey);
                        WriteFile(Server.MapPath("") + "\\Log.txt", sign);
                        packageReqHandler.setParameter("sign", sign);

                        string data = packageReqHandler.parseXML();

                        WriteFile(Server.MapPath("") + "\\Log.txt", data);

                        string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder");

                        WriteFile(Server.MapPath("") + "\\Log.txt", prepayXml);

                        //获取预支付ID
                        var xdoc = new XmlDocument();
                        xdoc.LoadXml(prepayXml);
                        XmlNode     xn  = xdoc.SelectSingleNode("xml");
                        XmlNodeList xnl = xn.ChildNodes;
                        if (xnl.Count > 7)
                        {
                            prepayId = xnl[7].InnerText;
                            package  = string.Format("prepay_id={0}", prepayId);
                            WriteFile(Server.MapPath("") + "\\Log.txt", package);
                        }

                        //设置支付参数
                        var paySignReqHandler = new RequestHandler(Context);
                        paySignReqHandler.setParameter("appId", appId);
                        paySignReqHandler.setParameter("timeStamp", timeStamp);
                        paySignReqHandler.setParameter("nonceStr", nonceStr);
                        paySignReqHandler.setParameter("package", package);
                        paySignReqHandler.setParameter("signType", "MD5");
                        paySign = paySignReqHandler.CreateMd5Sign("key", appkey);


                        WriteFile(Server.MapPath("") + "\\Log.txt", paySign);
                        #endregion

                        //订单提交支付信息
                        if (modelb2pay == null)
                        {
                            B2b_pay eticket = new B2b_pay()
                            {
                                Id           = 0,
                                Oid          = orderid,
                                Pay_com      = "wx",
                                Pay_name     = modelb2border.U_name,
                                Pay_phone    = modelb2border.U_phone,
                                Total_fee    = p_totalprice1,
                                Trade_no     = "",
                                Trade_status = "trade_pendpay",
                                Uip          = ""
                            };
                            int payid = datapay.InsertOrUpdate(eticket);
                        }
                        else
                        {
                            //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                            if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                            {
                                //防止金额有所改动
                                modelb2pay.Pay_com   = "wx";
                                modelb2pay.Total_fee = p_totalprice1;
                                datapay.InsertOrUpdate(modelb2pay);
                            }
                        }
                    }
                }
            }
        }
示例#22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //RequestUrl = Request.ServerVariables["SERVER_NAME"].ToLower();
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            if (Request.QueryString["code"] != null)
            {
                orderid = Request["orderid"].ConvertTo <int>(0);

                Returnmd5 = EncryptionHelper.ToMD5(orderid.ToString() + "lixh1210", "UTF-8");


                if (orderid != 0)
                {
                    //根据订单id得到订单信息
                    B2bOrderData dataorder     = new B2bOrderData();
                    B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                    orderstatus = EnumUtils.GetName((OrderStatus)modelb2border.Order_state);
                    paystatus   = modelb2border.Pay_state;//1未支付;2已支付
                    order_type  = modelb2border.Order_type;

                    //根据产品id得到产品信息
                    B2bComProData datapro     = new B2bComProData();
                    B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString(), modelb2border.Speciid, modelb2border.channelcoachid);

                    if (modelcompro != null)
                    {
                        servertype = modelcompro.Server_type;
                    }

                    cart = modelb2border.Shopcartid;//购物车

                    #region 正常订单
                    if (modelb2border.Order_type == 1)
                    {
                        if (modelcompro != null)
                        {
                            #region    务类型订单金额
                            p_totalprice1 = new B2bOrderData().GetOrderTotalPrice(modelcompro, modelb2border, out price, out pricedetail);
                            if (p_totalprice1 == 0 || price == "0")
                            {
                                Response.Write("<script>alert('订单金额不可为0');</script>");
                                Response.End();
                                return;
                            }
                            #endregion

                            proname     = modelcompro.Pro_name;
                            u_name      = modelb2border.U_name.Substring(0, 1) + "**";
                            u_mobile    = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);
                            travel_date = modelb2border.U_traveldate.ToString();
                            buy_num     = modelb2border.U_num;
                            u_youxiaoqi = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();

                            p_totalprice   = CommonFunc.OperTwoDecimal(p_totalprice1.ToString());
                            wxp_totalprice = (p_totalprice1 * 100).ToString("F0");
                            price          = modelb2border.Pay_price.ToString();

                            price = CommonFunc.OperTwoDecimal(price);
                            comid = modelcompro.Com_id;

                            var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                            if (saleset != null)
                            {
                                phone = saleset.Service_Phone;
                            }
                        }
                    }
                    #endregion

                    #region 充值订单
                    if (modelb2border.Order_type == 2)
                    {
                        //ordertype=2 充值订单会传递过来值
                        comid = modelb2border.Comid;

                        p_totalprice1  = modelb2border.U_num * modelb2border.Pay_price;
                        p_totalprice   = CommonFunc.OperTwoDecimal(p_totalprice1.ToString());
                        wxp_totalprice = (p_totalprice1 * 100).ToString("F0");

                        //获得商户电话
                        var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                        if (saleset != null)
                        {
                            phone = saleset.Service_Phone;
                        }
                    }
                    #endregion

                    #region 统一获得商户名称 和 微信支付链接
                    if (comid != 0)
                    {
                        comName = B2bCompanyData.GetCompany(comid).Com_name;
                    }
                    #endregion


                    #region 写入支付数据库,先判定是否有此订单支付
                    B2bPayData datapay    = new B2bPayData();
                    B2b_pay    modelb2pay = datapay.GetPayByoId(orderid);

                    if (modelb2pay != null)
                    {
                        //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                        if (modelb2pay.Trade_status == "TRADE_SUCCESS")
                        {
                            Response.Write("订单已经支付过!");
                            Response.End();
                            return;
                        }
                    }
                    #endregion

                    #region  微信支付
                    //根据产品判断商家是否含有自己的微信支付:a.含有的话支付到商家;b.没有的话支付到平台的微信公众号账户中
                    B2b_finance_paytype model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(comid);

                    if (model != null)
                    {
                        //商家微信支付的所有参数都存在
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            appId     = model.Wx_appid;
                            appsecret = model.Wx_appkey;
                            appkey    = model.Wx_paysignkey;
                            mchid     = model.Wx_partnerid;
                        }
                        else
                        {
                            model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                            if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                            {
                                appId     = model.Wx_appid;
                                appsecret = model.Wx_appkey;
                                appkey    = model.Wx_paysignkey;
                                mchid     = model.Wx_partnerid;
                            }
                        }
                    }
                    else
                    {
                        model = new B2b_finance_paytypeData().GetFinancePayTypeByComid(106);
                        if (model.Wx_appid != "" && model.Wx_appkey != "" && model.Wx_partnerid != "" && model.Wx_paysignkey != "")
                        {
                            appId     = model.Wx_appid;
                            appsecret = model.Wx_appkey;
                            appkey    = model.Wx_paysignkey;
                            mchid     = model.Wx_partnerid;
                        }
                    }



                    #region 获取用户openid
                    code = Request.QueryString["code"];
                    string url =
                        string.Format(
                            "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code",
                            appId, appsecret, code);
                    string returnStr = HttpUtil.Send("", url);

                    var obj = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);
                    if (obj.openid == null)
                    {
                        //WriteFile(Server.MapPath("") + "\\Log.txt", "code:" + code + "\r\n------------------------------\r\n returnStr:" + returnStr);

                        url = string.Format(
                            "https://api.weixin.qq.com/sns/oauth2/refresh_token?appid={0}&grant_type=refresh_token&refresh_token={1}",
                            appId, obj.refresh_token);
                        returnStr = HttpUtil.Send("", url);
                        obj       = JsonConvert.DeserializeObject <ModelOpenID>(returnStr);
                    }


                    //WriteFile(Server.MapPath("") + "\\Log.txt", "access_token:" + obj.access_token + "\r\n" + "--openid:" + obj.openid);


                    //url = string.Format(
                    //    "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}",
                    //    obj.access_token, obj.openid);
                    //returnStr = HttpUtil.Send("", url);
                    //WriteFile(Server.MapPath("") + "\\Log.txt", returnStr);
                    #endregion


                    //创建支付应答对象
                    var packageReqHandler = new RequestHandler(Context);
                    //初始化
                    packageReqHandler.init();

                    timeStamp = TenpayUtil.getTimestamp();
                    nonceStr  = TenpayUtil.getNoncestr();


                    //设置package订单参数
                    string productname = "";
                    if (modelb2border.Order_type == 1)
                    {
                        productname = modelcompro.Pro_name.Replace("\"", "").Replace("“", "").Replace("'", "").Replace("‘", "").Replace(";", "").Replace(";", "");

                        if (productname.Length > 50)
                        {
                            productname = productname.Substring(0, 50);
                        }
                    }
                    if (modelb2border.Order_type == 2)
                    {
                        productname = "预付款充值";
                    }
                    packageReqHandler.setParameter("body", productname); //商品信息 127字符
                    packageReqHandler.setParameter("appid", appId);
                    packageReqHandler.setParameter("mch_id", mchid);
                    packageReqHandler.setParameter("nonce_str", nonceStr.ToLower());
                    packageReqHandler.setParameter("notify_url", "http://shop" + comid + ".etown.cn/wxpay/backpaynotice.aspx");
                    packageReqHandler.setParameter("openid", obj.openid);
                    packageReqHandler.setParameter("out_trade_no", orderid.ToString());               //商家订单号
                    packageReqHandler.setParameter("spbill_create_ip", Page.Request.UserHostAddress); //用户的公网ip,不是商户服务器IP
                    packageReqHandler.setParameter("total_fee", wxp_totalprice);                      //商品金额,以分为单位(money * 100).ToString()
                    packageReqHandler.setParameter("trade_type", "JSAPI");

                    //获取package包
                    sign = packageReqHandler.CreateMd5Sign("key", appkey);
                    //WriteFile(Server.MapPath("") + "\\Log.txt", sign);
                    packageReqHandler.setParameter("sign", sign);

                    string data = packageReqHandler.parseXML();

                    //WriteFile(Server.MapPath("") + "\\Log.txt", "package包签名:" + sign + "-----\r\n向统一支付接口发送的xml:" + data);

                    string prepayXml = HttpUtil.Send(data, "https://api.mch.weixin.qq.com/pay/unifiedorder");

                    //WriteFile(Server.MapPath("") + "\\Log.txt", "统一支付接口返回xml:" + prepayXml);

                    //获取预支付ID
                    var xdoc = new XmlDocument();
                    xdoc.LoadXml(prepayXml);
                    XmlNode     xn  = xdoc.SelectSingleNode("xml");
                    XmlNodeList xnl = xn.ChildNodes;
                    if (xnl.Count > 7)
                    {
                        prepayId = xnl[7].InnerText;
                        package  = string.Format("prepay_id={0}", prepayId);
                        //WriteFile(Server.MapPath("") + "\\Log.txt", "预支付id:" + package);
                    }

                    //设置支付参数
                    var paySignReqHandler = new RequestHandler(Context);
                    paySignReqHandler.setParameter("appId", appId);
                    paySignReqHandler.setParameter("timeStamp", timeStamp);
                    paySignReqHandler.setParameter("nonceStr", nonceStr);
                    paySignReqHandler.setParameter("package", package);
                    paySignReqHandler.setParameter("signType", "MD5");
                    paySign = paySignReqHandler.CreateMd5Sign("key", appkey);


                    //WriteFile(Server.MapPath("") + "\\Log.txt", "支付签名" + paySign);
                    #endregion

                    #region 订单提交支付信息
                    if (modelb2pay == null)
                    {
                        B2b_pay eticket = new B2b_pay()
                        {
                            Id           = 0,
                            Oid          = orderid,
                            Pay_com      = "wx",
                            Pay_name     = modelb2border.U_name,
                            Pay_phone    = modelb2border.U_phone,
                            Total_fee    = p_totalprice1,
                            Trade_no     = "",
                            Trade_status = "trade_pendpay",
                            Uip          = "",
                            comid        = model.Com_id
                        };
                        int payid = datapay.InsertOrUpdate(eticket);
                    }
                    else
                    {
                        //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                        if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                        {
                            //防止金额有所改动
                            modelb2pay.comid     = model.Com_id;
                            modelb2pay.Pay_com   = "wx";
                            modelb2pay.Total_fee = p_totalprice1;
                            datapay.InsertOrUpdate(modelb2pay);
                        }
                    }
                    #endregion
                }
            }
        }
示例#23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int orderid = Request["out_trade_no"].ConvertTo <int>(0);
            //根据订单id得到订单信息
            B2bOrderData dataorder     = new B2bOrderData();
            B2b_order    modelb2border = dataorder.GetOrderById(orderid);

            //根据产品id得到产品信息
            B2bComProData datapro     = new B2bComProData();
            B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());

            if (modelb2border != null)
            {
                //支付宝网关地址
                string GATEWAY_NEW = "http://wappaygw.alipay.com/service/rest.htm?";

                ////////////////////////////////////////////调用授权接口alipay.wap.trade.create.direct获取授权码token////////////////////////////////////////////

                //返回格式
                string format = "xml";
                //必填,不需要修改

                //返回格式
                string v = "2.0";
                //必填,不需要修改

                //请求号
                string req_id = DateTime.Now.ToString("yyyyMMddHHmmss");
                //必填,须保证每次请求都是唯一

                //req_data详细信息

                //服务器异步通知页面路径
                //string notify_url = "";
                string notify_url = "http://" + RequestUrl + "/h5/pay_by/notify_url.aspx";
                //需http://格式的完整路径,不允许加?id=123这类自定义参数

                //页面跳转同步通知页面路径
                //string call_back_url = "http://127.0.0.1:64704/WS_WAP_PAYWAP-CSHARP-UTF-8/call_back_url.aspx";
                string call_back_url = "http://" + RequestUrl + "/h5/pay_by/call_back_url.aspx";
                //需http://格式的完整路径,不允许加?id=123这类自定义参数

                //操作中断返回地址
                //string merchant_url = "http://v.etown.cn";
                string merchant_url = "http://" + RequestUrl + "/h5/Orderlist.aspx";
                //用户付款中途退出返回商户的地址。需http://格式的完整路径,不允许加?id=123这类自定义参数

                //卖家支付宝帐户
                string seller_email = "*****@*****.**";
                //必填

                //商户订单号
                string out_trade_no = modelb2border.Id.ToString();
                //商户网站订单系统中唯一订单号,必填

                //订单名称
                string subject = "";
                if (modelb2border.Order_type == 1)
                {
                    subject = modelcompro.Pro_name;
                }
                if (modelb2border.Order_type == 2)
                {
                    if (modelb2border.serverid == "")
                    {
                        subject = "预付款充值";
                    }
                    else
                    {
                        subject = "购买服务于押金";
                    }
                }
                //必填

                //付款金额
                string total_fee = (modelb2border.Pay_price * modelb2border.U_num + modelb2border.Express - modelb2border.Integral1 - modelb2border.Imprest1).ToString();
                //必填


                if (modelb2border.Child_u_num > 0)//如果是旅游包含儿童的
                {
                    total_fee = (Decimal.Parse(total_fee) + modelb2border.Child_u_num * (modelb2border.Pay_price - modelcompro.Childreduce)).ToString();
                }


                //如果是购物车订单重新写金额
                if (modelb2border.Shopcartid != 0)
                {
                    total_fee = dataorder.GetCartOrderMoneyById(orderid).ToString("0.00");;
                }


                //请求业务参数详细
                string req_dataToken = "<direct_trade_create_req><notify_url>" + notify_url + "</notify_url><call_back_url>" + call_back_url + "</call_back_url><seller_account_name>" + seller_email + "</seller_account_name><out_trade_no>" + out_trade_no + "</out_trade_no><subject>" + subject + "</subject><total_fee>" + total_fee + "</total_fee><merchant_url>" + merchant_url + "</merchant_url></direct_trade_create_req>";
                //必填

                //把请求参数打包成数组
                Dictionary <string, string> sParaTempToken = new Dictionary <string, string>();
                sParaTempToken.Add("partner", Config.Partner);
                sParaTempToken.Add("_input_charset", Config.Input_charset.ToLower());
                sParaTempToken.Add("sec_id", Config.Sign_type.ToUpper());
                sParaTempToken.Add("service", "alipay.wap.trade.create.direct");
                sParaTempToken.Add("format", format);
                sParaTempToken.Add("v", v);
                sParaTempToken.Add("req_id", req_id);
                sParaTempToken.Add("req_data", req_dataToken);

                //建立请求
                string sHtmlTextToken = Submit.BuildRequest(GATEWAY_NEW, sParaTempToken);
                //URLDECODE返回的信息
                Encoding code = Encoding.GetEncoding(Config.Input_charset);
                sHtmlTextToken = HttpUtility.UrlDecode(sHtmlTextToken, code);

                //解析远程模拟提交后返回的信息
                Dictionary <string, string> dicHtmlTextToken = Submit.ParseResponse(sHtmlTextToken);

                //获取token
                string request_token = dicHtmlTextToken["request_token"];

                ////////////////////////////////////////////根据授权码token调用交易接口alipay.wap.auth.authAndExecute////////////////////////////////////////////


                //业务详细
                string req_data = "<auth_and_execute_req><request_token>" + request_token + "</request_token></auth_and_execute_req>";
                //必填

                //把请求参数打包成数组
                Dictionary <string, string> sParaTemp = new Dictionary <string, string>();
                sParaTemp.Add("partner", Config.Partner);
                sParaTemp.Add("_input_charset", Config.Input_charset.ToLower());
                sParaTemp.Add("sec_id", Config.Sign_type.ToUpper());
                sParaTemp.Add("service", "alipay.wap.auth.authAndExecute");
                sParaTemp.Add("format", format);
                sParaTemp.Add("v", v);
                sParaTemp.Add("req_data", req_data);



                //写入支付数据库,先判定是否有此订单支付
                //根据订单id得到订单信息
                B2bPayData datapay    = new B2bPayData();
                B2b_pay    modelb2pay = datapay.GetPayByoId(orderid);


                if (modelb2pay == null)
                {
                    B2b_pay eticket = new B2b_pay()
                    {
                        Id           = 0,
                        Oid          = orderid,
                        Pay_com      = "malipay",
                        Pay_name     = modelb2border.U_name,
                        Pay_phone    = modelb2border.U_phone,
                        Total_fee    = decimal.Parse(total_fee),
                        Trade_no     = "",
                        Trade_status = "trade_pendpay",
                        Uip          = "",
                        comid        = 106
                    };
                    int payid = datapay.InsertOrUpdate(eticket);
                }
                else
                {
                    //对已完成支付的,再次提交支付,跳转到订单也或显示此订单已支付
                    if (modelb2pay.Trade_status != "TRADE_SUCCESS")
                    {
                        //防止金额有所改动
                        modelb2pay.comid     = 106;
                        modelb2pay.Pay_com   = "malipay";
                        modelb2pay.Total_fee = decimal.Parse(total_fee);
                        datapay.InsertOrUpdate(modelb2pay);
                    }
                }



                //建立请求
                string sHtmlText = Submit.BuildRequest(GATEWAY_NEW, sParaTemp, "get", "确认");
                Response.Write(sHtmlText);
            }
        }
示例#24
0
        //读取用户信息
        private void Readuser(decimal idcard, int comid)
        {
            Today = DateTime.Now.ToString("yyyy-MM-dd");
            B2bCrmData dateuser = new B2bCrmData();

            var userinfo = dateuser.GetB2bCrmByCardcode(idcard);

            if (userinfo != null)
            {
                Integral = userinfo.Integral.ToString() == "" ? "0" : userinfo.Integral.ToString();
                Imprest  = userinfo.Imprest.ToString() == "" ? "0" : userinfo.Imprest.ToString();

                AccountWeixin = userinfo.Weixin;
                AccountEmail  = userinfo.Email;
                Accountphone  = userinfo.Phone;
                AccountCard   = userinfo.Idcard.ToString();
                string a = AccountCard.Substring(0, 1);
                if (a != null)
                {
                    fcard = int.Parse(a.ToString());
                }

                MemberCardData carddata = new MemberCardData();
                var            cardinfo = carddata.GetCardByCardNumber(decimal.Parse(AccountCard));
                if (cardinfo != null)
                {
                    channelid = Int32.Parse(cardinfo.IssueCard.ToString());
                }



                //获取预付款记录
                B2bFinanceData fdate      = new B2bFinanceData();
                int            totalcount = 0;
                var            list       = fdate.ImprestList(1, 10, comid, out totalcount, userinfo.Id);
                if (list != null)
                {
                    Imprestlist = "<ul>";
                    for (int i = 0; i < list.Count; i++)
                    {
                        if (list[i].Money < 0)
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  支出:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                        else
                        {
                            Imprestlist += "<li>" + list[i].Subdate + "  获得:" + list[i].Money.ToString("0.00") + "元</li>";
                        }
                    }
                    Imprestlist += "</ul>";
                }


                //获取积分记录
                var integrallist = fdate.IntegralList(1, 10, comid, out totalcount, userinfo.Id);
                if (integrallist != null)
                {
                    Integrallist = "<ul>";
                    for (int i = 0; i < integrallist.Count; i++)
                    {
                        if (integrallist[i].Money < 0)
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  支出:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                        else
                        {
                            Integrallist += "<li>" + integrallist[i].Subdate + "  获得:" + integrallist[i].Money.ToString("0") + "</li>";
                        }
                    }
                    Integrallist += "</ul>";
                }


                //消费记录
                string       proname    = "";
                string       orderstate = "";
                B2bOrderData dataorder  = new B2bOrderData();
                var          prodata    = new B2bComProData();
                var          order      = dataorder.ConsumerOrderPageList("", 1, 10, userinfo.Id, out totalcount);
                if (order != null)
                {
                    Orderlist = "<ul>";
                    for (int i = 0; i < order.Count; i++)
                    {
                        var promodel = prodata.GetProById(order[i].Pro_id.ToString());
                        if (promodel != null)
                        {
                            proname = promodel.Pro_name;
                        }

                        orderstate = EnumUtils.GetName((OrderStatus)order[i].Order_state);

                        Orderlist += "<li>" + proname + "(" + order[i].U_subdate + ") " + order[i].U_num + "(" + orderstate + ")</li>";
                    }
                    Orderlist += "</ul>";
                }



                //当读取用户信息的时候,判断是否有渠道转发信息
                if (Request.Cookies["ZF_ChanneId"] != null)
                {
                    int ZF_ChanneId = 0;
                    ZF_ChanneId = int.Parse(Request.Cookies["ZF_ChanneId"].Value);
                    if (ZF_ChanneId != 0)
                    { //有转发渠道ID
                        //在这判断 用户渠道是否为微信注册过来的
                        Member_Channel channel2 = new MemberChannelData().GetChannelByOpenId(userinfo.Weixin);
                        if (channel2 != null)
                        {
                            if (channel2.Issuetype == 4)
                            {
                                //如果为微信注册过来的 ,则修改会员渠道即可
                                int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                            }
                        }
                        else
                        {
                            //没有渠道的 ,则修改会员渠道即可
                            int upchannel = new MemberCardData().upCardcodeChannel(userinfo.Idcard.ToString(), ZF_ChanneId);
                        }

                        //清除Cookies
                        HttpCookie aCookie = new HttpCookie("ZF_ChanneId");
                        aCookie.Expires = DateTime.Now.AddDays(-1);
                        Response.Cookies.Add(aCookie);
                    }
                }


                dateuser.WeixinConPass(userinfo.Weixin, comid);//只要包含SESSION登陆成功,清空微信密码
            }
        }
示例#25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            //返回订单号
            orderid      = Request["orderid"].ConvertTo <int>(0);
            agentorderid = Request["agentorderid"].ConvertTo <int>(0);
            if (orderid != 0)
            {
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                if (modelb2border != null)
                {
                    if (!bo)
                    {
                        Response.Redirect("/ui/vasui/pay.aspx?orderid=" + orderid + "&comid=" + modelb2border.Comid);
                    }
                }


                //取消超时订单
                B2b_com_pro pro_cannelorder = new B2b_com_pro();
                pro_cannelorder.Server_type = 0;
                int rs_cannelorder = new B2bComProData().CancelOvertimeOrder(pro_cannelorder);



                orderstatus = EnumUtils.GetName((OrderStatus)modelb2border.Order_state);

                order_state = modelb2border.Order_state;
                paystatus   = modelb2border.Pay_state;//1未支付;2已支付
                order_type  = modelb2border.Order_type;
                subtime     = modelb2border.U_subdate.ToString("yyyy/MM/dd hh:mm:ss");
                comid       = modelb2border.Comid;

                #region 正常订单
                if (modelb2border.Order_type == 1)
                {
                    //根据产品id得到产品信息
                    B2bComProData datapro     = new B2bComProData();
                    B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString(), modelb2border.Speciid);

                    ////如果订单“未付款”显示支付及订单信息
                    //if ((int)modelb2border.Order_state == (int)OrderStatus.WaitPay)
                    //{
                    if (modelb2border.U_name != "")
                    {
                        u_name = modelb2border.U_name.Substring(0, 1) + "**";
                    }
                    else
                    {
                        u_name = "**";
                    }

                    if (modelb2border.U_phone != "")
                    {
                        u_mobile = modelb2border.U_phone.Substring(0, 4) + "****" + modelb2border.U_phone.Substring(modelb2border.U_phone.Length - 3, 3);
                    }
                    else
                    {
                        u_mobile = "****";
                    }


                    travel_date = modelb2border.U_traveldate.ToString();
                    buy_num     = modelb2border.U_num;

                    if (modelcompro != null)
                    {
                        u_youxiaoqi  = modelcompro.Pro_start.ToString() + " - " + modelcompro.Pro_end.ToString();
                        travel_proid = modelcompro.Travelproductid;
                        comid        = modelcompro.Com_id;
                        proname      = modelcompro.Pro_name;
                        servertype   = modelcompro.Server_type;
                        Ispanicbuy   = modelcompro.Ispanicbuy;
                    }

                    #region 如果服务类型是“酒店客房”,则根据酒店扩展订单表中房态信息,获取支付金额
                    if (modelcompro.Server_type == 9)
                    {
                        B2b_order_hotel hotelorder = new B2b_order_hotelData().GetHotelOrderByOrderId(orderid);
                        if (hotelorder != null)
                        {
                            string   fangtai    = hotelorder.Fangtai;
                            DateTime start_data = hotelorder.Start_date;
                            DateTime end_data   = hotelorder.End_date;
                            int      bookdaynum = hotelorder.Bookdaynum;

                            decimal  everyroomprice = 0;
                            string[] ftstr          = fangtai.Split(',');
                            for (int i = 0; i < ftstr.Length; i++)
                            {
                                if (ftstr[i].ConvertTo <decimal>(0) > 0)
                                {
                                    everyroomprice += ftstr[i].ConvertTo <decimal>(0);
                                }
                            }
                            price = everyroomprice.ToString();

                            p_totalprice = (modelb2border.U_num * everyroomprice - modelb2border.Integral1 - modelb2border.Imprest1);
                        }
                    }
                    #endregion
                    #region 当地游;跟团游;旅游大巴,获取支付金额
                    else if (servertype == 2 || servertype == 8) //当地游;跟团游;旅游大巴
                    {
                        string outdate = modelb2border.U_traveldate.ToString("yyyy-MM-dd");

                        //读取団期价格,根据实际选择的団期报价
                        B2b_com_LineGroupDate linemode = new B2b_com_LineGroupDateData().GetLineDayGroupDate(DateTime.Parse(outdate), modelcompro.Id);
                        if (linemode != null)//当地游;跟团游
                        {
                            price = linemode.Menprice.ToString();
                            if (servertype == 2 || servertype == 8)
                            {
                                decimal childreduce = modelcompro.Childreduce;
                                decimal childprice  = decimal.Parse(price) - childreduce;
                                if (childprice < 0)
                                {
                                    childprice = 0;
                                }
                                pricedetail = modelb2border.U_num + "成人," + modelb2border.Child_u_num + "儿童(成人" + price + "元/人,儿童" + childprice + "元/人)";

                                p_totalprice = (modelb2border.U_num * (linemode.Menprice) + (modelb2border.Child_u_num) * childprice - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                            else //旅游大巴:没有儿童减免
                            {
                                pricedetail = modelb2border.U_num + "人(" + price + "元/人)";

                                p_totalprice = (modelb2border.U_num * (linemode.Menprice) - modelb2border.Integral1 - modelb2border.Imprest1);
                            }
                        }
                    }
                    else if (servertype == 10)
                    {
                        pricedetail = modelb2border.U_num + "人(" + modelb2border.Pay_price.ToString("0.00") + "元/人)";

                        p_totalprice = (modelb2border.U_num * (modelb2border.Pay_price) - modelb2border.Integral1 - modelb2border.Imprest1);
                    }



                    #endregion
                    #region 票务、实物,获取支付金额
                    else //票务
                    {
                        p_totalprice = (modelb2border.U_num * modelb2border.Pay_price - modelb2border.Integral1 - modelb2border.Imprest1);
                        price        = modelb2border.Pay_price.ToString(); //modelb2border.Pay_price.ToString();
                        if (price == "0.00" || price == "0")
                        {
                            price = "";
                        }
                        else
                        {
                            price = CommonFunc.OperTwoDecimal(price);
                        }
                    }
                    #endregion
                    //}

                    #region  获得服务电话
                    var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (saleset != null)
                    {
                        phone = saleset.Service_Phone;
                    }

                    if (modelcompro != null)
                    {
                        //查询项目电话,如果有项目电话调取项目电话
                        var projectdata  = new B2b_com_projectData();
                        var projectmodel = projectdata.GetProject(modelcompro.Projectid, comid);
                        if (projectmodel != null)
                        {
                            if (projectmodel.Mobile != "")
                            {
                                phone = projectmodel.Mobile;
                            }
                        }
                    }
                    #endregion
                }
                #endregion
                #region 充值订单
                if (modelb2border.Order_type == 2)
                {
                    if (modelb2border.serverid != "")
                    {
                        proname = "购买服务与押金";
                    }
                    else if (modelb2border.payorder == 1)
                    {
                        proname = "快速支付";
                    }

                    else
                    {
                        proname = "预付款充值";
                    }

                    //ordertype=2 充值订单会传递过来值
                    if (comid == 0)
                    {
                        comid = Request["comid"].ConvertTo <int>(0);
                    }
                    p_totalprice = (modelb2border.U_num * modelb2border.Pay_price);
                    //获得商户电话
                    var saleset = B2bCompanySaleSetData.GetDirectSellByComid(comid.ToString());
                    if (saleset != null)
                    {
                        phone = saleset.Service_Phone;
                    }
                }
                #endregion
                p_totalpricedesc = CommonFunc.OperTwoDecimal(p_totalprice.ToString());


                #region 统一获得商户名称 和 微信支付链接
                if (comid != 0)
                {
                    wxpaylinkurl = WeiXinJsonData.GetFollowOpenLinkUrlAboutPay(comid, "http://shop" + comid + ".etown.cn/wxpay/payment_" + orderid + "_1.aspx");

                    comName = B2bCompanyData.GetCompany(comid).Com_name;
                }
                #endregion
            }
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int order_no = Int32.Parse(Request.QueryString["out_trade_no"]);            //获取订单号
            //返回订单号
            int orderid = order_no;

            if (orderid != 0)
            {
                //根据订单id得到订单信息
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);

                //根据产品id得到产品信息
                B2bComProData datapro     = new B2bComProData();
                B2b_com_pro   modelcompro = datapro.GetProById(modelb2border.Pro_id.ToString());


                //生成电子码
                int            u_num           = modelb2border.U_num;
                int            comid           = modelcompro.Com_id;
                RandomCodeData datarandomcode  = new RandomCodeData();
                RandomCode     modelrandomcode = datarandomcode.GetRandomCode();//得到未用随机码对象

                //设置取出的电子码状态为1(已使用)
                modelrandomcode.State = 1;
                int    randomcodeid = datarandomcode.InsertOrUpdate(modelrandomcode);
                string eticketcode  = "9" + comid.ToString() + modelrandomcode.Code.ToString();
                string sendstr      = "";

                //录入电子票列表
                B2bEticketData eticketdata = new B2bEticketData();
                B2b_eticket    eticket     = new B2b_eticket()
                {
                    Id           = 0,
                    Com_id       = comid,
                    Pro_id       = modelcompro.Id,
                    Agent_id     = 0,//直销
                    Pno          = eticketcode,
                    E_type       = (int)EticketCodeType.ShuZiMa,
                    Pnum         = modelb2border.U_num,
                    Use_pnum     = modelb2border.U_num,
                    E_proname    = modelcompro.Pro_name,
                    E_face_price = modelcompro.Face_price,
                    E_sale_price = modelcompro.Advise_price,
                    E_cost_price = modelcompro.Agentsettle_price,
                    V_state      = (int)EticketCodeStatus.NotValidate,
                    Send_state   = (int)EticketCodeSendStatus.NotSend,
                    Subdate      = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))
                };
                int eticketid = eticketdata.InsertOrUpdate(eticket);
                if (eticketid > 0)
                {
                    //生成电子码短信,稍后可单独写类或写到数据库中
                    diveticketcode.InnerText = "电子码生成成功:" + eticketcode;
                    sendstr = "感谢您订购" + modelcompro.Pro_name + modelb2border.U_num + "张" + ",电子码:" + eticketcode + " 有效期至:" + modelcompro.Pro_end.ToString("yyyy-MM-dd");
                }
                else
                {
                    diveticketcode.InnerText = "电子码生成ERROR";
                }
            }
        }
示例#27
0
        public decimal childreduce = 0;//儿童减免费用
        protected void Page_Load(object sender, EventArgs e)
        {
            lineid = Request["lineid"].ConvertTo <int>(0);
            uid    = Request["uid"].ConvertTo <int>(0);
            //获取IP地址
            uip     = CommonFunc.GetRealIP();
            nowdate = DateTime.Now;


            if (lineid != 0)
            {
                var prodata = new B2bComProData();
                var pro     = prodata.GetProById(lineid.ToString());

                if (pro != null)
                {
                    //作废超时未支付订单,完成回滚操作
                    int rs = new B2bComProData().CancelOvertimeOrder(pro);

                    childreduce = pro.Childreduce;

                    pro_name           = pro.Pro_name;
                    com_id             = pro.Com_id;
                    comid              = pro.Com_id;
                    pro_state          = pro.Pro_state;
                    server_type        = pro.Server_type;
                    pro_type           = pro.Pro_type;
                    source_type        = pro.Source_type;
                    pro_Remark         = pro.Pro_Remark;
                    pro_start          = pro.Pro_start;
                    pro_end            = pro.Pro_end;
                    face_price         = pro.Face_price;
                    advise_price       = pro.Advise_price;
                    agent1_price       = pro.Agent1_price;
                    agent2_price       = pro.Agent2_price;
                    agent3_price       = pro.Agent3_price;
                    agentsettle_price  = pro.Agentsettle_price;
                    thatDay_can        = pro.ThatDay_can;
                    thatday_can_day    = pro.Thatday_can_day;
                    service_Contain    = pro.Service_Contain;
                    service_NotContain = pro.Service_NotContain;
                    precautions        = pro.Precautions;
                    tuan_pro           = pro.Tuan_pro;
                    zhixiao            = pro.Zhixiao;
                    agentsale          = pro.Agentsale;
                    createtime         = pro.Createtime;
                    sms              = pro.Sms;
                    createuserid     = pro.Createuserid;
                    imgurl           = pro.Imgurl;
                    pro_number       = pro.Pro_number;
                    pro_explain      = pro.Pro_explain;
                    tuipiao          = pro.Tuipiao;
                    tuipiao_guoqi    = pro.Tuipiao_guoqi;
                    tuipiao_endday   = pro.Tuipiao_endday;
                    imgaddress       = FileSerivce.GetImgUrl(pro.Imgurl);
                    projectid        = pro.Projectid;
                    travelproductid  = pro.Travelproductid;
                    travelstarting   = pro.Travelstarting;
                    travelending     = pro.Travelending;
                    ispanicbuy       = pro.Ispanicbuy;
                    panic_begintime  = pro.Panic_begintime;
                    panicbuy_endtime = pro.Panicbuy_endtime;
                    limitbuytotalnum = pro.Limitbuytotalnum;

                    if (ispanicbuy == 1)
                    {
                        TimeSpan tss = panic_begintime - nowdate;
                        var      day = tss.Days * 24 * 3600;;          //这是相差的天数
                        var      h   = tss.Hours * 3600;               //这是相差的小时数,
                        var      m   = tss.Minutes * 60;
                        var      s   = tss.Seconds;
                        shijiacha = day + h + m + s;
                    }
                }
            }

            if (com_id != 0)
            {
                B2b_company company = B2bCompanyData.GetCompany(com_id);
                if (company != null)
                {
                    companyname = company.Com_name;
                    tel         = company.B2bcompanyinfo.Tel;
                }
                //获取渠道门市电话,当用户为门市会员则调取门市电话 tel
            }



            if (comid != 0)
            {
                var commodel = B2bCompanyData.GetCompany(comid);

                if (commodel != null)
                {
                    if (commodel.B2bcompanyinfo != null)
                    {
                        Wxfocus_url    = commodel.B2bcompanyinfo.Wxfocus_url;
                        Wxfocus_author = commodel.B2bcompanyinfo.Wxfocus_author;;
                    }
                }

                //获取微信平台端code
                string weixincode = Request["code"].ConvertTo <string>("");

                if (weixincode != "")
                {
                    int questtype = 2;//1=微信授权验证
                    DealUserinfo1("", weixincode, comid, questtype);
                }
                else
                {
                    string openid     = Request["openid"].ConvertTo <string>("");
                    string weixinpass = Request["weixinpass"].ConvertTo <string>("");
                    int    questtype  = 1;                               //1=一次性密码验证
                    DealUserinfo1(openid, weixinpass, comid, questtype); //判断用户微信号(1,点击的转发链接进来的2,点击微信菜单进来的);使用户处于登录状态(不包括点击转发链接的)
                }
            }



            //微信转发访问归属渠道
            if (uid != 0)//必须记录转发用户信息才能继续统计
            {
                //判断有转发人的渠道
                var    crmdata       = new B2bCrmData();
                var    pro           = crmdata.Readuser(uid, com_id);//读取转发人用户信息
                string zhuanfa_phone = "";
                if (pro != null)
                {
                    zhuanfa_phone = pro.Phone;
                }

                if (zhuanfa_phone != "")
                {                                                                                   //转发人手机存在
                    MemberChannelData channeldata = new MemberChannelData();
                    var channeinfo = channeldata.GetPhoneComIdChannelDetail(zhuanfa_phone, com_id); //查询渠道
                    if (channeinfo != null)
                    {
                        //转发人渠道记录COOKI
                        HttpCookie cookie = new HttpCookie("ZF_ChanneId");     //实例化HttpCookie类并添加值
                        cookie.Value   = channeinfo.Id.ToString();
                        cookie.Expires = DateTime.Now.AddDays(120);
                        Response.Cookies.Add(cookie);
                    }
                }
            }
        }