Ejemplo n.º 1
0
    ToolbarOptions toolbar; //overworld display script.

    #endregion Fields

    #region Methods

    //Used to try to book a room at this hotel
    public static void BookRoom(WeekDays dayOfWeek, float occupancyDiscount)
    {
        int numberOfDays = Random.Range(1, 5);

        //Determine if there will be a discount for 3+ days booking:
        bool discount3Days = true;
        if(numberOfDays < 3)
            discount3Days = false;

        RoomStats aRoom = BedroomBehaviour.GetNextAvailableRoom();
        if( aRoom == null)
        {
            Debug.Log("All Rooms are unsuable");
        }

        //check the price to remove cancel booking.
        if (CheckRoomCost (aRoom, dayOfWeek,occupancyDiscount)) {
            aRoom.Book (numberOfDays);
            aRoom.discount3Days = discount3Days;
            aRoom.discountNoBreakfast = BoolGen (40);
            aRoom.discountNoCancel = BoolGen (30);
            //Debug.Log ("Room booked for " + numberOfDays + " days!");
        }
        else
        {
            //room too expensive.
        }
    }
 public MyTask(WeekDays dayOfWeek, string taskOfDay = "")
 {
     this._dayOfWeek = dayOfWeek;
     this._taskOfDay = taskOfDay;
 }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            #region General_Typecast_Example
            i = 10;

            if (i != null)
            {
                f += (int)i;
            }

            i = (int)f;

            i = (b == true ? 1 : 0);

            #endregion

            #region Polymorphism_Example
            //Animal a = new Animal();
            Cat c = new Cat();
            Dog d = new Dog();

            Animal a1 = c;
            Animal a2 = d;

            //c.MakeASound();
            //a1.MakeASound();

            //d.MakeASound();
            //a2.MakeASound();

            #endregion

            #region Interface_Example

            Speaker s = new Speaker();

            ISoundable a = c,
                       e = new Radio();

            //a.MakeASound();
            //e.MakeASound();

            //s.MakeASound();
            //s.MakeASound("Yelling!");
            #endregion

            #region Encapsulation_Example

            //Radio r = new Radio();

            //r.ChangeStation();
            //r.MakeASound();
            //r.ChangeStation();
            //r.MakeASound();
            //r.ChangeStation();
            //r.MakeASound();

            #endregion

            #region Reference_Example

            //int[] integers = { 1, 2, 3, 4, 5};

            //foreach(int i in integers)
            //{
            //    Console.WriteLine(i);
            //}

            //func(integers);

            //Console.WriteLine();

            //foreach (int i in integers)
            //{
            //    Console.WriteLine(i);
            //}

            #endregion

            #region Enum_Example
            WeekDays w = 0;

            //for(int i = 0; i < 7; i++)
            //{
            //    Console.WriteLine(w++);
            //}

            //Console.WriteLine(w);
            #endregion


            #region Type_Typecast_Example
            //Console.WriteLine(i.GetType());
            //Console.WriteLine(w.GetType());

            //Console.WriteLine(default(int));
            //Console.WriteLine(default(WeekDays));

            Cat c2 = a1 as Cat;
            Console.WriteLine(c2.GetType());

            #endregion
        }
