private void cbbDistrict_SelectedIndexChanged(object sender, EventArgs e)
        {
            string DistrictNametemp = cbbDistrict.SelectedItem.ToString();
            string DistrictName     = "";

            if (DistrictNametemp.Contains("Thành Phố"))
            {
                DistrictName = DistrictNametemp.Substring(10);
            }
            if (DistrictNametemp.Contains("Huyện"))
            {
                DistrictName = DistrictNametemp.Substring(6);
            }
            if (DistrictNametemp.Contains("Quận"))
            {
                DistrictName = DistrictNametemp.Substring(5);
            }
            if (DistrictNametemp.Contains("Thị Xã"))
            {
                DistrictName = DistrictNametemp.Substring(7);
            }
            DataTable dt     = SignUpController.IDDistrict_Find(DistrictName).Tables[0];
            string    IDTemp = dt.Rows[0][0].ToString();
            int       ID     = int.Parse(IDTemp);

            DataTable Ward = SignUpController.Ward_Show(ID).Tables[0];

            cbbWard.Items.Clear();
            foreach (DataRow dr in Ward.Rows)
            {
                string temp = dr["WardName"].ToString();
                cbbWard.Items.Add(temp);
            }
        }
Esempio n. 2
0
    public void ValidateUniqueEmailCheckInDatabase()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "simple";
        request.Phone       = "12345678901";
        request.Sandbox_Key = "123";
        Enrollees enrollee = new Enrollees();

        if (enrollee.get_enrollees($" where email = '{request.Email}'").Count == 0)
        {
            Enrollees_Table enrolleesData = new Enrollees_Table();
// please either try to check this email for every test or delete it's record from the database
            enrolleesData.Email      = "*****@*****.**";
            enrolleesData.First_name = "simple";
            enrolleesData.Last_name  = "simple";
            enrolleesData.Phone      = "12345678901";
            enrollee.add_enrollees(enrolleesData);
        }
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Response == "Failed" && response.Message == "Enrollee data already exists" ? "true":"false"));
    }
Esempio n. 3
0
        public void SignUp_RedirectsGetToHome()
        {
            var controller = new SignUpController(configuration, signUpQueueingService, charityMembershipService);
            var result     = controller.SignUp();

            result.AssertActionRedirect();
        }
Esempio n. 4
0
        public async Task CompleteWithEmailAsync_ShouldConfirmEmail_AndSignIn_AndRedirect()
        {
            var signUpMessageSenderMock = new Mock <ISignUpMessageSender>();
            var userStoreMock           = new Mock <IUserStore <User> >();
            var userManagerMock         = new Mock <UserManager <User> >(userStoreMock.Object, null, null, null, null, null, null, null, null);
            var signInManagerMock       = new Mock <SignInManager <User> >(userManagerMock.Object,
                                                                           new Mock <IHttpContextAccessor>().Object,
                                                                           new Mock <IUserClaimsPrincipalFactory <User> >().Object,
                                                                           new Mock <IOptions <IdentityOptions> >().Object,
                                                                           new Mock <ILogger <SignInManager <User> > >().Object,
                                                                           new Mock <IAuthenticationSchemeProvider>().Object,
                                                                           new Mock <IUserConfirmation <User> >().Object);

            userManagerMock.Setup(m => m.FindByEmailAsync(It.IsAny <string>())).ReturnsAsync(new User());
            userManagerMock.Setup(m => m.ConfirmEmailAsync(It.IsAny <User>(), It.IsAny <string>())).ReturnsAsync(IdentityResult.Success);

            using (var controller = new SignUpController(userManagerMock.Object, signInManagerMock.Object, signUpMessageSenderMock.Object))
            {
                IActionResult actionResult = await controller.CompleteWithEmailAsync(new SignUpCompleteWithEmailViewModel());

                userManagerMock.Verify(m => m.ConfirmEmailAsync(It.IsAny <User>(), It.IsAny <string>()));
                signInManagerMock.Verify(m => m.SignInAsync(It.IsAny <User>(), It.IsAny <bool>(), It.IsAny <string>()));
                Assert.IsType <RedirectResult>(actionResult);
            }
        }
Esempio n. 5
0
        public void StartSite_RendersView()
        {
            var controller = new SignUpController(configuration, signUpQueueingService, charityMembershipService);
            var result     = controller.StartSite("");

            result.AssertViewRendered().WithViewData <StartSiteViewModel>();
        }
