コード例 #1
0
        /// <summary>
        /// Gets the neighborhood.
        /// </summary>
        /// <param name="municipalityID">The municipality identifier.</param>
        /// <returns></returns>
        public OutDepartments GetNeighborhood(int municipalityID)
        {
            OutDepartments data = new OutDepartments();

            try
            {
                ParametersDAO dao = new ParametersDAO();
                data = dao.GetNeighborhood(municipalityID);
            }
            catch (Exception ex)
            {
                //escribir en el log
                LogHelper.WriteLog("Models", "ManagerParameters", "GetNeighborhood", ex, "");
            }
            return(data);
        }
コード例 #2
0
        /// <summary>
        /// Gets the cities.
        /// </summary>
        /// <param name="departmentID">The department identifier.</param>
        /// <returns></returns>
        public OutDepartments GetCities(int departmentID)
        {
            OutDepartments data = new OutDepartments();

            try
            {
                ParametersDAO dao = new ParametersDAO();
                data = dao.GetCities(departmentID);
            }
            catch (Exception ex)
            {
                //escribir en el log
                LogHelper.WriteLog("Models", "ManagerParameters", "GetCities", ex, "");
            }
            return(data);
        }
コード例 #3
0
        /// <summary>
        /// Gets the neighborhood.
        /// </summary>
        /// <param name="municipalityID">The municipality identifier.</param>
        /// <returns></returns>
        /// <exception cref="Exception">ParametersDAO.GetNeighborhood</exception>

        public OutDepartments GetNeighborhood(int municipalityID)
        {
            string         connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutDepartments response         = new OutDepartments();
            var            ora = new OracleServer(connectionString);

            Departments        department;
            List <Departments> list    = new List <Departments>();
            string             command = string.Empty;

            try
            {
                command = " select cod_ctro_pobla, nom_ctro_pobla, cod_munic from dfpctropoblado ";
                command = command + string.Format("  where cod_munic = {0} ", municipalityID);
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    department = new Departments();
                    department.populationID   = DBNull.Value.Equals(rdr["cod_ctro_pobla"]) ? 0 : int.Parse(rdr["cod_ctro_pobla"].ToString());
                    department.populationName = DBNull.Value.Equals(rdr["nom_ctro_pobla"]) ? string.Empty : rdr["nom_ctro_pobla"].ToString();
                    department.municipalityID = DBNull.Value.Equals(rdr["cod_munic"]) ? 0 : int.Parse(rdr["cod_munic"].ToString());
                    list.Add(department);
                }
                rdr.Close();
                response.lstDepartments   = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetNeighborhood", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }
コード例 #4
0
        /// <summary>
        /// Gets the cities.
        /// </summary>
        /// <param name="departmentID">The department identifier.</param>
        /// <returns></returns>
        /// <exception cref="Exception">ParametersDAO.GetCities</exception>

        public OutDepartments GetCities(int departmentID)
        {
            string         connectionString = DataBaseHelper.GetConnectionString("DLG");
            OutDepartments response         = new OutDepartments();
            var            ora = new OracleServer(connectionString);

            Departments        department;
            List <Departments> list    = new List <Departments>();
            string             command = string.Empty;

            try
            {
                command = "select distinct A.cod_munic, A.nom_munic, A.cod_depto from dfpctropoblado A where CONSECUTIVO > 0 ";
                command = command + string.Format("  and A.cod_depto = {0} ", departmentID);
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    department = new Departments();
                    department.municipalityID   = DBNull.Value.Equals(rdr["cod_munic"]) ? 0 : int.Parse(rdr["cod_munic"].ToString());
                    department.municipalityName = DBNull.Value.Equals(rdr["nom_munic"]) ? string.Empty : rdr["nom_munic"].ToString();
                    department.departmentID     = DBNull.Value.Equals(rdr["cod_depto"]) ? 0 : int.Parse(rdr["cod_depto"].ToString());
                    list.Add(department);
                }
                rdr.Close();
                response.lstDepartments   = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetCities", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }
コード例 #5
0
        /// <summary>
        /// Gets the departments.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception">ParametersDAO.GetDepartments</exception>

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

            Departments        department;
            List <Departments> list    = new List <Departments>();
            string             command = string.Empty;

            try
            {
                command = "SELECT distinct nom_depto as nombre_producto, cod_depto as codigo_producto FROM dfpctropoblado ORDER BY 1 ASC ";
                var rdr = ora.ExecuteCommand(command);

                while (rdr.Read())
                {
                    department = new Departments();
                    department.departmentID   = DBNull.Value.Equals(rdr["codigo_producto"]) ? 0 : int.Parse(rdr["codigo_producto"].ToString());
                    department.departmentName = DBNull.Value.Equals(rdr["nombre_producto"]) ? string.Empty : rdr["nombre_producto"].ToString();
                    list.Add(department);
                }
                rdr.Close();
                response.lstDepartments   = list;
                response.msg              = new Response();
                response.msg.errorCode    = "200";
                response.msg.errorMessage = "OK";
            }
            catch (Exception ex)
            {
                throw new Exception("ParametersDAO.GetDepartments", ex);
            }
            finally
            {
                ora.Dispose();
            }
            return(response);
        }