Exemplo n.º 1
0
        public static AspectResultSet buildAspectResultSet(string strCountry, JobItem ji, int intSection)
        {
            //build aspects for a job, in a section
            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("ASPECT_DETAILS_" + strCountry, "select * from tblaspects" + strCountry);
            DataRow [] drsAspects = dtAspects.Select("OccNumber=" + ji.JobRef);
            AspectResultSet ars= new AspectResultSet();
            if (drsAspects.Length > 0)
            {
                string strAspectList ="";
                switch (intSection)
                {
                    case 1: strAspectList = drsAspects[0]["Central"].ToString(); break;
                    case 2: strAspectList = drsAspects[0]["Secondary"].ToString(); break;
                    case 3: strAspectList = drsAspects[0]["Other"].ToString(); break;
                };

                for (int i = 0; i < strAspectList.Length; i = i + 3)
                {
                    AspectResult ar = new AspectResult();
                    ar.AspectRef = Convert.ToInt16(strAspectList.Substring(i, 3).ToString());
                    ars.Add(ar);//mrm added
                };

            };
            return (ars);
        }
Exemplo n.º 2
0
        public bool LoadFromDB(string strPassword, string strMMUsername, string strMMPassword, string strFirstname, string strLastname)
        {
            string strSQL = "SELECT  UserID, FirstName, LastName, Passwrd, MMUsername, MMPassword, Ref, Res, Education, Skill FROM tblUsers WHERE (FirstName LIKE '" + strFirstname + "') AND (LastName LIKE '" + strLastname + "') AND (Passwrd LIKE '" + strPassword + "') AND (MMUsername LIKE '" + strMMUsername + "') AND (MMPassword LIKE '" + strMMPassword + "')";
            DataTable dt=CCLib.Common.DataAccess.GetDataTable(strSQL);
            if (dt.Rows.Count > 0)
            {
            FirstName = dt.Rows[0]["firstname"].ToString();
            LastName = dt.Rows[0]["lastname"].ToString();
            //aspects
            string strAspectRef = dt.Rows[0]["Ref"].ToString();
            string strAspectRes = dt.Rows[0]["Res"].ToString();
            ClientAspects = new AspectResultSet();
            for (int i = 0; i<strAspectRes.Length; i++)
            {
                AspectResult ar =new AspectResult();
                ar.AspectRef = Convert.ToInt32(strAspectRef.Substring(i*3,3));
                ar.AspectResponse = Convert.ToInt32(strAspectRes.Substring(i,1));
                ClientAspects.Add(ar);

            }
            string strLevels = dt.Rows[0]["Education"].ToString();
            ClientLevels = new LevelResultSet();
            for (int i = 0; i<strLevels.Length; i=i+3)
            {
                LevelResult lv =new LevelResult();
                lv.LevelRef = Convert.ToInt32(strLevels.Substring(i,3));
                //JM 02/11/2006 changed from lv.LevelRef = Convert.ToInt32(strLevels.Substring(i*3,3));
                lv.LevelResponse = true;
                ClientLevels.Add(lv);
            }
            ClientSkills = new SkillsResultSet();
            string strSkills = dt.Rows[0]["Skill"].ToString();
            for (int i = 1; i<=strSkills.Length; i++)
            {
                SkillsResult sr =new SkillsResult();
                sr.SkillsResponse  = Convert.ToInt32(strSkills.Substring(i-1,1));
                sr.SkillsRef = i;
                ClientSkills.Add(sr);
            }
            //calculate Aspect Indicator
            AspectIndicator =1;
            if (ClientAspects.Count >=39) {AspectIndicator=2;};
            if (ClientAspects.Count >=116) {AspectIndicator=4;};
            if (ClientSkills.Count >= 44) { SkillsIndicator = 1; };

            return (true);
            }
            else
            {
            return (false);
            }
        }
Exemplo n.º 3
0
        public static AspectResultSet buildAspectResultSet(string strLangCode)
        {
            //build primary aspects

            AspectResultSet ds = new AspectResultSet();
            DataTable dtAspects =CCLib.Cache.GetCachedDataTableWithNoExpire("QU_PRIMARY_ASPECT_IDS_" + strLangCode, "Select QuestionID from tblquestions"+ strLangCode+ " where questionid<40 order by questionid");

            foreach (DataRow rt in dtAspects.Rows)
            {
                AspectResult ar = new AspectResult();
                ar.AspectRef = Convert.ToInt16(rt["QuestionID"].ToString());
                ar.AspectResponse = -1;
                ds.Add(ar);
            };
            return (ds);
        }
Exemplo n.º 4
0
 public virtual ActionResult GetActionResult(AspectResult result)
 {
     if (result.ResponseAction == AspectResult.AspectResponseAction.Route)
     {
         return(result.Data == null
                    ? RedirectToRoute(result.Name)
                    : RedirectToRoute(result.Name, result.Data));
     }
     else
     if (result.ResponseAction == AspectResult.AspectResponseAction.Action)
     {
         return(result.Data == null
                    ? RedirectToAction(result.Name)
                    : RedirectToAction(result.Name, result.Data));
     }
     else
     {
         return(result.Name == null
                 ? View(result.Data)
                 : View(result.Name, result.Data));
     }
 }
