public static Dictionary <string, object>[] GetListQueryResults(string Url, string RecordId)
        {
            ISearchesRunnable q = GetListQuery(Url, RecordId);

            return(q.Run());
        }
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            ISearchesRunnable packQuery = Query.Create()
                                          .Select("PACK_ID")
                                          .Select("PACK_NAME")
                                          .Select("PACK_PQ_ID")
                                          .From(QuerySources.Packs)
                                          .Where("PARENT_URL", QueryConditionTypes.Equal, PackParentURL)
                                          .OrderBy("PACK_NAME");

            List <ListItem> items = new List <ListItem>();
            IList <Dictionary <string, object> > results = packQuery.Run();

            foreach (Dictionary <string, object> item in results)
            {
                ListItem entry = new ListItem(item["PACK_NAME"].ToString(), item["PACK_ID"].ToString());
                items.Add(entry);
            }

            this.PackName.DataSource = items;

            foreach (ListItem item in this.PackName.Items)
            {
                Dictionary <string, object> qitem = results.FirstOrDefault(p => p["PACK_ID"].ToString() == item.Value);
                if (qitem != null)
                {
                    if (qitem["PACK_PQ_ID"] != null && qitem["PACK_PQ_ID"].ToString() != "")
                    {
                        item.Attributes.Add("queueid", qitem["PACK_PQ_ID"].ToString());
                    }
                }
            }

            SentFrom.FieldValue = this.CurrentSession.User.Person.PrincipalRole.Id;
            setPrintReqType();

            List <Document.OutputQueue> queues = Consensus.Document.OutputQueue.FetchAll().ToList();

            this.OutputQueue.DataSource = queues;

            foreach (ListItem item in this.OutputQueue.Items)
            {
                Document.OutputQueue qitem = queues.FirstOrDefault(q => q.Id == item.Value);
                if (qitem != null)
                {
                    if (qitem.SendType.HasValue)
                    {
                        item.Attributes.Add("sendtype", qitem.SendType.ToString());
                    }

                    if (qitem.SystemDefault.HasValue && qitem.SystemDefault.Value == 1)
                    {
                        item.Attributes.Add("defaultfortype", "1");
                    }
                }
            }

            //Consensus.Common.Code.FetchAllByType("DPMS").ToList(); // no longer using this - the types are hard coded...
            // Value is the same as Text because this is what we are saving to the Print_Req table.
            List <ListItem> allQueueTypes = new List <ListItem>()
            {
                new ListItem()
                {
                    Text = "16-Email", Value = "16-Email"
                },
                new ListItem()
                {
                    Text = "01-Post", Value = "01-Post"
                },
                new ListItem()
                {
                    Text = "30-SMS", Value = "30-SMS"
                }
            };

            List <ListItem> showQueueTypes = new List <ListItem>();

            foreach (ListItem queueType in allQueueTypes)
            {
                int queueSendType;
                if (int.TryParse(queueType.Text.Substring(0, 2), out queueSendType))
                {
                    if (queues.Exists(q => q.SendType == queueSendType))
                    {
                        showQueueTypes.Add(queueType);
                    }
                }
            }
            this.SendMethod.DataSource = showQueueTypes;
        }