示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lineid = Request["lineid"].ConvertTo <int>(0);
            B2b_com_pro pro = new B2bComProData().GetProById(lineid.ToString());

            if (pro != null)
            {
                proname    = pro.Pro_name;
                pro_Remark = pro.Pro_Remark;
            }

            List <B2b_com_LineGroupDate> list = new B2b_com_LineGroupDateData().GetLineGroupDateByLineid(lineid);

            if (list != null && list.Count > 0)
            {
                var date = from r in list
                           select r.Daydate.ToString("yyyy-MM-dd");

                hidLeavingDate.Value = string.Join(",", date.ToList());

                hidMinLeavingDate.Value = string.Join(",", date.ToList()).Split(',')[0];


                var price = from p in list
                            select p.Menprice;
                hidLinePrice.Value = string.Join(",", price.ToList());
            }
        }
示例#2
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;
                    }
                }
            }
        }
示例#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 lineid = 0;//线路id

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lineid = Request["lineid"].ConvertTo <int>(0);
                if (lineid == 0)
                {
                    Response.Redirect("/ui/pmui/productlist.aspx");
                }

                List <B2b_com_LineGroupDate> list = new B2b_com_LineGroupDateData().GetLineGroupDateByLineid(lineid);
                if (list != null && list.Count > 0)
                {
                    var date = from r in list
                               select r.Daydate.ToString("yyyy-MM-dd");

                    hidLeavingDate.Value     = string.Join(",", date.ToList());
                    hidinitLeavingDate.Value = string.Join(",", date.ToList());
                }
            }
        }
示例#5
0
        public string projectimgurl = "";         //项目图片

        protected void Page_Load(object sender, EventArgs e)
        {
            DateTime checkindate1 = Request["indate"].ConvertTo <DateTime>();

            checkindate = checkindate1.ToString("yyyy-MM-dd");
            DateTime checkoutdate1 = Request["outdate"].ConvertTo <DateTime>();

            checkoutdate = checkoutdate1.ToString("yyyy-MM-dd");
            bookdaynum   = (checkoutdate1 - checkindate1).Days;

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


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

            bookdaynum = (checkoutdate1 - checkindate1).Days;

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

            //获得房态信息
            List <B2b_com_LineGroupDate> list = new B2b_com_LineGroupDateData().GetLineDayGroupDate(checkindate, checkoutdate, proid);

            if (list.Count > 0)
            {
                foreach (B2b_com_LineGroupDate m in list)
                {
                    singleroom_totalprice += m.Menprice;
                    fangtai += m.Menprice + ",";
                }
                if (fangtai.Length > 0)
                {
                    fangtai = fangtai.Substring(0, fangtai.Length - 1);
                }
            }

            if (proid != 0)
            {
                var prodata = new B2bComProData().GetProById(proid.ToString());
                if (prodata != null)
                {
                    comid = prodata.Com_id;
                    B2b_com_project mod = new B2b_com_projectData().GetProject(prodata.Projectid, comid);
                    if (mod != null)
                    {
                        projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg);
                        projectname   = mod.Projectname;
                    }
                }
            }



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

            if (openid != "")
            {
                B2b_crm b2bmodle = b2b_crm.b2b_crmH5(openid, comid);
                if (b2bmodle != null)
                {
                    Imprest  = b2bmodle.Imprest;
                    Integral = b2bmodle.Integral;
                }
            }
        }
示例#6
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);
                            }
                        }
                    }
                }
            }
        }
