public async Task <int> mtdCrearSaldo(string strIdUser)
        {
            try
            {
                ParametrosController    par  = new ParametrosController(context);
                ActionResult <DateTime> time = par.mtdObtenerFechaMexico();
                // DateTime time = DateTime.Now;

                var saldo = new Saldos
                {
                    created_by           = strIdUser,
                    created_date         = time.Value,
                    bit_status           = true,
                    dtmfecha             = time.Value,
                    flt_monto_final      = 0.0,
                    flt_monto_inicial    = 0.0,
                    str_forma_pago       = " ",
                    str_tipo_recarga     = " ",
                    int_id_usuario_id    = strIdUser,
                    int_id_usuario_trans = strIdUser,
                    intidconcesion_id    = null
                };

                await context.AddAsync(saldo);

                await context.SaveChangesAsync();

                intdSaldo = saldo.id;
                return(intdSaldo);
            }
            catch (Exception ex)
            {
                return(0);
            }
        }
        // POST: api/Saldos
        public int Post(Saldos saldo)
        {
            int IDHistorial = 0;

            using (uxisolutionbdEntities context = new uxisolutionbdEntities())
            {
                HistorialSaldos hs = new HistorialSaldos();

                hs = context.HistorialSaldos.Add(new HistorialSaldos()
                {
                    Monto_Entrada = saldo.Monto_Entrada,
                    Monto_Salida  = saldo.Monto_Salida,
                    IdUsuario     = saldo.IdUsuario,
                    //Fecha = DateTime.Now,
                    UUM = saldo.UUM,
                    IDTipoMovimiento = saldo.TipoMovimiento.IDTipoMovimiento
                });

                context.SaveChanges();

                IDHistorial = hs.IdHistorial;
            }

            return(IDHistorial);
        }
Esempio n. 3
0
        public void actualizarSaldo(Saldos sd)
        {
            string sentencia;

            sentencia = "update saldos set saldoInicial = '" + sd.SaldoInicial + "' ," +
                        "set comentarios = '" + sd.Comentarios + "' ";

            MySqlCommand commandDatabase = new MySqlCommand(sentencia, databaseConnection);


            try
            {
                databaseConnection.Open();


                MySqlDataReader myReader = commandDatabase.ExecuteReader();
                commandDatabase.CommandTimeout = 60;

                MessageBox.Show("Saldo modificado");
                databaseConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message);
                MessageBox.Show("Error:" + ex.Source);
                MessageBox.Show("Error:" + ex.StackTrace);
            }
            finally
            {
                databaseConnection.Close();
            }
        }
Esempio n. 4
0
        public void insertarSaldo(Saldos sd)
        {
            string sentencia;

            sentencia = "insert into saldos values ('" + sd.IdSaldo + "' , " +
                        "'" + sd.SaldoInicial + "','" + sd.Idcolono + "' ,'" + sd.Comentarios + " ')";
            MySqlCommand commandDatabase = new MySqlCommand(sentencia, databaseConnection);


            try
            {
                databaseConnection.Open();


                MySqlDataReader myReader = commandDatabase.ExecuteReader();
                commandDatabase.CommandTimeout = 60;

                MessageBox.Show("Saldo dado de alta");
                databaseConnection.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:" + ex.Message);
                MessageBox.Show("Error:" + ex.Source);
                MessageBox.Show("Error:" + ex.StackTrace);
            }
            finally
            {
                databaseConnection.Close();
            }
        }
        public ReversarPagoResponse ReversarPago(ISunitpService _iSunitpService, ReversarPagoRequest request)
        {
            _iSunitpService.AddObjLog("AcademiaPinaresClient ReversarPago", "00000000000000000000", "REQUEST ENVIADO.", request);

            var response = new ReversarPagoResponse();

            response.Body = new ReversarPagoResponseBody();

            try
            {
                var client = new Cobranzas_Bancarias_API_DaviviendaSoapClient();
                var saldos = client.ReversarPago(request.Body.sBank, request.Body.sPass, request.Body.__oPago);
                response.Body.ReversarPagoResult = saldos;
                _iSunitpService.AddObjLog("AcademiaPinaresClient ReversarPago", "00000000000000000000", "PROCESO REALIZADO CORRECTAMENTE.", response);
            }
            catch (Exception ex)
            {
                var saldos = new Saldos();
                saldos.Error         = new Error();
                saldos.Error.Codigo  = "999";
                saldos.Error.Mensaje = "Error al momento de consultar el servicio.";

                response.Body.ReversarPagoResult = saldos;

                _iSunitpService.AddLog("AcademiaPinaresClient ReversarPago", "10000000000000000034", "ERROR AL MOMENTO DE EJECUTAR EL POSTEO A UN SERVICIO EXTERNO.", ex.ToString());
            }

            return(response);
        }
