public static void PopulateRandom(int count) { Random r = new Random(); for (int i = 0; i < count; i++) { string first = firstnames[r.Next(firstnames.Length)]; string last = lastnames[r.Next(lastnames.Length)]; PersonV2 tmp = new PersonV2(); tmp.SetNameFirst(first); tmp.SetNameMiddle(""); tmp.SetNameLast(last); tmp.SetStreet1($"{r.Next(4000) + 1} {streets[r.Next(streets.Length)]} {streettype[r.Next(streettype.Length)]}"); tmp.SetStreet2(""); tmp.SetCity(cities[r.Next(cities.Length)]); tmp.SetState(states[r.Next(states.Length)]); tmp.SetZip($"{r.Next(10000, 100000)}"); tmp.SetPhone($"({r.Next(100, 1000)}) {r.Next(100, 1000)}-{r.Next(1000, 10000)}"); tmp.SetEmail($"{first.Substring(0, 1).ToLower()}.{last.ToLower()}@scotticus.gov"); tmp.SetMobile($"({r.Next(100, 1000)}) {r.Next(100, 1000)}-{r.Next(1000, 10000)}"); tmp.SetInstagramURL($"https://instagram.com/{ first + last}"); Program.database.AddPerson(tmp, out bool _); } }
public PersonV2 GetPerson(string GUID) { PersonV2 tmp = new PersonV2(); SQLCommandBuilder command = new SQLCommandBuilder(); command.EditCommand("SELECT"); command.AddParams("FirstName, MiddleName, LastName, Street1, Street2, City, State, Zip, HomePhone, Email, MobilePhone, InstagramURL"); command.EditCommand("FROM", "People"); command.EditCommand("WHERE", "PersonID = @parameter"); SqlCommand comm = new SqlCommand(); comm.CommandText = command.GetSQL(); comm.Parameters.AddWithValue($"@parameter", GUID); DataSet d = ProcessDBRequest(comm, out _); try { tmp.SetNameFirst(d.Tables[0].Rows[0][0].ToString()); tmp.SetNameMiddle(d.Tables[0].Rows[0][1].ToString()); tmp.SetNameLast(d.Tables[0].Rows[0][2].ToString()); tmp.SetStreet1(d.Tables[0].Rows[0][3].ToString()); tmp.SetStreet2(d.Tables[0].Rows[0][4].ToString()); tmp.SetCity(d.Tables[0].Rows[0][5].ToString()); tmp.SetState(d.Tables[0].Rows[0][6].ToString()); tmp.SetZip(d.Tables[0].Rows[0][7].ToString()); tmp.SetPhone(d.Tables[0].Rows[0][8].ToString()); tmp.SetEmail(d.Tables[0].Rows[0][9].ToString()); tmp.SetMobile(d.Tables[0].Rows[0][10].ToString()); tmp.SetInstagramURL(d.Tables[0].Rows[0][11].ToString()); } catch (Exception e) { } return(tmp); }