示例#7
0
        public decimal basic_agent3_price = 0; //基本信息中三级分销返还
        protected void Page_Load(object sender, EventArgs e)
        {
            //获取访问的域名
            RequestDomin = Request.ServerVariables["SERVER_NAME"].ToLower();
            Requestfile  = Request.ServerVariables["Url"].ToLower();



            //如果是微旅行,则直接跳转 当域名为微旅行,访问默认页面则直接跳转会员专区
            if ((RequestDomin == "v.vctrip.com" || RequestDomin == "www.vctrip.com" || RequestDomin == "v.etown.cn") && Requestfile == "/default.aspx")
            {
                //非手机的跳转到V目录下
                string u         = Request.ServerVariables["HTTP_USER_AGENT"];
                bool   phonebool = detectmobilebrowser.HttpUserAgent(u);
                if (phonebool == false)
                {
                    Response.Redirect("/V/");//非手机的跳转到V目录
                }
                else
                {
                    Response.Redirect("/M/");//非手机的跳转到V目录
                }
            }



            //如果是绑定域名跳转到产品页,否则
            B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestDomin);

            if (companyinfo != null)
            {
                if (companyinfo.Com_id == 1305)//麦客行
                {
                    if (UserHelper.ValidateLogin())
                    {
                        // TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "4");
                        GetUser();
                    }
                    else
                    {
                        //Response.Redirect("/h5/order/");
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "5");
                        Response.Redirect("/Agent/page.html");
                    }
                }
                else if (companyinfo.Com_id == 1194)//大好河山张家口
                {
                    if (UserHelper.ValidateLogin())
                    {
                        // TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "4");
                        GetUser();
                    }
                    else
                    {
                        //Response.Redirect("/h5/order/");
                        //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "5");
                        Response.Redirect("/Channel/index.aspx");
                    }
                }
                else
                {
                    //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\Log.txt", "6");
                    Response.Redirect("/ui/shangjiaui/ProductList.aspx");
                }
            }
            else
            {
                //判定是否为自助域名规则安 shop1.etown.cn
                if (Domain_def.Domain_yanzheng(RequestDomin))
                {
                    //comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestDomin));
                    if (RequestDomin == "shop1143.etown.cn")
                    {
                        Response.Redirect("http://shop.etown.cn/Manage/default.html");
                    }
                    else
                    {
                        Response.Redirect("/ui/shangjiaui/ProductList.aspx");
                    }
                }
                else
                {
                    if (UserHelper.ValidateLogin())
                    {
                        GetUser();
                    }
                    else
                    {
                        if (RequestDomin == "admin.vctrip.com")
                        {
                            Response.Redirect("/Manage/index1.html");
                        }
                        else
                        {
                            if (RequestDomin == "shop.etown.cn" || RequestDomin == "admin.etown.cn" || RequestDomin == "test.etown.cn")
                            {
                                Response.Redirect("/Manage/default.html");
                            }

                            if (RequestDomin == "mm.easytour.cn" || RequestDomin == "weixin.easytour.cn")//跳转渠道
                            {
                                Response.Redirect("/Channel/easytour.html");
                            }
                            else if (RequestDomin == "zhangjiakou.etown.cn" || RequestDomin == "zhangjiakoushop.etown.cn")//跳转渠道
                            {
                                Response.Redirect("/Channel/zhangjiakou.html");
                            }
                            else
                            {
                                Response.Redirect("/admin/");
                            }
                        }
                    }
                }
            }
            if (!IsPostBack)
            {
                lineid = Request["lineid"].ConvertTo <int>(0);
                if (lineid == 0)
                {
                    Response.Redirect("/ui/pmui/productlist.aspx");
                }
                //获得产品基本信息
                var pro = new B2bComProData().GetProById(lineid.ToString());
                if (pro != null)
                {
                    ServerType  = pro.Server_type;
                    adviseprice = pro.Advise_price;
                    linename    = pro.Pro_name;

                    basic_agent1_price = pro.Agent1_price;
                    basic_agent2_price = pro.Agent2_price;
                    basic_agent3_price = pro.Agent3_price;
                }



                //获得团期/房态
                List <B2b_com_LineGroupDate> list = new B2b_com_LineGroupDateData().GetLineGroupDateByLineid(lineid, "1");
                if (list != null && list.Count > 0)
                {
                    var date = from r in list
                               orderby r.Daydate
                               select r.Daydate.ToString("yyyy-MM-dd");

                    hidLeavingDate.Value     = string.Join(",", date.ToList());
                    hidinitLeavingDate.Value = string.Join(",", date.ToList());
                }
            }
        }
