Ejemplo n.º 1
0
        public ActionResult Promoter(int page = 1, string nameFull = "", string idDocument = "", string email = "", string codPromoter = "")
        {
            ViewBag.nameFull = nameFull;
            ViewBag.idDocument = idDocument;
            ViewBag.email = email;
            ViewBag.codPromoter = codPromoter;
            ViewBag.page = page;

            var promoterlist = new Promoter().SelectPromoter(Settings.AutenticationKeyEarningSystem, nameFull, idDocument, email, codPromoter).ToList();

            var list = new MvcList<PromoterModel>(promoterlist
                                                        .OrderBy(x => x.NameFull)
                                                        .Skip((page * Helper.Constants.AdminPromoterRegistersPerPage) - Helper.Constants.AdminPromoterRegistersPerPage)
                                                        .Take(Helper.Constants.AdminPromoterRegistersPerPage),
                                                        page,
                                                        promoterlist.Count,
                                                        Helper.Constants.AdminPromoterRegistersPerPage);

            return View(list);
        }
Ejemplo n.º 2
0
        private List<OrderModels> SetValues(int idPeriod, PeriodModel period)
        {
            var orders = new Order().GetOrderByClient(Settings.AutenticationKeyEarningSystem, idPeriod, RetornaidCliente()).ToList();
            var param = new WS.Parameter.Parameter().Get(Settings.AutenticationKeyEarningSystem, 3);

            var promoter = new Promoter().GetPromoter(
                Settings.AutenticationKeyEarningSystem, RetornaidCliente());

            if (promoter != null)
            {
                var invite = new Invite().Select(Settings.AutenticationKeyEarningSystem, promoter.IdPromoter);
                ViewBag.TotalInvites = invite.TotalInvite;
                ViewBag.TotalAcceptedInvite = invite.TotalAcceptedInvite;

                SetCommissions(period, promoter);
            }

            ViewBag.IdPeriod = idPeriod;
            ViewBag.MyPurchase = orders.Sum(m => m.ValorTotal);
            ViewBag.MinValue = decimal.Parse(param.Valor);
            return orders;
        }