Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            orderid = Request["orderid"].ConvertTo <int>(0);
            string dikou = Request["dikou"].ConvertTo <string>("");

            if (dikou == "OK")
            {
                title = "订单支付 成功!";
            }
            else
            {
                title = dikou;
            }
            if (orderid != 0)
            {
                B2b_order orderdate = new B2bOrderData().GetOrderById(orderid);
                if (orderdate != null)
                {
                    var saleset = B2bCompanySaleSetData.GetDirectSellByComid(orderdate.Comid.ToString());
                    if (saleset != null)
                    {
                        phone = saleset.Service_Phone;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public string pnocode(int id)
        {
            string pno = "";

            if (id != 0)
            {
                //根据订单信息得到产品详情
                B2b_com_pro proo = new B2bComProData().GetProByOrderID(id);
                if (proo != null)
                {
                    int sourcetype = proo.Source_type;
                    if (sourcetype == 1)
                    {
                        //根据订单号得到电子码信息
                        B2b_eticket eticket = new B2bEticketData().SelectOrderid(id);
                        if (eticket != null)
                        {
                            pno = eticket.Pno;
                        }
                    }
                    if (sourcetype == 2)
                    {
                        B2b_order order = new B2bOrderData().GetOrderById(id);
                        pno = order.Pno;
                    }
                }
            }
            return(pno);
        }
Ejemplo n.º 3
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string    qunarorderid = qunar_order.Text.Trim();
            B2b_order ordermodel   = new B2bOrderData().GetOrderById(qunarorderid.ConvertTo <int>(0));

            EticketJsonData.AsyncSend_qunar(ordermodel);
        }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     orderid = Request["id"].ConvertTo <int>(0);
     bank    = Request["bank"].ConvertTo <int>(0);
     if (orderid != 0)
     {
         string u  = Request.ServerVariables["HTTP_USER_AGENT"];
         bool   bo = detectmobilebrowser.HttpUserAgent(u);
         //根据订单id得到订单信息
         B2bOrderData dataorder     = new B2bOrderData();
         B2b_order    modelb2border = dataorder.GetOrderById(orderid);
         if (modelb2border != null)
         {
             comid = modelb2border.Comid;
             //if (bo == false)
             //{
             //    if (comid == 101)
             //    {
             //        Response.Redirect("http://vctrip.etown.cn/");
             //    }
             //    Response.Redirect("http://shop" + comid + ".etown.cn");
             //}
         }
     }
 }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            orderid = Request["orderid"].ConvertTo <int>(0);
            //从cookie中得到微信号
            if (Request.Cookies["openid"] != null)
            {
                openid = Request.Cookies["openid"].Value;
            }

            if (Session["AccountId"] != null)
            {
                //先判断Session
                AccountId = int.Parse(Request.Cookies["AccountId"].Value);
            }

            if (orderid != 0)
            {
                B2b_order order = new B2bOrderData().GetOrderById(orderid);
                if (order != null)
                { //查询订单首先判断是否为指定用户的否则直接跳出
                    if (AccountId == 0 || order.U_id != AccountId)
                    {
                        Response.Redirect("indexcard.aspx");//订购账户不匹配 跳出
                    }
                }
                else
                {
                    Response.Redirect("indexcard.aspx");//没有查询到订单 跳出
                }



                //根据订单信息得到产品详情
                B2b_com_pro proo = new B2bComProData().GetProByOrderID(orderid);
                if (proo != null)
                {
                    sourcetype = proo.Source_type;
                    servertype = proo.Server_type;

                    if (order != null)
                    {
                        if (sourcetype == 2 || sourcetype == 1)//倒码或系统生成码
                        {
                            pno = order.Pno;
                        }

                        if (sourcetype == 4)   //分销导入产品
                        //读取原产品
                        {
                            B2b_order oldorder = new B2bOrderData().GetOrderById(order.Bindingagentorderid);
                            if (oldorder != null)
                            {
                                pno = oldorder.Pno;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 测试去哪消费通知
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Button1_Click(object sender, EventArgs e)
        {
            string    pno         = TextBox1.Text.Trim();
            var       eticketinfo = new B2bEticketData().GetEticketDetail(pno);
            B2b_order ordermodel  = new B2bOrderData().GetOrderById(eticketinfo.Oid);

            EticketJsonData.AsyncSend_qunar(ordermodel);
        }
Ejemplo n.º 7
0
        public static string ChannelFPageList(string comid, int pageindex, int pagesize, string key, int channelcomid)
        {
            var totalcount = 0;

            if (channelcomid == 0)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "传递参数错误" }));
            }

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();


                var         list   = financedata.FinancePageList(comid, pageindex, pagesize, key, out totalcount, channelcomid);
                IEnumerable result = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id                = finance.Id,
                        Com_id            = finance.Com_id,
                        ComName           = B2bCompanyData.GetCompany(finance.Com_id).Com_name,
                        Agent_id          = finance.Agent_id,
                        Eid               = finance.Eid,
                        Order_id          = finance.Order_id,
                        Servicesname      = finance.Servicesname,
                        ShortServicesname = finance.Servicesname.Length > 15 ? finance.Servicesname.Substring(0, 15) + "." : finance.Servicesname,
                        SerialNumber      = finance.SerialNumber,
                        Money             = finance.Money,
                        Money_come        = finance.Money_come,
                        Over_money        = finance.Over_money,
                        Payment           = finance.Payment,
                        Payment_type      = finance.Payment_type,
                        Subdate           = finance.Subdate,
                        Con_state         = finance.Con_state,
                        Remarks           = finance.Remarks,
                        PrintscreenUrl    = new FileUploadData().GetFileById(finance.Printscreen.ToString().ConvertTo <int>(0)) == null ? "" : new FileUploadData().GetFileById(finance.Printscreen.ToString().ConvertTo <int>(0)).Relativepath,
                        Pno               = orderdata.GetPnoByOrderId(finance.Order_id),
                        Channelid         = finance.Channelid,
                        ChannelName       = channeldata.GetChannelCompanyNameById(finance.Channelid),
                        Paychannelstate   = finance.Paychannelstate
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Ejemplo n.º 8
0
        private WxPayData UnifiedOrder(string openId, string productId, WxPayConfig config)
        {
            #region  productid中包含oid,则传递过来的是订单号
            if (productId.IndexOf("oid") > -1)
            {
                B2b_order morder = new B2bOrderData().GetOrderById(productId.Substring(3).ConvertTo <int>(0));
                if (morder == null)
                {
                    throw new WxPayException("原生支付订单查询失败!");
                }
                B2b_com_pro modelcompro = new B2bComProData().GetProById(morder.Pro_id.ToString());
                if (modelcompro == null)
                {
                    throw new WxPayException("原生支付产品查询失败!");
                }

                string  price          = "0"; //单价
                string  pricedetail    = "";  //价格描述
                decimal p_totalprice1  = new B2bOrderData().GetOrderTotalPrice(modelcompro, morder, out price, out pricedetail);
                string  wxp_totalprice = (p_totalprice1 * 100).ToString("F0");
                if (p_totalprice1 == 0 || price == "0")
                {
                    throw new WxPayException("订单金额不可为0!");
                }

                //统一下单
                WxPayData req = new WxPayData();
                req.SetValue("body", modelcompro.Pro_name);
                req.SetValue("attach", "");
                req.SetValue("out_trade_no", productId.Substring(3));
                req.SetValue("total_fee", wxp_totalprice);
                req.SetValue("time_start", DateTime.Now.ToString("yyyyMMddHHmmss"));
                req.SetValue("time_expire", DateTime.Now.AddMinutes(10).ToString("yyyyMMddHHmmss"));
                req.SetValue("goods_tag", "");
                req.SetValue("trade_type", "NATIVE");
                req.SetValue("openid", openId);
                req.SetValue("product_id", productId);
                WxPayData result = WxPayApi.UnifiedOrder(req, config);
                return(result);
            }
            #endregion
            #region productid中包含pid,则传递过来的是产品号
            else if (productId.IndexOf("pid") > -1)
            {
                throw new WxPayException("暂时原生支付只是用于PC线上付款!");
            }
            #endregion
            #region productid中pid和oid 均不包含
            else
            {
                throw new WxPayException("暂时原生支付只是用于PC线上付款!!");
            }
            #endregion
        }
Ejemplo n.º 9
0
        public static string ComFinancePageList(string comid, int pageindex, int pagesize, string key, int oid = 0, string payment_type = "", string money_come = "", string starttime = "", string endtime = "")
        {
            var totalcount = 0;

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();

                B2bPayData  datapay = new B2bPayData();
                var         list    = financedata.FinancePageList(comid, pageindex, pagesize, key, out totalcount, 0, oid, payment_type, money_come, starttime, endtime);
                IEnumerable result  = "";
                if (list != null)
                {
                    result = from finance in list
                             select new
                    {
                        Id                = finance.Id,
                        Com_id            = finance.Com_id,
                        ComName           = B2bCompanyData.GetCompany(finance.Com_id).Com_name,
                        Agent_id          = finance.Agent_id,
                        Eid               = finance.Eid,
                        Order_id          = finance.Order_id,
                        Servicesname      = finance.Servicesname,
                        ShortServicesname = finance.Servicesname.Length > 15 ? finance.Servicesname.Substring(0, 15) + "." : finance.Servicesname,
                        SerialNumber      = finance.SerialNumber,
                        Money             = finance.Money,
                        Money_come        = finance.Money_come,
                        Over_money        = finance.Over_money,
                        Payment           = finance.Payment,
                        Payment_type      = finance.Payment_type,
                        Subdate           = finance.Subdate,
                        Con_state         = finance.Con_state,
                        Remarks           = finance.Remarks,
                        Pno               = orderdata.GetPnoByOrderId(finance.Order_id),
                        Channelid         = finance.Channelid,
                        ChannelName       = channeldata.GetChannelCompanyNameById(finance.Channelid),
                        Paychannelstate   = finance.Paychannelstate,
                        Agentname         = financedata.GetAgentNamebyorderid(finance.Order_id),
                        Payinfo           = datapay.GetPayByoId(finance.Order_id)
                    }
                }
                ;

                return(JsonConvert.SerializeObject(new { type = 100, totalCount = totalcount, msg = result }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Ejemplo n.º 10
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);
                }
            }
        }
Ejemplo n.º 11
0
        internal string GetOrderPaydesc(int orderid)
        {
            //判断是否有订单 绑定传入的订单
            B2b_order d_loldorder = new B2bOrderData().GetOldorderBybindingId(orderid);

            if (d_loldorder != null)
            {
                orderid = d_loldorder.Id;
            }
            string desc = GetOrderPay(orderid);

            return(desc);
        }
Ejemplo n.º 12
0
        public static string HotelOrderlist(int comid, string begindate, string enddate, int productid, string orderstate)
        {
            DataTable tblDatas = new B2bOrderData().HotelOrderlist(comid, begindate, enddate, productid, orderstate);

            if (tblDatas != null)
            {
                return(JsonConvert.SerializeObject(new { type = 100, msg = tblDatas }));
            }
            else
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = "" }));
            }
        }
        public string GetinsureNumbyorderid(int orderid)
        {
            using (var helper = new SqlHelper())
            {
                int bindorderid = new B2bOrderData().GetBindOrderIdByOrderid(orderid);
                if (bindorderid > 0)
                {
                    orderid = bindorderid;
                }

                string r = new Internalapi_hzins_OrderApplyResp_OrderExt(helper).GetinsureNumbyorderid(orderid);
                return(r);
            }
        }
