Beispiel #1
0
        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 QuotaTextBox_TextChanged(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(QuotaTextBox.Text))
     {
         BalanceIntTextBox.Clear();
         TotalTextBox.Clear();
         BalanceIntTextBox.AppendText((Convert.ToDouble(QuotaTextBox.Text) * Convert.ToDouble(InteresTextBox.Text) / 100).ToString());
         TotalTextBox.AppendText((Convert.ToDouble(BalanceIntTextBox.Text) + Convert.ToDouble(QuotaTextBox.Text)).ToString());
     }
     else
     {
         Util.Limpiar(this);
         InteresTextBox.AppendText("4");
     }
 }
Beispiel #3
0
 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 LimpiarButton_Click(object sender, EventArgs e)
 {
     Util.Limpiar(this);
     InteresTextBox.AppendText("4");
 }
Beispiel #5
0
        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());
        }