Ejemplo n.º 4
0
    //Steps the day counter for all rooms
    public static void StepDay(WeekDays curDay)
    {
        //reference the reception log for this week.
        ReceptionLog currentLog = Reception.receptionLogs[Reception.receptionLogs.Count - 1];
        //Iterate through each room stepping their day counters if necessary
        foreach(RoomStats aRoom in allBedrooms)
        {
            if(aRoom.daysUnderConstruction > 0)
            {

                --aRoom.daysUnderConstruction;//Decrease days under construction
                if(aRoom.daysUnderConstruction == 0)
                {
                    aRoom.RemoveIcon("RepairUpgrade");
                }
            }
            else
            {
                aRoom.DegradeRoom ();
                if(aRoom.daysOccupied > 0)
                {
                    int roomTypeSelected = 0;
                    float roomPrice = 0;
                    //check if this is a special booking
                    if(aRoom.typeRented == groupType.noneBooked)
                    {

                        RoomCost roomType = new RoomCost();//assign the correct list of prices and discount.
                        switch(aRoom.roomQuality)
                        {
                        case 1:roomType = currentLog.standardRoom;
                            roomTypeSelected = 1;
                            Reception.monthlyReports[Reception.monthlyReports.Count-1].numbRoomLvl1Booked++;
                            break;
                        case 2:roomType = currentLog.doubleRoom;
                            roomTypeSelected = 2;
                            Reception.monthlyReports[Reception.monthlyReports.Count-1].numbRoomLvl2Booked++;
                            break;
                        case 3:roomType = currentLog.deluxeRoom;
                            roomTypeSelected = 3;
                            Reception.monthlyReports[Reception.monthlyReports.Count-1].numbRoomLvl3Booked++;
                            break;
                        case 4:roomType = currentLog.suiteRoom;
                            roomTypeSelected = 4;
                            Reception.monthlyReports[Reception.monthlyReports.Count-1].numbRoomLvl4Booked++;
                            break;
                        case 5:roomType = currentLog.masterSuiteRoom;
                            roomTypeSelected = 5;
                            Reception.monthlyReports[Reception.monthlyReports.Count-1].numbRoomLvl5Booked++;
                            break;
                        }
                        if(curDay <= WeekDays.Wednesday)
                        {
                            //weekday rate.
                            roomPrice = roomType.weekdayRoomCost;
                            //Give discount if 3 days booked or higher:
                            if(aRoom.discount3Days)
                            {
                                //applies the 3 day discount.
                                roomPrice *=  (1-roomType.weekday3NightDiscount/100);
                            }
                            if(aRoom.discountNoBreakfast)
                            {
                                //applies the no breakfast discount.
                                roomPrice *=  (1-roomType.weekdayNoBreakfastDiscount/100);
                            }
                            if(aRoom.discountNoCancel)
                            {
                                //applies the no cancellation discount.
                                roomPrice *=  (1-roomType.weekdayNoCancelDiscount/100);
                            }
                        }
                        else //If it's a weekend, charge weekend rate
                        {
                            //weekend rate.
                            roomPrice = roomType.weekendRoomCost;
                            //Give discount if 3 days booked or higher:
                            if(aRoom.discount3Days)
                            {
                                // applies the 3 night discount.
                                roomPrice *=  (1-roomType.weekend3NightDiscount/100);
                            }
                            if(aRoom.discountNoBreakfast)
                            {
                                //applies the no breakfast discount.
                                roomPrice *= (1-roomType.weekendNoBreakfastDiscount/100);
                            }
                            if(aRoom.discountNoCancel)
                            {
                                //applies the no cancellation discount.
                                roomPrice *= (1-roomType.weekendNoCancelDiscount/100);
                            }
                        }
                    }
                    //set price if conference booking.
                    else if(aRoom.typeRented == groupType.conference){
                        roomTypeSelected = 6;
                        roomPrice = currentLog.conferenceHeadCost;
                        if(curDay <= WeekDays.Wednesday)
                            roomPrice *= (1-currentLog.conferenceWeekendDiscount/100);
                    }
                    //set price if group type booking
                    else if(aRoom.typeRented == groupType.group){
                        roomTypeSelected = 7;
                        roomPrice = currentLog.groupHeadCost;
                    }
                    //set price if special event booked
                    else if(aRoom.typeRented == groupType.specialEvent){
                        roomTypeSelected = 8;
                        roomPrice = currentLog.eventsCost;
                        if(curDay <= WeekDays.Wednesday)
                            roomPrice *= (1-currentLog.eventWeekEndDiscount/100);
                    }
                    else{Debug.LogError("Error in groupTypeSelection");}
                    //adds the discount from revenue management tab.

                    roomPrice *= occupancyDiscount;

                    switch(roomTypeSelected){
                    case 1:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueRoomLvl1 += roomPrice;
                        break;
                    case 2:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueRoomLvl2 += roomPrice;
                        break;
                    case 3:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueRoomLvl3 += roomPrice;
                        break;
                    case 4:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueRoomLvl4 += roomPrice;
                            break;
                    case 5:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueRoomLvl5 += roomPrice;
                        break;
                    case 6:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueConferences += roomPrice;
                        break;
                    case 7:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueGroups += roomPrice;
                        break;
                    case 8:Reception.monthlyReports[Reception.monthlyReports.Count-1].revenueEvents += roomPrice;
                        break;
                    }

                    MasterReference.accountsReceivable += roomPrice;
                    aRoom.daysOccupied--;
                    //Reset scale when room is available again

                }
                if (aRoom.daysOccupied == 0 && aRoom.inUse)
                {
                    GameObject assetCTR = GameObject.FindGameObjectWithTag("GameController").transform.FindChild("AssetController").gameObject;
                    string currentLayout = "";

                    aRoom.typeRented = groupType.noneBooked;
                    if (aRoom.roomCleanliness >= 50)
                    {
                        aRoom.GetComponent<Renderer>().material.color = Color.white;

                        if (aRoom.name == "Container")
                        {
                            switch (aRoom.roomQuality)
                            {
                                case 1:
                                    currentLayout = "Standard";
                                    break;
                                case 2:
                                    currentLayout = "Double";
                                    break;
                            }
                            assetCTR.GetComponent<AssetSwapper>().SwapRoomStatus(aRoom.gameObject, currentLayout, "Clean");
                        }
                    }
                    else
                    {
                        if (aRoom.name == "Container")
                        {
                            switch (aRoom.roomQuality)
                            {
                                case 1:
                                    currentLayout = "Standard";
                                    break;
                                case 2:
                                    currentLayout = "Double";
                                    break;
                            }
                            assetCTR.GetComponent<AssetSwapper>().SwapRoomStatus(aRoom.gameObject, currentLayout, "Dirty");
                        }
                        aRoom.GetComponent<Renderer>().material.color = Color.yellow;
                    }
                    aRoom.inUse = false;
                }
            }

        }

        ShuffleRooms();
    }
