Example #1
0
        /// <summary>
        /// Gets a list of tables marked for using as relatable tables
        /// </summary>
        /// <returns></returns>
        private IDictionary <string, string> GetRelatedTables()
        {
            // check query string for manual list of related tables
            string queryRelatedTables = Request.QueryString["relatedTables"];
            IDictionary <string, string> relatedSrcTables = new Dictionary <string, string>();

            if (!string.IsNullOrEmpty(queryRelatedTables))
            {
                var tables = from table in queryRelatedTables.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)
                             where pdec.IsTable(table)
                             select table;
                // validate names
                if (tables.Count() > 0)
                {
                    relatedSrcTables = pdec.GetDataEntryFormLabels(tables);
                }
            }

            // default: use metadata if no related tables specified
            relatedSrcTables = relatedSrcTables.Count() > 0 ? relatedSrcTables : rc.GetRelatedRecordTablesAndLabels();

            // add defatult table
            if (!string.IsNullOrEmpty(SrcTableName) && !relatedSrcTables.ContainsKey(SrcTableName))
            {
                relatedSrcTables.Add(SrcTableName, pdec.GetTableLabel(SrcTableName));
            }
            // validation: only allow tables related to Patients
            return((from table in relatedSrcTables
                    where BOL.BusinessObject.GetParentTablename(table.Key) == "Patients"
                    select table).ToDictionary(a => a.Key, a => a.Value));
        }