static void OutputDatabaseSingle(UniquePerson p, string simpleurl) { SQLDataActions sqlDA = new SQLDataActions(); sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber, p.LineType, p.JSON, simpleurl, p.ContractNumber, sessionid); if (p.PhoneNumber2.Length > 0) { sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber2, p.LineType2, p.JSON, simpleurl, p.ContractNumber, sessionid); } if (p.PhoneNumber3.Length > 0) { sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber3, p.LineType3, p.JSON, simpleurl, p.ContractNumber, sessionid); } }
public static void OutputToDatabase() { SQLDataActions sqlDA = new SQLDataActions(); foreach (UniquePerson p in lstUniquePerson) { sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber, p.LineType, p.JSON, p.Request, p.ContractNumber, sessionid); if (p.PhoneNumber2.Length > 0) { sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber2, p.LineType2, p.JSON, p.Request, p.ContractNumber, sessionid); } if (p.PhoneNumber3.Length > 0) { sqlDA.InsertAPIReturnedData(p.PMDPatientID, p.PMDClientID, p.DOB, p.Name, p.Address, p.Address2, p.City, p.State, p.PostalCode, p.PhoneNumber3, p.LineType3, p.JSON, p.Request, p.ContractNumber, sessionid); } } }
static void RemovePreviouslyCalledPeople(int pmdClientID) { SQLDataActions sqlDA = new SQLDataActions(); DataTable dt = sqlDA.ReturnWhitePagesListByClient(pmdClientID); int removedcount = 0; Console.Out.WriteLine(""); Console.Out.WriteLine("******"); Console.Out.WriteLine("Before Previously Called Removal: " + lstUniquePerson.Count.ToString()); foreach (DataRow dr in dt.Rows) { //string pmdpatientid = dr["pmd_patient_id"].ToString(); string pmdpatientid = dr["pmdpatientid"].ToString(); lstUniquePerson.RemoveAll(x => x.PMDPatientID == pmdpatientid); } Console.Out.WriteLine("After Previously Called Removal: " + lstUniquePerson.Count.ToString()); Console.Out.WriteLine("******"); Console.Out.WriteLine(""); }
static void MTMPiece(string[] args) { pmdClientID = -4; Arguments a = new Arguments(); a.ProcessArguments(args); if (a.inputType == "0" || a.inputType == "1") { SQLDataActions sda = new SQLDataActions(); //overwrite the client list from the whitepages table; //BW 10/24/2018 DataTable dt = sda.GetWhitePagesClients(); lstMTMClients.Clear(); foreach (DataRow row in dt.Rows) { if (row["producttype"].ToString() == "MTM") { lstMTMClients.Add(Convert.ToInt32(row["clientid"])); } } ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; if (a.Errored == false) { pmdClientID = Convert.ToInt32(a.inputPMDClientID); if (pmdClientID == -1) { foreach (int i in lstMTMClients) { foundcount = notfoundcount = errorcount = baddemographicscount = 0; int pmdClientID = i; Console.Out.WriteLine("PMDClientID: " + pmdClientID.ToString()); Console.Out.WriteLine("Starting at:" + DateTime.Now.ToString()); string outputmessage = ""; try { if (a.inputPMDMode == "1") { CreatePersonListFromDataBase(true, pmdClientID); } else if (a.inputPMDMode == "2") { CreatePersonFileFromManualList(); } /* * if (pmdClientID == 54) * { * RemovePreviouslyCalledPeople(pmdClientID); * } */ SQLDataActions sqlDA = new SQLDataActions(); sessionid = sqlDA.InsertAPISession(DateTime.Now, pmdClientID); CallAPI(); //output messages and stuff outputmessage = lstPerson.Count() + " Total People"; outputmessage = lstUniquePerson.Count() + " Total Unique People"; outputmessage += System.Environment.NewLine + foundcount + " API Identified People"; outputmessage += System.Environment.NewLine + notfoundcount + " API Non-Identified People"; outputmessage += System.Environment.NewLine + errorcount + " Errored People"; outputmessage += System.Environment.NewLine + baddemographicscount + " Bad Demographics People (address1 vs address 2)"; Console.Out.WriteLine(outputmessage); Console.Out.WriteLine("Ending at:" + DateTime.Now.ToString()); Console.Out.WriteLine(""); sqlDA.UpdateAPISession(sessionid, DateTime.Now); } 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(""); Console.Out.WriteLine("Press Enter to exit"); //string s = Console.ReadKey(); #if DEBUG string s = Console.ReadLine(); #endif SQLDataActions sqlDA = new SQLDataActions(); sqlDA.UpdateAPISession(sessionid, DateTime.Now); System.Environment.Exit(1); } } } else { Console.Out.WriteLine("Starting at:" + DateTime.Now.ToString()); string outputmessage = ""; try { //temp for cynthia's meridian person //FillPerson(); //Highmark Formulary //CreatePersonListFromFile(); //query the ODS data store for patient information by client if (a.inputPMDMode == "1") { CreatePersonListFromDataBase(true, Convert.ToInt32(a.inputPMDClientID)); } else if (a.inputPMDMode == "2") { CreatePersonFileFromManualList(); } //Highmark Formulary - remove people we have already used for that special project /* * if (pmdClientID == 54) * { * RemovePreviouslyCalledPeople(pmdClientID); * } */ SQLDataActions sqlDA = new SQLDataActions(); sessionid = sqlDA.InsertAPISession(DateTime.Now, pmdClientID); //THE call to the White Pages API CallAPI(); //output messages and stuff outputmessage = lstPerson.Count() + " Total People"; outputmessage = lstUniquePerson.Count() + " Total Unique People"; outputmessage += System.Environment.NewLine + foundcount + " API Identified People"; outputmessage += System.Environment.NewLine + notfoundcount + " API Non-Identified People"; outputmessage += System.Environment.NewLine + errorcount + " Errored People"; outputmessage += System.Environment.NewLine + baddemographicscount + " Bad Demographics People (address1 vs address 2)"; Console.Out.WriteLine(outputmessage); //OutputFinals(); //OutputToDatabase(); Console.Out.WriteLine("Ending at:" + DateTime.Now.ToString()); Console.Out.WriteLine(""); sqlDA.UpdateAPISession(sessionid, DateTime.Now); } 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 string s = Console.ReadLine(); Console.Out.WriteLine("Press Enter to exit"); #endif //string s = Console.ReadKey(); SQLDataActions sqlDA = new SQLDataActions(); sqlDA.UpdateAPISession(sessionid, DateTime.Now); System.Environment.Exit(1); } } } else { Console.Out.WriteLine(""); Console.Out.WriteLine(""); #if DEBUG Console.Out.WriteLine("Press Enter to exit"); string s = Console.ReadLine(); #endif //string s = Console.ReadKey(); System.Environment.Exit(1); } } }
static void CreatePersonListFromDataBase(bool ismtm, int pmdClientID) { lstUniquePerson.Clear(); lstPerson.Clear(); SQLDataActions sqlDA = new SQLDataActions(); int originalcount = 0; //taking out as of 8/20/19 BDW /* * //DataTable dt = sqlDA.ReturnDemographicsDataPostGres(pmdClientID); * DataTable dt = sqlDA.ReturnDemographicsDataODS(pmdClientID); * * originalcount = dt.Rows.Count; * * foreach (DataRow dr in dt.Rows) * { * //postgres * //lstPerson.Add(new Person(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())); * lstPerson.Add(new Person(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["zip_code"].ToString().Trim(), dr["state"].ToString().Trim(), null, true, false, pmdClientID.ToString(), dr["pmd_patient_id"].ToString(), dr["dob"].ToString(), dr["contractnumber"].ToString())); * } */ //section new 12/20/2017 //use the missing numbers query as well DataTable dt2 = sqlDA.ReturnPatientsWithoutPhoneNumbers(pmdClientID, ismtm); originalcount += dt2.Rows.Count; foreach (DataRow dr in dt2.Rows) { //postgres //lstPerson.Add(new Person(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())); lstPerson.Add(new Person(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["secondary_address"].ToString(), dr["city"].ToString().Trim(), dr["zip_code"].ToString().Trim(), dr["state"].ToString().Trim(), null, true, false, pmdClientID.ToString(), dr["pmd_patient_id"].ToString(), dr["dob"].ToString(), dr["contractnumber"].ToString())); } /* * //section new 7/25/2019 BW * //add in specific people i want to find numbers for * if (DateTime.Now.Month >= 10) * { * DataTable dt3 = sqlDA.ReturnPatientsManualListCreatedToday(pmdClientID); * * originalcount += dt3.Rows.Count; * * foreach (DataRow dr in dt3.Rows) * { * //postgres * //lstPerson.Add(new Person(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())); * lstPerson.Add(new Person(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["zip_code"].ToString().Trim(), dr["state"].ToString().Trim(), null, true, false, pmdClientID.ToString(), dr["pmd_patient_id"].ToString(), dr["dob"].ToString(), dr["contractnumber"].ToString())); * } * } */ DistinctListGenerator dlg = new DistinctListGenerator(); lstUniquePerson = dlg.ReturnUniqueList(lstPerson); int uniquecount = lstUniquePerson.Count; Console.Out.WriteLine(originalcount.ToString() + " Original Count/" + uniquecount.ToString() + " Unique Count"); }