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)); }
public Human(string login, string password, bool isStandertView = false) { if (!isStandertView) { StandartView.LoginEr(login); } Login = login; _password = HachPassword(password); }
private void City_Leave(object sender, EventArgs e) { CorrectTextBox(City, enterCity); try { City.Text = StandartView.ConverteToStandartString(City.Text); } catch (Exception) { City.BackColor = Color.Red; } }
private void FerstName_Leave(object sender, EventArgs e) { CorrectTextBox(FirstName, enterFirstName); try { FirstName.Text = StandartView.ConverteToStandartString(FirstName.Text); } catch (Exception) { FirstName.BackColor = Color.Red; } }
private bool IsString(TextBox textBox) { try { StandartView.ConverteToStandartString(textBox.Text); return(true); } catch (Exception) { City.BackColor = Color.Red; return(false); } }
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); }
private bool IsPhoneNumber() => StandartView.IsPhoneNumber(PhoneNumber.Text);
private bool IsLogin() => !(login.Text == enterLogin) && StandartView.IsLogin(login.Text) && _database.IsFreeLoginAdmins(login.Text) && _database.IsFreeLoginClients(login.Text);