protected void btnSaveRefund_OnClick(object sender, EventArgs e)
        {
            var wxUserweixin = GetAdminInfo();

            if (wxUserweixin == null)
            {
                throw new Exception("用户不能为空!");
            }
            if (chkIsRefund.Checked)
            {
                double money        = MyCommFun.Str2Float(txtAmount.Text);
                var    hotelService = new HotelService();
                Order = _hotelOrderService.GetModel(dingdanid);

                var hotel = new BLL.wx_hotels_info().GetModel(Order.hotelid.Value);

                using (var scope = new TransactionScope())
                {
                    var dto = new TuidanDto()
                    {
                        dingdanid    = Order.id,
                        hotelid      = Order.hotelid.Value,
                        roomid       = Order.roomid.Value,
                        openid       = Order.openid,
                        wid          = hotel.wid.Value,
                        operateUser  = wxUserweixin.id,
                        refundAmount = money,
                        refundTime   = DateTime.Now,
                        remarks      = this.remarks.InnerText,
                        refundCode   = "HT" + DateTime.Now.ToString("yyyyMMddHHmmssffff") + Utils.Number(5)
                    };
                    hotelService.AddTuidan(dto);

                    string return_msg = String.Empty;

                    if (WeChatRefund(Order, dto, hotel.wid.Value, out return_msg))//
                    {
                        new BLL.wx_hotel_dingdan().RefundComplete(Order.OrderNumber);

                        AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改酒店状态为" +
                                    HotelStatusManager.OrderStatus.Refunding.StatusName
                                    + HotelStatusManager.OrderStatus.Refunding.StatusId + ",主键为" + dingdanid); //记录日志
                        JscriptMsg("退款成功!", "hotel_dingdan_manage.aspx?hotelid=" + hotelid + "", "Success");
                    }
                    else
                    {
                        Response.Write(return_msg);
                        GetData(dingdanid);
                    }
                    //                    _hotelOrderService.Update(Order.id, HotelStatusManager.OrderStatus.Refunding.StatusId.ToString());



                    scope.Complete();
                }
            }
        }
        protected void btn_completed_OnClick(object sender, EventArgs e)
        {
            Order = _hotelOrderService.GetModel(dingdanid);
            _hotelOrderService.Update(Order.id, HotelStatusManager.OrderStatus.Completed.StatusId.ToString());

            AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改酒店状态为" +
                        HotelStatusManager.OrderStatus.Completed.StatusName
                        + HotelStatusManager.OrderStatus.Completed.StatusId + ",主键为" + dingdanid); //记录日志
            JscriptMsg("修改成功!", "hotel_dingdan_manage.aspx?hotelid=" + hotelid + "", "Success");
        }
        /// <summary>
        /// 获取最大可退价格
        /// </summary>
        /// <param name="order"></param>
        private decimal GetPrice(GetHotelOrderResponse order)
        {
            decimal result = 0;

            var dateSpan = order.LeaveDate - order.ArriveDate;

            result = order.Price * order.OrderNum * dateSpan.Days;//单位分

            return(result);
        }
        /// <summary>
        /// 获取订单
        /// </summary>
        /// <param name="orderId"></param>
        private void GetData(int orderId)
        {
            var orderRequest = new GetHotelOrderByOrderIdRequest()
            {
                OrderId = orderId
            };
            var result = BusHelper.Send <GetHotelOrderResponse>(orderRequest);

            Order = result;
            GetIdentifyingCode(orderId);
            GetOrderList(orderId);
            GetUserMsg(Order);
            //            GetOrderStatusMsg(Order);
        }
        private void GetUserMsg(GetHotelOrderResponse order)
        {
            //订单信息
            if (order != null)
            {
                var request = new GetHotelRequest()
                {
                    HotelId = order.HotelId
                };
                var hotel      = BusHelper.Send <GetHotelResponse>(request);
                var createTime = string.Format("{0:yyyy/MM/dd HH:mm}", Order.CreateDate);

                Dingdanren += "<tr> <td>酒店商户或门店:" + hotel.Name + "</td></tr>";
                Dingdanren += "<tr> <td>商户或门店编号:" + hotel.Code + "</td></tr>";
                Dingdanren += "<tr><td width=\"70\">订单编号: " + order.OrderNum + "</td></tr>";
                Dingdanren += "<tr> <td>交易日期:" + createTime + "</td></tr>";
                Dingdanren += "<tr><td>预定人:" + order.OrderPersonName + "</td></tr>";
                Dingdanren += "<tr><td>电话:" + order.Tel + "</td></tr>";
                //                dingdanren += "<tr><td>地址:" + manage.address + "</td></tr>";
                //                dingdanren += "<tr><td>备注 :" + manage.oderRemark + "</td></tr>";

                status      = HotelStatusManager.OrderStatus.GetStatusDict(order.OrderStatus);
                Dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='" + status.CssClass
                              + "'>" + status.StatusName + "</em></td></tr>";
            }
            else
            {
                Dingdanren += "<tr> <td>酒店商户或门店:</td></tr>";
                Dingdanren += "<tr> <td>商户或门店编号:</td></tr>";
                Dingdanren += "<tr><td width=\"70\">订单编号:</td></tr>";
                Dingdanren += "<tr> <td>交易日期:</td></tr>";
                Dingdanren += "<tr><td>预定人:</td></tr>";
                Dingdanren += "<tr><td>电话:</td></tr>";

                Dingdanren += "<tr><td>订单状态:<em  style='width:70px;' class='no'>未处理</em></td></tr>";
            }
        }
        /// <summary>
        /// 获取订单状态
        /// </summary>
        /// <param name="order"></param>
        private void GetOrderStatusMsg(GetHotelOrderResponse order)
        {
            orderStatus = order.OrderStatus;
            //支付状态下默认退款金额为订单总额
            if (orderStatus == HotelStatusManager.OrderStatus.Payed.StatusId)
            {
                var result = GetPrice(order);

                txtAmount.Text = result.ToString();
                if (isAdmin)
                {
                    hidConfirmStr.Value = "确定执行【退款】操作吗?";

//                    WHEN 0 THEN ''未支付''
//                    WHEN 1 THEN ''已支付''
//                    WHEN 2 THEN ''已使用''
//                    WHEN 3 THEN ''申请退款''
//                    WHEN 4 THEN ''已退款''
                    if (_listCode != null && _listCode.Any(c => c.Status == 2))//订单中有验证码已使用
                    {
                        hidConfirmStr.Value = string.Format("{0},{1}", "订单中有验证码已使用", hidConfirmStr.Value);
                    }
                }
            }
            else if (orderStatus == HotelStatusManager.OrderStatus.Refunding.StatusId ||
                     orderStatus == HotelStatusManager.OrderStatus.Refunded.StatusId)
            {
                tuidan = hotelService.GetModel(order.id, order.hotelid.Value);
                if (tuidan != null && tuidan.operateUser > 0)
                {
                    var manager = new BLL.manager().GetModel(tuidan.operateUser);
                    uName    = manager.real_name;
                    roleName = new WeiXinPF.BLL.manager_role().GetTitle(manager.role_id);
                }
            }
        }