示例#8
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
            }
        }
        /*得到1个人的价格*/
        internal decimal Gethotelallprice(int proid, DateTime start_date, DateTime end_date, int Agentlevel)
        {
            //产品基本信息中的分销返还
            decimal basic_agentback1 = 0;
            decimal basic_agentback2 = 0;
            decimal basic_agentback3 = 0;
            //查询是否为导入产品,如果是导入产品读取主产品的id,读取主产品日历
            string sql_f = "select * from B2b_com_pro  where id=" + proid;
            var    cmd_f = sqlHelper.PrepareTextSqlCommand(sql_f);

            using (var reader = cmd_f.ExecuteReader())
            {
                if (reader.Read())
                {
                    if (reader.GetValue <int>("bindingid") != 0)
                    {
                        proid = reader.GetValue <int>("bindingid");
                    }
                    basic_agentback1 = reader.GetValue <decimal>("agent1_price");
                    basic_agentback2 = reader.GetValue <decimal>("agent2_price");
                    basic_agentback3 = reader.GetValue <decimal>("agent3_price");
                }
            }


            var r = new B2b_com_LineGroupDateData().GetHouseTypeDayList(proid, start_date.ToString("yyyy-MM-dd"), end_date.ToString("yyyy-MM-dd"));

            if (r.Count == 0)
            {
                return(0);
            }
            else
            {
                //判断是否有房型已满房
                string errmsg = "";

                if (errmsg == "")
                {
                    //判断是否查询超出了房态范围
                    System.TimeSpan ND = end_date - start_date;
                    int             n  = ND.Days; //天数差
                    if (r.Count < n)
                    {
                        errmsg = end_date.AddDays(r.Count - n).ToString("yyyy-MM-dd") + "房已满";
                        return(0);
                    }
                    else
                    {
                        //得到产品团期中的分销返还 和 产品基本信息中的分销返还:产品团期没有设置分销返还,则用基本信息中的分销返还
                        if (r[0].agent1_back == 0 && r[0].agent2_back == 0 && r[0].agent3_back == 0)
                        {
                            decimal agent_back = 0;//分销返还
                            if (Agentlevel == 1)
                            {
                                agent_back = basic_agentback1;
                            }
                            if (Agentlevel == 2)
                            {
                                agent_back = basic_agentback2;
                            }
                            if (Agentlevel == 3)
                            {
                                agent_back = basic_agentback3;
                            }

                            string sql = "select sum(Menprice) as Menprice  from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";

                            try
                            {
                                var cmd = sqlHelper.PrepareTextSqlCommand(sql);


                                decimal Menprice = 0;//总价格
                                using (var reader = cmd.ExecuteReader())
                                {
                                    if (reader.Read())
                                    {
                                        Menprice = reader.GetValue <decimal>("Menprice");
                                    }
                                }
                                return(Menprice - agent_back * n);
                            }
                            catch
                            {
                                return(0);
                            }
                        }
                        else
                        {
                            string sql = "select sum(Menprice) as Menprice  from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";
                            if (Agentlevel == 1)
                            {
                                sql = "select sum(Menprice) as Menprice,sum(agent1_back) as backmoney from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";
                            }
                            if (Agentlevel == 2)
                            {
                                sql = "select sum(Menprice) as Menprice,sum(agent2_back) as backmoney from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";
                            }
                            if (Agentlevel == 3)
                            {
                                sql = "select sum(Menprice) as Menprice,sum(agent3_back) as backmoney from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";
                            }

                            try
                            {
                                var cmd = sqlHelper.PrepareTextSqlCommand(sql);


                                decimal Menprice  = 0; //总价格
                                decimal backmoney = 0; //总减免
                                using (var reader = cmd.ExecuteReader())
                                {
                                    if (reader.Read())
                                    {
                                        Menprice = reader.GetValue <decimal>("Menprice");
                                        try
                                        {
                                            backmoney = reader.GetValue <decimal>("backmoney");
                                        }
                                        catch { }
                                    }
                                }
                                return(Menprice - backmoney);
                            }
                            catch
                            {
                                return(0);
                            }
                        }
                    }
                }
                else
                {
                    return(0);
                }
            }
        }
        /*得到一段时间内最小空房数量*/
        internal int GetMinEmptyNum(int proid, DateTime start_date, DateTime end_date)
        {
            //查询是否为导入产品,如果是导入产品读取主产品的id,读取主产品日历
            string sql_f = "select * from B2b_com_pro  where id=" + proid;
            var    cmd_f = sqlHelper.PrepareTextSqlCommand(sql_f);

            using (var reader = cmd_f.ExecuteReader())
            {
                if (reader.Read())
                {
                    if (reader.GetValue <int>("bindingid") != 0)
                    {
                        proid = reader.GetValue <int>("bindingid");
                    }
                }
            }


            var r = new B2b_com_LineGroupDateData().GetHouseTypeDayList(proid, start_date.ToString("yyyy-MM-dd"), end_date.ToString("yyyy-MM-dd"));

            if (r.Count == 0)
            {
                return(0);
            }
            else
            {
                //判断是否有房型已满房
                string errmsg = "";
                foreach (B2b_com_LineGroupDate m in r)
                {
                    if (m.Emptynum == 0)
                    {
                        errmsg = m.Daydate.ToString("yyyy-MM-dd") + "已满房";
                        break;
                    }
                }


                if (errmsg == "")
                {
                    //判断是否查询超出了房态范围
                    System.TimeSpan ND = end_date - start_date;
                    int             n  = ND.Days; //天数差
                    if (r.Count < n)
                    {
                        errmsg = end_date.AddDays(r.Count - n).ToString("yyyy-MM-dd") + "房已满";
                        return(0);
                    }
                    else
                    {
                        string sql = "select min(emptynum) as minemptynum from B2b_com_LineGroupDate where lineid=" + proid + " and daydate>='" + start_date + "' and daydate<'" + end_date + "' ";

                        try
                        {
                            var cmd = sqlHelper.PrepareTextSqlCommand(sql);


                            int minm = 0;//最小空位数量
                            using (var reader = cmd.ExecuteReader())
                            {
                                if (reader.Read())
                                {
                                    minm = reader.GetValue <int>("minemptynum");
                                }
                            }
                            return(minm);
                        }
                        catch
                        {
                            return(0);
                        }
                    }
                }
                else
                {
                    return(0);
                }
            }
        }
