示例#1
0
 public Flight(string originAirport, string destinationAirport, Seating seating, DateTime date)
 {
     this.originAirport      = originAirport;
     this.destinationAirport = destinationAirport;
     this.seating            = seating;
     this.date = date;
 }
示例#2
0
        public ActionResult MakeEventSeat(All a, int i, string Name, string userNameCurr)
        {
            ViewData["i"]    = i;
            ViewData["Name"] = Name;

            if (userNameCurr != null)
            {
                List <Seating> seatList = es.Seatings.ToList();
                Seating        found    = seatList.Find(c => c.User_Name == userNameCurr && c.Event_Name == Name);

                es.Seatings.Remove(found);
                es.SaveChanges();
            }
            a = new All
            {
                name   = user,
                event1 = new Event(),
                chart1 = new Chart(),

                seating2 = es.Seatings.ToList(),
                chart2   = es.Charts.ToList(),
                login2   = es.Login_Table.ToList()
            };

            return(View(a));
        }
        /// <summary>
        /// AddNewPerson функція, що вносить дані про користувача який забронював авіаквиток.
        /// </summary>
        public void AddNewPerson()
        {
            var sum = Int32.Parse(new String(string.Join(" ", Seating.Split(' ').ToList()[2]).Where(Char.IsDigit).ToArray()));
            PersonalInformation personalInformation = new PersonalInformation();

            personalInformation.FirstName  = FirstName;
            personalInformation.SecondName = SecondName;
            personalInformation.Document   = Document;
            personalInformation.Gender     = Gender.ToString();
            personalInformation.FlightId   = FlightId;
            personalInformation.BirthDate  = BirthDate;
            personalInformation.Seating    = string.Join(" ", Seating.Split(' ').ToList().GetRange(0, 2)).ToString();
            personalInformation.Login      = Login;
            CountTickets -= 1;

            Clients.Add(personalInformation, sum);

            if (CountTickets == 0)
            {
                Views.Payment menu = new Views.Payment(Login);
                menu.Show();
                CloseWindow();
            }
            else
            {
                Views.Personal_Information personal_Information = new Views.Personal_Information(Login, FlightId, CountTickets);
                personal_Information.Show();
                CloseWindow();
            }
        }
        public static void Show(Guid id)
        {
            Seating seat = templist[id];

            templist.Remove(id);
            templist1.Add(seat.Id, seat);
        }
示例#5
0
    public override void BindToParkitect(GameObject hider, AssetBundle bundle)
    {
        BaseDecorator        baseDecorator     = DecoratorByInstance <BaseDecorator>();
        SeatDecorator        seatDecorator     = DecoratorByInstance <SeatDecorator>();
        ColorDecorator       colorDecorator    = DecoratorByInstance <ColorDecorator>();
        BoundingBoxDecorator boxDecorator      = DecoratorByInstance <BoundingBoxDecorator>();
        CategoryDecorator    categoryDecorator = DecoratorByInstance <CategoryDecorator>();

        GameObject gameObject = Instantiate(bundle.LoadAsset <GameObject>(Key));;

        gameObject.transform.parent = hider.transform;

        _seat      = gameObject.AddComponent <Seating>();
        _seat.name = Key;

        RemapUtility.RemapMaterials(gameObject);

        baseDecorator.Decorate(gameObject, hider, this, bundle);
        colorDecorator.Decorate(gameObject, hider, this, bundle);
        categoryDecorator.Decorate(gameObject, hider, this, bundle);

        foreach (var box in boxDecorator.BoundingBoxes)
        {
            var b = Prefab.AddComponent <BoundingBox>();
            b.setBounds(box.Bounds);
        }

        AssetManager.Instance.registerObject(_seat);
    }