Ejemplo n.º 14
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 = "验证错误";
            }
        }
Ejemplo n.º 15
0
        internal B2b_pay GetSUCCESSPayById(int orderid)
        {
            string sqltxt = "SELECT   [id] ,[oid] ,[pay_com] ,[pay_name],[pay_phone] ,[total_fee],[trade_no] ,[trade_status] ,[uip] ,wxtransaction_id,comid,subtime   FROM b2b_pay where [Oid]=" + orderid + " and [trade_status]='TRADE_SUCCESS'";
            //判断订单是否是购物车订单
            int shopcartid = new B2bOrderData().GetShopcartidbyoid(orderid);

            if (shopcartid > 0)
            {
                sqltxt = "SELECT   [id] ,[oid] ,[pay_com] ,[pay_name],[pay_phone] ,[total_fee],[trade_no] ,[trade_status] ,[uip] ,wxtransaction_id,comid,subtime    FROM  [b2b_pay] where oid in (select id from b2b_order where shopcartid=" + shopcartid + ") and [trade_status]='TRADE_SUCCESS' ";
            }


            var cmd = this.sqlHelper.PrepareTextSqlCommand(sqltxt);


            using (var reader = cmd.ExecuteReader())
            {
                if (reader.Read())
                {
                    return(new B2b_pay
                    {
                        Id = reader.GetValue <int>("Id"),
                        Oid = reader.GetValue <int>("oid"),
                        Pay_com = reader.GetValue <string>("pay_com"),
                        Pay_name = reader.GetValue <string>("pay_name"),
                        Pay_phone = reader.GetValue <string>("pay_phone"),
                        Total_fee = reader.GetValue <decimal>("total_fee"),
                        Trade_no = reader.GetValue <string>("trade_no"),
                        Trade_status = reader.GetValue <string>("trade_status"),
                        Uip = reader.GetValue <string>("uip"),
                        Wxtransaction_id = reader.GetValue <string>("wxtransaction_id"),
                        comid = reader.GetValue <int>("comid"),
                        subtime = reader.GetValue <DateTime>("subtime"),
                    });
                }
                return(null);
            }
        }
