Ejemplo n.º 1
1
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = GetPortText(5372, false);
            Section = "portfolio_tool";
            CSS = "student";
            HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.btnDescription {  font: 11px Verdana, Arial, Helvetica, sans-serif; margin: 0px 15px}--></STYLE>";
            BodyTag = " alink='#990000' style='background-image:url(/media/shared/bg_left_bar_grey.gif);background-repeat:repeat-y;' bgcolor='#ffffff' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#669966'><td background='/media/portfolio_tool/bg_bar_tan_top.gif'><img height=23 src='/media/student_parent/icons/icon_arrow.gif' alt='' width=24><img height=23 src='/media1/" + this.PortType + "/h_h_main" + this.SuffixCode() + ".gif' alt='' width=141>";
            #endregion Properties For The Base Class and Check Login

            #region Initialize Values and Form Execution
            CheckPortSession();

            if (!Page.IsPostBack)
            {
                strSQL = "select c.SectionNameCapital" + SuffixCode() + " Ability,Convert(varchar(10),DBO.fn_ConvertTimeZone(StartTime," + PortInfo["SchoolID"].ToString() + ",1),101) [Test Date], Percentile,CorrectAnswers Correct,TotalQuestions,a.APTestID from AP_SavedTest a join AP_SavedSection b on a.APTestID = b.APTestID join AP_Section c on b.SectionID = c.SectionID where PortfolioID = " + PortInfo["PortfolioID"].ToString() + " and IsActiveStatus = 1 order by b.SectionID";
                dtSummary = CCLib.Common.DataAccess.GetDataTable(strSQL);

                // Prevent user manually change url from browser
                if (dtSummary.Rows.Count == 0)
                    Response.Redirect("AP_Portfolio2.aspx?LoginID=" + LoginID);
                if (dtSummary.Rows.Count > 0 && dtSummary.Rows.Count < 6)
                    Response.Redirect("AP_Portfolio3.aspx?LoginID=" + LoginID);

                //Check if Matchmaker results deleted
                divMM.Visible = false;
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.Retrieve(LoginID);

                if (clientStorage.AspectIndicator < 2)
                {
                    divMM.Visible = true;
                    divLinkMM.Visible = false;
                }
                if (dtSummary.Rows[0]["Percentile"].ToString() == "")
                {
                    UpdateScore();
                    strSQL = "select c.SectionNameCapital" + SuffixCode() + " Ability,Convert(varchar(10),DBO.fn_ConvertTimeZone(StartTime," + PortInfo["SchoolID"].ToString() + ",1),101) [Test Date], Percentile,CorrectAnswers Correct,TotalQuestions,a.APTestID from AP_SavedTest a join AP_SavedSection b on a.APTestID = b.APTestID join AP_Section c on b.SectionID = c.SectionID where PortfolioID = " + PortInfo["PortfolioID"].ToString() + " and SchoolID = " + PortInfo["SchoolID"].ToString() + " and IsActiveStatus = 1 order by b.SectionID";
                    dtSummary = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }
                rptSummary.DataSource = dtSummary;
                rptSummary.DataBind();
                AssignToUserControl();
            }
            #endregion Initialize Values and Form Execution

            #region Properties For The Individual Base Class
            SetCustomJS();
            PortTitle = GetPortText(5372,false);
            SetTitleBar();
            SetLeftButtons();
            PortSubTitle = GetPortText(8804, false);
            SetSubTitleBar();
            SetFooter();
            #endregion Properties For The Individual Base Class
        }
Ejemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = "Ability Profiler";
            Section = "mm";
            CSS = "global_css";
            HeadTag = "<style type='TEXT/CSS'><!--.btnDescription {  font: 11px Verdana, Arial, Helvetica, sans-serif; margin: 0px 15px}--></style>";
            BodyTag = " alink='#990000' style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<table border='0' cellpadding='0' cellspacing='0' style='width:100%;'><tr style='background-color:#336699; vertical-align:top;'><td style='background-image:url(/media/mm/i_top_bar_bg.gif);'><img src='/media/mm/i_c_mm_icon.gif' alt=''><img src='/media/mm/h_c_mm.gif' alt='" + TextCode(273) + "'>";

            StringBuilder sbSQL = new StringBuilder();
            sbSQL.Append("SELECT s.AbilityName_EN, ss.Percentile, ss.Percentile*227/100 PBar, ss.CorrectAnswers, s.TotalQuestions");
            sbSQL.Append(" FROM AP_SavedTest st");
            sbSQL.Append(" LEFT JOIN AP_SavedSection ss ON st.APTestID = ss.APTestID");
            sbSQL.Append(" LEFT JOIN AP_Section s ON ss.SectionID = s.SectionID");
            sbSQL.Append(" WHERE st.IsActiveStatus = 1 and st.PortfolioID = '" + LoginInfo["PID"].ToString() + "' ORDER BY ss.SectionID");

            dtSection = CCLib.Common.DataAccess.GetDataTable(sbSQL.ToString());
            sbSQL = null;

            if (dtSection.Rows[0]["Percentile"].ToString() == "")
            {
                UpdateScore();
                StringBuilder sbSQL1 = new StringBuilder();
                sbSQL1.Append("SELECT s.AbilityName_EN, ss.Percentile, ss.Percentile*227/100 PBar, ss.CorrectAnswers, s.TotalQuestions");
                sbSQL1.Append(" FROM AP_SavedTest st");
                sbSQL1.Append(" LEFT JOIN AP_SavedSection ss ON st.APTestID = ss.APTestID");
                sbSQL1.Append(" LEFT JOIN AP_Section s ON ss.SectionID = s.SectionID");
                sbSQL1.Append(" WHERE st.IsActiveStatus = 1 and st.PortfolioID = '" + LoginInfo["PID"].ToString() + "' ORDER BY ss.SectionID");
                dtSection = CCLib.Common.DataAccess.GetDataTable(sbSQL1.ToString());
                sbSQL1 = null;

            }

            rptBar.DataSource = dtSection;
            rptBar.DataBind();

            rptChart.DataSource = dtSection;
            rptChart.DataBind();

            strSectionName = "Your Ability Profile";

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            if (clientStorage.AspectIndicator >= 2)
            {
                bHasMatchmaker = true;
                aMatchMaker.Attributes.Add("HREF", "/Matchmaker/k_list_matched.aspx?LoginID=" + LoginID + "&BM=1");
            }
            else
            {
                bHasMatchmaker = false;
                aMatchMaker.Attributes.Add("HREF", "/Individual/AP_Portfolio1.aspx?LoginID=" + LoginID);
                aMatchMaker.Attributes.Add("onclick", "alert('You do not currently have any saved Matchmaker Results. Please complete Career Matchmaker to see how your abilities match up with those of the careers you may be interested in.');");

            }
        }
Ejemplo n.º 3
0
 public DataTable PopulateSkillData()
 {
     ClientStorage clientStorage = new ClientStorage();
     clientStorage.Retrieve(LoginID);
     intTotalAspectCount = clientStorage.ClientSkills.Count;
     return clientStorage.ClientSkills.GetAsDataTable();
 }
Ejemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = "Ability Profiler";
            Section = "portfolio_tool";
            CSS = "student";
            HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.btnDescription {  font: 11px Verdana, Arial, Helvetica, sans-serif; margin: 0px 15px}--></STYLE>";
            BodyTag = " alink='#990000' background='/media/shared/bg_else.gif' bgcolor='#ffffff' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#669966'><td background='/media/portfolio_tool/bg_bar_tan_top.gif'><img height=23 src='/media/student_parent/icons/icon_arrow.gif' alt='' width=24><img height=23 src='/media1/" + this.PortType + "/h_h_main" + this.SuffixCode() + ".gif' alt='' width=141>";
            #endregion Properties For The Base Class and Check Login

            #region Initialize Values and Form Execution
            CheckPortSession();
            if (!Page.IsPostBack)
            {
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.Retrieve(LoginID);

                strSQL = "select * from AP_SavedTest a join AP_SavedSection b on a.APTestID = b.APTestID where PortfolioID = " + PortInfo["PortfolioID"].ToString() + " and a.Gradenumber= " + PortInfo["GradeNumber"].ToString() + " and IsActiveStatus = 1";
                dtSections = CCLib.Common.DataAccess.GetDataTable(strSQL);
                if (dtSections.Rows.Count == 6)
                    Response.Redirect("AP_Portfolio4.aspx?LoginID=" + LoginID, false);

                if (clientStorage.AspectIndicator >= 2)
                {
                    if (dtSections.Rows.Count == 0)
                        Response.Redirect("AP_Portfolio2.aspx?LoginID=" + LoginID, false);
                    if (dtSections.Rows.Count > 0 && dtSections.Rows.Count < 6)
                        Response.Redirect("AP_Portfolio3.aspx?LoginID=" + LoginID, false);
                }
            }
            #endregion Initialize Values and Form Execution

            #region MyComments User Control
            UC.Caller = "/Parent/AP_Portfolio1";
            UC.LoginID = LoginID;
            UC.SectionID = "48";
            UC.ParentID = PortInfo["ParentID"].ToString();
            UC.PortfolioID = PortInfo["PortfolioID"].ToString();
            UC.Title = Server.UrlEncode(TextCode(4030));
            UC.SubTitle = TextCode(4034);
            #endregion MyComments User Control

            #region Properties For The Individual Base Class
            SetCustomJS();
            PortTitle = "Assessments";
            SetTitleBar();
            SetLeftButtons();
            AddParentComment = false;
            PortSubTitle = "Ability Profiler";
            SetSubTitleBar();
            SetFooter();
            #endregion Properties For The Individual Base Class
        }
Ejemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(330);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @"  alink=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(330) + "'>";
            IsLongPage = false;
            #endregion Properties For The Base Class and Check Login

            strMMID = Request.QueryString["MMID"];//SavedMatchMakerID

            bool bValidEntry = true;
            if ((Request.Form["txtFirstName"]=="") || (Request.Form["txtFirstName"]==null)) {bValidEntry = false;};
            if ((Request.Form["Pass1"]=="") || (Request.Form["Pass1"]==null)) {bValidEntry = false;};
            if ((Request.Form["Pass2"]=="") || (Request.Form["Pass2"]==null)) {bValidEntry = false;};
            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            if(bValidEntry == true)
            {
                //Check to see that both passwords are the same
                if (Request.Form["Pass1"] == Request.Form["Pass2"])
                {
                    //Open the database to update this record
                    clientStorage.FirstName =  txtFirstName.Value;
                    clientStorage.LastName = txtLastName.Value;
                    clientStorage.SaveToDB(Request.Form["Pass1"].ToString(),base.LoginInfo["Username"].ToString(), base.LoginInfo["Password"].ToString());
                    clientStorage.Save(LoginID);
                    Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);

                }
                else
                {
                    Response.Write("Please enter the same password in both password boxes");
                }

            }

            txtFirstName.Value = clientStorage.FirstName;
            txtLastName.Value = clientStorage.LastName;
        }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = GetPortText(5372, false);
            Section = "portfolio_tool";
            CSS = "student";
            HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.btnDescription {  font: 11px Verdana, Arial, Helvetica, sans-serif; margin: 0px 15px}--></STYLE>";
            BodyTag = " alink='#990000' style='background-image:url(/media/shared/bg_left_bar_grey.gif);background-repeat:repeat-y;' bgcolor='#ffffff' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#669966'><td background='/media/portfolio_tool/bg_bar_tan_top.gif'><img height=23 src='/media/student_parent/icons/icon_arrow.gif' alt='' width=24><img height=23 src='/media1/" + this.PortType + "/h_h_main" + this.SuffixCode() + ".gif' alt='' width=141>";
            #endregion Properties For The Base Class and Check Login

            #region Initialize Values and Form Execution
            CheckPortSession();
            if (!Page.IsPostBack)
            {
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.Retrieve(LoginID);

                strSQL = "select count(SavedSectionID) from AP_SavedTest a join AP_SavedSection b on a.APTestID = b.APTestID where PortfolioID = " + PortInfo["PortfolioID"].ToString() + " and IsActiveStatus = 1";
                intCompletedSection = Convert.ToInt16(CCLib.Common.DataAccess.GetValue(strSQL));
                if (intCompletedSection >= 6)
                    Response.Redirect("AP_Portfolio4.aspx?LoginID=" + LoginID);

                if (clientStorage.AspectIndicator >= 2)
                {
                    if (intCompletedSection == 0)
                        Response.Redirect("AP_Portfolio2.aspx?LoginID=" + LoginID);
                    if (intCompletedSection > 0 && intCompletedSection < 6)
                        Response.Redirect("AP_Portfolio3.aspx?LoginID=" + LoginID);
                }
            }
            #endregion Initialize Values and Form Execution

            #region Properties For The Individual Base Class
            SetCustomJS();
            PortTitle = GetPortText(5372, false);
            SetTitleBar();
            SetLeftButtons();
            PortSubTitle = GetPortText(8804,false);
            SetSubTitleBar();
            SetFooter();
            #endregion Properties For The Individual Base Class
        }
Ejemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(263);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @"  alink=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(263) + "'>";
            #endregion Properties For The Base Class and Check Login

            if (Session["PortInfo"] != null)//get user name value from portfolio session
            {
                DataRow drwPortInfo = (DataRow)Session["PortInfo"];
                strFirstName = drwPortInfo["FirstName"].ToString();
                strLastName = drwPortInfo["LastName"].ToString();
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.AspectIndicator = 1;
                clientStorage.FirstName = strFirstName;
                clientStorage.LastName = strLastName;
                clientStorage.Save(LoginID);
                Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID);

            }

            if ((Request.Form["firstname"] == "") || (Request.Form["lastname"] == ""))
            {
                svrLoginInstructions.Text = TextCode(2970);
            }
            else if (Request.Form["firstname"]!=null)
            {
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.AspectIndicator = 1;
                clientStorage.FirstName = Request.Form["firstname"].ToString();
                clientStorage.LastName = Request.Form["lastname"].ToString();
                clientStorage.Save(LoginID);
                Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID );

            };
        }
Ejemplo n.º 8
0
        //int intTotalAspectCount = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here

            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);

            base.Redirect();
            base.PageTitle = TextCode(295);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @" ALINK=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' LEFTMARGIN=0 LINK=#003366 TEXT=#000000 TOPMARGIN=0 VLINK=#666666 MARGINWIDTH='0' MARGINHEIGHT='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(295) + "'>";

            #endregion Properties For The Base Class and Check Login
            if (Request.Form["bState"] != null)
            {
                ClientStorage clientStorage = new ClientStorage();

                if (clientStorage.LoadFromDB(Request.Form["txtPasswrd"], LoginInfo["Username"].ToString(), LoginInfo["Password"].ToString(), Request.Form["txtfirstname"], Request.Form["txtlastname"]))
                {
                    clientStorage.Save(LoginID);
                    Response.Redirect("k_list_matched.aspx?LoginId=" + LoginID);
                }
                else
                {
                    svrLoginInstruction.Text  = TextCode(2969);
                }

            }
            else
            {
                ClientStorage clientStorage = new ClientStorage();
                clientStorage.Retrieve(LoginID);
                txtFirstName.Value = clientStorage.FirstName;
                txtLastName.Value = clientStorage.LastName;

            }
        }
Ejemplo n.º 9
0
 public string getAspectResponse(object aspectref)
 {
     //find a response for a particular aspect(if it exists)
     ClientStorage clientStorage = new ClientStorage();
     clientStorage.Retrieve(LoginID);
     AspectResult aspectResult = clientStorage.ClientAspects.Find(
                                      delegate(AspectResult ar)
                                      {
                                          return ar.AspectRef == Convert.ToInt16(aspectref);
                                      }
                                      );
     //convert it to text
     int iResponse = -1;
     string strResponse;
     if (aspectResult != null)
     {
         iResponse = aspectResult.AspectResponse;
     }
     switch (iResponse)
     {
         case 5:
             strResponse = "<font color=#336600>" + TextCode(1289);
             break;
         case 4:
             strResponse = "<font color=#336600>" + TextCode(1288);
             break;
         case 3:
             strResponse = "<font color=#cc9900>" + TextCode(1287);
             break;
         case 2:
             strResponse = "<font color=#990000>" + TextCode(1286);
             break;
         case 1:
             strResponse = "<font color=#990000>" + TextCode(1285);
             break;
         default:
             strResponse = "<font>";
             break;
     }
     return "<b>" + strResponse + "</font></b>";
 }
Ejemplo n.º 10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(336);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @" ALINK=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' LEFTMARGIN=0 LINK=#003366 TEXT=#000000 TOPMARGIN=0 VLINK=#666666 ";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(336) + "'>";
            IsLongPage = false;
            #endregion Properties For The Base Class and Check Login

            // place Page initialisation here for now
            JSGenericHrefLink = "onul";

            // Put user code to initialize the page here
            strMMID = Request.QueryString["MMID"]; //SavedMatchMakerID

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            // we use this as a list of questions
            if ((Request.QueryString["RES"] == "") || (Request.QueryString["RES"] == null))// have they answered a question or is this the first time around
            {

                // it doesn't exist so lets build it....
                    Session.Add("skillsset", CCLib.MatchingObject.CCobject.buildSkillsResultSet(SuffixCountryLanguageCode()));

            }

            //JM 15/08/2006 if we have no questionset in the session then the session must have timed out between answering questions so redirect them to to k_list_matched.aspx
            if (Session["skillsset"] == null)
            {
                Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID + "&SVP=1&AP=0&MMID=" + strMMID);
            }

            // lets pull the results into a local variable rather than keep accessing it through the session interface
            SkillsResultSet skillsset = Session["skillsset"] as SkillsResultSet; // get resultset from session

            // save the value away
            if ((Request.QueryString["RES"] != "") && (Request.QueryString["RES"] != null))// a resultset already exists, have they answered a question
            {

                SkillsResult skillsResult = clientStorage.ClientSkills.Find(
                                                             delegate(SkillsResult sr)
                                                             {
                                                                 return sr.SkillsRef == Convert.ToInt16(Request.QueryString["REF"]);
                                                             }
                                                             );
                if (skillsResult == null)
                {
                    //it's not there so add to resultset
                    skillsResult = new SkillsResult();
                    skillsResult.SkillsRef = Convert.ToInt16(Request.QueryString["REF"]);
                    clientStorage.ClientSkills.Add(skillsResult);
                }
                // then we set the value...
                if (skillsResult != null) { skillsResult.SkillsResponse = Convert.ToInt16(Request["RES"].ToString()); };

                //now we flag the question as answered
                skillsResult = skillsset.Find(
                                                             delegate(SkillsResult sr)
                                                             {
                                                                 return sr.SkillsRef == Convert.ToInt16(Request.QueryString["REF"]);
                                                             }
                                                             );

                if (skillsResult != null) { skillsResult.SkillsResponse = Convert.ToInt16(Request["RES"].ToString()); };

            }

            //see which question to ask
            SkillsResult skillNext = skillsset.Find(delegate(SkillsResult sr) { return sr.SkillsResponse == -1; });
            if (skillNext == null)
            {
                //they have answered all the questions - we'll show the results in a grid to prove it worked...
                clientStorage.SkillsIndicator = 1;
                clientStorage.Save(LoginID);
                //set LEG=1 to force display of Legend when returning to matched list
                Session["LEG"] = "1";
                Response.Redirect("k_list_matched.aspx?loginid=" + LoginID + "&SVP=1&AP=0&MMID=" + strMMID);
            }
            else
            {

                DataRow skill = CCLib.MatchingObject.CCobject.getSkill(skillNext.SkillsRef , SuffixCountryLanguageCode());
                int wPos = skillsset.IndexOf(skillNext);
                // set skill info
                svrProgressLit.Text = Convert.ToString(wPos + 1) + "&nbsp;" + TextCode(2972) + "&nbsp;" + Convert.ToString(skillsset.Count) + "&nbsp;&nbsp;";
                svrSkillNameLit.Text = skill["question"].ToString();
                svrSkillNoteLit.Text = skill["notes"].ToString();

                //set progress bar
                svrProgressImg.Width = Convert.ToInt16((wPos + 1) * (7));
                svrProgressImg.Alt = TextCode(3292) + " = " + Convert.ToString(wPos + 1) + " " + TextCode(2972) + " " + Convert.ToString(skillsset.Count);

                //set response URL
                string wURL = "k_skills_question.aspx?&REF=" + skill["ref"].ToString() + "&LoginID=" + base.LoginID + "&MMID=" + strMMID;
                checkbox1.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=5',1)");
                checkbox2.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=4',2)");
                checkbox3.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=3',3)");
                checkbox4.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=2',4)");
                checkbox5.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=1',5)");

            };
            //Save the client record
            clientStorage.Save(LoginID);
        }
Ejemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CCLib.Login.EnforceSSLLoginPage();//always check valid server name first and enforce SSL for login page

            strLogoff = CCLib.Common.Strings.GetQueryString("t");//used to determine auto logoff or manual logoff
            //check if user manually clicked logout, if so, expire session, especially the last SD page
            if (strLogoff == "m" || strLogoff == "t")
            {
                //delete user PID from LoginInfo and clear Login cache
                if (Session["PortInfo"] != null)
                {
                    strLoginID = CCLib.Common.DataAccess.GetValue("select TOP (1) LoginID from LoginInfo where PID=" + ((DataRow)Session["PortInfo"])["PortfolioID"].ToString() + " ORDER BY ExpiredTime DESC").ToString();
                    CCLib.Common.DataAccess.ExecuteDb("delete from LoginInfo where PID=" + ((DataRow)Session["PortInfo"])["PortfolioID"].ToString());
                }
                CCLib.Login.ExpireUserLoginSession();
            }

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strUsername = CCLib.Common.Strings.GetFormString("Username");
                strPassword = CCLib.Common.Strings.GetFormString("Password");
                strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword from Userinfo u inner join Portfolio p on u.schoolid=p.schoolid and p.Username='******'", "''") + "' and p.Password='******'", "''") + "' and u.PortTypeID=4";//Student SD
                dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);

                //then try Parent SD again if no match found
                if (dtUserInfo.Rows.Count == 0)
                {
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword,p.ParentLastLogin,p.AgreementDate from Userinfo u inner join Portfolio_View_SD p on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "' AND p.PortTypeID = 4 and p.Active=1";//Parent SD
                    dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }

                if (dtUserInfo.Rows.Count > 0)
                {
                    strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").ToString() + "-4";//get LoginID
                    if (dtUserInfo.Rows[0]["ParentUserName"].ToString().ToUpper() == strUsername.ToUpper() && dtUserInfo.Rows[0]["ParentPassword"].ToString().ToUpper() == strPassword.ToUpper())//Parent SD
                    {
                        blIsSDParent = true;
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                    }
                    else//Studnet SD
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc

                    //User coming from MatchMaker login
                    if (Session["matchmaker_login_from_portfolio"] != null)
                    {
                        ClientStorage clientStorage = new ClientStorage();
                        if (clientStorage.LoadFromPortfolio(dtUserInfo.Rows[0]["PortfolioID"].ToString()))
                        {
                            clientStorage.Save(LoginID);
                            Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }
                        else
                        {
                            clientStorage.ClearSession();
                            if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                                Session["LastPortPage"] = "/MatchMaker/k_educationLevel.aspx";
                            else
                                Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }

                    }

                    //user saved to SD or not
                    if (Session["ptreturnurl"] != null)
                        strHomepage = "/Individual/SaveToPort.aspx";
                    else//last Port page or not
                    {
                        strHomepage = (Session["LastPortPage"] != null) ? Session["LastPortPage"].ToString() : (blIsSDParent) ? ((dtUserInfo.Rows[0]["AgreementDate"].ToString() == "") ? "/Parent/Registration.aspx" : "/Parent/Home.aspx") : "/Individual/Home.aspx";
                    }

                    CCLib.Login.PortLoginInitSession("4", "SDPort", dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString());

                    if (strHomepage.IndexOf("?") > -1)
                        strHomepage = strHomepage + "&";
                    else
                        strHomepage = strHomepage + "?";

                    if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                        Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID);
                    else
                        Response.Redirect(strHomepage + "PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID);
                }
                else
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your username and password were not found in the system. Please try again.");
                }

            }
            else
            {
                if (strLogoff == "t")
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your session has expired.");
            }
        }
Ejemplo n.º 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isParentAllowedToAccessPlan = true;

            CCLib.Login.EnforceSSLLoginPage();//always check valid server name first and enforce SSL for login page

            strLogoff = CCLib.Common.Strings.GetQueryString("t");//used to determine auto logoff or manual logoff
            //check if user manually clicked logout, if so, expire session, especially the last ilp page
            if (strLogoff == "m" || strLogoff == "t")
            {
                //delete user PID from LoginInfo and clear Login cache
                if (Session["PortInfo"] != null)
                {
                    PortInfo = (DataRow)Session["PortInfo"];//get session value
                    CCLib.Login.ExpireUserLoginSession();//expire session
                    strLoginID = CCLib.Common.DataAccess.GetValue("select TOP (1) LoginID from LoginInfo where PID=" + PortInfo["PortfolioID"].ToString() + " ORDER BY ExpiredTime DESC").ToString();
                    CCLib.Common.DataAccess.ExecuteDb("delete from LoginInfo where PID=" + PortInfo["PortfolioID"].ToString());

                    //if (strLogoff == "m" && PortInfo["GUID"].ToString() != "")//manual logoff also pass to gohigher to log off gohigher
                    //{
                    //    string accessKey = CCLib.Common.Strings.GetAppSettingsValue("strGoHigherAccessKey");
                    //    XAPSSO.SingleSignOn Service = new XAPSSO.SingleSignOn();
                    //    string strToken = Service.RequestGatewayToken(accessKey, PortInfo["GUID"].ToString());
                    //    Response.Redirect(CCLib.Common.Strings.GetAppSettingsValue("strGoHigherGatewayLink") + "?guid=" + PortInfo["GUID"].ToString() + "&token=" + strToken + "&command=logoff&targeturl=" + Server.UrlEncode("http://" + ConfigurationManager.AppSettings["strServerName"] + "/ILP/Default.aspx"));
                    //}
                }
            }

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                CCLib.Login.ExpireUserLoginSession();
                strUsername = CCLib.Common.Strings.GetFormString("Username");
                strPassword = CCLib.Common.Strings.GetFormString("Password");

                strSQL = "SELECT u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword,p.Agreement,u.MMEduLevel, p.FirstName, p.LastName, pla.NumberOfFailedLogins, j.AccessType as 'Access2' from Userinfo u inner join Portfolio p on u.schoolid=p.schoolid ";
                strSQL += "LEFT JOIN Port_LockedAccounts pla ON p.PortfolioID = pla.PortfolioID ";
                strSQL += "LEFT OUTER JOIN UserInfo20Access j on u.SchoolID=j.SchoolID ";
                strSQL += "WHERE p.Username='******'", "''") + "' AND p.Password='******'", "''") + "' AND (p.UserType=2 or p.UserType=6) ";//Student ILP

                dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);

                //then try Parent ILP again if no match found
                if (dtUserInfo.Rows.Count == 0)
                {
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword,u.MMEduLevel, p.FirstName, p.LastName, p.DOB, 0 as NumberOfFailedLogins, j.AccessType as 'Access2' from Userinfo u left outer join UserInfo20Access j on u.SchoolID=j.SchoolID inner join Portfolio_View_KY p on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "' AND Active=1";//Parent ILP
                    dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }

                int numberOfFailedLogins = 0;

                if (dtUserInfo.Rows.Count > 0)
                {
                    if (dtUserInfo.Rows[0]["NumberOfFailedLogins"] != DBNull.Value)
                    {
                        numberOfFailedLogins = Convert.ToInt32(dtUserInfo.Rows[0]["NumberOfFailedLogins"]);
                    }
                }

                if (dtUserInfo.Rows.Count > 0 && numberOfFailedLogins < 1000)
                {
                    strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").ToString() + "-" + dtUserInfo.Rows[0]["UserType"];//get LoginID

                    if (dtUserInfo.Rows[0]["ParentUserName"].ToString().ToUpper().Trim() == strUsername.ToUpper().Trim() && dtUserInfo.Rows[0]["ParentPassword"].ToString().ToUpper().Trim() == strPassword.ToUpper().Trim())//Parent ILP
                    {
                        blIsILPParent = true;

                        // retrieve student's birth date
                        DateTime studentBirthDate = Convert.ToDateTime(dtUserInfo.Rows[0]["DOB"]);
                        // retrieve today's date
                        DateTime currentDate = DateTime.Today;
                        // get the difference in years between today's date & student's birth date
                        int years = currentDate.Year - studentBirthDate.Year;

                        // subtract another year if the student birthday has not yet occurred
                        if (currentDate.Month < studentBirthDate.Month || (currentDate.Month == studentBirthDate.Month && currentDate.Day < studentBirthDate.Day))
                        {
                            years--;
                        }

                        // if student is over 18, parent should not be allowed access to plan
                        if (years >= 18)
                        {
                            isParentAllowedToAccessPlan = false;
                        }
                        else
                        {
                            // otherwise, parent should be allowed to access plan
                            CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                        }
                    }
                    else//Studnet ILP
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc

                    //User coming from MatchMaker login
                    if (Session["portfolio_login_from_matchmaker"] != null)
                    {
                        ClientStorage clientStorage = new ClientStorage();
                        if (clientStorage.LoadFromPortfolio(dtUserInfo.Rows[0]["PortfolioID"].ToString()))
                        {
                            clientStorage.Save(LoginID);
                            Session["LastPortPage"] = "/Individual/Matchmaker.aspx";
                        }
                        else
                        {
                            clientStorage.AspectIndicator = 1;
                            clientStorage.Save(LoginID);
                            if (dtUserInfo.Rows[0]["MMEduLevel"].ToString().ToLower() == "true")
                                Session["LastPortPage"] = "/MatchMaker/k_educationLevel.aspx";
                            else
                                Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }
                    }

                    // user coming from Learning Style login
                    if (Session["portfolio_login_from_learningstyle"] != null)
                    {
                        string strLrnStyleID = CCLib.Common.DataAccess.GetValue("select LrnStyleID from Port_SavedLrnStyles where PortfolioID = " + dtUserInfo.Rows[0]["PortfolioID"].ToString()).ToString();
                        if (strLrnStyleID != "")
                        {
                            Session["LS_ID"] = strLrnStyleID;
                            Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Profile.aspx";
                        }
                        else
                            Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Introduction.aspx";
                    }
                    //always have LS user name from Portfolio session
                    Session["LS_StudentName"] = dtUserInfo.Rows[0]["FirstName"].ToString() + " " + dtUserInfo.Rows[0]["LastName"].ToString();

                    //user saved to ILP or not
                    if (Session["ptreturnurl"] != null)
                        strHomepage = "/Individual/SaveToPort.aspx";
                    else//last Port page or not
                    {
                        if (Session["LastPortPage"] != null)
                            strHomepage = Session["LastPortPage"].ToString();
                        else //check whether user agrees to the terms
                            strHomepage = (blIsILPParent) ? "/Parent/Home.aspx" : (dtUserInfo.Rows[0]["Agreement"].ToString() == "True") ? "/Individual/Home.aspx" : "/Individual/Agreement.aspx";
                    }

                    CCLib.Login.PortLoginInitSession(dtUserInfo.Rows[0]["UserType"].ToString(), "ILP", dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString());

                    if (numberOfFailedLogins > 0)
                    {
                        strSQL = "UPDATE Port_LockedAccounts SET NumberOfFailedLogins = 0 WHERE PortfolioID = " + dtUserInfo.Rows[0]["PortfolioID"].ToString();
                        CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);
                    }

                    if (Session["LastPortPageQueryString"] != null)
                        strLastPortPageQueryString = "&" + Session["LastPortPageQueryString"].ToString();

                    // if parent is not allowed access to plan
                    if (blIsILPParent && !isParentAllowedToAccessPlan)
                    {
                        // display appropraite message
                        strJS = CCLib.Common.Forms.JavaScriptNotify("Since your child is now 18 years old, you can no longer access his or her ILP without his or her permission. Your child can use the Invite Others to View My ILP feature to share his or her plan with you.");
                    }
                    else
                    {
                        // otherwise, log user in
                        if (!blIsILPParent)
                        {
                            if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLanding.aspx?LoginID=" + strLoginID);
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridge.aspx?LoginID=" + strLoginID);
                                else
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                            else
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLanding.aspx?LoginID=" + strLoginID);
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridge.aspx?LoginID=" + strLoginID);
                                else
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                        }
                        else
                        {
                            if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLandingParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridgeParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                            else
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLandingParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridgeParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                        }

                    }
                }
                else if (numberOfFailedLogins == 1000)
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your account has been locked due to too many incorrect password entries.  Please contact your admin to unlock your account.");
                }
                else
                {
                    string username = strUsername.Replace("'", "''");
                    string password = strPassword.Replace("'", "''");

                    // see if any records exist corresponding to username entered, and retrieve portfolio ID
                    strSQL = "SELECT TOP 1 PortfolioID FROM Portfolio WHERE Username='******' and (UserType=2 or UserType=6)";
                    string matchingUsernamePortfolioID = CareerCruisingWeb.CCLib.Common.DataAccess.GetValue(strSQL).ToString();

                    // if record exists corresponding to username entered
                    if (matchingUsernamePortfolioID != "")
                    {
                        // see if any records exist corresponding to username & password entered
                        strSQL = "SELECT p.PortfolioID FROM Portfolio p INNER JOIN UserInfo u ON u.schoolid=p.schoolid AND p.Username='******' AND p.Password='******' AND (p.UserType=2 or p.UserType=6)";
                        string matchingPasswordPortfolioID = CareerCruisingWeb.CCLib.Common.DataAccess.GetValue(strSQL).ToString();

                        if (matchingPasswordPortfolioID == "")
                        {
                            strSQL = "SELECT NumberOfFailedLogins FROM Port_LockedAccounts WHERE PortfolioID = " + matchingUsernamePortfolioID;
                            DataTable failedLogins = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(strSQL);

                            numberOfFailedLogins = 0;

                            if (failedLogins.Rows.Count > 0)
                            {
                                numberOfFailedLogins = Convert.ToInt32(failedLogins.Rows[0]["NumberOfFailedLogins"]);
                            }

                            numberOfFailedLogins++;

                            if (numberOfFailedLogins < 1000)
                            {
                                strSQL = "UPDATE Port_LockedAccounts ";
                                strSQL += "SET NumberOfFailedLogins = " + numberOfFailedLogins + " ";
                                strSQL += "WHERE PortfolioID = " + matchingUsernamePortfolioID + " ";
                                strSQL += "IF @@ROWCOUNT = 0 ";
                                strSQL += "INSERT INTO Port_LockedAccounts(PortfolioID, NumberOfFailedLogins) ";
                                strSQL += "VALUES (" + matchingUsernamePortfolioID + ", 1)";

                                CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);

                                strJS = CCLib.Common.Forms.JavaScriptNotify("Your username and password were not found in the system. Please try again.");
                            }
                            else if (numberOfFailedLogins == 1000)
                            {
                                strSQL = "UPDATE Port_LockedAccounts SET NumberOfFailedLogins = " + numberOfFailedLogins + ", DateLocked = '" + DateTime.Now.ToString() + "' WHERE PortfolioID = " + matchingUsernamePortfolioID;
                                CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);

                                strJS = CCLib.Common.Forms.JavaScriptNotify("Your account has been locked due to too many incorrect password entries.  Please contact your admin to unlock your account.");
                            }
                        }
                    }
                }

            }
            else
            {
                if (strLogoff == "t")
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your session has expired.");
            }
        }
Ejemplo n.º 13
0
 public string getSkillResponse(object skillsref)
 {
     //find a response for a particular aspect(if it exists)
     ClientStorage clientStorage = new ClientStorage();
     clientStorage.Retrieve(LoginID);
     SkillsResult skillsResult = clientStorage.ClientSkills.Find(
                                      delegate(SkillsResult sr)
                                      {
                                          return sr.SkillsRef == Convert.ToInt16(skillsref);
                                      }
                                      );
     //convert it to text
     int iResponse = -1;
     string strResponse;
     if (skillsResult != null)
     {
         iResponse = skillsResult.SkillsResponse;
     }
     switch (iResponse)
     {
         case 5:
             strResponse = "<font color=#006600><b>" + TextCode(1290);
             break;
         case 4:
             strResponse = "<font color=#339900><b>" + TextCode(1291);
             break;
         case 3:
             strResponse = "<font color=#CC9900><b>" + TextCode(1292);
             break;
         case 2:
             strResponse = "<font color=#990000><b>" + TextCode(1293);
             break;
         case 1:
             strResponse = "<font color=#999900><b>" + TextCode(1294);
             break;
         default:
             strResponse = "</b><font>";
             break;
     }
     return strResponse + "</font>";
 }
Ejemplo n.º 14
0
 public DataTable PopulateAspectData()
 {
     ClientStorage clientStorage = new ClientStorage();
     clientStorage.Retrieve(LoginID);
     return clientStorage.ClientAspects.GetAsDataTable();
 }
