public static DataTable GetModuleForms(int locationId, int moduleId) { IPatientHome ptmhm = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical"); DataTable dtForms = ptmhm.GetModuleForms(moduleId, locationId); return(dtForms); }
/// <summary> /// Gets the forms for patient and module. /// </summary> /// <param name="locationId">The location identifier.</param> /// <param name="moduleId">The module identifier.</param> /// <param name="userId">The user identifier.</param> /// <param name="patientAge">The patient age.</param> /// <param name="patientSex">The patient sex.</param> /// <returns></returns> DataTable GetFormsForPatientAndModule(int locationId, int moduleId, int userId, Patient patient) { IPatientHome ptmhm = (IPatientHome)ObjectFactory.CreateInstance("BusinessProcess.Clinical.BPatientHome, BusinessProcess.Clinical"); List <StaticFormMap> formMap = StaticFormMap.FormUrl; DataTable dtForms = ptmhm.GetModuleForms(moduleId, locationId); List <FormRule> formRules = ptmhm.GetModuleFormsBusinessRule(moduleId, null, null); DataTable dt = this.ApplyBusinessRuleOnFormSet(ref dtForms, ref formRules, patient.Age, patient.Sex); //dtForms.DefaultView.ToTable(); if (moduleId == 1 && patient.Age < 2) //pmtct { // to do move this to the model configuration, rules per forms and modules //remove ccc and anc forms if the patientage < 2 years //CCC_INITIAL_FOLLOWUP //ART_HISTORY //ART_THERAPY //ICF //ANC_Register_MOH_405 //Postnatal_Register_MOH_406 dt.DefaultView.RowFilter = "ReferenceId Not In('CCC_INITIAL_FOLLOWUP','ART_HISTORY','ART_THERAPY','ICF','ANC_Register_MOH_405','Postnatal_Register_MOH_406')"; } DataTable dtFilterd = dt.DefaultView.ToTable(); dtFilterd.Columns.Add(new DataColumn("Url", Type.GetType("System.String"))); dtFilterd.Columns["Url"].DefaultValue = ""; dtFilterd.AcceptChanges(); foreach (DataRow row in dtFilterd.Rows) { if (!Convert.ToBoolean(row["Custom"])) { StaticFormMap map = formMap.Where(m => m.ReferenceId == row["ReferenceId"].ToString()).FirstOrDefault(); if (map != null) { row["Url"] = string.Format("{0}?|{1}", map.Url, row["FeatureId"].ToString()); } else { row["Deleted"] = 1; } } else if (row["Code"].ToString() == "CARE_END") { row["Url"] = string.Format("{0}|{1}", "~/Scheduler/frmScheduler_ContactCareTracking.aspx?", row["FeatureId"].ToString()); } else { row["Url"] = string.Format("~/ClinicalForms/CustomForm.aspx?|{0}", row["FeatureId"].ToString()); } row.AcceptChanges(); } dtFilterd.DefaultView.RowFilter = "Deleted <> 1"; this.formLoaded = true; return(dtFilterd.DefaultView.ToTable()); }