/// <summary> /// Adds a table to the database from user entered data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void addTableButton_Click(Object sender, EventArgs e) { //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding if (Page.IsValid) { TableModel newTable = new TableModel(); BuildingModel bm = new BuildingModel(); RoomModel rm = new RoomModel(); //Selects single selected building form buildinglist bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); int id = bm.BuildingID; //Fills the list for the next to take it rooms = RoomBL.fillRoomsList(id); //Selects single selected building from roomlist rm = rooms.Where(r => r.RoomID == Int32.Parse(roomDropdown.Text)).FirstOrDefault(); //Sets the table values from user data newTable.RoomID = rm.RoomID; newTable.Category = inTableCatagory.Value; newTable.PersonCapacity = Convert.ToInt32(inTableCapacity.Value); //Adds a new table to the database TableBL.ProcessAddNewTable(newTable); //Visually displays recognition of successful table creation ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "Table Created!" + "');", true); } }
protected void Page_Load(object sender, EventArgs e) { //Gets all buildings by an ID int ID = Int32.Parse(Request.QueryString["ID"]); lblHeading.Text = "Building: " + BuildingBL.getBuildingByID(ID).BuildingName; rooms = RoomBL.fillRoomsList(ID); if (!IsPostBack) { //Fill list with all relevant rooms inputRoomSelecter.DataSource = rooms; inputRoomSelecter.DataValueField = "RoomID"; inputRoomSelecter.DataTextField = "RoomName"; inputRoomSelecter.DataBind(); } if (inputRoomSelecter.Items.Count < 1) { //If no rooms found, output error code and hide selection options sideLbl.Text = "No rooms found"; inputRoomSelecter.Visible = false; goToRoomingButton.Visible = false; } }
/// <summary> /// Update list of rooms on change of content /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlroomDropDown_SelectedIndexChanged(object sender, EventArgs e) { BuildingModel bm = new BuildingModel(); //Selects single selected building bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); int id = bm.BuildingID; //Pull all rooms from the database rooms = RoomBL.fillRoomsList(id); RoomModel rm = new RoomModel(); //Selects single selected building rm = rooms.Where(r => r.RoomID == Int32.Parse(roomDropdown.Text)).FirstOrDefault(); int rid = rm.RoomID; tables = TableBL.FillTableList(rid); //Update values from user input tableDropdown.DataSource = tables; tableDropdown.DataValueField = "TableID"; tableDropdown.DataTextField = "TableID"; tableDropdown.DataBind(); }
public IHttpActionResult AddLocation([FromBody] dynamic requestBody) { try { string columnsData = Convert.ToString(requestBody); if (!string.IsNullOrEmpty(columnsData)) { var columns = JObject.Parse(columnsData); LocationModel location = new LocationModel(); location.LocationName = columns["locationName"].ToString(); location.CreatedBy = columns["userId"].ToString(); RoomBL room = new RoomBL(); room.AddLocation(location); } return(Ok("Location is added successfully.")); } catch (Exception ex) { string msg = "Room Details are failed to add. \n Error Message: " + ex.Message; return(Ok(msg)); } }
public IHttpActionResult AddRoomBooking([FromBody] dynamic requestBody) { try { string columnsData = Convert.ToString(requestBody); if (!string.IsNullOrEmpty(columnsData)) { var columns = JObject.Parse(columnsData); RoomBookingModel roomBookingModel = new RoomBookingModel(); roomBookingModel.RoomID = int.Parse(columns["roomID"].ToString()); roomBookingModel.GuestName = columns["guestName"].ToString(); roomBookingModel.Age = int.Parse(columns["age"].ToString()); roomBookingModel.Sex = columns["sex"].ToString(); roomBookingModel.BookingStartDate = DateTime.Parse(columns["bookStartDate"].ToString()); roomBookingModel.BookingEndDate = DateTime.Parse(columns["bookEndDate"].ToString()); roomBookingModel.CreatedBy = columns["user"].ToString(); RoomBL room = new RoomBL(); room.AddRoomBookingDetails(roomBookingModel); } return(Ok("Room Booking Details are added successfully.")); } catch (Exception ex) { string msg = "Room Booking Details are failed to add. \n Error Message: " + ex.Message; return(InternalServerError(ex)); } }
public IHttpActionResult AddRoom([FromBody] dynamic requestBody) { try { string columnsData = Convert.ToString(requestBody); if (!string.IsNullOrEmpty(columnsData)) { var columns = JObject.Parse(columnsData); RoomModel roomModel = new RoomModel(); roomModel.LocationID = int.Parse(columns["locationId"].ToString()); roomModel.RoomName = columns["roomName"].ToString(); roomModel.RoomAddress = columns["roomAddress"].ToString(); roomModel.Capacity = int.Parse(columns["capacity"].ToString()); roomModel.IsGenderSpecific = columns["genderSpecific"].ToString(); roomModel.CreatedBy = columns["user"].ToString(); RoomBL room = new RoomBL(); room.AddRoom(roomModel); } return(Ok("Room Details are added successfully.")); } catch (Exception ex) { string msg = "Room Details are failed to add. \n Error Message: " + ex.Message; return(InternalServerError(ex)); } }
/// <summary> /// Adds a room to the database from user entered data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void addRoomButton_Click(Object sender, EventArgs e) { //Uses ASP.NET function IsValid() to test user input and the current error state before proceeding if (Page.IsValid) { BuildingModel bm = new BuildingModel(); //New buiding instance //Finds the single matching building to the user's selection bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); int id = bm.BuildingID; RoomModel newRoom = new RoomModel(); //New room instance //Sets the room values from user data newRoom.BuildingID = id; newRoom.RoomName = inRoomName.Value; newRoom.RoomLabel = inRoomLabel.Value; newRoom.TableQty = Convert.ToInt32(inTableQty.Value); //Adds a new room to the database RoomBL.ProcessAddNewRoom(newRoom); //Redirects the admin to the Admin HomePage after processing Response.Redirect("AdminHome.aspx"); } }
public Manager_PtntMngmnt() { InitializeComponent(); BL = new PatientBL(); DocBL = new DoctorBL(); RooBL = new RoomBL(); RecBL = new ReceptionistBL(); }
public Receptionist_PtntRcptn() { InitializeComponent(); BL = new PatientBL(); DocBL = new DoctorBL(); RooBL = new RoomBL(); RecBL = new ReceptionistBL(); }
public Doctor_PatientDischarge() { InitializeComponent(); BL = new PatientBL(); DocBL = new DoctorBL(); RooBL = new RoomBL(); RecBL = new ReceptionistBL(); PaHiBL = new PatientHistoryBL(); }
public void GetLocationTest() { List <LocationModel> result = null; RoomBL room = new RoomBL(); result = room.GetLocation(); Assert.AreEqual(true, ((result.Count() > 0))); }
protected void btnDirections_Click(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); int buildingID = BuildingBL.getBuildingByID(RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID).BuildingID).BuildingID; // directions module string URL = DirectionModuleBL.start(buildingID); Response.Redirect(URL); }
protected void notifyGroup(string email, int tableID, DateTime date, string sHour) { //The details that are send to the group members NotifyBL.startNotifyGroupMember(UserBL.passUserSearch(Session["login"].ToString()).FirstName.ToString(), email, TableBL.GetTableByID(tableID).TableID.ToString(), RoomBL.getRoomByID(TableBL.GetTableByID(tableID).RoomID).RoomName.ToString(), BuildingBL.getBuildingByID(RoomBL.getRoomByID(TableBL.GetTableByID(tableID).RoomID).BuildingID).BuildingName.ToString(), date.ToString("dd-MM-yyyy"), sHour + "00"); }
public void AddLocationTest() { RoomBL room = new RoomBL(); LocationModel location = new LocationModel(); location.LocationName = "Madurai"; location.CreatedBy = "anitha"; bool result = room.AddLocation(location); Assert.AreEqual(true, result); }
public IHttpActionResult GetDashboard(DateTime startDate, DateTime endDate) { try { RoomBL room = new RoomBL(); var dashboard = room.GetDashBoard(startDate, endDate); return(Ok(dashboard)); } catch (Exception ex) { return(InternalServerError(ex)); } }
protected void Page_Load(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); TableModel ThisTable = TableBL.GetTableByID(ID); lblgetID.Text = ThisTable.TableID.ToString(); lblgetCategory.Text = ThisTable.Category; lblgetSeatingCapacity.Text = ThisTable.PersonCapacity.ToString(); DateTime today = DateTime.Now; //HH = 24hours, hh = 12hours, M = month, m = minute, d = day, y = year. lblHeading.Text = "Select Hour: "; //updates the dropdown list for book Today section List <string> hoursList = new List <String>(); int x = Convert.ToInt32(today.ToString("HH"));; RoomModel thisRoom = RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID); if (x >= thisRoom.ClosingTime.TotalHours) //check if room is closed { btnBook.Enabled = false; } while (x < thisRoom.ClosingTime.TotalHours) //will loop each hour until the end of the room's closing time { if (!TableBL.CheckTableHourAvailability(Int32.Parse(Request.QueryString["ID"]), x, today)) { hoursList.Add(x.ToString() + ": " + "is free"); } else { hoursList.Add(x.ToString() + ": Occupied"); } x++; } if (!IsPostBack) { hourDropdown.DataSource = hoursList; hourDropdown.DataBind(); } if (hourDropdown.SelectedValue.ToString().Contains("Occupied")) { btnBook.Visible = false; lblStatus.Text = "THE TABLE IS CURRENTLY OCCUPIED"; } showCalInputBoxes((TableBL.GetTableByID(ID).PersonCapacity) - 1); // -1 because the user takes up 1 spot showInputBoxes((TableBL.GetTableByID(ID).PersonCapacity) - 1); }
protected void ddlroomDropDown_SelectedIndexChanged(object sender, EventArgs e) { BuildingModel bm = new BuildingModel(); bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); //grabs single selected building int id = bm.BuildingID; rooms = RoomBL.fillRoomsList(id); roomDropdown.DataSource = rooms; roomDropdown.DataValueField = "RoomID"; roomDropdown.DataTextField = "RoomName"; roomDropdown.DataBind(); }
/// <summary> /// Update list of buildings on change of content /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlbuildingDropDown_SelectedIndexChanged(object sender, EventArgs e) { BuildingModel bm = new BuildingModel(); //Selects single selected building bm = buildings.Where(b => b.BuildingID == Int32.Parse(buildingDropdown.Text)).FirstOrDefault(); int id = bm.BuildingID; //Pull all rooms from the database rooms = RoomBL.fillRoomsList(id); //Update values from user input roomDropdown.DataSource = rooms; roomDropdown.DataValueField = "RoomID"; roomDropdown.DataTextField = "RoomName"; roomDropdown.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); lblRoomHeading.Text = "Room: " + RoomBL.getRoomByID(ID).RoomName; tables = TableBL.FillTableList(ID); if (!IsPostBack) //need this to stop it reverting to the top value every button click { tableDropdown.DataSource = tables; tableDropdown.DataValueField = "TableID"; tableDropdown.DataTextField = "TableID"; tableDropdown.DataBind(); } if (tableDropdown.Items.Count < 1) { lblAboveDropdown.Text = "No tables currently available"; tableDropdown.Visible = false; goToTableButton.Visible = false; } // List <TableModel> drawtables = new List <TableModel>(); drawtables = TableBL.FillTableList(ID); int iLenght = drawtables.Count(); int x = 0; /*/////////////////////// * TextBox textBox = new TextBox(); * textBox.ID = "textBox1"; * textBox.Text = iLenght.ToString(); * div1.Controls.Add(textBox); * ////////////////////////*/ while (x < iLenght) { createImageTable(Convert.ToInt32(drawtables[x].TableID.ToString()), drawtables[x].Category); x++; } }
public IHttpActionResult GetLocation() { IList <LocationModel> locationList = null; try { RoomBL room = new RoomBL(); locationList = room.GetLocation(); if (locationList.Count == 0) { return(NotFound()); } } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(locationList)); }
public IHttpActionResult GetRoom() { IList <RoomModel> roomList = null; try { RoomBL room = new RoomBL(); roomList = room.GetRoom(); if (roomList.Count == 0) { return(NotFound()); } } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(roomList)); }
protected void MyCalendar_SelectionChanged(object sender, EventArgs e) { //Updates the calander section whenever a new selection is made lblCalCheck.Text = "You selected date: "; CalHourDropDown.Visible = true; lblHourHelper.Visible = true; foreach (DateTime dt in Cal.SelectedDates) { lblCalCheck.Text += dt.ToLongDateString() + "<br />"; } int ID = Int32.Parse(Request.QueryString["ID"]); RoomModel thisRoom = RoomBL.getRoomByID(TableBL.GetTableByID(ID).RoomID); List <string> hoursList = new List <String>(); double x = thisRoom.OpeningTime.TotalHours; //building opening time while (x < thisRoom.ClosingTime.TotalHours) //will loop until the end of the day's booking aka 2300. Can change to room closing time { if (!TableBL.CheckTableHourAvailability(Int32.Parse(Request.QueryString["ID"]), Convert.ToInt32(x), Cal.SelectedDate)) { hoursList.Add(x.ToString() + ": " + "is free"); } else { hoursList.Add(x.ToString() + ": Occupied"); } x++; } CalHourDropDown.DataSource = hoursList; CalHourDropDown.DataBind(); if (CalHourDropDown.SelectedValue.ToString().Contains("Occupied")) { btnBookCalander.Visible = false; } }
/// <summary> /// Generates relevant booking information, as acquired from the user's booking information supplied /// </summary> /// <param name="bookingID"></param> protected void MainWorker(int bookingID) { //Get booking by the ID provided BookingModel booking = BookingBL.SearchBookingByID(bookingID); UserModel user = new UserModel(); TableModel table = new TableModel(); RoomModel room = new RoomModel(); BuildingModel building = new BuildingModel(); //Get all values by their identifiers (table, users & room) table = TableBL.GetTableByID(booking.tableID); user = UserBL.passUserSearch(booking.emailAddress); room = RoomBL.getRoomByID(table.RoomID); building = BuildingBL.getBuildingByID(room.BuildingID); string name = user.FirstName; string day = booking.bookingDate.ToString("yyyy-MM-d"); string hour = booking.bookingHour.ToString() + ":00"; string bTable = table.TableID.ToString(); string roomName = room.RoomName; string buildingName = building.BuildingName; //Generate a string from acquired data string buildingAddress = building.street + " " + building.suburb + Environment.NewLine + "<br />" + " " + building.provence + " " + building.country; //Update relevant data from user input booking information lblName.Text = name; lblDay.Text = day; lblHour.Text = hour; lblTable.Text = bTable; lblRoom.Text = roomName; lblBuilding.Text = buildingName; lblAddress.Text = buildingAddress; lblbuildingid.Text = building.BuildingID.ToString(); }
protected void Page_Load(object sender, EventArgs e) { int ID = Int32.Parse(Request.QueryString["ID"]); rooms = RoomBL.fillRoomsList(ID); if (!IsPostBack) //need this to stop it reverting to the top value every button click { roomDropdown.DataSource = rooms; roomDropdown.DataValueField = "RoomID"; roomDropdown.DataTextField = "RoomName"; roomDropdown.DataBind(); } if (roomDropdown.Items.Count < 1) { lblAboveDropdown.Text = "No rooms currently available"; roomDropdown.Visible = false; goToRoomingButton.Visible = false; //show room timetables } }
public void ChooseMovieScheduleForYou(int movie_id) { Console.Clear(); MoviesBL movie = new MoviesBL(); ScheduleBL schechule = new ScheduleBL(); RoomBL room = new RoomBL(); // information . Lấy ra phim nhờ id movie Movies informatin = movie.getMovieById(movie_id); // list lấy ra tất cả lịch chiếu của phim. List <DateTime> list = schechule.SelectDatetime(movie_id); TimeSpan datefortimespan = DateTime.Now.TimeOfDay; DateTime comparedatetime = DateTime.Now; string comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}"); // Array này lấy ra ngày để connect tới database format by yyyy-MM-dd. List <string> array = new List <string> (); // Array1 này. Lưu lại thời gian để so sách với thời gian hiện tại. List <string> array1 = new List <string> (); int dem = 0; string[] arr1 = new string[] { "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy", "Chủ nhật" }; string[] arr2 = new string[] { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" }; Console.WriteLine("============================================================================================"); Console.WriteLine($"----------------- Chọn Ngày Chiếu Của Phim : {informatin.Name} "); Console.WriteLine("============================================================================================"); for (int i = 0; i < list.Count; i++) { string date = list[i].Date.ToString($"{list[i].Date:dd/MM/yyyy}"); if (list[i].Date > DateTime.Now && comparedatetime1.CompareTo(date) < 0 || comparedatetime1.CompareTo(date) == 0) { string date1 = list[i].Date.ToString($"{list[i].Date:yyyy-MM-dd}"); array.Add(date1); array1.Add(date); int count = -1; string week = $"{list[i].Date.DayOfWeek}"; for (int j = 0; j < arr2.Length; j++) { if (arr2[j] == week) { count = j; break; } } string format = string.Format($"{dem+1,2}. {date} {arr1[count],-8} "); dem++; Console.WriteLine($"{format}"); Console.WriteLine(); } } Console.WriteLine("--------------------------------------------------------------------------------------------"); int number; Console.WriteLine("0. Quay lại menu chính."); Console.WriteLine("*: Nhập số thứ tự để chọn ngày chiếu."); Console.WriteLine("--------------------------------------------------------------------------------------------"); Console.Write("#Chọn : "); while (true) { bool isINT = Int32.TryParse(Console.ReadLine(), out number); if (!isINT) { Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại."); Console.Write("#Chọn: "); } else if (number < 0 || number > array.Count) { Console.WriteLine($"Giá trị trong khoảng từ 0 - > { array.Count }"); Console.Write("#Chọn: "); } else { break; } } if (number == 0) { CinemaInterface.Cinema(); } ShowScheduleByMovieIdAndDatetime(movie_id, schechule, array1[number - 1], array[number - 1]); }
public static void ShowScheduleByMovieIdAndDatetime(int movie_id, ScheduleBL schechule, string datetime, string datetimeforDatabase) { Console.Clear(); MoviesBL movie = new MoviesBL(); Movies informatin = movie.getMovieById(movie_id); RoomBL room = new RoomBL(); TimeSpan datefortimespan = DateTime.Now.TimeOfDay; DateTime comparedatetime = DateTime.Now; string comparedatetime1 = comparedatetime.ToString($"{comparedatetime:dd/MM/yyyy}"); // Lấy ra lịch chiếu nhờ STT của Ngày chiếu. Console.WriteLine("====================================================================="); Console.WriteLine($"-Chọn Lịch Chiếu Của Phim : {informatin.Name} Ngày {datetime} -"); Console.WriteLine("---------------------------------------------------------------------"); Console.WriteLine("STT | Lịch Chiếu | Phòng | Số ghế còn lại "); Console.WriteLine("---------------------------------------------------------------------"); List <Schedules> demons = schechule.SelectTime(movie_id, datetimeforDatabase); // Lưu tất cả các TimeSpan để so sánh với DateTime.Now.TimeOfDay List <string> list1 = new List <string> (); // List2 để lấy ra các thời gian show ra màn hình. List <string> list2 = new List <string> (); string tym_one = string.Format("{0:D2}:{1:D2}:{2:D2}", datefortimespan.Hours, datefortimespan.Minutes, datefortimespan.Seconds); int count1 = 0; foreach (var item in demons) { string timeText = string.Format("{0:D2}:{1:D2}:{2:D2}", item.Start_time.Hours, item.Start_time.Minutes, item.Start_time.Seconds); list1.Add(timeText); } for (int j = 0; j < demons.Count; j++) { Rooms ro = room.GetRoomById(demons[j].Room_id); string date1 = demons[j].Show_date.ToString($"{demons[j].Show_date:yyyy-MM-dd}"); string timeTe = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds); // Schedules sche = schechule.SelectTimeBy (demons[j].Movie_id,date1,timeTe); if (comparedatetime1.CompareTo(datetime) == 0) { if (tym_one.CompareTo(list1[j]) < 0) { string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes); string end = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes); count1++; string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds); list2.Add(addtimetolist2); Schedules sche = schechule.SelectTimeBy(demons[j].Movie_id, date1, timeTe); string[] count = sche.Schedule_room_seat.Trim().Split(";"); string[] seated = count[2].Split(","); string[] chaier = ro.Chaire_not_placed.Split(","); int a = 0; if (seated[0] != "") { a = ro.Number_Of_seats - seated.Length; } else { a = ro.Number_Of_seats; } if (chaier[0] != "") { a = a - chaier.Length; } string format = string.Format($"{count1}. | {start,-5} - {end,-5} | {ro.Name,-10} | {a}"); Console.WriteLine(format); } } else { string start = string.Format("{0:D2}:{1:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes); string end = string.Format("{0:D2}:{1:D2}", demons[j].End_time.Hours, demons[j].End_time.Minutes); count1++; Schedules sche = schechule.SelectTimeBy(demons[j].Movie_id, date1, timeTe); string[] count = sche.Schedule_room_seat.Trim().Split(";"); string[] seated = count[2].Split(","); int a = 0; if (seated[0] != "") { a = ro.Number_Of_seats - seated.Length; } else { a = ro.Number_Of_seats; } string[] chaier = ro.Chaire_not_placed.Split(","); if (chaier[0] != "") { a = a - chaier.Length; } string addtimetolist2 = string.Format("{0:D2}:{1:D2}:{2:D2}", demons[j].Start_time.Hours, demons[j].Start_time.Minutes, demons[j].Start_time.Seconds); list2.Add(addtimetolist2); string format = string.Format($"{count1}. | {start,-5} - {end,-5} | {ro.Name,-10} | {a }"); Console.WriteLine(format); } } Console.WriteLine("---------------------------------------------------------------------"); int number1; Console.WriteLine("0. Quay lại menu chính."); Console.WriteLine("*: Nhập số thứ tự để suất chiếu."); Console.WriteLine("---------------------------------------------------------------------"); Console.Write("#Chọn : "); while (true) { bool isINT = Int32.TryParse(Console.ReadLine(), out number1); if (!isINT) { Console.WriteLine("Bạn vừa nhập sai giá trị, vui lòng nhập lại."); Console.Write("#Chọn: "); } else if (number1 < 0 || number1 > list2.Count) { Console.WriteLine($"Giá trị trong khoảng từ 0 - > { list2.Count }"); Console.Write("#Chọn: "); } else { break; } } if (number1 == 0) { CinemaInterface.Cinema(); } Console.Clear(); Schedules sch = schechule.SelectTimeBy(movie_id, datetimeforDatabase, list2[number1 - 1]); ChoiceMapSeats.MenuChoiceSeats(sch); }
public static void MenuChoiceSeats(Schedules scheduleUp) { List <string> choicedSeat = new List <string> (); while (true) { // ------------------------ Map Seats in Database with Schedule. ScheduleBL schechuleBl = new ScheduleBL(); string showdate = scheduleUp.Show_date.ToString($"{scheduleUp.Show_date:yyyy-MM-dd}"); string starttime = string.Format("{0:D2}:{1:D2}:{2:D2}", scheduleUp.Start_time.Hours, scheduleUp.Start_time.Minutes, scheduleUp.Start_time.Seconds); Schedules schedule = schechuleBl.SelectTimeBy(scheduleUp.Movie_id, showdate, starttime); string map = schedule.Schedule_room_seat; Console.Clear(); string[] mapArr = map.Split(";"); string[] rowsArr = mapArr[0].Split(" "); int cols = Int32.Parse(mapArr[1]); List <string> succer = new List <string> (); string[] seated = mapArr[2].Split(","); succer = AddlistByMapSeat(succer, seated); // -------------- Map not RoomBL room = new RoomBL(); Rooms ro = room.GetRoomById(schedule.Room_id); string map_ = ro.Chaire_not_placed; string[] map_chaire_not_placed = map_.Split(","); // ----------------------------------- ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed); Console.WriteLine("\n 0. Quay lại."); Console.WriteLine("\n *: Nhập số số ghế theo định dạng A1, A2, A3 để chọn ghế."); Console.WriteLine("\n _______________________________________________________________________________________________"); string choice; string[] choiced; // Cho khánh hàng nhập các ghế mà khách hàng muốn chọn, Phải nhập đúng định dạng thì mới được break ra khỏi While(true). while (true) { Console.Write("\n •√ Bạn chọn ghế :"); choice = Console.ReadLine().Trim().ToUpper(); if (choice == "0") { BookingTicker tick = new BookingTicker(); tick.MenuBookingTicker(); return; } try { if (choice[choice.Length - 1] == ',') { choice = choice.Remove(choice.Length - 1, 1); } } catch (System.Exception) { } choiced = choice.Split(","); if (CheckInsertIntoChoice(choiced) == true) { break; } else { Console.Clear(); ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed); Console.WriteLine("\n #: Bạn đã nhập sai định dạng ghế VD : A1, A2, A3. Vui lòng nhập lại!! Hoặc chọn 0 để thoát"); } } string test = ""; test = CheckSeatInSchedule(choiced, succer, test, rowsArr, cols, map_chaire_not_placed); if (test != "") { Console.Clear(); Console.WriteLine("\n -------------------------------------------------------------------------------"); Console.WriteLine(" #: Ghế " + test + " mà bạn chọn không có trong danh sách hoặc đã được đặt rồi. "); Console.WriteLine(" Vui lòng chọn lại ghế hoặc thoát"); Console.WriteLine("\n -------------------------------------------------------------------------------"); ComeBackMenu(scheduleUp, 0); return; } string checkedSeat = ""; // List<string> choicedSeat = new List<string> (); for (int i = 0; i < choiced.Length; i++) { if (succer.FindIndex(x => x == choiced[i]) == -1) { if (choicedSeat.FindIndex(x => x == choiced[i]) == -1) { succer.Add(choiced[i]); choicedSeat.Add(choiced[i]); } else { checkedSeat = checkedSeat + " " + choiced[i]; } } } ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed); ChoiceBookingAndContinue(); if (checkedSeat != "") { Console.WriteLine(" Bạn vừa chọn ghế " + checkedSeat + " này rồi ! "); } Console.Write("\n #Chọn : "); int number; while (true) { bool isINT = Int32.TryParse(Console.ReadLine(), out number); if (!isINT) { Console.Clear(); ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed); ChoiceBookingAndContinue(); Console.WriteLine("\n • Giá trị sai vui lòng nhập lại."); Console.Write("\n #Chọn : "); } else if (number < 0 || number > 2) { Console.Clear(); ShowSeatChoice(rowsArr, cols, seated, choicedSeat, schedule, map_chaire_not_placed); ChoiceBookingAndContinue(); Console.WriteLine("\n • Giá trị sai vui lòng nhập lại 1 hoặc 2. "); Console.Write("\n #Chọn : "); } else { break; } } Console.WriteLine(); switch (number) { case 1: map = AddSeatsForSchedule(choicedSeat, seated, map); InformationMovieBookingTickets(schedule, choicedSeat, map); choicedSeat = null; choicedSeat = new List <string> (); break; case 2: Console.Clear(); break; } } }
public static void InformationTickets(Reservation res, int count) { ScheduleBL sch = new ScheduleBL(); Schedules schedule = sch.GetScheduleByIdSchedule(res.Schedule_id); MoviesBL movie = new MoviesBL(); Movies informatin = movie.getMovieById(schedule.Movie_id); RoomBL room = new RoomBL(); Rooms ro = room.GetRoomById(schedule.Room_id); string timeshow = ShowDay(schedule.Show_date, schedule.Start_time, schedule.End_time); Console.Clear(); Console.WriteLine($" ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-++++"); Console.WriteLine($" | √√ VÉ ĐẶT TRƯỚC √√ |"); Console.WriteLine($" | |"); Console.WriteLine($" | |"); try { Console.WriteLine($" | • Khánh Hàng : {String.Format(UserInterface.LoginCinema.GetCustomer ().Name),-20} • SĐT {String.Format(UserInterface.LoginCinema.GetCustomer ().Phone),-31} |"); } catch (System.Exception) { Console.WriteLine($" | • Khánh Hàng : {String.Format(Login.GetCustomer1 ().Name),-20} • SĐT {String.Format(Login.GetCustomer1 ().Phone),-31} |"); } Console.WriteLine($" | |"); Console.WriteLine($" | • Mẫu số : 01/VE2/003 • Ký Hiệu : MT/17T |"); Console.WriteLine($" | |"); Console.WriteLine($" | • Số vé : {res.Code_ticket,-6} • MST : 0303675393-001 |"); Console.WriteLine($" | |"); Console.WriteLine($" | CÔNG TY TNHH CINEMA MẠNH ĐẠT - CHI NHÁNH HÀ NỘI |"); Console.WriteLine($" | Toà nhà VTC, Số 18 đường Tam Trinh quận Hai Bà Trưng, thành phố Hà Nội |"); Console.WriteLine($" | |"); Console.WriteLine($" | ............................................................................|"); Console.WriteLine($" | |"); if (count == 0) { Console.WriteLine($" | CIMENA THẾ GIỚI {DateTime.Now} BOX1 ONLINE |"); } else { Console.WriteLine($" | CIMENA THẾ GIỚI {res.Create_on} BOX1 ONLINE |"); } Console.WriteLine($" | |"); Console.WriteLine($" | ============================================================================|"); Console.WriteLine($" | |"); Console.WriteLine($" | √ {string.Format ($"{informatin.Name.ToUpper (),-73}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | √ Thời gian chiếu : {string.Format ($"{timeshow,-53}")}|"); Console.WriteLine($" | |"); Console.Write($" | √ Phòng chiếu : {string.Format ($"{ro.Name,-6}")} Ghế "); string[] arraySeat = res.Seats.Trim().Split(" "); int dem = 0; for (int i = 0; i < arraySeat.Length; i++) { dem++; Console.Write($"{arraySeat[i]} : {Tien(PaymentFare(arraySeat[i]).ToString())} VND "); if (dem == 2) { dem = 0; } if ((i + 1) % 2 == 0) { Console.Write(" |\n | "); } } if (dem == 1) { Console.WriteLine(" |"); } else { Console.WriteLine(" |"); } Console.WriteLine($" | |"); Console.WriteLine($" | ============================================================================|"); Console.WriteLine($" | |"); Console.WriteLine($" | √ Giá Tiền VND {Tien(res.Price.ToString()),-15} | "); Console.WriteLine($" | (Đã bao gồm 5% VAT) |"); Console.WriteLine($" ++-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-++-++++"); Console.WriteLine($" ____________________________________________________________________________"); if (count == 0) { Console.WriteLine(); Console.WriteLine($" #: Vui lòng nhớ số điện thoại và số vé để đối chiếu "); Console.WriteLine($" #: Quý khánh vui lòng đến trước suất chiếu 15 phút để lấy vé "); Console.WriteLine($" Quá thời gian lấy vé, chúng tôi sẽ không hoàn lại tiền vé của bạn "); Console.WriteLine($" và vé đặt sẽ tự động bị huỷ. "); Console.WriteLine($" ____________________________________________________________________________"); ComeBackMenu(schedule, 1); } else { return; } }
// Show thông tin vé. public static void InformationMovieBookingTickets(Schedules schedule, List <string> choicedSeat, string map) { Console.Clear(); MoviesBL movie = new MoviesBL(); Movies informatin = movie.getMovieById(schedule.Movie_id); RoomBL room = new RoomBL(); Rooms infor = room.GetRoomById(schedule.Room_id); string start1 = string.Format("{0:D2}:{1:D2}", schedule.Start_time.Hours, schedule.Start_time.Minutes); string end1 = string.Format("{0:D2}:{1:D2}", schedule.End_time.Hours, schedule.End_time.Minutes); string datetime = string.Format($"{schedule.Show_date:dd/MM/yyyy}"); string choiced = ""; Random random = new Random(); int randomNumber = random.Next(0, 100000000); Reservation reser = new Reservation(); reser.Reservation_id = 0; reser.Schedule_id = schedule.Schedule_id; try { reser.Customer_id = UserInterface.LoginCinema.GetCustomer().Customer_id; foreach (var item in choicedSeat) { choiced = choiced + " " + item; } reser.Seats = choiced.Trim(); reser.Code_ticket = randomNumber; reser.Price = PaymentFareSeat(choicedSeat); string a = Tien(PaymentFareSeat(choicedSeat).ToString()) + " VND"; string time = $"{start1} - {end1}"; Console.Clear(); Console.WriteLine($" √√√√√ Rạp chiếu phim thế giới.\n"); Console.WriteLine($" Thông tin vé đặt trước !"); Console.WriteLine($" –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––"); Console.WriteLine($" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); Console.WriteLine($" | |"); Console.WriteLine($" | Tên Phim : {string.Format ($"{informatin.Name,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Phòng Chiếu : {string.Format ($"{infor.Name,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Ngày Chiếu : {string.Format ($"{datetime,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Lịch Chiếu : {string.Format ($"{time,-47}")}|"); Console.WriteLine($" | |"); Console.Write($" | Ghế Ngồi : "); int count = 0; for (int i = 0; i < choicedSeat.Count; i++) { count++; Console.Write($"{choicedSeat[i]} : {Tien(PaymentFare(choicedSeat[i]).ToString())} VND "); if (count == 2) { count = 0; } if ((i + 1) % 2 == 0) { Console.Write(" |\n | "); } } if (count == 1) { Console.WriteLine(" |"); } else { Console.WriteLine(" |"); } // Console.Write ("|\n"); // Console.WriteLine ($" | Ghế Ngồi : {string.Format ($"{choiced,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" |-----------------------------------------------------------------------|"); Console.WriteLine($" | |"); Console.WriteLine($" | Tổng Tiền : {string.Format ($"{a,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); Console.WriteLine($" _______________________________________________________________________"); YNChoice(choicedSeat, schedule, map, reser); } catch (System.Exception) { reser.Customer_id = Login.GetCustomer1().Customer_id; foreach (var item in choicedSeat) { choiced = choiced + " " + item; } reser.Seats = choiced.Trim(); reser.Code_ticket = randomNumber; reser.Price = PaymentFareSeat(choicedSeat); string a = Tien(PaymentFareSeat(choicedSeat).ToString()) + " VND"; string time = $"{start1} - {end1}"; Console.Clear(); Console.WriteLine($" √√√√√ Rạp chiếu phim thế giới.\n"); Console.WriteLine($" Thông tin vé đặt trước !"); Console.WriteLine($" –––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––"); Console.WriteLine($" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); Console.WriteLine($" | |"); Console.WriteLine($" | Tên Phim : {string.Format ($"{informatin.Name,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Phòng Chiếu : {string.Format ($"{infor.Name,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Ngày Chiếu : {string.Format ($"{datetime,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" | Lịch Chiếu : {string.Format ($"{time,-47}")}|"); Console.WriteLine($" | |"); Console.Write($" | Ghế Ngồi : "); int count = 0; for (int i = 0; i < choicedSeat.Count; i++) { count++; Console.Write($"{choicedSeat[i]} : {Tien(PaymentFare(choicedSeat[i]).ToString())} VND "); if (count == 2) { count = 0; } if ((i + 1) % 2 == 0) { Console.Write(" |\n | "); } } if (count == 1) { Console.WriteLine(" |"); } else { Console.WriteLine(" |"); } // Console.Write ("|\n"); // Console.WriteLine ($" | Ghế Ngồi : {string.Format ($"{choiced,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" |-----------------------------------------------------------------------|"); Console.WriteLine($" | |"); Console.WriteLine($" | Tổng Tiền : {string.Format ($"{a,-47}")}|"); Console.WriteLine($" | |"); Console.WriteLine($" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+"); Console.WriteLine($" _______________________________________________________________________"); YNChoice(choicedSeat, schedule, map, reser); throw; } }
public RoomController(RoomBL roomBL, IMapper mapper) { this.roomBL = roomBL; this._mapper = mapper; }