public static CallingRecordsParameters GetCallingRecordsParameters(string parameters) { CallingRecordsParameters callingRecordsParameters = new CallingRecordsParameters(); string[] paras = parameters.Split('~'); callingRecordsParameters.Source = paras[0]; callingRecordsParameters.Parameter1 = paras[1]; callingRecordsParameters.Parameter2 = paras[2]; callingRecordsParameters.Parameter3 = paras[3]; callingRecordsParameters.Parameter4 = paras[4]; return callingRecordsParameters; }
public List<CallingRecord> GetListOfPatientsToCallFromFileFamily(CallingRecordsParameters parameters) { string reason = string.Empty; StreamReader importFile = null; string line = string.Empty; string[] sdelimStr = null; string delimStr = ","; char[] delimiter = delimStr.ToCharArray(); string[] sdelimStr2 = null; string delimStr2 = " "; char[] delimiter2 = delimStr2.ToCharArray(); string reminderConnectionNET = string.Empty; long nameID = 20000; long telephoneID = 1; string _sql = string.Empty; int count = 1; //int count2 = 1; List<Appointments> appointments = new List<Appointments>(); List<CallingRecord> callingRecords = new List<CallingRecord>(); try { importFile = File.OpenText(parameters.Parameter1); while ((line = importFile.ReadLine()) != null) { if (line.Length > 15) { sdelimStr = line.Split(delimiter, 20); sdelimStr2 = sdelimStr[2].Split(delimiter2, 20); bool bReturn = false; try { // bReturn = CheckToSeeIfCallIsCompleted(Common.ConvertTelephoneNumber2(sdelimStr[4]), sdelimStr[3]); } catch (Exception er) { string dd = er.Message; } if (bReturn) { string ff = string.Empty; } else { try { //reason = sdelimStr[11].Replace("'", "''").Trim().Substring(0, 13); reason = sdelimStr[11]; reason = reason.Replace("\"", ""); } catch { reason = string.Empty; } } } CallingRecord callingRecord = new CallingRecord(); try { callingRecord.FirstName = sdelimStr[1].Replace("\"", "").Trim(); } catch { callingRecord.FirstName = string.Empty; } try { callingRecord.LastName = sdelimStr[0].Replace("\"", "").Trim(); } catch { callingRecord.LastName = string.Empty; } try { callingRecord.Provider = sdelimStr[6].Replace("\"", "").Trim(); //appointment.D } catch { callingRecord.Provider = string.Empty; } //EntityID callingRecord.Company_ID = int.Parse(System.Configuration.ConfigurationManager.AppSettings["companyID"]); callingRecord.NameID = (int)nameID; callingRecord.TelephoneID = (int)telephoneID; callingRecord.MessageTime = 0; try { callingRecord.DateOfAppointment = sdelimStr[3].Replace("\"", "").Trim(); } catch { callingRecord.DateOfAppointment = string.Empty; } try { callingRecord.TimeOfAppointment = sdelimStr[4].Replace("\"", "").Trim(); } catch { callingRecord.TimeOfAppointment = string.Empty; } try { callingRecord.ApTime = callingRecord.TimeOfAppointment.Replace(":", ""); } catch { callingRecord.ApTime = string.Empty; } try { callingRecord.Date1 = Common.GetMonthFromDate(sdelimStr[3].Replace("\"", "")); } catch { callingRecord.Date1 = string.Empty; } try { DateTime appointmentDay = DateTime.Parse(callingRecord.DateOfAppointment); } catch { } try { callingRecord.Date2 = Common.GetDayNumberFromDate(sdelimStr[4].Replace("\"", "")); } catch { callingRecord.Date2 = string.Empty; } try { callingRecord.TimeForDelete = DateTime.Parse(sdelimStr[4].Replace("\"", "")); //callingRecord.TimeForDelete = DateTime.Parse(ConvertTimeOfAppointment3(sdelimStr[6])); } catch (Exception er) { string s1 = er.Message; //callingRecord.TimeForDelete = string.Empty; } try { callingRecord.Day = Common.GetDayFromDate(sdelimStr[3].Replace("\"", "")); } catch { callingRecord.Day = string.Empty; } try { callingRecord.TelephoneNumber1 = Common.ConvertTelephoneNumber(sdelimStr[2].Replace("\"", "").Trim()) .Replace("-", "") .Replace("(", "") .Replace(")", "") .Replace(" ", ""); callingRecord.TelephoneNumber1 = CheckTelephoneNumber(callingRecord.TelephoneNumber1); } catch { callingRecord.TelephoneNumber1 = string.Empty; } callingRecord.TelephoneNumber2 = "0"; try { callingRecord.TelephoneFile = sdelimStr[2].Replace("\"", "").Trim() .Replace("-", "") .Replace("(", "") .Replace(")", "") .Replace(" ", ""); } catch { callingRecord.TelephoneFile = string.Empty; } try { callingRecord.ReasonCode = sdelimStr[7].Replace("\"", "").Trim(); } catch { callingRecord.ReasonCode = string.Empty; } try { callingRecord.ReasonForAppointment = string.Empty; } catch { callingRecord.ReasonForAppointment = string.Empty; } try { callingRecord.Location = sdelimStr[8].Replace("\"", "").Trim(); } catch { callingRecord.Location = string.Empty; } callingRecord.Charge = "FAMILY"; callingRecord.InUse = "N"; callingRecord.Completed = "N"; callingRecord.CallWait = 0; callingRecord.MessageTime = 0; callingRecord.Busy = 0; callingRecord.ResultDescription = "Waiting To Call"; //callingRecord.Acknowledge //callingRecord.CallBack //callingRecord.Cancel //callingRecords.Add(callingRecord); InsertCallingRecord(callingRecord); nameID++; telephoneID++; count++; Console.WriteLine(count.ToString()); } importFile.Close(); return callingRecords; } catch (Exception er) { //Log.WhichProgram = "Labcorp Interface"; Log.LogMessage(er.ToString()); importFile.Close(); return callingRecords; } }