Example #1
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);
        }
Example #2
0
 private ClientCardInfoViewModel DecryptCCinfo(ClientCardInfo model)
 {
     ClientCardInfoViewModel clientCardInfoVM = new ClientCardInfoViewModel();
     clientCardInfoVM.CardType = model.CardType;
     clientCardInfoVM.CardHolderNameOnCard = Cryptographer.Decrypt(model.CardHolderNameOnCard,SetKey());
     clientCardInfoVM.CardNumber = Cryptographer.Decrypt(model.CardNumber,SetKey());
     clientCardInfoVM.ClientCardGuid = model.ClientCardGuid;
     clientCardInfoVM.ClientGuid = model.ClientGuid;
     clientCardInfoVM.CvvNumber = Cryptographer.Decrypt(model.CvvNumber, SetKey());
     clientCardInfoVM.ExpMonth = model.ExpMonth;
     clientCardInfoVM.ExpYear = model.ExpYear;
     return clientCardInfoVM;
 }
Example #3
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);
            }
        }
Example #4
0
        public ActionResult EditClientCardInfo(ClientCardInfoViewModel clientCardInfoVM)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Please correct the errors and try again.");
                return View(clientCardInfoVM);
            }

            var user = Membership.GetUser();
            if (user == null)
            {
                return RedirectToAction("Create");
            }

            ClientLogic clientLogic = new ClientLogic();
            Client possibleClient = clientLogic.GetClientByEmail(user.UserName);

            if (null == possibleClient)
            {
                return RedirectToAction("Create");
            }
            clientCardInfoVM.ClientGuid = possibleClient.ClientGuid;
            this.SaveClientCardInfo(clientCardInfoVM, false);
            return RedirectToAction("see");
        }
Example #5
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);
 }
Example #6
0
        public ActionResult ClientCardInfo(ClientCardInfoViewModel clientCardInfoVM)
        {
            if (!ModelState.IsValid)
            {
                ModelState.AddModelError("", "Please correct the errors and try again.");
                return View(clientCardInfoVM);
            }

            var user = Membership.GetUser();
            if (user == null)
                return RedirectToAction("Create");

            ClientLogic clientLogic = new ClientLogic();
            // UserName is the email address they signed in with.
            Client possibleClient = clientLogic.GetClientByEmail(user.UserName);

            // If an account already exists for the user, show them the See page.
            if (null == possibleClient)
                return RedirectToAction("Create");
            clientCardInfoVM.ClientGuid = possibleClient.ClientGuid;
            this.SaveClientCardInfo(clientCardInfoVM, true);
            return RedirectToAction("See");
        }