Beispiel #1
0
 private void GaranteComboBox_SelectionChangeCommitted(object sender, EventArgs e)
 {
     BLL.Personas persona = new BLL.Personas();
     persona.Buscar(Convert.ToInt32(GaranteComboBox.SelectedValue));
     GaranteTextBox.Clear();
     GaranteTextBox.AppendText(persona.Ingreso.ToString());
 }
Beispiel #2
0
 public rPersona(int IdPersona)
 {
     InitializeComponent();
     BLL.Personas persona = new BLL.Personas();
     if (persona.Buscar(IdPersona))
     {
         Modificar   = true;
         IdModificar = IdPersona;
         IdtextBox.AppendText(IdPersona.ToString());
         NombreTextBox.AppendText(persona.Nombre);
         ApellidoTextBox.AppendText(persona.Apellido);
         CedulamaskedTextBox.AppendText(persona.Cedula);
         DireccionTextBox.AppendText(persona.Direccion);
         IngresoTextBox.AppendText(persona.Ingreso.ToString());
         TelefonomaskedTextBox.AppendText(persona.Telefono);
         if (persona.IsClient == 1)
         {
             ClienteRadioButton.Select();
         }
         else
         {
             GaranteRadioButton.Select();
         }
         IdtextBox.Enabled = false;
     }
 }
Beispiel #3
0
        private void BuscarButtom_Click(object sender, EventArgs e)
        {
            ErrorProvider error = new ErrorProvider();

            if (!string.IsNullOrWhiteSpace(IdtextBox.Text) && Convert.ToInt32(IdtextBox.Text) > 0)
            {
                BLL.Personas persona = new BLL.Personas();
                if (persona.Buscar(Convert.ToInt32(IdtextBox.Text)))
                {
                    int id = Convert.ToInt32(IdtextBox.Text);
                    Util.Limpiar(this);
                    Modificar   = true;
                    IdModificar = id;
                    IdtextBox.AppendText(id.ToString());
                    NombreTextBox.AppendText(persona.Nombre);
                    ApellidoTextBox.AppendText(persona.Apellido);
                    CedulamaskedTextBox.AppendText(persona.Cedula);
                    DireccionTextBox.AppendText(persona.Direccion);
                    IngresoTextBox.AppendText(persona.Ingreso.ToString());
                    TelefonomaskedTextBox.AppendText(persona.Telefono);
                    if (persona.IsClient == 1)
                    {
                        ClienteRadioButton.Select();
                    }
                    else
                    {
                        GaranteRadioButton.Select();
                    }
                    IdtextBox.Enabled = false;
                }
            }
            else
            {
                Modificar = true;
                Util.Limpiar(this);
                Consultas.cPersonas consulta = new Consultas.cPersonas();
                consulta.ShowDialog(this);
                BLL.Personas persona = consulta.ObtenerPersona();
                if (persona.IdPersona > 0)
                {
                    IdModificar = persona.IdPersona;
                    IdtextBox.AppendText(persona.IdPersona.ToString());
                    NombreTextBox.AppendText(persona.Nombre);
                    ApellidoTextBox.AppendText(persona.Apellido);
                    CedulamaskedTextBox.AppendText(persona.Cedula);
                    DireccionTextBox.AppendText(persona.Direccion);
                    IngresoTextBox.AppendText(persona.Ingreso.ToString());
                    TelefonomaskedTextBox.AppendText(persona.Telefono);
                    if (persona.IsClient == 1)
                    {
                        ClienteRadioButton.Select();
                    }
                    else
                    {
                        GaranteRadioButton.Select();
                    }
                    IdtextBox.Enabled = false;
                }
            }
        }
Beispiel #4
0
 public BLL.Personas ObtenerPersona()
 {
     BLL.Personas persona = new BLL.Personas();
     if ((PersonasDataGridView.SelectedRows.Count > 1))
     {
         persona.Buscar(Convert.ToInt32(PersonasDataGridView.SelectedRows[0].Cells["IdPersona"].Value));
         return(persona);
     }
     else
     {
         return(persona);
     }
 }
Beispiel #5
0
        private void GuardarButton_Click(object sender, EventArgs e)
        {
            ErrorProvider error = new ErrorProvider();

            if (!Modificar && string.IsNullOrWhiteSpace(IdtextBox.Text))
            {
                IdtextBox.AppendText("0");
            }
            if (Util.ValidarVacio(this) && Util.ValidarCharacteres(NombreTextBox, error))
            {
                int IsClient = -1;
                if (ClienteRadioButton.Checked)
                {
                    IsClient = 1;
                }
                else
                {
                    IsClient = 0;
                }
                BLL.Personas persona = new BLL.Personas(IsClient, CedulamaskedTextBox.Text, Convert.ToSingle(IngresoTextBox.Text), DireccionTextBox.Text, TelefonomaskedTextBox.Text, NombreTextBox.Text, ApellidoTextBox.Text);

                if (Modificar)
                {
                    persona.IdPersona = IdModificar;
                    if (persona.Modificar(IsClient, Convert.ToSingle(IngresoTextBox.Text), CedulamaskedTextBox.Text, TelefonomaskedTextBox.Text, DireccionTextBox.Text, NombreTextBox.Text, ApellidoTextBox.Text))
                    {
                        MessageBox.Show("Exito");
                        Util.Limpiar(this);
                        Modificar   = false;
                        IdModificar = 0;
                    }
                }
                else
                {
                    if (persona.Insertar())
                    {
                        MessageBox.Show("Exito");
                        Util.Limpiar(this);
                    }
                }
            }
        }
Beispiel #6
0
 private void CancelarButton_Click(object sender, EventArgs e)
 {
     BLL.Personas persona = new BLL.Personas();
     if (!string.IsNullOrWhiteSpace(IdtextBox.Text))
     {
         if (persona.Buscar(Convert.ToInt32(IdtextBox.Text)))
         {
             DialogResult Resultado = MessageBox.Show("Estas seguro que deseas elminiar estos datos?", "Aviso", MessageBoxButtons.YesNo);
             if (Resultado == DialogResult.Yes)
             {
                 persona.Eliminar(Convert.ToInt32(IdtextBox.Text));
                 Util.Limpiar(this);
             }
         }
         else
         {
             MessageBox.Show("El cliente no existe", "Aviso", MessageBoxButtons.OK);
         }
     }
 }
Beispiel #7
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());
        }