protected void BtnCompleted_Click(object sender, EventArgs e) { try { const ConsentType consentType = ConsentType.BloodConsentOrRefusal; //validation var lblError = DeclarationSignatures1.LblError; lblError.Text = string.Empty; DeclarationSignatures1.ValidateForm(); if (!string.IsNullOrEmpty(lblError.Text)) { return; } string patientId; try { patientId = Session["PatientID"].ToString(); } catch (Exception) { if (string.IsNullOrEmpty(HdnPatientId.Value)) { Response.Redirect("/PatientConsent.aspx"); return; } patientId = HdnPatientId.Value; Session["PatientID"] = patientId; } string location; try { location = Session["Location"].ToString(); } catch (Exception) { if (string.IsNullOrEmpty(HdnPatientId.Value)) { Response.Redirect("/PatientConsent.aspx"); return; } location = HdnLocation.Value; Session["Location"] = location; } string ip = Request.ServerVariables["REMOTE_ADDR"]; string device; if (Request.Browser.IsMobileDevice) { device = Request.Browser.Browser + " " + Request.Browser.Version; } else { device = Request.Browser.Browser + " " + Request.Browser.Version; } var signatureses = new List <Signatures>(); signatureses.AddRange(DeclarationSignatures1.GetSignatures()); string empID = string.Empty; if (Session["EmpID"] != null) { empID = Session["EmpID"].ToString(); } var treatment = new Treatment { _patientId = patientId, _consentType = consentType, _signatureses = signatureses.ToArray(), _isPatientUnableSign = DeclarationSignatures1.ChkPatientisUnableToSign.Checked, _unableToSignReason = DeclarationSignatures1.TxtPatientNotSignedBecause.Text, _translatedBy = DeclarationSignatures1.TxtTranslatedBy.Text, _trackingInformation = new TrackingInformation { _device = device, _iP = ip }, _empID = empID }; var consentFormSvcClient = Utilities.GetConsentFormSvcClient(); consentFormSvcClient.AddTreatment(treatment); Utilities.GeneratePdfAndUploadToSharePointSite(consentFormSvcClient, consentType, patientId, Request, location); try { Response.Redirect(Utilities.GetNextFormUrl(consentType, Session)); } catch (Exception) { Response.Redirect("/PatientConsent.aspx"); } } catch (Exception ex) { var client = Utilities.GetConsentFormSvcClient(); client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(), ex.Message + Environment.NewLine + ex.StackTrace); } }
protected void BtnCompleted_Click(object sender, EventArgs e) { try { const ConsentType consentType = ConsentType.OutsideOR; //validation var lblError = DeclarationSignatures1.LblError; lblError.Text = string.Empty; var doctorsAndProcedures = DoctorsAndProcedures1.GetDoctorsAndProcedures().ToArray(); if (doctorsAndProcedures.Length == 0) { lblError.Text += "<br /> Please select physicians and procedures."; } DeclarationSignatures1.ValidateForm(); if (string.IsNullOrEmpty(Request.Form[SignatureType.DoctorSign1.ToString()]) || string.IsNullOrEmpty(Request.Form[SignatureType.DoctorSign2.ToString()]) || string.IsNullOrEmpty(Request.Form[SignatureType.DoctorSign3.ToString()]) || string.IsNullOrEmpty(Request.Form[SignatureType.DoctorSign4.ToString()]) || string.IsNullOrEmpty(Request.Form[SignatureType.DoctorSign5.ToString()])) { lblError.Text += "Please input signatures."; } if (!string.IsNullOrEmpty(lblError.Text)) { return; } string patientId; try { patientId = Session["PatientID"].ToString(); } catch (Exception) { if (string.IsNullOrEmpty(HdnPatientId.Value)) { Response.Redirect("/PatientConsent.aspx"); return; } patientId = HdnPatientId.Value; Session["PatientID"] = patientId; } string location; try { location = Session["Location"].ToString(); } catch (Exception) { if (string.IsNullOrEmpty(HdnPatientId.Value)) { Response.Redirect("/PatientConsent.aspx"); return; } location = HdnLocation.Value; Session["Location"] = location; } string ip = Request.ServerVariables["REMOTE_ADDR"]; string device; if (Request.Browser.IsMobileDevice) { device = Request.Browser.Browser + " " + Request.Browser.Version; } else { device = Request.Browser.Browser + " " + Request.Browser.Version; } var signatureses = new List <Signatures>(); if (Request.Form[SignatureType.DoctorSign1.ToString()] != null) { var bytes = Encoding.ASCII.GetBytes(Request.Form[SignatureType.DoctorSign1.ToString()]); signatureses.Add(new Signatures { _name = string.Empty, _signatureContent = Encoding.ASCII.GetString(bytes), _signatureType = SignatureType.DoctorSign1 }); } if (Request.Form[SignatureType.DoctorSign2.ToString()] != null) { var bytes = Encoding.ASCII.GetBytes(Request.Form[SignatureType.DoctorSign2.ToString()]); signatureses.Add(new Signatures { _name = string.Empty, _signatureContent = Encoding.ASCII.GetString(bytes), _signatureType = SignatureType.DoctorSign2 }); } if (Request.Form[SignatureType.DoctorSign3.ToString()] != null) { var bytes = Encoding.ASCII.GetBytes(Request.Form[SignatureType.DoctorSign3.ToString()]); signatureses.Add(new Signatures { _name = string.Empty, _signatureContent = Encoding.ASCII.GetString(bytes), _signatureType = SignatureType.DoctorSign3 }); } if (Request.Form[SignatureType.DoctorSign4.ToString()] != null) { var bytes = Encoding.ASCII.GetBytes(Request.Form[SignatureType.DoctorSign4.ToString()]); signatureses.Add(new Signatures { _name = string.Empty, _signatureContent = Encoding.ASCII.GetString(bytes), _signatureType = SignatureType.DoctorSign4 }); } if (Request.Form[SignatureType.DoctorSign5.ToString()] != null) { var bytes = Encoding.ASCII.GetBytes(Request.Form[SignatureType.DoctorSign5.ToString()]); signatureses.Add(new Signatures { _name = string.Empty, _signatureContent = Encoding.ASCII.GetString(bytes), _signatureType = SignatureType.DoctorSign5 }); } signatureses.AddRange(DeclarationSignatures1.GetSignatures()); string empID = string.Empty; if (Session["EmpID"] != null) { empID = Session["EmpID"].ToString(); } var treatment = new Treatment { _patientId = patientId, _consentType = consentType, _signatureses = signatureses.ToArray(), _isPatientUnableSign = DeclarationSignatures1.ChkPatientisUnableToSign.Checked, _unableToSignReason = DeclarationSignatures1.TxtPatientNotSignedBecause.Text, _translatedBy = DeclarationSignatures1.TxtTranslatedBy.Text, _trackingInformation = new TrackingInformation { _device = device, _iP = ip }, _doctorAndPrcedures = doctorsAndProcedures, _empID = empID }; if (treatment._doctorAndPrcedures.GetUpperBound(0) < 0) { lblError.Text += "Please input procedure."; return; } var formHandlerServiceClient = Utilities.GetConsentFormSvcClient(); formHandlerServiceClient.AddTreatment(treatment); Utilities.GeneratePdfAndUploadToSharePointSite(formHandlerServiceClient, consentType, patientId, Request, location); try { Response.Redirect(Utilities.GetNextFormUrl(consentType, Session)); } catch (Exception) { Response.Redirect("/PatientConsent.aspx"); } } catch (Exception ex) { var client = Utilities.GetConsentFormSvcClient(); client.CreateLog(Utilities.GetUsername(Session), LogType.E, GetType().Name + "-" + new StackTrace().GetFrame(0).GetMethod().ToString(), ex.Message + Environment.NewLine + ex.StackTrace); } }