Esempio n. 1
0
 public ApartmentEditor(ApartmentDao dao)
     : base()
 {
     this.dao = dao;
     InitializeComponent();
     InitData();
 }
Esempio n. 2
0
 public ApartmentEditor()
     : base()
 {
     this.dao = new ApartmentDao();
     InitializeComponent();
     InitData();
 }
Esempio n. 3
0
 public OutputUtils()
 {
     this.projectDao   = new ProjectDao();
     this.stageDao     = new StageDao();
     this.buildingDao  = new BuildingDao();
     this.floorplanDao = new FloorplanDao();
     this.apartmentDao = new ApartmentDao();
     this.mediaDao     = new MediaDao();
 }
        public bool Validate(ApartmentDao apt)
        {
            if (val.IntValidate(apt.CurrentCapacity) &&
                val.IntValidate(apt.MaxCapacity) &&
                val.IntValidate(apt.RoomNumber) &&
                val.ForeignKeyValidate(apt.HotelID) &&
                val.ForeignKeyValidate(apt.GenderID) &&
                val.PrimaryKeyValidate(apt.RoomID))
            {
                return(true);
            }


            return(false);
        }
 public bool UpdateApartment(ApartmentDao apt)
 {
     try
     {
         if (aptVal.Validate(apt))
         {
             return(ac.UpdateApartment(emap.MapToData(apt)));
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 6
0
        public IActionResult GetApartmentById([FromServices] ApartmentDao apartmentDao, [FromRoute] Guid id)
        {
            try
            {
                var apartment = apartmentDao.GetApartmentById(id);

                return(IsAValidOperation()
                    ? RequestResponse(HttpStatusCode.OK, result: apartment)
                    : RequestResponse(HttpStatusCode.NotFound, "kipercondominio/api/v1/apartments", isError: true));
            }
            catch (Exception ex)
            {
                var error = JsonConvert.SerializeObject(ex);
                _logger.LogError(error);

                return(RequestResponse(HttpStatusCode.BadRequest, isError: true, result: "Ocorreu um erro ao obter o apartamento"));
            }
        }
 public bool InsertApartment(ApartmentDao newapt)
 {
     try
     {
         if (aptVal.Validate(newapt))
         {
             ac.InsertApartment(emap.MapToData(newapt));
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception)
     {
         return(false);
     }
 }
Esempio n. 8
0
        public Apartment MapToData(ApartmentDao apt)
        {
            var mapper = ApartmentMapper.CreateMapper();

            return(mapper.Map <Apartment>(apt));
        }
Esempio n. 9
0
        /// <summary>
        /// This method maps from a ApartmentDao to a ApartmentDto
        /// </summary>
        /// <param name="apt"></param>
        /// <returns>ApartmentDto</returns>
        public ApartmentDto MapToDto(ApartmentDao apt)
        {
            var mapper = apartmentMapper.CreateMapper();

            return(mapper.Map <ApartmentDto>(apt));
        }