Exemplo n.º 1
0
        private MoM.DataLists.WebsiteSponsorshipCheckoutSourceRepsDataListRow[] GetHeardAboutUsSubRows()
        {
            MoM.DataLists.WebsiteSponsorshipCheckoutSourceRepsDataListRow[] rows = BBSession.TryItem <MoM.DataLists.WebsiteSponsorshipCheckoutSourceRepsDataListRow[]>(c_HEARDABOUTUSSUBROWS);

            if (rows == null)
            {
                DataListLoadRequest request = MoM.DataLists.WebsiteSponsorshipCheckoutSourceRepsDataList.CreateRequest(this.API.AppFxWebServiceProvider);
                request.ContextRecordID = this.API.Users.CurrentUser.BackOfficeGuid.ToString();
                rows = MoM.DataLists.WebsiteSponsorshipCheckoutSourceRepsDataList.GetRows(this.API.AppFxWebServiceProvider, request);

                BBSession.Add(c_HEARDABOUTUSSUBROWS, rows);
            }

            return(rows);
        }
        private DataTable GetChildrenDataSet()
        {
            DataTable       dt   = new DataTable();
            PagedDataSource page = new PagedDataSource();

            page.DataSource       = dt.DefaultView;
            page.AllowPaging      = true;
            page.PageSize         = MyContent.ResultsPerPage;
            page.CurrentPageIndex = this.currentPage;

            string age0 = string.Empty;
            string age1 = string.Empty;

            if (!string.IsNullOrEmpty(AGE))
            {
                string[] range = AGE.Split('-');
                age0 = range[0];
                age1 = range[1];
            }

            using (SqlConnection con = new SqlConnection(Blackbaud.Web.Content.Core.Settings.ConnectionString))
            {
                //using (SqlCommand cmd = new SqlCommand("USR_USP_CHILDREN_WEBSEARCH", con))
                //{
                //    cmd.Parameters.Add(new SqlParameter("@GENDER", GENDER));
                //    cmd.Parameters.Add(new SqlParameter("@AGE0", age0));
                //    cmd.Parameters.Add(new SqlParameter("@AGE1", age1));
                //    cmd.Parameters.Add(new SqlParameter("@COUNTRY", COUNTRY));

                //    cmd.CommandType = CommandType.StoredProcedure;

                //    using(SqlDataAdapter dta = new SqlDataAdapter(cmd))
                //    {
                //        con.Open();
                //        dta.Fill(dt);
                //    }
                //}
            }

            BBSession.Remove("CHILDREN");
            BBSession.Add("CHILDREN", dt);

            return(dt);
        }
        private DataTable GetChildrenDataSet()
        {
            if (Request.QueryString["AGE"] != null)
            {
                AGE = Request.QueryString["AGE"].ToString();
            }

            if (Request.QueryString["GENDER"] != null)
            {
                GENDER = Request.QueryString["GENDER"].ToString();
                if (GENDER.ToLower() == "either")
                {
                    GENDER = string.Empty;
                }
            }

            if (Request.QueryString["COUNTRY"] != null)
            {
                COUNTRY = Request.QueryString["COUNTRY"].ToString();
                if (COUNTRY.ToLower() == "all")
                {
                    COUNTRY = string.Empty;
                }
            }

            if (Request.QueryString["CHOOSEFORME"] != null)
            {
                CHOOSEFORME = Request.QueryString["CHOOSEFORME"].ToString();
            }

            DataTable       dt   = new DataTable();
            PagedDataSource page = new PagedDataSource();

            page.DataSource       = dt.DefaultView;
            page.AllowPaging      = true;
            page.PageSize         = MyContent.ResultsPerPage;
            page.CurrentPageIndex = this.currentPage;

            string age0 = string.Empty;
            string age1 = string.Empty;

            if (!string.IsNullOrEmpty(AGE))
            {
                if (AGE.ToLower() != "all")
                {
                    if (AGE.Contains("-"))
                    {
                        string[] range = AGE.Split('-');
                        age0 = range[0];
                        age1 = range[1];
                    }
                    else
                    {
                        if (AGE.Substring(AGE.Length - 1, 1) == "p")
                        {
                            age0 = AGE.Substring(0, AGE.Length - 1);
                            age1 = "99";
                        }
                        else
                        {
                            age0 = AGE;
                            age1 = AGE;
                        }
                    }
                }
            }

            //**
            //using(SqlConnection con = new SqlConnection(Blackbaud.Web.Content.Core.Settings.ConnectionString))
            //{
            //    using (SqlCommand cmd = new SqlCommand("USR_USP_CHILDREN_WEBSEARCH", con))
            //    {
            //        cmd.Parameters.Add(new SqlParameter("@GENDER", GENDER));
            //        cmd.Parameters.Add(new SqlParameter("@AGE0", age0));
            //        cmd.Parameters.Add(new SqlParameter("@AGE1", age1));
            //        cmd.Parameters.Add(new SqlParameter("@COUNTRY", COUNTRY));

            //        cmd.CommandType = CommandType.StoredProcedure;

            //        using(SqlDataAdapter dta = new SqlDataAdapter(cmd))
            //        {
            //            con.Open();
            //            dta.Fill(dt);
            //        }
            //    }
            //}
            //**

            dt.Columns.Add("ID");
            dt.Columns.Add("FIRSTNAME");
            dt.Columns.Add("LASTNAME");
            dt.Columns.Add("FULLNAME");
            dt.Columns.Add("COUNTRYNAME");
            dt.Columns.Add("COUNTRYID");
            dt.Columns.Add("AGE");
            dt.Columns.Add("BIRTHDATE");
            dt.Columns.Add("GENDER");
            dt.Columns.Add("GENDERCODE");
            dt.Columns.Add("PROJECTNAME");
            dt.Columns.Add("PROJECTID");
            dt.Columns.Add("CHILDNO");
            dt.Columns.Add("ELIGIBILITY");
            dt.Columns.Add("AVAILABILITY");
            dt.Columns.Add("IMAGEURL");

            OCM.BBISWebParts.WebsiteChurchPartnerChildSearchDataListFilterData filter = new OCM.BBISWebParts.WebsiteChurchPartnerChildSearchDataListFilterData();

            filter.COUNTRY = COUNTRY;
            filter.GENDER  = GENDER;
            filter.AGEMIN  = age0;
            filter.AGEMAX  = age1;


            //DataListLoadRequest request = Blackbaud.AppFx.Sponsorship.Catalog.WebApiClient.DataLists.Constituent.SponsorshipDataList.CreateRequest(this.API.AppFxWebServiceProvider);
            //request.DataListID = new Guid("5ECB50D7-01C2-4487-8B34-1ECCF6E4FF5B");
            //request.ContextRecordID = MyContent.PartnerLookupID;

            OCM.BBISWebParts.WebsiteChurchPartnerChildSearchDataListRow[] rows = OCM.BBISWebParts.WebsiteChurchPartnerChildSearchDataList.GetRows(this.API.AppFxWebServiceProvider, MyContent.PartnerLookupID, filter);

            foreach (OCM.BBISWebParts.WebsiteChurchPartnerChildSearchDataListRow row in rows)
            {
                DataRow dr = dt.NewRow();
                dr["ID"]           = row.ID;
                dr["FIRSTNAME"]    = row.FIRSTNAME;
                dr["LASTNAME"]     = row.LASTNAME;
                dr["FULLNAME"]     = row.FULLNAME;
                dr["COUNTRYNAME"]  = row.COUNTRYNAME;
                dr["COUNTRYID"]    = row.COUNTRYID;
                dr["AGE"]          = row.AGE;
                dr["BIRTHDATE"]    = row.BIRTHDATE;
                dr["GENDER"]       = row.GENDER;
                dr["GENDERCODE"]   = row.GENDERCODE;
                dr["PROJECTNAME"]  = row.PROJECTNAME;
                dr["PROJECTID"]    = row.PROJECTID;
                dr["CHILDNO"]      = row.CHILDNO;
                dr["ELIGIBILITY"]  = row.ELIGIBILITY;
                dr["AVAILABILITY"] = row.AVAILABILITY;
                dr["IMAGEURL"]     = "custom/ChildSponsorship2/ImageHandler.ashx?context=sponsorship&type=" + MyContent.ThumbnailNoteType + "&id=" + row.ID;

                dt.Rows.Add(dr);
            }


            BBSession.Remove("CHILDREN");
            BBSession.Add("CHILDREN", dt);

            return(dt);
        }