Esempio n. 6
0
        public void StoreAdditionalInfo_RendersView()
        {
            var controller = new SignUpController(configuration, signUpQueueingService, charityMembershipService);
            var result     = controller.StoreAdditionalInfo(new CompleteViewModel());

            result.AssertViewRendered().WithViewData <CompleteViewModel>();
        }
        private void cbbProvince_SelectedIndexChanged(object sender, EventArgs e)
        {
            string ProvinceNametemp = cbbProvince.SelectedItem.ToString();
            string ProvinceName     = "";

            if (ProvinceNametemp.Contains("Tỉnh"))
            {
                ProvinceName = ProvinceNametemp.Substring(5);
            }
            if (ProvinceNametemp.Contains("Thành Phố"))
            {
                ProvinceName = ProvinceNametemp.Substring(10);
            }
            DataTable dt     = SignUpController.IDProvince_Find(ProvinceName).Tables[0];
            string    IDTemp = dt.Rows[0][0].ToString();
            int       ID     = int.Parse(IDTemp);

            DataTable District = SignUpController.District_Show(ID).Tables[0];

            cbbDistrict.Items.Clear();
            foreach (DataRow dr in District.Rows)
            {
                string temp = dr["DistrictName"].ToString();
                cbbDistrict.Items.Add(temp);
            }
        }
        public static IntermediaryDataSet_IntermediaryDTO GetInstance(object key, string jbID)
        {
            if (key == null)
            {
                return(null);
            }
            var rawKey     = key.ToString();
            var parsedKey  = int.Parse(rawKey);
            var foundEntry = new DAL.Repository().GetById <DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary>(parsedKey, false);

            if (foundEntry == null && !string.IsNullOrWhiteSpace(jbID))
            {
                if (int.TryParse(rawKey, out int _uniqueKey))
                {
                    var controller = new SignUpController();
                    var method     = controller.GetType().GetMethod($"Get_{jbID}_DatasourceQueryable");
                    var records    = method.Invoke(controller, new object[] { null }) as IQueryable <DSS5_SupplyChainFinancialsOptimisation.BO.Intermediary>;
                    foundEntry = records.Where(c => c._GetUniqueIdentifier() == _uniqueKey).FirstOrDefault();
                }
            }
            if (foundEntry != null)
            {
                return(new IntermediaryDataSet_IntermediaryDTO(foundEntry));
            }
            return(null);
        }