Esempio n. 6
0
        public JsonResult <List <ResponseSaldosPorCliente> > SaldosPorCliente(RequestSaldosPorCliente request)
        {
            IConsultasCredito consutasCredito         = new ConsultasCreditos();
            IEstadodeCuenta   consultasEstadoDeCuenta = new ConsultasEstadoDeCuenta();
            Iconsultassaldos  consultassaldos         = new ConsultasSaldos();

            Saldos Saldos = new Saldos(consutasCredito, consultasEstadoDeCuenta, consultassaldos);
            List <ResponseSaldosPorCliente> ListSaldos = Saldos.Proceso(request);

            return(Json(ListSaldos));
        }
Esempio n. 7
0
        /// <summary>
        /// Obtiene una lista de los saldos por usuario y nivel, Si el Nivel_Usuario = 1, devuelve todos, de lo contrario devuelve los saldos del usuario pasado
        /// </summary>
        /// <param name="ID_Usuario"></param>
        /// <param name="Nivel"></param>
        /// <returns></returns>
        public List <Saldos> ObtenerSaldos(int ID_Usuario)
        {
            List <Saldos> ListaSaldos = new List <Saldos>();
            Saldos        _Saldos     = new Saldos();
            AccesoDatos   datos       = new AccesoDatos();
            //DataSet ds = new DataSet();
            DataTable tblSaldos = datos.ObtenerSaldos(ID_Usuario);

            int a = 1;

            //----
            if (tblSaldos != null)
            {
                for (int i = 0; i < tblSaldos.Rows.Count; i++)
                {
                    ListaSaldos.Add(new Saldos
                    {
                        Matrimonio_ID   = (int)tblSaldos.Rows[i]["Matrimonio_ID"],
                        MatrimonioPM    = tblSaldos.Rows[i]["MatrimonioPM"].ToString(),
                        NombreEsposa    = tblSaldos.Rows[i]["NombreEsposa"].ToString(),
                        NombreEsposo    = tblSaldos.Rows[i]["NombreEsposo"].ToString(),
                        FechaMatrimonio = (DateTime)tblSaldos.Rows[i]["FechaMatrimonio"],
                        Nivel           = Convert.ToInt16(tblSaldos.Rows[i]["Nivel"].ToString()),
                        Mensualidad     = (decimal)tblSaldos.Rows[i]["Mensualidad"],
                        TotalaPagar     = (decimal)tblSaldos.Rows[i]["TotalaPagar"],
                        Saldo           = (decimal)tblSaldos.Rows[i]["Saldo"],
                        ID_Usuario      = (int)tblSaldos.Rows[i]["ID_Usuario"]
                    });
                }
            }


            //for (int i = 0; i < tblSaldos.Rows.Count; i++)
            //{
            //    _Saldos = new Saldos();
            //    _Saldos.Matrimonio_ID = (int)tblSaldos.Rows[i]["Matrimonio_ID"];
            //    _Saldos.MatrimonioPM = tblSaldos.Rows[i]["MatrimonioPM"].ToString();
            //    _Saldos.NombreEsposa = tblSaldos.Rows[i]["NombreEsposa"].ToString();
            //    _Saldos.NombreEsposo = tblSaldos.Rows[i]["NombreEsposo"].ToString();
            //    _Saldos.FechaMatrimonio = (DateTime)tblSaldos.Rows[i]["FechaMatrimonio"];
            //    _Saldos.Nivel = Convert.ToInt16(tblSaldos.Rows[i]["Nivel"].ToString());
            //    _Saldos.Mensualidad = (decimal)tblSaldos.Rows[i]["Mensualidad"];
            //    _Saldos.TotalaPagar = (decimal)tblSaldos.Rows[i]["TotalaPagar"];
            //    _Saldos.Saldo = (decimal)tblSaldos.Rows[i]["Saldo"];
            //    _Saldos.ID_Usuario = (int)tblSaldos.Rows[i]["ID_Usuario"];
            //    _Saldos.Nivel_Usuario = Convert.ToInt16(tblSaldos.Rows[i]["Nivel_Usuario"]);
            //    ListaSaldos.Add(_Saldos);
            //}

            return(ListaSaldos);
        }
        private PagoCuotaResponse setRequiredField()
        {
            var response = new PagoCuotaResponse();

            response.Body = new PagoCuotaResponseBody();

            var saldos = new Saldos();

            saldos.Error                  = new Error();
            saldos.Error.Codigo           = "998";
            saldos.Error.Mensaje          = "EL CAMPO (" + _requiredField + ") ES REQUERIDO";;
            response.Body.PagoCuotaResult = saldos;
            return(response);
        }
