Exemplo n.º 1
0
        public void Add_tipohab_mod(int tipo_id)
        {
            tipohabBO_mod         = tipohabDAO.Buscar(tipo_id);
            btn_guardar_tipo.Text = "Guardar";
            tipohabBO.Tipo_id     = tipo_id;

            txt_tipo_id.Text     = tipohabBO_mod.Tipo_id.ToString();
            txt_nombre_tipo.Text = tipohabBO_mod.Nombre;
        }
Exemplo n.º 2
0
        public TipohabBO Buscar(int tipo_id)
        {
            string    commandSQL = String.Format("SELECT * FROM tipo_habitacion WHERE tipo_id={0}", tipo_id);
            DataTable table      = conexion.EjecutarSentencia(commandSQL);

            if (table.Rows.Count > 0)
            {
                DataRowCollection row = table.Rows;

                TipohabBO tipohabBO = new TipohabBO();

                tipohabBO.Tipo_id = Convert.ToInt32(row[0]["tipo_id"]);
                tipohabBO.Nombre  = row[0]["nombre_tipo"].ToString();

                return(tipohabBO);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 3
0
        public Frm_configuracion()
        {
            InitializeComponent();
            tipohabBO    = new TipohabBO();
            tipohabDAO   = new TipohabDAO();
            estadohabBO  = new EstadohabBO();
            estadohabDAO = new EstadohabDAO();

            datos  = tipohabDAO.Buscar();
            datos2 = estadohabDAO.Buscar();

            dgv_tipo_hab.DataSource          = datos;
            dgv_tipo_hab.AllowUserToAddRows  = false;
            dgv_tipo_hab.ReadOnly            = true;
            dgv_tipo_hab.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            dgv_estado_hab.DataSource          = datos2;
            dgv_estado_hab.AllowUserToAddRows  = false;
            dgv_estado_hab.ReadOnly            = true;
            dgv_estado_hab.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;

            setColumNames();
        }
Exemplo n.º 4
0
 public void ValidarTexboxTipo()
 {
     if (txt_nombre_tipo.Text == "")
     {
         MessageBox.Show("Debe completar todos los campos");
     }
     else
     {
         if (tipohabBO_mod != null)
         {
             if (tipohabDAO.Modificar(RecuperarInformacionTipo()) == 1)
             {
                 MessageBox.Show("Se ha modificado el tipo de habitación");
             }
             else
             {
                 MessageBox.Show("Ha habido un error al modificar el tipo de habitación!");
             }
             tipohabBO_mod = null;
         }
         else
         {
             if (tipohabDAO.Agregar(RecuperarInformacionTipo()) == 1)
             {
                 MessageBox.Show("Se ha registrado el tipo de habitación");
             }
             else
             {
                 MessageBox.Show("Ha habido un error al registrar el tipo de habitación!");
             }
         }
         Clean();
         dgv_tipo_hab.DataSource = tipohabDAO.Buscar();
         dgv_tipo_hab.Update();
     }
 }
Exemplo n.º 5
0
        public int Eliminar(TipohabBO tipohabBO)
        {
            string ComandoSQL = string.Format("DELETE FROM tipo_habitacion WHERE tipo_id={0}", tipohabBO.Tipo_id);

            return(conexion.EjecutarComando(ComandoSQL));
        }
Exemplo n.º 6
0
        public int Modificar(TipohabBO tipohabBO)
        {
            string ComandoSQL = string.Format("UPDATE tipo_habitacion SET nombre_tipo='{1}' WHERE tipo_id={0}", tipohabBO.Tipo_id, tipohabBO.Nombre);

            return(conexion.EjecutarComando(ComandoSQL));
        }
Exemplo n.º 7
0
        public int Agregar(TipohabBO tipohabBO)
        {
            string ComandoSQL = string.Format("INSERT INTO  tipo_habitacion(nombre_tipo)VALUES('{0}');", tipohabBO.Nombre);

            return(conexion.EjecutarComando(ComandoSQL));
        }