/// <summary> /// Returns the Protocol specific visits dataset (PatientItems) /// </summary> /// <returns></returns> protected virtual string GetPatientVisitsDataset() { // get core Dataset string datasetSQL = CacheManager.GetDatasetSQL(Page.Session[SessionKey.DatasetId]); // get protocol int protocolId = int.Parse(BaseProtocolId); // return special visits SQL return(ProtocolMgmtController.GetVisitDatasetSQL(datasetSQL, protocolId)); }
// copy and paste; ugh, but you c/n override static methods public static List <ICaisisInputControl> GetCaisisInputControlsByTableName(string tableName) { List <ICaisisInputControl> cicList = new List <ICaisisInputControl>(); // get metadata var fieldMetadata = ProtocolMgmtController.GetTableFieldsMetadata(tableName); foreach (var field in fieldMetadata) { string fieldName = field.Key; Dictionary <string, string> metadata = new Dictionary <string, string>(field.Value); bool required = BOL.BusinessObject.IsRequired(tableName, fieldName, null); string controlType = metadata.ContainsKey(CONTROLTYPE) ? metadata[CONTROLTYPE] : ""; if (controlType.Equals("")) { controlType = typeof(CaisisTextBox).Name; } // eliminate LookupDistinct that references PatientId, UserName if (metadata.ContainsKey("LookupDistinct")) { string lkpDistint = metadata["LookupDistinct"]; if (!string.IsNullOrEmpty(lkpDistint) && lkpDistint.Contains("@")) { metadata.Remove("LookupDistinct"); } } ICaisisInputControl cic = InvokeInputControl(controlType); cic.Field = fieldName; cic.Table = tableName; cic.ShowLabel = false; cic.CssClass = "DynamicControlsClass"; if (cic is WebControl) { ((WebControl)cic).Style.Add("height", "20px"); } // set its metadata based attributes SetCICAttributes(cic, metadata); // set required from db if not set via metadata if (!cic.Required && !string.IsNullOrEmpty(tableName) && !string.IsNullOrEmpty(fieldName)) { if (BOL.BusinessObjectFactory.CanBuildBusinessObject(tableName)) { cic.Required = BOL.BusinessObject.IsRequired(tableName, fieldName); } } //if (!(cic is CaisisHidden)) cicList.Add(cic); } return(cicList); }
private static ProtocolSpecimenDefault[] GetDefaultSpecimens(string protocolNum, string type) { List <ProtocolSpecimenDefault> defaults = new List <ProtocolSpecimenDefault>(); // get default specimen configuration string xPath = string.Format("//specimens//defaults[@type='{0}']", type); XmlNode specimenDefaultNode = ProtocolMgmtController.GetConfigurationNode(Protocol.ProtocolNum, protocolNum, xPath); if (specimenDefaultNode != null) { // TODO: add automated de-serialization var defaultNodes = from node in specimenDefaultNode.SelectNodes("ProtocolSpecimenDefault").Cast <XmlNode>() let suffix = node.SelectSingleNode("Suffix").InnerText let subType = node.SelectSingleNode("SubType").InnerText let vialType = node.SelectSingleNode("VialType").InnerText select new ProtocolSpecimenDefault(suffix, subType, vialType); defaults.AddRange(defaultNodes); } return(defaults.ToArray()); }
public Dictionary <string, string> GetSpecimenVisits(string protocolNum, string type) { string xPath = string.Format("//specimens//visits[@type='{0}']", type); XmlNode visitNodes = ProtocolMgmtController.GetConfigurationNode(Protocol.ProtocolNum, protocolNum, xPath); if (visitNodes != null) { var visits = from visit in visitNodes.SelectNodes("visit").Cast <XmlNode>() select new { Label = visit.SelectSingleNode("Label").InnerText, Value = visit.SelectSingleNode("Value").InnerText }; return(visits.ToDictionary(v => v.Label, v => v.Value)); } else { return(new Dictionary <string, string>()); } }
protected void CopyArm(object sender, CommandEventArgs e) { int schemaId; int versionId; if (int.TryParse(e.CommandArgument.ToString(), out schemaId) && int.TryParse(QueryVersionId, out versionId)) { int?copiedSchema = ProtocolMgmtController.CopyProtocolSchema(schemaId); if (copiedSchema.HasValue) { // after creating copied schema, update verion id ProtocolSchema biz = new ProtocolSchema(); biz.Get(copiedSchema.Value); biz[ProtocolSchema.ProtocolVersionId] = versionId; biz.Save(); // adter copying schema, go to edit schema page string nextURL = GetQueryStringBySchema(copiedSchema); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "GoToSchemaPage", "parent.reloadTreatmentArms(); parent.editSchema('" + nextURL + "');", true); } } }
protected void SaveButton_Click(object sender, EventArgs e) { // validate approval date DateTime testDate = DateTime.Now; if (string.IsNullOrEmpty(ApprovalDate.Text) || !DateTime.TryParse(ApprovalDate.Text, out testDate)) { ApprovalDateValidator.IsValid = false; } else { ProtocolVersion biz = new ProtocolVersion(); int protocolId = int.Parse(BaseProtocolId); // copying if (!string.IsNullOrEmpty(CopyVersionId)) { biz = ProtocolMgmtController.CopyProtocolVersion(int.Parse(CopyVersionId)); } else { // updating if (numVersionId != -1) { biz.Get(numVersionId); } // new record else { biz[ProtocolVersion.ProtocolId] = protocolId; } } CICHelper.SetBOValues(Form.Controls, biz, protocolId); biz.Save(); RefreshMainScreen((int)biz[biz.PrimaryKeyName]); } }
// copy and paste; ugh, but you c/n override static methods public static List <CICCombined> GetCaisisInputControlsByTableName(string tableName) { List <CICCombined> cicList = new List <CICCombined>(); // get metadata var fieldMetadata = ProtocolMgmtController.GetTableFieldsMetadata(tableName); foreach (var field in fieldMetadata) { string fieldName = field.Key; Dictionary <string, string> metadata = new Dictionary <string, string>(field.Value); bool required = BOL.BusinessObject.IsRequired(tableName, fieldName, null); string controlType = metadata.ContainsKey(CONTROLTYPE) ? metadata[CONTROLTYPE] : ""; if (controlType.Equals("")) { controlType = typeof(CaisisTextBox).Name; } // eliminate LookupDistinct that references PatientId, UserName if (metadata.ContainsKey("LookupDistinct")) { string lkpDistint = metadata["LookupDistinct"]; if (!string.IsNullOrEmpty(lkpDistint) && lkpDistint.Contains("@")) { metadata.Remove("LookupDistinct"); } } ICaisisInputControl cic = InvokeInputControl(controlType); cic.Field = fieldName; cic.Table = tableName; // set its metadata based attributes SetCICAttributes(cic, metadata); // set required from db if not set via metadata if (!cic.Required && BOL.BusinessObjectFactory.CanBuildBusinessObject(tableName)) { cic.Required = required; } CICCombined cicCombined = new CICCombined(); cicCombined.CICParent = cic; // if it's a fuzzy date, add to the previous control if (cicList.Count() > 0 && cic is CaisisHidden) { CICCombined cicTop = cicList[cicList.Count - 1]; if (cicTop.CICParent is CaisisTextBox && ((CaisisTextBox)cicTop.CICParent).CalcDate) { cicTop.CICChild = cic; } else { // Add control to Control list cicList.Add(cicCombined); } } else { // Add control to Control list cicList.Add(cicCombined); } } return(cicList); }