protected void rptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var registrationInfo = e.Item.DataItem as DataRowView;
            var registrationHelper = new RegistrationHelper();
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues1))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues1));
                registrationHelper.BindCustomDDL(e, codes, "Custom1DD", "Custom1DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues2))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues2));
                registrationHelper.BindCustomDDL(e, codes, "Custom2DD", "Custom2DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues3))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues3));
                registrationHelper.BindCustomDDL(e, codes, "Custom3DD", "Custom3DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues4))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues4));
                registrationHelper.BindCustomDDL(e, codes, "Custom4DD", "Custom4DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues5))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues5));
                registrationHelper.BindCustomDDL(e, codes, "Custom5DD", "Custom5DDTXT");
            }

            var emailNotePanel = e.Item.FindControl("RegistrationEmailNotRequiredNote") as Panel;
            if (emailNotePanel != null && registrationInfo != null)
            {
                emailNotePanel.Visible =
                    registrationInfo["EmailAddress_Prompt"] as bool? == true
                    && registrationInfo["EmailAddress_Req"] as bool? != true;
            }

            var goalNotePanel = e.Item.FindControl("RegistrationGoalInfoNote") as Panel;
            if (goalNotePanel != null && registrationInfo != null)
            {
                goalNotePanel.Visible = registrationInfo["Goal_Prompt"] as bool? == true;
            }
        }
        protected void rptr_ItemDataBound(object sender, RepeaterItemEventArgs e) {
            DropDownList ctl = null;
            TextBox txt = null;
            ListItem i = null;

            ctl = (DropDownList)e.Item.FindControl("PrimaryLibrary");
            txt = (TextBox)e.Item.FindControl("PrimaryLibraryTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if(i != null)
                ctl.SelectedValue = txt.Text;


            ctl = (DropDownList)e.Item.FindControl("SchoolType");
            txt = (TextBox)e.Item.FindControl("SchoolTypeTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if(i != null)
                ctl.SelectedValue = txt.Text;

            //--
            ctl = (DropDownList)e.Item.FindControl("SchoolName");
            txt = (TextBox)e.Item.FindControl("SchoolNameTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if(i != null)
                ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("SDistrict");
            txt = (TextBox)e.Item.FindControl("SDistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if(i != null)
                ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("District");
            txt = (TextBox)e.Item.FindControl("DistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if(i != null)
                ctl.SelectedValue = txt.Text;

            var registrationHelper = new RegistrationHelper();
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues1)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues1));
                registrationHelper.BindCustomDDL(e, codes, "Custom1DD", "Custom1DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues2)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues2));
                registrationHelper.BindCustomDDL(e, codes, "Custom2DD", "Custom2DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues3)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues3));
                registrationHelper.BindCustomDDL(e, codes, "Custom3DD", "Custom3DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues4)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues4));
                registrationHelper.BindCustomDDL(e, codes, "Custom4DD", "Custom4DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues5)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues5));
                registrationHelper.BindCustomDDL(e, codes, "Custom5DD", "Custom5DDTXT");
            }
        }
        protected void rptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var ctl = (DropDownList)e.Item.FindControl("Gender");
            var txt = (TextBox)e.Item.FindControl("GenderTxt");
            var i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("PrimaryLibrary");
            txt = (TextBox)e.Item.FindControl("PrimaryLibraryTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("SchoolType");
            txt = (TextBox)e.Item.FindControl("SchoolTypeTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            //--
            ctl = (DropDownList)e.Item.FindControl("SchoolName");
            txt = (TextBox)e.Item.FindControl("SchoolNameTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("SDistrict");
            txt = (TextBox)e.Item.FindControl("SDistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("District");
            txt = (TextBox)e.Item.FindControl("DistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;
            //--

            var familyListButton = e.Item.FindControl("FamilyAccountList");
            var familyAddbutton = e.Item.FindControl("FamilyAccountAdd");
            var showFamilyList = Session[SessionKey.IsMasterAccount] as bool? == true;
            if(familyListButton != null) {
                familyListButton.Visible = showFamilyList;
            }
            if(familyAddbutton != null) {
                var patron = e.Item.DataItem as DataRowView;
                if(patron != null
                   && patron["Over18Flag"] as bool? == true
                   && patron["MasterAcctPID"] as int? == 0) {
                    familyAddbutton.Visible = !showFamilyList;
                } else {
                    familyAddbutton.Visible = false;
                }
            }

            var registrationHelper = new RegistrationHelper();
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues1)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues1));
                registrationHelper.BindCustomDDL(e, codes, "Custom1DD", "Custom1DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues2)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues2));
                registrationHelper.BindCustomDDL(e, codes, "Custom2DD", "Custom2DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues3)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues3));
                registrationHelper.BindCustomDDL(e, codes, "Custom3DD", "Custom3DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues4)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues4));
                registrationHelper.BindCustomDDL(e, codes, "Custom4DD", "Custom4DDTXT");
            }
            if(!string.IsNullOrEmpty(this.CustomFields.DDValues5)) {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues5));
                registrationHelper.BindCustomDDL(e, codes, "Custom5DD", "Custom5DDTXT");
            }
        }
 protected void rptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     var registrationHelper = new RegistrationHelper();
     if(!string.IsNullOrEmpty(this.CustomFields.DDValues1)) {
         var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues1));
         registrationHelper.BindCustomDDL(e, codes, "Custom1DD", "Custom1DDTXT");
     }
     if(!string.IsNullOrEmpty(this.CustomFields.DDValues2)) {
         var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues2));
         registrationHelper.BindCustomDDL(e, codes, "Custom2DD", "Custom2DDTXT");
     }
     if(!string.IsNullOrEmpty(this.CustomFields.DDValues3)) {
         var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues3));
         registrationHelper.BindCustomDDL(e, codes, "Custom3DD", "Custom3DDTXT");
     }
     if(!string.IsNullOrEmpty(this.CustomFields.DDValues4)) {
         var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues4));
         registrationHelper.BindCustomDDL(e, codes, "Custom4DD", "Custom4DDTXT");
     }
     if(!string.IsNullOrEmpty(this.CustomFields.DDValues5)) {
         var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues5));
         registrationHelper.BindCustomDDL(e, codes, "Custom5DD", "Custom5DDTXT");
     }
 }
        protected void rptr_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            var patron = e.Item.DataItem as DataRowView;

            var ctl = (DropDownList)e.Item.FindControl("Gender");
            var txt = (TextBox)e.Item.FindControl("GenderTxt");
            var i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("PrimaryLibrary");
            txt = (TextBox)e.Item.FindControl("PrimaryLibraryTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;


            ctl = (DropDownList)e.Item.FindControl("SchoolType");
            txt = (TextBox)e.Item.FindControl("SchoolTypeTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            //--
            ctl = (DropDownList)e.Item.FindControl("SchoolName");
            txt = (TextBox)e.Item.FindControl("SchoolNameTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("SDistrict");
            txt = (TextBox)e.Item.FindControl("SDistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;

            ctl = (DropDownList)e.Item.FindControl("District");
            txt = (TextBox)e.Item.FindControl("DistrictTxt");
            i = ctl.Items.FindByValue(txt.Text);
            if (i != null) ctl.SelectedValue = txt.Text;
            //--

            var familyListButton = e.Item.FindControl("FamilyAccountList");
            var familyAddbutton = e.Item.FindControl("FamilyAccountAdd");
            var showFamilyList = Session[SessionKey.IsMasterAccount] as bool? == true;
            if (familyListButton != null)
            {
                familyListButton.Visible = showFamilyList;
            }
            if (familyAddbutton != null)
            {
                if (patron != null
                   && patron["Over18Flag"] as bool? == true
                   && patron["MasterAcctPID"] as int? == 0)
                {
                    familyAddbutton.Visible = !showFamilyList;
                }
                else {
                    familyAddbutton.Visible = false;
                }
            }


            var registrationHelper = new RegistrationHelper();
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues1))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues1));
                registrationHelper.BindCustomDDL(e, codes, "Custom1DD", "Custom1DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues2))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues2));
                registrationHelper.BindCustomDDL(e, codes, "Custom2DD", "Custom2DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues3))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues3));
                registrationHelper.BindCustomDDL(e, codes, "Custom3DD", "Custom3DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues4))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues4));
                registrationHelper.BindCustomDDL(e, codes, "Custom4DD", "Custom4DDTXT");
            }
            if (!string.IsNullOrEmpty(this.CustomFields.DDValues5))
            {
                var codes = Codes.GetAlByTypeID(int.Parse(this.CustomFields.DDValues5));
                registrationHelper.BindCustomDDL(e, codes, "Custom5DD", "Custom5DDTXT");
            }

            var rewardPanel = e.Item.FindControl("ProgramRewardCodeDisplay") as Panel;
            var rewardLabel = e.Item.FindControl("ProgramRewardCodes") as Label;
            var rewardCodesData = DAL.ProgramCodes.GetAllForPatron((int)patron["PID"]);
            if (rewardCodesData != null
                && rewardCodesData.Tables.Count > 0
                && rewardCodesData.Tables[0].Rows.Count > 0)
            {
                var codes = rewardCodesData.Tables[0]
                    .AsEnumerable()
                    .Select(r => r.Field<string>("ShortCode"))
                    .ToArray();
                rewardLabel.Text = string.Join("<br>", codes);
                rewardPanel.Visible = true;
            }
            else
            {
                rewardLabel.Text = string.Empty;
                rewardPanel.Visible = false;
            }

            var program = DAL.Programs.FetchObject((int)patron["ProgID"]);
            if (program.HideSchoolInRegistration)
            {
                e.Item.FindControl("SDistrictPanel").Visible = false;
                e.Item.FindControl("SchoolTypePanel").Visible = false;
                e.Item.FindControl("SchoolNamePanel").Visible = false;
            }
        }