Exemplo n.º 1
0
        public ServiceResultModel <RoomTypeVM> UpdateRoomType(RoomTypeVM model)
        {
            using (EFBookingContext context = new EFBookingContext())
            {
                var currentItem = context.RoomTypes.FirstOrDefault(p => p.Id == model.Id);
                if (currentItem != null)
                {
                    // mevcut kayıt haricinde title ile aynı kayıt olamaz kontrol ediyoruz
                    if (context.RoomTypes.Any(p => p.Id != model.Id && p.Title.Equals(model.Title)))
                    {
                        return(new ServiceResultModel <RoomTypeVM>
                        {
                            Code = ServiceResultCode.Duplicate,
                            Data = currentItem.MapToViewModel <RoomTypeVM>(),
                            ResultType = OperationResultType.Warn,
                            Message = "This title using other records "
                        });
                    }
                    currentItem.Title       = model.Title;
                    currentItem.Description = model.Description;

                    context.Entry <RoomType>(currentItem).State = System.Data.Entity.EntityState.Modified;
                    context.SaveChanges();
                }

                return(ServiceResultModel <RoomTypeVM> .OK(currentItem.MapToViewModel <RoomTypeVM>()));
            }
        }
Exemplo n.º 2
0
        public string UpdateRoomType(RoomTypeVM roomType)
        {
            string roomTypeId = string.Empty;

            SqlParameter[] parameters =
            {
                new SqlParameter {
                    ParameterName = "@Id", Value = roomType.Id
                },
                new SqlParameter {
                    ParameterName = "@RoomTypeCode", Value = roomType.RoomTypeCode
                },
                new SqlParameter {
                    ParameterName = "@Description", Value = roomType.Description
                },
                new SqlParameter {
                    ParameterName = "@RoomCapacity", Value = roomType.RoomCapacity
                },
                new SqlParameter {
                    ParameterName = "@IsActive", Value = roomType.IsActive
                },
                new SqlParameter {
                    ParameterName = "@UpdatedBy", Value = roomType.UpdatedBy
                }
            };

            roomTypeId = Convert.ToString(DALHelper.ExecuteScalar("UpdateRoomType", parameters));

            return(roomTypeId);
        }