Ejemplo n.º 15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isParentAllowedToAccessPlan = true;

            CCLib.Login.CheckValidLoginPageServerName();//always check valid server name first for login page

            #region Dynamic Text Areas
            //page is redirected from auto login page
            if (CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("redirect") == "autologin")
            {
                userIP.Text = "<span>IP: " + Request.ServerVariables["REMOTE_ADDR"] + "</span>";
            }
            #endregion Dynamic Text Areas

            pageLanguageAbbreviation = null;
            string languageQuerystringValue = CareerCruisingWeb.CCLib.Common.Strings.FormatUserInput(CareerCruisingWeb.CCLib.Common.Strings.GetQueryString("Language"));

            if (languageQuerystringValue != "")
            {
                if (CCLib.Common.Strings.GetQueryString("Language") == "fr")
                {
                    SetLanguageCookie("fr");
                }
                else
                {
                    SetLanguageCookie("en");
                }

                pageLanguageAbbreviation = languageQuerystringValue;
            }
            // if previous cookie exists, retrieve language specified previously
            else if (Request.Cookies["DefaultPageLanguageCookie"] != null)
            {
                pageLanguageAbbreviation = Server.HtmlEncode(Request.Cookies["DefaultPageLanguageCookie"].Value);
            }
            else
            {
                string[] preferredPageLanguages = Request.UserLanguages;

                if (preferredPageLanguages != null)
                {
                    pageLanguageAbbreviation = preferredPageLanguages[0];
                }

                // check if user's browser language preference is set
                if (pageLanguageAbbreviation != null)
                {
                    // if no cookie exists, retrieve user's brower language settings
                    pageLanguageAbbreviation = Request.UserLanguages[0].Substring(0, 2);

                    // if user's browser language settings set to anything other than English or French
                    if (pageLanguageAbbreviation != "en" && pageLanguageAbbreviation != "fr")
                    {
                        // default page language to English
                        pageLanguageAbbreviation = "en";
                    }
                }
                else
                {
                    // if user's browser's language preference is not set, default to English
                    pageLanguageAbbreviation = "en";
                }
            }

            string frenchButtonText = null;
            string spanishButtonText = null;

            // depending on page language specified, set button command arguments & specify button text accordingly
            if (pageLanguageAbbreviation == "fr")
            {
                pnlLanguageFrench.Visible = true;
                pnlLanguageEnglish.Visible = false;
                pnlLanguageSpanish.Visible = false;
            }
            else if (pageLanguageAbbreviation == "sp")
            {
                pnlLanguageSpanish.Visible = true;
                pnlLanguageFrench.Visible = false;
                pnlLanguageEnglish.Visible = false;

            }
            else
            {
                pnlLanguageEnglish.Visible = true;
                pnlLanguageFrench.Visible = false;
                pnlLanguageSpanish.Visible = false;
            }

            if (!IsPostBack)
            {
                dtNews = CCLib.Cache.GetCachedDataTable("MarketingNews", "select ArticleDate,Title,ID from News where Active=1 ORDER BY ArticleDate DESC");

                for (int i = 0; i < dtNews.Rows.Count; i++)
                {
                    strNewsItems += "news[" + i + "]=\"<a href='/Public/AboutNewsDetail.aspx?NewsID=" + dtNews.Rows[i]["ID"] + "'><span class='bold'>" + String.Format("{0:d/MM/yyyy}", dtNews.Rows[i]["ArticleDate"]) + "</span> - " + dtNews.Rows[i]["Title"] + "</a>\";\n";
                }
            }

            #region Form Post Actions
            //user form post action, only validate user when post = 1
            if (CCLib.Common.Strings.GetFormString("post") == "1")
            {
                #region Get User Input and Values
                strCKRem = CCLib.Common.Strings.GetFormString("ckRem");
                strUsername = CCLib.Common.Strings.GetFormString("Username");
                strPassword = CCLib.Common.Strings.GetFormString("Password");
                strIP = Request.ServerVariables["REMOTE_ADDR"];
                strILP = CCLib.Common.Strings.GetFormString("ILP", "0");
                strSSP = CCLib.Common.Strings.GetFormString("SSP", "0");
                strSD = CCLib.Common.Strings.GetFormString("SD", "0");
                strOcc = CCLib.Common.Strings.GetQueryString("Occ");
                #endregion Get User Input and Values

                #region Set Cookies
                if (strCKRem == "on" && strPassword != "" && strUsername != "")
                {
                    //set cookie to remember password
                    Response.Cookies["Username"].Value = strUsername;
                    Response.Cookies["Username"].Expires = System.DateTime.Now.AddMonths(1);
                    Response.Cookies["Password"].Value = strPassword;
                    Response.Cookies["Password"].Expires = System.DateTime.Now.AddMonths(1);
                }
                #endregion Set Cookies

                #region Authenticate Users

                //check if username and password match
                strSQL = "select Country,SchoolID,ExpiredDate,UseSSL from Userinfo ";
                if (strILP == "0" && strSSP == "0" && strSD == "0")//directly login from generic page
                {
                    strSQL += "where (Username='******'", "''") + "' and Password='******'", "''") + "' and (PortTypeID = 0 or PortTypeID = 5 or PortTypeID = 1))";
                }
                else//ilp/ssp/sd school users from school admin tool
                {
                    strSQL += "where (Username='******'", "''") + "' and Password='******'", "''") + "' and (PortTypeID = 2 or PortTypeID = 3 or PortTypeID = 4))";
                }

                dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);

                if (dtLogin.Rows.Count == 0)//not valid student login
                {
                    //check ILP/SSP/SD instead
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,u.PortTypeID as UserType,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword,p.Agreement, p.PtrnPwdChangeDate, u.ForcePwdChange from Userinfo u inner join Portfolio p ";
                    strSQL += "on u.schoolid=p.schoolid and p.Username='******'", "''") + "' and p.Password='******'", "''") + "' ";//ILP/SSP/SD Student and (u.PortTypeID = 2 or u.PortTypeID = 3 or u.PortTypeID = 4)

                    dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);

                    //then try Parent ILP again if no match found
                    if (dtLogin.Rows.Count == 0)
                    {
                        strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,u.PortTypeID as UserType,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword, p.DOB from Userinfo u inner join Portfolio_View_KY p ";
                        strSQL += "on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "' AND Active=1";//ILP Parent
                        dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);
                    }

                    if (dtLogin.Rows.Count > 0)//parent login?
                    {
                        blHasRecord = true;
                        strUserType = dtLogin.Rows[0]["UserType"].ToString();
                        if (strUsername.ToUpper().Trim() == dtLogin.Rows[0]["ParentUserName"].ToString().ToUpper().Trim() && strPassword.ToString().ToUpper().Trim() == dtLogin.Rows[0]["ParentPassword"].ToString().ToUpper().Trim())
                        {
                            blIsILPParent = true;

                            // retrieve student's birth date
                            DateTime studentBirthDate = Convert.ToDateTime(dtLogin.Rows[0]["DOB"]);
                            // retrieve today's date
                            DateTime currentDate = DateTime.Today;
                            // get the difference in years between today's date & student's birth date
                            int years = currentDate.Year - studentBirthDate.Year;

                            // subtract another year if the student birthday has not yet occurred
                            if (currentDate.Month < studentBirthDate.Month || (currentDate.Month == studentBirthDate.Month && currentDate.Day < studentBirthDate.Day))
                            {
                                years--;
                            }

                            // if student is over 18, parent should not be allowed access to plan
                            if (years >= 18)
                            {
                                isParentAllowedToAccessPlan = false;
                            }
                        }
                    }//parent login?

                }//not valid student login
                else//valid student login
                {
                    blHasRecord = true;
                }//valid student login
                #endregion Authenticate Users

                #region Process to Alert or Authorize Users

                if (blHasRecord == false)//alert sbPageHistory for invalid user
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify((GetDefaultPageText(9399) + " \\n\\n" + GetDefaultPageText(9400) + " \\n" + GetDefaultPageText(9401) + " \\n\\n" + GetDefaultPageText(9402) + " \\n" + GetDefaultPageText(9403)).Replace("'", "\\'"));
                }//alert sbPageHistory for invalid user
                else//valid user account, new login
                {
                    #region Expire Portfolio and Language Setting
                    //expire Portfolio related Session, the same code with ILP/SSP and Portfolio/EDP login page
                    CCLib.Login.ExpireUserLoginSession();
                    #endregion Expire Portfolio and Language Setting

                    //user accunt license not expired
                    if (dtLogin.Rows[0]["ExpiredDate"].ToString() == "" || System.DateTime.Parse(dtLogin.Rows[0]["ExpiredDate"].ToString()) > System.DateTime.Now)
                    //if trial not exipired, get Country, UserNumbers from Userinfo.
                    {
                        strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "") + "-" + strUserType;//get LoginID

                        //add record in Logininfo
                        if (strUserType == "0" || strUserType == "1" || strUserType == "2" || strUserType == "3" || strUserType == "4" || strUserType == "5")//for directly ILP/SSP/SD login
                        {
                            if (blIsILPParent)//parent ilp
                            {
                                CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtLogin.Rows[0]["Username"].ToString(), dtLogin.Rows[0]["Password"].ToString(), dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString(), dtLogin.Rows[0]["PortfolioID"].ToString(), dtLogin.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                            }//parent ilp
                            else//student ilp/ssp/sd
                            {
                                CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtLogin.Rows[0]["Username"].ToString(), dtLogin.Rows[0]["Password"].ToString(), dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString(), dtLogin.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc
                            }//student ilp/ssp/sd
                            CCLib.Login.PortLoginInitSession(strUserType, ((strUserType == "2") ? "ILP" : ((strUserType == "3") ? "SSP" : ((strUserType == "4") ? "SDPort" : ""))), dtLogin.Rows[0]["PortfolioID"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString());
                            CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                            if (clientStorage.LoadFromPortfolio(dtLogin.Rows[0]["PortfolioID"].ToString()))
                            {
                                //it's worked so save it back to the session state
                                clientStorage.Save(LoginID);
                            }
                            else
                            {
                                //clear previous session if the current user does NOT have matchmaker
                                clientStorage.ClearSession();
                            }
                            DataRow drTempInfo = (DataRow)Session["PortInfo"];
                            Session["LS_StudentName"] = drTempInfo["FirstName"].ToString() + " " + drTempInfo["LastName"].ToString();
                        }//for directly ILP/SSP/SD login
                        else//other direct careeer cruising login
                        {
                            CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQL(strLoginID, strUsername, strPassword, dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString()));//Insert Logininfo and Accessinfo
                        }//other direct careeer cruising login

                        //go to next page

                        if (Session["MainLoginRequestedURL"] != null)
                        {
                            string strNewLocation = Session["MainLoginRequestedURL"].ToString();
                            int DotLocation = strNewLocation.IndexOf(".aspx");
                            if ((DotLocation + 6) < strNewLocation.Length)
                            {
                                strNewLocation = strNewLocation.Insert(DotLocation + 6, "LoginID=" + strLoginID + "&");
                                Session["MainLoginRequestedURL"] = null;
                                Response.Redirect(strNewLocation);
                            }
                        }

                        Response.Clear();

                        string strHomepage = "/Main/Index.aspx?";

                        if (strUserType == "2" && blIsILPParent == true)//For ILP Parent
                        {
                            strHomepage = "/Parent/Home.aspx?PID=" + dtLogin.Rows[0]["PortfolioID"].ToString() + "&";
                        }

                        if ((strUserType == "1" || strUserType == "0" || strUserType == "5" || strUserType == "2" || strUserType == "3" || strUserType == "4") && blIsILPParent == false)//For ILP/SSP/SD Student
                        {
                            // check whether user agrees the terms
                            if (dtLogin.Rows[0]["Agreement"].ToString() == "True" && (dtLogin.Rows[0]["ForcePwdChange"].ToString() == "False" || dtLogin.Rows[0]["PtrnPwdChangeDate"] != DBNull.Value))
                                strHomepage = "/Main/Index.aspx?";
                            else
                                strHomepage = "/Individual/Agreement.aspx?PID=" + dtLogin.Rows[0]["PortfolioID"].ToString() + "&";
                        }

                        //Redirection to the Occupation
                        if(strOcc !="")
                        {
                            strHomepage = "/Careers/JobDetails.aspx?OccNumber=" + strOcc + "&";
                        }

                        // if parent is not allowed access to plan
                        if (blIsILPParent && !isParentAllowedToAccessPlan)
                        {
                            // display appropraite message
                            strJS = CCLib.Common.Forms.JavaScriptNotify(GetDefaultPageText(9404).Replace("'", "\\'"));
                        }
                        else
                        {
                            if (!(bool)dtLogin.Rows[0]["UseSSL"])
                            {
                                Response.Redirect(strHomepage + "LoginID=" + strLoginID);
                            }

                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                            Response.End();
                        }
                    }//user accunt license not expired
                    else//user accunt license expired
                    {
                        strJS = CCLib.Common.Forms.JavaScriptNotify((GetDefaultPageText(9405).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9406).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9407).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9408).Replace("'", "\\'")).Replace("'", "\\'"));
                    }//user accunt license expired

                }//valid user account, new login

                #endregion Process to Alert or Authorize Users
            }
            else if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                string httpReferer = "";
                string postHiddenFieldValue = "";

                postHiddenFieldValue = CCLib.Common.Strings.GetFormString("post");

                if (Request.ServerVariables["HTTP_REFERER"] != null)
                    httpReferer = Request.ServerVariables["HTTP_REFERER"].ToString();

                #region Page History
                //go through page history list
                System.Text.StringBuilder sbPageHistory = new System.Text.StringBuilder();

                if (HttpContext.Current != null && HttpContext.Current.Session != null)
                {
                    // gather the list of pages last visited
                    CareerCruisingWeb.Global.CCPageRequest[] requests = HttpContext.Current.Session["LastRequests"] as CareerCruisingWeb.Global.CCPageRequest[];
                    Int32 lastRequestPosition = -1;

                    // if this is the first ever request then initialize the array
                    if (HttpContext.Current.Session["LastRequestPosition"] != null && HttpContext.Current.Session["LastRequestPosition"].ToString() != "")
                    {
                        lastRequestPosition = (Int32)HttpContext.Current.Session["LastRequestPosition"];
                    }

                    // only continue if the request data was located.
                    if (requests != null && lastRequestPosition != -1)
                    {
                        sbPageHistory.AppendFormat("\nLast {0} pages visited\n\n", requests.Length);

                        Int32 index = lastRequestPosition;

                        // go around the ring of pages until we get back to the last request
                        // start with the page next to the last request since that will be the oldest
                        do
                        {
                            index++;

                            if (index >= requests.Length)
                            {
                                index = 0;
                            }

                            CareerCruisingWeb.Global.CCPageRequest request = requests[index];

                            if (request != null)
                            {
                                sbPageHistory.AppendFormat("\n{0} - {1}\nQueryString: {2}\nForm: {3}\n", request.requestDate, request.page, request.queryString, request.form);
                            }

                        } while (index != lastRequestPosition);
                    }
                }
                else
                {
                    sbPageHistory.AppendFormat("The session is unavailable, unable to get the last pages visited");
                }

                string strPageHistory = sbPageHistory.ToString();
                #endregion Page History

                string commandText = "INSERT INTO MainSiteLoginErrors(Browser,Platform,IPAddress,RequestMethod,HTTPReferer,PostHiddenFieldValue,HTTPInfo,PageHistory) values('" + Request.Browser.Type.Replace("'", "''") + "','" + Request.Browser.Platform.Replace("'", "''") + "','" + Request.ServerVariables["REMOTE_ADDR"].Replace("'", "''") + "','" + Request.ServerVariables["REQUEST_METHOD"] + "','" + httpReferer + "','" + postHiddenFieldValue + "','" + Request.ServerVariables["ALL_HTTP"].Replace("'", "''") + " QUERY_STRING:" + Request.ServerVariables["QUERY_STRING"].Replace("'", "''") + " FORM:" + Request.Form.ToString().Replace("'", "''") + "','" + strPageHistory.Replace("'", "''") + "')";

                CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(commandText);
            }

            #endregion Form Post Actions
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            HasTopHeader = false;
            HasTopNavButtons = false;
            base.Redirect();
            base.PageTitle = TextCode(273);
            base.Section = "mm";
            base.CSS = "global_css";
            #endregion Properties For The Base Class and Check Login

            #region Initialize Values and Form Execution
            strPortfolioID = LoginInfo["PID"].ToString();
            string strCountry = LoginInfo["Country"].ToString();

            //Date printed
            strLanguage = GetUserLanguage();
            lblPrintDate.Text = CareerCruisingWeb.CCLib.Common.Strings.GetLongMonth(DateTime.Today.Month, strLanguage) + " " + DateTime.Today.Day + ", " + DateTime.Today.Year;
            //Footer current year
            intCurrentYear = DateTime.Today.Year;

            //Get Cluster
            strClusterSystem = LoginInfo["Cluster1"].ToString();
            DataTable dtClusterInstructions = CCLib.Cache.GetCachedDataTable("ClusterInstructions" + NonEngSuffixCode(), "select * from ClusterInstructions" + NonEngSuffixCode());
            DataRow[] drsClusterInstructions = dtClusterInstructions.Select("ClusterName='" + strClusterSystem.Replace("'", "''") + "'");
            lblRecommended.Text = drsClusterInstructions[0]["Recommendations"].ToString();
            rptTOWlist.Visible = (LoginInfo["ClusterMatchmaker"].ToString() == "True") ? true : false;

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            lblReportTitle.Text = TextCode(9026) + " " + clientStorage.FirstName + "&nbsp;" + clientStorage.LastName;//GetText(5551);

            if (Session["MatchMakerLabel"] != null)
                strLabel = Session["MatchMakerLabel"].ToString();

            //Answered questions number
            int intTotalAspectCount = clientStorage.ClientAspects.Count;
            strAnsweredQuestions = intTotalAspectCount.ToString();

            //Education Levels
            if (clientStorage.ClientLevels.Count == 0)
            {
                lblEdu.Text = "&raquo; " + TextCode(6996);
            }
            else
            {
                string strLevel = "";
                foreach (LevelResult lr in clientStorage.ClientLevels)
                {
                    if (lr.LevelResponse == true)
                    {
                        switch (lr.LevelRef)
                        {
                            case 1: strLevel = "&raquo; " + TextCode(303);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 2: strLevel = "&raquo; " + TextCode(9418);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 3: strLevel = "&raquo; " + TextCode(305);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 4: strLevel = "&raquo; " + TextCode(6996);
                                lblEdu.Text = strLevel;
                                break;
                        }
                    }
                }
                lblEdu.Text = (strLevel == "") ? "&raquo; " + TextCode(6996) : lblEdu.Text;
            }

            //Skills results
            bShowSkillCats = (clientStorage.SkillsIndicator == 1) ? true : false;

            JobList jl;
            //get all matched jobs
            jl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(), strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels);

            if (jl.Count > 0)
            {
                svhNoMatchedCareers.Visible = false;
                lblNoMatch.Visible = false;
            }
            else
            {  //No matched jobs
                rptSugglist.Visible = false;
                rptTOWlist.Visible = false;
                lblNoMatch.Text = TextCode(9180);
            }

            //AP results
            if (LoginInfo["PID"].ToString() != "")
            {
                commandText = " select APMatch, APNotMatch,Label from Port_SavedMatchMaker where PortfolioID= " + strPortfolioID + ";";
                studentInformation = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable(commandText);
                if (studentInformation.Rows.Count > 0)
                {
                    //strLabel = studentInformation.Rows[0]["Label"].ToString();
                    if (studentInformation.Rows[0]["APMatch"].ToString() != "")
                    {

                        strsAPMatch = studentInformation.Rows[0]["APMatch"].ToString().Split(new char[] { ';' });
                        HasAbilityProfiler = true;
                        strsAPNotMatch = studentInformation.Rows[0]["APNotMatch"].ToString().Split(new char[] { ';' });
                        for (int i = 0; i < jl.Count; i++)
                        {
                            jl[i].APMatchCat = strsAPMatch[i].ToString();
                            jl[i].APNotMatchCat = strsAPNotMatch[i].ToString();
                        }
                    }
                }
            }

            if (bShowSkillCats) //add skills
            { CCLib.MatchingObject.CCobject.getSkillsCategories(strCountry, jl, clientStorage.ClientSkills); };

            //svhNoMatchedCareers.Visible = (jl.Count > 0) ? false : true;
            rptSugglist.DataSource = jl.GetAsDataTable();
            rptSugglist.DataBind();

            //Get recommended cluster
            TOWList tl = CCLib.MatchingObject.CCobject.buildTOWList(SuffixCountryLanguageCode(), NonEngSuffixCode(), jl, strClusterSystem);
            DataTable dtTOWList = tl.GetAsDataTable();
            dtTOWList.Columns.Add(new DataColumn("Number", typeof(string)));
            for (int i = 0; i < dtTOWList.Rows.Count; i++)
            {
                int j = i + 1;
                dtTOWList.Rows[i]["Number"] = j.ToString();
            }
            rptTOWlist.DataSource = dtTOWList;
            rptTOWlist.DataBind();

            #endregion Initialize Values and Form Execution
        }
Ejemplo n.º 17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = TextCode(306);
            Section = "mm";
            CSS = "global_css";
            HeadTag = "<STYLE TYPE='TEXT/CSS'><!--body {background-repeat: no-repeat;}.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold; }--></STYLE>";
            BodyTag = @"  alink=#990000 background=/media/shared/bg_else.gif bgcolor=#ffffff leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='/media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='/media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='/media1/Matchmaker/h_c_asmt" + SuffixCode() + ".gif' WIDTH=141 alt='" + TextCode(306) + "'>";
            IsLongPage = false;
            #endregion Properties For The Base Class and Check Login

            #region MatchMaker
            ClientStorage clientStorage1 = new ClientStorage();
            clientStorage1.Retrieve(LoginID);
            if (LoginInfo["PID"].ToString() == "")// if no active Portfolio Session
            {
                strMMLink = "k_login.aspx?LoginID=" + LoginID;
            }
            else if (clientStorage1.AspectIndicator < 1)
            {
                strMMLink = "k_list_matched.aspx?LoginID=" + LoginID;
            }
            else if (LoginInfo["ParentID"].ToString() != "")//parent matchmaker
            {
                strMMLink = "/Parent/matchmaker.aspx?LoginID=" + LoginID;
            }
            else//individual matchmaker
            {
                strMMLink = "/Individual/matchmaker.aspx?LoginID=" + LoginID;
            }
            #endregion MatchMaker

            if (LoginInfo["EnableSkill"].ToString() != "True")
                divB.Visible = false;
            else
            {
                #region Skill link
                ClientStorage clientStorage2 = new ClientStorage();
                clientStorage2.Retrieve(LoginID);
                if (LoginInfo["PID"].ToString() == "")// if no active Portfolio Session
                {
                    strSkillLink = "k_login.aspx?LoginID=" + LoginID + "&RemindSkill=1";
                }
                else if (LoginInfo["ParentID"].ToString() != "")//parent matchmaker
                {
                    strSkillLink = "/Parent/MySkill.aspx?LoginID=" + LoginID;
                }
                else//individual matchmaker
                {
                    strSkillLink = "/Individual/MySkill.aspx?LoginID=" + LoginID;
                }
                #endregion Skill link
            }

            if (LoginInfo["EnableAbilityProfiler"].ToString() != "True")
                divC.Visible = false;
            else
            {
                #region AP link
                if (Session["PortInfo"] != null)
                {
                    strAPLink = "/Individual/AP_Portfolio1.aspx?LoginID=" + LoginID;
                }
                else
                {
                    strAPLink = "javascript:alert('You must have a Portfolio with saved Matchmaker results in order to complete the Ability Profiler. The Ability Profiler must be completed during an approved testing window.');window.location='/Individual/AP_Portfolio1.aspx?LoginID=" + LoginID + "';";
                }
                #endregion AP link
            }

            if (LoginInfo["EnableLrnStyles"].ToString() != "True")
                divD.Visible = false;
            else
            {
                #region LS link
                strLSLink = "/MatchMaker/LS_Pro/LS_Login.aspx?LoginID=" + LoginID;//by default, go to login page
                if (Session["LS_ID"] != null || Session["PortInfo"] != null)
                {
                    strLSLink = "/MatchMaker/LS_Pro/LS_Profile.aspx?LoginID=" + LoginID;
                }
                #endregion LS link

            }
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Log user in when log in is clicked.
        /// </summary>
        /// <param name="username"></param>
        /// <param name="password"></param>
        private void LogUserIn(string username, string password, string fromWhere="")
        {
            bool isParentAllowedToAccessPlan = true;

            #region Get User Input and Values
            strCKRem = CCLib.Common.Strings.GetFormString("ckRem");
            strUsername = username;
            strPassword = password;
            strIP = Request.ServerVariables["REMOTE_ADDR"];
            strILP = CCLib.Common.Strings.GetFormString("ILP", "0");
            strSSP = CCLib.Common.Strings.GetFormString("SSP", "0");
            strSD = CCLib.Common.Strings.GetFormString("SD", "0");
            #endregion Get User Input and Values

            #region Set Cookies
            if (strCKRem == "on" && strPassword != "" && strUsername != "")
            {
                //set cookie to remember password
                Response.Cookies["Username"].Value = strUsername;
                Response.Cookies["Username"].Expires = System.DateTime.Now.AddMonths(1);
                Response.Cookies["Password"].Value = strPassword;
                Response.Cookies["Password"].Expires = System.DateTime.Now.AddMonths(1);
            }
            #endregion Set Cookies

            #region Authenticate Users

            //check if username and password match
            strSQL = "select Country,u.SchoolID,ExpiredDate,UseSSL, LicenseType, IsCcSpark, j.AccessType as 'Access2', 0 as AppVersion from Userinfo u LEFT OUTER JOIN dbo.Userinfo20Access j ON u.SchoolID = j.SchoolID ";
            if (strILP == "0" && strSSP == "0" && strSD == "0")//directly login from generic page
            {
                strSQL += "where (Username='******'", "''") + "' and Password='******'", "''") + "' and (PortTypeID = 0 or PortTypeID = 5 or PortTypeID = 1 or PortTypeID = 7 or PortTypeID = 6))";
            }
            else//ilp/ssp/sd school users from school admin tool
            {
                strSQL += "where (Username='******'", "''") + "' and Password='******'", "''") + "' and (PortTypeID = 2 or PortTypeID = 3 or PortTypeID = 4 or PortTypeID = 7 or PortTypeID = 6))";
            }

            dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);

            if (dtLogin.Rows.Count == 0)//not valid student login
            {
                //check ILP/SSP/SD instead
                strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,u.PortTypeID as UserType,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword,p.Agreement, p.PtrnPwdChangeDate, u.ForcePwdChange, u.LicenseType, u.IsCcSpark, p.AppVersion, j.AccessType as 'Access2' from Userinfo u LEFT OUTER JOIN dbo.Userinfo20Access j ON u.SchoolID = j.SchoolID";
                strSQL += " join portfolio p on u.schoolid=p.schoolid and p.Username='******'", "''") + "' and p.Password='******'", "''") + "' ";//ILP/SSP/SD Student and (u.PortTypeID = 2 or u.PortTypeID = 3 or u.PortTypeID = 4)

                dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);

                //then try Parent ILP again if no match found
                if (dtLogin.Rows.Count == 0)
                {
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,u.PortTypeID as UserType,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword, p.DOB, u.LicenseType, u.IsCcSpark, 0 as 'Access2', 0 as AppVersion from Userinfo u inner join Portfolio_View_KY p ";
                    strSQL += "on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "' AND Active=1";//ILP Parent
                    dtLogin = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }

                if (dtLogin.Rows.Count > 0)//parent login?
                {
                    blHasRecord = true;
                    strUserType = dtLogin.Rows[0]["UserType"].ToString();
                    if (strUsername.ToUpper().Trim() == dtLogin.Rows[0]["ParentUserName"].ToString().ToUpper().Trim() && strPassword.ToString().ToUpper().Trim() == dtLogin.Rows[0]["ParentPassword"].ToString().ToUpper().Trim())
                    {
                        blIsILPParent = true;

                        // retrieve student's birth date
                        DateTime studentBirthDate = Convert.ToDateTime(dtLogin.Rows[0]["DOB"]);
                        // retrieve today's date
                        DateTime currentDate = DateTime.Today;
                        // get the difference in years between today's date & student's birth date
                        int years = currentDate.Year - studentBirthDate.Year;

                        // subtract another year if the student birthday has not yet occurred
                        if (currentDate.Month < studentBirthDate.Month || (currentDate.Month == studentBirthDate.Month && currentDate.Day < studentBirthDate.Day))
                        {
                            years--;
                        }

                        // if student is over 18, parent should not be allowed access to plan
                        if (years >= 18)
                        {
                            isParentAllowedToAccessPlan = false;
                        }
                    }
                }//parent login?

            }//not valid student login
            else//valid student login
            {
                blHasRecord = true;
            }//valid student login
            #endregion Authenticate Users

            #region Process to Alert or Authorize Users

            if (blHasRecord == false)//alert sbPageHistory for invalid user
            {
                //strJS = CCLib.Common.Forms.JavaScriptNotify((GetDefaultPageText(9399) + " \\n\\n" + GetDefaultPageText(9400) + " \\n" + GetDefaultPageText(9401) + " \\n\\n" + GetDefaultPageText(9402) + " \\n" + GetDefaultPageText(9403)).Replace("'", "\\'"));
                Literal1.Text = (GetDefaultPageText(9399) + "<br/><br/>" + GetDefaultPageText(9402) + "<br/>" + GetDefaultPageText(9403)).
                Replace("'", "\\'");
                //HyperLink1.NavigateUrl = "http://public.careercruising.com" + GetRedirectPage(GetCountryCode());

            }//alert sbPageHistory for invalid user
            else//valid user account, new login
            {
                #region Expire Portfolio and Language Setting
                //expire Portfolio related Session, the same code with ILP/SSP and Portfolio/EDP login page
                CCLib.Login.ExpireUserLoginSession();
                #endregion Expire Portfolio and Language Setting

                //ccspark only user not allowed to log in
                if (dtLogin.Rows[0]["IsCcSpark"].ToString() == "True" && dtLogin.Rows[0]["LicenseType"].ToString() == "ccSpark only")
                    Literal1.Text =
            "You have entered a login for ccSpark! Please go to www.ccspark.com and enter your username and password.<br /><br />" +
             "If you need assistance, please contact us at 1-800-965-8541 ext #1 or at [email protected].<br />";
                //user accunt license not expired
                else if (dtLogin.Rows[0]["ExpiredDate"].ToString() == "" || System.DateTime.Parse(dtLogin.Rows[0]["ExpiredDate"].ToString()) > System.DateTime.Now)
                //if trial not exipired, get Country, UserNumbers from Userinfo.
                {
                    strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "") + "-" + strUserType;//get LoginID

                    //add record in Logininfo
                    if (strUserType == "0" || strUserType == "1" || strUserType == "2" || strUserType == "3" || strUserType == "4" || strUserType == "5" || strUserType == "7" || strUserType == "6")//for directly ILP/SSP/SD login
                    {
                        if (blIsILPParent)//parent ilp
                        {
                            CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtLogin.Rows[0]["Username"].ToString(), dtLogin.Rows[0]["Password"].ToString(), dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString(), dtLogin.Rows[0]["PortfolioID"].ToString(), dtLogin.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                        }//parent ilp
                        else//student ilp/ssp/sd
                        {
                            CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtLogin.Rows[0]["Username"].ToString(), dtLogin.Rows[0]["Password"].ToString(), dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString(), dtLogin.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc
                        }//student ilp/ssp/sd
                        CCLib.Login.PortLoginInitSession(strUserType, ((strUserType == "2") ? "ILP" : ((strUserType == "3") ? "SSP" : ((strUserType == "4") ? "SDPort" : ""))), dtLogin.Rows[0]["PortfolioID"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString());
                        CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                        if (clientStorage.LoadFromPortfolio(dtLogin.Rows[0]["PortfolioID"].ToString()))
                        {
                            //it's worked so save it back to the session state
                            clientStorage.Save(LoginID);
                        }
                        else
                        {
                            //clear previous session if the current user does NOT have matchmaker
                            clientStorage.ClearSession();
                        }
                        DataRow drTempInfo = (DataRow)Session["PortInfo"];
                        Session["LS_StudentName"] = drTempInfo["FirstName"].ToString() + " " + drTempInfo["LastName"].ToString();
                    }//for directly ILP/SSP/SD login
                    else//other direct careeer cruising login
                    {
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQL(strLoginID, strUsername, strPassword, dtLogin.Rows[0]["Country"].ToString(), dtLogin.Rows[0]["SchoolID"].ToString()));//Insert Logininfo and Accessinfo
                    }//other direct careeer cruising login

                    //go to next page

                    if (Session["MainLoginRequestedURL"] != null)
                    {
                        string strNewLocation = Session["MainLoginRequestedURL"].ToString();
                        int DotLocation = strNewLocation.IndexOf(".aspx");
                        if ((DotLocation + 6) < strNewLocation.Length)
                        {
                            strNewLocation = strNewLocation.Insert(DotLocation + 6, "LoginID=" + strLoginID + "&");
                            Session["MainLoginRequestedURL"] = null;
                            Response.Clear();
                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='" + strNewLocation + "'\"></HEAD><BODY></BODY></HTML>");
                            Response.End();
                            //Response.Redirect(strNewLocation);
                        }
                    }
                    else if (fromWhere != "2" && (dtLogin.Rows[0]["Access2"].ToString() == "2" || (dtLogin.Rows[0]["AppVersion"] != null && dtLogin.Rows[0]["AppVersion"].ToString() == "2")))
                    {
                        Response.Clear();
                        if (dtLogin.Rows[0]["UseSSL"].ToString() == "True")
                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='https://www.careercruising.com/main/LoginBridge.aspx?LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                        else
                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='http://www.careercruising.com/main/LoginBridge.aspx?LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                        Response.End();
                    }
                    else if (fromWhere != "2" && (dtLogin.Rows[0]["Access2"].ToString() == "1" || (dtLogin.Rows[0]["AppVersion"] != null && dtLogin.Rows[0]["AppVersion"].ToString() == "1")))
                    {
                        Response.Clear();
                        if (dtLogin.Rows[0]["UseSSL"].ToString() == "True")
                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='https://www.careercruising.com/main/LoginLanding.aspx?LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                        else
                            Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='http://www.careercruising.com/main/LoginBridge.aspx?LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                        Response.End();
                    }

                    Response.Clear();

                    string strHomepage = "/Main/Index.aspx?";

                    if (strUserType == "2" && blIsILPParent == true)//For ILP Parent
                    {
                        strHomepage = "/Parent/Home.aspx?PID=" + dtLogin.Rows[0]["PortfolioID"].ToString() + "&";
                    }

                    if ((strUserType == "1" || strUserType == "0" || strUserType == "5" || strUserType == "2" || strUserType == "3" || strUserType == "4") && blIsILPParent == false)//For ILP/SSP/SD Student
                    {
                        // check whether user agrees the terms
                        if (dtLogin.Rows[0]["Agreement"].ToString() == "True" && (dtLogin.Rows[0]["ForcePwdChange"].ToString() == "False" || dtLogin.Rows[0]["PtrnPwdChangeDate"] != DBNull.Value))
                            strHomepage = "/Main/Index.aspx?";
                        else
                            strHomepage = "/Individual/Agreement.aspx?PID=" + dtLogin.Rows[0]["PortfolioID"].ToString() + "&";
                    }

                    // if parent is not allowed access to plan
                    if (blIsILPParent && !isParentAllowedToAccessPlan)
                    {
                        // display appropraite message
                        //strJS = CCLib.Common.Forms.JavaScriptNotify(GetDefaultPageText(9404).Replace("'", "\\'"));
                        Literal1.Text = GetDefaultPageText(9404).Replace("'", "\\'");
                        //HyperLink1.NavigateUrl = "http://public.careercruising.com" + GetRedirectPage(GetCountryCode());
                    }
                    else
                    {
                        if (!(bool)dtLogin.Rows[0]["UseSSL"])
                        {
                            Response.Redirect(strHomepage + "LoginID=" + strLoginID);
                        }

                        Response.Write("<HTML><HEAD><META HTTP-EQUIV='REFRESH' CONTENT=\"0; URL='https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "LoginID=" + strLoginID + "'\"></HEAD><BODY></BODY></HTML>");
                        Response.End();
                    }
                }//user accunt license not expired
                else//user accunt license expired
                {
                    //strJS = CCLib.Common.Forms.JavaScriptNotify((GetDefaultPageText(9405).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9406).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9407).Replace("'", "\\'") + " \\n" + GetDefaultPageText(9408).Replace("'", "\\'")).Replace("'", "\\'"));
                    Literal1.Text =
                        (GetDefaultPageText(9405).Replace("'", "\\'") + "<br />" +
                         GetDefaultPageText(9406).Replace("'", "\\'") + "<br />" +
                         GetDefaultPageText(9407).Replace("'", "\\'") + "<br />" +
                         GetDefaultPageText(9408).Replace("'", "\\'")).Replace("'", "\\'");
                    //HyperLink1.NavigateUrl = "http://public.careercruising.com" + GetRedirectPage(GetCountryCode());
                }//user accunt license expired

            }//valid user account, new login

            #endregion Process to Alert or Authorize Users
        }