Exemplo n.º 5
0
        public bool LoadFromPortfolio(string strPortfolioId, int intMMID)
        {
            string strSQL ="";
            strSQL = "SELECT p.FirstName, p.LastName, m.Ref AS MatchMakerRef, m.Res AS MatchMakerRes, m.Education AS MatchMakerEducation, m.Skill AS MatchMakerSkill FROM Portfolio AS p INNER JOIN Port_SavedMatchMaker AS m ON p.PortfolioID = m.PortfolioID WHERE (p.portfolioid=" + strPortfolioId + " and m.SavedMatchMakerID=" + intMMID + ")";
            DataTable dt = CCLib.Common.DataAccess.GetDataTable(strSQL);
            if (dt.Rows.Count > 0)
            {
                FirstName = dt.Rows[0]["firstname"].ToString();
                LastName = dt.Rows[0]["lastname"].ToString();
                //aspects
                string strAspectRef = dt.Rows[0]["MatchMakerRef"].ToString();
                string strAspectRes = dt.Rows[0]["MatchMakerRes"].ToString();
                ClientAspects = new AspectResultSet();
                for (int i = 0; i < strAspectRes.Length; i++)
                {
                    AspectResult ar = new AspectResult();
                    ar.AspectRef = Convert.ToInt32(strAspectRef.Substring(i * 3, 3));
                    ar.AspectResponse = Convert.ToInt32(strAspectRes.Substring(i, 1));
                    ClientAspects.Add(ar);

                }
                string strLevels = dt.Rows[0]["MatchMakerEducation"].ToString();
                ClientLevels = new LevelResultSet();
                for (int i = 0; i < strLevels.Length; i=i+3)
                {
                    LevelResult lv = new LevelResult();
                    lv.LevelRef = Convert.ToInt32(strLevels.Substring(i, 3));
                    lv.LevelResponse = true;
                    ClientLevels.Add(lv);
                }
                ClientSkills = new SkillsResultSet();
                string strSkills = dt.Rows[0]["MatchMakerSkill"].ToString();
                for (int i = 1; i <= strSkills.Length; i++)
                {
                    SkillsResult sr = new SkillsResult();
                    sr.SkillsResponse = Convert.ToInt32(strSkills.Substring(i - 1, 1));
                    sr.SkillsRef = i;
                    ClientSkills.Add(sr);
                }
                //calculate Aspect Indicator
                AspectIndicator = 1;
                if (ClientAspects.Count >= 39) { AspectIndicator = 2; };
                if (ClientAspects.Count >= 116) { AspectIndicator = 4; };
                if (ClientSkills.Count >= 44) { SkillsIndicator = 1; };

                return (true);
            }
            else
            {
                return (false);
            }
        }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
        public static AspectResultSet buildAspectResultSet(string strCountry, JobList jl, AspectResultSet arsAnswered)
        {
            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("ASPECT_DETIALS_" + strCountry, "select * from tblaspects" + strCountry);
            bool[] baInclude = new bool[MaxNoOfAspects];

            foreach (JobItem ji in jl) //go through each job in the list
            {
                DataRow[] drsAspects = dtAspects.Select("OccNumber=" + ji.JobRef);
                if (drsAspects.Length > 0)
                {
                    //make sure we find the job in the aspects table
                    for (int intSection = 1; intSection <= 3; intSection++)//check the core, secondary, other
                    {
                        string strAspectList="";
                        switch (intSection)
                        {
                            case 1: strAspectList = drsAspects[0]["Central"].ToString(); break;
                            case 2: strAspectList = drsAspects[0]["Secondary"].ToString(); break;
                            case 3: strAspectList = drsAspects[0]["Other"].ToString(); break;
                        };
                        //check which aspects they should of answered
                        for (int i = 0; i < strAspectList.Length; i = i + 3)
                        {
                            baInclude[Convert.ToInt16(strAspectList.Substring(i, 3).ToString())] = true;
                            //set a flag for each aspect
                        };
                    };
                };
            };
            AspectResultSet ars = new AspectResultSet();
            for (int i = 1; i < MaxNoOfAspects; i++) // go through our list of flags
            {
                //if the flags say they shold of answered it
                if (baInclude[i] == true)
                {
                    //if the client hasn't already answered them
                    AspectResult aspectResult = arsAnswered.Find(delegate(AspectResult ar)
                                                             {
                                                                 return ar.AspectRef == i;
                                                             }
                                                             );
                    if (aspectResult == null) //if it's not in the list of aspects the client has answered
                    {
                        AspectResult ar = new AspectResult();
                        ar.AspectRef = i;
                        ars.Add(ar);
                    }
                    else if (aspectResult.AspectResponse < 1)// or it's in the list but it has no response
                    {
                        AspectResult ar = new AspectResult();
                        ar.AspectRef = i;
                        ars.Add(ar);
                    }
                };

            };
            return (ars);
        }
Exemplo n.º 8
0
        public static AspectResultSet buildAspectResultSet(string strLangCode, AspectResultSet arsAnswered)
        {
            //build unanswered aspects

            AspectResultSet ds = new AspectResultSet();
            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("QU_ALL_ASPECT_IDS_" + strLangCode, "Select QuestionID from tblquestions" + strLangCode + " order by questionid");

            foreach (DataRow rt in dtAspects.Rows)
            {
                AspectResult aspectResult = arsAnswered.Find(delegate(AspectResult ar)
                                                     {
                                                         return ar.AspectRef == Convert.ToInt16(rt["QuestionID"].ToString());
                                                     }
                                                     );
                if (aspectResult == null) //if it's not in the list of aspects the client has answered
                {
                    AspectResult ar = new AspectResult();
                    ar.AspectRef = Convert.ToInt16(rt["QuestionID"].ToString());

                    ar.AspectResponse = -1;
                    ds.Add(ar);
                }
                else if (aspectResult.AspectResponse < 1)// or it's in the list but it has no response
                {
                    AspectResult ar = new AspectResult();
                    ar.AspectRef = Convert.ToInt16(rt["QuestionID"].ToString());

                    ar.AspectResponse = -1;
                    ds.Add(ar);
                }

            };
            return (ds);
        }