Beispiel #1
0
        /// <summary>
        /// Executes the rules and appends selected templates to the output row.
        /// </summary>
        /// <param name="inputRow">Input Row of data.</param>        
        public void Execute(Dictionary<string, string> inputRow)
        {
            CfhRulesDataStore rulesData = new CfhRulesDataStore();
            string drugType;
            string templateName = "DrugDetailsTemplateDefault";
            List<CfhRuleOutput> templates;

            if (inputRow["Form"] == null || inputRow["Route"] == null)
            {
                throw new ArgumentException("Invalid row specified");
            }

            this.GetDrugName(inputRow);
            
            drugType = CfhRulesDataStore.QueryDrugType(inputRow["Form"], inputRow["Route"]);
            if (!string.IsNullOrEmpty(drugType))
            {
                templates = rulesData.ExecuteRules(drugType, inputRow);

                if (templates != null)
                {
                    foreach (CfhRuleOutput output in templates)
                    {
                        if (output.LevelName.Equals(this.LevelName, StringComparison.OrdinalIgnoreCase))
                        {
                            templateName = output.TemplateName;
                            break;
                        }
                    }
                }
            }

            inputRow.Add("TemplateName", templateName);
            this.ApplyFormatting(inputRow);
        }
Beispiel #2
0
        /// <summary>
        /// Executes the rules and appends selected templates to the output row.
        /// </summary>
        /// <param name="inputRow">Input Row of data.</param>
        public void Execute(Dictionary <string, string> inputRow)
        {
            CfhRulesDataStore    rulesData = new CfhRulesDataStore();
            string               drugType;
            string               templateName = "DrugDetailsTemplateDefault";
            List <CfhRuleOutput> templates;

            if (inputRow["Form"] == null || inputRow["Route"] == null)
            {
                throw new ArgumentException("Invalid row specified");
            }

            this.GetDrugName(inputRow);

            drugType = CfhRulesDataStore.QueryDrugType(inputRow["Form"], inputRow["Route"]);
            if (!string.IsNullOrEmpty(drugType))
            {
                templates = rulesData.ExecuteRules(drugType, inputRow);

                if (templates != null)
                {
                    foreach (CfhRuleOutput output in templates)
                    {
                        if (output.LevelName.Equals(this.LevelName, StringComparison.OrdinalIgnoreCase))
                        {
                            templateName = output.TemplateName;
                            break;
                        }
                    }
                }
            }

            inputRow.Add("TemplateName", templateName);
            this.ApplyFormatting(inputRow);
        }
Beispiel #3
0
        /// <summary>
        /// Derives the value for DrugName.
        /// </summary>
        /// <param name="inputRow">Input row.</param>
        private void GetDrugName(Dictionary <string, string> inputRow)
        {
            string drugName = String.Empty;

            if (!string.IsNullOrEmpty(inputRow["VMPID"]))
            {
                drugName = CfhRulesDataStore.GetVMPName(inputRow["VMPID"]);
            }
            else if (!string.IsNullOrEmpty(inputRow["VTMID"]))
            {
                drugName = CfhRulesDataStore.GetVTMName(inputRow["VTMID"]);
            }
            else if (!string.IsNullOrEmpty(inputRow["AMPID"]))
            {
                drugName = CfhRulesDataStore.GetAMPName(inputRow["AMPID"]);
            }

            if (inputRow.ContainsKey("DrugName"))
            {
                inputRow["DrugName"] = drugName;
            }
            else
            {
                inputRow.Add("DrugName", drugName);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Applies capitalization to drug name.
 /// </summary>
 /// <param name="inputRow">Input row of data.</param>
 private void ApplyCapitalization(Dictionary <string, string> inputRow)
 {
     // check if DrugName should be changed to uppercase
     if (!string.IsNullOrEmpty(inputRow["VMPID"]))
     {
         string vtm = CfhRulesDataStore.GetVTMID(inputRow["VMPID"]);
         if (string.IsNullOrEmpty(vtm))
         {
             inputRow["DrugName"] = inputRow["DrugName"].ToUpper();
         }
     }
 }