protected void Page_Load(object sender, EventArgs e)
    {
        UserAuthorizationModel userInfo = UserAuthorization.userLogin(this.Page);

        if (userInfo.openId == null || userInfo.openId == "")
        {
            member = userInfo.mobile;
        }
        else
        {
            member = userInfo.openId;
        }
        ticketId = (string.IsNullOrEmpty(Request.QueryString["ticketId"]) ? 0 : int.Parse(Request.QueryString["ticketId"]));
        //预定数量
        reserverCount = (string.IsNullOrEmpty(Request.QueryString["reserverCount"]) ? 0 : int.Parse(Request.QueryString["reserverCount"]));
        if (!IsPostBack)
        {
            var bll = new LVWEIBA.DAL.ProviderSpot();
            ViewState["ticketId"] = ticketId;
            if (ticketId == 0 || reserverCount == 0)
            {
                Jscript.AlertAndRedirect("请选择合适的票数", "ticket.aspx");
            }
            else
            {
                LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(ticketId);
                ticketTitle        = providerSpot.SpotName;
                ticketId           = providerSpot.ID;
                startDate          = Convert.ToDateTime(providerSpot.BeginTime).ToString("yyyy年MM月dd号");
                endDate            = Convert.ToDateTime(providerSpot.EndTime).ToString("yyyy年MM月dd号");
                orderPriceLbl.Text = "¥" + providerSpot.ZkPrice;
                string priceDetailStr = reserverCount + "张";
                int    maketPrice     = (int)providerSpot.TicketPrice * reserverCount;
                int    zkPrice        = (int)providerSpot.ZkPrice * reserverCount;
                string str            = string.Format(@"<p>市场价:¥{0}({1})</p>
                       <p>优惠价:¥{2}({3})</p>", maketPrice, priceDetailStr, zkPrice, priceDetailStr);
                this.priceDetailLbl.Text = str;
                this.hid_count.Value     = reserverCount.ToString();
                this.hid_price_sc.Value  = maketPrice.ToString();
                this.hid_price_yh.Value  = zkPrice.ToString();
                this.hid_ticket_id.Value = ticketId.ToString();
                this.hid_price_jj.Value  = providerSpot.SellPrice.ToString();
                HiddenFieldBZ.Value      = str.Replace("<p>", "").Replace("</p>", "");

                LVWEIBA.BLL.MemberHotel          bllhotel = new LVWEIBA.BLL.MemberHotel();
                List <LVWEIBA.Model.MemberHotel> lsthotel = bllhotel.GetModelList(" member='" + userInfo.mobile + "' or member='" + userInfo.openId + "'");
                string strhotel = "";
                foreach (MemberHotel item in lsthotel)
                {
                    strhotel += string.Format(" <input id='Checkbox1' name='hotel' class='hotel' type='checkbox' value='{0}' />{1}", item.Id, item.Name);
                }
                contactPersonsLiteral.Text = strhotel;
            }
        }
    }
示例#2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary <string, string> sPara = GetRequestPost();

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

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

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

                //商户订单号
                openId = Request.Form["body"];
                string out_trade_no = Request.Form["out_trade_no"];

                //支付宝交易号

                string trade_no = Request.Form["trade_no"];

                //交易状态
                string trade_status = Request.Form["trade_status"];
                //总额
                string total_fee = Request.Form["total_fee"];


                if (Request.Form["trade_status"] == "TRADE_FINISHED")
                {
                    //
                }
                else if (Request.Form["trade_status"] == "TRADE_SUCCESS")
                {
                    BaseClass.Dal.ChongzhiLog sl = new BaseClass.Dal.ChongzhiLog();
                    bool isOrderValid            = sl.CZisok(out_trade_no, openId);
                    log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "订单号:" + out_trade_no + "处理状态:" + isOrderValid);
                    if (isOrderValid)
                    {
                        string  mid   = openId;
                        decimal money = decimal.Parse(total_fee) / 100;
                        LVWEIBA.DAL.order_list   oodd = new LVWEIBA.DAL.order_list();
                        LVWEIBA.Model.order_list oom  = oodd.GetModel(out_trade_no);
                        if (oom.order_zt != "DCX")
                        {
                            //正式状态
                            oom.order_zt = "DCX";
                            oodd.Update(oom);
                            //发送短信通知用户和商户
                            var orderMx = new LVWEIBA.DAL.order_Mx().GetModel(out_trade_no);
                            var member  = new LVWEIBA.BLL.MemberInfo().GetModel(mid);
                            //发送短信通知用户和商户(判断是门票还是尾单)
                            if (orderMx.ProType != null && (orderMx.ProType.Equals("DZP") || orderMx.ProType.Equals("ZZP")))
                            {
                                var bll = new LVWEIBA.DAL.ProviderSpot();
                                LVWEIBA.Model.ProviderSpot providerSpot = bll.GetModel(int.Parse(orderMx.productNum));
                                LVWEIBA.MessageService.NotifyUsersTicket(member.Tel, providerSpot.MasterTel, orderMx);
                                providerSpot.Num = providerSpot.Num - orderMx.ProCount;
                                bll.Update(providerSpot);
                                log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "修改余量: productNum is:" + orderMx.productNum + "TicketCount is:" + providerSpot.Num);
                            }
                            else
                            {
                                LVWEIBA.Model.LvULines lvModel = new LVWEIBA.DAL.LvULines().GetModel(orderMx.productNum);
                                LVWEIBA.MessageService.NotifyUsers(member.Tel, lvModel.LineMasterMoble, orderMx);
                                //修改线路余量
                                LVWEIBA.BLL.LvULines lvubLL = new LVWEIBA.BLL.LvULines();
                                if (lvModel != null)
                                {
                                    lvModel.adultTicketCount = lvModel.adultTicketCount - orderMx.adultCount;
                                    lvModel.puppyTicketCount = lvModel.puppyTicketCount - orderMx.puppyCount;
                                    lvubLL.Update(lvModel);
                                    log4netHelper.WriteDebugLog(typeof(notify_url), "订单notify", "修改余量: productNum is:" + orderMx.productNum);
                                }
                            }
                        }
                    }
                }
                //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
                Response.Write("success");  //请不要修改或删除
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////
            }
            else//验证失败
            {
                string out_trade_no = Request.Form["out_trade_no"];
                moneyUnFreeze(out_trade_no, openId);
                couponUnUse(out_trade_no);
                Response.Write("fail");
            }
        }
        else
        {
            Response.Write("无通知参数");
        }
    }