示例#6
0
        private void Delete()
        {
            bool confirmed = false;

            if (listBox1.SelectedItem == null)
            {
                return;
            }
            FormattedListBoxItem selectedItem =
                listBox1.SelectedItem as FormattedListBoxItem;

            if (selectedItem == null)
            {
                return;
            }

            if (ViewMode == SeatingViewMode.Rooms)
            {
                string message = (buttonEditToggle.IsEnabled ?
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoomAndAllItsSeatings :
                                  Strings.AreYouSureYouWantToDeleteTheSelectedRoom);
                if (PosDialogWindow.ShowDialog(
                        message, Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Room room = selectedItem.ReferenceObject as Room;
                    if (room != null)
                    {
                        SeatingManager.DeleteRoom(room.Id);
                        SeatingManager.DeleteAllSeating(room.Id);
                    }
                    buttonEditToggle.IsEnabled  = false;
                    roomEditorControl.IsEnabled = false;
                    SelectedRoom    = null;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            else if (ViewMode == SeatingViewMode.Seating)
            {
                if (PosDialogWindow.ShowDialog(
                        Strings.AreYouSureYouWantToDeleteTheSelectedSeating,
                        Strings.ConfirmDeletion, DialogButtons.OkCancel) == DialogButton.Ok)
                {
                    Seating seating = selectedItem.ReferenceObject as Seating;
                    if (seating != null)
                    {
                        SeatingManager.DeleteSeating(seating.Id);
                    }
                    seatingEditorControl.IsEnabled = false;
                    SelectedSeating = null;
                    confirmed       = true;
                }
            }
            if (confirmed)
            {
                listBox1.Items.Remove(selectedItem);
                listBox1.SelectedItem  = null;
                buttonDelete.IsEnabled = false;
            }
        }
示例#7
0
            public FloorPlan(List <string> rawData)
            {
                StableSeating = false;
                maxRow        = rawData.Count - 1;
                maxCol        = rawData[0].Length - 1;
                // First generates a list of list of seats
                foreach (string row in rawData)
                {
                    List <Seat> rowList = new List <Seat>();
                    foreach (char seat in row)
                    {
                        rowList.Add(new Seat(seat));
                    }
                    Seating.Add(rowList);
                }

                // Then adds all the specific neigbours to individual seats
                for (int row = 0; row <= maxRow; row++)
                {
                    for (int col = 0; col <= maxCol; col++)
                    {
                        AddNeighboursToSeat(row, col);
                    }
                }
            }
示例#8
0
 private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((e.AddedItems == null) || (e.AddedItems.Count == 0))
     {
         if (listBox1.SelectedItem == null)
         {
             buttonDelete.IsEnabled = false;
         }
         return;
     }
     if (ViewMode == SeatingViewMode.Rooms)
     {
         FormattedListBoxItem item = listBox1.SelectedItem as FormattedListBoxItem;
         if (item != null)
         {
             SelectedRoom = item.ReferenceObject as Room;
         }
         roomEditorControl.IsEnabled = true;
     }
     else if (ViewMode == SeatingViewMode.Seating)
     {
         FormattedListBoxItem item = listBox1.SelectedItem as FormattedListBoxItem;
         if (item != null)
         {
             SelectedSeating = item.ReferenceObject as Seating;
         }
         seatingEditorControl.IsEnabled = true;
     }
     buttonDelete.IsEnabled = true;
     SetEditMode(false);
 }
示例#9
0
        public static Seating AddSeating(int roomId, string description, int capacity)
        {
            Seating newSeating = Seating.Add(roomId, description, capacity, false);

            Seatings.Add(newSeating.Id, newSeating);
            NotifySeatingChanged();
            return(newSeating);
        }
示例#10
0
        private void CompletePath(IContext ctx, Context context, Seating seating)
        {
            seating.SetPathDone();
            ctx.Update(seating);

            context.SetState(ContextState.CheckDone);
            ctx.Update(context);
        }
示例#11
0
 private char ToChar(Seating seating)
 {
     return(seating switch
     {
         Seating.Floor => '.',
         Seating.Empty => 'L',
         Seating.Occupied => '#',
         _ => throw new Exception("Unexpected input"),
     });
示例#12
0
        public void SeatingParsingTest()
        {
            var seating = new Seating(_testInput);

            Assert.AreEqual('L', seating.GetSeat(0, 0));
            Assert.AreEqual('L', seating.GetSeat(0, 1));
            Assert.AreEqual('.', seating.GetSeat(1, 0));
            Assert.AreEqual('L', seating.GetSeat(9, 9));
        }
示例#13
0
        public static void DeleteSeating(int seatingId)
        {
            Seating seating = Seatings[seatingId];

            seating.SetIsUnused(true);
            seating.Update();
            Seatings.Remove(seatingId);
            NotifySeatingChanged();
        }
示例#14
0
        public static bool UpdateSeating(Seating seating)
        {
            bool result = Seating.Update(seating);

            if (result)
            {
                NotifySeatingChanged();
            }
            return(result);
        }
示例#15
0
        private static void UpdateSeatings()
        {
            Seatings.Clear();
            IEnumerable <Seating> seatings = Seating.GetAll(false);

            foreach (Seating seating in seatings)
            {
                Seatings.Add(seating.Id, seating);
            }
        }
        public ActionResult AddOrder(Seating s)
        {
            SeanceContext db = new SeanceContext();

            db.Seatings.Add(new Seating {
                SeanceID = s.SeanceID, UserID = 1, Row = s.Row, Place = s.Place
            });
            db.SaveChanges();
            return(RedirectToAction("Buy", new { id = s.SeanceID }));
        }
 public bool SameSpot(Seating other)
 {
     if (other.GetTable().Equals(table) && other.GetSeat().Equals(seat))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#18
0
 public bool Put(Guid id, [FromBody] Seating seating)
 {
     if (this.seatings.items.ContainsKey(seating.Id))
     {
         return(this.seatings.Update(seating));
     }
     else
     {
         return(false);
     }
 }
示例#19
0
        private void MapSeatingFromInput(List <string> rawInput)
        {
            var rawString = string.Join(",", rawInput);

            _seating = new Seating()
            {
                Layout        = rawInput,
                NumberOfSeats = rawString.Count(c => c == 'L'),
                Open          = rawString.Count(c => c == 'L'),
                Taken         = 0
            };
        }
示例#20
0
 public bool Post([FromBody] Seating seating)
 {
     if (!this.seatings.items.ContainsKey(seating.Id))
     {
         //    SeatManage.Hide(seating);
         return(this.seatings.Add(seating));
     }
     else
     {
         return(false);
     }
 }
示例#21
0
        public override void Define()
        {
            Context context = default;
            Seating seating = default;

            When()
            .Match(() => context, c => c.State == ContextState.MakePath)
            .Match(() => seating, s => !s.PathDone);

            Then()
            .Do(ctx => CompletePath(ctx, context, seating));
        }
示例#22
0
        public ActionResult ShowSeats(All a, int i, string Name, string aid, string existance)
        {
            ViewData["i"]    = i;
            ViewData["Name"] = Name;

            List <Seating> seatList = es.Seatings.ToList();
            Seating        found    = seatList.Find(c => c.User_Name == (string)Session["Name"]);
            Seating        found2   = seatList.Find(c => c.User_Name == (string)Session["Name"] && c.Hold_Places == aid);

            if (existance == "No_one")
            {
                Seating newSeating = new Seating();

                newSeating.Event_Name  = Name;
                newSeating.Hold_Places = aid;
                newSeating.User_Name   = (string)Session["Name"];

                es.Seatings.Add(newSeating);
                es.SaveChanges();
            }

            else if (existance == "No_one+Booked")
            {
                found.Hold_Places = aid;

                es.SaveChanges();
            }

            else if (existance == "userExists")
            {
                es.Seatings.Remove(found2);

                es.SaveChanges();
            }



            a = new All
            {
                name   = user,
                event1 = new Event(),
                chart1 = new Chart(),

                seating2 = es.Seatings.ToList(),
                chart2   = es.Charts.ToList(),
                login2   = es.Login_Table.ToList()
            };



            return(View(a));
        }
示例#23
0
 private void Add()
 {
     listBox1.SelectedItem = null;
     if (ViewMode == SeatingViewMode.Rooms)
     {
         SelectedRoom = null;
     }
     else if (ViewMode == SeatingViewMode.Seating)
     {
         SelectedSeating = null;
     }
     SetEditMode(true);
 }
    public override void OnServerAddPlayer(NetworkConnection conn, short playerControllerId, NetworkReader extraMessageReader)
    {
        Vector3 location = tableLocations[tableSelected] + seatOffsets[seatSelected];
        Seating spot     = new Seating(tableSelected, seatSelected);

        loggedIn.Add(spot);

        GameObject player = GameObject.Instantiate(playerPrefab, location, Quaternion.identity);

        player.GetComponent <Controller>().SetSeatNum(seatSelected);
        player.GetComponent <Controller>().SetTableNum(tableSelected);
        player.GetComponent <Controller>().SetInstructor();
        NetworkServer.AddPlayerForConnection(conn, player, playerControllerId);
    }
示例#25
0
        public override void Define()
        {
            Context context = null;
            Seating seating = null;

            Priority(0);

            When()
            .Match <Context>(() => context, c => c.State == ContextState.MakePath)
            .Match <Seating>(() => seating, s => !s.PathDone);

            Then()
            .Do(ctx => CompletePath(ctx, context, seating));
        }
示例#26
0
        public bool UpdateSeating()
        {
            // Add Seating
            if (SelectedSeating == null)
            {
                SelectedSeating = SeatingManager.AddSeating(SelectedRoom.Id,
                                                            GetName(), GetCapacity());
                return(SelectedSeating != null);
            }

            // Update Seating
            SelectedSeating.SetDescription(GetName());
            SelectedSeating.SetCapacity(GetCapacity());
            return(SelectedSeating.Update());
        }
示例#27
0
        public override void Define()
        {
            Context  context  = null;
            LastSeat lastSeat = null;
            Seating  seating  = null;

            When()
            .Match <Context>(() => context, c => c.State == ContextState.CheckDone)
            .Match <LastSeat>(() => lastSeat)
            .Match <Seating>(() => seating, s => s.RightSeatId == lastSeat.SeatId);

            Then()
            .Do(ctx => context.SetState(ContextState.PrintResults))
            .Do(ctx => ctx.Update(context));
        }
示例#28
0
文件: MakePath.cs 项目: zhrjin/NRules
        public override void Define()
        {
            Context context = null;
            Seating seating = null;
            Path    path    = null;

            When()
            .Match <Context>(() => context, c => c.State == ContextState.MakePath)
            .Match <Seating>(() => seating, s => !s.PathDone)
            .Match <Path>(() => path, p => p.Id == seating.Pid)
            .Not <Path>(p => p.Id == seating.Id, p => p.GuestName == path.GuestName);

            Then()
            .Do(ctx => MakeNewPath(ctx, context, seating, path));
        }
    public bool SeatIsOccupied()
    {
        Seating attempt = new Seating(tableSelected, seatSelected);

        foreach (Seating taken in loggedIn)
        {
            if (attempt.SameSpot(taken))
            {
                //Seat taken
                return(true);
            }
        }
        //Otherwise, seat is available
        return(false);
    }
示例#30
0
        private void AssignSeat(IContext ctx, Context context, Guest guest, Count count)
        {
            var cnt = count.Value;

            var seating = new Seating(cnt, 0, true, 1, guest.Name, 1, guest.Name);
            ctx.Insert(seating);

            var path = new Path(cnt, 1, guest.Name);
            ctx.Insert(path);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.AssignSeats);
            ctx.Update(context);
        }
示例#31
0
        public void Part2FirstRound()
        {
            var seating = Seating.FromString(_startInput);

            seating.Part2NextRound()
            .ToString().Should().Be(@"#.##.##.##
#######.##
#.#.#..#..
####.##.##
#.##.##.##
#.#####.##
..#.#.....
##########
#.######.#
#.#####.##");
        }
示例#32
0
        private void AssignSeat(IContext ctx, Context context, Seating seating, Guest guest1, Guest guest2, Count count)
        {
            int rightSeat = seating.RightSeatId;
            int seatId = seating.Id;
            int cnt = count.Value;

            var newSeating = new Seating(cnt, seatId, false, rightSeat, seating.RightGuestName, rightSeat + 1, guest2.Name);
            ctx.Insert(newSeating);

            var path = new Path(cnt, rightSeat + 1, guest2.Name);
            ctx.Insert(path);

            var chosen = new Chosen(seatId, guest2.Name, guest1.Hobby);
            ctx.Insert(chosen);

            count.Increment();
            ctx.Update(count);

            context.SetState(ContextState.MakePath);
            ctx.Update(context);
        }