Ejemplo n.º 1
0
        //---------- FORM CONSTRUCTOR ----------//
        public Form_Detail_Room(int idRoom, bool Editable)
        {
            //--- Initialize ---//
            InitializeComponent();
            this.idRoom             = idRoom;
            _detailRoomManageFacade = new DetailRoomManageFacade();

            //--- Load Data ---//
            comboboxRoomType();
            if (Editable)
            {
                comboboxStatus();
            }
            else
            {
                grbx_FromToStatus.Enabled = false;
                grbx_RoomInfo.Enabled     = false;
                btn_OK.Enabled            = false;
                btn_Reset.Enabled         = false;
            }
            if (idRoom != 0)
            {
                LoadData();
            }
            else
            {
                roomDetailVM = new RoomDetailVM();
            }
            listdel = new List <int>();
        }
Ejemplo n.º 2
0
        public void AddRoom(RoomDetailVM roomDetailVM)
        {
            var test = _roomDALManageFacade.FindRoom(1, 1, 0, roomDetailVM.RoomName, 0);

            if (test.Count != 0)
            {
                throw new ArgumentException("Room Name already existed");
            }
            int  idRoom = _roomDALManageFacade.GetRoomNextid();
            Room room   = new Room();

            mapper.Map(roomDetailVM, room);
            room.RoomIdroomtype = roomDetailVM.IdRoomType;
            room.RoomActiveflag = true;
            List <StatusTime> listadd = new List <StatusTime>();

            foreach (StatusTimeVM statusTimeVM in roomDetailVM.ListStatusTime)
            {
                StatusTime statusTime = new StatusTime();
                mapper.Map(statusTimeVM, statusTime);
                statusTime.StatimIdstatus = statusTimeVM.IdStatus;
                statusTime.StatimIdroom   = idRoom;
                listadd.Add(statusTime);
            }
            try
            {
                _roomDALManageFacade.AddRoom(room);
                _roomDALManageFacade.AddStatus(listadd);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 3
0
 private void LoadData()
 {
     roomDetailVM            = _detailRoomManageFacade.FindByID(idRoom);
     tb_RoomName.Text        = roomDetailVM.RoomName;
     tb_RoomDescription.Text = roomDetailVM.RoomDescription;
     addDataGridView();
     for (int i = 0; i < cbb_RoomType.Items.Count; i++)
     {
         CbbItem cbbItem = (CbbItem)cbb_RoomType.Items[i];
         if (cbbItem.text == roomDetailVM.RoTyName)
         {
             cbb_RoomType.SelectedIndex = i;
             break;
         }
     }
 }
Ejemplo n.º 4
0
        public RoomDetailVM FindByID(int idroom)
        {
            Room         room         = _roomDALManageFacade.FindRoomById(idroom);
            RoomDetailVM roomDetailVM = mapper.Map <RoomDetailVM>(room);
            int          id           = room.RoomIdroomtypeNavigation.IdRoomtype;
            string       rotyname     = room.RoomIdroomtypeNavigation.RotyName;

            roomDetailVM.RoTyName   = rotyname;
            roomDetailVM.IdRoomType = id;
            /* roomDetailVM.MapRoomtype.Add(id, rotyname);*/
            roomDetailVM.RotyCurrentprice = room.RoomIdroomtypeNavigation.RotyCurrentprice;
            foreach (StatusTime statusTime in room.StatusTimes)
            {
                StatusTimeVM statusTimeVM = mapper.Map <StatusTimeVM>(statusTime);
                statusTimeVM.IdStatus = statusTime.StatimIdstatusNavigation.IdStatus;
                statusTimeVM.StaName  = statusTime.StatimIdstatusNavigation.StaName;
/*                statusTimeVM.statusVM = mapper.Map<StatusVM>(statusTime.StatimIdstatusNavigation);*/
                roomDetailVM.ListStatusTime.Add(statusTimeVM);
            }
            return(roomDetailVM);
        }
Ejemplo n.º 5
0
        public void EditRoom(RoomDetailVM roomVM, List <int> listdel)
        {
            Room room = new Room();

            mapper.Map(roomVM, room);
            room.RoomIdroomtype = roomVM.IdRoomType;
            room.RoomActiveflag = true;
            List <StatusTime> listadd = new List <StatusTime>();

            foreach (StatusTimeVM statusTimeVM in roomVM.ListStatusTime)
            {
                StatusTime statusTime = new StatusTime();
                mapper.Map(statusTimeVM, statusTime);
                statusTime.StatimIdstatus = statusTimeVM.IdStatus;
                statusTime.StatimIdroom   = room.IdRoom;
                if (statusTime.IdStatim == 0)
                {
                    listadd.Add(statusTime);
                }
            }
            try
            {
                _roomDALManageFacade.UpdateRoom(room);
                if (listdel != null)
                {
                    _roomDALManageFacade.DeleteStatus(listdel);
                }
                if (listadd.Count != 0)
                {
                    _roomDALManageFacade.AddStatus(listadd);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
Ejemplo n.º 6
0
 public void findidRoom()
 {
     RoomDetailVM roomDetailVM = _receiptionistManage.FindRoomById(1);
 }
        private void LoadData(int id, bool Edit)
        {
            if (id == 0)
            {
                //Add new booking
                detailVM                = new BookingDetailVM();
                tb_BookDate.Text        = DateTime.Now.ToString("MM/dd/yyyy");
                tb_DueDate.Text         = (DateTime.Now.AddDays(4)).ToString("MM/dd/yyyy");
                rbtn_NewClient.Checked  = true;
                rbtn_OldClient.Checked  = false;
                tb_ClientSearch.Enabled = true;
                dgv.DataSource          = null;
                tb_Status.Text          = "Processed";
                btn_Checkin.Enabled     = false;
            }
            else
            {
                rbtn_OldClient.Checked  = true;
                tb_ClientSearch.Enabled = false;
                detailVM = _detailBookingManageFacade.GetDetail(IDBook);
                //View or Edit
                rbtn_OldClient.Checked = true;
                idClient            = detailVM.clientVM.IdClient;
                tb_ClientName.Text  = detailVM.clientVM.Name;
                tb_ClientEmail.Text = detailVM.clientVM.Gmail;
                tb_ClientPhone.Text = detailVM.clientVM.Phone;
                dtp_From.Value      = detailVM.CheckinDate;
                dtp_To.Value        = detailVM.CheckoutDate;
                foreach (SubBookingDetailVM item in detailVM.ListSub)
                {
                    subBookings.Add(item);
                }
                LoadBookedRoomList();
                tb_BookDate.Text        = detailVM.BookDate.ToString("MM/dd/yyyy");
                tb_DueDate.Text         = detailVM.DueDate.ToString("MM/dd/yyyy");
                tb_Deposit.Text         = detailVM.Deposit.ToString();
                tb_Total.Text           = detailVM.TotalPrice.ToString();
                tb_Status.Text          = detailVM.Status;
                tb_Note.Text            = detailVM.BookNote;
                grbx_ClientInfo.Enabled = false;
                if (!Edit)
                {
                    grbx_PeriodTime.Enabled  = false;
                    grbx_BookingInfo.Enabled = false;
                    picbx_Enter.Enabled      = false;
                    picbx_Add.Enabled        = false;
                    picbx_Delete.Enabled     = false;
                    btn_OK.Enabled           = false;
                    btn_Checkin.Enabled      = false;
                }
                else
                {
                    foreach (SubBookingDetailVM item in subBookings)
                    {
                        RoomDetailVM temproom = _detailBookingManageFacade.FindRoomByID(item.BoodetIdroom);

                        /* BookedRoomVMs.Add(new RoomVM
                         * {
                         *   IdRoom = temproom.IdRoom,
                         *   Name = temproom.Name,
                         *   Description = temproom.Description,
                         *   Price = temproom.Price,
                         *   RoomType = temproom.RoomType
                         * });*/
                    }
                }
            }
            tb_Total.Enabled   = false;
            tb_Deposit.Enabled = false;
        }
Ejemplo n.º 8
0
 public void AddRoom(RoomDetailVM roomDetailVM)
 {
     _roomBLLProvider.AddRoom(roomDetailVM);
 }
Ejemplo n.º 9
0
 public void  EditRoom(RoomDetailVM roomDetailVM, List <int> listdel)
 {
     _roomBLLProvider.EditRoom(roomDetailVM, listdel);
 }