public ActionResult _PosPrintContent(long id) { var info = PosConsumeBll.GetById(id); var now = DateTime.Now; ViewBag.CurrentTime = now.ToString("yyyy-MM-dd HH:mm"); ViewBag.HotelId = UserContext.CurrentUser.HotelId; ViewBag.PosId = info.PosId; ViewBag.CurrentUserName = UserContext.CurrentUser.Name; var hotel = HotelBll.GetById(UserContext.CurrentUser.HotelId); if (hotel != null) { ViewBag.HotelName = hotel.Name; } var models = PosConsumeDetailBll.GetList(id); models = models.Where(a => a.ToRoomRegId == 0 && a.SourceRoomRegId == 0).ToList(); //没有入账房间 而且没有部分转入账房间 ViewBag.DetailPrice = models.Select(a => a.Price).Sum(); ViewBag.DetailDiscountPrice = models.Select(a => a.DiscountPrice).Sum(); ViewBag.DetailAmount = models.Select(a => a.Amount).Sum(); ViewBag.Detail = models; var pos = PosDefineBll.GetById(info.PosId); ViewBag.Pos = pos; ViewBag.PosName = pos.MenuName; return(View(info)); }
public JsonResult <BasePageResponse <HotelSearchResponse> > Index() { var s = HotelBll.GetList(new HotelSearchRequest() { Name = "酒店" }); return(Json(s)); }
// GET: OutStock public ActionResult Index() { long hotelId = UserContext.CurrentUser.HotelId; ViewData["supplier"] = SupplierBll.GetAllList(hotelId); ViewData["warehourse"] = WarehouseBll.GetAllList(hotelId); ViewData["hotelList"] = HotelBll.GetAllList(hotelId); return(View()); }
public ActionResult Edit(long id = 0) { if (id == 0) { return(View(new HotelModel())); } var info = HotelBll.GetById(id); return(View(info)); }
public JsonResult <BasePageResponse <HotelSearchResponse> > Index() { var s = HotelBll.GetList(new HotelSearchRequest() { Name = "酒店" }); LogHelper.Write(Level.Info, "AAAAAAAAA", $"OpenApiGetAAAAAAAAAAAAAAAAAA"); LogHelper.Info("AAAA"); LogHelper.Warn("AAAA"); LogHelper.Error("AAAA"); LogHelper.Error("AAAA", new Exception()); return(Json(s)); }
public ActionResult Delete(long id) { var apiResult = new APIResult(); try { HotelBll.Delete(id); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
public JsonResult Edit(HotelModel model) { var apiResult = new APIResult(); try { HotelBll.AddOrUpdate(model, (UserEntity)UserContext.CurrentUser); } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
public string GetPager(int page, int rows, string searchName = "") { var pager = HotelBll.GetPager(page, rows, UserContext.CurrentUser.HotelId, searchName); return(JsonConvert.SerializeObject(pager)); }
public JsonResult Reg(string hotelName, string userName, string pwd, string CfmPwd, string handler, string tel, string code) { var apiResult = new APIResult(); try { if (Session[vCode.SessionName] == null) { throw new OperationExceptionFacade("验证码已过期"); } else if (code.ToLower() != Session[vCode.SessionName].ToString().ToLower()) { throw new OperationExceptionFacade("验证码错误"); } if (string.IsNullOrWhiteSpace(hotelName)) { throw new OperationExceptionFacade("酒店名称不可为空"); } if (string.IsNullOrWhiteSpace(userName)) { throw new OperationExceptionFacade("用户名不可为空"); } if (string.IsNullOrWhiteSpace(pwd)) { throw new OperationExceptionFacade("密码不可为空"); } if (CfmPwd != pwd) { throw new OperationExceptionFacade("两次输入的密码不相同"); } if (string.IsNullOrWhiteSpace(handler)) { throw new OperationExceptionFacade("联系人不可为空"); } if (string.IsNullOrWhiteSpace(tel)) { throw new OperationExceptionFacade("联系电话不可为空"); } var hotelId = IdBuilder.NextLongID(); var user = new Hotel.Model.User() { Id = IdBuilder.NextLongID(), UserName = userName, Pwd = pwd, HotelId = hotelId, UserType = 2, GId = 2,//总店管理员 CDate = TypeConvert.DateTimeToInt(DateTime.Now) }; if (UserBll.Reg(user)) { var hotel = new HotelModel() { Id = hotelId, Name = hotelName, Handler = handler, Tel = tel, CDate = TypeConvert.DateTimeToInt(DateTime.Now) }; bool flag = HotelBll.RegHotel(hotel); if (!flag) { throw new OperationExceptionFacade("酒店注册失败"); } } } catch (Exception ex) { apiResult.Ret = -1; apiResult.Msg = ex.Message; if (!(ex is OperationExceptionFacade)) { LogFactory.GetLogger().Log(LogLevel.Error, ex); } } return(Json(apiResult)); }
/// <summary> /// 喜玩订单 /// </summary> /// <param name="createrequset"></param> /// <param name="orderseriald"></param> /// <param name="ruleid"></param> /// <param name="qlhotelid"></param> /// <returns></returns> public DataResult XiWanOrder(CreateRequset createrequset, string orderseriald, int ruleid, int qlhotelid) { var result = new DataResult(); result.Code = DataResultType.Fail; var item = createrequset.orderModel; var request = new XiWanOrderRequest(); request.DistributeOrderNo = !string.IsNullOrWhiteSpace(item.thirdOrderNo) ? item.thirdOrderNo : orderseriald; request.HotelId = item.hotelId; request.RoomId = item.outCode.ToString(); request.RoomName = GetXiWanRoomName(item.roomTypeId.ToString()); request.ProductSerial = item.productSerial; request.ComeDate = Convert.ToDateTime(item.arrival).Date; request.RoomNum = item.roomNum; request.LeaveDate = Convert.ToDateTime(item.departure).Date; request.LastArriveTime = "18:00"; request.TotalPrice = Convert.ToDecimal(item.roomPrice); request.ContactName = item.contactName; request.ContactMobile = item.mobile; request.GuestNames = item.guestName.Split(','); request.NoteToHotel = !string.IsNullOrWhiteSpace(item.remark) ? item.remark : "无"; var rtn = XiWanAPI.XiWanPost <XiWanOrderResponse, XiWanOrderRequest>(request, HotelOrderUrl); //日志 var logmodel = new HO_HotelOrderLogModel { HOLOrderId = orderseriald, HOLLogType = 1,//订单日志 HOLAddId = 0, HOLAddName = "系统", HOLAddDepartId = 0, HOLAddDepartName = "系统", HOLAddTime = DateTime.Now }; logmodel.HOLRemark = "喜玩下单请求:" + JsonConvert.SerializeObject(request) + "||喜玩下单接口返回:" + JsonConvert.SerializeObject(rtn); OrderLogBll.AddOrderModel(logmodel); result.Message = JsonConvert.SerializeObject(rtn); var order = rtn?.Result; var price = OrderBll.GetHotelPriceList(ruleid, Convert.ToDateTime(item.arrival), Convert.ToDateTime(item.departure)); if (rtn.Code == "0" && !string.IsNullOrWhiteSpace(order.OrderNo)) { result.Code = DataResultType.Sucess; result.Data = orderseriald; logmodel.HOLRemark = "喜玩更新供应商订单流水号:流水号=" + order.OrderNo; var upserialid = OrderBll.UpdatesSupplier(orderseriald, order.OrderNo, 0); logmodel.HOLRemark = "更新结果:" + (upserialid > 0 ? "更新成功" : "更新失败"); OrderLogBll.AddOrderModel(logmodel); if (price != null && price.Any()) { foreach (var i in price) { logmodel.HOLRemark = "喜玩更新库存:原有库存=" + i.HRPCount; i.HRPCount = i.HRPCount - 1 >= 0 ? i.HRPCount - 1 : 0; var up = HotelRoomRuleBll.UpdateCount(i); logmodel.HOLRemark += ",更新后库存=" + i.HRPCount + ",更新结果:" + up.Msg; OrderLogBll.AddOrderModel(logmodel); } } } else { if (rtn.Msg.Contains("存在日期满房") || rtn.Msg.Contains("总价应为") || rtn.Msg.Contains("已关闭")) { var upstock = XiWanApiService.Xw_HotelPrice(qlhotelid); logmodel.HOLRemark = "满房或价格变动更新酒店库存和价格:酒店id:" + qlhotelid + ",更新结果:" + upstock.Code; OrderLogBll.AddOrderModel(logmodel); if (rtn.Msg.Contains("存在日期满房")) { if (price != null && price.Any()) { var i = price.OrderBy(s => s.HRPDate).FirstOrDefault(); i.HRPCount = 0; var up = HotelRoomRuleBll.UpdateCount(i); logmodel.HOLRemark = "满房更新库存:待更新信息:" + JsonConvert.SerializeObject(i) + ",更新结果:" + up.IsSuccess; OrderLogBll.AddOrderModel(logmodel); } result.Code = DataResultType.Fail; result.Message = JsonConvert.SerializeObject(rtn); OrderBll.UpdatesSupplier(orderseriald, "", 2); } if (rtn.Msg.Contains("总价应为")) { var neworder = OrderBll.GetModel(orderseriald); var newprice = OrderBll.GetHotelPriceList(neworder.HRRId, neworder.HOCheckInDate, neworder.HOCheckOutDate); if (price != null && price.Any()) { var total = price.Sum(s => s.HRPContractPrice) * neworder.HORoomCount; createrequset.orderModel.roomPrice = total.ToString(); if (createrequset.supplierSourceId == 1) { total = total * 0.94M; } if (neworder.HOSellPrice >= total) { XiWanOrder(createrequset, orderseriald, ruleid, qlhotelid); } else { result.Code = DataResultType.Fail; result.Message = JsonConvert.SerializeObject(rtn); OrderBll.UpdatesSupplier(orderseriald, "", 2); } } } if (rtn.Msg.Contains("已关闭")) { var up = HotelBll.SetValid(qlhotelid, 0, "system"); logmodel.HOLRemark = "已关闭更新酒店状态:待更新酒店Id:" + qlhotelid + ",更新结果:" + up.IsSuccess; OrderLogBll.AddOrderModel(logmodel); result.Code = DataResultType.Fail; result.Message = JsonConvert.SerializeObject(rtn); OrderBll.UpdatesSupplier(orderseriald, "", 2); } } } return(result); }