Exemplo n.º 3
0
        public void EditRoomType(RoomTypeVM roomTypeVM, List <int> listdel)
        {
            RoomType roomType = new RoomType();

            mapper.Map(roomTypeVM, roomType);
            List <ImgStorage> listadd = new List <ImgStorage>();

            foreach (ImageVM imageVM in roomTypeVM.ListImg)
            {
                ImgStorage imgStorage = new ImgStorage();
                mapper.Map(imageVM, imgStorage);
                imgStorage.ImgstoIdrootyp = roomType.IdRoomtype;
                if (imageVM.IdImgsto == 0)
                {
                    listadd.Add(imgStorage);
                }
            }

            try
            {
                if (listdel != null)
                {
                    _roomTypeDALManageFacade.DeleteImage(listdel);
                }
                _roomTypeDALManageFacade.UpdateRoomtype(roomType);
                _roomTypeDALManageFacade.AddImage(listadd);
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 4
0
        public JsonResult UpdateRoomType(RoomTypeVM model)
        {
            if (model.Id <= 0)
            {
                RedirectToAction(nameof(RoomTypeList)); // ErrorHandle eklenecek
            }

            if (!ModelState.IsValid)
            {
                return(base.JSonModelStateHandle());
            }

            ServiceResultModel <RoomTypeVM> serviceResult = _roomTypeService.UpdateRoomType(model);

            if (!serviceResult.IsSuccess)
            {
                base.UIResponse = new UIResponse
                {
                    Message    = string.Format("Operation Is Not Completed, {0}", serviceResult.Message),
                    ResultType = serviceResult.ResultType,
                    Data       = serviceResult.Data
                };
            }
            else
            {
                base.UIResponse = new UIResponse
                {
                    Data       = serviceResult.Data,
                    ResultType = serviceResult.ResultType,
                    Message    = "Success"
                };
            }

            return(Json(base.UIResponse, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public void AddRoomType(RoomTypeVM roomTypeVM)
        {
            int               idRoomType = _roomTypeDALManageFacade.GetnextidRoomType();
            RoomType          roomType   = new RoomType();
            List <ImgStorage> imgstolist = new List <ImgStorage>();

            mapper.Map(roomTypeVM, roomType);
            roomType.RoTyActiveflag = true;
            foreach (ImageVM imageVM in roomTypeVM.ListImg)
            {
                ImgStorage imgStorage = new ImgStorage();
                mapper.Map(imageVM, imgStorage);
                imgStorage.ImgstoIdrootyp = idRoomType;
                imgstolist.Add(imgStorage);
            }
            roomType.ImgStorages = imgstolist;
            try
            {
                _roomTypeDALManageFacade.AddRoomtype(roomType);
                _roomTypeDALManageFacade.AddImage(imgstolist);
            }
            catch (Exception e)
            {
            }
        }
Exemplo n.º 6
0
        public JsonResult SaveRoomType(RoomTypeVM model)
        {
            if (!ModelState.IsValid)
            {
                return(base.JSonModelStateHandle());
            }

            ServiceResultModel <RoomTypeVM> serviceResult = _roomTypeService.SaveRoomType(model);

            if (!serviceResult.IsSuccess)
            {
                base.UIResponse = new UIResponse
                {
                    Message    = string.Format("Operation Is Not Completed, {0}", serviceResult.Message),
                    ResultType = serviceResult.ResultType,
                    Data       = serviceResult.Data
                };
            }
            else
            {
                base.UIResponse = new UIResponse
                {
                    Data       = serviceResult.Data,
                    ResultType = serviceResult.ResultType,
                    Message    = "Success"
                };
            }

            return(Json(base.UIResponse, JsonRequestBehavior.AllowGet));
        }
        public void editRoomType(RoomTypeVM roomTypeVM)
        {
            RoomType roomType = new RoomType();

            _iMapper.Map(roomTypeVM, roomType);
            List <int> img_del = new List <int>();

            foreach (KeyValuePair <int, string> kvp in roomTypeVM.MapImgUrl)
            {
                if (kvp.Value == "")
                {
                    img_del.Add(kvp.Key);
                }
                else
                {
                    ImgStorage imgStorage = new ImgStorage();
                    if (kvp.Key > 0)
                    {
                        imgStorage.IdImgsto = kvp.Key;
                    }

                    imgStorage.ImgstoIdrootyp = roomTypeVM.IdRoomtype;
                    imgStorage.ImgstoUrl      = kvp.Value;
                    roomType.ImgStorages.Add(imgStorage);
                }
            }
            foreach (int val in img_del)
            {
                _iImgStorageDAL.delete(val);
            }
            _iRoomTypeDAL.updateRoomtype(roomType);
        }
Exemplo n.º 8
0
        public List <RoomTypeVM> FindByProperty(string search, string orderBy, string status)
        {
            List <RoomTypeVM> listVM = new List <RoomTypeVM>();

            foreach (RoomType roomType in _roomTypeDALManageFacade.FindRoomtype(search, orderBy, status))
            {
                RoomTypeVM roomTypeVM = mapper.Map <RoomTypeVM>(roomType);
                listVM.Add(roomTypeVM);
            }
            return(listVM);
        }
Exemplo n.º 9
0
        public void editRoomType()
        {
            RoomTypeVM roomTypeVM = _iRoomTypeBBL.findbyid(1);
            string     json       = JsonConvert.SerializeObject(roomTypeVM, Formatting.Indented);

            Console.WriteLine(json);
            // roomTypeVM.MapImgUrl[1] = "hello";
            //  roomTypeVM.MapImgUrl.Add(8,"justtest");
            // roomTypeVM.MapImgUrl[7] ="";
            roomTypeVM.MapImgUrl[8] = "sasda";
            _iRoomTypeBBL.editRoomType(roomTypeVM);
        }
        public RoomTypeVM findbyid(int id)
        {
            RoomType   roomType   = _iRoomTypeDAL.findbyid(id);
            RoomTypeVM roomTypeVM = _iMapper.Map <RoomTypeVM>(roomType);

            foreach (ImgStorage img in roomType.ImgStorages)
            {
                // roomTypeVM.ListImgURL.Add(img.ImgstoUrl);
                roomTypeVM.MapImgUrl.Add(img.IdImgsto, img.ImgstoUrl);
            }
            return(roomTypeVM);
        }
Exemplo n.º 11
0
        public RoomTypeVM Findbyid(int id)
        {
            RoomType   roomType   = _roomTypeDALManageFacade.FindRoomtypeById(id);
            RoomTypeVM roomTypeVM = mapper.Map <RoomTypeVM>(roomType);

            foreach (ImgStorage img in roomType.ImgStorages)
            {
                ImageVM imageVM = mapper.Map <ImageVM>(img);
                roomTypeVM.ListImg.Add(imageVM);
            }
            return(roomTypeVM);
        }
        public ActionResult Edit(RoomTypeVM model)
        {
            try
            {
                string roomTypeId = string.Empty;

                model.UpdatedBy = LogInManager.LoggedInUserId;

                #region Check Room Type Code Available.

                if (this.CheckRoomTypeCodeAvailable(model.Id, model.RoomTypeCode) == false)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = string.Format("Room Type Code : {0} already exist.", model.RoomTypeCode)
                    }, JsonRequestBehavior.AllowGet));
                }

                #endregion

                roomTypeId = roomTypeRepository.UpdateRoomType(model);

                if (!string.IsNullOrWhiteSpace(roomTypeId))
                {
                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            RoomTypeId = model.Id
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Room Type details not updated successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Edit");
                return(Json(new { IsSuccess = false, errorMessage = e.Message }));
            }
        }
Exemplo n.º 13
0
        public void addRoomType()
        {
            RoomTypeVM roomTypeVM = new RoomTypeVM();

            roomTypeVM.RotyName         = "provipRoom";
            roomTypeVM.RotyCapacity     = 2;
            roomTypeVM.RotyCurrentprice = 100;
            roomTypeVM.RotyDescription  = "qua tot";
            List <string> imglist = new List <string>();

            imglist.Add("/home/cuong/pro");
            imglist.Add("/home/cuong/vip");
            roomTypeVM.ListImgURL = imglist;
            _iRoomTypeBBL.addRoomType(roomTypeVM);
        }
        public ActionResult Edit(Guid id)
        {
            var roomType = roomTypeRepository.GetRoomTypeById(id);

            RoomTypeVM model = new RoomTypeVM();

            if (roomType != null && roomType.Count > 0)
            {
                model = roomType[0];

                return(View(model));
            }

            return(RedirectToAction("List"));
        }
Exemplo n.º 15
0
        public ServiceResultModel <RoomTypeVM> GetRoomType(int id)
        {
            if (id <= 0)
            {
                return(null);
            }
            RoomTypeVM currentItem = null;

            using (EFBookingContext context = new EFBookingContext())
            {
                currentItem = context.RoomTypes.FirstOrDefault(p => p.Id == id).MapProperties <RoomTypeVM>();
            }

            return(ServiceResultModel <RoomTypeVM> .OK(currentItem));
        }
Exemplo n.º 16
0
        public PartialViewResult _RoomTypeAddEdit(int?id)
        {
            RoomTypeVM roomTypeVm = null;

            if (id.HasValue)
            {
                ServiceResultModel <RoomTypeVM> serviceResult = _roomTypeService.GetRoomType(id.Value);
                if (serviceResult.IsSuccess)
                {
                    roomTypeVm = serviceResult.Data;
                }
            }

            roomTypeVm = roomTypeVm ?? new RoomTypeVM();

            return(PartialView("_RoomTypeAddEdit", roomTypeVm));
        }
        public void addRoomType(RoomTypeVM roomTypeVM)
        {
            int               idRoomType = _iRoomTypeDAL.getnextid();
            RoomType          roomType   = new RoomType();
            List <ImgStorage> imgstolist = new List <ImgStorage>();

            _iMapper.Map(roomTypeVM, roomType);
            foreach (string imgurl in roomTypeVM.ListImgURL)
            {
                ImgStorage imgStorage = new ImgStorage();
                imgStorage.ImgstoUrl      = imgurl;
                imgStorage.ImgstoIdrootyp = idRoomType;
                imgstolist.Add(imgStorage);
            }
            roomType.ImgStorages = imgstolist;
            _iRoomTypeDAL.addRoomtype(roomType);
        }
        public List <RoomTypeVM> getAll()
        {
            var               result     = _iRoomTypeDAL.getAll();
            List <string>     imgUrlList = new List <string>();
            List <RoomTypeVM> listVM     = new List <RoomTypeVM>();

            foreach (RoomType roomType in _iRoomTypeDAL.getAll())
            {
                RoomTypeVM roomTypeVM = _iMapper.Map <RoomTypeVM>(roomType);
                foreach (ImgStorage imgStorage in roomType.ImgStorages)
                {
                    imgUrlList.Add(imgStorage.ImgstoUrl);
                }
                roomTypeVM.ListImgURL = imgUrlList;
                listVM.Add(roomTypeVM);
            }
            return(listVM);
        }
Exemplo n.º 19
0
        public ServiceResultModel <RoomTypeVM> SaveRoomType(RoomTypeVM model)
        {
            using (EFBookingContext context = new EFBookingContext())
            {
                bool isAlreadyExists = context.RoomTypes.Any(p => p.Title == model.Title);
                if (isAlreadyExists)
                {
                    return(new ServiceResultModel <RoomTypeVM>
                    {
                        Code = ServiceResultCode.Duplicate,
                        Data = null,
                        ResultType = OperationResultType.Warn,
                        Message = "This record already exists"
                    });
                }

                var recordItem = context.RoomTypes.Add(model.MapToEntityModel <RoomType>());
                context.SaveChanges();

                return(ServiceResultModel <RoomTypeVM> .OK(recordItem.MapToViewModel <RoomTypeVM>()));
            }
        }
        //----- Room Type -----//
        private void AddRoomType()
        {
            RoomTypeVM roomTypeVM = new RoomTypeVM
            {
                Capacity    = 3,
                Price       = 10000,
                Description = "ko co",
                Name        = "Cuongpor",
            };
            ImageVM image1 = new ImageVM
            {
                ImgstoUrl = "home/cuong/yessss"
            };

            roomTypeVM.ListImg.Add(image1);
            ImageVM image2 = new ImageVM
            {
                ImgstoUrl = "home/cuong/nooooo"
            };

            roomTypeVM.ListImg.Add(image2);
            roomTypeBLL.AddRoomType(roomTypeVM);
        }
Exemplo n.º 21
0
 protected override void OnAppearing()
 {
     Vm             = new RoomTypeVM();
     BindingContext = Vm;
 }
        public ActionResult PrintMultipleRegistrationCard()
        {
            if (Session["ReservationIds"] == null || string.IsNullOrWhiteSpace(Convert.ToString(Session["ReservationIds"])))
            {
                return(HttpNotFound());
            }

            var reservationIds = (List <Guid>)Session["ReservationIds"];

            StringBuilder html = new StringBuilder();

            if (reservationIds != null && reservationIds.Count > 0)
            {
                foreach (var reservationId in reservationIds)
                {
                    var reservation = reservationRepository.GetReservationById(reservationId, LogInManager.LoggedInUserId).FirstOrDefault();

                    if (reservation != null)
                    {
                        GuestRegistrationCardVM model = new GuestRegistrationCardVM();

                        #region Room Mapping

                        //Get Room Mapping
                        var selectedRooms = roomRepository.GetReservationRoomMapping(reservationId, null, LogInManager.LoggedInUserId);
                        var roomIds       = string.Empty;
                        var roomNumbers   = string.Empty;

                        if (selectedRooms != null && selectedRooms.Count > 0)
                        {
                            foreach (var room in selectedRooms)
                            {
                                roomIds     += string.Format("{0},", room.RoomId);
                                roomNumbers += string.Format("{0}, ", room.RoomNo);
                            }

                            if (!string.IsNullOrWhiteSpace(roomNumbers))
                            {
                                //Remove Last Comma.
                                roomNumbers = Utility.Utility.RemoveLastCharcter(roomNumbers, ',');
                            }
                        }
                        #endregion


                        #region Profile

                        var profile = new IndividualProfileVM();

                        if (reservation.ProfileId.HasValue)
                        {
                            profile = profileRepository.GetIndividualProfileById(reservation.ProfileId.Value, LogInManager.LoggedInUserId).FirstOrDefault();
                        }

                        #endregion

                        #region Title

                        var title = new TitleVM();
                        if (profile.TitleId.HasValue)
                        {
                            title = titleRepository.GetTitlebyId(profile.TitleId.Value).FirstOrDefault();
                        }

                        #endregion

                        #region Room Type

                        var roomType = new RoomTypeVM();
                        if (reservation.RoomTypeId.HasValue)
                        {
                            roomType = roomTypeRepository.GetRoomTypeById(reservation.RoomTypeId.Value).FirstOrDefault();
                        }

                        #endregion

                        #region Preference Mapping

                        //Get Preference Mapping
                        var selectedPreferences = preferenceRepository.GetReservationPreferenceMapping(reservation.Id, null, LogInManager.LoggedInUserId);

                        var preferences = "";
                        if (selectedPreferences != null && selectedPreferences.Count > 0)
                        {
                            preferences = String.Join(", ", selectedPreferences.Select(m => m.PreferenceDescription));

                            if (!string.IsNullOrWhiteSpace(preferences))
                            {
                                preferences = Utility.Utility.RemoveLastCharcter(preferences.Trim(), ',');
                            }
                        }

                        model.Preferences = preferences;

                        #endregion

                        #region Package Mapping

                        //Get Package Mapping
                        var selectedPackages = reservationRepository.GetReservationPackageMapping(reservation.Id, null, LogInManager.LoggedInUserId).ToList();

                        if (selectedPackages != null)
                        {
                            model.Packages = selectedPackages;
                            //model.PackageName = selectedPackage.PackageName;
                            //model.PackagePrice = CurrencyManager.ParseAmountToUserCurrency(selectedPackage.PackagePrice, LogInManager.CurrencyCode);
                            //model.PackageTotalAmount = CurrencyManager.ParseAmountToUserCurrency(selectedPackage.TotalAmount, LogInManager.CurrencyCode);
                        }

                        #endregion

                        model.Id                = reservation.Id;
                        model.ConfirmationNo    = reservation.ConfirmationNumber;
                        model.ProfileId         = reservation.ProfileId;
                        model.Title             = title.Title;
                        model.Email             = profile.Email;
                        model.PhoneNo           = profile.TelephoneNo;
                        model.Name              = (profile.FirstName + ' ' + profile.LastName);
                        model.CarRegistrationNo = profile.CarRegistrationNo;

                        #region Fetch Address
                        var address = "";
                        if (!string.IsNullOrWhiteSpace(profile.Address))
                        {
                            //address = profile.Address;
                            address = profile.Address.Replace(",", Delimeter.SPACE);
                        }
                        else if (!string.IsNullOrWhiteSpace(profile.HomeAddress))
                        {
                            //address = profile.HomeAddress;
                            address = profile.HomeAddress.Replace(",", Delimeter.SPACE);
                        }

                        model.Address = address;

                        if (!string.IsNullOrWhiteSpace(profile.CityName))
                        {
                            //model.Address += !string.IsNullOrWhiteSpace(model.Address) ? (Delimeter.SPACE + profile.CityName) : profile.CityName;
                            model.City = profile.CityName;
                        }

                        if (!string.IsNullOrWhiteSpace(profile.StateName))
                        {
                            //model.Address += !string.IsNullOrWhiteSpace(model.Address) ? (Delimeter.SPACE + profile.StateName) : profile.StateName;
                            model.State = profile.StateName;
                        }

                        if (profile.CountryId.HasValue)
                        {
                            var country = countryRepository.GetCountryById(profile.CountryId.Value).FirstOrDefault();

                            if (country != null)
                            {
                                model.Country = country.Name;
                            }
                        }

                        //Split Address

                        //if (!string.IsNullOrWhiteSpace(model.Address))
                        //{
                        //    //var splitAddress = ExtensionMethod.SplitString(model.Address, 40);

                        //    var splitAddress = model.Address.SplitStringChunks(60);

                        //    if (splitAddress != null && splitAddress.Length > 0)
                        //    {
                        //        model.Address1 = splitAddress[0];

                        //        if (splitAddress.Length > 1) { model.Address2 = splitAddress[1]; }
                        //        if (splitAddress.Length > 2) { model.Address3 = splitAddress[2]; }
                        //    }
                        //}

                        model.ZipCode = profile.ZipCode;
                        #endregion

                        model.RoomNumer     = roomNumbers;
                        model.ArrivalDate   = reservation.ArrivalDate.HasValue ? reservation.ArrivalDate.Value.ToString("dd-MMM-yyyy") : "";
                        model.DepartureDate = reservation.DepartureDate.HasValue ? reservation.DepartureDate.Value.ToString("dd-MMM-yyyy") : "";
                        model.NoOfNights    = reservation.NoOfNight;
                        model.NoOfAdult     = reservation.NoOfAdult;
                        model.NoOfChildren  = reservation.NoOfChildren;

                        if (roomType != null)
                        {
                            model.RoomType = roomType.RoomTypeCode;
                        }
                        model.Rate           = CurrencyManager.ParseAmountToUserCurrency(reservation.Rate, LogInManager.CurrencyCode);
                        model.ConfirmationNo = reservation.ConfirmationNumber;

                        //HTML to PDF
                        html.Append(Utility.Utility.RenderPartialViewToString((Controller)this, "PreviewRegistrationCard", model));
                    }
                }
            }

            #region Record Activity Log
            RecordActivityLog.RecordActivity(Pages.SEARCH_ARRIVALS, "Generated multiple guest registration card report.");
            #endregion

            //Clear session.
            //Session["ReservationIds"] = null;

            byte[] pdfBytes = Utility.Utility.GetPDF(Convert.ToString(html));

            //return File(pdfBytes, "application/pdf", string.Format("RegistrationCard_{0}.pdf", model.Id));
            return(File(pdfBytes, "application/pdf"));
        }
        public ActionResult Create(RoomTypeVM model)
        {
            try
            {
                string roomTypeId = string.Empty;
                model.CreatedBy = LogInManager.LoggedInUserId;

                #region Check Room Type Code Available.

                if (this.CheckRoomTypeCodeAvailable(model.Id, model.RoomTypeCode) == false)
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = string.Format("Room Type Code : {0} already exist.", model.RoomTypeCode)
                    }, JsonRequestBehavior.AllowGet));
                }

                #endregion

                roomTypeId = roomTypeRepository.AddRoomType(model);

                if (!string.IsNullOrWhiteSpace(roomTypeId))
                {
                    #region Add Rate (Default 100) for each Rate Type.

                    var rateTypes = rateTypeRepository.GetRateType(string.Empty);

                    if (rateTypes != null && rateTypes.Count > 0)
                    {
                        foreach (var rateType in rateTypes)
                        {
                            RoomTypeRateTypeMappingVM roomTypeRateTypeMapping = new RoomTypeRateTypeMappingVM();
                            roomTypeRateTypeMapping.RoomTypeId = Guid.Parse(roomTypeId);
                            roomTypeRateTypeMapping.RateTypeId = rateType.Id;
                            roomTypeRateTypeMapping.Amount     = 100; //Default Price.
                            roomTypeRateTypeMapping.IsActive   = true;
                            roomTypeRateTypeMapping.CreatedBy  = LogInManager.LoggedInUserId;

                            rateRepository.AddRoomTypeRateTypeMapping(roomTypeRateTypeMapping);
                        }
                    }

                    #endregion

                    return(Json(new
                    {
                        IsSuccess = true,
                        data = new
                        {
                            RoomTypeId = model.Id
                        }
                    }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new
                    {
                        IsSuccess = false,
                        errorMessage = "Room Type details not saved successfully."
                    }, JsonRequestBehavior.AllowGet));
                }
            }
            catch (Exception e)
            {
                Utility.Utility.LogError(e, "Create");
                return(Json(new
                {
                    IsSuccess = false,
                    errorMessage = e.Message
                }));
            }
        }
        //---------- FUNCTIONS ----------//
        //----- Load Data -----//
        public void LoadData(int idroomtype, bool Editable)
        {
            if (idroomtype == 0)
            {
                //Add room type
            }
            else
            {
                //View or edit
                roomTypeVM                  = roomTypeBLL.Findbyid(idroomtype);
                tb_RoomTypeName.Text        = roomTypeVM.Name;
                tb_RoomTypeDescription.Text = roomTypeVM.Description;
                tb_RoomTypePrice.Text       = roomTypeVM.Price.ToString();
                tb_RoomTypeCapacity.Text    = roomTypeVM.Capacity.ToString();
                TotalPic = roomTypeVM.ListImg.Count;
                int TotalLoadedPic = TotalPic;
                switch (TotalLoadedPic)
                {
                case 6:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[5].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add6.Image    = Image.FromStream(fs);
                            picbx_Add6.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add6.BackgroundImage = null;
                        picbx_Add6.AccessibleName  = roomTypeVM.ListImg[5].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add6.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    TotalLoadedPic -= 1;
                    if (TotalLoadedPic > 0)
                    {
                        goto case 5;
                    }
                    break;

                case 5:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[4].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add5.Image    = Image.FromStream(fs);
                            picbx_Add5.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add5.BackgroundImage = null;
                        picbx_Add5.AccessibleName  = roomTypeVM.ListImg[4].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add5.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    TotalLoadedPic -= 1;
                    if (TotalPic == 5)
                    {
                        picbx_Add6.BackgroundImage = Properties.Resources.add_fluent_color_96px;
                    }
                    if (TotalLoadedPic > 0)
                    {
                        goto case 4;
                    }
                    break;

                case 4:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[3].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add4.Image    = Image.FromStream(fs);
                            picbx_Add4.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add4.BackgroundImage = null;
                        picbx_Add4.AccessibleName  = roomTypeVM.ListImg[3].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add4.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    TotalLoadedPic -= 1;
                    if (TotalPic == 4)
                    {
                        picbx_Add5.BackgroundImage = Properties.Resources.add_fluent_color_96px;
                    }
                    if (TotalLoadedPic > 0)
                    {
                        goto case 3;
                    }
                    break;

                case 3:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[2].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add3.Image    = Image.FromStream(fs);
                            picbx_Add3.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add3.BackgroundImage = null;
                        picbx_Add3.AccessibleName  = roomTypeVM.ListImg[2].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add3.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    TotalLoadedPic -= 1;
                    if (TotalPic == 3)
                    {
                        picbx_Add4.BackgroundImage = Properties.Resources.add_fluent_color_96px;
                    }
                    if (TotalLoadedPic > 0)
                    {
                        goto case 2;
                    }
                    break;

                case 2:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[1].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add2.Image    = Image.FromStream(fs);
                            picbx_Add2.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add2.BackgroundImage = null;
                        picbx_Add2.AccessibleName  = roomTypeVM.ListImg[1].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add2.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    TotalLoadedPic -= 1;
                    if (TotalPic == 2)
                    {
                        picbx_Add3.BackgroundImage = Properties.Resources.add_fluent_color_96px;
                    }
                    if (TotalLoadedPic > 0)
                    {
                        goto case 1;
                    }
                    break;

                case 1:
                    try
                    {
                        using (FileStream fs = new FileStream(roomTypeVM.ListImg[0].ImgstoUrl, FileMode.Open))
                        {
                            picbx_Add1.Image    = Image.FromStream(fs);
                            picbx_Add1.SizeMode = PictureBoxSizeMode.StretchImage;
                            fs.Close();
                        }
                        picbx_Add1.BackgroundImage = null;
                        picbx_Add1.AccessibleName  = roomTypeVM.ListImg[0].IdImgsto.ToString();
                    }
                    catch (Exception e) { picbx_Add1.BackgroundImage = Properties.Resources.nothing_found_fluent_color_96px; }
                    if (TotalPic == 1)
                    {
                        picbx_Add2.BackgroundImage = Properties.Resources.add_fluent_color_96px;
                    }
                    break;

                default:
                    break;
                }
            }
            if (!Editable)
            {
                grbx_RoomTypeDetail.Enabled = false;
                btn_Del.Enabled             = false;
                btn_OK.Enabled    = false;
                btn_Reset.Enabled = false;
            }
        }