Пример #1
0
        public void BookRoom(int roomid, int userid, DateTime sdate, DateTime edate, string remark)
        {
            if (sdate.AddDays(1) < DateTime.Now)
            {
                OutResult("入住日期必须大于等于当前日期!");
                return;
            }
            if (edate <= sdate)
            {
                OutResult("离开日期必须大于入住日期!");
                return;
            }

            MemberController controller = new MemberController();
            var r = controller.BookRoom(roomid, sdate, edate, remark, userid);
            if (r == 1)
            {
                OutResult(1);
            }
            else if (r == -2)
            {
                OutResult("该时段的房间已全部被预订!");
            }
            else if (r == -3)
            {
                OutResult("您的余额已不足!请登录旅居中国官网充值。");
            }
            else
            {
                OutResult("预订失败,请重试!");
            }
        }
Пример #2
0
        public JsonNetResult HelpMemBook(int memid, int roomid, DateTime sdate, DateTime edate, string remark)
        {
            if (sdate.AddDays(1) < DateTime.Now)
            {
                return this.JsonNet(new { ResultID = 0, Message = "入住日期必须大于等于当前日期!" });
            }
            if (edate <= sdate)
            {
                return this.JsonNet(new { ResultID = 0, Message = "离开日期必须大于入住日期!" });
            }

            MemberController mctr = new MemberController();
            var r = mctr.BookRoom(roomid, sdate, edate, remark, memid);
            if (r == -2)
            {
                return this.JsonNet(new { ResultID = 0, Message = "房间数量不足!" });
            }
            else if (r == -3)
            {
                return this.JsonNet(new { ResultID = 0, Message = "余额不足!" });
            }
            else if (r == 0)
            {
                return this.JsonNet(new { ResultID = 0, Message = "预定失败,请重试!" });
            }
            return this.JsonNet(new { ResultID = 1, Message = "预定成功。" });
        }