Ejemplo n.º 16
0
        public static string Financecount(string comid, string stardate, string enddate)
        {
            var totalcount = 0;

            try
            {
                var financedata = new B2bFinanceData();
                var orderdata   = new B2bOrderData();
                var channeldata = new MemberChannelcompanyData();


                var list = financedata.Financecount(comid, stardate, enddate);


                return(JsonConvert.SerializeObject(new { type = 100, msg = list }));
            }
            catch (Exception ex)
            {
                return(JsonConvert.SerializeObject(new { type = 1, msg = ex.Message }));

                throw;
            }
        }
Ejemplo n.º 17
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string oper       = context.Request["oper"].ConvertTo <string>("");
            string phone      = context.Request["phone"].ConvertTo <string>("");
            string smscontent = context.Request["smscontent"].ConvertTo <string>("");

            string dxstr = context.Request["dxstr"].ConvertTo <string>("");
            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", dxstr);
            string msg = "";

            if (oper == "234908uasdlkfjasdfou234kldfuasfk234u809dsfjasdfu90")
            {
                var snsback = SendSmsHelper.SendSms(phone, smscontent, 106, out msg);

                context.Response.Write(snsback);
            }

            //接收短信上行数据 http://ip:port/MO?dxstr=2,13800138000,0,F165245140224152846,20140428172543;2,15193792747,0,F165246140224152846,20140428172543;
            if (dxstr != "")
            {
                //var OrderData1 = new B2bOrderData();
                //var insertstepm = OrderData1.InsertSmsback(0, "", "", dxstr, "");


                var dxstr_arr = dxstr.Split(';');
                for (int i = 0; i < dxstr_arr.Length; i++) //分解每条消息
                {
                    if (dxstr_arr[i] != "")                //判断消息是否为空
                    {
                        var duanxin_arr = dxstr_arr[i].Split(',');
                        if (duanxin_arr.Length == 5)    //必须含有5个参数,下面读取对应的值,如果不匹配,暂时 不操作
                        {
                            var duanxin_type   = int.Parse(duanxin_arr[0]);
                            var duanxin_mobile = duanxin_arr[1];
                            var duanxin_state  = duanxin_arr[2];
                            var duanxin_con    = duanxin_arr[3];
                            var duanxin_time   = duanxin_arr[4];


                            if (duanxin_type == 0)    //上行消息

                            //上行消息写入记录
                            {
                                var OrderData = new B2bOrderData();
                                var insertsms = OrderData.InsertSmsback(duanxin_type, duanxin_mobile, duanxin_state, duanxin_con, duanxin_time);


                                //对上行消息判定
                                if (duanxin_con != "")
                                {
                                    if (duanxin_con.ToLower().Substring(0, 2) == "qr" || duanxin_con.ToLower().Substring(0, 2) == "qx" || duanxin_con.ToLower().Substring(0, 2) == "tj")
                                    {
                                        //截取前两个字qr,进入确认流程
                                        int orderid = int.Parse(duanxin_con.ToLower().Substring(2, duanxin_con.Length - 2));

                                        var snsback = OrderJsonData.UporderPaystate(orderid, duanxin_con.ToLower().Substring(0, 2), duanxin_mobile);

                                        context.Response.Write(snsback);
                                    }
                                }
                            }

                            if (duanxin_type == 2) //状态报告,未做
                            {
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
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");
            }
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u  = Request.ServerVariables["HTTP_USER_AGENT"];
            bool   bo = detectmobilebrowser.HttpUserAgent(u);


            if (Domain_def.Domain_yanzheng(RequestUrl))//如果符合shop101.etown.cn的格式,则从多微信商户基本信息表中获取comid
            {
                comid = Int32.Parse(Domain_def.Domain_Huoqu(RequestUrl));
            }

            if (comid == 0)//如果非标准格式,查询 是否有绑定的域名
            {
                var domaincomid = B2bCompanyData.GetComId(RequestUrl);
                if (domaincomid != null)
                {
                    comid = domaincomid.Com_id;
                }
            }

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

                if (commodel != null)
                {
                    title = commodel.Com_name;
                }
            }


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



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

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

            startime = DateTime.Now.ToString("yyyy-MM-dd");
            viewtype = Request["type"].ConvertTo <int>(0);



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



            //最后判断登陆
            if (AccountId == 0)
            {
                Response.Redirect("/h5/order/login.aspx?come=/h5/order/Coachappointment.aspx");//非手机的跳转到V目录
            }

            if (channelid != 0)
            {
                var jiaolianorderdata = new B2bOrderData().channelcoachOrderPageList(comid.ToString(), channelid);
                if (jiaolianorderdata != null)
                {
                    for (int i = 0; i < jiaolianorderdata.Count; i++)
                    {
                        datelist += jiaolianorderdata[i].Address + ",";
                        numlist  += jiaolianorderdata[i].U_num + ",";
                    }
                    if (datelist != "")
                    {
                        datelist = datelist.Substring(0, datelist.Length - 1);
                    }
                    if (numlist != "")
                    {
                        numlist = numlist.Substring(0, numlist.Length - 1);
                    }
                }
            }
        }
Ejemplo n.º 20
0
        public int viewtop        = 1; //头部及左侧相关显示控制
        protected void Page_Load(object sender, EventArgs e)
        {
            Request.ValidateInput();


            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 (orderid != 0)
            {
                B2bOrderData dataorder     = new B2bOrderData();
                B2b_order    modelb2border = dataorder.GetOrderById(orderid);
                if (modelb2border != null)
                {
                    proid = modelb2border.Pro_id.ToString();
                }
            }

            if (proid != "")
            {
                B2b_com_pro pro = new B2bComProData().GetProById(proid);
                if (pro != null)
                {
                    //如果是 云顶旅游大巴的 不显示头部
                    if (pro.Projectid == 2179)
                    {
                        viewtop     = 0;
                        Scenic_name = pro.Pro_name;
                        Com_name    = pro.Pro_name;
                    }

                    //绿野 不显示头部
                    if (pro.Com_id == 2553)
                    {
                        viewtop = 0;
                    }
                }
            }


            //根据域名读取商户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));
                }
            }

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

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

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

                        Copyright = comsetinfo.Copyright;
                    }
                }
            }
            else
            {
                //如果没有商户ID(域名未绑定) 则跳转管理登陆页面。
                // Response.Redirect("/Manage/index1.html");
            }
        }