Ejemplo n.º 19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            Section = "careers";
            CSS = "careers";
            HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            BodyTag = " alink='#990000' style='backgroud-image:url(/media/shared/bg_else.gif); background-color:#FFFFFF;' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='0'><TR VALIGN='TOP' BGCOLOR='#669966'><td background='../media/shared/i_c_grn_bar_bg.gif'><img height=23 src='../media/careers/i_c_careers_icon.gif' width=24 alt='Careers icon'><img height=23 src='../media1/Careers/h_c_careers" + SuffixCode() + ".gif' width=141 alt='Careers'>";
            #endregion Properties For The Base Class and Check Login

            //variables to be assigned
            strOccNumber = CCLib.Common.Strings.GetQueryString("OccNumber");
            blHasValidData = (CCLib.Common.Strings.IsInteger(strOccNumber));

            if (blHasValidData)
            {
                strMM = CCLib.Common.Strings.GetQueryString("MM");
                strUrl = "JobDetails.aspx?LoginID=" + LoginID + "&OccNumber=" + Server.UrlEncode(strOccNumber);
                //carry MatchMaker back link
                strUrl = (strMM == "") ? strUrl : strUrl + "&MM=" + strMM;
                intLeftHeight = (strMM == "") ? 365 : 365 + 34;
                intLeftHeight += 95;
                //intLeftHeight = (LoginInfo["Portfolio"].ToString() == "Yes") ? intLeftHeight + 60 : intLeftHeight;

                strHeader = TextCode(2983);//suitable4U
                svhBackButton.Visible = (strMM != "");
                //svhPortfolio.Visible = SaveToPort;
                //svhNoPortfolio.Visible = !(svhPortfolio.Visible);
                strCSBackLink = CCLib.Common.Strings.GetQueryString("CSBackLink");
                svhCSBackLink.Visible = (strCSBackLink != "");
                strCSBackSelfLink = (strCSBackLink == "") ? "" : "&CSBackLink=" + strCSBackLink;

                //Case study
                //dtJobDetails = CCLib.Cache.GetCachedDataTable("JobDetails_" + strOccNumber + SuffixCountryLanguageCode(), "select * from Jobinfo" + SuffixCountryLanguageCode() + "_View where OccNumber=" + strOccNumber);
                //if (dtJobDetails.Rows.Count > 0)
                //{
                //    strOccName = dtJobDetails.Rows[0]["OccName"].ToString();
                //    strPerson1 = dtJobDetails.Rows[0]["Name1"].ToString();
                //    strPerson2 = dtJobDetails.Rows[0]["Name2"].ToString();
                //}
                //strLinkPerson1 = "../Careers/Interview.aspx?LoginID=" + LoginID + "&person=" + Server.UrlEncode(strPerson1) + "&OccName=" + Server.UrlEncode(strOccName) + "&OccNumber=" + strOccNumber + "&MM=" + strMM;
                //strLinkPerson2 = "../Careers/Interview.aspx?LoginID=" + LoginID + "&person=" + Server.UrlEncode(strPerson2) + "&OccName=" + Server.UrlEncode(strOccName) + "&OccNumber=" + strOccNumber + "&MM=" + strMM;

                //for comment and aspect responses
                clientStorage = new ClientStorage();
                clientStorage.Retrieve(LoginID);

                //JM if loading from portfolio then lets do it here
                string strPortfolioID = CCLib.Common.Strings.GetQueryString("PortfolioId");
                if (strPortfolioID != "")
                {
                    if (clientStorage.LoadFromPortfolio(strPortfolioID))
                    {
                        //it's worked so save it back to the session state
                        clientStorage.Save(LoginID);
                    }
                    else
                    {
                        //it hasn't worked so use whatever is in the session
                        clientStorage.Retrieve(LoginID);
                    }
                }

                if (strOccNumber != "")
                {
                    iJobref = Convert.ToInt32(strOccNumber);
                }

                //redirect if session has expired
                if (clientStorage.AspectIndicator < 1)
                {
                    if (strOccNumber == "")
                    {
                        Response.Redirect("../Index.aspx?LoginID=" + LoginID);
                    }
                    else
                    {
                        Response.Redirect("../Careers/JobDetails.aspx?LoginID=" + LoginID + "&OccNumber=" + strOccNumber);
                    }

                }

                // retrieve column name containing photo name
                string photoFilePhotoColumnName = "PhotoName_" + this.AbbreviatedCountryCode();

                // photo file code
                // create command used to select any photofile records corresponding to the occupation number passed
                string commandText = "Select * from JobInfoPhotoFile where OccNum = " + strOccNumber + " order by " + photoFilePhotoColumnName;

                // select the photofile records from the database corresponding to the occupation number passed
                DataTable photoFile = CCLib.Cache.GetCachedDataTable("PhotoFile_" + strOccNumber, commandText);

                int photoFileCount = photoFile.Rows.Count;

                //  if there are any photos associated with the job
                if (photoFileCount > 0)
                {
                    this.hasPhotoFile = true;
                }
            }//has valid data from querystring as integer

            #region pass the parameters to the user control
            ucLeftMenu.sCSBackSelfLink = strCSBackSelfLink;
            ucLeftMenu.sUrl = strUrl;
            ucLeftMenu.sOccNumber = strOccNumber;
            ucLeftMenu.blSaveToPort = SaveToPort;
            ucLeftMenu.sendOccNameToPage += delegate(string strOName)
            { strOccName = strOName; };
            //ucLeftMenu.sMMUrl = strMMUrl;
            ucLeftMenu.sMM = strMM;
            #endregion pass the parameters to the user control
        }
Ejemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            bool isParentAllowedToAccessPlan = true;

            CCLib.Login.EnforceSSLLoginPage();//always check valid server name first and enforce SSL for login page

            strLogoff = CCLib.Common.Strings.GetQueryString("t");//used to determine auto logoff or manual logoff
            //check if user manually clicked logout, if so, expire session, especially the last ilp page
            if (strLogoff == "m" || strLogoff == "t")
            {
                //delete user PID from LoginInfo and clear Login cache
                if (Session["PortInfo"] != null)
                {
                    strLoginID = CCLib.Common.DataAccess.GetValue("select TOP (1) LoginID from LoginInfo where PID=" + ((DataRow)Session["PortInfo"])["PortfolioID"].ToString() + " ORDER BY ExpiredTime DESC").ToString();
                    CCLib.Common.DataAccess.ExecuteDb("delete from LoginInfo where PID=" + ((DataRow)Session["PortInfo"])["PortfolioID"].ToString());
                }
                CCLib.Login.ExpireUserLoginSession();
            }

            //if (strLogoff == "m")//manual logoff also pass to gohigher to log off gohigher
            //{
            //    Response.Redirect(ConfigurationManager.AppSettings["strGoHigherGatewayLink"] + "?command=logoff&targeturl=" + Server.UrlEncode("http://" + Request.ServerVariables["SERVER_NAME"] + "/SSP/Default.aspx"));
            //}

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                CCLib.Login.ExpireUserLoginSession();
                strUsername = CCLib.Common.Strings.GetFormString("Username");
                strPassword = CCLib.Common.Strings.GetFormString("Password");
                strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword,p.Agreement,u.MMEduLevel, p.FirstName, p.LastName, j.AccessType as 'Access2' from Userinfo u left outer join UserInfo20Access j on u.SchoolID=j.SchoolID inner join Portfolio p on u.schoolid=p.schoolid and p.Username='******'", "''") + "' and p.Password='******'", "''") + "' and p.UserType=3";//Student SSP
                dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);

                //then try Parent SSP again if no match found
                if (dtUserInfo.Rows.Count == 0)
                {
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword,u.MMEduLevel, p.FirstName, p.LastName, p.BIRTHDATE, j.AccessType as 'Access2' from Userinfo u left outer join UserInfo20Access j on u.SchoolID=j.SchoolID inner join Portfolio_View_DE p on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "' AND p.PortTypeID = 3 AND Active=1";//Parent SSP
                    dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }

                if (dtUserInfo.Rows.Count > 0)
                {
                    strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").ToString() + "-3";//get LoginID
                    if (dtUserInfo.Rows[0]["ParentUserName"].ToString().ToUpper() == strUsername.ToUpper() && dtUserInfo.Rows[0]["ParentPassword"].ToString().ToUpper() == strPassword.ToUpper())//Parent SSP
                    {
                        blIsSSPParent = true;

                        // retrieve student's birth date
                        DateTime studentBirthDate = Convert.ToDateTime(dtUserInfo.Rows[0]["BIRTHDATE"]);
                        // retrieve today's date
                        DateTime currentDate = DateTime.Today;
                        // get the difference in years between today's date & student's birth date
                        int years = currentDate.Year - studentBirthDate.Year;

                        // subtract another year if the student birthday has not yet occurred
                        if (currentDate.Month < studentBirthDate.Month || (currentDate.Month == studentBirthDate.Month && currentDate.Day < studentBirthDate.Day))
                        {
                            years--;
                        }

                        // if student is over 18, parent should not be allowed access to plan
                        if (years >= 18)
                        {
                            isParentAllowedToAccessPlan = false;
                        }
                        else
                        {
                            CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                        }
                    }
                    else//Studnet SSP
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc

                    //User coming from MatchMaker login
                    if (Session["portfolio_login_from_matchmaker"] != null)
                    {
                        ClientStorage clientStorage = new ClientStorage();
                        if (clientStorage.LoadFromPortfolio(dtUserInfo.Rows[0]["PortfolioID"].ToString()))
                        {
                            clientStorage.Save(LoginID);
                            Session["LastPortPage"] = "/Individual/Matchmaker.aspx";
                        }
                        else
                        {
                            clientStorage.AspectIndicator = 1;
                            clientStorage.Save(LoginID);
                            if (dtUserInfo.Rows[0]["MMEduLevel"].ToString().ToLower() == "true")
                                Session["LastPortPage"] = "/MatchMaker/k_educationLevel.aspx";
                            else
                                Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }
                    }

                    // user coming from Learning Style login
                    if (Session["portfolio_login_from_learningstyle"] != null)
                    {
                        string strLrnStyleID = CCLib.Common.DataAccess.GetValue("select LrnStyleID from Port_SavedLrnStyles where PortfolioID = " + dtUserInfo.Rows[0]["PortfolioID"].ToString()).ToString();
                        if (strLrnStyleID != "")
                        {
                            Session["LS_ID"] = strLrnStyleID;
                            Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Profile.aspx";
                        }
                        else
                            Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Introduction.aspx";
                    }
                    //always have LS user name from Portfolio session
                    Session["LS_StudentName"] = dtUserInfo.Rows[0]["FirstName"].ToString() + " " + dtUserInfo.Rows[0]["LastName"].ToString();

                    //user saved to SSP or not
                    if (Session["ptreturnurl"] != null)
                        strHomepage = "/Individual/SaveToPort.aspx";
                    else//last Port page or not
                    {
                        if (Session["LastPortPage"] != null)
                            strHomepage = Session["LastPortPage"].ToString();
                        else //check whether user agrees to the terms
                            strHomepage = (blIsSSPParent) ? "/Parent/Home.aspx" : (dtUserInfo.Rows[0]["Agreement"].ToString() == "True") ? GetHomePage() : "/Individual/Agreement.aspx";
                    }

                    CCLib.Login.PortLoginInitSession("3", "SSP", dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString());

                    if (Session["LastPortPageQueryString"] != null)
                        strLastPortPageQueryString = "&" + Session["LastPortPageQueryString"].ToString();

                    // if parent is not allowed access to plan
                    if (blIsSSPParent && !isParentAllowedToAccessPlan)
                    {
                        // display appropraite message
                        strJS = CCLib.Common.Forms.JavaScriptNotify("Since your child is now 18 years old, you can no longer access his or her SSP without his or her permission. Your child can use the Invite Others to View My SSP feature to share his or her plan with you.");
                    }
                    else
                    {
                        if (!blIsSSPParent)
                        {
                            if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLanding.aspx?LoginID=" + strLoginID);
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridge.aspx?LoginID=" + strLoginID);
                                else
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                            else
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLanding.aspx?LoginID=" + strLoginID);
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridge.aspx?LoginID=" + strLoginID);
                                else
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                        }
                        else
                        {
                            if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLandingParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridgeParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else
                                    Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                            else
                            {
                                if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "1")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginLandingParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else if (dtUserInfo.Rows[0]["Access2"] != null && dtUserInfo.Rows[0]["Access2"].ToString() == "2")
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + "/Main/LoginBridgeParent.aspx?LoginID=" + strLoginID + "&Type=Explore");
                                else
                                    Response.Redirect("http://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID + strLastPortPageQueryString);
                            }
                        }
                    }
                }
                else
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your username and password were not found in the system. Please try again.");
                }

            }
            else
            {
                if (strLogoff == "t")
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your session has expired.");
            }
        }
