예제 #1
0
        private async Task <IActionResult> Register(string userUuid)
        {
            var number = await GetNumber();

            // 503 Error, Fail get number
            if (number == null)
            {
                return(new StatusCodeResult(503));
            }

            var newItem = new UserModel();

            newItem.UserUuid = userUuid;
            newItem.Major    = number.Major.ToString();
            newItem.Minor    = number.Minor.ToString();
            newItem.SetStatus(Common.UserStatus.None);
            var newItemResult = await Cosmos.User.CreateItemAsync(newItem);

            var result = new RegisterResultModel();

            result.UserUuid = userUuid;
            result.Major    = newItem.Major;
            result.Minor    = newItem.Minor;
            return(new OkObjectResult(result));
        }
예제 #2
0
        public ActionResult RegisterResult(int resultId)
        {
            var resultText = string.Empty;

            switch ((UserRegistrationType)resultId)
            {
            case UserRegistrationType.Disabled:
                resultText = "Registration not allowed. Please contact us for more information.";
                break;

            case UserRegistrationType.Standard:
                resultText = "Your registration completed.";
                break;

            case UserRegistrationType.AdminApproval:
                resultText = "Your account is pending for approval.";
                break;

            case UserRegistrationType.EmailValidation:
                resultText = "Your registration has been successfully completed. You have just been sent an email containing membership activation instructions.";
                break;

            default:
                break;
            }
            var model = new RegisterResultModel
            {
                Result = resultText
            };

            return(View(model));
        }
예제 #3
0
        private async Task <IActionResult> Register(string userUuid)
        {
            var number = await UserRepository.NextSequenceNumber();

            // 503 Error, Fail get number
            if (number == null)
            {
                return(new StatusCodeResult(503));
            }

            var newItem = new UserModel();
            var secret  = Cryption.CreateSecret();

            newItem.UserUuid = userUuid;
            newItem.Major    = number.Major.ToString();
            newItem.Minor    = number.Minor.ToString();
            newItem.SetStatus(Common.UserStatus.None);
            newItem.ProtectSecret = Cryption.Protect(secret);
            await UserRepository.Create(newItem);

            var result = new RegisterResultModel();

            result.UserUuid = userUuid;
            result.Major    = newItem.Major;
            result.Minor    = newItem.Minor;
            result.Secret   = secret;
            return(new OkObjectResult(result));
        }
예제 #4
0
        public async Task <IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var lastMembershipNumber =
                BigInteger.Parse(UserManager.Users.OrderByDescending(a => a.MembershipNumber).First().MembershipNumber);
            var nextMembershipNumber = (lastMembershipNumber + 1).ToString();

            var user = new ApplicationUser()
            {
                UserName         = model.Email, Email = model.Email,
                MembershipNumber = nextMembershipNumber
            };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return(GetErrorResult(result));
            }

            var response = new RegisterResultModel()
            {
                MembershipNumber = nextMembershipNumber
            };

            return(Ok(response));
        }
        public virtual RegisterResultModel PrepareRegisterResultModel(int resultId)
        {
            var resultText = "";

            switch ((UserRegistrationType)resultId)
            {
            case UserRegistrationType.Disabled:
                resultText = _localizationService.GetResource("Account.Register.Result.Disabled");
                break;

            case UserRegistrationType.Standard:
                resultText = _localizationService.GetResource("Account.Register.Result.Standard");
                break;

            case UserRegistrationType.AdminApproval:
                resultText = _localizationService.GetResource("Account.Register.Result.AdminApproval");
                break;

            case UserRegistrationType.EmailValidation:
                resultText = _localizationService.GetResource("Account.Register.Result.EmailValidation");
                break;

            default:
                break;
            }
            var model = new RegisterResultModel
            {
                Result = resultText
            };

            return(model);
        }
예제 #6
0
        public ActionResult RegisterResult(int resultId)
        {
            var resultText = "";

            switch ((UserRegistrationType)resultId)
            {
            case UserRegistrationType.Disabled:
                resultText = "Registration is disabled";
                break;

            case UserRegistrationType.Standard:
                resultText = "Standard";
                break;

            case UserRegistrationType.AdminApproval:
                resultText = "Admin Approval";
                break;

            default:
                break;
            }
            var model = new RegisterResultModel
            {
                Result = resultText
            };

            return(View(model));
        }