Ejemplo n.º 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);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 22
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  //如果是 教练评价 客户
                      //查询渠道是否匹配,可能遇到不针对教练预约 ,暂时不做判定,这样 出现所有教练都有可能对客户进行评价,未指定教练,如何评价



                {
                }
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var inputStream = Request.InputStream;

            var strLen = Convert.ToInt32(inputStream.Length);

            var strArr = new byte[strLen];

            inputStream.Read(strArr, 0, strLen);

            var requestMes = Encoding.UTF8.GetString(strArr);

            //TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", requestMes);
            //录入和慧择网交互日志
            ApiLog mapilog = new ApiLog
            {
                Id            = 0,
                request_type  = "Hzins_AsyncNotice",
                Serviceid     = 2,
                Str           = requestMes.Trim(),
                Subdate       = DateTime.Now,
                ReturnStr     = "success",
                ReturnSubdate = DateTime.Now,
                Errmsg        = "",
            };
            int ins = new ApiLogData().EditLog(mapilog);



            Hzins_AsyncOrderInfo mresp = (Hzins_AsyncOrderInfo)JsonConvert.DeserializeObject(requestMes, typeof(Hzins_AsyncOrderInfo));

            if (mresp != null)
            {
                string insureNum = mresp.insureNum;
                int    orderid   = new Api_hzins_OrderApplyResp_OrderExtData().GetorderidbyinsureNum(mresp.insureNum);
                if (orderid == 0)
                {
                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", "orderid=0");
                    return;
                }
                B2b_order modelb2border = new B2bOrderData().GetOrderById(orderid);
                if (modelb2border == null)
                {
                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", "modelb2border==null");
                    return;
                }

                if (mresp.resultCode == 0)
                {
                    if (mresp.policyList != null)
                    {
                        List <AsyncOrderInfo_policyList> policyList = mresp.policyList;
                        foreach (AsyncOrderInfo_policyList policy in policyList)
                        {
                            int    issueState = policy.issueState;
                            string cName      = policy.insurant;

                            Api_hzins_OrderApplyResp_OrderInfo m1 = new Api_hzins_OrderApplyResp_OrderInfo
                            {
                                id         = 0,
                                orderid    = modelb2border.Id,
                                insureNum  = insureNum,
                                policyNum  = "",
                                cName      = cName,
                                cardCode   = "",
                                issueState = issueState
                            };
                            int ins1 = new Api_hzins_OrderApplyResp_OrderInfoData().EditOrderApplyResp_OrderInfo(m1);
                        }

                        modelb2border.Order_state  = (int)OrderStatus.HasSendCode;
                        modelb2border.Order_remark = "异步出单成功";
                        new B2bOrderData().InsertOrUpdate(modelb2border);

                        try
                        {
                            //如果保险订单(b单)是原始订单(a单)的绑定订单,则修改原始订单(a单)的状态
                            int aorderid = new B2bOrderData().Getinitorderid(orderid);
                            if (aorderid > 0)
                            {
                                new B2bOrderData().Uporderstate(aorderid, (int)OrderStatus.HasSendCode);
                            }
                        }
                        catch (Exception ex)
                        {
                            TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", "aorderid error");
                            return;
                        }
                    }
                }
                else
                {
                    modelb2border.Order_remark = "异步出单通知错误(" + requestMes + ")";
                    new B2bOrderData().InsertOrUpdate(modelb2border);

                    TxtHelper.WriteFile("D:\\site\\b2betown\\ETS2.WebApp\\BaoxianLog.txt", "mresp.resultCode != 0");
                    return;
                }
            }



            Response.Write("success");

            Response.End();
        }