Ejemplo n.º 21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            PID = Request.QueryString["PID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(273);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @"  alink=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(273) + "'>";
            #endregion Properties For The Base Class and Check Login

            strAP = Request.QueryString["AP"];
            string strCountry = LoginInfo["Country"].ToString();

            strBM = Request.QueryString["BM"]; //Is Best Match
            strAction = CCLib.Common.Strings.GetQueryString("action"); //Click GO button
            strLbl = CCLib.Common.Strings.GetQueryString("Lbl"); //matchMaker Label
            strListTitle = TextCode(6993); // Your Career Suggestion
            strMMID = Request.QueryString["MMID"];//SavedMatchMakerID
            strNewMMLbl = CCLib.Common.Strings.GetQueryString("NewLbl");
            strSaveToPort = CCLib.Common.Strings.GetQueryString("Stat");

            //Have a new MatchMaker session
            if (strMMID == null || strMMID == "")
            {
                //Have an active Portfolio session
                if (LoginInfo["PID"].ToString() != "")
                {
                    //Is Best Match
                    if (strBM == "1")
                    {
                        DataTable[] dts = CCLib.Common.DataAccess.GetDataTables("select SavedMatchMakerID,Label,Convert(varchar(10),UpdateDate,101) UpdateDate from Port_SavedMatchMaker where BestMatch = 1 and PortfolioID=" + LoginInfo["PID"].ToString() + "; Select FirstName,LastName from Portfolio where PortfolioID=" + LoginInfo["PID"].ToString());
                        DataTable dtNN = dts[0];
                        dtMM = dts[1];
                        if (dtNN.Rows.Count > 0)
                        {
                            strMMID = dtNN.Rows[0][0].ToString();
                            strLabel = dtNN.Rows[0][1].ToString();
                            if (dtNN.Rows[0][1].ToString() != "")
                            {
                                strListTitle = TextCode(6993) + " - " + dtNN.Rows[0][1].ToString();
                                Session["MatchMakerLabel"] = dtNN.Rows[0][1].ToString();//save label in session for SaveToPort page
                            }
                            else
                                strListTitle = TextCode(6993);
                        }
                    }
                    else
                    {
                        dtMM = CCLib.Common.DataAccess.GetDataTable("select FirstName,LastName from Portfolio where PortfolioID=" + LoginInfo["PID"].ToString());
                    }

                }
            }
            else //Matchmaker results have been saved to database, return MMID to page. Or calling from MatchMaker Page in Portfolio
            {
                //Have an active Portfolio session
                if (LoginInfo["PID"].ToString() != "")
                    dtMM = CCLib.Common.DataAccess.GetDataTable("select SavedMatchMakerID,Label,Convert(varchar(10),UpdateDate,101) UpdateDate,b.FirstName,b.LastName from Port_SavedMatchMaker a join Portfolio b on a.PortfolioID = b.PortfolioID where SavedMatchMakerID=" + strMMID + " and a.PortfolioID=" + LoginInfo["PID"].ToString());
                else
                    dtMM = CCLib.Common.DataAccess.GetDataTable("select SavedMatchMakerID,Label,Convert(varchar(10),UpdateDate,101) UpdateDate from Port_SavedMatchMaker where SavedMatchMakerID=" + strMMID);
                if (dtMM.Rows.Count > 0)
                {
                    if (dtMM.Rows[0][1].ToString() != "")
                    {
                        strListTitle = TextCode(6993) + " - " + dtMM.Rows[0][1].ToString();
                        Session["MatchMakerLabel"] = dtMM.Rows[0][1].ToString();
                    }
                    else
                        strListTitle = TextCode(6993);
                    strLabel = dtMM.Rows[0][1].ToString();
                }
                else
                    blNotMatch = true;//If the results not matching with login user account
            }

            //Get Cluster literals
            strClusterSystem = LoginInfo["Cluster1"].ToString();
            dtClusterInstructions = CCLib.Cache.GetCachedDataTable("ClusterInstructions" + NonEngSuffixCode(), "select * from ClusterInstructions" + NonEngSuffixCode());
            drsClusterInstructions = dtClusterInstructions.Select("ClusterName='" + strClusterSystem.Replace("'", "''") + "'");
            strClusterHeading = drsClusterInstructions[0]["Recommendations"].ToString();
            //mrm changed field as instructed by Meredith
            strClusterIntro = drsClusterInstructions[0]["CareerSuggestionsInst"].ToString();
            strClusterLink = drsClusterInstructions[0]["SuggestionsLink"].ToString();

            //OnLoad JS and JS that changes - fixed Javascript is read from k_list_matched.js
            string strBuf = "<SCRIPT LANGUAGE='JavaScript' ><!--\n";
            strBuf = strBuf + "pageImgInit('" + SuffixCode() + "');";
            strBuf = strBuf + "\n// --></SCRIPT>";
            svrJavaSetup.Text = strBuf;

            rptTOWlist.Visible = (LoginInfo["ClusterMatchmaker"].ToString() == "True") ? true : false;

            //JM/Don if loading from portfolio then lets do it here
            //string strPortfolioID = CCLib.Common.Strings.GetQueryString("PortfolioId");//first check query string
            //if (strPortfolioID == "" && Session["PortInfo"] != null)//check session variables again, in case user linked from top nav button without the querystring passed
            //{
            //    DataRow drwPortInfo = (DataRow)Session["PortInfo"];
            //    strPortfolioID = drwPortInfo["PortfolioID"].ToString();
            //}

            ClientStorage clientStorage = new ClientStorage();
            //Loading from Portfolio
            if (strMMID != null && strMMID != "" && Request["SVP"] != "1")
            {
                if (clientStorage.LoadFromPortfolio(LoginInfo["PID"].ToString(), Convert.ToInt32(strMMID)))
                    clientStorage.Save(LoginID);
            }
            else //Loading from Save Reminder Popup or New MatchMaker Session
                clientStorage.Retrieve(LoginID);

            //Education Level
            intTotalAspectCount = clientStorage.ClientAspects.Count;
            strAnsweredQuestions = intTotalAspectCount.ToString();
            imgBar1.Width = Convert.ToInt16((Convert.ToDouble(intTotalAspectCount) / Convert.ToDouble(116)) * 161);

            //Get Education Level options
            if (clientStorage.ClientLevels.Count == 0)
            {
                lblEdu.Text = TextCode(6996);//Default value
            }
            else
            {
                string strLevel = "";
                foreach (LevelResult lr in clientStorage.ClientLevels)
                {
                    if (lr.LevelResponse == true)
                    {
                        switch (lr.LevelRef)
                        {
                            case 1: strLevel = TextCode(303);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 2: strLevel = TextCode(304);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 3: strLevel = TextCode(305);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 4: strLevel = TextCode(6996);
                                lblEdu.Text = strLevel;
                                break;
                        }
                    }
                }
                lblEdu.Text = (strLevel == "") ? TextCode(6996) : lblEdu.Text;
            }

            if (LoginInfo["PID"] != null)
            {
                //New MatchMaker session with active Portfolio Session
                if (clientStorage.AspectIndicator < 1)
                {
                    clientStorage.AspectIndicator = 1;
                    clientStorage.Save(LoginID);
                }
                else
                {
                    if (strMMID != null && strMMID != "" && Request["SVP"] != "1")
                    {
                        if (clientStorage.LoadFromPortfolio(LoginInfo["PID"].ToString(), Convert.ToInt32(strMMID)))
                            clientStorage.Save(LoginID);
                    }
                    else
                        clientStorage.Retrieve(LoginID);
                }
            }

            // Determine skill state and turn on/off controls
            if (LoginInfo["EnableSkill"].ToString() == "True")
            {
                //turn on skills button
                tblSkills.Visible = true;
                // if all skills answered - change HREF so submenu is displayed
                if (clientStorage.SkillsIndicator == 1)
                {
                    strAnsweredSkills = "45";
                    strSkillsLink = TextCode(3279);
                    tdLegend.Visible = true;
                    imgSkillsBar.Width = 161;
                    aSkills.Attributes.Add("HREF", "k_skills_review.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);//All the questions have been answered
                    bShowSkillCats = true;//show skill icons
                }
                else
                {
                    strAnsweredSkills = "0";
                    strSkillsLink = TextCode(7413);
                    tdLegend.Visible = false;
                    imgSkillsBar.Width = 0;
                    aSkills.Attributes.Add("HREF", "k_skills_intro.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);//All the questions have not been answered
                    bShowSkillCats = false;//show skill icons
                }
            }
            else
            {
                //turn off skills button
                tblSkills.Visible = false;
                bShowSkillCats = false;// and do not show skill icons
            }

            //Hide all DIVs
            svrPopContinue.Visible = false;
            svrPopSave1.Visible = false;
            svrPopSave2.Visible = false;
            svrPopSave3.Visible = false;
            svrPopSave4.Visible = false;
            DivPopConfirm1.Visible = false;
            DivPopConfirm2.Visible = false;

            //Save Reminder Popup only appears in Student site
            dtParent = CCLib.Common.DataAccess.GetDataTable("select PID,ParentID from logininfo where loginid='" + LoginID + "'");
            if ((dtParent != null) && (dtParent.Rows.Count > 0))
            {
                if (dtParent.Rows[0]["ParentID"].ToString() == "")
                {
                    if (Request["SVP"] == "1" && clientStorage.AspectIndicator > 1) SaveReminderPopup();
                }
            }

            //show Skills Legend if coming from skills_question all done
            if (!Page.IsPostBack)
            {
                if (Session["LEG"] != null)
                {
                    if (Session["LEG"].ToString() == "1")
                        ViewState["LEG"] = "1";
                }
            }
            if (Request["LEG"] == "1")
            {
                divPopupLegend.Style.Add("visibility", "visible");
                Session["LEG"] = null;
                ViewState["LEG"] = "";
            }
            else
            {
                divPopupLegend.Style.Add("visibility", "hidden");
            }

            string strDummy = LoginInfo["MMQuickSave"].ToString();
            svhQuickSaveOn.Visible = (strDummy == "True");
            svhPortFolioOn.Visible = SaveToPort;

            //*** Redirect if no aspects answered
            if (clientStorage.AspectIndicator < 1)
            {
                #region Track User Redirect Issue
                string strReferer = (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"] == null) ? "" : System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"].ToString();
                if ((strReferer.ToLower().IndexOf("/matchmaker/k_aspects_question.aspx") > 0 && Session["questionset"] != null) || (strReferer.ToLower().IndexOf("/matchmaker/k_skills_question.aspx") > 0 && Session["skillsset"] != null))//user clicked the last aspect or skill questions, track the problem
                {
                    //now go through page history list
                    System.Text.StringBuilder sbMessage = new System.Text.StringBuilder();

                    if (Session["LastRequests"] != null)
                    {
                        // gather the list of pages last visited
                        Global.CCPageRequest[] requests = Session["LastRequests"] as Global.CCPageRequest[];
                        Int32 lastRequestPosition = -1;

                        // if this is the first ever request then initialize the array
                        if (Session["LastRequestPosition"] != null && Session["LastRequestPosition"].ToString() != "")
                        {
                            lastRequestPosition = (Int32)Session["LastRequestPosition"];
                        }

                        // only continue if the request data was located.
                        if (requests != null && lastRequestPosition != -1)
                        {
                            sbMessage.AppendFormat("\nLast {0} pages visited\n\n", requests.Length);

                            Int32 index = lastRequestPosition;

                            // go around the ring of pages until we get back to the last request
                            // start with the page next to the last request since that will be the oldest
                            do
                            {
                                index++;

                                if (index >= requests.Length)
                                {
                                    index = 0;
                                }

                                Global.CCPageRequest request = requests[index];

                                if (request != null)
                                {
                                    sbMessage.AppendFormat("\n{0} - {1}\nQueryString: {2}\nForm: {3}\n", request.requestDate, request.page, request.queryString, request.form);
                                }

                            } while (index != lastRequestPosition);
                        }
                    }

                    CCLib.Common.DataAccess.ExecuteDb("insert into ErrorLogMatchMaker (Last5Pages) values ('" + sbMessage.ToString().Replace("'", "''") + "')");
                    //CCLib.Common.Email.SendEmail("*****@*****.**", "*****@*****.**", "Last 5 Pages - Matchmaker - Caputure Career Suggestions Page Requests", sbMessage.ToString());
                }
                #endregion Track User Redirect Issue

                Response.Redirect("k_login.aspx?LoginID=" + LoginID);
            }

            if (clientStorage.AspectIndicator < 2)
            {
                if (Request["SVP"] == "1")
                {
                    Response.Redirect("/MatchMaker/k_aspects_intro.aspx?LoginID=" + LoginID);
                }
                else
                {
                    //If school has MMEduLevel option equals TRUE, page will be redirected to Education Level page.
                    if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                        Response.Redirect("/MatchMaker/k_educationLevel.aspx?LoginID=" + LoginID);
                    else
                        Response.Redirect("/MatchMaker/k_aspects_intro.aspx?LoginID=" + LoginID);
                }
            }

            // if all questions answered - change HREF so message is displayed
            if (clientStorage.AspectIndicator == 4)
            {
                //aAspects.Attributes.Add("HREF", "javascript:togglePopupDone(true)");
                aAspects.Visible = false;
                aAspectsReview.Attributes.Add("HREF", "k_aspects_review.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);
            }
            else
            {
                aAspects.Attributes.Add("HREF", "k_aspects_question.aspx?&LoginID=" + LoginID + "&MMID=" + strMMID);
                aAspectsReview.Attributes.Add("HREF", "k_aspects_review.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);
            }

            //Loading from session if new MatchMaker results haven't been saved to database
            userdetails.Text = "&nbsp;" + TextCode(274) + "&nbsp;" + clientStorage.FirstName + "&nbsp;" + clientStorage.LastName;
            if (dtMM != null && LoginInfo["PID"].ToString() != "")
            {
                if (dtMM.Rows.Count > 0)
                    userdetails.Text = "&nbsp;" + TextCode(274) + "&nbsp;" + dtMM.Rows[0]["FirstName"].ToString() + "&nbsp;" + dtMM.Rows[0]["LastName"].ToString();
            }
            //debug            userdetails.Text = "&nbsp;" + TextCode(274) + "&nbsp;" + clientStorage.AspectIndicator.ToString();

            //display Continue PopUp if coming from Matchmaker on the menu
            svrPopContinue.Visible = (Request["MMM"] == "1" && Session["PortInfo"] == null);
            svrPopContinueIntro.Text = clientStorage.FirstName + "&nbsp;" + clientStorage.LastName + TextCode(4054) + "<br><br>" + TextCode(4055);
            svrBtnContinue.AlternateText = TextCode(4056);
            svrBtnContinue.ImageUrl = "../media1/Matchmaker/btn_sessioncontinue" + NonEngSuffixCode() + ".gif";
            svrBtnRestart.AlternateText = TextCode(4057);
            svrBtnRestart.ImageUrl = "../media1/Matchmaker/btn_sessionrestart" + NonEngSuffixCode() + ".gif";

            //do a match
            JobList jl;
            //get all matched jobs
            jl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(), strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels);
            if (Request["clustercode"] == null)
            {
                getCareerPercentile(jl); //add Ability profiler
                if (bShowSkillCats) //add skills
                { CCLib.MatchingObject.CCobject.getSkillsCategories(strCountry, jl, clientStorage.ClientSkills); };
                spanShowClusterOptions.Visible = false;

                //display all suggested jobs
                if (jl.Count > 0) { svhNoMatchedCareers.Visible = false; };
                sugglist.DataSource = jl.GetAsDataTable();
                sugglist.DataBind();
            }
            else
            {
                JobList TOWjl; //matched jobs based on TOW
                TOWjl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(), strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels, Request["clustercode"].ToString(), strClusterSystem);
                getCareerPercentile(TOWjl); //add Ability profiler
                if (bShowSkillCats) //add skills
                { CCLib.MatchingObject.CCobject.getSkillsCategories(strCountry, TOWjl, clientStorage.ClientSkills); };
                spanShowClusterOptions.Visible = true;
                //display matched TOW jobs
                if (TOWjl.Count > 0) { svhNoMatchedCareers.Visible = false; };
                sugglist.DataSource = TOWjl.GetAsDataTable();
                sugglist.DataBind();
                //determine the name of this cluster to place at top of job list
                dtClusterCodes = CCLib.Cache.GetCachedDataTableWithNoExpire("ClusterCodes", "select * from ClusterCodes");
                strClusterCode = Request.QueryString["clustercode"];
                strClusterType = (CCLib.Common.Strings.GetQueryString("Cluster").Length > 0) ? CCLib.Common.Strings.GetQueryString("Cluster") : strClusterSystem;//this comes from LoginInfo.Cluster1
                if (strClusterCode != "")
                {
                    drsClusterCodes = dtClusterCodes.Select("ClusterCode='" + strClusterCode.Replace("'", "''") + "' and ClusterType='" + strClusterType.Replace("'", "''") + "'");
                    strListTitle = TextCode(6993) + ": " + drsClusterCodes[0]["ClusteName" + NonEngSuffixCode()].ToString();
                }
            }

            //this is based on all matched jobs
            TOWList tl = CCLib.MatchingObject.CCobject.buildTOWList(SuffixCountryLanguageCode(), NonEngSuffixCode(), jl, strClusterSystem);
            DataTable dtTOWList = tl.GetAsDataTable();
            dtTOWList.Columns.Add(new DataColumn("Number", typeof(string)));
            for (int i = 0; i < dtTOWList.Rows.Count; i++)
            {
                int j = i + 1;
                dtTOWList.Rows[i]["Number"] = j.ToString();
            }

            rptTOWlist.DataSource = dtTOWList;
            rptTOWlist.DataBind();

            //populate portfolio save form...
            if (svhPortFolioOn.Visible == true || LoginInfo["CustomID"].ToString() == "f4k-no-nav")//for f4k users. Don Xiong Aug 23, 2006
            {
                string strMatchRefs = "";
                string strSkillsRankString = "";
                for (int i = 0; i < jl.Count; i++)
                {
                    if (strMatchRefs != "") { strMatchRefs = strMatchRefs + ";"; };
                    strMatchRefs = strMatchRefs + jl[i].JobRef.ToString();
                    strSkillsRankString = strSkillsRankString + jl[i].SkillsCat;
                };

                string strAspectRefString = "";
                string strAspectResString = "";
                foreach (AspectResult ar in clientStorage.ClientAspects)
                {
                    strAspectRefString = strAspectRefString + ar.AspectRef.ToString().PadLeft(3, '0');
                    int intTmp = ar.AspectResponse;
                    if (intTmp < 0) { intTmp = 0; };
                    strAspectResString = strAspectResString + intTmp.ToString();

                };
                string strSkillsString = "";
                for (int i = 0; i < clientStorage.ClientSkills.Count; i++)
                {
                    SkillsResult sr = clientStorage.ClientSkills[i];
                    int intTmp = sr.SkillsResponse;
                    if (intTmp < 0) { intTmp = 0; };
                    strSkillsString = strSkillsString + intTmp.ToString();
                }
                string strLevels = "";
                foreach (LevelResult lr in clientStorage.ClientLevels)
                {
                    if (lr.LevelResponse == true)
                    {
                        strLevels = strLevels + lr.LevelRef.ToString().PadLeft(3, '0');
                    };
                }
                if (strLevels != "")
                {
                    List<String> ls = new List<String>();
                    for (int i = 0; i < strLevels.Length; i = i + 3)
                    {
                        ls.Add(strLevels.Substring(i, 3));
                    }
                    string[] arr = ls.ToArray();
                    Array.Sort(arr);
                    strLevels = "";
                    foreach (string str in arr)
                    {
                        strLevels = strLevels + str;
                    }
                }

                string strClusterCodes = "";
                for (int i = 0; i < tl.Count && i < 2; i++)
                {
                    if (strClusterCodes != "") { strClusterCodes = strClusterCodes + ","; };
                    strClusterCodes = strClusterCodes + tl[i].Code;
                };

                MatchMakerRef.Value = strAspectRefString;
                MatchMakerRes.Value = strAspectResString;
                MatchMakerEducation.Value = strLevels;
                if (strSkillsString != "")
                {
                    MatchMakerSkill.Value = strSkillsString;
                    MatchMakerSkillRank.Value = strSkillsRankString;

                }
                Pathway.Value = strClusterSystem + "|" + strClusterCodes;
                ptsavevalue.Value = strMatchRefs;

                //for f4k users. Don Xiong Aug 23, 2006
                strOccNumbers = strMatchRefs;
                strPathway = strClusterCodes;
                //for f4k users. Don Xiong Aug 23, 2006
            }

            //Pop up Save Reminder
            if (LoginInfo["PID"].ToString() == "") Session["MatchMakerLabel"] = null;

            //Save MatchMaker result to server
            if (strAction != "")
            {
                //New MatchMaker session with no active Portfolio session - Click Yes, I have a Portfolio button
                if (strAction == "SaveResult1")
                {
                    if (LoginInfo["PID"].ToString() != "")
                    {
                        //If default name is not unique in table, get a new one with [X] as suffix
                        if (strLbl != "")
                        {
                            string strMMNumbers = LabelinDB(strLbl);
                            string strNewMMLabel = "0";
                            if (strMMNumbers != "0")
                            {
                                strLbl = LabelName(strLbl);
                                strNewMMLabel = "1";
                            }
                            SaveResults();
                            Session["ptreturnurl"] = ptreturnurl.Value + "NewLbl=" + strNewMMLabel + "&";
                            Session["ptsavename"] = ptsavename.Value;
                            Session["ptsavevalue"] = ptsavevalue.Value;
                            Session["MatchMakerRef"] = MatchMakerRef.Value;
                            Session["MatchMakerRes"] = MatchMakerRes.Value;
                            Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                            if (MatchMakerSkill.Value.Length != 45)
                            {
                                MatchMakerSkill.Value = "";
                                MatchMakerSkillRank.Value = "";
                            }
                            Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                            Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                            Session["Pathway"] = Pathway.Value;
                            Session["MatchMakerLabel"] = strLbl;
                            //Response.Write(Session["MatchMakerRes"].ToString());
                            //Response.End();
                            Server.Transfer("/Individual/SaveToPort.aspx?LoginID=" + LoginID, true);
                        }
                    }
                    else
                    {
                        SaveResults();
                        Session["ptreturnurl"] = ptreturnurl.Value + "NewLbl=0&";
                        Session["ptsavename"] = ptsavename.Value;
                        Session["ptsavevalue"] = ptsavevalue.Value;
                        Session["MatchMakerRef"] = MatchMakerRef.Value;
                        Session["MatchMakerRes"] = MatchMakerRes.Value;
                        Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                        if (MatchMakerSkill.Value.Length != 45)
                        {
                            MatchMakerSkill.Value = "";
                            MatchMakerSkillRank.Value = "";
                        }
                        Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                        Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                        Session["Pathway"] = Pathway.Value;
                        Session["MatchMakerLabel"] = strLbl;
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult1&Lbl=" + strLbl;
                        Response.Redirect("/Individual/default.aspx?LoginID=" + LoginID);
                    }
                }

                //New MatchMaker session with no active Portfolio session - Click Yes, but i don't have a Portfolio button
                if (strAction == "SaveResult2")
                {
                    if (LoginInfo["CreatePortfolio"].ToString().ToUpper() == "YES")
                    {
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult1&Lbl=" + strLbl;
                        Session["ptreturnurl"] = ptreturnurl.Value;
                        Session["MMID"] = strMMID;
                        Session["ptsavename"] = ptsavename.Value;
                        Session["ptsavevalue"] = ptsavevalue.Value;
                        Session["MatchMakerRef"] = MatchMakerRef.Value;
                        Session["MatchMakerRes"] = MatchMakerRes.Value;
                        Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                        if (MatchMakerSkill.Value.Length != 45)
                        {
                            MatchMakerSkill.Value = "";
                            MatchMakerSkillRank.Value = "";
                        }
                        Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                        Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                        Session["Pathway"] = Pathway.Value;
                        Session["MatchMakerLabel"] = strLbl;
                        Response.Redirect("/Individual/CreateUser.aspx?LoginID=" + LoginID);
                    }
                    else
                    {
                        ViewState["NoPortfolio"] = "1";
                    }
                }

                //Saved MatchMaker Result with an active Portfolio session
                if (strAction == "SaveResult3")
                {
                    if (LoginInfo["PID"].ToString() != "")
                    {
                        if (strLbl != "")
                        {
                            string strMMNumbers = LabelinDB(strLbl);
                            string strNewMMLabel = "0";
                            if (strMMNumbers != "0")
                            {
                                strLbl = LabelName(strLbl);
                                strNewMMLabel = "1";
                            }
                            SaveResults();
                            Session["ptreturnurl"] = ptreturnurl.Value + "NewLbl=" + strNewMMLabel + "&";
                            Session["MMID"] = strMMID;
                            Session["ptsavename"] = ptsavename.Value;
                            Session["ptsavevalue"] = ptsavevalue.Value;
                            Session["MatchMakerRef"] = MatchMakerRef.Value;
                            Session["MatchMakerRes"] = MatchMakerRes.Value;
                            Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                            if (MatchMakerSkill.Value.Length != 45)
                            {
                                MatchMakerSkill.Value = "";
                                MatchMakerSkillRank.Value = "";
                            }
                            Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                            Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                            Session["Pathway"] = Pathway.Value;
                            Session["MatchMakerLabel"] = strLbl;
                            Server.Transfer("/Individual/SaveToPort.aspx?LoginID=" + LoginID, true);
                        }
                    }
                    else
                    {
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult4&Lbl=" + strLbl + "&Stat=" + strSaveToPort;
                        Response.Redirect("/Individual/default.aspx?LoginID=" + LoginID);
                    }

                }

                //Saved MatchMaker Result with an active Portfolio session
                if (strAction == "SaveResult4")
                {
                    if (LoginInfo["PID"].ToString() != "")
                    {
                        SaveResults();
                        Session["ptreturnurl"] = ptreturnurl.Value;
                        Session["MMID"] = strMMID;
                        Session["ptsavename"] = ptsavename.Value;
                        Session["ptsavevalue"] = ptsavevalue.Value;
                        Session["MatchMakerRef"] = MatchMakerRef.Value;
                        Session["MatchMakerRes"] = MatchMakerRes.Value;
                        Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                        if (MatchMakerSkill.Value.Length != 45)
                        {
                            MatchMakerSkill.Value = "";
                            MatchMakerSkillRank.Value = "";
                        }
                        Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                        Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                        Session["Pathway"] = Pathway.Value;
                        Session["MatchMakerLabel"] = strLbl;
                        Server.Transfer("/Individual/SaveToPort.aspx?LoginID=" + LoginID, true);
                    }
                    else
                    {
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult4&Lbl=" + strLbl + "&Stat=" + strSaveToPort;
                        Response.Redirect("/Individual/default.aspx?LoginID=" + LoginID);
                    }

                }

                //Saved MatchMaker Result without active Portfolio session - Click Yes, I have a Portfolio button
                if (strAction == "SaveResult5")
                {
                    if (LoginInfo["PID"].ToString() != "")
                    {
                        if (blNotMatch)
                        {
                            if (strLbl != "")
                            {
                                string strMMNumbers = LabelinDB(strLbl);
                                string strNewMMLabel = "0";
                                if (strMMNumbers != "0")
                                {
                                    strLbl = LabelName(strLbl);
                                    strNewMMLabel = "1";
                                }
                                SaveResults();
                                Session["ptreturnurl"] = ptreturnurl.Value + "NewLbl=" + strNewMMLabel + "&";
                                Session["ptsavename"] = ptsavename.Value;
                                Session["ptsavevalue"] = ptsavevalue.Value;
                                Session["MatchMakerRef"] = MatchMakerRef.Value;
                                Session["MatchMakerRes"] = MatchMakerRes.Value;
                                Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                                if (MatchMakerSkill.Value.Length != 45)
                                {
                                    MatchMakerSkill.Value = "";
                                    MatchMakerSkillRank.Value = "";
                                }
                                Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                                Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                                Session["Pathway"] = Pathway.Value;
                                Session["MatchMakerLabel"] = strLbl;
                                Server.Transfer("/Individual/SaveToPort.aspx?LoginID=" + LoginID, true);
                            }
                        }
                        else
                        {

                            int iMMNumbers = Convert.ToInt16(CCLib.Common.DataAccess.GetValue("select count(SavedMatchMakerID) from Port_SavedMatchMaker where PortfolioID=" + LoginInfo["PID"].ToString()));
                            if (iMMNumbers > 0)
                            {
                                string strMMNumbers = LabelinDB("Matchmaker" + (iMMNumbers + 1).ToString());
                                if (strMMNumbers != "0")
                                    strLbl = LabelinDB("Matchmaker" + (iMMNumbers + 1).ToString());
                                else
                                    strLbl = "Matchmaker" + (iMMNumbers + 1).ToString();
                            }
                            else
                                strLbl = "Matchmaker1";
                            SaveResults();
                            Session["ptreturnurl"] = ptreturnurl.Value;
                            Session["MMID"] = strMMID;
                            Session["ptsavename"] = ptsavename.Value;
                            Session["ptsavevalue"] = ptsavevalue.Value;
                            Session["MatchMakerRef"] = MatchMakerRef.Value;
                            Session["MatchMakerRes"] = MatchMakerRes.Value;
                            Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                            if (MatchMakerSkill.Value.Length != 45)
                            {
                                MatchMakerSkill.Value = "";
                                MatchMakerSkillRank.Value = "";
                            }
                            Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                            Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                            Session["Pathway"] = Pathway.Value;
                            Session["MatchMakerLabel"] = strLbl;
                            Server.Transfer("/Individual/SaveToPort.aspx?LoginID=" + LoginID, true);
                        }
                    }
                    else
                    {
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult5&MMID=" + strMMID + "&Lbl=" + strLbl + "&Stat=" + strSaveToPort;
                        Response.Redirect("/Individual/default.aspx?LoginID=" + LoginID);
                    }
                }

                //Saved MatchMaker Result without active Portfolio session - Click Yes, but i don't have a Portfolio button
                if (strAction == "SaveResult6")
                {
                    if (LoginInfo["CreatePortfolio"].ToString().ToUpper() == "YES")
                    {
                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx?action=SaveResult5&MMID=" + strMMID + "&Lbl=" + strLbl + "&Stat=" + strSaveToPort;
                        Session["ptreturnurl"] = ptreturnurl.Value;
                        Session["MMID"] = strMMID;
                        Session["ptsavename"] = ptsavename.Value;
                        Session["ptsavevalue"] = ptsavevalue.Value;
                        Session["MatchMakerRef"] = MatchMakerRef.Value;
                        Session["MatchMakerRes"] = MatchMakerRes.Value;
                        Session["MatchMakerEducation"] = MatchMakerEducation.Value;
                        if (MatchMakerSkill.Value.Length != 45)
                        {
                            MatchMakerSkill.Value = "";
                            MatchMakerSkillRank.Value = "";
                        }
                        Session["MatchMakerSkill"] = MatchMakerSkill.Value;
                        Session["MatchMakerSkillRank"] = MatchMakerSkillRank.Value;
                        Session["Pathway"] = Pathway.Value;
                        Session["MatchMakerLabel"] = strLbl;
                        Response.Redirect("/Individual/CreateUser.aspx?LoginID=" + LoginID);
                    }
                    else
                    {
                        ViewState["NoPortfolio"] = "1";
                    }
                }

                //display Confirmation div
                if (strAction == "Confirm")
                {
                    if (strMMID != null && strMMID != "")
                    {
                        if (strBM == "1")
                        {
                            DivPopConfirm1.Visible = true;
                            DivPopConfirm2.Visible = false;
                        }
                        if (strBM == "0")
                        {
                            DivPopConfirm2.Visible = true;
                            DivPopConfirm1.Visible = false;
                        }
                    }
                }

                //If SavedMatchMakerID is associated with a different PortfolioID, remove username from "Career Suggestion for"
                if (strAction == "Restart")
                {
                    userdetails.Text = "&nbsp;" + TextCode(274);
                }

            }
        }
Ejemplo n.º 22
0
        //int intTotalAspectCount = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here

            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);

            base.Redirect();
            base.PageTitle = TextCode(300);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @" ALINK=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' LEFTMARGIN=0 LINK=#003366 TEXT=#000000 TOPMARGIN=0 VLINK=#666666 MARGINWIDTH='0' MARGINHEIGHT='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(300) + "'>";

            #endregion Properties For The Base Class and Check Login

            // Put user code to initialize the page here

            LevelResult levelResult;

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            //do we need to save the values??
            if (Request["ChkChange"] != null)
            {
            // save them away

            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv){return lv.LevelRef  == 1;});
            if (levelResult == null)
            {
                   //it's not there so add to resultset
                    levelResult = new LevelResult();
                    levelResult.LevelRef = 1;
                    clientStorage.ClientLevels.Add(levelResult);
            }
                // then we set the value...
            if (Request["chkLevel001"]  !=null)
            {
                    levelResult.LevelResponse = true;
            }
            else
            {
                    levelResult.LevelResponse = false;
            }

            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv){return lv.LevelRef  == 2;});
            if (levelResult == null)
            {
                   //it's not there so add to resultset
                    levelResult = new LevelResult();
                    levelResult.LevelRef = 2;
                    clientStorage.ClientLevels.Add(levelResult);
            }
                // then we set the value...
            if (Request["chkLevel002"]!=null)
            {
                    levelResult.LevelResponse = true;
            }
            else
            {
                    levelResult.LevelResponse = false;
            }

            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv){return lv.LevelRef  == 3;});
            if (levelResult == null)
            {
                   //it's not there so add to resultset
                    levelResult = new LevelResult();
                    levelResult.LevelRef = 3;
                    clientStorage.ClientLevels.Add(levelResult);
            }
                // then we set the value...
            if (Request["chkLevel003"]  != null)
            {
                    levelResult.LevelResponse = true;
            }
            else
            {
                    levelResult.LevelResponse = false;
            }

            //now we save it back
            clientStorage.Save(LoginID);
            //now we redirect

            Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID);

            }

            // default the checkboxes
            chkLevel001.Checked = false;
            chkLevel002.Checked = false;
            chkLevel003.Checked = false;

            // load the levels
            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv){return lv.LevelRef  == 1;});
            if (levelResult!=null)
            {
            chkLevel001.Checked = levelResult.LevelResponse;
            }

            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv) { return lv.LevelRef == 2; });
            if (levelResult != null)
            {
            chkLevel002.Checked = levelResult.LevelResponse;
            }

            levelResult = clientStorage.ClientLevels.Find(delegate(LevelResult lv) { return lv.LevelRef == 3; });
            if (levelResult != null)
            {
            chkLevel003.Checked = levelResult.LevelResponse;
            }
        }