Пример #7
0
        protected void confirm_dingdan_Click(object sender, EventArgs e)
        {
            var number = this.confirmnumber.Text.Trim();
            GetIdentifyingCodeResponse identifyingCode = null;
            GetHotelOrderResponse      hotelOrder      = null;

            var result = Global.Bus
                         .Send <GetIdentifyingCodeResponse>("WeixinPF.Hotel.Plugins.Service",
                                                            new GetIdentifyingCodeRequest()
            {
                ShopId     = this.hotelid,
                Number     = number,
                ModuleName = ModuleName,
                Wid        = wid
            });

            if (!result.IsSuccess)
            {
                return;
            }
            else
            {
                identifyingCode = result.Data;
            }

            var orderResult = Global.Bus
                              .Send <GetHotelOrderResponse>("WeixinPF.Hotel.Plugins.Service",
                                                            new GetHotelOrderByOrderIdRequest()
            {
                OrderId = int.Parse(identifyingCode.OrderId)
            });

            if (!orderResult.IsSuccess)
            {
                return;
            }
            else
            {
                hotelOrder = orderResult.Data;
            }

            if (hotelOrder.OrderStatus.Equals(HotelStatusManager.OrderStatus.Refunded.StatusId) ||
                hotelOrder.OrderStatus.Equals(HotelStatusManager.OrderStatus.Refunding.StatusId) ||
                hotelOrder.OrderStatus.Equals(HotelStatusManager.OrderStatus.Completed))
            {
                this.Response.Write(
                    "<script language='javascript' type='text/javascript'>alert('该订单已完成或进行退单处理,不能进行验证!')</script>");
            }
            else
            {
                if (identifyingCode.Status != 1)
                {
                    if (identifyingCode.Status == 0)
                    {
                        this.Response.Write("<script language='javascript' type='text/javascript'>alert('该商品未付款!')</script>");
                    }
                    else
                    {
                        this.Response.Write("<script language='javascript' type='text/javascript'>alert('该商品已消费或者退单,请确认!')</script>");
                    }
                }
                else
                {
                    this.Response.Redirect("commodity_detail.aspx?cid=" + identifyingCode.IdentifyingCodeId + "&shopid=" + identifyingCode.ShopId + "&id=" + identifyingCode.OrderId);
                }
            }
        }
 public hotel_dingdan_cz()
 {
     Order = new GetHotelOrderResponse();
 }
        protected void save_groupbase_Click(object sender, EventArgs e)
        {
            Guid identifyingCodeId;

            if (Guid.TryParse(this.cid, out identifyingCodeId))
            {
                GetIdentifyingCodeResponse identifyingCodeObject = null;

                var result = Global.Bus.Send <GetIdentifyingCodeResponse>(HotelServiceName,
                                                                          new GetByIdnetifyingCodeIdRequest()
                {
                    IdentifyingCodeId = identifyingCodeId,
                    ModuleName        = ModuleName,
                    Wid = this.wid
                });

                if (!result.IsSuccess)
                {
                    this.Response.Write("<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!')</script>");

                    return;
                }
                else
                {
                    identifyingCodeObject = result.Data;
                }


                var orderRequest = new GetHotelOrderByOrderIdRequest()
                {
                    OrderId = int.Parse(identifyingCodeObject.OrderId)
                };
                GetHotelOrderResponse order = null;

                var orderResult = Global.Bus.Send <GetHotelOrderResponse>(HotelServiceName, orderRequest);

                if (!orderResult.IsSuccess)
                {
                    this.Response.Write(
                        "<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!')</script>");
                    return;
                }
                else
                {
                    order = orderResult.Data;
                }

                if (order != null)
                {
                    if (order.OrderStatus.Equals(HotelStatusManager.OrderStatus.Refunded.StatusId) ||
                        order.OrderStatus.Equals(HotelStatusManager.OrderStatus.Refunding.StatusId) ||
                        order.OrderStatus.Equals(HotelStatusManager.OrderStatus.Completed))
                    {
                        this.Response.Write(
                            "<script language='javascript' type='text/javascript'>alert('该订单已完成或进行退单处理,不能进行验证!')</script>");
                        return;
                    }
                    else if (identifyingCodeObject.ShopId.Equals(this.hotelid.ToString(CultureInfo.InvariantCulture)))
                    {
                        var useIdentifyingCode = new MakeUseOfIdentifyingCode()
                        {
                            IdentifyingCodeId = identifyingCodeId
                        };

                        Global.Bus.MyBus.Send(HotelServiceName, useIdentifyingCode)
                        .Register <int>(response =>
                        {
                            if (response == 1)
                            {
                                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付状态,主键为" + id);
                                //记录日志                                                                                                   //Response.Redirect("dingdan_confirm.aspx?shopid=" + shopid + "");
                                Response.Write(
                                    "<script language='javascript' type='text/javascript'>alert('核销成功!');location.href = 'dingdan_confirm.aspx?shopid=" +
                                    hotelid + "';</script>");
                            }
                            else
                            {
                                AddAdminLog(MXEnums.ActionEnum.Edit.ToString(), "修改支付状态失败,主键为" + id);
                                //记录日志                                                                                                   //Response.Redirect("dingdan_confirm.aspx?shopid=" + shopid + "");
                                Response.Write(
                                    "<script language='javascript' type='text/javascript'>alert('核销失败');</script>");
                            }
                        });
                    }
                    else
                    {
                        this.Response.Write(
                            "<script language='javascript' type='text/javascript'>alert('核销失败。')</script>");
                    }
                }
                else
                {
                    this.Response.Write(
                        "<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!')</script>");
                }
            }
        }
