protected void Display()
 {
     toGetInfo getinfo = new toGetInfo();
     hfSchdID.Value =  getinfo.getSchdID();
     hfSIteID.Value = getinfo.getValueSiteID();
     hfStaffID.Value = Session["staffid"].ToString();
     Session["staffid"] = null;
     getinfo.setSchdID(null);
     getinfo.setSiteID(null);
     if (hfSIteID.Value.Length > 0 && hfSchdID.Value.Length > 0)
     {               
         string sqlquery = "SELECT [Question_ID], [Question], Label_ID FROM [ISBEPI_DEV].[dbo].[PROGRAM_DIRECTOR_SURVEY_QUESTIONS] WHERE [Label_ID] IN ( 'lblQ1','lblQ2','lblQ3','lblQ4','lblQ5','lblQ6','lblQ7','lblQ8','lblQ9','lblQ10','lblQ11');";
         DataTable dt = DBHelper.GetDataTable(sqlquery);
         Label lblQ = new Label();
         for (int x = 0; x < dt.Rows.Count; x++)
         {
             if (dt.Rows[x]["Question_ID"].ToString().Trim() == "Q7")
             {
                 lblQ = this.Master.FindControl("ContentPlaceHolder1").FindControl(dt.Rows[x]["Label_ID"].ToString().Trim()) as Label;
                 const int july = 7;
                 //const int june = 1;
                 if (DateTime.Now.Month == july)
                 {
                     string update = dt.Rows[x]["Question"].ToString().Replace("July 2014-June 2015", "July " + DateTime.Now.Year.ToString() + "-June " + DateTime.Now.AddYears(1).Year.ToString() + "");
                     string sqlupdate = "UPDATE [PROGRAM_DIRECTOR_SURVEY_QUESTIONS] SET [Question] ='" + update + "' WHERE Question_ID ='Q7'";
                     DBHelper.ExecuteSQL(sqlupdate);
                     string sqlqueryq7 = "SELECT * FROM [PROGRAM_DIRECTOR_SURVEY_QUESTIONS] WHERE Question_ID ='Q7'";
                     DataTable dtq7 = DBHelper.GetDataTable(sqlqueryq7);
                     lblQ.Text = dtq7.Rows[0]["Question"].ToString();
                    
                 }
                 else
                 {
                     lblQ.Text = dt.Rows[x]["Question"].ToString();
                 }
             }
             else
             {
                 lblQ = this.Master.FindControl("ContentPlaceHolder1").FindControl(dt.Rows[x]["Label_ID"].ToString().Trim()) as Label;
                 lblQ.Text = dt.Rows[x]["Question"].ToString();
             }
         }
         lblQ5_Yes_or_No.Text = "Do you Speak any languages, other than English, that you speak fluently?";               
     }
     else
     {
         Response.Redirect("~/ProgramDirector/default.aspx");
     }
 }  
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            check = false;
          
            if (chkbxlstQ27.SelectedValue.Length > 0 || chkbxlstQ27.SelectedValue.Length < 1)
            {
                if (chkbxlstQ27.SelectedValue.Length < 1)
                {
                    lblQ27Comment.Visible = true;
                    lblQ27Comment.Text = "Required";
                    check = true;
                }
                else
                {
                    for (int x = 0; x < chkbxlstQ27.Items.Count; x++)
                    {
                        if (chkbxlstQ27.Items[x].Selected)
                        {
                            if ((chkbxlstQ27.Items[x].Value == "4" && txtQ27Explain.Text.Length < 1))
                            {
                                lblQ28Comment.Visible = true;
                                lblQ27Comment.Text = "Required";
                                check = true;
                            }
                        }
                    }
                }
            }
            if (chkbxlstQ28.SelectedValue.Length < 1)
            {
                lblQ28Comment.Visible = true;
                lblQ28Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ29.SelectedValue.Length < 1)
            {
                lblQ29Comment.Visible = true;
                lblQ29Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ30.SelectedValue.Length < 1)
            {
                lblQ30Comment.Visible = true;
                lblQ30Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ31.SelectedValue.Length < 1)
            {
                lblQ31Comment.Visible = true;
                lblQ31Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ32.SelectedValue.Length < 1)
            {
                lblQ32Comment.Visible = true;
                lblQ32Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ33.SelectedValue.Length < 1)
            {
                lblQ33Comment.Visible = true;
                lblQ33Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ34.SelectedValue.Length < 1)
            {
                lblQ34Comment.Visible = true;
                lblQ34Comment.Text = "Required";
                check = true;
            }
            if (chkbxlstQ35.SelectedValue.Length < 1)
            {
                lblQ35Comment.Visible = true;
                lblQ35Comment.Text = "Required";
                check = true;
            }
            if (check == false)
            {
                lblQ27Comment.Visible = false;
                lblQ28Comment.Visible = false;
                lblQ29Comment.Visible = false;
                lblQ30Comment.Visible = false;
                lblQ31Comment.Visible = false;
                lblQ32Comment.Visible = false;
                lblQ33Comment.Visible = false;
                lblQ34Comment.Visible = false;
                lblQ35Comment.Visible = false;
                for (int r = 0; r < PD.GetData().Rows.Count; r++)
                {

                    if (PD.GetData().Rows[r]["Schd_ID"].ToString() == hfSchdID.Value && hfStaffID.Value == PD.GetData().Rows[r]["Staff_ID"].ToString())
                    {
                        row = PD.GetData().Rows[r];
                        //Q27
                        for (int x = 0; x < chkbxlstQ27.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ27.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ27.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q27_" + add] = chkbxlstQ27.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q27_" + add] = DBNull.Value;
                            //}

                        }
                        row["PD_DataCollectionProcess_Q27_other"] = txtQ27Explain.Text;

                        //Q28
                        for (int x = 0; x < chkbxlstQ28.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ28.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ28.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q28_" + add] = chkbxlstQ28.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q28_" + add] = DBNull.Value;
                            //}

                        }
                        //Q29
                        for (int x = 0; x < chkbxlstQ29.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ29.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ29.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q29_" + add] = chkbxlstQ29.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q29_" + add] = DBNull.Value;
                            //}

                        }
                        //Q30
                        for (int x = 0; x < chkbxlstQ30.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ30.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ30.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q30_" + add] = chkbxlstQ30.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q30_" + add] = DBNull.Value;
                            //}

                        }
                        //Q31
                        for (int x = 0; x < chkbxlstQ31.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ31.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ31.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q31_" + add] = chkbxlstQ31.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q31_" + add] = DBNull.Value;
                            //}

                        }
                        //Q32
                        for (int x = 0; x < chkbxlstQ32.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ32.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ32.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q32_" + add] = chkbxlstQ32.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q32_" + add] = DBNull.Value;
                            //}

                        }
                        //Q33
                        for (int x = 0; x < chkbxlstQ33.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ33.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ33.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q33_" + add] = chkbxlstQ33.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q33_" + add] = DBNull.Value;
                            //}

                        }
                        //Q34
                        for (int x = 0; x < chkbxlstQ34.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ34.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ34.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q34_" + add] = chkbxlstQ34.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q34_" + add] = DBNull.Value;
                            //}

                        }
                        //Q35
                        for (int x = 0; x < chkbxlstQ35.Items.Count; x++)
                        {
                            int add;
                            //if (chkbxlstQ35.Items[x].Selected)
                            //{

                                if (x == chkbxlstQ35.Items.Count)
                                {
                                    break;
                                }
                                else
                                {
                                    add = x + 1;
                                    row["PD_DataCollectionProcess_Q35_" + add] = chkbxlstQ35.Items[x].Selected;
                                }

                            //}
                            //else
                            //{
                            //    add = x + 1;
                            //    row["PD_DataCollectionProcess_Q35_" + add] = DBNull.Value;
                            //}

                        }
                        //row["Completed"] = "Completed";
                        //row["CompletedDate"] = DateTime.Now.ToShortDateString();
                        PD.Update(row);
                    }
                }
                toGetInfo getinfo = new toGetInfo();                
                getinfo.setSchdID(hfSchdID.Value );
                getinfo.setSiteID(hfSIteID.Value);
                Session["Staff_ID"] = hfStaffID.Value;
                Response.Redirect("~/ProgramDirector/PD_Review.aspx");               
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
                Response.Cache.SetNoStore();
            }
        }