Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!MyValidation())
            {
                return;
            }
            EChofer obj = new EChofer
            {
                ID = txtID.Text.Length == 0 ? 0 : int.Parse(txtID.Text),
                Nombre_completo = txtNombres.Text.Trim().ToUpper(),
                DNI             = txtDNI.Text,
                Edad            = int.Parse(txtEdad.Text),
                Sexo            = boxSexo.Text,
                placa           = (lblIDBus.Text),
                Estado          = chkEstado.Checked
            };

            int rpta;

            if (operacion == (byte)MisConstantes.OPERACION.Insercion)
            {
                rpta = new LChofer().Create(obj);
            }
            else
            {
                rpta = new LChofer().Update(obj);
            }

            if (rpta > 0)
            {
                MessageBox.Show("operacion realizada correctamente", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);

                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            this.DialogResult = DialogResult.OK;
            this.Close();
        }
Example #2
0
        public int Update(EChofer t)
        {
            using (SqlConnection cnx = new SqlConnection())
            {
                cnx.ConnectionString = MiCadena.CadenaCnx();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "sp_modificar_chofer";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IDChofer", t.ID);
                cmd.Parameters.AddWithValue("@NombresCho", t.Nombre_completo);
                cmd.Parameters.AddWithValue("@DNICh", t.DNI);
                cmd.Parameters.AddWithValue("@EdadCho", t.Edad);
                cmd.Parameters.AddWithValue("@SexoChof", t.Sexo);
                cmd.Parameters.AddWithValue("@IDBus", t.placa).ToString();
                cmd.Parameters.AddWithValue("@Estado", t.Estado);
                cmd.Connection = cnx;
                cnx.Open();


                int filasafectadas = cmd.ExecuteNonQuery();

                return(filasafectadas);
            }
        }
Example #3
0
 public int Update(EChofer t)
 {
     return(new DChofer().Update(t));
 }
Example #4
0
 public int Create(EChofer t)
 {
     return(new DChofer().Create(t));
 }