Ejemplo n.º 24
0
        public void AsyncSend(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comidd1, int validateticketlogid)
        {
            Agent_asyncsendlog log = new Agent_asyncsendlog
            {
                Id                = 0,
                Pno               = pno,
                Num               = confirmnum,
                Sendtime          = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")),
                Confirmtime       = DateTime.Parse(confirmtime),
                Issendsuc         = 0,//0失败;1成功
                Agentupdatestatus = (int)AgentUpdateStatus.Fail,
                Agentcomid        = agentcomid,
                Comid             = comidd1,
                Remark            = "",
                Issecondsend      = 0,
                Platform_req_seq  = (1000000000 + agentcomid).ToString() + DateTime.Now.ToString("yyyyMMddhhssmm") + CommonFunc.CreateNum(6),//请求流水号
                Request_content   = "",
                Response_content  = "",
                b2b_etcket_logid  = validateticketlogid
            };
            int inslog = new Agent_asyncsendlogData().EditLog(log);

            log.Id = inslog;
            try
            {
                //获得分销商信息
                Agent_company agentinfo = new AgentCompanyData().GetAgentCompany(agentcomid);
                if (agentinfo != null)
                {
                    string agent_updateurl = agentinfo.Agent_updateurl;

                    #region 糯米分销
                    if (agentinfo.Agent_type == (int)AgentCompanyType.NuoMi)//糯米分销
                    {
                        string re = new GetUrlData().HttpPost(updateurl, "");

                        XmlDocument doc  = (XmlDocument)JsonConvert.DeserializeXmlNode("{\"root\":" + re + "}");
                        XmlElement  root = doc.DocumentElement;
                        string      info = root.SelectSingleNode("info").InnerText;

                        //只要返回了数据,则是发送成功
                        log.Id               = inslog;
                        log.Issendsuc        = 1;
                        log.Request_content  = updateurl;
                        log.Response_content = re;

                        if (info == "success")
                        {
                            string errCode = root.SelectSingleNode("res/errCode").InnerText;//分销商更新结果
                            if (errCode == "0")
                            {
                                log.Agentupdatestatus = (int)AgentUpdateStatus.Suc;
                                new Agent_asyncsendlogData().EditLog(log);
                            }
                            else
                            {
                                log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                                new Agent_asyncsendlogData().EditLog(log);
                            }
                        }
                        else
                        {
                            log.Remark            = info;
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                        }
                    }
                    #endregion
                    #region 一般分销
                    else //一般分销
                    {
                        var eticketinfo = new B2bEticketData().GetEticketDetail(pno);
                        if (eticketinfo == null)
                        {
                            log.Remark            = "获得电子票信息失败";//单引号替换为'',双引号不用处理;
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                            return;
                        }

                        //a订单:原分销向指定商户提交的订单;b订单:指定商户下的绑定分销向拥有产品的商户提交的订单
                        //电子票表中记录的Oid是b订单
                        //判断b订单 是否 属于某个a订单
                        B2b_order loldorder = new B2bOrderData().GetOldorderBybindingId(eticketinfo.Oid);
                        if (loldorder != null)
                        {
                            eticketinfo.Oid = loldorder.Id;
                        }

                        if (eticketinfo.Oid == 0)
                        {
                            log.Remark            = "电子票对应的订单号为0";//单引号替换为'',双引号不用处理;
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                            return;
                        }


                        /*根据订单号得到分销商订单请求记录(当前需要得到原订单请求流水号)*/
                        List <Agent_requestlog> listagent_rlog = new Agent_requestlogData().GetAgent_requestlogByOrdernum(eticketinfo.Oid.ToString(), "add_order", "1");
                        if (listagent_rlog == null)
                        {
                            log.Remark            = "根据订单号得到分销商订单请求记录失败";//单引号替换为'',双引号不用处理;
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                            return;
                        }
                        if (listagent_rlog.Count == 0)
                        {
                            log.Remark            = "根据订单号得到分销商订单请求记录失败.";//单引号替换为'',双引号不用处理;
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                            return;
                        }


                        /*验证通知发送内容*/
                        string sbuilder = string.Format("<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                                                        "<business_trans>" +
                                                        "<request_type>sync_order</request_type>" +  //<!--验证同步-->
                                                        "<req_seq>{0}</req_seq>" +                   //<!--原订单请求流水号-->
                                                        "<platform_req_seq>{1}</platform_req_seq>" + //<!--平台请求流水号-->
                                                        "<order>" +                                  //<!--订单信息-->
                                                        "<order_num>{2}</order_num>" +               //<!-- 订单号 y-->
                                                        "<num>{3}</num>" +                           //<!-- 使用张数 -->
                                                        "<use_time>{4}</use_time>" +                 //<!--  使用时间  -->
                                                        "</order>" +
                                                        "</business_trans>", listagent_rlog[0].Req_seq, log.Platform_req_seq, eticketinfo.Oid, confirmnum, ConvertDateTimeInt(DateTime.Parse(confirmtime)));

                        updateurl += "?xml=" + sbuilder;


                        string re = new GetUrlData().HttpPost(updateurl, "");

                        //只要返回了数据,则是发送成功
                        log.Id               = inslog;
                        log.Issendsuc        = 1;
                        log.Request_content  = updateurl;
                        log.Response_content = re;

                        log.Remark = re.Replace("'", "''");//单引号替换为'',双引号不用处理;
                        if (re.Length >= 7)
                        {
                            re = re.Substring(0, 7);
                        }
                        if (re == "success")
                        {
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Suc;
                            new Agent_asyncsendlogData().EditLog(log);
                        }
                        else
                        {
                            log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                            new Agent_asyncsendlogData().EditLog(log);
                        }
                    }
                    #endregion
                }
                else
                {
                    log.Remark            = "分销商获取失败";
                    log.Agentupdatestatus = (int)AgentUpdateStatus.Fail;
                    new Agent_asyncsendlogData().EditLog(log);
                }
            }
            catch (Exception e)
            {
                log.Id     = inslog;
                log.Remark = e.Message.Replace("'", "''");//单引号替换为'',双引号不用处理
                new Agent_asyncsendlogData().EditLog(log);
            }
        }
