コード例 #1
0
ファイル: Room.cs プロジェクト: thieunq92/mo-restaurant-net45
 public Room(string name, bool deleted, RoomClass roomClass, RoomTypex roomType)
 {
     this.name = name;
     Deleted   = deleted;
     RoomClass = roomClass;
     RoomType  = roomType;
 }
コード例 #2
0
 public BookingRoom(Booking book, Room room, RoomClass roomClass, RoomTypex roomType)
 {
     _book      = book;
     _room      = room;
     _roomClass = roomClass;
     _roomType  = roomType;
 }
コード例 #3
0
 public Room(string name, bool deleted, RoomClass roomClass, RoomTypex roomType)
 {
     _name      = name;
     _deleted   = deleted;
     _roomClass = roomClass;
     _roomType  = roomType;
 }
コード例 #4
0
 public SailsPriceConfig(TripOption tripOption, double netPrice, double priceForChildren, RoomClass roomClass,
                         RoomTypex roomType, SailsTrip trip, double netPriceVND)
 {
     _tripOption = tripOption;
     //_netPrice = netPrice;
     _priceForChildren = priceForChildren;
     _roomClass        = roomClass;
     _roomType         = roomType;
     _trip             = trip;
     //_netPriceVND = netPriceVND;
 }
コード例 #5
0
        public virtual double Calculate(SailsModule Module, IList policies, double childPrice, double agencySup, Agency agency)
        {
            // Lấy về kiểu phòng
            RoomClass rclass = RoomClass;
            RoomTypex rtype  = RoomType;

            int adult = Adult;
            int child = Child;

            double price = Calculate(rclass, rtype, adult, child, IsSingle, _book.Trip, _book.Cruise, _book.TripOption, _book.StartDate, Module,
                                     policies, childPrice, agencySup, agency);

            return(price);
        }
コード例 #6
0
ファイル: BookingRoom.cs プロジェクト: thieunq92/mysapatravel
        public static double RoomPrice(SailsModule module, RoomClass rclass, RoomTypex rtype, SailsTrip trip, Cruise cruise, TripOption option, DateTime startDate)
        {
            if (trip == null)
            {
                return(0);
            }
            SailsPriceConfig rolePrice = module.SailsPriceConfigGet(rclass, rtype, trip, cruise, option, startDate,
                                                                    BookingType.Double, null);

            if (rolePrice != null)
            {
                return(rolePrice.NetPrice);
            }

            SailsPriceConfig priceConfig = module.SailsPriceConfigGet2(rclass, rtype, trip, cruise, option, startDate, BookingType.Double, null);

            if (priceConfig != null)
            {
                return(priceConfig.NetPrice * MARK_UP);
            }

            return(-1);
        }
コード例 #7
0
        /// <summary>
        /// Tính giá cho một loại phòng
        /// </summary>
        /// <returns></returns>
        public static double Calculate(RoomClass rclass, RoomTypex rtype, int adult, int child, bool isSingle, SailsTrip trip, Cruise cruise, TripOption option, DateTime startDate, SailsModule Module, IList policies, double childPrice, double agencySup, Agency agency)
        {
            // Lấy về bảng giá áp dụng cho thời điểm xuất phát
            if (trip == null)
            {
                return(0);
            }
            SailsPriceConfig priceConfig = Module.SailsPriceConfigGet(rclass, rtype, trip, cruise, option, startDate,
                                                                      BookingType.Double, agency);

            if (priceConfig == null)
            {
                throw new PriceException(string.Format("There isn't any price for {0} {1} room in trip {2} on {3}", rclass.Name, rtype.Name, trip.Name, startDate));
            }
            #region -- Giá phòng --
            double price;
            // Biến để lưu giá trị single supplement nếu là booking single
            double singlesup = 0;
            if (isSingle)
            {
                if (agencySup > 0)
                {
                    singlesup = agencySup;
                }
                else
                {
                    singlesup = priceConfig.SpecialPrice; //Module.ApplyPriceFor(priceConfig.SpecialPrice, policies);
                }
            }

            // Tính giá phòng theo người lớn

            // Đơn giá của phòng (đã áp dụng chính sách)
            double unitPrice;
            if (priceConfig.Table.Agency == null)
            {
                //unitPrice = Module.ApplyPriceFor(priceConfig.NetPrice, policies);
            }
            else
            {
                //unitPrice = priceConfig.NetPrice;
            }
            if (rtype.IsShared)
            {
                // Giá phòng twin phòng đơn giá x số lượng người lớn / 2 + đơn giá x tỉ lệ dành cho child x số child / 2
                // (Thực ra adult = 1/2, child =0/1)
                //price = unitPrice * adult / 2 + unitPrice * child * childPrice / 100 / 2;
                // Cộng thêm singlesup (nếu không phải single thì là + 0)
                //price += singlesup;
            }
            else
            {
                // Giá phòng double phòng đơn giá x số lượng người lớn / 2 + đơn giá x tỉ lệ dành cho child x số child / 2
                //price = unitPrice * adult / 2 + unitPrice * child * childPrice / 100 / 2;
                // Cộng thêm singlesup (nếu không phải single thì là + 0)
                //price += singlesup;
            }
            #endregion

            //return price;

            return(0.0);
        }