Exemplo n.º 1
0
        private void inputConfigToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ConfigFile temp = new ConfigFile();

            openFileDialog1.Filter      = "Config File(*.cfgdata)|*.cfgdata";
            openFileDialog1.FilterIndex = 1;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                temp.LoadFromFile(openFileDialog1.FileName);

                List <Student> tempStudents = new List <Student>();
                studentListTable.Items.Clear();
                foreach (string i in temp.students)
                {
                    Student newStudent = new Student(i);
                    tempStudents.Add(newStudent);
                    studentListTable.Items.Add(newStudent);
                }
                students = new StudentList(tempStudents);

                seats = new SeatList(0, Array.Empty <int>());
                seatTable.RowCount    = 1;
                seatTable.ColumnCount = 1;
                CleanTableWithFrontSign();
                for (int k = 0; k < temp.row; k++)
                {
                    AddNewRow(k + 1, temp.col[k]);
                }
            }
        }
Exemplo n.º 2
0
 private void cleanTable_Click(object sender, EventArgs e)
 {
     seatTable.RowCount    = 1;
     seatTable.ColumnCount = 1;
     CleanTableWithFrontSign();
     int[] temp0 = { };
     seats = new SeatList(0, temp0, null);
 }
Exemplo n.º 3
0
        public ActionResult DeleteConfirmed(int id)
        {
            SeatList seatList = db.SeatLists.Find(id);

            db.SeatLists.Remove(seatList);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
 public Form1()
 {
     InitializeComponent();
     CleanTableWithFrontSign();
     int[] temp0 = { };
     seats = new SeatList(0, temp0, null);
     string[] temp1 = { };
     students = new StudentList(temp1);
 }
Exemplo n.º 5
0
 public ConfigFile(SeatList inputSeatList, StudentList inputStudentList)
 {
     row      = inputSeatList.row;
     col      = inputSeatList.col;
     students = new List <string>();
     foreach (Student i in inputStudentList.students)
     {
         students.Add(i.name);
     }
 }
Exemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "id,seatNumber,IsAvailable,Hallid")] SeatList seatList)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seatList).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Hallid = new SelectList(db.Halls, "id", "id", seatList.Hallid);
     return(View(seatList));
 }
Exemplo n.º 7
0
        public ActionResult Create([Bind(Include = "id,seatNumber,IsAvailable,Hallid")] SeatList seatList)
        {
            if (ModelState.IsValid)
            {
                db.SeatLists.Add(seatList);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Hallid = new SelectList(db.Halls, "id", "id", seatList.Hallid);
            return(View(seatList));
        }
Exemplo n.º 8
0
        // GET: SeatLists/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SeatList seatList = db.SeatLists.Find(id);

            if (seatList == null)
            {
                return(HttpNotFound());
            }
            return(View(seatList));
        }
Exemplo n.º 9
0
        public TableResultFile(SeatList inputSeatList)
        {
            students = new List <string>();
            Seat temp = inputSeatList.head;

            while (temp != null)
            {
                if (temp.stu == null)
                {
                    return;
                }
                students.Add(temp.stu.name);
                temp = temp.next;
            }
        }
Exemplo n.º 10
0
        // GET: SeatLists/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            SeatList seatList = db.SeatLists.Find(id);

            if (seatList == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Hallid = new SelectList(db.Halls, "id", "id", seatList.Hallid);
            return(View(seatList));
        }
Exemplo n.º 11
0
        public void List_CheckStatus_ReturnSeat(int row, int column, int allocationTypeId, string allocationTypeDescription)
        {
            //Arrange
            var seatReservationDataContext = new InMemorySeatReservationDataContext($"SeatList{row}{column}");
            var testDB = new TestDataset1();

            testDB.Load(seatReservationDataContext);

            //Act
            var eventList = new SeatList(seatReservationDataContext).List(2);
            var item      = eventList.Where(p => p.Row == row && p.Column == column).FirstOrDefault();

            //Assert
            Assert.NotNull(item);
            Assert.Equal(item.AllocationTypeId, allocationTypeId);
            Assert.Equal(item.AllocationTypeDescription, allocationTypeDescription);
        }
Exemplo n.º 12
0
        public void AddSeatsToCart(CsharpSeatBookingSystemContext _databaseConn)
        {
            int i = 0;

            string[] SeatListArr = SeatList.Split(' ');
            foreach (string seat in SeatListArr)
            {
                Console.Out.WriteLine(seat);
                i++;
                Cart temp = new Cart();
                temp.SeatId  = Int16.Parse(seat.Trim());
                temp.UserId  = UserId;
                temp.EventId = EventID;
                _databaseConn.Add(temp);
                _databaseConn.SaveChanges();
            }
        }
Exemplo n.º 13
0
        public ActionResult Create([Bind(Include = "id,numberOfSeats")] Hall hall)
        {
            if (ModelState.IsValid)
            {
                db.Halls.Add(hall);
                db.SaveChanges();

                for (int i = 1; i <= hall.numberOfSeats; i++)
                {
                    SeatList seatList = new SeatList();
                    seatList.IsAvailable = true;
                    seatList.seatNumber  = i.ToString();
                    seatList.Hallid      = hall.id;
                    db.SeatLists.Add(seatList);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }

            return(View(hall));
        }
Exemplo n.º 14
0
        public SeatModel PickSeat(int Number, string Type)
        {
            SeatModel pickedSeat = SeatList.FirstOrDefault(i => i.Number == Number && i.Type == Type && !i.IsOccuped);

            return(pickedSeat);
        }
Exemplo n.º 15
0
		public SeatRow()
		{
			Seats = new SeatList();
		}