Ejemplo n.º 25
0
        delegate void AsyncsendEventHandler(string updateurl, string pno, int confirmnum, string confirmtime, int agentcomid, int comid, int validateticketlogid, int aorderid);//发送验证同步发送请求委托

        /// <summary>
        /// 阳光验证通知接口
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

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

            if (xml == "")
            {
                context.Response.Write("fail 接收参数为空");//参数为空
                return;
            }

            if (xml != "")
            {
                //录入交互日志
                ApiLog mapilog = new ApiLog
                {
                    Id            = 0,
                    request_type  = "sync_order",
                    Serviceid     = 1,
                    Str           = xml.Trim(),
                    Subdate       = DateTime.Now,
                    ReturnStr     = "",
                    ReturnSubdate = DateTime.Now,
                    Errmsg        = "",
                };
                int ins = new ApiLogData().EditLog(mapilog);
                mapilog.Id = ins;

                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(xml);
                    XmlElement root             = doc.DocumentElement;
                    string     request_type     = root.SelectSingleNode("request_type").InnerText;
                    string     req_seq          = root.SelectSingleNode("req_seq").InnerText;          //原订单流水号
                    string     platform_req_seq = root.SelectSingleNode("platform_req_seq").InnerText; //平台请求流水号
                    string     order_num        = root.SelectSingleNode("order/order_num").InnerText;  //订单号
                    string     num      = root.SelectSingleNode("order/num").InnerText;                //使用张数
                    string     use_time = root.SelectSingleNode("order/use_time").InnerText;           //使用时间

                    //根据平台订单号得到易城订单号
                    int orderid = new B2bOrderData().GetOrderidByServiceOrderNum(order_num);
                    if (orderid == 0)
                    {
                        //"老系统订单,服务商订单信息获取不到"===只有阳光订单才有这种可能,其他接口则直接返回错误
                        //把验票记录 记入 验证同步日志表
                        Api_yg_Syncordernotice notice = new Api_yg_Syncordernotice
                        {
                            id               = 0,
                            req_seq          = req_seq,
                            platform_req_seq = platform_req_seq,
                            order_num        = order_num,
                            num              = num.ConvertTo <int>(0),
                            use_time         = use_time.ConvertTo <DateTime>(),
                            rcontent         = "老系统订单,服务商订单信息获取不到",
                            orderid          = 0
                        };
                        int insnotice = new Api_yg_SyncordernoticeData().EditNotice(notice);
                        notice.id = insnotice;

                        mapilog.ReturnStr     = "success";
                        mapilog.ReturnSubdate = DateTime.Now;
                        mapilog.Errmsg        = notice.rcontent;
                        new ApiLogData().EditLog(mapilog);

                        context.Response.Write("success");
                        return;
                    }

                    //根据平台流水号 得到正确处理的验证通知记录
                    Api_yg_Syncordernotice sucnotice = new Api_yg_SyncordernoticeData().GetSucNotice(platform_req_seq);
                    if (sucnotice == null)
                    {
                        //把验票记录 记入 验证同步日志表
                        Api_yg_Syncordernotice notice = new Api_yg_Syncordernotice
                        {
                            id               = 0,
                            req_seq          = req_seq,
                            platform_req_seq = platform_req_seq,
                            order_num        = order_num,
                            num              = num.ConvertTo <int>(0),
                            use_time         = use_time.ConvertTo <DateTime>(),
                            rcontent         = "",
                            orderid          = orderid
                        };
                        int insnotice = new Api_yg_SyncordernoticeData().EditNotice(notice);
                        notice.id = insnotice;



                        //易城系统订单 处理
                        B2b_order morder = new B2bOrderData().GetOrderById(orderid);
                        if (morder != null)
                        {
                            int incount  = morder.U_num;                                     //总数量
                            int usecount = morder.service_usecount + num.ConvertTo <int>(0); //验证数量
                            if (incount == usecount)                                         //全部验证
                            {
                                morder.service_usecount   = usecount;
                                morder.service_lastcount  = incount - usecount - morder.Cancelnum;
                                morder.Servicepro_v_state = ((int)Product_V_State.AllValidate).ToString(); //验证全部
                                morder.Order_state        = (int)OrderStatus.HasUsed;                      //已消费

                                new B2bOrderData().InsertOrUpdate(morder);
                            }
                            else //部分验证
                            {
                                morder.service_usecount   = usecount;
                                morder.service_lastcount  = incount - usecount - morder.Cancelnum;
                                morder.Servicepro_v_state = ((int)Product_V_State.PartValidate).ToString(); //验证部分
                                morder.Order_state        = (int)OrderStatus.HasUsed;                       //已消费

                                new B2bOrderData().InsertOrUpdate(morder);
                            }

                            //根据b单判断是否有a单存在
                            B2b_order aorder = new B2bOrderData().GetOldorderBybindingId(morder.Id);
                            if (aorder != null)
                            {
                                aorder.Order_state = morder.Order_state;

                                new B2bOrderData().InsertOrUpdate(aorder);
                            }

                            notice.rcontent = "success";
                            new Api_yg_SyncordernoticeData().EditNotice(notice);


                            //如果是分销订单,则需要给分销发送验证通知
                            //判断b订单 是否 属于某个a订单
                            if (aorder != null)
                            {
                                //得到a订单的分销信息
                                if (aorder.Agentid > 0)
                                {
                                    Agent_company acompany = new AgentCompanyData().GetAgentCompany(aorder.Agentid);
                                    if (acompany != null)
                                    {
                                        //异步发送验证同步请求
                                        AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend);
                                        mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), morder.Pno, morder.service_usecount, use_time, aorder.Agentid, aorder.Comid, 0, aorder.Id, new AsyncCallback(Completed), null);
                                    }
                                }
                            }
                            else
                            {
                                if (morder.Agentid > 0)
                                {
                                    Agent_company acompany = new AgentCompanyData().GetAgentCompany(morder.Agentid);
                                    if (acompany != null)
                                    {
                                        //异步发送验证同步请求
                                        AsyncsendEventHandler mydelegate = new AsyncsendEventHandler(AsyncSend);
                                        mydelegate.BeginInvoke(acompany.Agent_updateurl.Trim(), morder.Pno, morder.service_usecount, use_time, morder.Agentid, morder.Comid, 0, morder.Id, new AsyncCallback(Completed), null);
                                    }
                                }
                            }

                            mapilog.ReturnStr     = "success";
                            mapilog.ReturnSubdate = DateTime.Now;
                            mapilog.Errmsg        = "成功";
                            new ApiLogData().EditLog(mapilog);

                            context.Response.Write("success");
                            return;
                        }
                        else
                        {
                            mapilog.ReturnStr     = "fail 获取订单失败";
                            mapilog.ReturnSubdate = DateTime.Now;
                            mapilog.Errmsg        = "fail 获取订单失败";
                            new ApiLogData().EditLog(mapilog);

                            notice.rcontent = "fail 获取订单失败";
                            new Api_yg_SyncordernoticeData().EditNotice(notice);

                            context.Response.Write("fail 获取订单失败");
                            return;
                        }
                    }
                    else
                    {
                        mapilog.ReturnStr     = "success";
                        mapilog.ReturnSubdate = DateTime.Now;
                        mapilog.Errmsg        = "已经成功处理过,不在处理";
                        new ApiLogData().EditLog(mapilog);

                        context.Response.Write("success");
                        return;
                    }
                }
                catch
                {
                    context.Response.Write("fail 意外错误");//意外错误
                    return;
                }
            }
        }
