예제 #1
0
 private void GuardarButton_Click(object sender, EventArgs e)
 {
     if (Util.ValidarVacio(this))
     {
         BLL.Cobros cobro = new BLL.Cobros();
         cobro.Buscar(Convert.ToInt32(CobroComboBox.SelectedValue));
         BLL.Financiamientos fin = new BLL.Financiamientos();
         fin.Buscar(cobro.IdFinanciamiento);
         BLL.CobroDetalles detalle = new BLL.CobroDetalles(Convert.ToSingle(QuotaTextBox.Text), Convert.ToSingle(InteresTextBox.Text), Convert.ToSingle(BalanceIntTextBox.Text), fin.IntervaloPago);
         detalle.Insert();
     }
 }
예제 #2
0
 public BLL.Cobros ObtenerCobro()
 {
     BLL.Cobros cobro = new BLL.Cobros();
     if ((CobrosDataGridView.SelectedRows.Count > 1))
     {
         cobro.Buscar(Convert.ToInt32(CobrosDataGridView.SelectedRows[0].Cells["IdCobro"].Value));
         return(cobro);
     }
     else
     {
         return(cobro);
     }
 }
예제 #3
0
 private void BuscarButtom_Click(object sender, EventArgs e)
 {
     BLL.Cobros cobro = new BLL.Cobros();
     if (string.IsNullOrWhiteSpace(IdtextBox.Text))
     {
         IdtextBox.AppendText("0");
     }
     if (cobro.Buscar(Convert.ToInt32(IdtextBox.Text)))
     {
         int id = Convert.ToInt32(IdtextBox.Text);
         Util.Limpiar(this);
         Modificar   = true;
         IdModificar = cobro.IdCobro;
         IdtextBox.AppendText(id.ToString());
         FinanzaComboBox.SelectedValue = cobro.IdFinanciamiento;
         IdtextBox.Enabled             = false;
         foreach (DataRow row in BLL.CobroDetalles.Listar("*", "IdCobro = " + cobro.IdCobro).Rows)
         {
             string[] fila = { cobro.IdCobro.ToString(), row["IdCobroDetalle"].ToString(), FinanzaComboBox.SelectedValue.ToString(), row["BalanceQuota"].ToString() };
             CobrosDataGridView.Rows.Add(fila);
         }
     }
     else
     {
         Modificar = true;
     }
     Util.Limpiar(this);
     Consultas.cCobros consulta = new Consultas.cCobros();
     consulta.ShowDialog(this);
     cobro = consulta.ObtenerCobro();
     if (cobro.IdCobro > 0)
     {
         IdtextBox.Enabled = false;
         IdModificar       = cobro.IdCobro;
         IdtextBox.AppendText(cobro.IdCobro.ToString());
         FinanzaComboBox.SelectedValue = cobro.IdFinanciamiento;
         foreach (DataRow row in BLL.CobroDetalles.Listar("*", "IdCobro = " + cobro.IdCobro).Rows)
         {
             string[] fila = { cobro.IdCobro.ToString(), row["IdCobroDetalle"].ToString(), FinanzaComboBox.SelectedValue.ToString(), row["BalanceQuota"].ToString() };
             CobrosDataGridView.Rows.Add(fila);
         }
     }
 }
예제 #4
0
 private void CancelarButton_Click(object sender, EventArgs e)
 {
     BLL.Cobros cobro = new BLL.Cobros();
     if (!string.IsNullOrWhiteSpace(IdtextBox.Text))
     {
         if (cobro.Buscar(Convert.ToInt32(IdtextBox.Text)))
         {
             DialogResult Resultado = MessageBox.Show("Estas seguro que deseas elminiar estos datos?", "Aviso", MessageBoxButtons.YesNo);
             if (Resultado == DialogResult.Yes)
             {
                 cobro.Eliminar(Convert.ToInt32(IdtextBox.Text));
                 BLL.CobroDetalles detalle = new BLL.CobroDetalles();
                 detalle.Eliminar(Convert.ToInt32(IdtextBox.Text));
                 Util.Limpiar(this);
                 CobrosDataGridView.Rows.Clear();
                 IdtextBox.Enabled = true;
             }
         }
         else
         {
             MessageBox.Show("El motor no existe", "Aviso", MessageBoxButtons.OK);
         }
     }
 }