public void Load_saved(Save_blk sblk) { int bnum; saved_type = true; Practice.Text = sblk.Practice; dept_tbox.Text = sblk.Department; Department.Text = sblk.Department; Patient.Text = sblk.Patient; Patientid.Text = sblk.Patient_id; Phone.Text = sblk.Phone; address.Text = sblk.Address; address.BackColor = System.Drawing.Color.White; DOB.Text = sblk.DOB; econtact.Text = sblk.Emergency_contact; econtact.BackColor = System.Drawing.Color.White; ins.Text = sblk.Insurance; ins.BackColor = System.Drawing.Color.White; if (!string.IsNullOrEmpty(sblk.Prtitle)) { ppgb.Text = sblk.Prtitle; lab1["priph_title:"] = ppgb.Text; } prv_combo.Text = sblk.Priph; priph.Text = sblk.Priph; secph.Text = sblk.Secph; if (!string.IsNullOrEmpty(sblk.Sptitle) | !string.IsNullOrEmpty(secph.Text)) { if (string.IsNullOrEmpty(sblk.Sptitle)) { sptitle.Text = sp.Text; } else { sptitle.Text = sblk.Sptitle; } sp.Text = sptitle.Text; lab1["secph_title:"] = sp.Text; sp.Visible = true; secph.Visible = true; secph.Enabled = true; secph.BackColor = System.Drawing.Color.White; } foreach (Sblock sb in sblk.Blk_list) { bnum = sb.num; if (gpn.ContainsKey(bnum)) { Grpblocks[bnum].Visible = false; Grpblocks[bnum].Controls[0].Text = sb.header; Grpblocks[bnum].Controls[0].Tag = sb.header; Grpblocks[bnum].Controls[0].Enabled = true; TextBox tb = (TextBox)Grpblocks[bnum].Controls[0]; tb.ReadOnly = true; Grpblocks[bnum].Controls[1].Text = sb.body; Grpblocks[bnum].Controls[1].Enabled = true; RichTextBox rb = (RichTextBox)Grpblocks[bnum].Controls[1]; rb.ReadOnly = true; rb.BackColor = System.Drawing.Color.White; Ath_setcolor(bnum); labgb[gph[bnum]] = sb.header; labgb[gpb[bnum]] = sb.body; bl_used[bnum] = bl_available[bnum]; bl_available.Remove(bnum); } } Savemi.Visible = true; Savemi.Enabled = true; Deletemi.Visible = true; if (bl_used.Count > 0) { Scsiz(Width); } Update(); foreach (KeyValuePair <int, string> k in bl_used) { Grpblocks[k.Key].Visible = true; } Set_empgb(); Data_altered = false; Dsi = (KeyValuePair <string, Dsave>)dsaves.SelectedItem; return; }
private async Task <Dsave_return> save_blk() { if (run_timer) { Ettb.Text = start_timer(SW); } var claims = Gen_Claims(); string Wrtim = DateTime.Now.ToString("yyyyMMddHHmmss"); var Sblk = new Save_blk(); Sblock Sb; string js; string jse; Dsave_return dr; if (saved_type) { // Dsi = dsaves.SelectedItem Ds = Dsi.Value; if (string.IsNullOrEmpty(Patient.Text)) { Patient.Text = Ds.Name; } } if (string.IsNullOrEmpty(Patient.Text)) { Patient.Text = "Unknown_" + Wrtim; } if (!string.IsNullOrEmpty(Patient.Text) && Ds is object && !string.IsNullOrEmpty(Ds.Name)) { if (!((Patient.Text ?? "") == (Ds.Name ?? ""))) { saved_type = false; } } Sblk.Practice = Practice.Text; if (Department.Items.Count > 1) { Sblk.Department = Department.Text; } else { Sblk.Department = dept_tbox.Text; } Sblk.Patient = Patient.Text; Sblk.Patient_id = Patientid.Text; Sblk.Address = address.Text; Sblk.DOB = DOB.Text; Sblk.Emergency_contact = econtact.Text; Sblk.Insurance = ins.Text; if (atpv.Count > 1) { Sblk.Priph = prv_combo.Text; } else { Sblk.Priph = priph.Text; } Sblk.Phone = Phone.Text; Sblk.Prtitle = ppgb.Text; Sblk.Sptitle = sptitle.Text; Sblk.Secph = secph.Text; Sblk.Sec_visible = Mpck.Sec_visible; foreach (KeyValuePair <int, string> s in bl_used) { Sb = new Sblock(); { var withBlock = Sb; withBlock.num = s.Key; withBlock.header = Controls[s.Value].Controls[0].Text; withBlock.body = Controls[s.Value].Controls[1].Text; } Sblk.Blk_list.Add(Sb); } aws_body.Clear(); js = JsonConvert.SerializeObject(Sblk, Formatting.Indented); aws_body["skey"] = Enc256.Encrypt(Sblk.Patient, Enc256.Iterscramble(cid + Mpck.Dlab, Mpck.Iterations)); var switchExpr = save_ver; switch (switchExpr) { case 1: { jse = Enc256.Encrypt(js, Enc256.Iterscramble(cid), Convert.ToInt32(Mpck.Iterations % 10 + 2)); aws_body["skey"] = Enc256.Encrypt(Sblk.Patient, Enc256.Iterscramble(cid + Mpck.Dlab), Mpck.Iterations % 10 + 2); break; } default: { jse = Enc256.Encrypt(js, Enc256.Iterscramble(cid, Mpck.Iterations), Convert.ToInt32(Mpck.Iterations / (double)3)); aws_body["skey"] = Enc256.Encrypt(Sblk.Patient, Enc256.Iterscramble(cid + Mpck.Dlab, Mpck.Iterations)); break; } } aws_body["ukey"] = Enc256.Encrypt(cid + Mpck.Dlab, cid + Mpck.Dlab, Mpck.Iterations); if (saved_type) { if (string.IsNullOrEmpty(Ds.lwtim)) { aws_body["wrtim"] = Wrtim; aws_body["lwtim"] = Wrtim; } else { aws_body["wrtim"] = Ds.wrtim; aws_body["lwtim"] = Wrtim; } } else { aws_body["wrtim"] = Wrtim; aws_body["lwtim"] = Wrtim; } aws_body["vers"] = save_ver.ToString(); aws_body["value"] = jse; Application.UseWaitCursor = true; dr = await Aws.Pat_save_aysnc(Mpck.Url, enck, Mpck.Salt, claims, aws_body); Application.UseWaitCursor = false; Add_saved_item(dr.ds[0]); Data_altered = false; if (run_timer) { Ettb.Text = stop_timer(SW); } return(dr); }