/// <summary>
        /// Shows the public question form grid.
        /// </summary>
        /// <param name="dataGrid">The data grid.</param>
        /// <param name="index">The index.</param>
        /// <param name="sort">The sort.</param>
        /// <param name="order">The order.</param>
        /// <param name="organisationId">The organisation id.</param>
        /// <param name="PublicityLevel">The publicity level.</param>
        protected static void ShowPublicQuestionFormGrid(DataGrid dataGrid,
                                              int index, string sort, string order, Guid organisationId,
                                              int PublicityLevel)
        {
            IOrganisationService orgservice = ServiceFactory.GetOrganisationService();
            Organisation orgM = orgservice.OrganisationSelect(organisationId);
            if (orgM.IsActive) // nem aktív a szervezet
            {
            // Get query result from database
            ITemplateService srv = ServiceFactory.GetTemplateService();
            TemplateContainer selected = srv.TemplateSelectOfOrganisationQuestionForm(organisationId,
                                                                                      PublicityLevel);

            if (selected.AllCount > 0)
            {
                dataGrid.Visible = true;
            }
            else
            {
                dataGrid.Visible = false;
                return;
            }

            ArrayList sortableList;
            // Sort if necessary
            if (sort == null)
            {
                sortableList = selected.All.Items;
            }
            else
            {
                if (String.Compare(order, "Ascending", true) == 0)
                {
                    sortableList = selected.All.SortBy(sort, true);
                }
                else if (String.Compare(order, "Descending", true) == 0)
                {
                    sortableList = selected.All.SortBy(sort, false);
                }
                else
                {
                    sortableList = selected.All.SortBy(sort);
                }
            }

            // Bind list to datagrid control
            dataGrid.CurrentPageIndex = index;
            dataGrid.CurrentSortExpression = sort;
            dataGrid.CurrentSortOrder = order;
            dataGrid.DataSource = sortableList;
            dataGrid.DataBind();
            }
        }
        protected void ShowForumGroupGrid(DataGrid dataGrid,
                                      int index, string sort, string order)
        {
            // Get query result from database
              IForumGroupService srv = ServiceFactory.GetForumGroupService();
              ForumGroupContainer selected = null;
              if (Context.User.Identity.IsAuthenticated)
              {
            selected = srv.ForumGroupSelectAllForRegistered();
              }
              else
              {
            selected = srv.ForumGroupSelectAllForVisitors();
              }

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
              }
              else
              {
            dataGrid.Visible = false;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowForumItemGrid(DataGrid dataGrid,
                                     int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.ForumItemList");

              // Get query result from database
              ForumItem filter = new ForumItem(Guid.NewGuid());
              //filter.ItemText = txtSearchExpression.Text;
              filter.ItemText = Helpers.BuildFreetextCondition(txtSearchExpression.Text);

              if (Context.User.Identity.IsAuthenticated)
              {
            filter.FilterOnVisibleForRegistered = 1;
              }
              else
              {
            filter.FilterOnVisibleForVisitor = 1;
              }

              IForumItemService srv = ServiceFactory.GetForumItemService();
              ForumItemContainer selected = srv.ForumItemSelectFreetext(filter);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotfound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotfound.Visible = true;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.ProgramList");

              // Get query result from database
              Program filter = new Program(Guid.NewGuid());
              filter.FilterOnKeyword1 = Helpers.CreateLikeSearchText(txtKeyword1.Text);
              if (txtKeyword2.Text.Trim().Length > 0)
              {
            filter.FilterOnKeywordRelation1 = cmbKeywordRelation1.SelectedValue;
            filter.FilterOnKeyword2 = Helpers.CreateLikeSearchText(txtKeyword2.Text);
              }
              if (txtKeyword3.Text.Trim().Length > 0)
              {
            filter.FilterOnKeywordRelation2 = cmbKeywordRelation2.SelectedValue;
            filter.FilterOnKeyword3 = Helpers.CreateLikeSearchText(txtKeyword3.Text);
              }
              if (txtKeyword4.Text.Trim().Length > 0)
              {
            filter.FilterOnKeywordRelation3 = cmbKeywordRelation3.SelectedValue;
            filter.FilterOnKeyword4 = Helpers.CreateLikeSearchText(txtKeyword4.Text);
              }

              IProgramService srv = ServiceFactory.GetProgramService();
              ProgramContainer selected = srv.ProgramSelectByKeyword(filter);

              if (selected.AllCount > 0)
              {
            gridProgram.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            gridProgram.Visible = false;
            lblNotFound.Visible = true;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
示例#5
0
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order)
        {
            //lekérdezzük a régió kódhoz tartozó nevet

              IOrganisationService srvOrg = ServiceFactory.GetOrganisationService();
              Organisation filter = new Organisation(Guid.NewGuid());
              filter.FilterOnIsactive = (DBInt) Convert.ToInt32(true);
              filter.IsActive = true;
              filter.IsKef = true;
              OrganisationDispsetContainer data = srvOrg.OrganisationSelectDispsetFiltered(filter);
              OrganisationDispsetContainer contUnion = data;

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = contUnion.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = contUnion.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = contUnion.All.SortBy(sort, false);
            }
            else
            {
              sortableList = data.All.SortBy(sort);
            }
              }

              if (contUnion.AllCount > 0)
              {
            // Bind list to datagrid control
            dataGrid.CurrentPageIndex = index;
            dataGrid.CurrentSortExpression = sort;
            dataGrid.CurrentSortOrder = order;
            dataGrid.DataSource = sortableList;
            dataGrid.DataBind();
            dataGrid.Visible = true;
            dataGrid.Focus();
              }
              else
              {
            dataGrid.Visible = false;
              }
        }
        protected void ShowGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.ProgramList");

              if (cmbTemplate.SelectedValue.ToString() == "")
              {
            btn_Search.Visible = false;
            btn_ExportCsv.Visible = false;
            btn_ExportRtf.Visible = false;
            btn_SearchClear.Visible = false;
            return;
              }
              // Build filter document:
              Guid templateGuid = new Guid(cmbTemplate.SelectedValue);
              TemplateControl1.SetAnswer();
              QuestionForm form = new QuestionForm(Guid.NewGuid());
              form.TemplateRef = templateGuid;
              foreach (IQuestion question in TemplateControl1.Questions)
              {
            TemplateDetail detail = (TemplateDetail) question;
            string ans = detail.Answer.Trim();
            if (ans.Length > 0)
            {
              if (!ans.Equals("-- Összes --"))
              {
            QuestionFormDetail questionDetail = new QuestionFormDetail(form.ID, detail.ID, templateGuid);
            questionDetail.Answer = ans;
            form.Details.Add(questionDetail);
              }
            }
              }

              // Get query result from database
              IProgramService srv = ServiceFactory.GetProgramService();
              ProgramContainer selected = srv.ProgramSelectByQuestionForm(form);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.KeywordList");

              // Get query result from database
              Thesaurus filter = new Thesaurus("%" + txtKeyword1.Text + "%");

              IThesaurusService srv = ServiceFactory.GetThesaurusService();
              ThesaurusContainer selected = srv.ThesaurusSelectForFilter(filter);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowPartnerProgramGrid(DataGrid dataGrid, int index, string sort, string order, Guid orgId)
        {
            // Get query result from database
              IOrganisationService orgSrv = ServiceFactory.GetOrganisationService();
              ProgramContainer selected = orgSrv.ProgramSelectByPartnerOrganisation(orgId);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNoPartner.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNoPartner.Visible = true;
            return;
              }

              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowProgramGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.ProgramList");

              // Get query result from database
              Program filter = new Program(Guid.NewGuid());
              if (cmbCategory.SelectedValue.Length > 0)
              {
            if (cmbCategory.SelectedValue != "ALL_PROGRAMS")
              filter.ProgramCategoryRef = cmbCategory.SelectedValue;
              }

              filter.FilterOnFreetext = Helpers.BuildFreetextCondition(txtSearchExpression.Text);
              //filter.FilterOnFreetext = "\"" + txtSearchExpression.Text + "\"";
              //filter.FilterOnFreetext = txtSearchExpression.Text;
              filter.FilterOnIsActive = 1;

              if (Context.User.Identity.IsAuthenticated)
              {
            filter.FilterOnPublicityLevel = PublicityLevel.RegisteredOnly;
              }
              else
              {
            filter.FilterOnPublicityLevel = PublicityLevel.Public;
              }

              IProgramService srv = ServiceFactory.GetProgramService();
              ProgramContainer selected = srv.ProgramSelectFreetext(filter);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowNewsGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.News");

              // Get query result from database
              INewsService srv = ServiceFactory.GetNewsService();
              NewsContainer selected = null;

              DBInt isActual = DBInt.Null;
              DBInt visibleForVisitors;
              DBInt visibleForRegistred;

              if (Context.User.Identity.IsAuthenticated)
              {
            visibleForVisitors = DBInt.Null;
            visibleForRegistred = 1;
              }
              else
              {
            visibleForVisitors = 1;
            visibleForRegistred = DBInt.Null;
              }

              if (cmbCategory.SelectedValue == "NEWS")
            isActual = 1; //az aktuális hírekben keres
              else if (cmbCategory.SelectedValue == "NEWS_ARCH")
            isActual = 0; //csak az archívumban keres

              string filterOnFreetext = Helpers.BuildFreetextCondition(txtSearchExpression.Text);

              selected = srv.NewsSelectFreeText(filterOnFreetext, 1, isActual, visibleForVisitors, visibleForRegistred);

              if (selected.AllCount > 0)
              {
            lblNotFound.Visible = false;
            dataGrid.Visible = true;
              }
              else
              {
            lblNotFound.Visible = true;
            dataGrid.Visible = false;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
示例#11
0
        protected void ShowQuestionFormGrid(DataGrid dataGrid,
                                        int index, string sort, string order, Guid programId)
        {
            // Get query result from database
              ITemplateService srv = ServiceFactory.GetTemplateService();
              TemplateContainer selected = srv.TemplateSelectOfProgramPendingQuestionForm(programId);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNoQuest.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNoQuest.Visible = true;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowIndexGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.QuestionList");

              ITemplateService templateService = ServiceFactory.GetTemplateService();
              string templateId = Request["templId"];
              Template template = templateService.TemplateSelect(new Guid(templateId));

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = template.Pages.All.Items;
              dataGrid.DataBind();
        }
        protected void ShowForumThreadGrid(DataGrid dataGrid,
                                       int index, string sort, string order, Guid groupGuid)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.ForumThreadList");

              // Get query result from database
              ForumThread filter = new ForumThread(Guid.NewGuid());
              filter.FilterOnIsactive = 1;
              filter.ForumGroupRef = groupGuid;

              IForumThreadService srv = ServiceFactory.GetForumThreadService();
              ForumThreadContainer selected = srv.ForumThreadSelectFiltered(filter);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
            return;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
示例#14
0
        protected void ShowUserGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.UserList");

              UserContainer selected = new UserContainer();
              JobAnswer filter = new JobAnswer(m_JobId, JobAnswerTypeEnum.FIN, "", Context.User.Identity.Name);
              filter.FilterOnIsActive = 1;
              IJobAnswerService srvJobAnswer = ServiceFactory.GetJobAnswerService();
              IUserService srvUser = ServiceFactory.GetUserService();
              JobAnswerContainer answers = srvJobAnswer.JobAnswerSelectFiltered(filter);
              foreach (JobAnswer answer in answers.All)
              {
            User user = srvUser.UserSelect(answer.SubscriberNameRef);
            selected.Add(user);
              }

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFoundUser.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFoundUser.Visible = true;
            return;
              }

              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else sortableList = String.Compare(order, "Descending", true) == 0 ? selected.All.SortBy(sort, false) : selected.All.SortBy(sort);
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
        protected void ShowGrid(DataGrid dataGrid, int index, string sort, string order)
        {
            dataGrid.PageSize = Helpers.GetPageSize("PageSize.Competition");

              // Get query result from database
              ICompetitionService srv = ServiceFactory.GetCompetitionService();
              CompetitionContainer selected = srv.CompetitionSelectActive();

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNotFound.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNotFound.Visible = true;
              }

              ArrayList sortableList = null;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }
示例#16
0
        protected void ShowGrid(DataGrid dataGrid,
                            int index, string sort, string order, string regionCode)
        {
            dataGrid.PageSize = Helper.GetPageSize("PageSize.RegionSearch");

              if (regionCode != null)
              {
            //lekérdezzük a régió kódhoz tartozó nevet
            IRegionSearchService srvRegSearch = ServiceFactory.GetRegionSearchService();
            lblRegionName.Text = srvRegSearch.RegionSearchSelect(regionCode).RegionDescription;
            lblRegionName.Text = "(" + lblRegionName.Text + ")";

            IOrganisationService srvOrg = ServiceFactory.GetOrganisationService();
            Organisation filter = new Organisation(Guid.NewGuid());
            filter.FilterOnIsactive = (DBInt) Convert.ToInt32(true);
            filter.IsActive = true;
            filter.RegionSearchCodeRef = regionCode;
            OrganisationDispsetContainer data = srvOrg.OrganisationSelectDispsetFiltered(filter);
            OrganisationDispsetContainer contUnion = data;

            ArrayList sortableList = null;
            // Sort if necessary
            if (sort == null)
            {
              sortableList = contUnion.All.Items;
            }
            else
            {
              if (String.Compare(order, "Ascending", true) == 0)
              {
            sortableList = contUnion.All.SortBy(sort, true);
              }
              else if (String.Compare(order, "Descending", true) == 0)
              {
            sortableList = contUnion.All.SortBy(sort, false);
              }
              else
              {
            sortableList = data.All.SortBy(sort);
              }
            }

            if (contUnion.AllCount > 0)
            {
              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
              dataGrid.Visible = true;
              dataGrid.Focus();
              lblPleaseSelect.Visible = false;
            }
            else
            {
              dataGrid.Visible = false;
              lblNotFound.Visible = true;
              lblPleaseSelect.Visible = false;
            }
              }
              else lblPleaseSelect.Visible = true;
        }
        protected void ShowOwnProgramGrid(DataGrid dataGrid, int index, string sort, string order, Guid orgId)
        {
            // Get query result from database

              Program filter = new Program(Guid.NewGuid());
              filter.OrganisationRef = orgId;
              filter.FilterOnIsActive = 1;
              IProgramService srv = ServiceFactory.GetProgramService();
              ProgramContainer selected = srv.ProgramSelectFiltered(filter);

              if (selected.AllCount > 0)
              {
            dataGrid.Visible = true;
            lblNoOwnProgram.Visible = false;
              }
              else
              {
            dataGrid.Visible = false;
            lblNoOwnProgram.Visible = true;
            return;
              }

              ArrayList sortableList;
              // Sort if necessary
              if (sort == null)
              {
            sortableList = selected.All.Items;
              }
              else
              {
            if (String.Compare(order, "Ascending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, true);
            }
            else if (String.Compare(order, "Descending", true) == 0)
            {
              sortableList = selected.All.SortBy(sort, false);
            }
            else
            {
              sortableList = selected.All.SortBy(sort);
            }
              }

              // Bind list to datagrid control
              dataGrid.CurrentPageIndex = index;
              dataGrid.CurrentSortExpression = sort;
              dataGrid.CurrentSortOrder = order;
              dataGrid.DataSource = sortableList;
              dataGrid.DataBind();
        }