Ejemplo n.º 1
0
        public IActionResult ViewAccount(int id)
        {
            var account   = _accountService.PrepareViewAccount(id);
            var viewmodel = new AccountOverviewViewModel()
            {
                AccountBalance = account.Balance,
                AccountID      = account.AccountId
            };

            viewmodel.Transactions = _transactionService
                                     .GetandOrderTransactionsByAccountID(id, 20, 0)
                                     .Select(x => new TransactionViewModel
            {
                TransactionId = x.TransactionId,
                Amount        = x.Amount,
                Balance       = x.Balance,
                Bank          = x.Bank,
                Date          = x.Date,
                Operation     = x.Operation,
                OtherAccount  = x.Account,
                Type          = x.Type,
                Symbol        = x.Symbol
            }).ToList();

            return(View(viewmodel));
        }
        public ActionResult Index()
        {
            var model = new AccountOverviewViewModel();

            var customer = Customers.GetCustomer(Identity.Current.CustomerID);
            var website  = ExigoDAL.GetCustomerSiteRealTime(Identity.Current.CustomerID);
            var socialNetworksResponse = ExigoDAL.GetCustomerSocialNetwork(Identity.Current.CustomerID);

            //var socialNetworksResponse = Exigo.WebService().GetCustomerSocialNetworks(new GetCustomerSocialNetworksRequest()
            //{
            //    CustomerID = Identity.Current.CustomerID
            //});

            foreach (var network in socialNetworksResponse)
            {
                switch (network.SocialNetworkID)
                {
                case (int)SocialNetworks.Facebook: model.Facebook = network.Url; break;

                case (int)SocialNetworks.Twitter: model.Twitter = network.Url; break;

                case (int)SocialNetworks.YouTube: model.YouTube = network.Url; break;

                case (int)SocialNetworks.Blog: model.Blog = network.Url; break;

                case (int)SocialNetworks.GooglePlus: model.GooglePlus = network.Url; break;

                case (int)SocialNetworks.LinkedIn: model.LinkedIn = network.Url; break;

                case (int)SocialNetworks.MySpace: model.MySpace = network.Url; break;

                case (int)SocialNetworks.Pinterest: model.Pinterest = network.Url; break;

                case (int)SocialNetworks.Instagram: model.Instagram = network.Url; break;
                }
            }

            model.Customer = customer;

            model.WebAlias = website.WebAlias;

            model.CustomerSite.FirstName        = website.FirstName;
            model.CustomerSite.LastName         = website.LastName;
            model.CustomerSite.Email            = website.Email;
            model.CustomerSite.PrimaryPhone     = website.PrimaryPhone;
            model.CustomerSite.SecondaryPhone   = website.SecondaryPhone;
            model.CustomerSite.Fax              = website.Fax;
            model.CustomerSite.Notes1           = website.Notes1;
            model.CustomerSite.Notes2           = website.Notes2;
            model.CustomerSite.Notes3           = website.Notes3;
            model.CustomerSite.Notes4           = website.Notes4;
            model.CustomerSite.Address.Address1 = website.Address.Address1;
            model.CustomerSite.Address.Address2 = website.Address.Address2;
            model.CustomerSite.Address.Country  = website.Address.Country;
            model.CustomerSite.Address.City     = website.Address.City;
            model.CustomerSite.Address.State    = website.Address.State;
            model.CustomerSite.Address.Zip      = website.Address.Zip;

            return(View(model));
        }
        /// <summary>
        /// Index action for account overview
        /// </summary>
        /// <param name="bankAccountId">Id of the bank account to show</param>
        /// <returns>View containing the overview</returns>
        public async Task <IActionResult> Index(int bankAccountId)
        {
            try
            {
                var bankAccount = await _bankAccountService.GetBankAccountByIdForCurrentUser(bankAccountId);

                var transactions = await _transactionService.GetTransactionsForBankAccountForCurrentUser(bankAccountId, 200, skip : 0);

                var availableCategories = await _categoryService.GetAllCategoriesForCurrentUser();

                var model = new AccountOverviewViewModel
                {
                    Account             = bankAccount,
                    Transactions        = transactions.Take(200).ToList(),
                    AccountBalance      = bankAccount.CurrentBalance.GetValueOrDefault(),
                    AvailableCategories = availableCategories
                };

                return(View("index", model));
            }
            catch (NotFoundException)
            {
                TempDataHelper.SetTemporaryMessage(TempData, MessageState.Error, Resources.BankAccountNotFound);
                return(RedirectToAction(actionName: "Index", controllerName: "Home"));
            }
        }