Ejemplo n.º 5
0
 private bool HasFlag(WeekDays d1, WeekDays d2)
 {
     return(((byte)d1 & (byte)d2) == (byte)d2);
 }
Ejemplo n.º 6
0
 private void SingleDayCourseToggle_Click(object sender, RoutedEventArgs e)
 {
     AppBarToggleButton sdct = (AppBarToggleButton)sender;
     if ((bool)sdct.IsChecked)
     {
         weekDays.Clear();
         foreach(string item in days)
         {
             WeekDays day = new WeekDays() { day = item };
             weekDays.Add(day);
         }
         //singleDayCourseView.ItemsSource = null;
         //singleDayCourseView.ItemsSource = weekDays;
         timeTableView.Visibility = Visibility.Collapsed;
         singleDayCourseView.Visibility = Visibility.Visible;
     }
     else
     {
         timeTableView.Visibility = Visibility.Visible;
         singleDayCourseView.Visibility = Visibility.Collapsed;
     }
 }
Ejemplo n.º 7
0
 public Time(WeekDays weekDay)
 {
     WeekDay = weekDay;
     DateTimes = new List<DateTime>();
 }
Ejemplo n.º 8
0
        }         // AddWorkingWeekDays

        // ----------------------------------------------------------------------
        public void AddWeekendWeekDays()
        {
            WeekDays.Add(DayOfWeek.Saturday);
            WeekDays.Add(DayOfWeek.Sunday);
        }         // AddWeekendWeekDays
Ejemplo n.º 9
0
 public bool IsDayActive(WeekDays day)
 {
     return((days & (int)day) != 0);
 }
Ejemplo n.º 10
0
 public Habit(string HabitName, DateTime HabitDateTime, WeekDays HabitWeekDays)
 {
     this.HabitName     = HabitName;
     this.HabitDateTime = HabitDateTime;
     this.HabitWeekDays = HabitWeekDays;
 }
Ejemplo n.º 11
0
 static void Task8()
 {
     WeekDays days = WeekDays.Friday;
     Console.WriteLine(days);
 }
Ejemplo n.º 12
0
 public static WeekDays RemoveWeekDay(WeekDays workDays, WeekDays day)
 {
     return(workDays & ~day);
 }
Ejemplo n.º 13
0
 public static WeekDays AddWeekDay(WeekDays workDays, WeekDays day)
 {
     return(workDays | day);
 }
Ejemplo n.º 14
0
 public void ShowDay(WeekDays someDay)
 {
     Console.WriteLine(someDay);
 }
Ejemplo n.º 15
0
 public WeekDays HelloWorld(WeekDays wd)
 {
     return(wd);
 }
