Esempio n. 1
0
        public int update(Comuna_ENT datosComuna)
        {
            try
            {
                using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH))
                {
                    sqlConn.Open();
                    SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "SP_UPDATE_COMUNA_IDCOMUNA";

                    cmd.Parameters.AddWithValue("@id_comuna", datosComuna.IdComuna);
                    cmd.Parameters.AddWithValue("@id_ciudad", datosComuna.IdCiudad);
                    cmd.Parameters.AddWithValue("@nombre", datosComuna.Nombre);
                    cmd.Parameters.AddWithValue("@estado", datosComuna.Estado);
                    SqlDataReader reader = cmd.ExecuteReader();

                    while (reader.Read())
                    {
                        this.error = reader["error"].Equals(1) ? 1 : 0;
                    }
                    return(this.error);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error al ejecutar SP_UPDATE_COMUNA_IDCOMUNA", ex);
            }
        }
Esempio n. 2
0
        public List <Comuna_ENT> listComunaForIdCiudad(string idCiudad)
        {
            try
            {
                using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH))
                {
                    sqlConn.Open();
                    SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "SP_LIST_ALL_COMUNA_IDCIUDAD";

                    cmd.Parameters.AddWithValue("@id_ciudad", idCiudad);

                    List <Comuna_ENT> listComuna = new List <Comuna_ENT>();
                    SqlDataReader     reader     = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        Comuna_ENT oComuna = new Comuna_ENT();

                        oComuna.IdComuna = Convert.ToInt32(reader["id_comuna"]);
                        oComuna.IdCiudad = Convert.ToInt32(reader["id_ciudad"]);
                        oComuna.Nombre   = reader["nombre"].Equals(DBNull.Value) ? "" : Convert.ToString(reader["nombre"]);
                        oComuna.Estado   = reader["estado"].Equals(DBNull.Value) ? false : Convert.ToBoolean(reader["estado"]);

                        listComuna.Add(oComuna);
                    }
                    return(listComuna);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error al ejecutar SP_LIST_ALL_COMUNA_IDCIUDAD", ex);
            }
        }
Esempio n. 3
0
        public Comuna_ENT insert(Comuna_ENT datosComuna)
        {
            try
            {
                using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH))
                {
                    sqlConn.Open();
                    SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn);
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.CommandText = "SP_INSERT_COMUNA";

                    cmd.Parameters.AddWithValue("@id_comuna", datosComuna.IdComuna);
                    cmd.Parameters.AddWithValue("@id_ciudad", datosComuna.IdCiudad);
                    cmd.Parameters.AddWithValue("@nombre", datosComuna.Nombre);
                    cmd.Parameters.AddWithValue("@estado", datosComuna.Estado);

                    Comuna_ENT    oComuna = new Comuna_ENT();
                    SqlDataReader reader  = cmd.ExecuteReader();
                    while (reader.Read())
                    {
                        oComuna.IdComuna = Convert.ToInt32(reader["id_comuna"]);
                        oComuna.IdCiudad = Convert.ToInt32(reader["id_ciudad"]);
                        oComuna.Nombre   = reader["nombre"].Equals(DBNull.Value) ? "" : Convert.ToString(reader["nombre"]);
                        oComuna.Estado   = reader["estado"].Equals(DBNull.Value) ? false : Convert.ToBoolean(reader["sitio"]);
                    }
                    return(oComuna);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Error al ejecutar SP_INSERT_COMUNA", ex);
            }
        }
