Пример #1
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(5357, 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();
            strSubSection = (CCLib.Common.Strings.GetQueryString("SubSection") == "") ? "List" : CCLib.Common.Strings.GetQueryString("SubSection");
            strAP = Request.QueryString["AP"];
            strStOrder = CCLib.Common.Strings.GetQueryString("storder");
            strSt = CCLib.Common.Strings.GetQueryString("st");
            strAction = CCLib.Common.Strings.GetQueryString("action");
            strLbl = CCLib.Common.Strings.GetQueryString("Lbl"); //matchMaker Label
            strYear = CCLib.Common.Strings.GetQueryString("year"); //Archive Year
            strMMID = CCLib.Common.Strings.GetQueryString("MMID");

            SavedMMResults.PortfolioID = PortInfo["PortfolioID"].ToString();
            SavedMMResults.LoginID = LoginID;
            SavedMMResults.MMEduLevel = LoginInfo["MMEduLevel"].ToString().ToLower();
            SavedMMResults.SuffixCode = SuffixCode();
            SavedMMResults.NonEngSuffixCode = NonEngSuffixCode();
            SavedMMResults.JSGenericHrefLink = JSGenericHrefLink;
            SavedMMResults.CountryLanguageSuffixCode = SuffixCountryLanguageCode();
            SavedMMResults.SortColumn = strSt;
            SavedMMResults.SortBy = strStOrder;
            SavedMMResults.CtrlType = "SK";
            SavedMMResults.ArchiveYear = strYear;
            SavedMMResults.ParentID = "";
            SavedMMResults.ArchiveYear = strYear;

            BestMatchResults.PortfolioID = PortInfo["PortfolioID"].ToString();
            BestMatchResults.LoginID = LoginID;
            BestMatchResults.MMEduLevel = LoginInfo["MMEduLevel"].ToString().ToLower();
            BestMatchResults.SuffixCode = SuffixCode();
            BestMatchResults.NonEngSuffixCode = NonEngSuffixCode();
            BestMatchResults.JSGenericHrefLink = JSGenericHrefLink;
            BestMatchResults.CountryLanguageSuffixCode = SuffixCountryLanguageCode();
            BestMatchResults.CtrlType = "SK";
            BestMatchResults.ParentID = "";
            BestMatchResults.ArchiveYear = strYear;

            ((CareerCruisingWeb.PageBase.IndividualBase)Page).DatabaseName = CareerCruisingWeb.CCLib.Common.Strings.GetDatabaseName();

            if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
            {
                strSavedMatchMakerID = CCLib.Common.Strings.GetFormString("SavedMatchMakerID");

                if (strAction == "archive")
                {
                    BestMatchResults.MMID = strSavedMatchMakerID;
                }
            }

            if (strAction == "new")
            {
                CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                clientStorage.ClearSession();
                if (clientStorage.LoadFromPortfolio(LoginInfo["PID"].ToString(), Convert.ToInt32(strSavedMatchMakerID)))
                    clientStorage.Save(LoginID);
                Response.Redirect("/MatchMaker/k_skills_intro.aspx?LoginID=" + LoginID + "&MMID=" + strMMID);
                //if (!ClientScript.IsOnSubmitStatementRegistered("Submit"))
                //{
                //    ClientScript.RegisterOnSubmitStatement(Page.GetType(), "Submit", "showLyr('appendReviewDiv');document.reviewrevise.TargetPage.value='/MatchMaker/k_skills_intro.aspx?LoginID=" + LoginID + "&MMID=" + strSavedMatchMakerID + "';location.hash = 'page_top'; void 0;"); //"CareerCruisingWeb.CCLib.Common.Strings.GenerateHrefString("/MatchMaker/k_list_matched.aspx?LoginID="+LoginID+"&BM=1", JSGenericHrefLink)%>");
                //}
            }

            dtMatchMaker = CCLib.Common.DataAccess.GetDataTable("select SavedMatchMakerID,OccNumbers,Ref,Res,Education,Cluster,Skill,SkillRank,Convert(varchar(10),UpdateDate,101) UpdateDate,APMatch,APNotMatch,Label,BestMatch from " + ((CareerCruisingWeb.PageBase.IndividualBase)Page).DatabaseName + "Port_SavedMatchMaker where PortfolioID=" + PortInfo["PortfolioID"].ToString());
            for (int i = 0; i < dtMatchMaker.Rows.Count; i++)
            {
                if (dtMatchMaker.Rows[i]["Skill"].ToString() != "")
                    blHasSkills = true;
            }
            drBM = dtMatchMaker.Select("BestMatch=1");
            if (drBM.Length > 0)
            {
                strSavedMatchMakerID = drBM[0]["SavedMatchMakerID"].ToString();
                strMMLabel = drBM[0]["Label"].ToString();
                if (drBM[0]["OccNumbers"].ToString() != "")
                {
                    bBMNoSkills = (drBM[0]["SkillRank"].ToString() != "") ? false : true;
                }
            }

            #endregion Initialize Values and Form Execution

            #region Properties For The Individual Base Class
            SetCustomJS();
            AddArchiveButton = true;
            PortTitle = GetPortText(5372, false);
            SetTitleBar();
            SetLeftButtons();
            //LeftButtons = LeftButtons + ((Convert.ToBoolean(PortTypeElements["Mnu_LeftButtonImage"])) ? "<script>subMenu(2,'img16');</script>" : "");
            PortSubTitle = TextCode(8799);
            SetSubTitleBar();
            SetFooter();
            #endregion Properties For The Individual Base Class
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //before save, put into login session
            if (Session["ptreturnurl"] == null)
            {
                //get values from form post
                if (Request.ServerVariables["REQUEST_METHOD"] == "POST")
                {
                    Session["ptreturnurl"] = CCLib.Common.Strings.GetFormString("ptreturnurl");
                    Session["ptsavename"] = CCLib.Common.Strings.GetFormString("ptsavename");
                    Session["ptsavevalue"] = CCLib.Common.Strings.GetFormString("ptsavevalue");
                    Session["SchoolCountry"] = (CCLib.Common.Strings.GetFormString("SchoolCountry") == "US") ? "1" : "2";
                    Session["SchoolType"] = CCLib.Common.Strings.GetFormString("SchoolType");
                    //three values for MatchMaker
                    Session["MatchMakerRef"] = CCLib.Common.Strings.GetFormString("MatchMakerRef");
                    Session["MatchMakerRes"] = CCLib.Common.Strings.GetFormString("MatchMakerRes");
                    Session["MatchMakerEducation"] = CCLib.Common.Strings.GetFormString("MatchMakerEducation");
                    Session["MatchMakerSkill"] = CCLib.Common.Strings.GetFormString("MatchMakerSkill");
                    Session["MatchMakerSkillRank"] = CCLib.Common.Strings.GetFormString("MatchMakerSkillRank");
                    Session["MatchMakerLabel"] = CCLib.Common.Strings.GetFormString("MatchMakerLabel");
                    //one value for Michigan Pathway
                    Session["Pathway"] = CCLib.Common.Strings.GetFormString("Pathway");
                }
                else//get value from query string
                {
                    Session["ptreturnurl"] = CCLib.Common.Strings.GetQueryString("ptreturnurl");
                    Session["ptsavename"] = CCLib.Common.Strings.GetQueryString("ptsavename");
                    Session["ptsavevalue"] = CCLib.Common.Strings.GetQueryString("ptsavevalue");
                    Session["SchoolCountry"] = (CCLib.Common.Strings.GetQueryString("SchoolCountry") == "US") ? "1" : "2";
                    Session["SchoolType"] = CCLib.Common.Strings.GetQueryString("SchoolType");
                    //three values for MatchMaker
                    Session["MatchMakerRef"] = CCLib.Common.Strings.GetQueryString("MatchMakerRef");
                    Session["MatchMakerRes"] = CCLib.Common.Strings.GetQueryString("MatchMakerRes");
                    Session["MatchMakerEducation"] = CCLib.Common.Strings.GetQueryString("MatchMakerEducation");
                    Session["MatchMakerSkill"] = CCLib.Common.Strings.GetQueryString("MatchMakerSkill");
                    Session["MatchMakerSkillRank"] = CCLib.Common.Strings.GetQueryString("MatchMakerSkillRank");
                    Session["MatchMakerLabel"] = CCLib.Common.Strings.GetQueryString("MatchMakerLabel");
                    //one value for Michigan Pathway
                    Session["Pathway"] = CCLib.Common.Strings.GetQueryString("Pathway");
                }
            }//before save, put into login session

            #region Properties For The Base Class and Check Login
            LoginID = Request.QueryString["LoginID"];
            LoginInfo = CCLib.Login.GetLoginInfo(LoginID);
            Redirect();
            PageTitle = PortfolioName + " Homepage";
            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='/media/student_parent/shared/h_h_main.gif' alt='' width=141>";
            #endregion Properties For The Base Class and Check Login

            //check session
            CheckPortSession();

            //Response.Write("Out");
            if (Session["ptreturnurl"] != null)//return url not null
            {
                //Response.Write("In");
                //not for ILP Parent
                if (LoginInfo["ParentID"].ToString() == "")
                {
                    //save to db
                    //insert into Port_SavedCareers table
                    if (Session["ptsavename"].ToString() == "Career")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select OccNumber from Port_SavedCareers where PortfolioID=" + LoginInfo["PID"].ToString() + " and OccNumber=" + Session["ptsavevalue"].ToString()).ToString() == "")
                        {
                            strSQL = "insert into Port_SavedCareers (OccNumber,PortfolioID) values(" + Session["ptsavevalue"].ToString() + "," + LoginInfo["PID"].ToString() + ")";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("Career");
                            //Response.Redirect(Session["ptreturnurl"].ToString() + "&LoginID=" + LoginID);
                        }
                    }
                    //insert into Port_SavedCompanies table
                    else if (Session["ptsavename"].ToString() == "ConnectCompany")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select CompanyID from Port_SavedCompanies where PortfolioID=" + LoginInfo["PID"].ToString() + " and CompanyID=" + Session["ptsavevalue"].ToString()).ToString() == "")
                        {
                            strSQL = "insert into Port_SavedCompanies (CompanyID,PortfolioID) values(" + Session["ptsavevalue"].ToString() + "," + LoginInfo["PID"].ToString() + ")";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("NetSavedComp");
                        }
                    }
                    //insert into Port_SavedSchools table
                    else if (Session["ptsavename"].ToString() == "School")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select SchoolID from Port_SavedSchools where PortfolioID=" + LoginInfo["PID"].ToString() + " and CountryID=" + Session["SchoolCountry"].ToString() + " and SchoolID='" + Session["ptsavevalue"].ToString().Replace("'", "''") + "'").ToString() == "")
                        {
                            if (Session["SchoolType"].ToString() != "")
                                strSQL = "insert into Port_SavedSchools (CountryID,SchoolID,UX_VX, PortfolioID) values(" + Session["SchoolCountry"].ToString() + ",'" + Session["ptsavevalue"].ToString().Replace("'", "''") + "','" + Session["SchoolType"].ToString().Replace("'", "''") + "'," + LoginInfo["PID"].ToString() + ")";
                            else
                                strSQL = "insert into Port_SavedSchools (CountryID,SchoolID,PortfolioID) values(" + Session["SchoolCountry"].ToString() + ",'" + Session["ptsavevalue"].ToString().Replace("'", "''") + "'," + LoginInfo["PID"].ToString() + ")";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("School");

                        }
                    }
                    //insert into Port_SavedMatchMakers table
                    else if (Session["ptsavename"].ToString() == "MatchMaker")
                    {
                        //for now, no duplicates
                        string strBM = ""; //flag of best match
                        int intID = 0;
                        string strMMNumbers = CCLib.Common.DataAccess.GetValue("select count(SavedMatchMakerID) from Port_SavedMatchMaker where PortfolioID=" + LoginInfo["PID"].ToString()).ToString();
                        strBM = (strMMNumbers != "0") ? "0" : "1";

                        if (Session["MMID"] == null || Session["MMID"].ToString() == "")
                        {
                            if (strMMNumbers != "0")
                            {
                                strSQL = "insert into Port_SavedMatchMaker (PortfolioID,OccNumbers,Ref,Res,Education,Cluster,Skill,SkillRank,BestMatch,Label,DateCreated) values(" + LoginInfo["PID"].ToString() + ",'" + Session["ptsavevalue"].ToString().Replace("'", "''") + "','" + Session["MatchMakerRef"].ToString().Replace("'", "''") + "','" + Session["MatchMakerRes"].ToString().Replace("'", "''") + "','" + Session["MatchMakerEducation"].ToString().Replace("'", "''") + "','" + Session["Pathway"].ToString().Replace("'", "''") + "','" + Session["MatchMakerSkill"].ToString().Replace("'", "''") + "','" + Session["MatchMakerSkillRank"].ToString().Replace("'", "''") + "',0,'" + CCLib.Common.Strings.FormatUserInput(Session["MatchMakerLabel"].ToString().Replace("'", "''")) + "',GETDATE())";
                                //strSQL = "update Port_SavedMatchMaker set OccNumbers='" + Session["ptsavevalue"].ToString().Replace("'", "''") + "',Ref='" + Session["MatchMakerRef"].ToString().Replace("'", "''") + "',Res='" + Session["MatchMakerRes"].ToString().Replace("'", "''") + "',Education='" + Session["MatchMakerEducation"].ToString().Replace("'", "''") + "',Cluster='" + Session["Pathway"].ToString().Replace("'", "''") + "',Skill='" + Session["MatchMakerSkill"].ToString().Replace("'", "''") + "',SkillRank='" + Session["MatchMakerSkillRank"].ToString().Replace("'", "''") + "', UpdateDate = getdate() where PortfolioID= " + LoginInfo["PID"].ToString();
                                strBM = "0";
                            }
                            else
                            {
                                strSQL = "insert into Port_SavedMatchMaker (PortfolioID,OccNumbers,Ref,Res,Education,Cluster,Skill,SkillRank,BestMatch,Label,DateCreated) values(" + LoginInfo["PID"].ToString() + ",'" + Session["ptsavevalue"].ToString().Replace("'", "''") + "','" + Session["MatchMakerRef"].ToString().Replace("'", "''") + "','" + Session["MatchMakerRes"].ToString().Replace("'", "''") + "','" + Session["MatchMakerEducation"].ToString().Replace("'", "''") + "','" + Session["Pathway"].ToString().Replace("'", "''") + "','" + Session["MatchMakerSkill"].ToString().Replace("'", "''") + "','" + Session["MatchMakerSkillRank"].ToString().Replace("'", "''") + "',1,'" + CCLib.Common.Strings.FormatUserInput(Session["MatchMakerLabel"].ToString().Replace("'", "''")) + "',GETDATE())";
                                strBM = "1";
                            }
                            intID = CCLib.Common.DataAccess.ExecuteDbWithIntResult(strSQL + "; select SCOPE_IDENTITY();");
                        }
                        else
                        {
                            string strBestMatch = CCLib.Common.DataAccess.GetValue("select count(SavedMatchMakerID) from Port_SavedMatchMaker where BestMatch=1 and SavedMatchMakerID = " + Session["MMID"].ToString()).ToString();
                            strBM = (strBestMatch == "1") ? "1" : "0";

                            strSQL = "update Port_SavedMatchMaker set OccNumbers = '" + Session["ptsavevalue"].ToString().Replace("'", "''") + "',Ref = '" + Session["MatchMakerRef"].ToString().Replace("'", "''") + "',Res='" + Session["MatchMakerRes"].ToString().Replace("'", "''") + "',Education='" + Session["MatchMakerEducation"].ToString().Replace("'", "''") + "',Cluster='" + Session["Pathway"].ToString().Replace("'", "''") + "',Skill='" + Session["MatchMakerSkill"].ToString().Replace("'", "''") + "',SkillRank='" + Session["MatchMakerSkillRank"].ToString().Replace("'", "''") + "',UpdateDate=GETDATE() where SavedMatchMakerID = " + Session["MMID"].ToString();
                            CCLib.Common.DataAccess.ExecuteNonQuery(strSQL);
                            intID = Convert.ToInt32(Session["MMID"]);
                        }
                        Session["ptreturnurl"] = Session["ptreturnurl"] + "MMID=" + intID.ToString() + "&BM=" + strBM + "&";
                        UpdatePCSStatusFromSection("MatchMaker");
                        //matchmaker session initialization
                        CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                        if (clientStorage.LoadFromPortfolio(PortInfo["PortfolioID"].ToString(), intID))
                        {
                            //it's worked so save it back to the session state
                            clientStorage.Save(LoginID);
                        }
                    }
                    else if (Session["ptsavename"].ToString() == "careermessageboard")
                    {
                        if (PortInfo["AllowMsgBrdPosts"].ToString() != "True")
                            Response.Write(CCLib.Common.Forms.JavaScriptNotify("You do not have permission to post to the message boards."));
                        else
                        {
                            if (Session["ptreturnurl"].ToString().Contains("/Careers/"))
                                UpdatePCSStatusFromSection("NetCoachBoards");
                            else if (Session["ptreturnurl"].ToString().Contains("/Connect/"))
                                UpdatePCSStatusFromSection("NetCompBoards");
                        }
                        //    Response.Redirect(Session["ptreturnurl"].ToString() + "&LoginID=" + LoginID);
                    }

                    else if (Session["ptsavename"].ToString() == "Military")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select OccNumber from Port_SavedCareers where PortfolioID=" + LoginInfo["PID"].ToString() + " and OccNumber=" + Session["ptsavevalue"].ToString() + "AND IsMilitary = 'true'").ToString() == "")
                        {
                            strSQL = "insert into Port_SavedCareers (OccNumber,PortfolioID, IsMilitary) values(" + Session["ptsavevalue"].ToString() + "," + LoginInfo["PID"].ToString() + ", 'true')";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("Career");
                        }
                    }

                    else if (Session["ptsavename"].ToString() == "CompareSchools")
                    {
                        //Response.Redirect(Session["ptreturnurl"].ToString() + "&LoginID=" + LoginID);
                    }

                    //insert into or update Port_Selector table
                    else if (Session["ptsavename"].ToString() == "CareerSelector" || Session["ptsavename"].ToString() == "UGSchoolSelector" || Session["ptsavename"].ToString() == "CTSchoolSelector" || Session["ptsavename"].ToString() == "GRSchoolSelector" || Session["ptsavename"].ToString() == "FASelector")
                    {
                        string strSelectorType = Session["ptsavename"].ToString().Replace("Selector", "");
                        //for now, no duplicates
                        if (CCLib.Common.DataAccess.GetValue("select SelectorID from Port_Selector where PortfolioID=" + LoginInfo["PID"].ToString() + " and SelectorType='" + strSelectorType + "'").ToString() == "")
                            strSQL = "insert into Port_Selector (SelectorType,SelectorCriteria,PortfolioID) values('" + strSelectorType + "','" + Session["ptsavevalue"].ToString().Replace("'", "''") + "'," + LoginInfo["PID"].ToString() + ")";
                        else
                            strSQL = "update Port_Selector set SelectorCriteria='" + Session["ptsavevalue"].ToString().Replace("'", "''") + "', CreateTime='" + DateTime.Now + "' where SelectorType= '" + strSelectorType + "' and PortfolioID= " + LoginInfo["PID"].ToString();
                        CCLib.Common.DataAccess.ExecuteDb(strSQL);
                        if (Session["ptsavename"].ToString() == "CareerSelector")
                            UpdatePCSStatusFromSection("CareerSelector");
                        else if (Session["ptsavename"].ToString() == "UGSchoolSelector" || Session["ptsavename"].ToString() == "CTSchoolSelector" || Session["ptsavename"].ToString() == "GRSchoolSelector")
                            UpdatePCSStatusFromSection("SchoolSelector");
                        else if (Session["ptsavename"].ToString() == "FASelector")
                            UpdatePCSStatusFromSection("FinancialAidSelector");
                    }

                    else if (Session["ptsavename"].ToString() == "Apprenticeship")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select AppNum from Port_SavedApprenticeships where PortfolioID = " + LoginInfo["PID"].ToString() + " and AppNum = '" + Session["ptsavevalue"] + "'").ToString() == "")
                        {
                            strSQL = "insert into Port_SavedApprenticeships(PortfolioID, AppNum) values('" + LoginInfo["PID"].ToString() + "', '" + Session["ptsavevalue"].ToString() + "')";
                            strSQL += "; UPDATE CP_Student SET ProgramEligibilityUpdate = 1 WHERE PortfolioID = '" + LoginInfo["PID"].ToString() + "'";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("Apprenticeship");
                            strAjaxCPReturnValue = "1"; //added
                        }
                        else if (CCLib.Common.Strings.GetQueryString("ProgramFilterAjax") != "")
                        {
                            strSQL = "delete FROM Port_SavedApprenticeships where PortfolioID = " + LoginInfo["PID"].ToString() + " and AppNum = '" + Session["ptsavevalue"].ToString() + "'";
                            strSQL += "; UPDATE CP_Student SET ProgramEligibilityUpdate = 1 WHERE PortfolioID = '" + LoginInfo["PID"].ToString() + "'";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            strAjaxCPReturnValue = "0"; //removed
                        }
                        if (CCLib.Common.Strings.GetQueryString("ProgramFilterAjax") != "")
                        {
                            Response.Write(strAjaxCPReturnValue);
                            Session["ptreturnurl"] = null;
                            Response.End();
                        }
                    }

                    else if (Session["ptsavename"].ToString() == "Program")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select ProgramID from Port_SavedPrograms where PortfolioID = " + LoginInfo["PID"].ToString() + " and ProgramID = '" + Session["ptsavevalue"] + "'").ToString() == "")
                        {
                            strSQL = "insert into Port_SavedPrograms(PortfolioID, ProgramID) values('" + LoginInfo["PID"].ToString() + "', '" + Session["ptsavevalue"].ToString() + "')";
                            strSQL += "; UPDATE CP_Student SET ProgramEligibilityUpdate = 1 WHERE PortfolioID = '" + LoginInfo["PID"].ToString() + "'";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            UpdatePCSStatusFromSection("Programs");
                            strAjaxCPReturnValue = "1"; //added
                        }
                        else if (CCLib.Common.Strings.GetQueryString("ProgramFilterAjax") != "")
                        {
                            strSQL = "delete FROM Port_SavedPrograms where PortfolioID = " + LoginInfo["PID"].ToString() + " and ProgramID = '" + Session["ptsavevalue"].ToString() + "'";
                            strSQL += "; UPDATE CP_Student SET ProgramEligibilityUpdate = 1 WHERE PortfolioID = '" + LoginInfo["PID"].ToString() + "'";

                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                            strAjaxCPReturnValue = "0"; //removed
                        }
                        if (CCLib.Common.Strings.GetQueryString("ProgramFilterAjax") != "")
                        {
                            Response.Write(strAjaxCPReturnValue);
                            Session["ptreturnurl"] = null;
                            Response.End();
                        }
                    }

                    else if (Session["ptsavename"].ToString() == "Scholarship")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select ScholarshipID from Port_SavedScholarships where PortfolioID = " + LoginInfo["PID"].ToString() + " and ScholarshipID = '" + Session["ptsavevalue"] + "'").ToString() == "")
                        {
                            strSQL = "insert into Port_SavedScholarships(PortfolioID, ScholarshipID) values('" + LoginInfo["PID"].ToString() + "', '" + Session["ptsavevalue"].ToString() + "')";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                        }
                    }

                    else if (Session["ptsavename"].ToString() == "LearningStyle" && Session["LS_Answers"] != null)
                    {
                        if (CCLib.Common.DataAccess.GetValue("select LrnStyleID from Port_SavedLrnStyles where PortfolioID = " + LoginInfo["PID"].ToString()).ToString() == "")
                            strSQL = "insert into Port_SavedLrnStyles(PortfolioID, LrnStyleID, DateSaved, LrnStyleAnswers, VisualPercent, AuditoryPercent, TactilePercent) values ('" + LoginInfo["PID"].ToString() + "', '" + Session["LS_ID"].ToString() + "', '" + DateTime.Now + "', '" + Session["LS_Answers"].ToString() + "', '" + Session["VisualPercent"].ToString() + "', '" + Session["AuditoryPercent"].ToString() + "', '" + Session["TactilePercent"].ToString() + "')";
                        else
                            strSQL = "update Port_SavedLrnStyles set LrnStyleID = " + Session["LS_ID"].ToString() + ", DateSaved = '" + DateTime.Now + "', LrnStyleAnswers = '" + Session["LS_Answers"].ToString() + "', VisualPercent = '" + Session["VisualPercent"].ToString() + "', AuditoryPercent = '" + Session["AuditoryPercent"].ToString() + "', TactilePercent = '" + Session["TactilePercent"].ToString() + "' where PortfolioID = '" + LoginInfo["PID"].ToString() + "'";
                        CCLib.Common.DataAccess.ExecuteDb(strSQL);
                        UpdatePCSStatusFromSection("LrnStyle");
                    }

                    else if (Session["ptsavename"].ToString() == "Major")
                    {
                        if (CCLib.Common.DataAccess.GetValue("select SavedMajorID from Port_SavedMajors where PortfolioID = " + LoginInfo["PID"].ToString() + " and CIP_Code = '" + Session["ptsavevalue"] + "'").ToString() == "")
                        {
                            strSQL = "insert into Port_SavedMajors(PortfolioID, CIP_CODE) values('" + LoginInfo["PID"].ToString() + "', '" + Session["ptsavevalue"].ToString() + "')";
                            CCLib.Common.DataAccess.ExecuteDb(strSQL);
                        }
                    }
                    //save to db
                }//not for ILP Parent
                else
                    Session["ptreturnurl"] = "/ILPParent/Home.aspx?";//ILP Parent goes to home page

                //clear login session
                strPTReturnURL = Session["ptreturnurl"].ToString() + "LoginID=" + LoginID;

                if (LoginInfo["ParentID"].ToString() == "" && ScriptName.ToLower().IndexOf("individual/") > -1)
                {
                    string strAgreement = CCLib.Common.DataAccess.GetValue("select Agreement from Portfolio where PortfolioID=" + PortInfo["PortfolioID"].ToString()).ToString();
                    if (strAgreement != "True")
                    {
                        strPTReturnURL = "/Individual/Agreement.aspx?LoginID=" + LoginID;//ILP Parent goes to home page
                        Session["ptAgreement"] = Session["ptreturnurl"];
                    }
                }
                Session["ptreturnurl"] = null;
                Session["ptsavename"] = null;
                Session["ptsavevalue"] = null;
                Session["SchoolCountry"] = null;
                Session["SchoolType"] = null;
                //three values for MatchMaker
                Session["MatchMakerRef"] = null;
                Session["MatchMakerRes"] = null;
                Session["MatchMakerEducation"] = null;
                Session["MatchMakerSkill"] = null;
                Session["MatchMakerSkillRank"] = null;
                //one value for Michigan Pathway
                Session["Pathway"] = null;

                //redirect to save result page
                Response.Redirect(strPTReturnURL + "&pt=1");

            }//return url not null
        }
