Exemple #1
0
        public List <ClsRenta> ObtenerRentas()
        {
            List <ClsRenta> rentas = new List <ClsRenta>();
            DataTable       dt     = new DataTable();

            string store = "s_ObtenerRentas";

            dt = data.Leer(store);

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    ClsRenta r = new ClsRenta();
                    r.IDCliente  = Convert.ToInt32(row["IDCliente"].ToString());
                    r.IDVehiculo = Convert.ToInt32(row["IDVehiculo"].ToString());
                    r.Dias       = Convert.ToInt32(row["Dias"].ToString());
                    r.Importe    = Convert.ToInt32(row["Importe"].ToString());

                    rentas.Add(r);
                }
            }

            return(rentas);
        }
Exemple #2
0
        public void Insertar(ClsRenta r)
        {
            string    store = "s_InsertarRenta";
            Hashtable table = new Hashtable();

            table.Add("@IDCliente", r.IDCliente);
            table.Add("@IDVehiculo", r.IDVehiculo);
            table.Add("@Dias", r.Dias);
            table.Add(@"Importe", r.Importe);

            data.Escribir(store, table);
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                ClsRenta r = new ClsRenta();
                r.IDCliente  = Convert.ToInt32(cbClientes.SelectedValue);
                r.IDVehiculo = Convert.ToInt32(((ClsVehiculos)lbVehiculos.SelectedValue).ID);
                r.Dias       = Convert.ToInt32(txtDias.Text);
                r.Importe    = Convert.ToInt32(txtImporte.Text);

                rBll.Insertar(r);

                ObtenerRentas();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Ha ocurrido un error");
                return;
            }
        }
Exemple #4
0
 public void Insertar(ClsRenta r)
 {
     rMpp.Insertar(r);
 }