public async static Task <Level2_Return> Get_Level2_aysnc(string Base, string Key, string Salt, Dictionary <string, object> Claims, Dictionary <string, object> bp) { var l2 = new Level2_Return(); if (File.Exists("l2ret.json")) { using (var sr = new StreamReader("l2ret.json")) { string l2d = sr.ReadToEnd(); l2 = JsonConvert.DeserializeObject <Level2_Return>(l2d); return(l2); } } Mret m1 = null; var bpl = new Dictionary <string, object>(bp); bpl["Call_vector"] = 6000; string Token = Enc256.Encode(Key, Salt, Claims); try { m1 = await Get_Data(Base, Token, bpl); if (m1.status == 200) { l2 = JsonConvert.DeserializeObject <Level2_Return>(m1.body); } else { l2.code = m1.status; l2.message = m1.message; } } #pragma warning disable CS0168 // Variable is declared but never used catch (FlurlHttpException ex) #pragma warning restore CS0168 // Variable is declared but never used { // int i = 1; } return(l2); }
public void Load_level2(Level2_Return l2) { string pphone = null; string s1; var ad = new StringBuilder(); string term = null; ppgb.Text = "Primary Physician"; saved_type = false; Dsi = new KeyValuePair <string, Dsave>(); Savemi.Enabled = false; Deletemi.Enabled = false; dsaves.Enabled = false; Scsiz(Width, Originaly); Invalidate(); Update(); Reset_fields(); dsaves.SelectedIndexChanged -= Dsaves_SelectedIndexChanged; dsaves.SelectedItem = null; dsaves.SelectedIndexChanged += Dsaves_SelectedIndexChanged; foreach (int k in blocks.Keys) { Max_rec[k] = 0; } foreach (Ath_block b in ath_blist) { if (b.max_lines > 0) { Max_rec[b.num] = b.max_lines; } } if (l2.Pat.Patientid is object) { Patientid.Text = l2.Pat.Patientid.ToString(); } if (l2.Pat.Mobilephone is object) { pphone = l2.Pat.Mobilephone; } if (pphone is null && l2.Pat.Homephone is object) { pphone = l2.Pat.Homephone; } if (l2.Pat.Firstname is object && l2.Pat.Lastname is object) { Patient.Text = l2.Pat.Firstname + " " + l2.Pat.Lastname; } if (l2.Pat.Dob is object) { DOB.Text = l2.Pat.Dob; } if (pphone is object) { pphone = Trimc(ref pphone, ")(- "); Phone.Text = Format_phone(ref pphone); } if (l2.Pat.Address1 is object) { ad.Append(l2.Pat.Address1); term = "\r\n"; } if (l2.Pat.City is object) { ad.Append(term); ad.Append(l2.Pat.City); term = ","; } if (l2.Pat.State is object) { ad.Append(term); ad.Append(l2.Pat.State); term = " "; if (l2.Pat.Zip is object) { ad.Append(term); ad.Append(l2.Pat.Zip); } } if (ad.Length > 0) { address.Text = ad.ToString(); } address.BackColor = System.Drawing.Color.White; if (l2.Pat.Primaryproviderid != -1 && atpv.ContainsKey((int)l2.Pat.Primaryproviderid)) { prv_combo.SelectedItem = atpv[(int)l2.Pat.Primaryproviderid]; priph.Text = atpv[(int)l2.Pat.Primaryproviderid]; } s1 = null; pphone = null; if (l2.Pat.Contactname is object) { s1 = l2.Pat.Contactname; } else if (l2.Pat.Contactrelationship is object) { s1 = Ucfc(l2.Pat.Contactrelationship); } if (s1 is object) { if (l2.Pat.Contactmobilephone is object) { pphone = l2.Pat.Contactmobilephone; } else { pphone = l2.Pat.Contacthomephone; } } if (s1 is object) { if (pphone is object) { s1 = s1 + " " + Format_phone(ref pphone); } econtact.Text = s1; } econtact.BackColor = System.Drawing.Color.White; ins.Text = l2.Ins; ins.BackColor = System.Drawing.Color.White; if (ppgb.Text.Length > 1) { lab1["priph_title:"] = ppgb.Text; } if (sp.Text.Length > 1) { lab1["secph_title:"] = sp.Text; } foreach (KeyValuePair <string, List <string> > K in l2.blks) { var blk = new Blk_entry() { header = K.Key, State = (int)Load_state.not_loaded }; if (Endpoints_in_use.Contains(blk.header)) { blk.State = (int)Load_state.not_loaded_byc; int bnum = bl_available.First().Key; bl_used[bl_available.First().Key] = bl_available.First().Value; bl_available.Remove(bl_available.First().Key); Grpblocks[bnum].Visible = false; Grpblocks[bnum].Controls[0].Text = K.Key; Grpblocks[bnum].Controls[0].Tag = K.Key; Grpblocks[bnum].Controls[0].Enabled = true; TextBox tb = (TextBox)Grpblocks[bnum].Controls[0]; tb.ReadOnly = true; Grpblocks[bnum].Controls[1].Text = string.Join("\r\n", K.Value); Grpblocks[bnum].Controls[1].Enabled = true; Grpblocks[bnum].Controls[1].Tag = K.Key; RichTextBox rb = (RichTextBox)Grpblocks[bnum].Controls[1]; rb.ReadOnly = true; rb.BackColor = System.Drawing.Color.White; Ath_setcolor(bnum); labgb[gph[bnum]] = K.Key; labgb[gpb[bnum]] = string.Join("\r\n", K.Value); blk.State = (int)Load_state.loaded; blk.Num = bnum; } bl_loaded[K.Key] = blk; } if (bl_used.Count > 0) { Scsiz(Width); } Update(); foreach (KeyValuePair <string, Blk_entry> k in bl_loaded) { if (k.Value.State == (int)Load_state.loaded) { Grpblocks[k.Value.Num].Visible = true; } } Savemi.Visible = true; Savemi.Enabled = true; dsaves.Enabled = true; Set_empgb(); Data_altered = false; // Generate_labels(); return; }