Esempio n. 9
0
        public string Post(Saldos saldos)
        {
            try
            {
                DataTable table = new DataTable();
                string    query = @" Execute itInsertarNuevoSaldo '" + saldos.Folio + "' , '" + saldos.SaldoPendiente + "'";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }
                return("Saldo Agregado");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
        public async Task <ActionResult <Saldos> > mtdIngresarSaldo([FromBody] Saldos saldos)
        {
            try
            {
                ParametrosController    par = new ParametrosController(context);
                ActionResult <DateTime> horadeTransaccion = par.mtdObtenerHora();

                saldos.created_date       = horadeTransaccion.Value;
                saldos.last_modified_date = horadeTransaccion.Value;
                context.tbsaldo.Add(saldos);
                await context.SaveChangesAsync();

                return(Ok());
            }

            catch (Exception ex)
            {
                //ModelState.AddModelError("token", ex.Message);
                //return BadRequest(ModelState);
                return(Json(new { token = ex.Message }));
            }
        }
        public async Task <ActionResult> mtdActualizaSaldos(int id, [FromBody] Saldos saldos)
        {
            try
            {
                ParametrosController    par = new ParametrosController(context);
                ActionResult <DateTime> horadeTransaccion = par.mtdObtenerHora();

                var response = await context.tbsaldo.FirstOrDefaultAsync(x => x.id == id);

                if (response.id != id)
                {
                    return(BadRequest());
                }

                response.last_modified_by     = saldos.last_modified_by;
                response.last_modified_date   = horadeTransaccion.Value;
                response.dtmfecha             = saldos.dtmfecha;
                response.flt_monto_final      = saldos.flt_monto_final;
                response.flt_monto_inicial    = saldos.flt_monto_inicial;
                response.int_id_usuario_trans = saldos.int_id_usuario_trans;
                response.str_forma_pago       = saldos.str_forma_pago;
                response.str_tipo_recarga     = saldos.str_tipo_recarga;
                response.int_id_usuario_id    = saldos.int_id_usuario_id;
                response.intidconcesion_id    = saldos.intidconcesion_id;

                await context.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                //ModelState.AddModelError("token", ex.Message);
                //return BadRequest(ModelState);
                return(Json(new { token = ex.Message }));
            }
        }
Esempio n. 12
0
        public string Put(Saldos saldos)
        {
            try
            {
                DataTable table = new DataTable();

                string query = @"
                                exec etEditarSaldo " + saldos.IdSaldos + " , '" + saldos.SaldoPendiente + "'";

                using (var con = new SqlConnection(ConfigurationManager.ConnectionStrings["Prolapp"].ConnectionString))
                    using (var cmd = new SqlCommand(query, con))
                        using (var da = new SqlDataAdapter(cmd))
                        {
                            cmd.CommandType = CommandType.Text;
                            da.Fill(table);
                        }

                return("Se Actualizo Correctamente");
            }
            catch (Exception exe)
            {
                return("Se produjo un error" + exe);
            }
        }
        public async Task <ActionResult> mtdRecargarSaldo(double fltMonto, [FromBody] Saldos saldos)
        {
            string strresult       = " ";
            double dblSaldoInicial = 0;

            //var strategy = context.Database.CreateExecutionStrategy();
            //await strategy.ExecuteAsync(async () =>
            //{
            using (IDbContextTransaction transaction = context.Database.BeginTransaction())
            {
                try
                {
                    ParametrosController    par = new ParametrosController(context);
                    ActionResult <DateTime> horadeTransaccion = par.mtdObtenerFechaMexico();
                    DateTime time = horadeTransaccion.Value;
                    //DateTime time = DateTime.Now;
                    //Se ocomento esta linea por actualizacion
                    //var response = await context.tbsaldo.FirstOrDefaultAsync(x => x.id == id);

                    //var comision = await context.tbcomisiones.FirstOrDefaultAsync(x => x.intidconcesion_id == movimientos.intidconcesion_id && x.str_tipo == "RECARGA");

                    var usuario = await context.NetUsers.FirstOrDefaultAsync(x => x.Id == saldos.int_id_usuario_trans);

                    dblSaldoInicial = usuario.dbl_saldo_actual;

                    usuario.dbl_saldo_actual   = usuario.dbl_saldo_actual + fltMonto;
                    usuario.dbl_saldo_anterior = dblSaldoInicial;

                    var comision = await context.tbparametros.Where(x => x.intidconcesion_id == null).FirstOrDefaultAsync();

                    double c = comision.PorcentajeComisionRecarga / 100;

                    double total = fltMonto * c;
                    //Se comento esta linea por actualizacion
                    //response.last_modified_by = saldos.last_modified_by;
                    //response.last_modified_date = horadeTransaccion.Value;
                    //response.dtmfecha = horadeTransaccion.Value;
                    //response.flt_monto_final = response.flt_monto_final + fltMonto;
                    //response.flt_monto_inicial = dblSaldoInicial;
                    //response.int_id_usuario_trans = saldos.int_id_usuario_trans;
                    //response.str_forma_pago = saldos.str_forma_pago;
                    //response.str_tipo_recarga = saldos.str_tipo_recarga;

                    //response.intidconcesion_id = saldos.intidconcesion_id;

                    await context.SaveChangesAsync();

                    context.tbsaldo.Add(new Saldos()
                    {
                        created_by = saldos.created_by,
                        // created_date = horadeTransaccion.Value,
                        dtmfecha                = time,
                        last_modified_date      = time,
                        flt_monto_inicial       = dblSaldoInicial,
                        flt_monto_final         = usuario.dbl_saldo_actual,
                        str_forma_pago          = "VIRTUAL",
                        str_tipo_recarga        = "RECARGA",
                        flt_monto               = fltMonto,
                        flt_porcentaje_comision = total,
                        flt_total_con_comision  = fltMonto + total,
                        int_id_usuario_id       = usuario.Id,
                        int_id_usuario_trans    = usuario.Id
                    });;

                    await context.SaveChangesAsync();

                    await _emailSender.SendEmailAsync(usuario.Email, "Recarga de saldo",
                                                      "La recarga de saldo se ha realizado exitosamente. Monto $" + fltMonto + "MXN.<br/> Si usted no reconoce este movimiento comuniquese con el equipo de soporte");

                    transaction.Commit();
                }

                catch (Exception ex)
                {
                    transaction.Rollback();
                    strresult = ex.Message;
                }
            }
            //});
            return(Ok());
        }