Ejemplo n.º 16
0
        public AttachStudentResultModel PostAttachStudent(AttachStudentModel model)
        {
            var        res = new AttachStudentResultModel();
            List <int> stations;
            List <int> lines;
            DateTime?  date = null;

            if (!string.IsNullOrEmpty(model.StrDate))
            {
                var dtList = model.StrDate.Split('/');
                if (dtList.Length == 3)
                {
                    date = new DateTime(
                        int.Parse(dtList[2]),
                        int.Parse(dtList[0]),
                        int.Parse(dtList[1]),
                        model.Hours,
                        model.Minutes, 0);
                }
            }
            var wd = new WeekDays
            {
                Monday    = model.Mon == "on",
                Tuesday   = model.Tue == "on",
                Wednesday = model.Wed == "on",
                Thursday  = model.Thu == "on",
                Friday    = model.Fri == "on",
                Saturday  = model.Sat == "on",
                Sunday    = model.Sun == "on"
            };

            using (var logic = new tblStudentLogic())
            {
                var oldList = logic.GetAttachInfo(model.StudentId);
                stations = oldList.Select(z => z.StationId).ToList();
                lines    = oldList.Where(z => z.LineId != -1).Select(z => z.LineId).ToList();
            }
            using (var logic = new StationsLogic())
            {
                res.Done = logic.AttachStudent(
                    model.StudentId,
                    model.StationId,
                    model.LineId,
                    model.Distance,
                    (ColorMode)model.UseColor,
                    date,
                    model.ConflictAction,
                    wd);
            }
            using (var logic = new tblStudentLogic())
            {
                var newList = logic.GetAttachInfo(model.StudentId);
                stations.AddRange(newList.Select(z => z.StationId).ToList());
                lines.AddRange(newList.Where(z => z.LineId != -1).Select(z => z.LineId).ToList());

                res.Student = new StudentShortInfo(logic.getStudentByPk(model.StudentId));
            }
            using (var logic = new StationsLogic())
            {
                res.Stations = logic.GetStations(stations)
                               .Select(z => new StationModel(z)).ToList();
                foreach (var station in res.Stations)
                {
                    station.Students = logic.GetStudents(station.Id)
                                       .Select(z => new StudentToLineModel(z))
                                       .ToList();
                }
            }
            using (var logic = new LineLogic())
            {
                res.Lines = logic.GetLines(lines).Select(z => new LineModel(z)).ToList();
                foreach (var line in res.Lines)
                {
                    line.Stations = logic.GetStations(line.Id)
                                    .Select(z => new StationToLineModel(z))
                                    .ToList();
                }
            }
            return(res);
        }
Ejemplo n.º 17
0
 public static int getDayOfWeek(WeekDays weekDay)
 {
     return((int)weekDay + 1);
 }
Ejemplo n.º 18
0
 public void ShowDays(WeekDays Flag)
 {
     Console.WriteLine($"Dagen van de week: {Flag}");
 }
Ejemplo n.º 19
0
 public Date(int currentYear, int dayOTM, WeekDays dayP, months monthP, int numberOfWeeks)
 {
     this.year = currentYear;
     this.dayOfTheMonth = dayOTM;
     this.day = dayP;
     this.month = monthP;
     this.numberOfWeeks = numberOfWeeks;
 }
Ejemplo n.º 20
0
 public static bool IsWeekDay(this EDaysOfWeek dayOfWeek)
 {
     return(WeekDays.Contains(dayOfWeek));
 }
