protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "KeenProfile Assessment";
        if (!this.Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["success"]))
            {
                main_thanks.Visible = true;
                main_form.Visible   = false;

                Model_AssesIntro intro = new Model_AssesIntro();
                intro            = intro.GetIntro();
                ThanksTitle.Text = intro.ThanksTitle;
                ThanksDes.Text   = convertcontent(intro.ThanksDes);
            }
            else
            {
                Model_Users u = this.UserActive;
                if (u != null)
                {
                    //Get Main Intro
                    Model_AssesIntro intro = new Model_AssesIntro();
                    intro = intro.GetIntro();


                    //Get Job Function
                    Model_CJF        cjf     = new Model_CJF();
                    List <Model_CJF> cjflist = cjf.GetCJFeAll();

                    Model_UserCJF        cjflistUser    = new Model_UserCJF();
                    List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID);

                    //Get Functional Competencies
                    Model_FC        fc     = new Model_FC();
                    List <Model_FC> fclist = fc.GetFCAll();

                    Model_UserFC        fcuser        = new Model_UserFC();
                    List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID);

                    //Get Section
                    Model_AsSection        section     = new Model_AsSection();
                    List <Model_AsSection> sectionlist = section.GetListSection(true);

                    //Get Assessment
                    Model_Assessment        ass     = new Model_Assessment();
                    List <Model_Assessment> asslist = ass.GetAssessmentAll();

                    //Get Country
                    Model_Country        c        = new Model_Country();
                    List <Model_Country> ccountry = c.GetAllCountry();


                    dropNation.DataSource     = ccountry;
                    dropNation.DataTextField  = "DropValue";
                    dropNation.DataValueField = "ID";
                    dropNation.DataBind();

                    dropNation.SelectedValue = "211";


                    StringBuilder strcjf = new StringBuilder();
                    StringBuilder strfc  = new StringBuilder();


                    strcjf.Append("<div  class=\"checkitem\">");


                    foreach (Model_CJF i  in cjflist.Where(r => r.Status))
                    {
                        string check = string.Empty;
                        if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0)
                        {
                            check = "Checked=\"Checked\"";
                        }


                        strcjf.Append("<div class=\"item\">");
                        strcjf.Append("<input  type=\"radio\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">");
                        strcjf.Append("<label>" + i.Title + "</label>");
                        strcjf.Append("</div>");
                    }


                    strcjf.Append("</div>");



                    strfc.Append("<div class=\"checkitem\">");

                    foreach (Model_FC i in fclist)
                    {
                        string check = string.Empty;
                        if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0)
                        {
                            check = "Checked=\"Checked\"";
                        }

                        strfc.Append("<div class=\"item\">");
                        strfc.Append("<input  type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">");
                        strfc.Append("<label>" + i.Title + "</label>");
                        strfc.Append("</div>");
                    }

                    strfc.Append("</div>");

                    chckCJF.Text = strcjf.ToString();
                    // checkFC.Text = strfc.ToString();



                    IntroTitle.Text  = intro.Title;
                    IntroDetail.Text = convertcontent(intro.Description);

                    LastTitle.Text = intro.LastTitle;
                    LastDes.Text   = convertcontent(intro.LastDes);

                    Maintitle.Text = intro.MainTitle;


                    profiletitle.Text = intro.ProfileTitle;
                    //fctitle.Text = intro.ProfileFCTitle;
                    cjftitle.Text = intro.ProfileCJFTitle;

                    StringBuilder ret = new StringBuilder();
                    foreach (Model_AsSection sec in sectionlist)
                    {
                        //string sIntro = sec.Title;
                        //string sDetail = convertcontent(sec.Intro);

                        List <Model_Assessment> list = asslist.Where(r => r.SCID == sec.SCID).OrderBy(r => r.Priority).ThenBy(r => r.GroupName).ToList();
                        if (list.Count > 0)
                        {
                            ret.Append(GenSectionIntro(sec));


                            foreach (Model_Assessment asi in list)
                            {
                                string question = asi.Questions;
                                int    rs       = asi.StartRank;
                                int    rd       = asi.EndRank;

                                byte questionType = asi.QTID;



                                // 1   Scale
                                //4   Ranking Scale
                                //5   Left / Right Ranking
                                switch (questionType)
                                {
                                //Scale
                                case 1:
                                    ret.Append(GenQuestionTypeScale(asi));
                                    break;

                                //Ranking Scale
                                case 4:
                                    ret.Append(GenQuestionTypeRankingScalChoice(asi));
                                    break;

                                //Left / Right Ranking
                                case 5:
                                    ret.Append(GenQuestionTypeRankLeftRigth(asi));
                                    break;
                                }
                            }
                        }
                    }

                    Stepcontent.Text = ret.ToString();


                    //Binding profile (initial data)
                    heUserID.Value           = u.UserID.ToString();
                    firstName.Text           = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName);
                    LastName.Text            = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName);
                    dropGender.SelectedValue = u.Gender.ToString();
                    dropNation.SelectedValue = u.Nationality.ToString();
                    day.Text     = (u.DateofBirth != null? u.DateofBirth.ToString("yyy-MM-dd"): "");
                    txtPhon.Text = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber);
                }
            }
        }
        else
        {
            //Button btn = (Button)sender;

            //Response.Write(chckCJF.SelectedValue);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Page.Title = "KeenProfile Your Profile";
        if (!this.Page.IsPostBack)
        {
            //if (!string.IsNullOrEmpty(Request.QueryString["success"]))
            //{
            //    main_thanks.Visible = true;
            //    main_form.Visible = false;

            //    Model_AssesIntro intro = new Model_AssesIntro();
            //    intro = intro.GetIntro();
            //    ThanksTitle.Text = intro.ThanksTitle;
            //    ThanksDes.Text = convertcontent(intro.ThanksDes);
            //}

            Model_Users u = this.UserActive;
            if (u != null)

            {
                //Get Job Function
                Model_CJF        cjf     = new Model_CJF();
                List <Model_CJF> cjflist = cjf.GetCJFeAll();

                Model_UserCJF        cjflistUser    = new Model_UserCJF();
                List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID);

                //Get Functional Competencies
                Model_FC        fc     = new Model_FC();
                List <Model_FC> fclist = fc.GetFCAll();

                Model_UserFC        fcuser        = new Model_UserFC();
                List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID);


                //Get Country
                Model_Country        c        = new Model_Country();
                List <Model_Country> ccountry = c.GetAllCountry();


                dropNation.DataSource     = ccountry;
                dropNation.DataTextField  = "DropValue";
                dropNation.DataValueField = "ID";
                dropNation.DataBind();

                dropNation.SelectedValue = "211";


                StringBuilder strcjf = new StringBuilder();
                StringBuilder strfc  = new StringBuilder();


                strcjf.Append("<div  class=\"checkitem\">");


                foreach (Model_CJF i in cjflist.Where(o => o.Status))
                {
                    string check = string.Empty;
                    if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0)
                    {
                        check = "Checked=\"Checked\"";
                    }


                    strcjf.Append("<div class=\"item\">");


                    strcjf.Append("<input  type=\"radio\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">");
                    strcjf.Append("<label>" + i.Title + "</label>");
                    strcjf.Append("</div>");
                }


                strcjf.Append("</div>");



                //strfc.Append("<div class=\"checkitem\">");

                //foreach (Model_FC i in fclist)
                //{

                //    string check = string.Empty;
                //    if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0)
                //        check = "Checked=\"Checked\"";

                //    strfc.Append("<div class=\"item\">");
                //    strfc.Append("<input  type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">");
                //    strfc.Append("<label>" + i.Title + "</label>");
                //    strfc.Append("</div>");


                //}

                //strfc.Append("</div>");

                chckCJF.Text = strcjf.ToString();
                //checkFC.Text = strfc.ToString();


                Maintitle.Text = "Your Profile";



                //Binding profile (initial data)
                heUserID.Value           = u.UserID.ToString();
                firstName.Text           = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName);
                LastName.Text            = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName);
                dropGender.SelectedValue = u.Gender.ToString();
                dropNation.SelectedValue = u.Nationality.ToString();
                day.Text      = (u.DateofBirth != null ? u.DateofBirth.ToString("yyy-MM-dd") : "");
                txtPhon.Text  = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber);
                txtEmail.Text = u.Email;
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!this.Page.IsPostBack)
        {
            //dropRole.DataSource = UsersController.GetUserRole();
            //dropRole.DataTextField = "Title";
            //dropRole.DataValueField = "UsersRoleId";
            //dropRole.DataBind();

            //ListItem lis = new ListItem("All", "0");
            //dropRole.Items.Insert(0, lis);

            if (!string.IsNullOrEmpty(Request.QueryString["s"]))
            {
                int         USerID = int.Parse(Request.QueryString["s"]);
                Model_Users u      = new Model_Users();
                u = u.getUserbyID(USerID);

                //Get Job Function
                Model_CJF        cjf     = new Model_CJF();
                List <Model_CJF> cjflist = cjf.GetCJFeAll();

                Model_UserCJF        cjflistUser    = new Model_UserCJF();
                List <Model_UserCJF> cjfuserChecked = cjflistUser.GetListUsercjf(u.UserID);

                //Get Functional Competencies
                Model_FC        fc     = new Model_FC();
                List <Model_FC> fclist = fc.GetFCAll();

                Model_UserFC        fcuser        = new Model_UserFC();
                List <Model_UserFC> fcuserchecked = fcuser.GetListUserFc(u.UserID);


                //Get Country
                Model_Country        c        = new Model_Country();
                List <Model_Country> ccountry = c.GetAllCountry();


                dropNation.DataSource     = ccountry;
                dropNation.DataTextField  = "DropValue";
                dropNation.DataValueField = "ID";
                dropNation.DataBind();

                dropNation.SelectedValue = "211";


                StringBuilder strcjf = new StringBuilder();
                StringBuilder strfc  = new StringBuilder();


                strcjf.Append("<div  class=\"checkitem\">");


                foreach (Model_CJF i in cjflist)
                {
                    string check = string.Empty;
                    if (cjfuserChecked.Where(r => r.CJFID == i.CJFID).Count() > 0)
                    {
                        check = "Checked=\"Checked\"";
                    }


                    strcjf.Append("<div class=\"item\">");


                    strcjf.Append("<input  type=\"checkbox\" name=\"chckCJF_form\" " + check + " class=\"role_cjf_valid\" value=\"" + i.CJFID + "\">");
                    strcjf.Append("<label>" + i.Title + "</label>");
                    strcjf.Append("</div>");
                }


                strcjf.Append("</div>");



                strfc.Append("<div class=\"checkitem\">");

                foreach (Model_FC i in fclist)
                {
                    string check = string.Empty;
                    if (fcuserchecked.Where(r => r.FCID == i.FCID).Count() > 0)
                    {
                        check = "Checked=\"Checked\"";
                    }

                    strfc.Append("<div class=\"item\">");
                    strfc.Append("<input  type=\"checkbox\" name=\"chckFC_form\" " + check + " class=\"role_fc_valid\" value=\"" + i.FCID + "\">");
                    strfc.Append("<label>" + i.Title + "</label>");
                    strfc.Append("</div>");
                }

                strfc.Append("</div>");

                chckCJF.Text = strcjf.ToString();
                checkFC.Text = strfc.ToString();


                //Maintitle.Text = "Your Profile";



                //Binding profile (initial data)

                firstName.Text           = (string.IsNullOrEmpty(u.FirstName) ? "" : u.FirstName);
                LastName.Text            = (string.IsNullOrEmpty(u.LastName) ? "" : u.LastName);
                dropGender.SelectedValue = u.Gender.ToString();
                dropNation.SelectedValue = u.Nationality.ToString();
                day.Text      = (u.DateofBirth != null ? u.DateofBirth.ToString("yyy-MM-dd") : "");
                txtPhon.Text  = (string.IsNullOrEmpty(u.MobileNumber) ? "" : u.MobileNumber);
                txtEmail.Text = u.Email;
            }
        }
    }