예제 #1
0
        public void NUEVOCONTRATISTA(ContratistaCE c)
        {
            cn = objCON.getConecta();
            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "SP_NUEVOCONTRATISTA";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection  = cn;

            cmd.Parameters.Add("@COD", SqlDbType.Char).Value    = c.codigo;
            cmd.Parameters.Add("@NOM", SqlDbType.VarChar).Value = c.nombre;
            cmd.Parameters.Add("@PAT", SqlDbType.VarChar).Value = c.paterno;
            cmd.Parameters.Add("@MAT", SqlDbType.VarChar).Value = c.materno;
            cmd.Parameters.Add("@FON", SqlDbType.VarChar).Value = c.telefono;
            cmd.Parameters.Add("@EMA", SqlDbType.VarChar).Value = c.correo;

            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
            }
        }
        private void btnRegistrar_Click(object sender, EventArgs e)
        {
            if (valida() == "")
            {
                ContratistaCE objCE = new ContratistaCE();
                objCE.codigo   = lblCodigo.Text;
                objCE.nombre   = txtNombre.Text;
                objCE.paterno  = txtPaterno.Text;
                objCE.materno  = txtMaterno.Text;
                objCE.telefono = txtTelefono.Text;
                objCE.correo   = txtCorreo.Text;

                try
                {
                    objCon.NUEVOCONTRATISTA(objCE);
                    generarCodigo();
                    MessageBox.Show("CONTRATISTA REGISTRADO CORRECTAMENTE..!!", "REGISTRO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                MessageBox.Show("El error se encuentra en " + valida());
            }
        }
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            if (valida() == "")
            {
                ContratistaCE objCE = new ContratistaCE();
                objCE.codigo   = txtCodigo.Text;
                objCE.nombre   = txtNombre.Text;
                objCE.paterno  = txtPaterno.Text;
                objCE.materno  = txtMaterno.Text;
                objCE.telefono = txtTelefono.Text;
                objCE.correo   = txtCorreo.Text;

                try
                {
                    objCon.ACTUALIZACONTRATISTA(objCE);
                    MessageBox.Show("CONTRATISTA ACTUALIZA CORRECTAMENTE..!!", "ACTUALIZA", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    dgContratista.DataSource = objCon.LISTACONTRATISTA();
                }
                catch (Exception)
                {
                    throw;
                }
            }
            else
            {
                MessageBox.Show("El error se encuentra en " + valida());
            }
        }
예제 #4
0
        public DataTable BUSCACONTRATISTA(ContratistaCE C)
        {
            cn = objCON.getConecta();
            SqlDataAdapter da = new SqlDataAdapter("SP_BUSCACONTRATISTA", cn);

            da.SelectCommand.CommandType = CommandType.StoredProcedure;
            da.SelectCommand.Parameters.Add("@COD", SqlDbType.Char).Value = C.codigo;
            DataTable dt = new DataTable();

            da.Fill(dt);
            return(dt);
        }
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            ContratistaCE objC = new ContratistaCE();

            objC.codigo = txtCodigo.Text;

            try
            {
                objCon.ELIMINACONTRATISTA(objC);
                MessageBox.Show("CONTRATISTA ELIMINADO CORRECTAMENTE..!!", "ELIMINADO", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception)
            {
                throw;
            }
        }
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            ContratistaCE objC = new ContratistaCE();

            objC.codigo = txtCodigo.Text;

            if (valida() == "")
            {
                DataRow fila = objCon.BUSCACONTRATISTA(objC).Rows[0];
                txtNombre.Text   = fila[1].ToString();
                txtPaterno.Text  = fila[2].ToString();
                txtMaterno.Text  = fila[3].ToString();
                txtTelefono.Text = fila[4].ToString();
                txtCorreo.Text   = fila[5].ToString();
            }
            else
            {
                MessageBox.Show("El error se encuentra en " + valida());
            }
        }
예제 #7
0
        public void ELIMINACONTRATISTA(ContratistaCE C)
        {
            cn = objCON.getConecta();
            cn.Open();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandText = "SP_ELIMINACONTRATISTA";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection  = cn;

            cmd.Parameters.Add("@COD", SqlDbType.Char).Value = C.codigo;
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #8
0
 public DataTable BUSCACONTRATISTA(ContratistaCE c)
 {
     return(objDAO.BUSCACONTRATISTA(c));
 }
예제 #9
0
 public void ELIMINACONTRATISTA(ContratistaCE c)
 {
     objDAO.ELIMINACONTRATISTA(c);
 }
예제 #10
0
 public void ACTUALIZACONTRATISTA(ContratistaCE c)
 {
     objDAO.ACTUALIZACONTRATISTA(c);
 }
예제 #11
0
 public void NUEVOCONTRATISTA(ContratistaCE c)
 {
     objDAO.NUEVOCONTRATISTA(c);
 }