/// <summary> /// Updates the EForm's HTML Transform and Current Status /// </summary> /// <param name="eformId"></param> /// <param name="narrative"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> /// <returns></returns> public bool UpdateEFormReport(int eformId, string narrative, string currentStatus, string userName) { bool returnVal = false; if (CanEditEForm()) { // update EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormReport] = narrative; eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); return(true); // add call to update EFormLog //returnVal = _da.UpdateEFormReport(eformId, narrative, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } return(returnVal); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void UpdateEformStatuses(object sender, EventArgs e) { // manually update eform statuses foreach (int dirtyRowIndex in dirtyRows) { Control row = EFormActivityRptr.Items[dirtyRowIndex]; // get status text ICaisisInputControl eformIdField = row.FindControl("EFormId") as ICaisisInputControl; ICaisisInputControl statusField = row.FindControl("StatusField") as ICaisisInputControl; ICaisisInputControl EFormApptPhysicianField = row.FindControl("EFormApptPhysicianField") as ICaisisInputControl; ICaisisInputControl EFormApptTimeField = row.FindControl("EFormApptTimeField") as ICaisisInputControl; // load record and update status field int eformId = int.Parse(eformIdField.Value); BOL.EForm biz = new EForm(); biz.Get(eformId); biz[BOL.EForm.CurrentStatus] = statusField.Value; biz[BOL.EForm.EformApptPhysician] = EFormApptPhysicianField.Value; biz[BOL.EForm.EformApptTime] = EFormApptTimeField.Value; biz.Save(); } // rebind list to show updated statuses BuildEformStatusList(BOL.EForm.EFormId, SortDirection.Ascending); }
/// <summary> /// Updates the EForm record with the XML, HTML Transform and Current Status. /// </summary> /// <param name="eformId"></param> /// <param name="eformXml"></param> /// <param name="eformHtml"></param> /// <param name="currentStatus"></param> public void UpdateEFormRecord(int eformId, XmlDocument eformXml, string eformHtml, string currentStatus) { if (CanEditEForm()) { // load existing EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormXML] = eformXml.InnerXml; eform[EForm.EFormReport] = eformHtml; eform[EForm.CurrentStatus] = currentStatus; // optional EForm Appt Fields SetEFormApptFields(eform, eformXml); // update eform.Save(); // add log entry LogEForm(eformId, currentStatus); // _da.UpdateEFormRecord(eformId, eFormXmlString, eformHtml, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } }
/// <summary> /// Updates the EForm's Current Status /// </summary> /// <param name="eformId"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> public void UpdateEFormStatus(int eformId, string currentStatus, string userName) { if (CanEditEForm()) { // add call to update EFormLog // RULE :once an eform is approved, it can no longer be updated string status = this.GetEFormStatus(eformId); if (status != "" && status.IndexOf("Approved") == -1) // -1 then approved was not present, update { // update EForm status EForm eform = new EForm(); eform.Get(eformId); eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); // _da.UpdateEFormStatus(eformId, currentStatus, userName); } } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } }
override protected void Page_Load(object sender, System.EventArgs e) { // view state is disabled in base control if (IsPreview) { _patientId = int.MinValue; } else { _patientId = int.Parse(Session[SessionKey.PatientId].ToString()); } // get eform id and name from url vars if (Request.QueryString["eformId"] != null) { _eformId = int.Parse(Request.QueryString["eformId"]); EForm eb = new EForm(); eb.Get(_eformId); _eformName = eb[EForm.EFormName].ToString(); } else { _eformName = Request.QueryString["eform"]; } if (!Page.IsPostBack) { this.OverrideLookupCodes(); this.PopulateEform(); } }
/// <summary> /// Returns the XmlDocuemnt represented in the eform record /// </summary> /// <returns></returns> private XmlDocument GetEformXml() { // load eform XmlDocument eformXML = new XmlDocument(); int eformId = int.Parse(EformId); EForm eForm = new EForm(); eForm.Get(eformId); if (!eForm.IsNull(BOL.EForm.EFormXML)) { eformXML.LoadXml(eForm[BOL.EForm.EFormXML].ToString()); } return(eformXML); }
protected void Page_Load(object sender, EventArgs e) { string docType = Request.QueryString["docType"]; string eFormId = Request.QueryString["eFormId"]; if (!string.IsNullOrEmpty(eFormId)) { int id = int.Parse(eFormId); if (!string.IsNullOrEmpty(docType)) { docType = docType == "xml" ? "text/xml" : "text/html"; } else { docType = "text/html"; } Response.ContentType = docType; EForm biz = new EForm(); biz.Get(id); if (docType == "text/xml") { Response.Write(biz[EForm.EFormXML]); } else { object s = biz[EForm.EFormReport]; if (s != null) { if (s.ToString() != "" && s != DBNull.Value) { Response.Write(biz[EForm.EFormReport]); } } else { Response.Write("<html><head></head><body></body></html>"); } } } else { Response.Write("<html><head></head><body></body></html>"); } }
/// <summary> /// Updates the EForm's XML and Current Status /// </summary> /// <param name="eformId"></param> /// <param name="s"></param> /// <param name="currentStatus"></param> /// <param name="userName"></param> /// <returns></returns> public int UpdateEFormXml(int eformId, string s, string currentStatus, string userName) { if (CanEditEForm()) { // update the EForm record EForm eform = new EForm(); eform.Get(eformId); eform[EForm.EFormXML] = s; eform[EForm.CurrentStatus] = currentStatus; eform.Save(); // add log entry LogEForm(eformId, currentStatus); // possibly add call to update EFormLog ; will update very often //_da.UpdateEFormXml(eformId, s, currentStatus, userName); } else { throw new ClientException("Please contact your administrator for access to this eform.", true); } // should return xml string used to repopulate form return(eformId); }
/// <summary> /// Create a new instance of a GenericEFormViewer /// </summary> /// <param name="eformId">The Eform Id to create a generic eform view</param> public GenericEFormViewer(int eformId) { biz = new EForm(); biz.Get(eformId); }
private void Save() { // required string sourceTable = SourceTables.SelectedValue; string destTable = DestTableName; int? destPriKey = null; Dictionary <string, Dictionary <int, string> > tablesRecordsAndKeys = new Dictionary <string, Dictionary <int, string> >(); tablesRecordsAndKeys.Add(sourceTable, new Dictionary <int, string>()); var recordsAndKeys = tablesRecordsAndKeys[sourceTable]; // determine if using actual records or eform if (IsActualRecord) { destPriKey = int.Parse(DestTablePrimaryKey); } foreach (RepeaterItem item in TableRecordsRptr.Items) { // get related record if (if it exists) HiddenField srcTableKeyField = item.FindControl("SrcTablePriKey") as HiddenField; HiddenField relatedRecordIdField = item.FindControl("RelatedRecordId") as HiddenField; // get dest key (should always exist) int srcPriKey = int.Parse(srcTableKeyField.Value); // get existing related record (if exists) int?relatedRecordId = null; if (!string.IsNullOrEmpty(relatedRecordIdField.Value)) { relatedRecordId = int.Parse(relatedRecordIdField.Value); } // iterate relation strengths and insert/update/delete relation (if applicable) bool doDelete = true; // mark inital strength for update/insert/delete, empty recordsAndKeys[srcPriKey] = string.Empty; foreach (int relationStrength in RelationStrengths) { RadioButton relationRadio = item.FindControl("Relation_Radio_" + relationStrength) as RadioButton; if (relationRadio.Checked) { // once an item is checked, no need to delete doDelete = false; // mark updated relation recordsAndKeys[srcPriKey] = relationStrength.ToString(); // if record exists (updated strength) if (relatedRecordId.HasValue) { RelatedRecord biz = new RelatedRecord(); biz.Get(relatedRecordId.Value); biz[RelatedRecord.RelationStrength] = relationStrength; biz.Save(); } // if there is a destination, update else if (destPriKey.HasValue) { RelatedRecord biz = RelatedRecordController.CreateRelatedRecord(RelatedRecordController.SOURCE_SYSTEM, sourceTable, srcPriKey, destTable, destPriKey.Value, relationStrength, true); } else if (IsEform) { // handled by update map } // only 1 checked radio per row break; } } // if no items have been checked, remove related record if (doDelete) { // delete real relation if (relatedRecordId.HasValue) { RelatedRecord biz = new RelatedRecord(); biz.Delete(relatedRecordId.Value); // update keys relatedRecordId = null; relatedRecordIdField.Value = string.Empty; } // delete eform reation else if (IsEform) { // handled by update map } } } // for eforms, insert/update/delete relationships if (IsEform) { // udpate xml XmlDocument eformXML = GetEformXml(); rc.UpdateEformRelatedRecords(eformXML, DestTableName, EformRecordId, tablesRecordsAndKeys); // update record EForm biz = new EForm(); biz.Get(int.Parse(EformId)); biz[EForm.EFormXML] = eformXML.OuterXml; biz.Save(); } // Register update script if (!string.IsNullOrEmpty(RelatedClientId))// && sourceTable == SrcTableName) { var relationStrengths = tablesRecordsAndKeys.SelectMany(a => a.Value.Select(b => b.Value)).Where(a => !string.IsNullOrEmpty(a)); string clientRelationArray = "[" + string.Join(",", relationStrengths.ToArray()) + "]"; Page.ClientScript.RegisterStartupScript(this.GetType(), "refreshAndCloseRelatedRecords", "refreshAndCloseRelatedRecords('" + RelatedClientId + "', " + clientRelationArray + ");", true); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "refreshAndCloseRelatedRecords", "refreshAndCloseRelatedRecords();", true); } }