Exemplo n.º 1
0
        public Rescate ConsultarRescate(string _cod)
        {
            Rescate       rescate = new Rescate();
            IDbConnection _conn   = DASoftColitas.Conexion();

            _conn.Open();
            SqlCommand _Comand = new SqlCommand("SP_CONSULTAR_RESCATE", _conn as SqlConnection);

            _Comand.CommandType = CommandType.StoredProcedure;
            _Comand.Parameters.Add(new SqlParameter("@COD_ANIMAL", _cod));
            IDataReader _reader = _Comand.ExecuteReader();

            while (_reader.Read())
            {
                rescate.IDRescate          = _reader.GetInt32(0);
                rescate.CodigoAnimal       = _reader.GetString(1);
                rescate.LugarRescate       = _reader.GetString(2);
                rescate.FechaRescate       = Convert.ToDateTime(_reader.GetValue(3));
                rescate.EspecieAnimal      = _reader.GetString(4);
                rescate.Descripcion        = _reader.GetString(5);
                rescate.NombreQuienReporta = _reader.GetString(6);
            }
            _conn.Close();
            return(rescate);
        }
Exemplo n.º 2
0
 private void BtnConsultar_Click(object sender, EventArgs e)
 {
     try
     {
         Rescate _resc = _dlr.ConsultarRescate(txtCodigoAnimal.Text);
         if (_resc.IDRescate != 0)
         {
             this.txtAlertaAnimal.Text        = _resc.NombreQuienReporta;
             this.txtCodigoAnimal.Text        = _resc.CodigoAnimal;
             this.txtDescripcion.Text         = _resc.Descripcion;
             this.cBoxTipoAnimal.SelectedItem = _resc.EspecieAnimal;
             this.txtFecha.Text = _resc.FechaRescate.ToString();
             this.txtLugar.Text = _resc.LugarRescate;
             this.enableData(false);
             this.cargarCombo();
         }
         else
         {
             MessageBox.Show("No existe expediente de rescate para el animal indicado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             LlenarFecha();
         }
     }
     catch
     {
         MessageBox.Show("Error al cargar datos ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         LlenarFecha();
     }
 }
Exemplo n.º 3
0
        public int EliminarRescate(Rescate rescate)
        {
            IDbConnection _conn = DASoftColitas.Conexion();

            _conn.Open();
            SqlCommand _Comand = new SqlCommand("SP_ELIMINAR_USUARIO", _conn as SqlConnection);

            _Comand.CommandType = CommandType.StoredProcedure;
            _Comand.Parameters.Add(new SqlParameter("@COD_ANIMAL", rescate.CodigoAnimal));
            int Resultado = _Comand.ExecuteNonQuery();

            _conn.Close();
            return(Resultado);
        }
Exemplo n.º 4
0
        public int ModificarRescate(Rescate rescate)
        {
            IDbConnection _conn = DASoftColitas.Conexion();

            _conn.Open();
            SqlCommand _Comand = new SqlCommand("SP_MODIFICAR_RESCATES", _conn as SqlConnection);

            _Comand.CommandType = CommandType.StoredProcedure;
            _Comand.Parameters.Add(new SqlParameter("@COD_ANIMAL", rescate.CodigoAnimal));
            _Comand.Parameters.Add(new SqlParameter("@DESCRIPCION", rescate.Descripcion));
            int Resultado = _Comand.ExecuteNonQuery();

            _conn.Close();
            return(Resultado);
        }
Exemplo n.º 5
0
        public int AgregarRescate(Rescate rescate)
        {
            IDbConnection _conn = DASoftColitas.Conexion();

            _conn.Open();
            SqlCommand _Comand = new SqlCommand("SP_AGREGAR_RESCATE", _conn as SqlConnection);

            _Comand.CommandType = CommandType.StoredProcedure;
            _Comand.Parameters.Add(new SqlParameter("@COD_ANIMAL", rescate.CodigoAnimal));
            _Comand.Parameters.Add(new SqlParameter("@LUGAR_RESCATE", rescate.LugarRescate));
            _Comand.Parameters.Add(new SqlParameter("@FECHA_RESCATE", rescate.FechaRescate));
            _Comand.Parameters.Add(new SqlParameter("@ESPECIE", rescate.EspecieAnimal));
            _Comand.Parameters.Add(new SqlParameter("@DESCRIPCION", rescate.Descripcion));
            _Comand.Parameters.Add(new SqlParameter("@NOMBRE_REPORTE", rescate.NombreQuienReporta));
            _Comand.Parameters.Add(new SqlParameter("@IDUSUARIO", rescate.IDUsuario));
            int Resultado = _Comand.ExecuteNonQuery();

            _conn.Close();
            return(Resultado);
        }
Exemplo n.º 6
0
 private void cBoxAnimales_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Rescate _resc = _dlr.ConsultarRescate(cboxAnimales.SelectedItem.ToString());
         Animal  _an   = _dla.BuscarAnimal(cboxAnimales.SelectedItem.ToString());
         if (cboxAnimales.SelectedIndex != 0)
         {
             if (_resc.CodigoAnimal == cboxAnimales.SelectedItem.ToString())
             {
                 this.txtAlertaAnimal.Text        = _resc.NombreQuienReporta;
                 this.cboxAnimales.SelectedItem   = _resc.CodigoAnimal;
                 this.txtDescripcion.Text         = _resc.Descripcion;
                 this.cBoxTipoAnimal.SelectedItem = _resc.EspecieAnimal;
                 this.txtFecha.Text = _resc.FechaRescate.ToString();
                 this.txtLugar.Text = _resc.LugarRescate;
                 this.enableData(false);
                 this.cargarCombo();
                 this.btnRegistrar.Enabled = false;
             }
             else
             {
                 MessageBox.Show("No existe expediente de rescate para el animal indicado", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 LlenarFecha();
                 this.cBoxTipoAnimal.SelectedItem = _an.Especie;
                 this.enableData(true);
                 this.btnRegistrar.Enabled = true;
                 Limpiar();
             }
         }
     }
     catch
     {
         MessageBox.Show("Error al cargar datos ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
         LlenarFecha();
     }
 }
Exemplo n.º 7
0
 public int EliminarRescate(Rescate rescate)
 {
     return(_dar.EliminarRescate(rescate));
 }
Exemplo n.º 8
0
 public int ModificarRescate(Rescate rescate)
 {
     return(_dar.ModificarRescate(rescate));
 }
Exemplo n.º 9
0
 public int AgregarRescate(Rescate rescate)
 {
     return(_dar.AgregarRescate(rescate));
 }