Пример #1
0
        public void SaveTuidan_ReturnNull_WithID()
        {
            var       hotelService = new HotelService();
            int       wid          = 1;
            TuidanDto tuidanDto    = new TuidanDto()
            {
                dingdanid    = 1,
                hotelid      = 1,
                openid       = "test",
                wid          = wid,
                roomid       = 1,
                refundTime   = DateTime.Now,
                refundAmount = 123.12,
                operateUser  = wid,
                remarks      = "什么原因也一样"
            };

            hotelService.AddTuidan(tuidanDto);
            Assert.IsTrue(tuidanDto.id > 0);

            var model = hotelService.GetModel(tuidanDto.id);

            Assert.IsNotNull(model);
            Assert.AreEqual(model.dingdanid, tuidanDto.dingdanid);
        }
Пример #2
0
        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();
                dingdan = dingdanbll.GetModel(dingdanid);

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

                using (var scope = new TransactionScope())
                {
                    var dto = new TuidanDto()
                    {
                        dingdanid    = dingdan.id,
                        hotelid      = dingdan.hotelid.Value,
                        roomid       = dingdan.roomid.Value,
                        openid       = dingdan.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(dingdan, dto, hotel.wid.Value, out return_msg))//
                    {
                        new BLL.wx_hotel_dingdan().RefundComplete(dingdan.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);
                    }
                    //                    dingdanbll.Update(dingdan.id, HotelStatusManager.OrderStatus.Refunding.StatusId.ToString());



                    scope.Complete();
                }
            }
        }