Ejemplo n.º 23
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            PID = Request.QueryString["PID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(273);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @"  alink=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(273) + "'>";
            #endregion Properties For The Base Class and Check Login
            DataBind(); // Ying added in May23,2008 for active server control databinding in aspx page
            bool bShowSkillCats = false;
            string strCountry = LoginInfo["Country"].ToString();

            //Get Cluster literals
            strClusterSystem = LoginInfo["Cluster1"].ToString();
            dtClusterInstructions = CCLib.Cache.GetCachedDataTable("ClusterInstructions" + NonEngSuffixCode(), "select * from ClusterInstructions" + NonEngSuffixCode());
            drsClusterInstructions = dtClusterInstructions.Select("ClusterName='" + strClusterSystem.Replace("'", "''") + "'");
            strClusterHeading = drsClusterInstructions[0]["Recommendations"].ToString();
            //mrm changed field as instructed by Meredith
            strClusterIntro = drsClusterInstructions[0]["CareerSuggestionsInst"].ToString();
            strClusterLink = drsClusterInstructions[0]["SuggestionsLink"].ToString();

            //OnLoad JS and JS that changes - fixed Javascript is read from k_list_matched.js
            string strBuf = "<SCRIPT LANGUAGE='JavaScript' ><!--\n";
            strBuf = strBuf + "pageImgInit('" + SuffixCode() + "');";
            strBuf = strBuf + "\n// --></SCRIPT>";
            svrJavaSetup.Text = strBuf;

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);
            intTotalAspectCount = clientStorage.ClientAspects.Count;
            strAnsweredQuestions = intTotalAspectCount.ToString();
            imgBar1.Width = Convert.ToInt16((Convert.ToDouble(intTotalAspectCount) / Convert.ToDouble(116)) * 161);
            if (clientStorage.ClientLevels.Count == 0)
            {
                lblEdu.Text = TextCode(6996);
            }
            else
            {
                string strLevel = "";
                foreach (LevelResult lr in clientStorage.ClientLevels)
                {
                    if (lr.LevelResponse == true)
                    {
                        switch (lr.LevelRef)
                        {
                            case 1: strLevel = TextCode(303);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 2: strLevel = TextCode(304);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 3: strLevel = TextCode(305);
                                lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                                break;
                            case 4: strLevel = TextCode(6996);
                                lblEdu.Text = strLevel;
                                break;
                        }
                        //lblEdu.Text = (lblEdu.Text == "") ? strLevel : lblEdu.Text + "<br />" + strLevel;
                    }
                }
                lblEdu.Text = (strLevel == "") ? TextCode(6996) : lblEdu.Text;
            }
            rptTOWlist.Visible = (LoginInfo["ClusterMatchmaker"].ToString() == "True") ? true : false;

            //JM/Don if loading from portfolio then lets do it here
            //string strPortfolioID = CCLib.Common.Strings.GetQueryString("PortfolioId");//first check query string
            //if (strPortfolioID == "" && Session["PortInfo"] != null)//check session variables again, in case user linked from top nav button without the querystring passed
            //{
            //    DataRow drwPortInfo = (DataRow)Session["PortInfo"];
            //    strPortfolioID = drwPortInfo["PortfolioID"].ToString();
            //}

            //if (strPortfolioID != "")
            if (Session["matchmaker_login_from_portfolio"] != null)
            {
                if (clientStorage.AspectIndicator < 1)
                {
                    clientStorage.AspectIndicator = 1;
                    clientStorage.Save(LoginID);
                }
                else
                    clientStorage.Retrieve(LoginID);
            }

            // Determine skill state and turn on/off controls
            if (LoginInfo["EnableSkill"].ToString() == "True")
            {
                //turn on skills button
                tblSkills.Visible = true;
                // if all skills answered - change HREF so submenu is displayed
                if (clientStorage.SkillsIndicator == 1)
                {
                    strAnsweredSkills = "45";
                    strSkillsLink = TextCode(3279);
                    tdLegend.Visible = true;
                    imgSkillsBar.Width = 161;
                    aSkills.Attributes.Add("HREF", "k_skills_review.aspx?LoginID=" + LoginID);//All the questions have been answered
                    bShowSkillCats = true;//show skill icons
                }
                else
                {
                    strAnsweredSkills = "0";
                    strSkillsLink = TextCode(7413);
                    tdLegend.Visible = false;
                    imgSkillsBar.Width = 0;
                    aSkills.Attributes.Add("HREF", "k_skills_intro.aspx?LoginID=" + LoginID);//All the questions have not been answered
                    bShowSkillCats = false;//show skill icons
                }
            }
            else
            {
                //turn off skills button
                tblSkills.Visible = false;
                bShowSkillCats = false;// and do not show skill icons
            }

            // May 8,2008 Added by Ying for Save Reminder Popup
            svrPopContinue.Visible = false;
            svrPopSave.Visible = false;
            if (LoginInfo["PortTypeID"].ToString() == "1" || LoginInfo["PortTypeID"].ToString() == "0")
                svrBtnYes1.AlternateText = TextCode(5593) + " " + PortfolioName + ".";
            else
                svrBtnYes1.AlternateText = "Yes, I would like to save my results.";
            svrBtnYes2.AlternateText = TextCode(5594) + " " + PortfolioName + ".";
            svrBtnNo.AlternateText = TextCode(5601);

            dtParent = CCLib.Common.DataAccess.GetDataTable("select PID,ParentID from logininfo where loginid='" + LoginID + "'");
            if (dtParent != null & dtParent.Rows[0]["ParentID"].ToString() == "")
            {
                if (Request["SVP"] == "1") SaveReminderPopup();
            }
            if (Request["AL"] == "1")
            {
                ViewState["SaveToPort"] = "1";
                SaveResults();
            }
            if (Request["PP"] == "1") ViewState["SaveResult"] = "1";
            //show Skills Legend if coming from skills_question all done
            if (!Page.IsPostBack)
            {
                if (Session["LEG"] != null)
                {
                    if (Session["LEG"].ToString() == "1")
                        ViewState["LEG"] = "1";
                }
            }
            if (Request["LEG"] == "1")
            {
                divPopupLegend.Style.Add("visibility", "visible");
                Session["LEG"] = null;
                ViewState["LEG"] = "";
            }
            else
            {
                divPopupLegend.Style.Add("visibility", "hidden");
            }

            string strDummy = LoginInfo["MMQuickSave"].ToString();
            svhQuickSaveOn.Visible = (strDummy == "True");
            //     svhQuickSaveOn.Visible = true;
            svhPortFolioOn.Visible = SaveToPort;

            //*** Redirect if no aspects answered
            if (clientStorage.AspectIndicator < 1)
            {
                #region Track User Redirect Issue
                string strReferer = (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"] == null) ? "" : System.Web.HttpContext.Current.Request.ServerVariables["HTTP_REFERER"].ToString();
                if ((strReferer.ToLower().IndexOf("/matchmaker/k_aspects_question.aspx") > 0 && Session["questionset"] != null) || (strReferer.ToLower().IndexOf("/matchmaker/k_skills_question.aspx") > 0 && Session["skillsset"] != null))//user clicked the last aspect or skill questions, track the problem
                {
                    //now go through page history list
                    System.Text.StringBuilder sbMessage = new System.Text.StringBuilder();

                    if (Session["LastRequests"] != null)
                    {
                        // gather the list of pages last visited
                        Global.CCPageRequest[] requests = Session["LastRequests"] as Global.CCPageRequest[];
                        Int32 lastRequestPosition = -1;

                        // if this is the first ever request then initialize the array
                        if (Session["LastRequestPosition"] != null && Session["LastRequestPosition"].ToString() != "")
                        {
                            lastRequestPosition = (Int32)Session["LastRequestPosition"];
                        }

                        // only continue if the request data was located.
                        if (requests != null && lastRequestPosition != -1)
                        {
                            sbMessage.AppendFormat("\nLast {0} pages visited\n\n", requests.Length);

                            Int32 index = lastRequestPosition;

                            // go around the ring of pages until we get back to the last request
                            // start with the page next to the last request since that will be the oldest
                            do
                            {
                                index++;

                                if (index >= requests.Length)
                                {
                                    index = 0;
                                }

                                Global.CCPageRequest request = requests[index];

                                if (request != null)
                                {
                                    sbMessage.AppendFormat("\n{0} - {1}\nQueryString: {2}\nForm: {3}\n", request.requestDate, request.page, request.queryString, request.form);
                                }

                            } while (index != lastRequestPosition);
                        }
                    }

                    CCLib.Common.DataAccess.ExecuteDb("insert into ErrorLogMatchMaker (Last5Pages) values ('" + sbMessage.ToString().Replace("'", "''") + "')");
                    //CCLib.Common.Email.SendEmail("*****@*****.**", "*****@*****.**", "Last 5 Pages - Matchmaker - Caputure Career Suggestions Page Requests", sbMessage.ToString());
                }
                #endregion Track User Redirect Issue

                Response.Redirect("k_login.aspx?LoginID=" + LoginID);
            }

            if (clientStorage.AspectIndicator < 2)
            {
                if (Session["matchmaker_login_from_portfolio"] == null)
                {
                    Response.Redirect("/MatchMaker/k_aspects_intro.aspx?LoginID=" + LoginID);
                }
                else
                {
                    Session["matchmaker_login_from_portfolio"] = null;
                    if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                        Response.Redirect("/MatchMaker/k_educationLevel.aspx?LoginID=" + LoginID);
                    else
                        Response.Redirect("/MatchMaker/k_aspects_intro.aspx?LoginID=" + LoginID);
                }
            }

            // if all questions answered - change HREF so message is displayed
            if (clientStorage.AspectIndicator == 4)
            {
                //aAspects.Attributes.Add("HREF", "javascript:togglePopupDone(true)");
                aAspects.Visible = false;
                aAspectsReview.Attributes.Add("HREF", "k_aspects_review.aspx?LoginID=" + LoginID);
            }
            else
            {
                aAspects.Attributes.Add("HREF", "k_aspects_question.aspx?&LoginID=" + LoginID);
                aAspectsReview.Attributes.Add("HREF", "k_aspects_review.aspx?LoginID=" + LoginID);
            }

            userdetails.Text = "&nbsp;" + TextCode(274) + "&nbsp;" + clientStorage.FirstName + "&nbsp;" + clientStorage.LastName;
            //debug            userdetails.Text = "&nbsp;" + TextCode(274) + "&nbsp;" + clientStorage.AspectIndicator.ToString();

            //display Continue PopUp if coming from Matchmaker on the menu
            svrPopContinue.Visible = (Request["MMM"] == "1" && Session["PortInfo"] == null);
            svrPopContinueIntro.Text = clientStorage.FirstName + "&nbsp;" + clientStorage.LastName + TextCode(4054) + "<br><br>" + TextCode(4055);
            svrBtnContinue.AlternateText = TextCode(4056);
            svrBtnContinue.ImageUrl = "../media1/Matchmaker/btn_sessioncontinue" + NonEngSuffixCode() + ".gif";
            svrBtnRestart.AlternateText = TextCode(4057);
            svrBtnRestart.ImageUrl = "../media1/Matchmaker/btn_sessionrestart" + NonEngSuffixCode() + ".gif";

            //do a match
            JobList jl;
            //get all matched jobs
            jl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(), strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels);
            if (Request["clustercode"] == null)
            {
                if (bShowSkillCats) //add skills
                { CCLib.MatchingObject.CCobject.getSkillsCategories(strCountry, jl, clientStorage.ClientSkills); };
                spanShowClusterOptions.Visible = false;
                strListTitle = TextCode(6993);//Your career suggestions
                //display all suggested jobs
                if (jl.Count > 0) { svhNoMatchedCareers.Visible = false; };
                sugglist.DataSource = jl.GetAsDataTable();
                sugglist.DataBind();
            }
            else
            {
                JobList TOWjl; //matched jobs based on TOW
                TOWjl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(), strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels, Request["clustercode"].ToString(), strClusterSystem);
                if (bShowSkillCats) //add skills
                { CCLib.MatchingObject.CCobject.getSkillsCategories(strCountry, TOWjl, clientStorage.ClientSkills); };
                spanShowClusterOptions.Visible = true;
                //display matched TOW jobs
                if (TOWjl.Count > 0) { svhNoMatchedCareers.Visible = false; };
                sugglist.DataSource = TOWjl.GetAsDataTable();
                sugglist.DataBind();
                //determine the name of this cluster to place at top of job list
                dtClusterCodes = CCLib.Cache.GetCachedDataTableWithNoExpire("ClusterCodes", "select * from ClusterCodes");
                strClusterCode = Request.QueryString["clustercode"];
                strClusterType = (CCLib.Common.Strings.GetQueryString("Cluster").Length > 0) ? CCLib.Common.Strings.GetQueryString("Cluster") : strClusterSystem;//this comes from LoginInfo.Cluster1
                drsClusterCodes = dtClusterCodes.Select("ClusterCode='" + strClusterCode.Replace("'", "''") + "' and ClusterType='" + strClusterType.Replace("'", "''") + "'");
                strListTitle = TextCode(6993) + ": " + drsClusterCodes[0]["ClusteName" + NonEngSuffixCode()].ToString();
            }

            //this is based on all matched jobs
            TOWList tl = CCLib.MatchingObject.CCobject.buildTOWList(SuffixCountryLanguageCode(), NonEngSuffixCode(), jl, strClusterSystem);
            DataTable dtTOWList = tl.GetAsDataTable();
            dtTOWList.Columns.Add(new DataColumn("Number", typeof(string)));
            for (int i = 0; i < dtTOWList.Rows.Count; i++)
            {
                int j = i + 1;
                dtTOWList.Rows[i]["Number"] = j.ToString();
            }

            rptTOWlist.DataSource = dtTOWList;
            rptTOWlist.DataBind();

            //populate portfolio save form...
            if (svhPortFolioOn.Visible == true || LoginInfo["CustomID"].ToString() == "f4k-no-nav")//for f4k users. Don Xiong Aug 23, 2006
            {
                string strMatchRefs = "";
                string strSkillsRankString = "";
                for (int i = 0; i < jl.Count; i++)
                {
                    if (strMatchRefs != "") { strMatchRefs = strMatchRefs + ";"; };
                    strMatchRefs = strMatchRefs + jl[i].JobRef.ToString();
                    strSkillsRankString = strSkillsRankString + jl[i].SkillsCat;
                };

                string strAspectRefString = "";
                string strAspectResString = "";
                foreach (AspectResult ar in clientStorage.ClientAspects)
                {
                    strAspectRefString = strAspectRefString + ar.AspectRef.ToString().PadLeft(3, '0');
                    int intTmp = ar.AspectResponse;
                    if (intTmp < 0) { intTmp = 0; };
                    strAspectResString = strAspectResString + intTmp.ToString();

                };
                string strSkillsString = "";
                for (int i = 0; i < clientStorage.ClientSkills.Count; i++)
                {
                    SkillsResult sr = clientStorage.ClientSkills[i];
                    int intTmp = sr.SkillsResponse;
                    if (intTmp < 0) { intTmp = 0; };
                    strSkillsString = strSkillsString + intTmp.ToString();
                }
                string strLevels = "";
                foreach (LevelResult lr in clientStorage.ClientLevels)
                {
                    if (lr.LevelResponse == true)
                    {
                        strLevels = strLevels + lr.LevelRef.ToString().PadLeft(3, '0');
                    };
                }

                string strClusterCodes = "";
                for (int i = 0; i < tl.Count && i < 2; i++)
                {
                    if (strClusterCodes != "") { strClusterCodes = strClusterCodes + ","; };
                    strClusterCodes = strClusterCodes + tl[i].Code;
                };

                MatchMakerRef.Value = strAspectRefString;
                MatchMakerRes.Value = strAspectResString;
                MatchMakerEducation.Value = strLevels;
                if (strSkillsString != "")
                {
                    MatchMakerSkill.Value = strSkillsString;
                    MatchMakerSkillRank.Value = strSkillsRankString;

                }
                Pathway.Value = strClusterSystem + "|" + strClusterCodes;
                ptsavevalue.Value = strMatchRefs;

                //for f4k users. Don Xiong Aug 23, 2006
                strOccNumbers = strMatchRefs;
                strPathway = strClusterCodes;
                //for f4k users. Don Xiong Aug 23, 2006
            }
        }