Пример #3
0
        //used to check user session and log out user
        public void CheckPortSession()
        {
            string strPortTypeFolder = (PortTypeID == "4") ? "SD" : PortType;
            LoginPage = (PortTypeSettings["HasCustomLogin"].ToString() == "True") ? "/" + strPortTypeFolder + "/Default.aspx" : "/Individual/Default.aspx";
            UserLanguage = GetUserLanguage();
            //first time access, check if it is valid login (has to be withing one minute of login to avoid url copying/pasting)
            if (CCLib.Common.Strings.GetQueryString("PID") != "" && CCLib.Common.Strings.GetQueryString("PID") == LoginInfo["PID"].ToString() && DateTime.Compare(DateTime.Now.AddDays(1), ((DateTime)(LoginInfo["ExpiredTime"])).AddMinutes(1)) < 0)
            {
                //Re-initialize Portfolio Session due to the scenarios like load balancing redirection
                //if (Session["PortInfo"] == null)
                //{
                //    CCLib.Login.PortLoginInitSession(PortTypeID, PortType, LoginInfo["PID"].ToString(), SchoolID);
                //}

                //SD user's should be redirected to the main page upon login to home page
                if (PortTypeID == "4" && ScriptName.ToLower() == "/individual/home.aspx")
                {
                    if (Session["PortInfo"] != null)
                    {
                        DataRow drwPortInfo = (DataRow)Session["PortInfo"];
                        //matchmaker session initialization
                        CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                        if (clientStorage.LoadFromPortfolio(drwPortInfo["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();
                        }
                        if (drwPortInfo["Agreement"].ToString() == "True")
                            Response.Redirect("/Main/Index.aspx?LoginID=" + LoginID);
                        else
                            Response.Redirect("/Individual/Agreement.aspx?LoginID=" + LoginID);
                    }
                }
            }
            else if (CCLib.Common.Strings.GetQueryString("PID") == "" && LoginInfo["PID"].ToString() == "")//school port login, reset login session for portfolio login page
            {
                CCLib.Login.ExpireUserLoginSession();
            }

            if (Session["PortInfo"] != null)
            {
                PortInfo = (DataRow)Session["PortInfo"];
                if (Convert.ToInt16(PortInfo["GradeNumber"]) < 5)
                    PortInfo["GradeNumber"] = 5;
                else if (Convert.ToInt16(PortInfo["GradeNumber"]) > 13)
                    PortInfo["GradeNumber"] = 13;

                if (PortTypeID != "5")
                    AppSettings = CCLib.Login.GetAppSettings(PortInfo["SchoolID"].ToString());

                //PortSettings = (DataRow)Session["PortSettings"];
                //PortTypeSettings = (DataRow)Session["PortTypeSettings"];
                PortTypeElements = GetPortTypeElements(ToolTypeID);

                #region set menu grade

                if (Convert.ToInt16(PortInfo["GradeNumber"]) <= 13 && Convert.ToInt16(PortInfo["GradeNumber"]) > 4)
                    MenuGrade = PortInfo["GradeNumber"].ToString();
                else if (Convert.ToInt16(PortInfo["GradeNumber"]) > 13)
                    MenuGrade = "13";
                else
                    MenuGrade = "5";

                #endregion set menu grade

                GetPCSCriteria();

                if (Session["PCSStatus"] != null)
                {
                    PCSStatus = (DataRow)Session["PCSStatus"];
                }

                //first time access or session is not initialized, generate PCS session variable
                if (CCLib.Common.Strings.GetQueryString("PID") == LoginInfo["PID"].ToString() || Session["PCSStatus"] == null)
                    GetPCSStatus();

                //check AltComp flag, if so, update PCSStatus["AltComp"]
                if (Convert.ToInt16(PortTypeElements["PCS_AltComp_View"]) == 1 && IsAltComp(PortInfo["PortfolioID"].ToString()) && PCSStatus != null)
                    PCSStatus["AltComp"] = true;

                //customized code for ILP below, need to be changed later
                SetPCSDescription();

                //Get Port SectionID based on page name
                GetPortSectionID();

                //course planning flag
                if (LoginInfo["CoursePlanner"].ToString() != "" && (PortInfo["Active"].ToString() == "True" || PortInfo["CP_Demo"].ToString() == "1" || PortInfo["CP_Demo"].ToString() == "2"))
                {
                    CPCoursePlanner = LoginInfo["CoursePlanner"].ToString();
                    isCEP = Convert.ToBoolean(LoginInfo["isCEP"]);
                }

                //matchmaker session initialization
                CCLib.MatchingObject.ClientStorage clientStorage = new CCLib.MatchingObject.ClientStorage();
                if (clientStorage.LoadFromPortfolio(PortInfo["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();
                }
            }
            else
            {
                Session["LastPortPage"] = ScriptName;//used to remember the last Port page when re-login
                Session["LastPortPageQueryString"] = CCLib.Common.Strings.TrimQueryString(CCLib.Common.Strings.TrimQueryString(Request.QueryString.ToString(), "LoginID=" + LoginID), "PID=" + LoginInfo["PID"].ToString());//used to remember the last Port page's querystring (excluding LoginID and PID) when re-login

                string strLanguagePar = (UserLanguage == "") ? "" : "&Language=" + UserLanguage;
                Response.Redirect(LoginPage + "?LoginID=" + LoginID + strLanguagePar);//user clicked portfolio button outside portfoio, either from top nav bar or from the main home page
            }
        }