Esempio n. 9
0
        private void CreateUser_Click(object sender, EventArgs e)
        {
            SignUpController suc = new SignUpController();

            if (textBox1.Text.Length < 3 && textBox2.Text.Length < 3 && textBox3.Text.Length < 3)
            {
                MessageBox.Show("First Name,Last Name,Father Name Should be at least 3 characters");
            }
            else if (textBox5.Text.Length < 18)
            {
                MessageBox.Show("NIC should be at least 18 characters");
            }
            else if (textBox7.Text.Length < 13 && textBox9.Text.Length < 13)
            {
                MessageBox.Show("Permenant and Temporary Email should contain minimum 13 characters and containing @ and .com in it");
            }
            else if (textBox8.Text.Length < 5 && textBox4.Text.Length < 5 && textBox6.Text.Length < 5 && textBox11.Text.Length < 5)
            {
                MessageBox.Show("Permanant and Temporary Address,Country and City should be at least 5 characters");
            }
            else if (textBox12.Text.Length < 5)
            {
                MessageBox.Show("Postal Code Should at least 5 characters");
            }
            else if (textBox13.Text.Length < 11)
            {
                MessageBox.Show("Cell no Should Be min and max 11 characters");
            }
            else if (textBox14.Text.Length < 6 && textBox15.Text.Length < 6)
            {
                MessageBox.Show("Password Should be atleast 6 characters");
            }
            else if (textBox14.Text != textBox15.Text)
            {
                MessageBox.Show("The Password and Confirm Password do not match");
            }
            else if (textBox14.Text == textBox15.Text)
            {
                suc.NewUser(comboBox2.Text, textBox1.Text, textBox2.Text, textBox3.Text, comboBox1.Text, textBox5.Text, DateTime.Parse(dateTimePicker1.Text), textBox7.Text, textBox9.Text, textBox8.Text, textBox4.Text, textBox6.Text, textBox11.Text, int.Parse(textBox12.Text), textBox13.Text, textBox15.Text);
                MessageBox.Show("User Created");
                //textBox10.Clear();
                comboBox2.Text = "";
                textBox1.Clear();
                textBox2.Clear();
                textBox3.Clear();
                comboBox1.Text = "";
                textBox5.Clear();
                dateTimePicker1.ResetText();
                textBox7.Clear();
                textBox9.Clear();
                textBox8.Clear();
                textBox4.Clear();
                textBox6.Clear();
                textBox11.Clear();
                textBox12.Clear();
                textBox13.Clear();
                textBox14.Clear();
            }
        }
        private async void _SignUp_Clicked(object sender, EventArgs e)
        {
            Dictionary <int, String[]> KeyValues = new Dictionary <int, string[]>();
            bool IsCompleted = false;

            try
            {
                KeyValues.Add(0, new String[] { "full_name", _FullName.Text });
                KeyValues.Add(1, new String[] { "gender", (_Gender.SelectedItem.Equals("Male")) ? "m" : "f" });
                KeyValues.Add(2, new String[] { "phone", GD.Phone });
                KeyValues.Add(3, new String[] { "address", _HomeAddress.Text });
                KeyValues.Add(4, new String[] { "dob", _DOB.Date.ToString("yyyy-MM-dd") });
                KeyValues.Add(5, new String[] { "password", GD.Password });
                KeyValues.Add(6, new String[] { "username", _Username.Text });
                if (!String.IsNullOrEmpty(GD.Email))
                {
                    KeyValues.Add(7, new String[] { "email", GD.Email });
                }
                KeyValues.Add(8, new String[] { "blood_group", _BloodGroup.SelectedItem.ToString() });
                KeyValues.Add(9, new String[] { "is_medic", "0" });

                IsCompleted = true;
            }
            catch
            {
                await DisplayAlert("Alert", "Please Fill All Fields", "Okay");
            }

            if (IsCompleted)
            {
                FormUrlEncodedContent Data = Utilities.PostDataEncoder(KeyValues);
                try
                {
                    //get the result of the signup 0 = status, 1 = message
                    var Result = await SignUpController.SignUp(Data);

                    if (Convert.ToBoolean(Result[0]))
                    {
                        await Utilities.CreateAlertDialog("Alert", Result[1].ToString(), "Ok", delegate
                        {
                            Navigation.PushAsync(new LoginPage());
                            Navigation.RemovePage(this);
                        });
                    }
                    else
                    {
                        await DisplayAlert("Alert", Result[1].ToString(), "Okay");
                    }
                }
                catch (System.Net.WebException WebEx)
                {
                    await DisplayAlert("Alert", "Unable to connect to the server, Please check the internet connection. ", "Okay");
                }
                catch (Exception ex)
                {
                    await DisplayAlert("Alert", "UPDP Error, Please Contact Admin " + ex.Message, "Okay");
                }
            }
        }
Esempio n. 11
0
        public void Index()
        {
            SignUpController controller = new SignUpController(_userRepoMock.Object);
            ViewResult       result     = controller.Index();

            Assert.IsNotNull(result);
            Assert.IsTrue(result.ViewName == "");
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            signUp      = new SignUpController();
            userControl = new UserCtrl();

            if (IsPostBack)
            {
                ResultLabel.Visible = true;
            }

            if (!IsPostBack)
            {
                EditProfileTitle.Visible = false;

                //if (Session["name"]!= null)
                if (Page.PreviousPage == null && Session["name"] != null)
                {
                    //Manage title and button visibility for Edit Profile
                    EditProfileBtn.Visible   = true;
                    SignUpBtn.Visible        = false;
                    BackButton.Visible       = true;
                    SignUpTitle.Visible      = false;
                    EditProfileTitle.Visible = true;
                    ResultLabel.Visible      = false;

                    email.ReadOnly     = true;
                    confEmail.ReadOnly = true;
                    string emailString = Session["name"].ToString();

                    u = userControl.getProfileInfo(emailString);

                    email.Text     = u.Email;
                    confEmail.Text = u.Email;
                    firstName.Text = u.FirstName;
                    lastName.Text  = u.LastName;
                    address.Text   = u.Address;
                    city.Text      = u.City;
                    DropDownList1.SelectedValue = u.State;
                    zipCode.Text = u.Zip.ToString();
                    //Phone.Text = u.Phone;
                    MobilePhone.Text    = u.Phone;
                    checkToText.Checked = u.Text;
                }
            }

            ServiceReference1.SUSMSClient isuService = new ServiceReference1.SUSMSClient();

            string[] carriers = isuService.getCarriers();

            if (carriers.Length > 0 && CarrierList.Items.Count <= 1)
            {
                foreach (string carrier in carriers)
                {
                    CarrierList.Items.Add(new ListItem(carrier, carrier));
                }
            }
        }
        private void Login_Click(object sender, EventArgs e)
        {
            SignUpController suc = new SignUpController();

            if (textBox14.Text == textBox15.Text)
            {
                suc.NewUser(textBox10.Text, textBox1.Text, textBox2.Text, textBox3.Text, comboBox1.Text, textBox5.Text, DateTime.Parse(dateTimePicker1.Text), textBox7.Text, textBox9.Text, textBox8.Text, textBox4.Text, textBox6.Text, textBox11.Text, int.Parse(textBox12.Text), textBox13.Text, textBox15.Text);
                MessageBox.Show("User Created");
            }
        }
