private static void CreateProviderListFromDataBase() { lstUniqueProvider.Clear(); lstProviders.Clear(); SQLDataActions sqlDA = new SQLDataActions(); //DataTable dt = sqlDA.ReturnProviderList(); DataTable dt = new DataTable(); int originalcount = dt.Rows.Count; foreach (DataRow dr in dt.Rows) { //postgres //lstProvider.Add(new Provider(dr["firstname"].ToString().Trim(), dr["lastname"].ToString().Trim(), dr["firstname"].ToString().Trim() + " " + dr["middleinitial"].ToString().Trim() + " " + dr["lastname"].ToString().Trim(), dr["street"].ToString().Trim(), "", dr["city"].ToString().Trim(), dr["zipcode"].ToString().Trim(), dr["state"].ToString().Trim(), null, false, false, dr["dob"].ToString())); lstProviders.Add(new Providers(dr["name"].ToString().Trim(), dr["street"].ToString().Trim(), "", dr["city"].ToString().Trim(), dr["zip_code"].ToString().Trim(), dr["state"].ToString().Trim(), null, true, false, null, dr["npi"].ToString())); } DistinctListGenerator dlg = new DistinctListGenerator(); lstUniqueProvider = dlg.ReturnUniqueList(lstProviders); int uniquecount = lstUniqueProvider.Count; Console.Out.WriteLine(originalcount.ToString() + " Original Count/" + uniquecount.ToString() + " Unique Count"); }
static void OutputDatabaseSingle(UniqueProvider p, string simpleurl) { SQLDataActions sqlDA = new SQLDataActions(); if (p.PhoneNumbers.Count == 0) { sqlDA.InsertAPIReturnedData(p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, "", "", p.JSON, simpleurl, sessionid, p.NPI); } else { for (int i = 0; i < p.PhoneNumbers.Count; i++) { sqlDA.InsertAPIReturnedData(p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumbers[i], p.LineTypes[i], p.JSON, simpleurl, sessionid, p.NPI); } } }
static void Main(string[] args) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; try { Console.Out.WriteLine("Starting at:" + DateTime.Now.ToString()); string outputmessage = ""; SQLDataActions sqlDA = new SQLDataActions(); sessionid = sqlDA.InsertAPISession(DateTime.Now, -1); //CreateProviderListFromDataBase(); FillProvider(); CallAPI(); //output messages and stuff outputmessage = lstProviders.Count() + " Total Providers"; outputmessage = lstProviders.Count() + " Total Unique Providers"; outputmessage += System.Environment.NewLine + foundcount + " API Identified Providers"; outputmessage += System.Environment.NewLine + notfoundcount + " API Non-Identified Providers"; outputmessage += System.Environment.NewLine + errorcount + " Errored Providers"; outputmessage += System.Environment.NewLine + baddemographicscount + " Bad Demographics Providers (address1 vs address 2)"; Console.Out.WriteLine(outputmessage); //OutputFinals(); //OutputToDatabase(); Console.Out.WriteLine(""); Console.Out.WriteLine(""); Console.Out.Write("The application will exit in 5 seconds..."); System.Threading.Thread.Sleep(5000); Console.Out.WriteLine("Ending at:" + DateTime.Now.ToString()); Console.Out.WriteLine(""); sqlDA.UpdateAPISession(sessionid, DateTime.Now); System.Environment.Exit(0); } catch (Exception ex) { Console.Out.WriteLine("An error occurred: " + ex.Message + " - " + ex.StackTrace); Console.Out.WriteLine(""); Console.Out.WriteLine("Ending at:" + DateTime.Now.ToString()); Console.Out.WriteLine(""); #if DEBUG Console.Out.WriteLine("Press Enter to exit"); string s = Console.ReadLine(); #endif //string s = Console.ReadKey(); SQLDataActions sqlDA = new SQLDataActions(); sqlDA.UpdateAPISession(sessionid, DateTime.Now); System.Environment.Exit(1); } }