Ejemplo n.º 4
0
        // GET: Cabinet
        public ActionResult Index()
        {
            var user  = System.Web.HttpContext.Current.GetOwinContext().GetUserManager <AppUserManager>().FindById(System.Web.HttpContext.Current.User.Identity.GetUserId());
            var model = new AccountOverviewViewModel()
            {
                User          = user,
                OrdersCount   = _unitOfWork.Orders.getOrdersCount(user.Email),
                WishListCount = _unitOfWork.WishLists.getWishListCount(user.Email),
                CartCount     = _unitOfWork.Carts.getCartCount(user.Email)
            };

            return(View(model));
        }
Ejemplo n.º 5
0
        public async Task<ActionResult> Index(string message = "", bool error = false, bool success = false)
        {
            var user = await _userManager.FindByIdAsync(User.Identity.GetUserId());
            var userId = user.Id;

            var model = new AccountOverviewViewModel
            {
                Accounts = _bank.Accounts.Where(account => account.OwnerId == userId).ToList(),
                Message = message,
                Error = error,
                Success = success
            };

            return View(model);
        }
        public ActionResult Index()
        {
            var model    = new AccountOverviewViewModel();
            var customer = Exigo.GetCustomer(Identity.Current.CustomerID);

            model.Enroller = customer.Enroller;
            model.Sponsor  = customer.Sponsor;
            var website = Exigo.GetCustomerSite(Identity.Current.CustomerID);
            var socialNetworksResponse = Exigo.WebService().GetCustomerSocialNetworks(new GetCustomerSocialNetworksRequest()
            {
                CustomerID = Identity.Current.CustomerID
            });

            // Social NetWorks
            foreach (var network in socialNetworksResponse.CustomerSocialNetwork)
            {
                switch (network.SocialNetworkID)
                {
                case (int)SocialNetworks.Facebook: model.FacebookUrl = network.Url; break;

                case (int)SocialNetworks.Twitter: model.TwitterUrl = network.Url; break;

                case (int)SocialNetworks.YouTube: model.YouTubeUrl = network.Url; break;

                case (int)SocialNetworks.Blog: model.BlogUrl = network.Url; break;
                }
            }


            //Basic Info
            model.CustomerID  = customer.CustomerID;
            model.FirstName   = customer.FirstName;
            model.LastName    = customer.LastName;
            model.Email       = customer.Email;
            model.WebAlias    = website.WebAlias;
            model.LoginName   = customer.LoginName;
            model.LanguageID  = customer.LanguageID;
            model.CreatedDate = customer.CreatedDate;


            // Team Placement
            var currentPeriod    = Exigo.GetCurrentPeriod(PeriodTypes.Default);
            var placementOptions = new List <SelectListItem>();
            var volumes          = Exigo.GetCustomerVolumes(new GetCustomerVolumesRequest()
            {
                CustomerID   = Identity.Current.CustomerID,
                PeriodID     = currentPeriod.PeriodID,
                PeriodTypeID = PeriodTypes.Default
            });
            var canSeeTeamOne   = (volumes.Volume50 > 0);
            var canSeeTeamTwo   = (volumes.Volume51 > 0);
            var canSeeTeamThree = (volumes.Volume52 > 0);
            var canSeeTeamFour  = (volumes.Volume53 > 0);
            var canSeeTeamFive  = (volumes.Volume54 > 0);

            model.TeamPlacementPreferenceID = customer.Field1;

            // Only show available teams. If none available, default to team one
            if (canSeeTeamOne || (canSeeTeamOne == false && canSeeTeamTwo == false && canSeeTeamThree == false && canSeeTeamFour == false && canSeeTeamFive == false))
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 1", Value = "1"
                });
            }
            if (canSeeTeamTwo)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 2", Value = "2"
                });
            }
            if (canSeeTeamThree)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 3", Value = "3"
                });
            }
            if (canSeeTeamFour)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 4", Value = "4"
                });
            }
            if (canSeeTeamFive)
            {
                placementOptions.Add(new SelectListItem {
                    Text = Resources.Common.Team + " 5", Value = "5"
                });
            }
            model.TeamPlacementPreferenceOptions = placementOptions;

            // Set the description for the user's team to be displayed
            if (model.TeamPlacementPreferenceID != "")
            {
                model.TeamPlacementPreference = Resources.Common.Team + " " + model.TeamPlacementPreferenceID;
            }
            // If somehow the customer does not have a value in thier Field1, default the description to the first available option
            else
            {
                var firstAvailableTeamNumber = placementOptions.OrderBy(c => c.Value).FirstOrDefault().Value;
                model.TeamPlacementPreference = Resources.Common.Team + " " + firstAvailableTeamNumber;
            }


            // Tax ID - Added try catch around this because it fails from time to time and kills the entire page - Mike M.
            try
            {
                var request = new Common.Api.ExigoWebService.GetCustomReportRequest();
                request.ReportID   = 3;
                request.Parameters = new List <ParameterRequest>
                {
                    new ParameterRequest {
                        ParameterName = "CustomerID", Value = Identity.Current.CustomerID
                    }
                }.ToArray();
                var taxIDResponse = Exigo.WebService().GetCustomReport(request);
                var taxId         = taxIDResponse.ReportData.Tables[0].Rows[0][0].ToString();
                model.TaxIDIsSet  = (taxId != "");
                model.MaskedTaxID = taxId;
            }
            catch (Exception ex)
            {
            }

            // Contact
            model.PrimaryPhone   = customer.PrimaryPhone;
            model.SecondaryPhone = customer.SecondaryPhone;
            model.MobilePhone    = customer.MobilePhone;
            model.Fax            = customer.Fax;
            model.Addresses      = customer.Addresses;


            // Customer Site
            model.CustomerSite.FirstName      = website.FirstName;
            model.CustomerSite.LastName       = website.LastName;
            model.CustomerSite.Email          = website.Email;
            model.CustomerSite.PrimaryPhone   = website.PrimaryPhone;
            model.CustomerSite.SecondaryPhone = website.SecondaryPhone;
            model.CustomerSite.Fax            = website.Fax;

            model.CustomerSite.Notes1 = website.Notes1;
            model.CustomerSite.Notes2 = website.Notes2;
            model.CustomerSite.Notes3 = website.Notes3;
            model.CustomerSite.Notes4 = website.Notes4;

            model.CustomerSite.Address.Address1 = website.Address.Address1;
            model.CustomerSite.Address.Address2 = website.Address.Address2;
            model.CustomerSite.Address.Country  = website.Address.Country;
            model.CustomerSite.Address.City     = website.Address.City;
            model.CustomerSite.Address.State    = website.Address.State;
            model.CustomerSite.Address.Zip      = website.Address.Zip;


            // Opt in
            model.IsOptedIn = customer.IsOptedIn;

            // Annual Membership
            model.Membership = Exigo.GetCustomerAutoOrders(new GetCustomerAutoOrdersRequest
            {
                CustomerID                = Identity.Current.CustomerID,
                IncludeDetails            = true,
                IncludePaymentMethods     = true,
                IncludeInactiveAutoOrders = true
            }).Where(v => v.Details.Any(d => d.ItemCode == "IAANNUALRENEWAL")).FirstOrDefault();

            model.ActiveMembership = model.Membership != null ? "Scheduled" + @model.Membership.NextRunDate : "No Renewal Scheduled";

            // Get the available languages
            model.Languages = Exigo.GetLanguages();


            return(View(model));
        }