Exemplo n.º 1
0
 public static AccountBase Create(ChooseAccount choice, AccountCredentials credit, AccountNavigation navig)
 {
     AccountBase acc = null;
     switch (choice)
     {
         case ChooseAccount.Main:
             {
                 credit = Framework.Inst.CredentialsList[0];
                 credit.AccountId = 1;
                 acc = new BossaAccount(credit, navig);
                 break;
             }
         case ChooseAccount.Account1:
             {
                 credit = Framework.Inst.CredentialsList[1];
                 credit.AccountId = 2;
                 acc = new BossaAccount(credit, navig);
                 break;
             }
     //    case ChooseAccount.Test:
     //        {
     //            if(credit == null)
     //                credit = new Credentials();
                 
     //            acc = new BossaAccount(credit, navig);
     //            break;
     //        }
     }
     
     return acc;
 }
Exemplo n.º 2
0
        internal void UserRegistration()
        {
            //Start the Add address test
            Base.test = Base.extent.StartTest("User Registration");

            //Populating the Excel sheet
            Global.ExcelLib.PopulateInCollection(Global.Base.ExcelPath, "Registration");

            GlobalDefinition.wait(500);

            //Navigate to the Url
            GlobalDefinition.driver.Navigate().GoToUrl(ExcelLib.ReadData(2, "Url"));
            GlobalDefinition.wait(500);

            Global.GlobalDefinition.driver.Manage().Window.Maximize();

            //Click on Sign Up Link
            SignupLink.Click();
            GlobalDefinition.wait(500);

            //Enter Firstname
            FirstName.SendKeys(ExcelLib.ReadData(2, "FirstName"));
            GlobalDefinition.wait(500);

            //Enter lastname
            LastName.SendKeys(ExcelLib.ReadData(2, "LastName"));
            GlobalDefinition.wait(500);

            //Enter the Username
            EmailAddress.SendKeys(ExcelLib.ReadData(2, "EmailAddress"));
            GlobalDefinition.wait(500);

            //Enter the password
            Password.SendKeys(ExcelLib.ReadData(2, "Password"));
            GlobalDefinition.wait(1000);

            //Click on Choose Account
            ChooseAccount.Click();
            GlobalDefinition.wait(500);

            //Select Property Owner
            PropertyOwner.Click();
            GlobalDefinition.wait(1000);

            //Check TermsnConditionCheckbox
            TermsnConditionsCheckbox.Click();
            GlobalDefinition.wait(1000);

            // Click on SignUp Button
            SignupButton.Click();


            //Screenshot
            Global.SaveScreenShotClass.SaveScreenshot(GlobalDefinition.driver, "RegistrationPage");

            //Reports
            Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Pass, "Registration successfull");
        }
Exemplo n.º 3
0
 public static AccountBase Create(ChooseAccount choice)
 {
     AccountNavigation navig = new AccountNavigation();
     return Create(choice, null, navig);
 }
Exemplo n.º 4
0
 private void LoginButtonClicked(object sender, RoutedEventArgs routedEvent)
 {
     AccountActivate.IsRegister = false;
     CreateLoginFromInputData();
     if (ValidateDataLogin())
     {
         string passwordEncryption = Utils.Security.Encrypt(login.password);
         login.password = passwordEncryption;
         string     urlBase = "http://127.0.0.1:5000/";
         RestClient client  = new RestClient(urlBase);
         client.Timeout = -1;
         var request = new RestRequest("logins", Method.POST);
         var json    = JsonConvert.SerializeObject(login);
         request.AddParameter("application/json", json, ParameterType.RequestBody);
         System.Net.ServicePointManager.ServerCertificateValidationCallback = (senderX, certificate, chain, sslPolicyErrors) => { return(true); };
         try
         {
             IRestResponse response = client.Execute(request);
             if (response.StatusCode == System.Net.HttpStatusCode.Created || response.StatusCode == System.Net.HttpStatusCode.OK)
             {
                 Models.Token token = JsonConvert.DeserializeObject <Models.Token>(response.Content);
                 cookies      = response.Cookies;
                 tokenAccount = token;
                 loginAccount = login;
                 if (token.memberATEType == Number.NumberValue(NumberValues.TWO))
                 {
                     ChooseAccount chooseAccount = new ChooseAccount();
                     chooseAccount.InitializeHome();
                     chooseAccount.Show();
                     Close();
                 }
                 else
                 {
                     if (token.memberATEType == Number.NumberValue(NumberValues.THREE))
                     {
                         HomeManager home = new HomeManager();
                         home.Show();
                         Close();
                     }
                     else
                     {
                         HomeClient home = new HomeClient();
                         home.InitializeMenu();
                         home.Show();
                         Close();
                     }
                 }
             }
             else
             {
                 Models.Error responseError = JsonConvert.DeserializeObject <Models.Error>(response.Content);
                 MessageBox.Show(responseError.error, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
         catch (Exception exception)
         {
             TelegramBot.SendToTelegram(exception);
             LogException.Log(this, exception);
             MessageBox.Show(exception.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
         }
     }
     else
     {
         MessageBox.Show("Por favor, Ingrese datos correctos en los campos marcados en rojo", "Datos Incorrectos", MessageBoxButton.OK, MessageBoxImage.Warning);
     }
 }
Exemplo n.º 5
0
        public string Account(ChooseAccount model)
        {
            Session["Account"] = model.Account;

            return(model.Account);
        }