예제 #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();
        }
예제 #2
0
파일: DChofer.cs 프로젝트: antonevj/SIVSUR
        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);
            }
        }
예제 #3
0
파일: LChofer.cs 프로젝트: antonevj/SIVSUR
 public int Update(EChofer t)
 {
     return(new DChofer().Update(t));
 }
예제 #4
0
파일: LChofer.cs 프로젝트: antonevj/SIVSUR
 public int Create(EChofer t)
 {
     return(new DChofer().Create(t));
 }