Пример #10
0
        public void List(int ids)
        {
            //订单
            Dingdanlist = "";
            dingdanren  = "";

            var searchRequest = new GetIdentifyingCodeDetailRequest()
            {
                IdentifyingCodeId = Guid.Parse(cid),
                ModuleName        = "hotel"
            };

            GetIdentifyingCodeDetailResponse searchResponse = null;

            var result = Global.Bus.Send <GetIdentifyingCodeDetailResponse>(HotelServiceName, searchRequest);

            if (!result.IsSuccess)
            {
                this.Response.Write("<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!');location.href = 'dingdan_confirm.aspx?shopid=" +
                                    hotelid + "';</script>");
                this.Response.End();
            }
            else
            {
                searchResponse = result.Data;
            }

            decimal amount = 0;

            if (searchResponse.Details.FirstOrDefault().Status == 2)
            {
                save_groupbase.Text        = "已验证";
                save_groupbase.Enabled     = false;
                save_groupbase.Style.Value = "";
            }
            Dingdanlist += "<tr><th>商品名称</th><th class=\"cc\">购买数量</th><th class=\"cc\">单价</th><th class=\"cc\">入住时间</th><th class=\"cc\">离店时间</th></tr>";
            foreach (var item in searchResponse.Details)
            {
                Dingdanlist += " <tr><td class=\"cc\">" + item.ProductName + "</td>";
                Dingdanlist += "<td class=\"cc\">" + item.Number + "</td>";
                Dingdanlist += "<td class=\"cc\">" + item.Price + "</td>";
                Dingdanlist += "<td class=\"cc\">" + item.ArriveTime + "</td>";
                Dingdanlist += "<td class=\"cc\">" + item.LeaveTime + "</td></tr>";
                amount      += Convert.ToDecimal(item.TotelPrice);
            }
            Dingdanlist += "<tr><td></td><td ></td><td ></td><td ></td><td class=\"rr\" style=\"color: red; font-weight:bold;\">支付总计:¥" + amount + "</td></tr>";


            GetHotelOrderResponse orderResponse = null;

            var orderResult = Global.Bus.Send <GetHotelOrderResponse>(HotelServiceName,
                                                                      new GetHotelOrderByOrderIdRequest()
            {
                OrderId = int.Parse(id)
            });

            if (!orderResult.IsSuccess)
            {
                this.Response.Write("<script language='javascript' type='text/javascript'>alert('该订单不存在或未付款,请确认!');location.href = 'dingdan_confirm.aspx?shopid=" +
                                    hotelid + "';</script>");
                this.Response.End();
            }
            else
            {
                orderResponse = orderResult.Data;
            }

            //订单信息
            if (orderResponse != null)
            {
                dingdanren += "<tr><td width=\"70\">订单编号: " + orderResponse.OrderNumber + "</td></tr>";
                dingdanren += "<tr> <td>交易日期:" + orderResponse.OrderDate + "</td></tr>";
                dingdanren += "<tr><td>预定人:" + orderResponse.OrderPersonName + "</td></tr>";
                dingdanren += "<tr><td>电话:" + orderResponse.Tel + "</td></tr>";
            }
            else
            {
                dingdanren += "<tr><td width=\"70\">订单编号:</td></tr>";
                dingdanren += "<tr> <td>交易日期:</td></tr>";
                dingdanren += "<tr><td>预定人:</td></tr>";
                dingdanren += "<tr><td>电话:</td></tr>";
            }
        }