/// <summary> /// An event that's called everytime the HotelEventManager pushes out an HotelEvent. /// </summary> /// <param name="Event">The HotelEvent containing event information.</param> public void Notify(HotelEvent Event) { #region START_CINEMA //In this case we only need to check for the relevant HotelEventType, which is START_CINEMA if (Event.EventType == HotelEventType.START_CINEMA) { if (Event.Data.Keys.First() == "ID" && PullIntsFromString(Event.Data.Values.ToList())[0] == ID) { //Set the progress int to the length of the Movie MovieProgress = MovieTime; //Tell customers that the movie has started and that they can't enter MovieStarted = true; //Change the Sprite of the cinema so it's easier to see if the movie has started or not Sprite = Sprites.Cinema_Start; //Placing all the Customers in line into the Cinema InCinema = new HashSet <Customer>(WaitingLine); WaitingLine.Clear(); //Telling all the Customers in the Cinema that the movie has started foreach (Customer customer in InCinema) { customer.InCinema(MovieTime, this); } } } #endregion }
public IActionResult Complete(int insuranceId, int doctorId) { ShiftPlan shiftplan = GetShiftPlanFromDoctorId(doctorId); // Lấy mã phòng Room room = _context.Rooms.Where(r => r.Id == shiftplan.Room_Id).FirstOrDefault(); string roomshortcode = room.ShortCode; // Lấy tên bác sĩ Doctor doc = _context.Doctors.Where(d => d.Id == doctorId).FirstOrDefault(); string doctorname = doc.NameLast + " " + doc.NameMiddle + " " + doc.NameFirst; // Lấy tên khoa string facultyname = _context.Faculties.Where(f => f.Id == doc.Faculty_Id).FirstOrDefault().Name; // Lấy số thứ tự //nullhere int waitnumber = 0; var ifnull = _context.WaitingLines.Where(w => w.Room_Id == room.Id).LastOrDefault(); if (ifnull == null) { waitnumber = 1; } else { waitnumber = ifnull.Number + 1; } // Thêm vào hàng chờ WaitingLine new_wait = new WaitingLine() { Room_Id = room.Id, Patient_Id = _context.Patients.Where(p => p.Insurance_Id == insuranceId).FirstOrDefault().Id, Number = waitnumber }; _context.WaitingLines.Add(new_wait); _context.SaveChanges(); VictimCompleteViewModel vm = new VictimCompleteViewModel() { RoomShortCode = roomshortcode, DoctorName = doctorname, FacultyName = facultyname, WaitNumber = waitnumber }; return(View(vm)); }
public int CompareTo(object obj) { WaitingLine waitingLineToCompare = obj as WaitingLine; if (waitingLineToCompare.waitingTime < waitingTime) { return(1); } if (waitingLineToCompare.waitingTime > waitingTime) { return(-1); } return(0); }
public void EnterStation(Plane plane) { if (IsWaitinglineEmpty && !isStationOccupied) { Task.Run(() => { Wait(plane); }); } else { WaitingLine.Enqueue(plane); ChangeInState?.Invoke(this, new StationChangedEventArgs(this.WaitingLine, plane, DateTime.Now, PlaneAction.EnterWaitingLine)); } }
static void Main(string[] args) { //Console.WriteLine("Le resto est ouvert"); //Room mainRoom = new Room(); Room mainRoom = Room.Instance; WaitingLine waitingline = new WaitingLine(); for (int i = 0; i < 10; i++) { waitingline.AjouterClientsWaitline(new GroupClient()); mainRoom.HeadWaiter.checkWaitingLine(waitingline); } foreach (Table table in mainRoom.Square1.Tables) { Console.WriteLine(table.Occupied); if (table.Occupied == true) { Console.WriteLine("Avec un groupe de : " + table.Clients.NbrClients + " table id : " + table.IdTable); } } foreach (Table table in mainRoom.Square2.Tables) { Console.WriteLine(table.Occupied); if (table.Occupied == true) { Console.WriteLine("Avec un groupe de : " + table.Clients.NbrClients + " table id : " + table.IdTable); } } Console.ReadLine(); /*IPAddress ip = Dns.GetHostEntry("localhost").AddressList[0]; * TcpListener server = new TcpListener(ip, 8080); * TcpClient client = default(TcpClient); * * try * { * server.Start(); * Console.WriteLine("Le restaurant est ouvert..."); * * }catch (Exception ex) * { * Console.WriteLine(ex.ToString()); * Console.Read(); * } * * while (true) * { * client = server.AcceptTcpClient(); * * byte[] receiveBuffer = new byte[100]; * NetworkStream stream = client.GetStream(); * * stream.Read(receiveBuffer, 0, receiveBuffer.Length); * string msg = Encoding.ASCII.GetString(receiveBuffer, 0, receiveBuffer.Length); * * Console.WriteLine(msg); * * }*/ }