Ejemplo n.º 24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(263);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @"  alink=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' leftmargin=0 link=#003366 text=#000000 topmargin=0 vlink=#666666 marginwidth='0' marginheight='0'";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(263) + "'>";
            IsLongPage = false;
            #endregion Properties For The Base Class and Check Login

            if (!Page.IsPostBack)
            {
                string s = LoginInfo["Portfolio"].ToString();
                string t = LoginInfo["MMQuickSave"].ToString();
                divA.Visible = false;
                divD.Visible = false;
                divPopupSkillReminder.Visible = false;

                strAction = CCLib.Common.Strings.GetQueryString("action");
                string strFN = CCLib.Common.Strings.GetQueryString("fn");
                string strLN = CCLib.Common.Strings.GetQueryString("ln");

                if (strAction == "Start")
                {
                    if (Session["PortInfo"] != null)//get user name value from portfolio session
                    {
                        DataRow drwPortInfo = (DataRow)Session["PortInfo"];
                        //strFirstName = drwPortInfo["FirstName"].ToString();
                        //strLastName = drwPortInfo["LastName"].ToString();
                        ClientStorage clientStorage = new ClientStorage();
                        clientStorage.AspectIndicator = 1;
                        clientStorage.FirstName = drwPortInfo["FirstName"].ToString(); ;
                        clientStorage.LastName = drwPortInfo["LastName"].ToString(); ;
                        clientStorage.Save(LoginID);
                    }
                    else
                    {
                        ClientStorage clientStorage = new ClientStorage();
                        clientStorage.AspectIndicator = 1;
                        clientStorage.FirstName = strFN;
                        clientStorage.LastName = strLN;
                        clientStorage.Save(LoginID);
                    }
                    if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                        Response.Redirect("k_EducationLevel.aspx?LoginID=" + LoginID);
                    else
                        Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID);
                }

                if (strAction == "Login")
                {
                    Session["portfolio_login_from_matchmaker"] = "yes";
                    string strPortTypeFolder = (PortTypeID == "4") ? "SD" : PortType;
                    string LoginPage = (PortTypeSettings["HasCustomLogin"].ToString() == "True") ? "/" + strPortTypeFolder + "/Default.aspx" : "/Individual/Default.aspx";
                    Response.Redirect(LoginPage + "?LoginID=" + LoginID + "&ptsection=stmAssessments");
                }

                if (strAction == "Recall")
                {
                    Response.Redirect("k_ContinueSession.aspx?LoginID=" + LoginID);
                }
                if (LoginInfo["Portfolio"].ToString().ToLower() == "yes" && LoginInfo["MMQuickSave"].ToString().ToLower() == "false" && (PortTypeID == "0" || PortTypeID == "1" || PortTypeID == "5") || (PortTypeID == "2" || PortTypeID == "3" || PortTypeID == "4"))
                {
                    divA.Visible = true;
                    tbLogin.Visible = true;
                    tbRecall.Visible = false;
                    tbMMQuickSave.Visible = false;
                    divD.Visible = false;
                }

                if (LoginInfo["Portfolio"].ToString().ToLower() == "yes" && LoginInfo["MMQuickSave"].ToString().ToLower() == "true" && (PortTypeID == "0" || PortTypeID == "1" || PortTypeID == "5"))
                {
                    divA.Visible = true;
                    tbLogin.Visible = true;
                    tbRecall.Visible = false;
                    tbMMQuickSave.Visible = true;
                    divD.Visible = false;
                }

                if (LoginInfo["Portfolio"].ToString().ToLower() == "no" && LoginInfo["MMQuickSave"].ToString().ToLower() == "true" && (PortTypeID == "0" || PortTypeID == "1" || PortTypeID == "5"))
                {
                    divA.Visible = true;
                    tbLogin.Visible = false;
                    tbRecall.Visible = true;
                    tbMMQuickSave.Visible = false;
                    divD.Visible = false;
                }

                if (LoginInfo["Portfolio"].ToString().ToLower() == "no" && LoginInfo["MMQuickSave"].ToString().ToLower() == "false" && (PortTypeID == "0" || PortTypeID == "1" || PortTypeID == "5"))
                {
                    divA.Visible = false;
                    divD.Visible = true;
                }

                if (CCLib.Common.Strings.GetQueryString("RemindSkill") == "1")
                    divPopupSkillReminder.Visible = true;
                else
                    divPopupSkillReminder.Visible = false;
            }
        }
Ejemplo n.º 25
0
        public void SaveAspects()
        {
            int intAspectRef;
            int intAspectRes;

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);
            AspectResult aspectResult;

            foreach (GridViewRow gr in grdChangeAnswers.Rows)
            {
                intAspectRef = Convert.ToInt16((gr.FindControl("AspectRef") as System.Web.UI.HtmlControls.HtmlInputHidden).Value);
                intAspectRes = Convert.ToInt16((gr.FindControl("ResponseDropDown") as System.Web.UI.WebControls.DropDownList).SelectedValue);

                // find the value
                aspectResult = clientStorage.ClientAspects.Find(delegate(AspectResult ar)
                                                                 {
                                                                     return ar.AspectRef == intAspectRef;
                                                                 }
                                                                 );
                // then we set the value...
                if (aspectResult != null) { aspectResult.AspectResponse = intAspectRes; };
            };
            clientStorage.Save(LoginID);
        }
Ejemplo n.º 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CCLib.Login.EnforceSSLLoginPage();//always check valid server name first and enforce SSL for login page

            strLogoff = CCLib.Common.Strings.GetQueryString("t");//used to determine auto logoff or manual logoff
            //check if user manually clicked logout, if so, expire session, especially the last ilp page
            if (strLogoff == "m"||strLogoff=="t")
            {
                //delete user PID from LoginInfo and clear Login cache
                if (Session["PortInfo"] != null)
                {
                    PortInfo = (DataRow)Session["PortInfo"];//get session value
                    CCLib.Login.ExpireUserLoginSession();//expire session
                    strLoginID = CCLib.Common.DataAccess.GetValue("select TOP (1) LoginID from LoginInfo where PID=" + PortInfo["PortfolioID"].ToString() + " ORDER BY ExpiredTime DESC").ToString();
                    CCLib.Common.DataAccess.ExecuteDb("delete from LoginInfo where PID=" + PortInfo["PortfolioID"].ToString());

                    if (strLogoff == "m" && PortInfo["GUID"].ToString()!="")//manual logoff also pass to gohigher to log off gohigher
                    {
                        string accessKey = CCLib.Common.Strings.GetAppSettingsValue("strGoHigherAccessKey");
                        XAPSSO.SingleSignOn Service = new XAPSSO.SingleSignOn();
                        string strToken = Service.RequestGatewayToken(accessKey, PortInfo["GUID"].ToString());
                        Response.Redirect(CCLib.Common.Strings.GetAppSettingsValue("strGoHigherGatewayLink") + "?guid=" + PortInfo["GUID"].ToString() + "&token=" + strToken + "&command=logoff&targeturl=" + Server.UrlEncode("http://" + ConfigurationManager.AppSettings["strServerName"] + "/ILP/Default.aspx"));
                    }
                }
            }

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strUsername = CCLib.Common.Strings.GetFormString("Username");
                strPassword = CCLib.Common.Strings.GetFormString("Password");
                strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,0 as ParentID,'' as ParentUserName,'' as ParentPassword,p.Agreement from Userinfo u inner join Portfolio p on u.schoolid=p.schoolid and p.Username='******'", "''") + "' and p.Password='******'", "''") + "' and p.UserType=2";//Student ILP
                dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);

                //then try Parent ILP again if no match found
                if (dtUserInfo.Rows.Count == 0)
                {
                    strSQL = "select u.Country,u.ExpiredDate,u.UseSSL,u.Username,u.Password,u.SchoolID,p.UserType,p.PortfolioID,p.ParentID,p.ParentUserName,p.ParentPassword from Userinfo u inner join Portfolio_View_KY p on u.schoolid=p.schoolid and p.ParentUserName='******'", "''") + "' and p.ParentPassword='******'", "''") + "'";//Parent ILP
                    dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);
                }

                if (dtUserInfo.Rows.Count > 0)
                {
                    strLoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").ToString() + "-2";//get LoginID
                    if (dtUserInfo.Rows[0]["ParentUserName"].ToString().ToUpper().Trim() == strUsername.ToUpper().Trim() && dtUserInfo.Rows[0]["ParentPassword"].ToString().ToUpper().Trim() == strPassword.ToUpper().Trim())//Parent ILP
                    {
                        blIsILPParent = true;
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLParent(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["ParentID"].ToString()));//Insert Logininfo and Accessinfo, etc
                    }
                    else//Studnet ILP
                        CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQLPort(strLoginID, dtUserInfo.Rows[0]["Username"].ToString(), dtUserInfo.Rows[0]["Password"].ToString(), dtUserInfo.Rows[0]["Country"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString(), dtUserInfo.Rows[0]["PortfolioID"].ToString()));//Insert Logininfo and Accessinfo, etc

                    //User coming from MatchMaker login
                    if (Session["matchmaker_login_from_portfolio"] != null)
                    {
                        ClientStorage clientStorage = new ClientStorage();
                        if (clientStorage.LoadFromPortfolio(dtUserInfo.Rows[0]["PortfolioID"].ToString()))
                        {
                            clientStorage.Save(LoginID);
                            Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }
                        else
                        {
                            clientStorage.ClearSession();
                            if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                                Session["LastPortPage"] = "/MatchMaker/k_educationLevel.aspx";
                            else
                                Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                        }
                    }

                    //user saved to ILP or not
                    if (Session["ptreturnurl"] != null)
                        strHomepage = "/Individual/SaveToPort.aspx";
                    else//last Port page or not
                    {
                        if (Session["LastPortPage"] != null)
                            strHomepage = Session["LastPortPage"].ToString();
                        else //check whether user agrees to the terms
                            strHomepage = (blIsILPParent) ? "/Parent/Home.aspx" : (dtUserInfo.Rows[0]["Agreement"].ToString() == "True") ? "/Individual/Home.aspx" : "/Individual/Agreement.aspx";
                    }

                    CCLib.Login.PortLoginInitSession("2", "ILP", dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString());

                    if ((bool)dtUserInfo.Rows[0]["UseSSL"])
                        Response.Redirect("https://" + ConfigurationManager.AppSettings["strServerName"] + strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID);
                    else
                        Response.Redirect(strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString().Replace("'", "") + "&LoginID=" + strLoginID);
                }
                else
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your username and password were not found in the system. Please try again.");
                }

            }
            else
            {
                if(strLogoff=="t")
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your session has expired.");
            }
        }
Ejemplo n.º 27
0
        public void PopulateAspectData(string sortExpression, string direction)
        {
            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);
            intTotalAspectCount = clientStorage.ClientAspects.Count;

            dtQuestions = CCLib.Cache.GetCachedDataTableWithNoExpire("MM_QUESTION_" + intTotalAspectCount + "_" + SuffixCountryLanguageCode(), "select QuesID,Questions,Description from tblquestions" + SuffixCountryLanguageCode());

            dtAnswers = clientStorage.ClientAspects.GetAsDataTable(sortExpression, direction);
            dtAnswers.Columns.Add("QuesID", typeof(int));
            dtAnswers.Columns.Add("QuesName", typeof(String));
            dtAnswers.Columns.Add("QuesDesc", typeof(String));
            for (int i = 0; i < dtAnswers.Rows.Count; i++)
            {
                // The first time the page is requested, GridViewQuestionsOrder is set after PopulateAspectData() has been called
                dtAnswers.Rows[i]["QuesID"] = GridViewQuestionsOrder.Contains(dtAnswers.Rows[i]["AspectRef"]) ? GridViewQuestionsOrder[dtAnswers.Rows[i]["AspectRef"]] : i + 1;
                for (int j=0; j < dtQuestions.Rows.Count; j++)
                {
                    if (dtAnswers.Rows[i]["AspectRef"].ToString() == dtQuestions.Rows[j]["QuesID"].ToString())
                    {
                        dtAnswers.Rows[i]["QuesName"] = dtQuestions.Rows[j]["Questions"].ToString();
                        dtAnswers.Rows[i]["QuesDesc"] = dtQuestions.Rows[j]["Description"].ToString();
                    }
                }
            }
            grdChangeAnswers.DataSource = dtAnswers;
            grdChangeAnswers.DataBind();

            preparePagerCount();
            AssignToUserControl();
        }
Ejemplo n.º 28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Put user code to initialize the page here

            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            base.LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            base.Redirect();
            base.PageTitle = TextCode(270);
            base.Section = "mm";
            base.CSS = "global_css";
            base.HeadTag = "<STYLE TYPE='TEXT/CSS'><!--.MMBackLink {text-decoration:none;}.MMBackLink:hover {text-decoration:underline}.PrintLink {color: #FFFFFF; font-size:10px; text-decoration:underline;}.PrintLink:hover {color: #FFFFFF;font-size:10px; font-weight:bold}--></STYLE>";
            base.BodyTag = @" ALINK=#990000 style='background-image:url(/media/shared/bg_else.gif); background-repeat:no-repeat; background-color:#FFFFFF;' LEFTMARGIN=0 LINK=#003366 TEXT=#000000 TOPMARGIN=0 VLINK=#666666 ";
            base.LeftBar = @"<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH='100%'><TR BGCOLOR=#336699 VALIGN=top><TD BACKGROUND='../media/mm/i_top_bar_bg.gif'><IMG HEIGHT=23 SRC='../media/mm/i_c_mm_icon.gif' WIDTH=24 alt=''><IMG HEIGHT=23 SRC='../media/mm/h_c_mm.gif' WIDTH=141 alt='" + TextCode(270) + "'>";
            IsLongPage = false;
            #endregion Properties For The Base Class and Check Login

            int wPos = 0; //number of answered aspects
            //int wCount = 0;//number of aspects in this set
            //int wResponse = -1;//
            string strCountry = LoginInfo["Country"].ToString();
            string strMMID = Request.QueryString["MMID"]; //SavedMatchMakerID

            //*** Page interface initialisation
            string strBuf = "../media1/Matchmaker/";
            if (LoginInfo["MMGraphic"].ToString() == "Adult") {
                strBuf = strBuf + "MMIcon2";
            } else {
                strBuf = strBuf + "i_emoticons";
            }
            ImageMap1.Attributes.Add("SRC", strBuf + SuffixCode() + ".gif");
            ImageMap2.Attributes.Add("SRC", "../media1/Matchmaker/sh_p3" + SuffixCode() + ".gif");
            ImageMap1.Alt = TextCode(3272);
            ImageMap2.Alt = TextCode(3273);
            //TODO cope with old browsers
            //From Old ASP page
            //    set objBrowser = Server.CreateObject("cyScape.browserObj")
            //    if (objBrowser.Browser = "IE" and instr(objBrowser.platform,"Mac")=1) or (objBrowser.Browser = "Netscape" and instr(objBrowser.fullVersion,"6.")=1) then
            //    %>javascript:moreInfo2()<%
            //    else
            //    %>javascript:moreInfo()<%
            //    end if
            //    set objBrowser = nothing
            svrMoreInfoBtn.Text = "<A HREF='javascript:moreInfo()'><IMG SRC='../media1/MatchMaker/mout_p3_moreinfo" + SuffixCode() + ".gif' WIDTH='49' HEIGHT='47' BORDER='0' alt='"+TextCode(3180)+"'></A>";
            //see below for using moreInfo2() - this is now in JS/imgOnOff and the text is passed

            //***Page Code inititialisation
            //see if we need to build a result set
            // first we get the client data

            ClientStorage clientStorage = new ClientStorage();
            clientStorage.Retrieve(LoginID);

            // we use this as a list of questions
            if ((Request.QueryString["RES"] == "") || (Request.QueryString["RES"] == null))// have they answered a question or is this the first time around
            {

                // it doesn't exist so lets build it....
                if (clientStorage.AspectIndicator == 2)
                {
                    JobList jl = CCLib.MatchingObject.CCobject.buildJobList(SuffixCountryLanguageCode(),strCountry, clientStorage.ClientAspects, clientStorage.ClientHealth, clientStorage.ClientLevels);
                    AspectResultSet ars = CCLib.MatchingObject.CCobject.buildAspectResultSet(strCountry,jl,clientStorage.ClientAspects);
                    //check if any supplementary questions - if none then get remainder
                    //mrm 15/5/2006 changed from 1 to 20 to avoid very small supplementary aspect sets
                    if (ars.Count < 20) ars = CCLib.MatchingObject.CCobject.buildAspectResultSet(SuffixCountryLanguageCode(), clientStorage.ClientAspects);
                    Session.Add("questionset", ars);
                }
                else
                {
                    Session.Add("questionset", CCLib.MatchingObject.CCobject.buildAspectResultSet(SuffixCountryLanguageCode()));
                };

            }

            //JM 13/08/2006 if we have no questionset in the session then the session must have timed out between answering questions so redirect them to to k_list_matched.aspx
            if (Session["questionset"] == null)
            {
                Response.Redirect("k_list_matched.aspx?LoginID=" + LoginID + "&SVP=1&MMID=" + strMMID);
            }

            // lets pull the results into a local variable rather than keep accessing it through the session interface
            AspectResultSet questionset = Session["questionset"] as AspectResultSet; // get resultset from session

            // save the value away
            if ((Request.QueryString["RES"] != "") && (Request.QueryString["RES"] != null))// a resultset already exists, have they answered a question
            {

                AspectResult aspectResult = clientStorage.ClientAspects.Find(
                                                             delegate(AspectResult ar)
                                                             {
                                                                 return ar.AspectRef == Convert.ToInt16(Request.QueryString["REF"]);
                                                             }
                                                             );
                if (aspectResult == null)
                {
                    //it's not there so add to resultset
                    aspectResult = new AspectResult();
                    aspectResult.AspectRef = Convert.ToInt16(Request.QueryString["REF"]);
                    clientStorage.ClientAspects.Add(aspectResult);
                }
                // then we set the value...
                if (aspectResult != null) { aspectResult.AspectResponse = Convert.ToInt16(Request["RES"].ToString()); };

                //now we flag the question as answered
                aspectResult = questionset.Find(
                                                             delegate(AspectResult ar)
                                                             {
                                                                 return ar.AspectRef == Convert.ToInt16(Request.QueryString["REF"]);
                                                             }
                                                             );

                if (aspectResult != null) { aspectResult.AspectResponse = Convert.ToInt16(Request["RES"].ToString()); };

            }

            //see which question to ask
            AspectResult aspectNext = questionset.Find(delegate(AspectResult ar) { return ar.AspectResponse == -1; });
            if (aspectNext == null)
            {
                //they have answered all the questions in this set
                //mrm - 18/4/2006 previously Indicator was simply set to 2
                if (clientStorage.AspectIndicator==2)
                {
                    //check for any unanswered aspects - set Indicator to 4 if no more to do
                    AspectResultSet arUnanswered = CCLib.MatchingObject.CCobject.buildAspectResultSet(SuffixCountryLanguageCode(), clientStorage.ClientAspects);
                    if (arUnanswered.Count == 0)
                    {
                        clientStorage.AspectIndicator = 4;
                    }
                }
                else
                {
                    clientStorage.AspectIndicator = 2;
                }
                clientStorage.Save(LoginID);

                Response.Redirect("k_list_matched.aspx?loginID=" + LoginID + "&SVP=1&MMID=" + strMMID);
            }
            else
            {

                DataRow aspect = CCLib.MatchingObject.CCobject.getAspect(aspectNext.AspectRef, SuffixCountryLanguageCode());//TODO use suffix and Language code
                wPos = questionset.IndexOf(aspectNext);
                svrProgressLit.Text = Convert.ToString(wPos + 1) + "&nbsp;" + TextCode(2972) + "&nbsp;" + Convert.ToString(questionset.Count) + "&nbsp;&nbsp;";
                // set aspect details
                svrAspectNameLit.Text = aspect["question"].ToString();
                svrMoreInfo2.Text = Convert2BR(aspect["notes"].ToString());//must add BRs to format bullets

                //set progress bar
                svhProgressImg.Width = Convert.ToInt16((wPos + 1) * (387 / questionset.Count));
                svhProgressImg.Alt = TextCode(3292) + " = " + Convert.ToString(wPos + 1) + " " + TextCode(2972) + " " + Convert.ToString(questionset.Count);

                //decide whether to show Bottom Careers button
                if (clientStorage.AspectIndicator > 1) {
                    svhBtmRow.Visible = true;
                    svhBtmDest.Attributes.Add("HREF", "k_list_matched.aspx?loginID=" + LoginID + "&SVP=1&MMID=" + strMMID);
                } else {
                    svhBtmRow.Visible = false;
                }

                //set response URL
                string wURL = "k_aspects_question.aspx?&REF=" + aspect["ref"].ToString() + "&LoginID=" + base.LoginID + "&MMID=" + strMMID;
                checkbox5.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=5',5)");
                checkbox4.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=4',4)");
                checkbox3.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=3',3)");
                checkbox2.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=2',2)");
                checkbox1.Attributes.Add("onclick", "chkMark('" + wURL + "&RES=1',1)");

            };
            //Save the client record
            clientStorage.Save(LoginID);
        }
