private void FinanzaComboBox_SelectionChangeCommitted(object sender, EventArgs e) { BalanceTextBox.Clear(); BLL.Financiamientos fin = new BLL.Financiamientos(); fin.Buscar(Convert.ToInt32(FinanzaComboBox.SelectedValue)); BalanceTextBox.AppendText(fin.Balance.ToString()); }
private void GuardarButton_Click(object sender, EventArgs e) { ErrorProvider error = new ErrorProvider(); if (Convert.ToInt32(ClienteComboBox.SelectedValue) > -1 && Convert.ToInt32(GaranteComboBox.SelectedValue) > -1 && Convert.ToInt32(MotorComboBox.SelectedValue) > -1 && Convert.ToInt32(QuotasComboBox.SelectedItem) > -1 && Util.ValidarTextBoxVacio(PrecioTextBox, error, "El campo esta vacio.")) { BLL.Financiamientos finanza = new BLL.Financiamientos((int)ClienteComboBox.SelectedValue, (int)GaranteComboBox.SelectedValue, (int)MotorComboBox.SelectedValue, Convert.ToSingle(PrecioTextBox.Text), Convert.ToInt32(QuotasComboBox.SelectedItem), Convert.ToSingle(InicialTextBox.Text)); if (Modificar) { if (finanza.Modificar(Convert.ToInt32(ClienteComboBox.SelectedValue), Convert.ToInt32(GaranteComboBox.SelectedValue), Convert.ToInt32(MotorComboBox.SelectedValue), Convert.ToSingle(PrecioTextBox.Text), Convert.ToInt32(QuotasComboBox.SelectedItem), Convert.ToSingle(InicialTextBox.Text))) { MessageBox.Show("Exito"); Util.Limpiar(this); InteresTextBox.AppendText("3"); IdtextBox.Enabled = true; } } else { if (finanza.Insert()) { MessageBox.Show("Exito"); Util.Limpiar(this); InteresTextBox.AppendText("3"); IdtextBox.Enabled = true; } } } }
private void GuardarButton_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(IdtextBox.Text)) { if (CobrosDataGridView.Rows.Count > 0 && Convert.ToInt32(IdtextBox.Text) > 0) { float suma = 0; BLL.CobroDetalles detalle = new BLL.CobroDetalles(); if (Modificar) { foreach (DataGridViewRow row in CobrosDataGridView.Rows) { suma += Convert.ToSingle(row.Cells["Cantidad"].Value); detalle.IdCobroDetalle = Convert.ToInt32(row.Cells["IdDetalle"].Value); detalle.Modificar(Convert.ToSingle(row.Cells["Cantidad"].Value), 3, Convert.ToSingle(row.Cells["Cantidad"].Value) * (detalle.Interes / 100), 0); } BLL.Financiamientos fin = new BLL.Financiamientos(); BLL.Cobros cobro = new BLL.Cobros(); if (cobro.Modificar(Convert.ToSingle(BalanceTextBox.Text), suma)) { MessageBox.Show("Exito"); } fin.Buscar(Convert.ToInt32(FinanzaComboBox.SelectedValue)); fin.Balance -= suma; fin.Modificar(fin.IdPersona, fin.IdGarante, fin.IdMotor, fin.Balance, fin.IntervaloPago, fin.Inicial); Modificar = false; } else { foreach (DataGridViewRow row in CobrosDataGridView.Rows) { suma += Convert.ToSingle(row.Cells["Cantidad"].Value); detalle.IdCobro = Convert.ToInt32(row.Cells["IdCobro"].Value); detalle.Interes = 3; detalle.Quotas = 0; detalle.BalanceInteres = Convert.ToSingle(row.Cells["Cantidad"].Value) * (detalle.Interes / 100); detalle.BalanceQuota = Convert.ToSingle(row.Cells["Cantidad"].Value); detalle.Insert(); } BLL.Financiamientos fin = new BLL.Financiamientos(); BLL.Cobros cobro = new BLL.Cobros(Convert.ToSingle(BalanceTextBox.Text), suma, Convert.ToInt32(FinanzaComboBox.SelectedValue)); if (cobro.Insert()) { MessageBox.Show("Exito"); } fin.Buscar(Convert.ToInt32(FinanzaComboBox.SelectedValue)); fin.Balance -= suma; fin.Modificar(fin.IdPersona, fin.IdGarante, fin.IdMotor, fin.Balance, fin.IntervaloPago, fin.Inicial); } Util.Limpiar(this); CobrosDataGridView.Rows.Clear(); IdtextBox.Enabled = true; } } }
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(); } }
public BLL.Financiamientos ObtenerFinanciamiento() { BLL.Financiamientos fin = new BLL.Financiamientos(); if ((FinanciamientoDataGridView.SelectedRows.Count > 1)) { fin.Buscar(Convert.ToInt32(FinanciamientoDataGridView.SelectedRows[0].Cells["IdFinanciamiento"].Value)); return(fin); } else { return(fin); } }
public rFinanciamiento(int IdFinanciamiento) { InitializeComponent(); BLL.Financiamientos fin = new BLL.Financiamientos(); if (fin.Buscar(IdFinanciamiento)) { Modificar = true; ClienteComboBox.SelectedValue = fin.IdPersona; GaranteComboBox.SelectedValue = fin.IdGarante; MotorComboBox.SelectedValue = fin.IdMotor; InicialTextBox.AppendText(fin.Inicial.ToString()); QuotasComboBox.SelectedItem = fin.IntervaloPago; } }
private void CancelarButton_Click(object sender, EventArgs e) { BLL.Financiamientos fin = new BLL.Financiamientos(); if (!string.IsNullOrWhiteSpace(IdtextBox.Text)) { if (fin.Buscar(Convert.ToInt32(IdtextBox.Text))) { DialogResult Resultado = MessageBox.Show("Estas seguro que deseas elminiar estos datos?", "Aviso", MessageBoxButtons.YesNo); if (Resultado == DialogResult.Yes) { fin.Eliminar(Convert.ToInt32(IdtextBox.Text)); Util.Limpiar(this); InteresTextBox.AppendText("3"); IdtextBox.Enabled = true; } } else { MessageBox.Show("El cliente no existe", "Aviso", MessageBoxButtons.OK); } } }
private void BuscarButtom_Click(object sender, EventArgs e) { ErrorProvider error = new ErrorProvider(); if (!string.IsNullOrWhiteSpace(IdtextBox.Text) && Convert.ToInt32(IdtextBox.Text) > 0) { BLL.Financiamientos fin = new BLL.Financiamientos(); if (fin.Buscar(Convert.ToInt32(IdtextBox.Text))) { IdtextBox.Enabled = false; int id = Convert.ToInt32(IdtextBox.Text); Util.Limpiar(this); InteresTextBox.AppendText("3"); Modificar = true; IdModificar = id; IdtextBox.AppendText(id.ToString()); ClienteComboBox.SelectedValue = fin.IdPersona; GaranteComboBox.SelectedValue = fin.IdGarante; MotorComboBox.SelectedValue = fin.IdMotor; InicialTextBox.AppendText(fin.Inicial.ToString()); QuotasComboBox.SelectedItem = fin.IntervaloPago.ToString(); } } else { Modificar = true; Util.Limpiar(this); InteresTextBox.AppendText("3"); Consultas.cFinanciamientos consulta = new Consultas.cFinanciamientos(); consulta.ShowDialog(this); BLL.Financiamientos fin = consulta.ObtenerFinanciamiento(); if (fin.IdFinanciamiento > 0) { IdtextBox.Enabled = false; IdModificar = fin.IdPersona; IdtextBox.AppendText(fin.IdFinanciamiento.ToString()); ClienteComboBox.SelectedValue = fin.IdPersona; GaranteComboBox.SelectedValue = fin.IdGarante; MotorComboBox.SelectedValue = fin.IdMotor; InicialTextBox.AppendText(fin.Inicial.ToString()); QuotasComboBox.SelectedItem = fin.IntervaloPago.ToString(); } } BLL.Motores motor = new BLL.Motores(); BLL.Colores color = new BLL.Colores(); motor.Buscar(Convert.ToInt32(MotorComboBox.SelectedValue)); color.Buscar(motor.IdColor); ColorTextBox.Clear(); ColorTextBox.AppendText(color.Color); NumeroTextBox.Clear(); NumeroTextBox.AppendText(motor.NumeroChasis); PrecioTextBox.Clear(); PrecioTextBox.AppendText(motor.Precio.ToString()); BLL.Personas persona = new BLL.Personas(); persona.Buscar(Convert.ToInt32(ClienteComboBox.SelectedValue)); ClienteTextBox.Clear(); ClienteTextBox.AppendText(persona.Ingreso.ToString()); persona.Buscar(Convert.ToInt32(GaranteComboBox.SelectedValue)); GaranteTextBox.Clear(); GaranteTextBox.AppendText(persona.Ingreso.ToString()); }