public Client GenerateСlient(string city = null)
        {
            var responseMessage = _httpClient.GetAsync("https://randomuser.me/api/?inc=gender,name,location,login,dob,nat=gb&noinfo").Result;

            var contentString = responseMessage.Content.ReadAsStringAsync().Result;

            // я так и не понял почему я не могу обойтись без листа
            var a = JsonSerializer.Deserialize <Root>(contentString).results.First();

            var result = new string[7];

            result[0] = a.login.username;

            result[1] = a.login.password;

            result[2] = a.name.last + ' ' + a.name.first;

            result[3] = a.gender;

            result[4] = a.dob.date.ToShortDateString();

            // не смог использовать ??  кишки тонки
            result[5] = (city == null) ? a.location.city : StandartView.ConverteToStandartString(city);

            result[6] = GeneratePhoneNumber();

            return(new Client(result[0], result[1], result[2], result[3], result[4], result[5], result[6], true));
        }
Exemple #2
0
        public Human(string login, string password, bool isStandertView = false)
        {
            if (!isStandertView)
            {
                StandartView.LoginEr(login);
            }

            Login = login;

            _password = HachPassword(password);
        }
Exemple #3
0
 private void City_Leave(object sender, EventArgs e)
 {
     CorrectTextBox(City, enterCity);
     try
     {
         City.Text = StandartView.ConverteToStandartString(City.Text);
     }
     catch (Exception)
     {
         City.BackColor = Color.Red;
     }
 }
Exemple #4
0
 private void FerstName_Leave(object sender, EventArgs e)
 {
     CorrectTextBox(FirstName, enterFirstName);
     try
     {
         FirstName.Text = StandartView.ConverteToStandartString(FirstName.Text);
     }
     catch (Exception)
     {
         FirstName.BackColor = Color.Red;
     }
 }
Exemple #5
0
        private bool IsString(TextBox textBox)
        {
            try
            {
                StandartView.ConverteToStandartString(textBox.Text);

                return(true);
            }
            catch (Exception)
            {
                City.BackColor = Color.Red;

                return(false);
            }
        }
Exemple #6
0
        public Client(string login, string password, string myFulName, string sex, string myBirthday,
                      string myCity, string myPhoneNumber, bool isStandartView = false) : base(login, password, isStandartView)
        {
            MyFulName = new FulName(myFulName, isStandartView);

            MyBirthday = StandartView.ConverteStringToDate(myBirthday);

            MyCity = (isStandartView) ? myCity : StandartView.ConverteToStandartString(myCity);

            MyPhoneNumber = (isStandartView) ? myPhoneNumber : StandartView.ConverteToStandartPhoneNumber(myPhoneNumber);

            MySex = new Gender(sex);

            MyZodiacSign = new ZodiacSign(MyBirthday);

            MyCompatibilityByName = new СompatibilityByName(MyFulName.FirstName);
        }
Exemple #7
0
 private bool IsPhoneNumber() => StandartView.IsPhoneNumber(PhoneNumber.Text);
Exemple #8
0
 private bool IsLogin() => !(login.Text == enterLogin) && StandartView.IsLogin(login.Text) &&
 _database.IsFreeLoginAdmins(login.Text) && _database.IsFreeLoginClients(login.Text);