コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query = Request.QueryString["query"];

            if (query == null)
            {
                query = Request.QueryString["Search_TextBox"];
            }
            query = query == null ? "" : query;
            string province = Request.QueryString["province"];

            if (province == null)
            {
                province = "0";
            }
            bool   looseSearch    = true;
            string looseSearchStr = Request.QueryString["loose"];

            if (looseSearchStr != null && looseSearchStr.ToLower() == "false")
            {
                looseSearch = false;
            }

            int    rowsPerPage    = 50;
            int    currentPage    = 0;
            string currentPageStr = Request.QueryString["page"];

            if (!int.TryParse(currentPageStr, out currentPage))
            {
                currentPage = 0;
            }

            int    userId    = -1;
            string userIDStr = Request.QueryString["id"];

            int.TryParse(userIDStr, out userId);

            //Charity
            CharityProfile charity = DonorSearchManager.GetCharityProfile(userId);

            if (charity == null)
            {
                Response.Redirect("../../");
            }
            else
            {
                displayCharityFullName(charity.FullName);
                displayCharityRegNumber(charity.RegNumber);

                displayCharityCategory(charity.Category.Name, charity.Category.Description);
                displayCharityDesignation(charity.Designation.Description);

                displayCharityAddress(charity.Province, charity.City, charity.Address1, charity.Address2, charity.PostalCode);
                displayContactInforamtion(charity.Email, charity.Phone, charity.Website);

                displayCharityPrograms(charity.Programs);
                displayCharityCountries(charity.Countries);
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string query = Request.QueryString["query"];

            if (query == null)
            {
                query = Request.QueryString["Search_TextBox"];
            }
            query = query == null ? "" : query;
            string province = Request.QueryString["province"];

            if (province == null)
            {
                province = "0";
            }
            bool   looseSearch    = true;
            string looseSearchStr = Request.QueryString["loose"];

            if (looseSearchStr != null && looseSearchStr.ToLower() == "false")
            {
                looseSearch = false;
            }

            int    rowsPerPage    = 50;
            int    currentPage    = 0;
            string currentPageStr = Request.QueryString["page"];

            if (!int.TryParse(currentPageStr, out currentPage))
            {
                currentPage = 0;
            }

            loose_search_radio.Checked  = looseSearch;
            strong_search_radio.Checked = !looseSearch;

            this.Search_TextBox.Value   = query;
            this.location_div.InnerHtml = C4H_Website.Managers.DesignManager.GenerateProvinceCombobox(province);

            int totalRows = 0;
            Dictionary <string, int>             geoStatistics;
            Dictionary <CharityDesignation, int> designationStatistics;
            List <CharityProfile> profiles = DonorSearchManager.SearchCharitiesByQuery(query, province, looseSearch, currentPage, rowsPerPage, out totalRows, out geoStatistics, out designationStatistics);

            accordion1.InnerHtml = "<br/></br></br>" + GenerateMapStatiscalHTML(geoStatistics)
                                   + "<h2>Results</h2>"
                                   + (profiles == null ? "" : "<h4>Showing you " + (currentPage * rowsPerPage + 1) + "-" + (currentPage * rowsPerPage + profiles.Count()) + " out of " + totalRows + "</h4>")
                                   + GenereatePageHTMLNavigation(currentPage, rowsPerPage, totalRows) + " " + GenerateDesignationStatisticsHTML(designationStatistics)
                                   + "<br/>" + GenerateHTMLResult(profiles, query, province, looseSearch, currentPage);
        }