Exemplo n.º 1
0
        public bool InsertarCliente()
        {
            bool  res  = false;
            Int32 cont = 0;

            if (this.ValidarDatos())
            {
                string sql = "INSERT INTO tcliente(nombre, cedula, direccion, telefono, barrio)";
                sql += "VALUES ('" + Nombre.ToLower() + "', '" + Cedula + "', '" + Direccion + "', '" + Telefono + "', '" + Barrio + "');";
                //ESTE IF VERIFICA LA EXISTENCIA DE UN CLIENTE EN LA DB
                cont = this.verificarExistencia();
                if (cont == 0)
                {
                    res = conex.Ejecutar(sql);
                }
                else
                {
                    msg.Getmensaje(TipoError.EXISTENCIA);
                    res = false;
                }
            }
            else
            {
                msg.Getmensaje(TipoError.DATOS_INVALIDOS);
            }
            return(res);
        }
Exemplo n.º 2
0
        public bool InsertarPrestamo(int indice)
        {
            bool res = false;

            //int indice;
            if (this.ValidarDatos())
            {
                //indice = this.getMaximoIndice() + 1;
                string sql = "INSERT INTO tprestamo(codigo, valor, porcentaje, total, fecha_inicio, fecha_final, cuotas, valor_cuota, cedula_cliente, codigo_frecpag, saldo,  indice) ";
                sql += "VALUES ('" + Codigo + "',";
                sql += Valor.ToString().Replace(",", ".") + ",";
                sql += Porcentaje.ToString().Replace(",", ".") + ",";
                sql += Total.ToString().Replace(",", ".") + ",'";
                sql += FechaInicial + "','";
                sql += FechaFinal + "',";
                sql += Numcuota + ",";
                sql += ValorCuota.ToString().Replace(",", ".") + ",'";
                sql += CedulaCliente + "',";
                sql += Cod_FrePag + ", ";
                sql += Saldo.ToString().Replace(",", ".") + ", " + indice + ");";

                //SE EJECUTA LA CONSULTA
                res = conex.Ejecutar(sql);
            }
            else
            {
                msg.Getmensaje(TipoError.DATOS_INVALIDOS);
            }
            return(res);
        }
Exemplo n.º 3
0
        //GUARDA LA CUOTA ACTUAL
        private void RegistrarCuota()
        {
            double abono    = Convert.ToDouble(TXTabono.Text);
            Cuota  objCuota = new Cuota(abono, TXTcodigo.Text, DTPfecha.Value.ToShortDateString(), cedulacobrador, int.Parse(DTPfecha.Value.DayOfWeek.ToString("d")));

            if (objCuota.verificarExistencia(TXTcodigo.Text, DTPfecha.Value.ToShortDateString()) == 0)
            {
                if (objCuota.InsertarCuota())
                {
                    msg.Getmensaje(TipoError.INSERCCION_POSITIVA);
                    //this.Close();
                }
                else
                {
                    msg.Getmensaje(TipoError.INSERCCION_NEGATIVA);
                }
            }
            else
            {
                MessageBox.Show("Ya existe una cuota con la fecha: " + DTPfecha.Value.ToShortDateString() + " y con el codigo: " + TXTcodigo.Text, "Alerta", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Elimina el prestamo o el cliente dependiendo del argumento tipo
        /// </summary>
        /// <param name="tipo">Tipo de eliminacion (1 o 2)</param>
        private void EliminarPrestamo_Cliente(int tipo)
        {
            Prestamo objPrestamo = new Prestamo();
            Cliente  objCliente  = new Cliente();
            bool     res         = false;

            if (tipo == 1)
            {
                res = objPrestamo.EliminarPrestamo(LBLcodigo.Text);
            }
            else if (tipo == 2)
            {
                res = objCliente.EliminarCliente(TXTcedula.Text);
            }
            if (res)
            {
                msg.Getmensaje(TipoError.ELIMINACION_POSITIVA);
            }
            else
            {
                msg.Getmensaje(TipoError.ELIMINACION_NEGATIVA);
            }
        }