Esempio n. 4
0
 public Comuna_ENT getForIdComuna(Comuna_ENT datosComuna)
 {
     try
     {
         using (SqlConnection sqlConn = new SqlConnection(this.ConexionPH))
         {
             sqlConn.Open();
             SqlCommand cmd = new SqlCommand(this.ConexionPH, sqlConn);
             cmd.CommandType = System.Data.CommandType.StoredProcedure;
             cmd.CommandText = "SP_GET_COMUNA_IDCOMUNA";
             cmd.Parameters.AddWithValue("@id_comuna", datosComuna.IdComuna);
             SqlDataReader reader  = cmd.ExecuteReader();
             Comuna_ENT    oComuna = new Comuna_ENT();
             if (reader.Read())
             {
                 oComuna.IdComuna = Convert.ToInt32(reader["id_comuna"]);
                 oComuna.IdCiudad = Convert.ToInt32(reader["id_ciudad"]);
                 oComuna.Nombre   = reader["nombre"].Equals(DBNull.Value) ? "" : Convert.ToString(reader["nombre"]);
                 oComuna.Estado   = true;
                 return(oComuna);
             }
             else
             {
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         throw new Exception("Error al ejecutar SP_GET_COMUNA_IDCOMUNA", ex);
     }
 }
        public List <ConjuntoHabitacional_ENT> listConjuntoHabitacional()
        {
            List <ConjuntoHabitacional_ENT> listConjunto    = new ConjuntoHabitacional_DAO().listConjuntoHabitacional();
            List <ConjuntoHabitacional_ENT> newListConjunto = new List <ConjuntoHabitacional_ENT>();

            foreach (ConjuntoHabitacional_ENT dato in listConjunto)
            {
                ConjuntoHabitacional_ENT oConjunto = new ConjuntoHabitacional_ENT();
                Comuna_ENT oComuna = new Comuna_ENT();

                oConjunto.IdConjuntoHabitacional = dato.IdConjuntoHabitacional;
                oConjunto.CodigoConjunto         = dato.CodigoConjunto;
                oConjunto.NombreConjunto         = dato.NombreConjunto;
                oConjunto.Etapa                         = dato.Etapa;
                oConjunto.DireccionConjunto             = dato.DireccionConjunto;
                oConjunto.RutConstructora               = dato.RutConstructora;
                oConjunto.NombreConjunto                = dato.NombreConjunto;
                oConjunto.RutEmpresaVendedora           = dato.RutEmpresaVendedora;
                oConjunto.NombreEmpresaVendedora        = dato.NombreEmpresaVendedora;
                oConjunto.RepresentanteEmpresaVendedora = dato.RepresentanteEmpresaVendedora;
                oComuna.IdComuna                        = dato.IdComunaConjunto;
                oConjunto.NombreComunaConjunto          = new Comuna_BSS().getComunaID(oComuna).Nombre;
                oConjunto.DireccionEmpresaVendedora     = dato.DireccionEmpresaVendedora;
                oConjunto.AreaEmpresaVendedora          = dato.AreaEmpresaVendedora;
                oConjunto.TelefonoEmpresaVendedora      = dato.TelefonoEmpresaVendedora;
                oConjunto.EmailEmpresaVendedora         = dato.EmailEmpresaVendedora;
                oConjunto.FechaContrato                 = dato.FechaContrato;
                oConjunto.FechaTerminoConstruccion      = dato.FechaTerminoConstruccion;
                oConjunto.FechaRecepcionMunicipal       = dato.FechaRecepcionMunicipal;
                oConjunto.FechaRecepcionProhogar        = dato.FechaRecepcionProhogar;

                newListConjunto.Add(oConjunto);
            }


            return(newListConjunto);
        }
Esempio n. 6
0
        public Comuna_ENT getComunaID(Comuna_ENT datosComuna)
        {
            Comuna_ENT oComuna = new Comuna_DAO().getForIdComuna(datosComuna);

            return(oComuna);
        }
Esempio n. 7
0
        public int deleteComuna(Comuna_ENT datosComuna)
        {
            int error = new Comuna_DAO().delete(datosComuna);

            return(error);
        }
Esempio n. 8
0
        public Comuna_ENT insertComuna(Comuna_ENT datosComuna)
        {
            Comuna_ENT oComuna = new Comuna_DAO().insert(datosComuna);

            return(oComuna);
        }