예제 #7
0
        /// <summary>
        /// Prepare the register result model
        /// </summary>
        /// <param name="resultId">Value of UserRegistrationType enum</param>
        /// <returns>Register result model</returns>
        public RegisterResultModel PrepareRegisterResultModel(int resultId)
        {
            var resultText = "";

            switch ((UserRegistrationType)resultId)
            {
            case UserRegistrationType.Disabled:
                resultText = "Account Disabled";
                break;

            case UserRegistrationType.Standard:
                resultText = "Account Standard";
                break;

            case UserRegistrationType.AdminApproval:
                resultText = "Account AdminApproval";
                break;

            case UserRegistrationType.EmailValidation:
                resultText = "ระบบได้ลงทะเบียนผู้วิจัยเรียบร้อยแล้ว โปรดยืนยันอีเมลของท่าน ก่อนเข้าใช้ระบบงาน!";
                break;

            default:
                break;
            }
            var model = new RegisterResultModel
            {
                Result = resultText
            };

            return(model);
        }
예제 #8
0
        public void CreateMethod()
        {
            // action
            var model = new RegisterResultModel();

            // assert
            Assert.IsNotNull(model);
        }
예제 #9
0
        public void PropertiesTest()
        {
            // preparation
            var model = new RegisterResultModel();

            // model property access
            Helper.ModelTestHelper.PropetiesTest(model);
        }
예제 #10
0
        public ActionResult RegisterClose()
        {
            var model = new RegisterResultModel
            {
                Result = "对不起,社区暂时关闭注册"
            };

            return(View(model));
        }
        /// <summary>
        /// Compares between the two regiseters
        /// +1  for evert correct value
        /// -1 for every unlike value
        /// -0.25 for every null value that has been set by the student
        /// </summary>
        /// <param name="computerSolution"></param>
        /// <param name="studentSolution"></param>
        /// <returns>The student mark</returns>
        public static float CompareRegisters(this RegisterResultModel computerSolution, RegisterResultModel studentSolution)
        {
            //The student mark
            float mark = 0;

            //Correct each filed
            mark += SharedMethods.CompareFiledsAndGetMark(computerSolution.Operation, studentSolution.Operation);

            return(mark);
        }
예제 #12
0
        public ActionResult RegisterResult(int resultId = 1)
        {
            var resultText = _localizationService.GetResource("Account.Register.Result.Standard");
            var model      = new RegisterResultModel
            {
                Result = resultText
            };

            return(View(model));
        }
        /// <summary>
        /// Prepare the register result model
        /// </summary>
        /// <param name="resultId">Value of UserRegistrationType enum</param>
        /// <returns>Register result model</returns>
        public virtual RegisterResultModel PrepareRegisterResultModel(int resultId)
        {
            var resultText = "";

            var model = new RegisterResultModel
            {
                Result = resultText
            };

            return(model);
        }
예제 #14
0
        private async Task <IActionResult> Register(string userUuid)
        {
            var newItem = new UserModel();
            var secret  = Cryption.CreateSecret(userUuid);

            newItem.UserUuid      = userUuid;
            newItem.ProtectSecret = Cryption.Protect(secret);
            await UserRepository.Create(newItem);

            var result = new RegisterResultModel();

            result.UserUuid = userUuid;
            result.Secret   = secret;
            return(new OkObjectResult(result));
        }
예제 #15
0
        private async Task <IActionResult> Register(string userUuid)
        {
            var newItem = new UserModel()
            {
                UserUuid      = userUuid,
                ProtectSecret = DUMMY_PROTECT_SECRET
            };
            await UserRepository.Create(newItem);

            var result = new RegisterResultModel()
            {
                // set dummy infos
                UserUuid           = DUMMY_UUID,
                Secret             = DUMMY_SECRET,
                JumpConsistentSeed = newItem.JumpConsistentSeed,
            };

            return(new OkObjectResult(result));
        }
예제 #16
0
        public async Task <RegisterResultModel> Register(RegisterRequestModel data)
        {
            RegisterResultModel app = await base.Post <RegisterResultModel>("register", null, data);

            return(app);
        }
예제 #17
0
 public void CreateMethod()
 {
     // action
     var model = new RegisterResultModel();
 }