示例#11
0
        public int uid = 0;//会员id
        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);

            nowdate = Request["startdate"].ConvertTo <string>(DateTime.Now.ToString("yyyy-MM-dd"));
            enddate = Request["enddate"].ConvertTo <string>(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd"));

            proid     = Context.Request["proid"].ConvertTo <string>("0");
            projectid = Context.Request["projectid"].ConvertTo <int>(0);

            uid = Context.Request["uid"].ConvertTo <int>(0);

            comid = Request["id"].ConvertTo <int>(0);
            if (comid == 0)
            {
                if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
                {
                    comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
                }
                else
                {
                    //if (bo == false)
                    //{
                    //    Response.Redirect("http://vctrip.etown.cn/");
                    //}
                    B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                    if (companyinfo != null)
                    {
                        comid = companyinfo.Com_id;
                        //if (bo == false)
                        //{
                        //    if (comid == 101)
                        //    {
                        //        Response.Redirect("http://vctrip.etown.cn/");
                        //    }
                        //    Response.Redirect("http://shop" + comid + ".etown.cn");
                        //}
                    }
                }
            }


            if (proid != "0" && proid != "")
            {
                var prodata = new B2bComProData().GetProById(proid);
                if (prodata != null)
                {
                    comid     = prodata.Com_id;
                    projectid = prodata.Projectid;
                    var m = new B2b_com_LineGroupDateData().GetMinValidByProid(prodata.Id, comid);
                    if (m != null)
                    {
                        mindate     = m.Daydate.ToString("yyyy-MM-dd");
                        mindate_out = m.Daydate.AddDays(1).ToString("yyyy-MM-dd");
                    }
                }
            }


            //判断是否为平台。只有106,101
            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                comid_temp = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
            }
            else
            {
                B2b_company_info companyinfo = B2bCompanyData.GetComId(RequestUrl);
                if (companyinfo != null)
                {
                    comid_temp = companyinfo.Com_id;
                }
            }

            if (comid_temp == 101 || comid_temp == 106)
            {
                comidture = 1;
            }

            if (comid != 0)
            {
                //if (bo == false)
                //{
                //    if (comid == 101)
                //    {
                //        Response.Redirect("http://vctrip.etown.cn/");
                //    }
                //    Response.Redirect("http://shop" + comid + ".etown.cn");
                //}

                B2b_company companyinfo = B2bCompanyData.GetCompany(comid);

                B2bCompanyInfoData info = new B2bCompanyInfoData();
                if (companyinfo != null)
                {
                    comName = companyinfo.Com_name;
                    if (comName.Length >= 9)
                    {
                        comName = comName.Substring(0, 9) + "..";
                    }

                    remark = info.GetCompanyInfo(comid).Scenic_intro;
                    if (remark.Length > 42)
                    {
                        remark = remark.Substring(0, 42) + "&nbsp;&nbsp;<a style=\"color:#1a9ed9\" href=\"Hotelinfo.aspx?id=" + comid + "\">(查看全部)</a>";
                    }
                }

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

            if (projectid == 0)
            {
                if (proid.ConvertTo <int>(0) > 0)
                {
                    B2b_com_pro modelpro = new B2bComProData().GetProById(proid);
                    if (modelpro != null)
                    {
                        projectid = modelpro.Projectid;
                    }
                }
            }
            B2b_com_project mod = new B2b_com_projectData().GetProject(projectid, comid);

            if (mod != null)
            {
                projectimgurl = FileSerivce.GetImgUrl(mod.Projectimg);

                projectname  = mod.Projectname;
                projectbrief = mod.Briefintroduce;
                if (mod.Mobile != "")
                {
                    phone = mod.Mobile;
                }
            }


            //------------------------------新添加代码(主要目的就是获取微信号使用户处于登录状态以及判断用户转发时引发的微信号混乱问题)===========================

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

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