Ejemplo n.º 26
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");
                }
            }
        }
Ejemplo n.º 27
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");*/
            }
        }
Ejemplo n.º 28
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);
                    }
                }
            }
        }
Ejemplo n.º 29
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";
                }
            }
        }
Ejemplo n.º 30
0
        //验证通知
        protected void Button4_Click(object sender, EventArgs e)
        {
            string pno = TextBox2.Text.Trim();

            if (pno == "")
            {
                Label1.Text = "电子码不可为空";
                return;
            }
            if (pno.Length == 12 || pno.Length == 13)
            {
            }
            else
            {
                Label1.Text = "电子码格式有误";
                return;
            }
            int bindorderid = new B2bOrderData().GetOrderidbypno(pno);

            if (bindorderid == 0)
            {
                Label1.Text = "电子码输入有误";
                return;
            }

            //a订单:原分销向指定商户提交的订单;b订单:指定商户下的绑定分销向拥有产品的商户提交的订单
            //电子票表中记录的Oid是b订单
            //判断b订单 是否 属于某个a订单


            B2b_order loldorder = new B2bOrderData().GetOldorderBybindingId(bindorderid);

            if (loldorder != null)
            {
                //得到a订单的分销信息
                if (loldorder.Agentid > 0)
                {
                    Agent_company acompany = new AgentCompanyData().GetAgentCompany(loldorder.Agentid);
                    if (acompany != null)
                    {
                        string agent_updateurl    = acompany.Agent_updateurl;
                        string agent_Inter_deskey = acompany.Inter_deskey;

                        int a_comid   = loldorder.Comid;
                        int a_orderid = loldorder.Id;
                        int a_agentid = loldorder.Agentid;

                        if (agent_updateurl.Trim() != "" && agent_Inter_deskey != "")
                        {
                            //根据bingorderid 得到验证成功日志列表

                            List <B2b_eticket_log> loglist = new B2bEticketLogData().GeteticketloglistByorderid(bindorderid);
                            if (loglist.Count > 0)
                            {
                                foreach (B2b_eticket_log log in loglist)
                                {
                                    if (log != null)
                                    {
                                        AsyncSend(agent_updateurl, log.Pno, log.Use_pnum, log.Actiondate.ToString("yyyy-MM-dd HH:mm:ss"), a_agentid, a_comid, log.Id);
                                    }
                                }
                                Label1.Text = "验证通知发送成功";
                                return;
                            }
                            else
                            {
                                Label1.Text = "根据订单得到验证日志出错";
                                return;
                            }
                        }
                    }
                    else
                    {
                        Label1.Text = "分销订单查询出错";
                        return;
                    }
                }
                else
                {
                    Label1.Text = "不是分销订单";
                    return;
                }
            }
        }