Ejemplo n.º 21
0
    //-----checks the median costs and discount based on occupancy.Return a booking or not as a bool----//
    static bool CheckRoomCost(RoomStats aRoom, WeekDays day, float occupancyDiscount)
    {
        int roomQuality = aRoom.roomQuality;
        int percentChance;
        float currentCost = 0f;
        bool WD = true;

        if (day <= WeekDays.Wednesday)
        {
            WD = true;
        }
        else
        {
            WD = false;
        }

        switch (roomQuality)
        {
        case 1:
            if(WD){currentCost = receptionLogs[receptionLogs.Count-1].standardRoom.weekdayRoomCost;}
            else{currentCost = receptionLogs[receptionLogs.Count-1].standardRoom.weekdayRoomCost;}
            break;
        case 2:
            if(WD){currentCost = receptionLogs[receptionLogs.Count-1].doubleRoom.weekdayRoomCost;}
            else{currentCost = receptionLogs[receptionLogs.Count-1].doubleRoom.weekdayRoomCost;}
            break;

        case 3:
            if(WD){currentCost = receptionLogs[receptionLogs.Count-1].deluxeRoom.weekdayRoomCost;}
            else{currentCost = receptionLogs[receptionLogs.Count-1].deluxeRoom.weekdayRoomCost;}
            break;

        case 4:
            if(WD){currentCost = receptionLogs[receptionLogs.Count-1].suiteRoom.weekdayRoomCost;}
            else{currentCost = receptionLogs[receptionLogs.Count-1].suiteRoom.weekdayRoomCost;}
            break;

        case 5:
            if(WD){currentCost = receptionLogs[receptionLogs.Count-1].masterSuiteRoom.weekdayRoomCost;}
            else{currentCost = receptionLogs[receptionLogs.Count-1].masterSuiteRoom.weekdayRoomCost;}
            break;
        }
        if (WD)
        {
            percentChance = (int)((medianRoomCostWD[roomQuality-1]/(currentCost*occupancyDiscount/100f))*0.75f*100f);
        }
        else
        {
            percentChance =  (int)((medianRoomCostWE[roomQuality-1]/(currentCost*occupancyDiscount/100f))*0.75f*100f);
        }

        return BoolGen (percentChance);
    }
Ejemplo n.º 22
0
        static void Main(string[] args)
        {
            #region daysoftheweek

            WeekDays today = WeekDays.Wednesday;

            switch (today)
            {
            case WeekDays.Monday:
                Console.WriteLine("Today its Monday");
                break;

            case WeekDays.Tuesday:
                Console.WriteLine("Today its Tuesday");
                break;

            case WeekDays.Wednesday:
                Console.WriteLine("Today its Wednesday");
                break;

            case WeekDays.Thursday:
                Console.WriteLine("Today its Thursday");
                break;

            case WeekDays.Friday:
                Console.WriteLine("Today its Friday");
                break;

            case WeekDays.Saturday:
                Console.WriteLine("Today its Saturday");
                break;

            case WeekDays.Sunday:
                Console.WriteLine("Today its Sunday");
                break;
            }

            Console.WriteLine();
            Console.WriteLine("Press [Enter] to continue!");
            Console.ReadLine();
            Console.Clear();

            #endregion

            #region Directions

            string    choice;
            Direction PlayerDirection;

            Console.WriteLine("Chose a direction that you want to move to:");
            Console.WriteLine();
            Console.WriteLine("Option 1: Move North");
            Console.WriteLine("Option 2: Move East");
            Console.WriteLine("Option 3: Move South");
            Console.WriteLine("Option 4: Move West");
            Console.WriteLine();
            Console.WriteLine("chose one of the options that are given above:");
            choice = Console.ReadLine();

            switch (choice)
            {
            case "1":
                PlayerDirection = Direction.North;
                break;

            case "2":
                PlayerDirection = Direction.East;
                break;

            case "3":
                PlayerDirection = Direction.South;
                break;

            case "4":
                PlayerDirection = Direction.West;
                break;

            case "5":
                PlayerDirection = Direction.Stay;
                break;

            default:
                goto case "5";
                break;
            }

            switch (PlayerDirection)
            {
            case Direction.North:
                Console.WriteLine("You have chosen to move North,");
                Console.WriteLine("Goodluck with your adventures!");
                break;

            case Direction.East:
                Console.WriteLine("You have chosen to move East,");
                Console.WriteLine("Goodluck with your adventures!");
                break;

            case Direction.South:
                Console.WriteLine("You have chosen to move South,");
                Console.WriteLine("Goodluck with your adventures!");
                break;

            case Direction.West:
                Console.WriteLine("You have chosen to move West,");
                Console.WriteLine("Goodluck with your adventures!");
                break;

            case Direction.Stay:
                Console.WriteLine("you have chosen to stay in the same spot!");
                break;

            default:
                break;
            }
            #endregion
        }
Ejemplo n.º 23
0
 //Used to book group rooms
 public static void BookRoomSpecial(WeekDays dayOfWeek, specialBookings special)
 {
     RoomStats aRoom = BedroomBehaviour.GetNextAvailableRoom();
     aRoom.Book (special.numberOfDays);
     //Debug.Log("Room booked for " + special.numberOfDays + " days for special event!");
 }
Ejemplo n.º 24
0
 public static void SelectRoute(WeekDays day, string start, string end)
 {
 }