コード例 #1
0
 //METODO PARA LIMPPIAR TODOS LOS TEXTBOX QUE SE ENCUENTRAN EN EL
 public void MET_LimpiarTextBox()
 {
     MtbCedula.Clear();
     TxtNombreCliente.Clear();
     TxtApellidoCliente.Clear();
     MtbTelefono.Clear();
     TxtDireccionCliente.Clear();
     TxtDeuda.Clear();
     TxtPago.Clear();
     TxtDeudaRestante.Clear();
     LblErrorCedula.Visible          = false;
     LblErrorNombre.Visible          = false;
     LblErrorApellido.Visible        = false;
     LblErrorTelefono.Visible        = false;
     LblErrorDireccion.Visible       = false;
     LblErrorPago.Visible            = false;
     LblErrorFechaNacimiento.Visible = false;
 }
コード例 #2
0
 private void TxtNombreCliente_KeyPress(object sender, KeyPressEventArgs e)
 {
     if (e.KeyChar == Convert.ToChar(Keys.Enter))
     {
         e.Handled = true;
         TxtApellidoCliente.Focus();
     }
     else if (char.IsLetter(e.KeyChar))
     {
         e.Handled = false;
     }
     else if (char.IsControl(e.KeyChar))
     {
         e.Handled = false;
     }
     else if (char.IsSeparator(e.KeyChar))
     {
         e.Handled = false;
     }
     else
     {
         e.Handled = true;
     }
 }
コード例 #3
0
        private void BtnGuardarCliente_Click(object sender, EventArgs e)
        {
            if (V_Editar == false)
            {
                try
                {
                    if (MtbCedula.MaskFull != true)
                    {
                        LblErrorCedula.Visible          = true;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Visible = false;
                        MtbCedula.Focus();
                        return;
                    }
                    else if (TxtNombreCliente.Text == "")
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = true;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Visible = false;
                        TxtNombreCliente.Focus();
                        return;
                    }
                    else if (TxtApellidoCliente.Text == "")
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = true;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Visible = false;
                        TxtApellidoCliente.Focus();
                        return;
                    }
                    else if (TxtDireccionCliente.Text == "")
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = true;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Visible = false;
                        TxtDireccionCliente.Focus();
                        return;
                    }
                    else if (MtbTelefono.MaskFull != true)
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = true;
                        LblErrorFechaNacimiento.Visible = false;
                        MtbTelefono.Focus();
                        return;
                    }
                    else if (V_Edad < 18)
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Visible = true;
                        LblErrorFechaNacimiento.Text    = "EL CLIENTE NO DE DEBE SER MENOR DE 18 AÑOS";
                        return;
                    }
                    else
                    {
                        CN_Acciones InsertarCliente = new CN_Acciones();
                        InsertarCliente.InsertarDatosCliente(MtbCedula.Text,
                                                             TxtNombreCliente.Text, TxtApellidoCliente.Text,
                                                             TxtDireccionCliente.Text, MtbTelefono.Text,
                                                             DtpFechaNacimiento.Text);

                        MessageBox.Show("SE INSERTO CORRECTAMENTE");

                        MET_LimpiarTextBox();
                        //MET_LblInvisibles();
                        DtvClientes.Visible         = true;
                        BtnGuardarCliente.Visible   = false;
                        BtnEditarCliente.Visible    = true;
                        BtnBorrarCliente.Visible    = true;
                        BtnCancelarGuardado.Visible = false;
                        BtnAgregarCliente.Visible   = true;
                        MET_MostrarClientes();
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + " LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            if (V_Editar == true)
            {
                try
                {
                    if (MtbCedula.MaskFull != true)
                    {
                        LblErrorCedula.Visible    = true;
                        LblErrorNombre.Visible    = false;
                        LblErrorApellido.Visible  = false;
                        LblErrorDireccion.Visible = false;
                        LblErrorTelefono.Visible  = false;
                        MtbCedula.Focus();
                        return;
                    }
                    else if (TxtNombreCliente.Text == "")
                    {
                        LblErrorCedula.Visible    = false;
                        LblErrorNombre.Visible    = true;
                        LblErrorApellido.Visible  = false;
                        LblErrorDireccion.Visible = false;
                        LblErrorTelefono.Visible  = false;
                        TxtNombreCliente.Focus();
                        return;
                    }
                    else if (TxtApellidoCliente.Text == "")
                    {
                        LblErrorCedula.Visible    = false;
                        LblErrorNombre.Visible    = false;
                        LblErrorApellido.Visible  = true;
                        LblErrorDireccion.Visible = false;
                        LblErrorTelefono.Visible  = false;
                        TxtApellidoCliente.Focus();
                        return;
                    }
                    else if (TxtDireccionCliente.Text == "")
                    {
                        LblErrorCedula.Visible    = false;
                        LblErrorNombre.Visible    = false;
                        LblErrorApellido.Visible  = false;
                        LblErrorDireccion.Visible = true;
                        LblErrorTelefono.Visible  = false;
                        TxtDireccionCliente.Focus();
                        return;
                    }
                    else if (MtbTelefono.MaskFull != true)
                    {
                        LblErrorCedula.Visible    = false;
                        LblErrorNombre.Visible    = false;
                        LblErrorApellido.Visible  = false;
                        LblErrorDireccion.Visible = false;
                        LblErrorTelefono.Visible  = true;
                        MtbTelefono.Focus();
                        return;
                    }
                    else if (V_Edad < 18)
                    {
                        LblErrorCedula.Visible          = false;
                        LblErrorNombre.Visible          = false;
                        LblErrorApellido.Visible        = false;
                        LblErrorDireccion.Visible       = false;
                        LblErrorTelefono.Visible        = false;
                        LblErrorFechaNacimiento.Text    = "EL CLIENTE DE DEBE SER MENOR DE 18 AÑOS";
                        LblErrorFechaNacimiento.Visible = true;
                        return;
                    }
                    else
                    {
                        CN_Acciones EditarCliente = new CN_Acciones();
                        if (DtvClientes.SelectedRows.Count > 0)
                        {
                            EditarCliente.EditarDatosClientes(MtbCedula.Text,
                                                              TxtNombreCliente.Text, TxtApellidoCliente.Text,
                                                              TxtDireccionCliente.Text, MtbTelefono.Text,
                                                              DtpFechaNacimiento.Text, V_IDCliente);

                            MessageBox.Show("SE EDITO CORRECTAMENTE");

                            MET_LimpiarTextBox();
                            //MET_LblInvisibles();
                            DtvClientes.Visible         = true;
                            BtnGuardarCliente.Visible   = false;
                            BtnEditarCliente.Visible    = true;
                            BtnBorrarCliente.Visible    = true;
                            BtnCancelarGuardado.Visible = false;
                            BtnCancelarEditado.Visible  = false;
                            BtnAgregarCliente.Visible   = true;
                            V_Editar = false;
                            MET_MostrarClientes();
                        }
                    }
                }
                catch (Exception)
                {
                    //MessageBox.Show("Hay Un error en los datos introducidos. Revise y vuelva a intentarlo " + Error + " LLAME A SOPORTE TECNICO");
                    MessageBox.Show("Hay Un error en los datos introducidos. Verifique que todo este correcto", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }