Example #1
0
        public int Update(ERutas t)
        {
            using (SqlConnection cnx = new SqlConnection())
            {
                //   EBus d = new EBus();
                cnx.ConnectionString = MiCadena.CadenaCnx();
                SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "sp_modificar_ruta";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IDRuta", t.IDRuta);
                cmd.Parameters.AddWithValue("@CiudadOrigen", t.Ciudad_De_Origen);
                cmd.Parameters.AddWithValue("@CiudadDestino", t.Ciudad_De_Destino);
                cmd.Parameters.AddWithValue("@Precio", t.precio);
                cmd.Parameters.AddWithValue("@Duracion", t.Duracion);
                cmd.Parameters.AddWithValue("@IDChofer", t.Chofer);
                cmd.Parameters.AddWithValue("@FechaViaje", t.Fecha_De_Viaje);
                cmd.Parameters.AddWithValue("@HoraSalida", t.Hora_De_Salida);
                cmd.Parameters.AddWithValue("@Estado", t.Estado);
                cmd.Connection = cnx;
                cnx.Open();


                int filasafectadas = cmd.ExecuteNonQuery();

                return(filasafectadas);
            }
        }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (!MyValidation())
            {
                return;
            }

            ERutas obj = new ERutas
            {
                IDRuta            = txtID.Text.Length == 0 ? 0 : int.Parse(txtID.Text),
                Ciudad_De_Origen  = txtOrigen.Text.Trim().ToUpper(),
                Ciudad_De_Destino = txtDestino.Text.Trim().ToUpper(),
                precio            = Convert.ToDecimal(txtPrecio.Text),
                Duracion          = (txtDuracion.Text),
                Chofer            = (lblIDChofer.Text),
                Fecha_De_Viaje    = Convert.ToDateTime(dateTimePicker2.Text),
                Hora_De_Salida    = boxHora.Text,
                Estado            = chkEstado.Checked,
            };

            int rpta;

            if (operacion == (byte)MisConstantes.OPERACION.Insercion)
            {
                rpta = new LRutas().Create(obj);
            }
            else
            {
                rpta = new LRutas().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 #3
0
 public int Update(ERutas t)
 {
     return(new DRutas().Update(t));
 }
Example #4
0
 public int Create(ERutas t)
 {
     return(new DRutas().Create(t));
 }