Esempio n. 14
0
        public void SetUp()
        {
            _fakeSignUpService = A.Fake <ISignUpService>();
            _fakeLoginService  = A.Fake <ILoginService>();
            var _fakeBookwormDbContext = A.Fake <BookwormDbContext>();

            _signUpController = new SignUpController(_fakeSignUpService);
            _fakeRepository   = new Repository <User>(_fakeBookwormDbContext);
            _validator        = A.Fake <SignUpValidator>();
        }
Esempio n. 15
0
 public GeneralForm(String UserType)
 {
     InitializeComponent();
     this.UserType = UserType;
     //_CountryCode.Items.Add("+234");
     //_CountryCode.Items.Add("+235");
     //_CountryCode.Items.Add("+236");
     //_CountryCode.Items.Add("+237");
     SignUpController.CallingCode(this, _CountryCode);
     //_CountryCode.SelectedIndex = 0;
 }
Esempio n. 16
0
 public void Setup()
 {
     _repository            = new MockRepository(MockBehavior.Strict);
     _mockCustomMessage     = _repository.Create <ICustomMessage>();
     _mockUsuarioService    = _repository.Create <IUsuarioService>();
     _mockUow               = _repository.Create <IUnitOfWork>();
     _mockCriptografia      = _repository.Create <ICriptografia>();
     _mockJwt               = _repository.Create <IJwt>();
     _mockUsuarioRepository = _repository.Create <IUsuarioRepository>();
     _signUpController      = new SignUpController(_mockUsuarioService.Object, _mockCustomMessage.Object, _mockCriptografia.Object, _mockJwt.Object, _mockUow.Object);
 }
Esempio n. 17
0
        public void SignUp_ModelStateNotValid()
        {
            SignUpController controller = new SignUpController(_userRepoMock.Object);
            SignUp           signUpUser = new SignUp();

            SetModelState(signUpUser, controller);

            ActionResult result = controller.SignUp(signUpUser);

            Assert.IsNotNull(result);
            Assert.IsTrue(result is ViewResult);
            Assert.IsTrue((result as ViewResult).ViewName == "Index");
        }
        public Registration()
        {
            InitializeComponent();

            SC = new SignUpController(this);

            GM = new Controller.GMapControl();

            Registration1.Visible = true;
            Registration2.Visible = false;
            Registration3.Visible = false;
            Registration4.Visible = false;
        }
Esempio n. 19
0
        private void BtnSignUp_Click(object sender, EventArgs e)
        {
            if (SignUpController.CriarConta(Convert.ToInt32(TextBoxAgency.Text), TextBoxAccountType.Text, TextBoxUser.Text, TextBoxPassword.Text))
            {
                MessageBox.Show("Account successfully created");
            }
            else
            {
                MessageBox.Show("Could not create an account");
            }

            OpenHome();
        }
Esempio n. 20
0
        private void cbbProvince_Click(object sender, EventArgs e)
        {
            DataSet   dataSet = SignUpController.Province_Show();
            DataTable dt      = new DataTable();

            dt = dataSet.Tables[0] as DataTable;
            cbbProvince.Items.Clear();
            foreach (DataRow dr in dt.Rows)
            {
                string temp = dr["ProvinceName"].ToString();
                cbbProvince.Items.Add(temp);
            }
        }
        public async Task SendSignUpMessageAsync_ShouldReturnBadRequest_WithModelState_WhenUserIsNotFound()
        {
            var signUpMessageSenderMock = new Mock <ISignUpMessageSender>();
            var userStoreMock           = new Mock <IUserStore <User> >();
            var userManagerMock         = new Mock <UserManager <User> >(userStoreMock.Object, null, null, null, null, null, null, null, null);

            using (var controller = new SignUpController(userManagerMock.Object, null, signUpMessageSenderMock.Object))
            {
                IActionResult actionResult = await controller.SendEmailMessageAsync(new SignUpSendEmailMessageViewModel());

                var badRequestObjectResult = Assert.IsType <BadRequestObjectResult>(actionResult);
                Assert.IsType <SerializableError>(badRequestObjectResult.Value);
            }
        }
