public HotelController() { fileUplloadedDAL = new FileUploadedDAL(DbProvider); hotelDAL = new HotelDAL(DbProvider); roomDAL = new RoomDAL(DbProvider); userDAL = new UserDAL(DbProvider); }
public bool UpdateRoomInfoLBL(Room aRoom) { RoomDAL aRoomDAL = new RoomDAL(); bool result = aRoomDAL.UpdateRoomInfoDAL(aRoom); return(result); }
public DataTable ExistingRoomsBLL() { RoomDAL aRoomDAL = new RoomDAL(); DataTable Dtable = aRoomDAL.ExistingRoomsDAL(); return(Dtable); }
public DataTable PredictRoomIDBLL() { RoomDAL aRoomDAL = new RoomDAL(); DataTable dTable = aRoomDAL.PredictRoomIDDAL(); return(dTable); }
public List <Room> GetAvailableRoomsByPeriod(String period, string available) { List <Room> roomList = new List <Room>(); roomList = RoomDAL.GetAvailableRoomsByPeriod(period, available); return(roomList); }
public List <Room> FindAllRooms() { List <Room> roomList = new List <Room>(); roomList = RoomDAL.FindAllRooms(); return(roomList); }
public bool GetByName() { bool res = false; res = RoomDAL.GetByName(this); return(res); }
public bool Delete() { bool res = false; res = RoomDAL.Delete(this); return(res); }
public List <Room> GetAvailableRooms() { List <Room> roomList = new List <Room>(); roomList = RoomDAL.GetAvailableRooms(); return(roomList); }
public static List <RoomModel> fillRoomsList(int id) { List <RoomModel> rooms = new List <RoomModel>(); rooms = RoomDAL.loadRoomList(id); return(rooms); }
/// <summary> /// searches for a room by its roomID via RoomDAL.loadRoomByID(roomId); /// returns a Room Model /// </summary> public static RoomModel getRoomByID(int roomId) { RoomModel room = new RoomModel(); room = RoomDAL.loadRoomByID(roomId); return(room); }
public static void CreateTables() { ClassDAL.CreateTable(); ClientDAL.CreateTable(); CoachDAL.CreateTable(); RegistrationDAL.CreateTable(); RoomDAL.CreateTable(); }
// load slot available from room public void loadSlot(string roomName) { toSlotCombobox.DataSource = null; DataTable allSlotAvailableFromRoom = new RoomDAL().getAvailableSlotByRoomName(roomName); toSlotCombobox.DataSource = allSlotAvailableFromRoom; toSlotCombobox.DisplayMember = "slotNumber"; toSlotCombobox.ValueMember = "slotNumber"; }
public bool Create() { bool res = false; if (!RoomDAL.GetByName(this)) { res = RoomDAL.Create(this); } return(res); }
public void loadData() { StudentDAL studentDAL = new StudentDAL(); RoomDAL roomDAL = new RoomDAL(); Slot slot = roomDAL.getSlotByStudentID(theStudent.studentID); nameField.Text = theStudent.name; idField.Text = theStudent.studentID; slotField.Text = slot.slotNumber.ToString(); roomField.Text = slot.roomID; }
private static RoomDAL fromReaderToRoom(NpgsqlDataReader reader) { var room = new RoomDAL { number = Convert.ToInt32(reader["room_num"]), block = Convert.ToInt32(reader["room_block"]), stage = Convert.ToInt32(reader["room_stage"]), capacity = Convert.ToInt32(reader["room_capacity"]), state = clearFromSpaces(Convert.ToString(reader["room_state"])), amountOfStudents = Convert.ToInt32(reader["count"]) }; return(room); }
private void showAllButton_Click(object sender, EventArgs e) { DataTable allAvailableRoom = new RoomDAL().getAllAvailableSlot(); if (allAvailableRoom.Rows.Count > 0) { messageLabel.Text = ""; searchResultDGV.DataSource = allAvailableRoom; } else { searchResultDGV.DataSource = null; messageLabel.Text = "No room available"; } }
public void updateState(RoomBLL updatedRoom) { RoomDAL roomDAL = new RoomDAL { number = updatedRoom.number, stage = updatedRoom.stage, state = updatedRoom.state, block = updatedRoom.block, capacity = updatedRoom.capacity, amountOfStudents = updatedRoom.amountOfStudents }; PGRoomRepository repository = repositoryFactory.getRoomRepository(); repository.updateState(roomDAL); }
public GameDBModel CreateFromGameModel(Game game) { RoomDAL _roomDAL = new RoomDAL(); GameDBModel tempModel = new GameDBModel(); tempModel.Id = game.Id; tempModel.Name = game.Name; tempModel.Time = game.Time; tempModel.Password = game.Password; tempModel.RoomName = _roomDAL.Get(Convert.ToInt32(game.Room)).Name; tempModel.Description = game.Description; return(tempModel); }
private void SearchRoom_Load(object sender, EventArgs e) { messageLabel.Text = ""; // load data for dom combobox DataTable domList = new RoomDAL().getListOfDom(); domComboBox.DataSource = domList; domComboBox.DisplayMember = "dom"; domComboBox.ValueMember = "dom"; // load data for capacity combobox DataTable capacityList = new RoomDAL().getCapacityList(); capacityComboBox.DataSource = capacityList; capacityComboBox.DisplayMember = "numberOfSlot"; capacityComboBox.ValueMember = "numberOfSlot"; }
private void sendButton_Click(object sender, EventArgs e) { string toRoom = toRoomCombobox.SelectedValue.ToString(); string toSlot = toSlotCombobox.SelectedValue.ToString(); if (toRoom == "" || toSlot == "") { MessageBox.Show("Destination of Room and Slot required!", "Inform", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (!isNumberic(toSlot)) { MessageBox.Show("Slot have to be an integer!", "Inform", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else if (!(new RoomDAL().isRoomExisted(toRoom))) { MessageBox.Show("This room is not existed", "Inform", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { DataTable availableRoom = new RoomDAL().getAvailableRoomByInput(toRoom); if (!(availableRoom.Rows.Count > 0)) { message.Text = "Room " + toRoom + " is full"; return; } else { // insert bool successInsert = new RequestDAL().addChangeRoomRequest(theStudent.studentID, slotField.Text, roomField.Text, contentField.Text, toSlot, toRoom, "1"); if (successInsert) { MessageBox.Show("Request has sent!", "Inform", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show("Send fail", "Inform", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } } }
public void loadData() { StudentDAL studentDAL = new StudentDAL(); RoomDAL roomDAL = new RoomDAL(); Slot slot = roomDAL.getSlotByStudentID(theStudent.studentID); nameField.Text = theStudent.name; idField.Text = theStudent.studentID; slotField.Text = slot.slotNumber.ToString(); roomField.Text = slot.roomID; DataTable allAvailableRoomTable = roomDAL.getAllRoomWhichHaveAvailableSlot(); toRoomCombobox.DataSource = allAvailableRoomTable; toRoomCombobox.DisplayMember = "roomID"; toRoomCombobox.ValueMember = "roomID"; loadSlot(toRoomCombobox.SelectedValue.ToString()); }
public bool DeleteRoomsDAL(Room aRoom) { if (aRoom.Id == 0) { return(false); } else { RoomDAL aRoomDAL = new RoomDAL(); bool result = aRoomDAL.DeleteRoomsDAL(aRoom); if (result) { return(result); } else { return(false); } } }
private void searchButton_Click(object sender, EventArgs e) { string dom = (string)domComboBox.SelectedValue; int capacity = (int)capacityComboBox.SelectedValue; DataTable availableRoom = new RoomDAL().getAvailableRoomByProperty(dom, capacity); if (availableRoom.Rows.Count > 0) { // having available room searchResultDGV.DataSource = availableRoom; messageLabel.Text = ""; } else { searchResultDGV.DataSource = null; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "No results found"; } }
public bool SaveRoomsBLL(Room aRoom) { if (aRoom.Floor == "" || aRoom.Type == "" || aRoom.Class == "" || aRoom.Rent == 0) { return(false); } else { RoomDAL aRoomDAL = new RoomDAL(); bool result = aRoomDAL.SaveRoomsDAL(aRoom); if (result) { return(result); } else { return(false); } } }
// load data to gidview public void loadResult() { string input = inputText.Text.ToUpper(); if (input == "") { messageLabel.Text = "Enter the room's name!"; return; } else { bool isRoomExisted = new RoomDAL().isRoomExisted(input); if (isRoomExisted) { DataTable availableRoom = new RoomDAL().getAvailableRoomByInput(input); if (availableRoom.Rows.Count > 0) { // having available slot searchResultDGV.DataSource = availableRoom; messageLabel.Text = ""; } else { // this room is full searchResultDGV.DataSource = availableRoom; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "Room " + input + " is full now"; return; } } else { // send out message searchResultDGV.DataSource = null; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "Room not Found"; return; } } }
private void searchByNameButton_Click(object sender, EventArgs e) { string input = inputText.Text.ToUpper(); if (input == "") { messageLabel.Text = "Enter the room's name!"; return; } else { bool isRoomExisted = new RoomDAL().isRoomExisted(input); if (isRoomExisted) { DataTable availableRoom = new RoomDAL().getAvailableRoomByInput(input); if (availableRoom.Rows.Count > 0) { // having available slot searchResultDGV.DataSource = availableRoom; messageLabel.Text = ""; } else { // this room is full searchResultDGV.DataSource = availableRoom; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "Room " + input + " is full now"; return; } } else { // send out message searchResultDGV.DataSource = null; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "This room is not existed"; return; } } }
public void loadResultByProperty(string selectedDom, int capacity) { string dom = selectedDom; //domComboBox.SelectedValue.ToString(); //int capacity = selectedSlot; //int.Parse(capacityComboBox.SelectedValue.ToString()); DataTable availableRoom = new RoomDAL().getAvailableRoomByProperty(dom, capacity); if (availableRoom.Rows.Count > 0) { // having available room searchResultDGV.DataSource = null; searchResultDGV.DataSource = availableRoom; messageLabel.Text = ""; } else { searchResultDGV.DataSource = null; messageLabel.ForeColor = Color.Yellow; messageLabel.Text = "No results found"; } }
public void updateState(RoomDAL updatedRoom) { string query = "UPDATE room " + "SET room_state=@state " + "WHERE room_num=@num"; using (NpgsqlConnection conn = new NpgsqlConnection(connectionString)) { conn.Open(); NpgsqlCommand cmd = new NpgsqlCommand(query, conn); cmd.Parameters.AddWithValue("@state", updatedRoom.state); cmd.Parameters.AddWithValue("@num", updatedRoom.number); try { cmd.ExecuteNonQuery(); MessageBox.Show("Запись успешно обновлена!", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Ошибка обновления записи в БД! Сообщение:" + ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public RoomBLL() { _roomDAL = new RoomDAL(); }