Пример #1
0
        public ActionResult Create()
        {
            // Copy over the possibly applicable data to the listing so the user doesn't have to type it twice if it's the same as the account info.
            ListingViewModelEdit listing = new ListingViewModelEdit();
            //plamen: instead of copy get available account data and use
            AccountLogic accountLogic = new AccountLogic();
            var accountVM = accountLogic.GetByEmail(User.Identity.Name);

            ClientCardInfoLogic ClientCardInfoLogic = new ClientCardInfoLogic();

            if (accountVM != null)
            {
                var clientCardInfo = ClientCardInfoLogic.GetByClientGuid(accountVM.ClientGuid);
                if (null == clientCardInfo)
                    return RedirectToAction("ClientCardInfo","Account");
                listing = accountVM.FeedListing();
                this.AddListingTypesToListing(listing);
                this.AddTypesOfCareToListing(listing);
                this.AddFacilityPhotoToListing(listing, true);
            }

            listing.SaveButtonText = listing.ActionName = "Create";
            // If logged in, show the form.
            return View(listing);
        }
Пример #2
0
        public ActionResult See()
        {
            AccountLogic accountLogic = new AccountLogic();
            AccountViewModel accountVM = accountLogic.GetByEmail(User.Identity.Name);

            // If an account does not exist, help user create one.
            if (null == accountVM)
            {
                return RedirectToAction("Create", "Account");
            }
            // If it does exist, show it.
            else
            {
                AccountWithListingsViewModel accountWithListings = accountVM.WithListings();
                ListingLogic llogic = new ListingLogic();
                var listings = llogic.GetListingsWithDateModifiedByClientGuid(accountWithListings.ClientGuid);
                accountWithListings.AccountListings = listings.ToList();
                ClientCardInfoLogic ClientCardInfoLogic = new ClientCardInfoLogic();
                var ccinfo= ClientCardInfoLogic.GetByClientGuid(accountWithListings.ClientGuid);

                ClientCardInfoViewModel clientCardInfoVM = new ClientCardInfoViewModel();
                if (ccinfo != null)
                    clientCardInfoVM = DecryptCCinfo(ccinfo);
                accountWithListings.clientCardInfoVM = clientCardInfoVM;

                return View(accountWithListings);
            }
        }
Пример #3
0
        private void SaveClientCardInfo(ClientCardInfoViewModel clientCardInfoVM, bool insert)
        {
            ClientCardInfoLogic logic = new ClientCardInfoLogic();
            ClientCardInfo clientCardInfo = new ClientCardInfo();

            clientCardInfo.CardType = clientCardInfoVM.CardType;
            clientCardInfo.CardHolderNameOnCard = Cryptographer.Encrypt(clientCardInfoVM.CardHolderNameOnCard, SetKey());
            clientCardInfo.CardNumber = Cryptographer.Encrypt(clientCardInfoVM.CardNumber, SetKey());
            clientCardInfo.ClientCardGuid= clientCardInfoVM.ClientCardGuid;
            clientCardInfo.ClientGuid = clientCardInfoVM.ClientGuid;
            clientCardInfo.CvvNumber = Cryptographer.Encrypt(clientCardInfoVM.CvvNumber, SetKey());
            clientCardInfo.ExpMonth = clientCardInfoVM.ExpMonth;
            clientCardInfo.ExpYear = clientCardInfoVM.ExpYear;
            if (insert)
                logic.InsertClientCardInfo(clientCardInfo);
            else
                logic.UpdateClientCardInfo(clientCardInfo);
        }
Пример #4
0
 public ActionResult EditClientCardInfo(Guid ClientGuid)
 {
     ClientCardInfoLogic ClientCardInfoLogic = new ClientCardInfoLogic();
     ClientCardInfo ccinfo = ClientCardInfoLogic.GetByClientGuid(ClientGuid);
     ClientCardInfoViewModel clientCardInfoVM = new ClientCardInfoViewModel();
     if (ccinfo != null)
         clientCardInfoVM = DecryptCCinfo(ccinfo);
     ViewBag.cardType = GetCardTypes();
     ViewBag.expiryMonth = GetExpiryMonths();
     ViewBag.expiryYear = GetExpiryYears();
     return View(clientCardInfoVM);
 }