public static string CreateChargeRequest(ref SqlDataReader reader, ref bool list, ref List <SyncEntities.SyncCharge> listCh) { if (reader == null) { return(""); } string json = ""; List <string> cpts = new List <string>(); while (reader.Read()) { SyncEntities.SyncCharge ch = new SyncEntities.SyncCharge( (long)reader["Id"], reader["DateOfService"].ToString().Trim(), reader["DateOfPosting"].ToString().Trim(), reader["PracticeId"].ToString().Trim(), reader["PatientId"].ToString().Trim(), reader["CPTId"].ToString().Trim(), reader["InsuranceCompanyId"].ToString().Trim(), reader["Billed"].ToString().Trim(), reader["Payment"].ToString().Trim(), reader["Adjustment"].ToString().Trim(), reader["Balance"].ToString().Trim(), reader["UpdateDate"].ToString().Trim(), reader["CreateDate"].ToString().Trim(), reader["DoctorId"].ToString().Trim(), reader["CaseNumber"].ToString().Trim(), reader["StatusId"].ToString().Trim(), reader["DueDate"].ToString().Trim(), "805", reader["LiveID"].ToString().Trim(), reader["updated"].ToString().Trim(), reader["toDelete"].ToString().Trim() ); cpts.Add(ch.GetNewHttpJson()); listCh.Add(ch); } if (cpts.Count <= 0) { return(""); } return(CreateListParams(cpts)); }
public static Dictionary <string, List <SyncEntities.SyncCharge> > CreateChargeRequestList(ref SqlDataReader reader, ref List <string> charges2Update) { if (reader == null) { return(null); } Dictionary <string, List <SyncEntities.SyncCharge> > requests_ch = new Dictionary <string, List <SyncEntities.SyncCharge> >(StringComparer.OrdinalIgnoreCase); List <string> cpts = new List <string>(); List <SyncEntities.SyncCharge> listCh = new List <SyncEntities.SyncCharge>(); int count = 0; while (reader.Read()) { SyncEntities.SyncCharge ch = new SyncEntities.SyncCharge( (long)reader["Id"], reader["DateOfService"].ToString().Trim(), reader["DateOfPosting"].ToString().Trim(), reader["PracticeId"].ToString().Trim(), reader["PatientId"].ToString().Trim(), reader["CPTId"].ToString().Trim(), reader["InsuranceCompanyId"].ToString().Trim(), reader["Billed"].ToString().Trim(), reader["Payment"].ToString().Trim(), reader["Adjustment"].ToString().Trim(), reader["Balance"].ToString().Trim(), reader["UpdateDate"].ToString().Trim(), reader["CreateDate"].ToString().Trim(), reader["DoctorId"].ToString().Trim(), reader["CaseNumber"].ToString().Trim(), reader["StatusId"].ToString().Trim(), reader["DueDate"].ToString().Trim(), "805", reader["LiveID"].ToString().Trim(), reader["updated"].ToString().Trim(), reader["toDelete"].ToString().Trim() ); /* string ss = ch.GetNewHttpJson(); * if (!ss.Contains("PolicyNumber")) * { * int jj = 0; * }*/ cpts.Add(ch.GetNewHttpJson()); charges2Update.Add(ch.GetChargeUpdateHttpJson()); listCh.Add(ch); ++count; if (count >= 100) { string json = CreateListParams(cpts); List <SyncEntities.SyncCharge> lc = new List <SyncEntities.SyncCharge>(); lc.AddRange(listCh); try { requests_ch.Add(json, lc); } catch { } cpts.Clear(); listCh.Clear(); json = ""; count = 0; } } if (cpts.Count > 0) { string js = CreateListParams(cpts); List <SyncEntities.SyncCharge> ll = new List <SyncEntities.SyncCharge>(); ll.AddRange(listCh); requests_ch.Add(js, ll); } if (requests_ch.Count <= 0) { return(null); } return(requests_ch); }