Esempio n. 22
0
    public void LastNameLessThanOneCharacter()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "";
        request.Phone       = "";
        request.Sandbox_Key = "";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Response == "Failed" && response.Message == "Invalid last name" ? "true":"false"));
    }
Esempio n. 23
0
    public void EmailLessThanFiveCharacter()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "abc";
        request.FirstName   = "";
        request.LastName    = "";
        request.Phone       = "";
        request.Sandbox_Key = "";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Response == "Failed" && response.Message == "Invalid email address" ? "true":"false"));
    }
Esempio n. 24
0
    public void PhoneBewteenIsElevenCharacter()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "simple";
        request.Phone       = "12345678901";
        request.Sandbox_Key = "";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Message != "Invalid phone number" ? "true":"false"));
    }
Esempio n. 25
0
    public void SandboxKeyEntered()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "simple";
        request.Phone       = "12345678901";
        request.Sandbox_Key = "123";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Message != "Invalid sandbox key" ? "true":"false"));
    }
Esempio n. 26
0
    public void SubmitPost()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "simple";
        request.Phone       = "12345678901";
        request.Sandbox_Key = "2";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Response == "Successful" && response.Message == "Enrollee data captured successfully" ? "true":"false"));
    }
Esempio n. 27
0
    public void FirstNameGreaterThanTwentyCharacter()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "abcdefghijklmnopqrstuvwxyz";
        request.LastName    = "";
        request.Phone       = "";
        request.Sandbox_Key = "";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Response == "Failed" && response.Message == "Invalid first name" ? "true":"false"));
    }
Esempio n. 28
0
    public void FirstNameBewteen_1_AndTwentyCharacter()
    {
        SignUpController signUp  = new SignUpController();
        RequestMessage   request = new RequestMessage();

        request.Email       = "*****@*****.**";
        request.FirstName   = "simple";
        request.LastName    = "";
        request.Phone       = "";
        request.Sandbox_Key = "";
        ResponsMessage response = signUp.NewPlanSubscription(request);

        Assert.Equal("true", (response.Message != "Invalid first name" ? "true":"false"));
    }
        public async Task PostAsync_ShouldReturnBadRequest_WithModelState_WhenUserIsNotCreated()
        {
            var userStoreMock   = new Mock <IUserStore <User> >();
            var userManagerMock = new Mock <UserManager <User> >(userStoreMock.Object, null, null, null, null, null, null, null, null);

            userManagerMock.Setup(m => m.CreateAsync(It.IsAny <User>(), It.IsAny <string>())).ReturnsAsync(IdentityResult.Failed());

            using (var controller = new SignUpController(userManagerMock.Object, null, null))
            {
                IActionResult actionResult = await controller.PostAsync(new SignUpPostViewModel());

                var badRequestObjectResult = Assert.IsType <BadRequestObjectResult>(actionResult);
                Assert.IsType <SerializableError>(badRequestObjectResult.Value);
            }
        }
Esempio n. 30
0
        public void ValidateModel()
        {
            IEnumerable <SiteFormField> data = new List <SiteFormField> {
                new SiteFormField {
                    Name = "DATA[EDU_NAME]", Value = "Анатомия мышечной системы: практическое занятие на макете"
                },
                new SiteFormField {
                    Name = "DATA[NAME]", Value = "Илья"
                },
                new SiteFormField {
                    Name = "DATA[PHONE][]", Value = "89031453412"
                },
                new SiteFormField {
                    Name = "DATA[EMAIL][]", Value = "*****@*****.**"
                },
                new SiteFormField {
                    Name = "DATA[PRICE]", Value = ""
                }
            };

            var             map = new TypeAdapterConfig();
            Map_FormToModel m   = new Map_FormToModel(map);

            var controller = new SignUpController(map, null, null);

            var result = controller.GivenFromSiteForm(data);

            Assert.IsInstanceOfType(result.Result, typeof(OkResult));

            IEnumerable <SiteFormField> data2 = new List <SiteFormField> {
                new SiteFormField {
                    Name = "DATA[NAME]", Value = "Илья"
                },
                new SiteFormField {
                    Name = "DATA[EMAIL][]", Value = "*****@*****.**"
                }
            };

            var controller2 = new SignUpController(map, null, null);

            dynamic result2 = controller.GivenFromSiteForm(data2);

            Assert.IsInstanceOfType(result2.Result, typeof(BadRequestObjectResult));

            Assert.AreEqual(result2.Result.Value.Count, 1);

            Assert.AreEqual(result2.Result.Value["Данные формы"][0], "Не указан телефон пользователя");
        }