Ejemplo n.º 29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CCLib.Login.CheckValidLoginPageServerName();//always check valid server name first for login page

            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);

            Redirect();
            PageTitle = TextCode(2620);
            Section = "portfolio_tool";
            CSS = "student";
            HeadTag = "<style type='TEXT/CSS'><!--.btnDescription {  font: 11px Verdana, Arial, Helvetica, sans-serif; margin: 0px 15px}--></style>";
            BodyTag = " alink='#990000' style='background-image:url(/media/shared/bg_left_bar_grey.gif);background-repeat:repeat-y;' bgcolor='#ffffff' leftmargin=0 link='#003366' text='#000000' topmargin=0 vlink='#003366' marginwidth='0' marginheight='0'";
            LeftBar = "<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr valign='TOP' bgcolor='#669966'><td background='/media/portfolio_tool/bg_bar_tan_top.gif'><img height=23 src='/media/student_parent/icons/icon_arrow.gif' alt='' width=24><img height=23 src='/media1/Portfolio/h_h_" + ((PortfolioName == "EDP") ? "edp_" : "") + "main" + SuffixCode() + ".gif' alt='' width=141>";

            //Check to see if course planner, then redirect if active
            string strCPLogin = CPLogin();
            if (strCPLogin != "") Response.Redirect(strCPLogin);

            #endregion Properties For The Base Class and Check Login

            strLogoff = CCLib.Common.Strings.GetQueryString("t");//used to determine auto logoff or manual logoff
            //check if user manually clicked logout, if so, expire session, especially the last ilp page
            if (strLogoff == "m" || strLogoff == "t")
            {
                //delete user PID from LoginInfo and clear Login cache
                CCLib.Common.DataAccess.ExecuteDb("update LoginInfo set PID = null where LoginID='" + LoginID + "'");
                CCLib.Login.ExpireUserLoginSession();
            }

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strUsername = CCLib.Common.Strings.GetFormString("Username").Trim();
                strPassword = CCLib.Common.Strings.GetFormString("Password").Trim();

                if (strUsername != "" && strPassword != "")//user entered something
                {
                    // select portfolios corresponding to the username or problem username (usernames containing hyphens or those that have the same username / password as school sccounts) entered
                    strSQL = "SELECT p.PortfolioID,p.FirstName,p.LastName, p.SchoolID,p.TransferSchoolId,p.SchoolUsername,p.SchoolPassword,p.Agreement, p.Active, p.Username as PortfolioUsername, pp.ProblemUsernameTypeID, pp.ProblemUsernameDateCleared, pp.ProblemUsername, pp.ProblemUsernameTypeID, pp.ProblemUsernameDateCleared, ";
                    strSQL += "p.PtrnPwdChangeDate, u.ForcePwdChange FROM Portfolio p ";
                    strSQL += "LEFT OUTER JOIN UserInfo u ON p.SchoolID = u.SchoolID ";
                    strSQL += "LEFT OUTER JOIN Port_ProblemUsernames pp ON p.PortfolioID = pp.PortfolioID ";
                    strSQL += "WHERE (u.PortTypeID = 0 or u.PortTypeID = 5 or u.PortTypeID = 1 or u.PortTypeID is null)";
                    strSQL += "AND ((pp.ProblemUsername='******'", "''") + "' and p.Password='******'", "''") + "' AND pp.ProblemUsernameDateCleared IS NULL) ";
                    strSQL += "OR (p.UserName='******'", "''") + "' and p.Password='******'", "''") + "'))";

                    dtUserInfo = CCLib.Common.DataAccess.GetDataTable(strSQL);

                    if (dtUserInfo.Rows.Count > 0)//valid username and password
                    {
                        // if username entered is a problem username
                        if (strUsername.ToLower() == dtUserInfo.Rows[0]["ProblemUsername"].ToString().Trim().ToLower())
                        {
                            // if user has not yet successfully logged in
                            if (dtUserInfo.Rows[0]["ProblemUsernameDateCleared"] == DBNull.Value)
                            {
                                // if problem username is a duplicate of a school account
                                if (dtUserInfo.Rows[0]["ProblemUsernameTypeID"].ToString() == "1")
                                {
                                    // display appropriate messaging
                                    strJS = CCLib.Common.Forms.JavaScriptNotify(TextCode(9332).Replace("'", "\\'") + "\\n\\n" + TextCode(9333).Replace("'", "\\'") + "\\n\\n" + dtUserInfo.Rows[0]["PortfolioUsername"].ToString() + "\\n\\n" + GetPortText(9334,false).Replace("'", "\\'"));
                                }
                                else if (dtUserInfo.Rows[0]["ProblemUsernameTypeID"].ToString() == "2")
                                {
                                    // otherwise, if username contains a hyphen(s), display appropriate messaging
                                    strJS = CCLib.Common.Forms.JavaScriptNotify(TextCode(9335).Replace("'", "\\'") + "\\n\\n" + TextCode(9333).Replace("'", "\\'") + "\\n\\n" + dtUserInfo.Rows[0]["PortfolioUsername"].ToString());
                                }
                            }
                            /* the following code block is not needed since the select query above handles cases where the "ProblemUsernameDateCleared" is null
                            else
                            {
                                strJS = CCLib.Common.Forms.JavaScriptNotify(TextCode(3214));
                            } */
                        }
                        else if (strUsername.ToLower() == dtUserInfo.Rows[0]["PortfolioUsername"].ToString().Trim().ToLower())
                        {
                            // otherwise, if not a problem username
                            if (dtUserInfo.Rows[0]["ProblemUsername"] != DBNull.Value && dtUserInfo.Rows[0]["ProblemUsernameDateCleared"] == DBNull.Value)
                            {
                                // update date cleared field if user has not logged in successfully before
                                strSQL = "UPDATE Port_ProblemUsernames SET ProblemUsernameDateCleared = '" + DateTime.Now + "' ";
                                strSQL += "WHERE PortfolioID = " + dtUserInfo.Rows[0]["PortfolioID"].ToString();

                                CareerCruisingWeb.CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);
                            }

                            //Transfer Student Loging in under old info.
                            if (dtUserInfo.Rows[0]["TransferSchoolId"].ToString() == LoginInfo["SchoolID"].ToString())
                            {
                                Session["TransferSchoolId"] = dtUserInfo.Rows[0]["TransferSchoolId"].ToString();
                                Session["PortfolioID"] = dtUserInfo.Rows[0]["PortfolioID"].ToString();
                                Session["TransferUsername"] = strUsername;
                                Session["TransferPassword"] = strPassword;
                                Response.Redirect("TransferLogin.aspx?LoginID=" + LoginID);
                            }

                            //Transfer student, so check for other usernames
                            else if (dtUserInfo.Rows[0]["TransferSchoolId"].ToString() != "")
                            {
                                //There must be a duplicate username so this person has to pick a new one
                                if (CCLib.Common.DataAccess.GetValue("select PortfolioID from Portfolio where Username='******'", "''") + "' and SchoolID=" + LoginInfo["SchoolID"].ToString() + " and PortfolioID<>" + dtUserInfo.Rows[0]["PortfolioID"].ToString()).ToString() != "")
                                {
                                    //CCLib.Common.Forms.JavaScriptNotify(LoginInfo["SchoolID"].ToString());
                                    Session["PortfolioID"] = dtUserInfo.Rows[0]["PortfolioID"].ToString();
                                    Session["FirstName"] = dtUserInfo.Rows[0]["FirstName"].ToString();
                                    Session["LastName"] = dtUserInfo.Rows[0]["LastName"].ToString();
                                    Session["TransferUsername"] = strUsername;
                                    Response.Redirect("TransferDuplicate.aspx?LoginID=" + LoginID);
                                }
                                //No duplicates so get rid of TransferSchoolID so won't get flagged as transfer student anymore
                                else
                                {
                                    CCLib.Common.DataAccess.ExecuteNonQuery("update portfolio set TransferSchoolID=null where PortfolioID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString());
                                }
                            }//Transfer student, so check for other usernames

                            //check whether new school username and password, and update new school info
                            if (dtUserInfo.Rows[0]["SchoolID"].ToString() != LoginInfo["SchoolID"].ToString())
                            {
                                if (dtUserInfo.Rows[0]["SchoolID"].ToString() != "")
                                {
                                    // Check if coming or leaving a CP related school
                                    strSQL = "DECLARE @OldCP int, @NewCP int ";
                                    strSQL += "SELECT @OldCP=CoursePlanner FROM UserInfo WHERE SchoolID=" + dtUserInfo.Rows[0]["SchoolID"].ToString() + " ";
                                    strSQL += "SELECT @NewCP=CoursePlanner FROM UserInfo WHERE SchoolID=" + LoginInfo["SchoolID"].ToString() + " ";
                                    strSQL += "SELECT @NewCP As NewCPStatus, @OldCP As OldCPStatus ";
                                    //Response.Write(strSQL);
                                    //Response.End();
                                    DataTable dtCP = CCLib.Common.DataAccess.GetDataTable(strSQL);
                                    if (dtCP.Rows.Count > 0)//valid username and password
                                    {
                                        string strBasicInfo = "";
                                        strBasicInfo += "OS" + dtUserInfo.Rows[0]["SchoolID"].ToString();
                                        strBasicInfo += "-NS" + LoginInfo["SchoolID"].ToString();
                                        strBasicInfo += "-PO" + dtUserInfo.Rows[0]["PortfolioID"].ToString();
                                        if (Convert.ToInt16(dtCP.Rows[0]["NewCPStatus"]) > 1 & dtCP.Rows[0]["OldCPStatus"].ToString() != "6")
                                        {
                                            //trying to transfer INTO a CP school (not allowed)
                                            Response.Redirect("CP_NoTransfer.aspx?CP=ToCP&CPInfo=" + strBasicInfo);
                                        }
                                        if ((Convert.ToInt16(dtCP.Rows[0]["OldCPStatus"]) > 1 & dtCP.Rows[0]["OldCPStatus"].ToString() != "6") & dtUserInfo.Rows[0]["Active"].ToString() == "True")
                                        {
                                            //trying to transfer OUT of a CP school (not allowed unless Inactive)
                                            Response.Redirect("CP_NoTransfer.aspx?CP=FromCP&CPInfo=" + strBasicInfo + "&SID=" + dtUserInfo.Rows[0]["SchoolID"].ToString());
                                        }
                                    }
                                }

                                //delete existing advisor assignments
                                CCLib.Common.DataAccess.ExecuteNonQuery("delete from PortfolioAdvisorAssignments where PortfolioID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString());
                                //check the new location has duplicate username
                                if (CCLib.Common.DataAccess.GetValue("select PortfolioID from Portfolio where Username='******'", "''") + "' and SchoolID=" + LoginInfo["SchoolID"].ToString()).ToString() != "")
                                {
                                    CCLib.Common.Forms.JavaScriptNotify(LoginInfo["SchoolID"].ToString() + " " + LoginInfo["Username"].ToString() + " " + LoginInfo["Password"].ToString());
                                    Session["PortfolioID"] = dtUserInfo.Rows[0]["PortfolioID"].ToString();
                                    Session["FirstName"] = dtUserInfo.Rows[0]["FirstName"].ToString();
                                    Session["LastName"] = dtUserInfo.Rows[0]["LastName"].ToString();
                                    Session["TransferUsername"] = strUsername;
                                    Response.Redirect("TransferDuplicate.aspx?LoginID=" + LoginID);
                                }

                                //update school user account and active for new school
                                CCLib.Common.DataAccess.ExecuteNonQuery("update portfolio set Active=1,SchoolID=" + LoginInfo["SchoolID"].ToString() + ",SchoolUsername='******'", "''") + "',SchoolPassword='******'", "''") + "' where PortfolioID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString());

                            }//check whether new school username and password, and update new school info

                            #region create new LoginID if it is already been used by other PID
                            if (CCLib.Common.DataAccess.GetValue("select count(PID) from LoginInfo where PID is not null and LoginID='" + LoginID + "' and PID<>" + dtUserInfo.Rows[0]["PortfolioID"].ToString()).ToString() != "0")
                            {
                                LoginID = System.Guid.NewGuid().ToString().Replace("{", "").Replace("}", "").ToString() + "-" + LoginInfo["PortTypeID"].ToString();//get LoginID
                                CCLib.Common.DataAccess.ExecuteNonQuery(CCLib.Login.LoginInsertSQL(LoginID, LoginInfo["Username"].ToString(), LoginInfo["Password"].ToString(), LoginInfo["Country"].ToString(), LoginInfo["SchoolID"].ToString()));//Insert Logininfo and Accessinfo, etc
                            }
                            #endregion create new LoginID if it is already been used

                            strSQL = "update Logininfo set PID= '" + dtUserInfo.Rows[0]["PortfolioID"].ToString() + "' where LoginID='" + LoginID + "';update portfolio set LastLogin='******' where PortfolioID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString() + ";insert into pt_loginlog (PortfolioID,logintime,clientip,schoolid) values (" + dtUserInfo.Rows[0]["PortfolioID"].ToString() + ",'" + System.DateTime.Now.ToString() + "','" + Request.ServerVariables["REMOTE_ADDR"] + "'," + dtUserInfo.Rows[0]["SchoolID"].ToString() + ");";
                            CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);

                            //User coming from MatchMaker login
                            if (Session["portfolio_login_from_matchmaker"] != null)
                            {
                                ClientStorage clientStorage = new ClientStorage();
                                if (clientStorage.LoadFromPortfolio(dtUserInfo.Rows[0]["PortfolioID"].ToString()))
                                {
                                    clientStorage.Save(LoginID);
                                    Session["LastPortPage"] = "/Individual/Matchmaker.aspx";
                                }
                                else
                                {
                                    clientStorage.AspectIndicator = 1;
                                    clientStorage.Save(LoginID);
                                    if (LoginInfo["MMEduLevel"].ToString().ToLower() == "true")
                                        Session["LastPortPage"] = "/MatchMaker/k_educationLevel.aspx";
                                    else
                                        Session["LastPortPage"] = "/MatchMaker/k_list_matched.aspx";
                                }

                            }

                            // user coming from Learning Style login
                            if (Session["portfolio_login_from_learningstyle"] != null)
                            {
                                string strLrnStyleID = CCLib.Common.DataAccess.GetValue("select LrnStyleID from Port_SavedLrnStyles where PortfolioID = " + dtUserInfo.Rows[0]["PortfolioID"].ToString()).ToString();
                                if (strLrnStyleID != "")
                                {
                                    Session["LS_ID"] = strLrnStyleID;
                                    Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Profile.aspx";
                                }
                                else
                                    Session["LastPortPage"] = "/MatchMaker/LS_Pro/LS_Introduction.aspx";
                            }
                            //always have LS user name from Portfolio session
                            Session["LS_StudentName"] = dtUserInfo.Rows[0]["FirstName"].ToString() + " " + dtUserInfo.Rows[0]["LastName"].ToString();

                            //re-initialize Cached Logininfo data
                            //Cache.Remove("LoginInfo" + LoginID);
                            Session["LoginInfo"] = null;

                            //user saved to Port or not
                            if (Session["ptreturnurl"] != null)
                                strHomepage = "/Individual/SaveToPort.aspx";
                            else//last Port page or not
                            {
                                if (Session["LastPortPage"] != null)
                                {
                                    strHomepage = Session["LastPortPage"].ToString();
                                    if (strHomepage == "/Individual/Home.aspx" && dtUserInfo.Rows[0]["Agreement"].ToString() != "True")
                                        strHomepage = "/Individual/Agreement.aspx";
                                }
                                else //check whether user agrees to the terms
                                    strHomepage = (blIsILPParent) ? "/Parent/Home.aspx" : (dtUserInfo.Rows[0]["Agreement"].ToString() == "True") ? "/Individual/Home.aspx" : "/Individual/Agreement.aspx";
                            }

                            CCLib.Login.PortLoginInitSession(PortTypeID, PortType, dtUserInfo.Rows[0]["PortfolioID"].ToString(), dtUserInfo.Rows[0]["SchoolID"].ToString());

                            // user need to change password or agree to agreement?
                            if (dtUserInfo.Rows[0]["Agreement"].ToString() != "True" || (dtUserInfo.Rows[0]["ForcePwdChange"].ToString() == "True" && dtUserInfo.Rows[0]["PtrnPwdChangeDate"] == DBNull.Value))
                                Response.Redirect("Agreement.aspx?PID=" + dtUserInfo.Rows[0]["PortfolioID"] + "&LoginID=" + LoginID);

                            if (Session["LastPortPageQueryString"] != null)
                                strLastPortPageQueryString = "&" + Session["LastPortPageQueryString"].ToString();

                            //May 9,2008 Changed by Ying for Additional flag needed in k_Listed_Matched.aspx page
                            if (strHomepage.IndexOf("?") > -1)
                                Response.Redirect(strHomepage + "&PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString() + "&LoginID=" + LoginID + strLastPortPageQueryString);
                            else
                                Response.Redirect(strHomepage + "?PID=" + dtUserInfo.Rows[0]["PortfolioID"].ToString() + "&LoginID=" + LoginID + strLastPortPageQueryString);
                        }
                    }//valid username and password
                    else
                    {
                        //course planner - check if it's a CP school and if direct login message exists, then redirect page
                        strSQL = "SELECT CP_SystemName.LoginGUID FROM Userinfo INNER JOIN CP_SystemName ON Userinfo.CPSystemNameID = CP_SystemName.SystemNameID WHERE     (Userinfo.CoursePlanner = 3 OR Userinfo.CoursePlanner > 6) AND (CP_SystemName.LastImport IS NOT NULL) AND (NOT (CP_SystemName.LoginMessage IS NULL)) AND (Userinfo.SchoolID = " + LoginInfo["SchoolID"].ToString() + ")";
                        DataTable dt = CCLib.Common.DataAccess.GetDataTable(strSQL);
                        if (dt.Rows.Count > 0)
                        {
                            Response.Redirect("/home/CPLogin.aspx?SysG=" + dt.Rows[0]["LoginGUID"].ToString());
                        }

                        strJS = CCLib.Common.Forms.JavaScriptNotify(TextCode(3214));
                    }
                }//user entered something
                else//user entered nothing
                {
                    strJS = CCLib.Common.Forms.JavaScriptNotify(TextCode(3214));

                }//user entered nothing

            }
            else
            {
                if (strLogoff == "t")
                    strJS = CCLib.Common.Forms.JavaScriptNotify("Your session has expired.");
            }
        }