Example #1
0
 public ActionResult Verification(CustomerVerification customerVerification)
 {
     if (customerVerification.OTP == Convert.ToInt32(Session["OTP"]))
     {
         ViewBag.Signup = true;
         StoreDBEntities1 entities = new StoreDBEntities1();
         int rowsAffected          = entities.spActivateCustomer(customerVerification.Email);
         entities.SaveChanges();
         if (rowsAffected > 0)
         {
             return(View("Index"));
         }
     }
     return(View("Verification"));
 }
Example #2
0
        /// Method Name     : GetUpdateVerificationRequestBody
        /// Author          : Pratik Soni
        /// Creation Date   : 24 Jan 2018
        /// Purpose         : To generate the request body for updating verification data in CRM
        /// Revision        :
        /// </summary>
        /// <returns> json STRING with verification code and code valid till date.</returns>
        private DTO.CustomerVerification GetUpdateVerificationRequestBody(int verificationCode)
        {
            CustomerVerification dtoCustomer = new CustomerVerification();
            string currentDateTimeFormat;
            int    OTPValidTill;

            OTPValidTill          = int.Parse(ConfigurationManager.AppSettings["OTPValidTill"]);
            currentDateTimeFormat = CultureInfo.CurrentCulture.DateTimeFormat.ShortDatePattern + " " + CultureInfo.CurrentCulture.DateTimeFormat.LongTimePattern;

            dtoCustomer.VerificationCode = verificationCode;
            dtoCustomer.CodeValidTill    = DateTime.Parse(General.ConvertDateStringInUTCFormat(DateTime.UtcNow.AddDays(OTPValidTill).ToString(), currentDateTimeFormat));

            logger.Info(resourceManager.GetString("msgRequestContentCreated"));
            return(dtoCustomer);
        }
        public void Handle(NewCustomerSignupEvent integrationEvent)
        {
            using (var unitOfWork = new CommandUnitOfWork(CommandArgs.FromIntegrationEvent(integrationEvent)))
            {
                Thread.Sleep(3000);

                string verificationCode = this.GenerateCustomerCode(integrationEvent.NewCustomer);

                unitOfWork.RaiseEvent(new CustomerVerificationGeneratedEvent(integrationEvent.NewCustomer.Username, verificationCode));

                unitOfWork.RaiseEvent(new LogEvent($"Customer [{integrationEvent.NewCustomer.Username}] verification code generated [{verificationCode}]"));

                CustomerVerification customerVerification = new CustomerVerification(integrationEvent.NewCustomer.Username, verificationCode);
                Context.CurrentContext.AddCustomerVerification(customerVerification);

                unitOfWork.Commit();
            }
        }