Exemple #1
0
        /// <summary>
        /// Gets the type of the housing.
        /// </summary>
        /// <returns></returns>
        public OutHousingType GetHousingType()
        {
            OutHousingType data = new OutHousingType();

            try
            {
                ParametersDAO dao = new ParametersDAO();
                data = dao.GetHousingType();
            }
            catch (Exception ex)
            {
                //escribir en el log
                LogHelper.WriteLog("Models", "ManagerParameters", "GetHousingType", ex, "");
            }
            return(data);
        }
Exemple #2
0
        /// <summary>
        /// Gets the type of the housing.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception">ParametersDAO.GetHousingType</exception>

        public OutHousingType GetHousingType()
        {
            string         connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutHousingType response         = new OutHousingType();
            var            ora = new OracleServer(connectionString);

            HousingType        housing;
            List <HousingType> list    = new List <HousingType>();
            string             command = string.Empty;

            try
            {
                command = " SELECT tipos_vivienda.codigo, tipos_vivienda.descripcion FROM tipos_vivienda ";
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    housing             = new HousingType();
                    housing.housingID   = DBNull.Value.Equals(rdr["codigo"]) ? 0 : int.Parse(rdr["codigo"].ToString());
                    housing.housingName = DBNull.Value.Equals(rdr["descripcion"]) ? string.Empty : rdr["descripcion"].ToString();
                    list.Add(housing);
                }
                rdr.Close();
                response.lstHousingType   = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetHousingType", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }