Exemple #1
0
 public bool validarPrecioVenta()
 {
     try
     {
         if (txtPrecioComercial.Text != "")
         {
             double precio = 0.00;
             if (Double.TryParse(txtPrecioComercial.Text.Trim(), out precio))
             {
                 return(true);
             }
             else
             {
                 ClsHelper.MensajeSistema("Precio de venta es invalido...");
                 return(false);
             }
         }
         else
         {
             DialogResult r = MessageBox.Show("¿Precio de venta se encuentra vacio desea continuar?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
             if (r == DialogResult.Yes)
             {
                 return(true);
             }
             else
             {
                 return(false);
             }
         }
     }catch (Exception)
     {
         throw;
     }
 }
Exemple #2
0
        public bool validarControlesCaracteristica()
        {
            try
            {
                if (txtPlaca.Text.ToString().Trim() == "")
                {
                    ClsHelper.MensajeSistema("Debe ingresar placa al vehiculo...");
                    return(false);
                }
                if ((Int32.Parse(cmbTipoVehiculo.SelectedValue.ToString())) <= 0)
                {
                    ClsHelper.MensajeSistema("Debe seleccionar un tipo vehiculo");
                    return(false);
                }
                else if (Int32.Parse(cmbMarca.SelectedValue.ToString()) <= 0)
                {
                    ClsHelper.MensajeSistema("Debe seleccionar una Linea...");
                    return(false);
                }
                else if (Int32.Parse(cmbLinea.SelectedValue.ToString()) <= 0)
                {
                    ClsHelper.MensajeSistema("Debe seleccionar una linea...");
                    return(false);
                }

                // ClsHelper.MensajeSistema(cmbTipoVehiculo.SelectedValue.ToString());
            }
            catch (Exception)
            {
                throw;
            }
            return(true);
        }
Exemple #3
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            string activo;
            string cambiarContrasena;

            try
            {
                if (!ClsHelper.camposObligatorios(txtNombre, txtUsuario, txtFechaNacimiento))
                {
                    return;
                }
                if (!ClsHelper.isDate(txtFechaNacimiento.Text))
                {
                    ClsHelper.MensajeSistema("Ingrese una fecha válida");
                    txtFechaNacimiento.Focus();
                    return;
                }
                activo            = Convert.ToInt16(chkActivo.Checked).ToString();
                cambiarContrasena = Convert.ToInt16(chkReiniciarContrasena.Checked).ToString();
                if (idUsuario == null)
                {
                    idUsuario = "0";
                }
                ClsSeguridad.grabarModificarUsuario(idUsuario, txtNombre.Text, txtUsuario.Text, txtFechaNacimiento.Text, txtDescripcion.Text, activo, cambiarContrasena);
                ClsHelper.MensajeSistema("Proceso completado exitosamente");
                limpiarControles();
                buscarUsuario();
            }
            catch (Exception ex)
            {
                idUsuario = "0";
                ClsHelper.erroLog(ex);
            }
        }
Exemple #4
0
 private void btnVenta_Click(object sender, EventArgs e)
 {
     try
     {
         if (comprobarControlesFinanciamiento())
         {
             if (verificarFinanciamiento())
             {
                 FrmNuevaVenta frmVenta = new FrmNuevaVenta();
                 frmVenta.setVehiculo(this.idVehiculo, lblTipoAuto.Text + "," + lblMarca.Text + ", " + lblLinea.Text +
                                      lblModelo.Text + ", cc: " + lblCilindros.Text + ", cc:" + lblCc.Text, lblPlaca.Text, lblPrecio.Text);
                 frmVenta.agregarFinanciamiento(cmbForma.SelectedIndex.ToString(), txtEnganche.Text.Trim(), txtCuotas.Text.Trim());
                 frmVenta.ventaDesdeCotizacion();
                 frmVenta.ShowDialog();
                 //    FrmVenta frmVenta = new FrmVenta();
                 //     frmVenta.Show();
                 //     frmVenta.//cargarFormNuevaVenta();
                 //        frmVenta.frmNuevaVenta.setVehiculo(idVehiculo, lblTipoAuto.Text + "," + lblMarca.Text + ", " + lblLinea.Text +
                 //             lblModelo.Text + ", cc: " + lblCilindros.Text + ", cc:" + lblCc.Text, lblPlaca.Text, lblPrecio.Text);
                 ///       frmVenta.frmNuevaVenta.agregarFinanciamiento(cmbForma.SelectedIndex.ToString(), txtEnganche.Text.Trim(), txtCuotas.Text.Trim());
                 //       frmVenta.frmNuevaVenta.ventaDesdeCotizacion();
                 //
             }
             else
             {
                 ClsHelper.MensajeSistema("Valores inconcistentes, recalcular...");
             }
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
Exemple #5
0
        private void grdExistentes_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.idVehiculo = grdExistentes.SelectedRows[0].Cells["idVehiculoCol"].Value.ToString();
                    FrmNuevoVehiculo frmNuevoVehiculo = new FrmNuevoVehiculo(this.idVehiculo);
                    frmNuevoVehiculo.ShowDialog(this);
                    buscar();
                    //this.padre.cargarFormIngreso(this.idVehiculo);
                    //txtNombre.Text = grdExistentes.SelectedRows[0].Cells["lineaCol"].Value.ToString();
                    //cmbMarca.SelectedValue = grdExistentes.SelectedRows[0].Cells["idMarcaCol"].Value;
                    //txtNombre.Enabled = true;
                    //txtNombre.Focus();
                    break;

                case 1:
                    DialogResult r = MessageBox.Show("¿Confirma que desea eliminar este registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (r == DialogResult.Yes)
                    {
                        this.clsVehiculo.eliminar(grdExistentes.SelectedRows[0].Cells["idVehiculoCol"].Value.ToString());
                        ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
                        limpiarControles();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                this.idVehiculo = "0";
                ClsHelper.erroLog(ex);
            }
        }
Exemple #6
0
 private void btnImprimir_Click(object sender, EventArgs e)
 {
     try
     {
         if (comprobarControlesFinanciamiento())
         {
             if (verificarFinanciamiento())
             {
                 FrmClienteCotizacion frmCliente = new FrmClienteCotizacion(
                     txtTotal.Text.ToString(),
                     idVehiculo,
                     txtCuotas.Text.Trim(),
                     txtEnganche.Text.Trim(),
                     txtCuotaMensual.Text.Trim(),
                     txtPrecioNegociado.Text.Trim(),
                     cmbForma.SelectedIndex.ToString());
                 frmCliente.ShowDialog(this);
             }
             else
             {
                 ClsHelper.MensajeSistema("Valores inconcistentes, recalcular...");
             }
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
Exemple #7
0
        void cargarDatosNuevoPago()
        {
            DataSet dts = new DataSet();

            try
            {
                dts = ClsPago.obtenerInformacionPago(idVenta.ToString());
                if (dts.Tables[0].Rows.Count < 1)
                {
                    ClsHelper.MensajeSistema("No hay datos para mostrar");
                    this.Close();
                }

                lblTitulo.Text = dts.Tables[0].Rows[0]["cliente"].ToString() + " Tel:" + dts.Tables[0].Rows[0]["telefonos"].ToString() + " " +
                                 dts.Tables[0].Rows[0]["vehiculo"].ToString() + " Fecha venta: " + dts.Tables[0].Rows[0]["fecha"].ToString();
                lblCuotas.Text  = dts.Tables[0].Rows[0]["cantidadCuotas"].ToString().PadLeft(2, '0');
                lblDiaPago.Text = dts.Tables[0].Rows[0]["diaPago"].ToString().PadLeft(2, '0');

                colocarCantidad(dts.Tables[0].Rows[0]["valorVenta"].ToString(), lblPrecioVentaE, lblPrecioVentaD);
                colocarCantidad(dts.Tables[0].Rows[0]["enganche"].ToString(), lblEngancheE, lblEngancheD);
                colocarCantidad(dts.Tables[0].Rows[0]["montoInicial"].ToString(), lblSaldoInicialE, lblSaldoInicialD);
                colocarCantidad(dts.Tables[0].Rows[0]["saldoActual"].ToString(), lblSaldoActualE, lblSaldoActualD);
                colocarCantidad(dts.Tables[0].Rows[0]["cuota"].ToString(), lblCuotaE, lblCuotaD);
                colocarCantidad(dts.Tables[2].Rows.Count > 0 ? dts.Tables[2].Rows[0]["PendienteUltimaCuota"].ToString() : "0.00", lblParcialPendienteE, lblParcialPendienteD);
                lblCuotasAtrasadas.Text = dts.Tables[3].Rows.Count.ToString();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #8
0
 private Boolean verificar()
 {
     try{
         if (txtCorreoOrigen.Text.Trim() == "")
         {
             ClsHelper.MensajeSistema("Ingresar un correo de Origen...");
             txtCorreoOrigen.Focus();
             return(false);
         }
         else if (txtContrasena.Text.Trim() == "")
         {
             ClsHelper.MensajeSistema("Ingresar una contraseña...");
             txtContrasena.Focus();
             return(false);
         }
         else if (txtCorreoDestino.Text.Trim() == "")
         {
             ClsHelper.MensajeSistema("Ingresar Correo de destino...");
             txtCorreoDestino.Focus();
             return(false);
         }
     }catch (Exception) {
         throw;
     }
     return(true);
 }
Exemple #9
0
        private void grdExistentes_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    this.txtDpi.Text               = grdExistentes.SelectedRows[0].Cells["dpiCol"].Value.ToString().Trim();
                    this.txtNombre.Text            = grdExistentes.SelectedRows[0].Cells["nombresCol"].Value.ToString();
                    this.txtNit.Text               = grdExistentes.SelectedRows[0].Cells["nitCol"].Value.ToString();
                    this.txtDireccion.Text         = grdExistentes.SelectedRows[0].Cells["direccionCol"].Value.ToString();
                    this.txtCorreoElectronico.Text = grdExistentes.SelectedRows[0].Cells["correoElectronicoCol"].Value.ToString();
                    this.txtTelefonos.Text         = grdExistentes.SelectedRows[0].Cells["telefonosCol"].Value.ToString();
                    this.dpiCliente = grdExistentes.SelectedRows[0].Cells["dpiCol"].Value.ToString();
                    this.txtNit.Focus();
                    break;

                case 1:
                    DialogResult r = MessageBox.Show("¿Confirma que desea eliminar este registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (r == DialogResult.Yes)
                    {
                        this.clsCliente.eliminar(grdExistentes.SelectedRows[0].Cells["dpiCol"].Value.ToString());
                        ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
                        limpiarControles();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                this.dpiCliente = "0";
                ClsHelper.erroLog(ex);
            }
        }
Exemple #10
0
 private void btnGrabar_Click(object sender, EventArgs e)
 {
     try
     {
         if (!ClsHelper.IsNumeric(txtMonto.Text))
         {
             ClsHelper.MensajeSistema("Debe Ingresar un número Válido");
             txtMonto.Focus();
             return;
         }
         //Avisa si no ha adjuntado
         if (MessageBox.Show("No ha adjuntado ningún archivo, ¿Desea continuar sin comprobante?", "Continuar sin adjunto", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
         {
             return;
         }
         ClsPago.grabarPago(this.idVenta.ToString(), txtMonto.Text, cboMetodoPago.SelectedValue.ToString(), txtObservaciones.Text, adjunto);
         ClsHelper.MensajeSistema("Pago registrado con éxito");
         limpiarControles();
         btnImprimir.Enabled = true;
     }
     catch (Exception ex)
     {
         ClsHelper.MensajeSistema(ex.Message);
     }
     finally
     {
         limpiarControles();
     }
 }
Exemple #11
0
        private void grdExistentes_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    idMarca        = grdExistentes.SelectedRows[0].Cells["idMarcaCol"].Value.ToString();
                    txtNombre.Text = grdExistentes.SelectedRows[0].Cells["nombreCol"].Value.ToString();
                    break;

                case 1:
                    DialogResult r = MessageBox.Show("¿Confirma que desea eliminar este registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (r == DialogResult.Yes)
                    {
                        ClsMarca.eliminar(grdExistentes.SelectedRows[0].Cells["idMarcaCol"].Value.ToString());
                        ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
                        limpiarControles();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                idMarca = "0";
                ClsHelper.erroLog(ex);
            }
        }
Exemple #12
0
        private void calcularCredito()
        {
            try
            {
                if (cmbFormapago.SelectedIndex == 0)
                {
                    if (dtDetalle.Rows.Count > 0)
                    {
                        txtTotalVenta.Text = Math.Round(((double)dtDetalle.Compute("sum(precioOtorgado)", ""))).ToString();
                    }
                }
                else
                {
                    if (validarControlesFinanciamiento())
                    {
                        double total = 0.00;
                        if (grdDetalle.Rows.Count == 1)
                        {
                            total = Math.Round(((double)dtDetalle.Compute("sum(precioOtorgado)", "")));
                        }
                        int    cuotas   = int.Parse(txtPlazo.Text);
                        double enganche = Math.Round(double.Parse(txtEnganche.Text));


                        //double total = Math.Round(double.Parse(txtTotalVenta.Text),2);
                        //double cuotas = double.Parse(txtPlazo.Text);
                        //double enganche = Math.Round(double.Parse(txtEnganche.Text), 2);
                        if (cuotas >= 2)
                        {
                            if (enganche < total)
                            {
                                double saldo = Math.Round((total - enganche));
                                double cuota = Math.Round((saldo / cuotas));

                                double nuevoTotal = Math.Round(((cuota * cuotas) + enganche));
                                double nuevoSaldo = Math.Round((nuevoTotal - enganche));

                                txtCuotaMensual.Text = cuota.ToString();
                                txtSaldo.Text        = nuevoSaldo.ToString();
                                txtTotalVenta.Text   = nuevoTotal.ToString();
                            }
                            else
                            {
                                ClsHelper.MensajeSistema("Monto de enganche sobrepasa valor venta, realizar venta al contado...");
                            }
                        }
                        else
                        {
                            ClsHelper.MensajeSistema("Cuota minima de financiamiento es 2");
                        }
                    }
                }
                txtPlazo.Focus();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #13
0
        private void grdExistentes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                    string           idVenta       = grdExistentes.SelectedRows[0].Cells["idVentaCol"].Value.ToString();
                    PV.FrmNuevaVenta frmNuevaVenta = new FrmNuevaVenta(idVenta);
                    frmNuevaVenta.ShowDialog(this);
                    //this._p.cargarFormNuevaVenta(idVenta);
                    //this.idVehiculo = grdExistentes.SelectedRows[0].Cells["idVehiculoCol"].Value.ToString();
                    //this.padre.cargarFormIngreso(this.idVehiculo);
                    //txtNombre.Text = grdExistentes.SelectedRows[0].Cells["lineaCol"].Value.ToString();
                    //cmbMarca.SelectedValue = grdExistentes.SelectedRows[0].Cells["idMarcaCol"].Value;
                    //txtNombre.Enabled = true;
                    //txtNombre.Focus();
                    break;

                case 1:
                    DialogResult r = MessageBox.Show("¿Confirma que desea eliminar este registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (r == DialogResult.Yes)
                    {
                        //this.clsVehiculo.eliminar(grdExistentes.SelectedRows[0].Cells["idVehiculoCol"].Value.ToString());
                        ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
                        //limpiarControles();
                    }
                    break;

                case 2:
                    string        r1       = grdExistentes.SelectedRows[0].Cells["adjunto1Col"].Value.ToString();
                    string        r2       = grdExistentes.SelectedRows[0].Cells["adjunto2Col"].Value.ToString();
                    List <String> adjuntos = new List <string>();
                    if (r1 != "")
                    {
                        adjuntos.Add(r1);
                    }
                    if (r2 != "")
                    {
                        adjuntos.Add(r2);
                    }

                    FrmAdjuntos frmAdjuntos = new FrmAdjuntos(adjuntos);
                    frmAdjuntos.ShowDialog(this);
                    //MessageBox.Show("adjunto");
                    break;
                }
            }
            catch (Exception ex)
            {
                //this.idVehiculo = "0";
                ClsHelper.erroLog(ex);
            }
        }
Exemple #14
0
 private void btnGrabar_Click_1(object sender, EventArgs e)
 {
     try
     {
         this.ClsMarca.grabarModificar(idMarca, txtNombre.Text.Trim());
         limpiarControles();
         ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
     }
     catch (Exception ex)
     {
         idMarca = "0";
         ClsHelper.erroLog(ex);
     }
 }
Exemple #15
0
 private void btnGrabar_Click(object sender, EventArgs e)
 {
     try
     {
         this.clsLinea.grabarModificar(idLinea, txtNombre.Text.Trim(), cmbMarca.SelectedValue.ToString());
         limpiarControles();
         ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
     }
     catch (Exception ex)
     {
         idLinea = "0";
         ClsHelper.erroLog(ex);
     }
 }
Exemple #16
0
        private void grdPago_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                switch (e.ColumnIndex)
                {
                case 0:
                {        //Muestra el archivo adjunto
                    String rutaAdjunto = ClsGlobals.rutaAdjuntos + grdPago.SelectedRows[0].Cells["rutaAdjuntoCol"].Value.ToString();
                    if (String.IsNullOrEmpty(rutaAdjunto))
                    {
                        ClsHelper.MensajeSistema("No hay archivo adjunto para mostrar");
                        return;
                    }
                    if (!File.Exists(rutaAdjunto))
                    {
                        ClsHelper.MensajeSistema("No existe el archivo o no tiene acceso a él");
                        return;
                    }
                    System.Diagnostics.Process.Start(rutaAdjunto);
                    break;
                }

                case 1:
                {        //anula pago
                    BL.ClsPago ClsPago = new BL.ClsPago();
                    if (MessageBox.Show("¿Confirma que desea anular este pago?" + Environment.NewLine + "Quedará registro de esta accion", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.No)
                    {
                        return;
                    }
                    try
                    {
                        ClsPago.anularPago(grdPago.SelectedRows[0].Cells["idPagoCol"].Value.ToString());
                    }
                    catch (Exception ms)
                    {        //Excepción propia porque la consulta devuelve raiserror
                        ClsHelper.MensajeSistema(ms.Message);
                    }
                    cargarListaPagos();
                    break;
                }
                }
            }
            catch (Exception ex)
            {
                ClsHelper.erroLog(ex);
            }
        }
Exemple #17
0
        private void btnExportar_Click(object sender, EventArgs e)
        {
            try
            {
                if (dtResult.Rows.Count < 1)
                {
                    ClsHelper.MensajeSistema("No hay datos para exportar");
                    return;
                }


                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter      = "txt files (*.xlsx)|*.xlsx";
                sfd.FilterIndex = 2;
                string fileName = "Sales_" + this.picFechaInicio.Value.ToString("dd_MM_yyyy") + "_to_" + this.picFechaFin.Value.ToString("dd_MM_yyyy");;
                sfd.FileName = fileName;
                // MessageBox.Show("fecha: " + this.picFechaInicio.Value.ToString("dd-MM-yyyy"));
                sfd.RestoreDirectory = true;

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    if (!String.IsNullOrEmpty(sfd.FileName))
                    {
                        //Exporting to Excel
                        fileName = sfd.FileName;
                        //if (!Directory.Exists(folderPath))
                        //{
                        //    Directory.CreateDirectory(folderPath);
                        //}
                        using (XLWorkbook wb = new XLWorkbook())
                        {
                            wb.Worksheets.Add(dtResult, "Ventas");
                            //wb.Worksheet("Ventas").Range(("D" + (dtResult.Rows.Count + 2).ToString())).Value = "Hello"; ;
                            wb.SaveAs(fileName);

                            if (MessageBox.Show("Archivo guardado correctamente,¿Desea abrirlo?", "Abrir Archivo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                System.Diagnostics.Process.Start(fileName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ClsHelper.erroLog(ex);
            }
        }
Exemple #18
0
 private void guardar()
 {
     try
     {
         //string diaPago = "0";
         string cuotas = "1";
         if (cmbFormapago.SelectedIndex == 1)
         {
             //diaPago = cmbDiaPago.SelectedItem.ToString();
             cuotas = txtPlazo.Text.ToString().Trim();
         }
         //MessageBox.Show("idv: " + idVehiculo + "venta: " + idVenta );
         DataTable dt = this.clsVenta.grabarModificar(
             idVenta, this.idVehiculo,
             txtTotalVenta.Text.Trim(),
             txtEnganche.Text,
             cuotas,
             txtCuotaMensual.Text,
             cmbDiaPago.SelectedItem.ToString(),
             referenciaStr[0][0].ToString(), referenciaStr[0][1].ToString(), referenciaStr[0][2].ToString(),
             referenciaStr[1][0].ToString(), referenciaStr[1][1].ToString(), referenciaStr[1][2].ToString(),
             referenciaStr[2][0].ToString(), referenciaStr[2][1].ToString(), referenciaStr[2][2].ToString(),
             adjuntos[0], adjuntos[1],
             txtNombres.Text, txtNit.Text, txtDpi.Text, txtDireccion.Text, txtTelefono.Text, txtEmail.Text,
             this.dpiU,
             this.txtFechaHora.Text
             );
         if (dt.Rows.Count >= 1)
         {
             //ClsHelper.MensajeSistema("data column: " + dt.Rows[0][0]);
             idVenta = dt.Rows[0]["idVenta"].ToString();
             //ClsHelper.MensajeSistema("Proceso Realizado con exito" + idVenta);
             this.btnImprimir.Enabled = true;
             deshabilitarControles();
             //habilitarControlesFinanciamiento(false);
             ClsHelper.MensajeSistema("Proceso completado correctamente...");
         }
         else
         {
             ClsHelper.MensajeSistema("Proceso no se completo correctamente, contactar con soporte...");
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Exemple #19
0
        private bool validarControlesFinanciamiento()
        {
            int    entero   = 0;
            double flotante = 0.00;

            if (!int.TryParse(txtPlazo.Text, out entero))
            {
                ClsHelper.MensajeSistema("Valor de plazo es invalido, agrege valor correcto y recalcule...");
                return(false);
            }
            if (!double.TryParse(txtEnganche.Text, out flotante))
            {
                ClsHelper.MensajeSistema("Valor de enganche es invalido, agrege valor correcto y recalcule...");
                return(false);
            }
            return(true);
        }
Exemple #20
0
 private void btnGrabar_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.validarControlesCosto())
         {
             this.clsCliente.grabarModificar(this.dpiCliente, this.txtDpi.Text.Trim(), this.txtNit.Text.Trim(), txtNombre.Text.Trim(),
                                             this.txtDireccion.Text.Trim(), this.txtTelefonos.Text.Trim(), this.txtCorreoElectronico.Text.Trim());
             limpiarControles();
             ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
         }
     }
     catch (Exception ex)
     {
         dpiCliente = "0";
         ClsHelper.erroLog(ex);
     }
 }
Exemple #21
0
 private void btnCalcular_Click(object sender, EventArgs e)
 {
     try
     {
         if (dtDetalle.Rows.Count > 0)
         {
             calcularCredito();
         }
         else
         {
             ClsHelper.MensajeSistema("No se a agregado ningun vehiculo...");
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
Exemple #22
0
        private void btnCrearCopia_Click(object sender, EventArgs e)
        {
            ClsDb  ClsDb = new ClsDb();
            String consulta;
            String dbName;
            SqlConnectionStringBuilder cn;

            try

            {
                this.Cursor = Cursors.WaitCursor;
                if (String.IsNullOrEmpty(txtRuta.Text))
                {
                    ClsHelper.MensajeSistema("Debe seleccionar la ruta donde guardará la copia");
                    return;
                }
                //if(!File.Exists(txtRuta.Text))
                //{
                //    File.Create(txtRuta.Text);
                //    if (!File.Exists(txtRuta.Text))
                //    {
                //        ClsHelper.MensajeSistema("La ruta especificada no existe, por favor seleccione otra");
                //    }
                //}
                cn       = new SqlConnectionStringBuilder(ConfigurationManager.ConnectionStrings["cnDefault"].ConnectionString);
                dbName   = cn.InitialCatalog;
                consulta = "BACKUP DATABASE " + dbName
                           + " TO DISK = N'" + txtRuta.Text + "\\" + dbName + DateTime.Now.Day.ToString()
                           + "-" + DateTime.Now.Month.ToString() + "-" + DateTime.Now.Year.ToString() + "-" + DateTime.Now.Hour.ToString() + "." + DateTime.Now.Minute.ToString() + "." + DateTime.Now.Second.ToString()
                           + ".bak' WITH NOFORMAT, NOINIT, NAME =N'" + dbName
                           + "-Full Database Backup',SKIP, STATS = 10";
                cn.InitialCatalog = "Master";
                ClsDb.ejecutarConsulta(consulta, new SqlConnection(cn.ConnectionString));
                ClsHelper.MensajeSistema("Copia realizada correctamente");
            }
            catch (Exception ex)
            {
                ClsHelper.erroLog(ex);
            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
Exemple #23
0
        private void btnAdjuntar_Click(object sender, EventArgs e)
        {
            try
            {
                ClsScanner scan = new ClsScanner();
                adjunto = scan.scanv2();
                if (!adjunto.Equals(""))
                {
                    ClsHelper.MensajeSistema("Adjuntado Correctamente");
                }
                else
                {
                    ClsHelper.MensajeSistema("No se pudo realizar la operación");
                }

                /*SaveFileDialog sfd = new SaveFileDialog();
                 * sfd.Filter = "txt files (*.jpg)|*.jpg";
                 * sfd.FilterIndex = 2;
                 * sfd.RestoreDirectory = true;
                 *
                 * if (sfd.ShowDialog() == DialogResult.OK)
                 * {
                 *  if (!String.IsNullOrEmpty(sfd.FileName))
                 *  {
                 *      FrmScanner frm = new FrmScanner();
                 *      frm.ruta = sfd.FileName;
                 *      if (frm.cargarForm())
                 *      {
                 *          adjunto = sfd.FileName;
                 *          ClsHelper.MensajeSistema("Adjuntado correctamente");
                 *      }
                 *      else
                 *      {
                 *          ClsHelper.MensajeSistema("No se pudo realizar la operación");
                 *      }
                 *
                 *  }
                 * }*/
            }
            catch (Exception ex)
            {
                ClsHelper.erroLog(ex);
            }
        }
Exemple #24
0
 private void btngrabar_Click(object sender, EventArgs e)
 {
     try
     {
         if (verificarDatosVenta() && validarControlesFinanciamiento())
         {
             // comprobar si se hicieron cambios en los valores de financiamiento
             double saldoc = 0.00;
             double total  = Math.Round(double.Parse(txtTotalVenta.Text), 2);
             if (cmbFormapago.SelectedIndex == 1)
             {
                 saldoc = Math.Round((Math.Round(double.Parse(txtCuotaMensual.Text), 2)) * (Math.Round(double.Parse(txtPlazo.Text), 2)), 2);
                 total  = Math.Round(saldoc + (Math.Round(double.Parse(txtEnganche.Text), 2)), 2);
             }
             //MessageBox.Show("val: " + total +"total: " + txtTotalVenta.Text.Trim());
             double cmp = Math.Round(total - Math.Round(double.Parse(txtTotalVenta.Text.Trim()), 2));
             if (cmp == 0)
             {
                 actualizarReferencias();
                 if (adjuntos[0] == "")
                 {
                     DialogResult r = MessageBox.Show("¿No se a adjuntado documentos, confirma que desea Grabar?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                     if (r == DialogResult.Yes)
                     {
                         guardar();
                     }
                 }
                 else
                 {
                     guardar();
                 }
             }
             else
             {
                 ClsHelper.MensajeSistema("Valores financiamiento inconcistentes, recalcular...");
             }
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
        private void btnExportar_Click(object sender, EventArgs e)
        {
            try
            {
                if (dtResult.Rows.Count < 1)
                {
                    ClsHelper.MensajeSistema("No hay datos para exportar");
                    return;
                }


                SaveFileDialog sfd = new SaveFileDialog();
                sfd.Filter           = "txt files (*.xlsx)|*.xlsx";
                sfd.FilterIndex      = 2;
                sfd.RestoreDirectory = true;

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    if (!String.IsNullOrEmpty(sfd.FileName))
                    {
                        //Exporting to Excel
                        string fileName = sfd.FileName;
                        //if (!Directory.Exists(folderPath))
                        //{
                        //    Directory.CreateDirectory(folderPath);
                        //}
                        using (XLWorkbook wb = new XLWorkbook())
                        {
                            wb.Worksheets.Add(dtResult, "Customers");
                            wb.SaveAs(fileName);
                            if (MessageBox.Show("Archivo guardado correctamente,¿Desea abrirlo?", "Abrir Archivo", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                            {
                                System.Diagnostics.Process.Start(fileName);
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ClsHelper.erroLog(ex);
            }
        }
Exemple #26
0
 private void tbnFinalizar_Click(object sender, EventArgs e)
 {
     try
     {
         if (validarControlesGenerales())
         {
             if (validarPrecioVenta())
             {
                 //DialogResult r = MessageBox.Show("¿Confirma que desea guardar este registro?", "Confirmar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                 //if (r == DialogResult.Yes)
                 //{
                 DataTable dtNew = this.tbCosto;
                 dtNew.Columns.Remove("TipoCosto");
                 BL.ClsVehiculo clsVehiculo = new BL.ClsVehiculo();
                 clsVehiculo.grabarModificar(this.idVeh.Trim(),
                                             this.cmbTipoVehiculo.SelectedValue.ToString().Trim(),
                                             this.cmbMarca.SelectedValue.ToString(),
                                             this.cmbLinea.SelectedValue.ToString(),
                                             this.cmbModelo.Text,
                                             this.txtPlaca.Text,
                                             this.txtNoChasis.Text,
                                             this.txtColores.Text,
                                             this.cmbAsientos.Text, this.cmbPuertas.Text, this.cmbTransmision.SelectedIndex.ToString(),
                                             this.txtNoMotor.Text, this.txtCc.Text, this.cmbCilindros.Text, this.txtVin.Text,
                                             this.txtTon.Text, this.txtObservaciones.Text, this.cmbAC.SelectedIndex.ToString(),
                                             this.txtNombrePropietario.Text, this.txtNit.Text, this.txtDireccionPropietario.Text,
                                             this.txtPoliza.Text, txtFecha.Text, this.txtPrecioComercial.Text, this.cmbOrigen.SelectedIndex.ToString(), dtNew,
                                             this.cmbGasolina.SelectedIndex.ToString()
                                             );
                 ClsHelper.MensajeSistema("Proceso ejecutado exitosamente");
                 this.Dispose();
                 this.Close();
                 //this._p.cargarFormListaVehiculos();
                 //}
             }
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
Exemple #27
0
 public void ventaDesdeCotizacion()
 {
     try
     {
         agregarVehiculo();
         //agregarFinanciamiento();
         if (dtDetalle.Rows.Count > 0)
         {
             calcularCredito();
         }
         else
         {
             ClsHelper.MensajeSistema("No se a agregado ningun vehiculo...");
         }
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }
Exemple #28
0
 private void btnGrabar_Click(object sender, EventArgs e)
 {
     try
     {
         if (verificar())
         {
             clsMail.grabarModificar(idCorreo, txtCorreoOrigen.Text.Trim(), txtCorreoDestino.Text.Trim(), txtContrasena.Text.Trim());
             //limpiarControles();
             ClsHelper.MensajeSistema("Proceso ejecutado exitosamente...");
             btnGrabar.Enabled    = false;
             btnVerificar.Enabled = false;
             buscar();
         }
     }
     catch (Exception ex)
     {
         //idCorreo = "0";
         ClsHelper.erroLog(ex);
     }
 }
Exemple #29
0
 private bool validarControlesPropietario()
 {
     try
     {
         if (txtNombrePropietario.Text.ToString() == "")
         {
             ClsHelper.MensajeSistema("Debe ingresar el nombre de propietario...");
             return(false);
         }
         else if (txtNit.Text.ToString() == "")
         {
             ClsHelper.MensajeSistema("Debe ingresar nit del propietario del vehiculo...");
             return(false);
         }
     }
     catch (Exception)
     {
         throw;
     }
     return(true);
 }
Exemple #30
0
 private void picAdjunto2_Click(object sender, EventArgs e)
 {
     try
     {
         String rutaAdjunto = adjuntos[1];
         if (String.IsNullOrEmpty(rutaAdjunto))
         {
             ClsHelper.MensajeSistema("No hay archivo adjunto para mostrar");
             return;
         }
         if (!File.Exists(rutaAdjunto))
         {
             ClsHelper.MensajeSistema("No existe el archivo o no tiene acceso a él");
             return;
         }
         System.Diagnostics.Process.Start(rutaAdjunto);
     }
     catch (Exception ex)
     {
         ClsHelper.erroLog(ex);
     }
 }