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 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.º 3
0
 public ClientStorage()
 {
     //
     // TODO: Add constructor logic here
     //
     ClientAspects = null;
     ClientLevels = null;
     ClientHealth = null;
     ClientSkills = null;
     AspectIndicator = 0;
 }
Exemplo n.º 4
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.º 5
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.º 6
0
        public void Retrieve(string LoginId)
        {
            //we use this as a list of results
            if (System.Web.HttpContext.Current.Session["aspectresultset"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("aspectresultset", new AspectResultSet());
            }
            ClientAspects = (System.Web.HttpContext.Current.Session["aspectresultset"] as AspectResultSet);
            //we use this as a list of results
            if (System.Web.HttpContext.Current.Session["skillsresultset"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("skillsresultset", new SkillsResultSet());
            }
            ClientSkills = (System.Web.HttpContext.Current.Session["skillsresultset"] as SkillsResultSet);

            //we use this as a list of results
            if (System.Web.HttpContext.Current.Session["levelresultset"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("levelresultset", new LevelResultSet());
            }
            ClientLevels = System.Web.HttpContext.Current.Session["levelresultset"] as LevelResultSet;

            if (System.Web.HttpContext.Current.Session["healthresultset"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("healthresultset", new HealthResultSet());
            }
            ClientHealth = System.Web.HttpContext.Current.Session["healthresultset"] as HealthResultSet;

            if (System.Web.HttpContext.Current.Session["AspectIndicator"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("AspectIndicator", 0);
            }
            AspectIndicator = Convert.ToInt16(System.Web.HttpContext.Current.Session["AspectIndicator"]);

            if (System.Web.HttpContext.Current.Session["SkillsIndicator"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("SkillsIndicator", 0);
            }
            SkillsIndicator = Convert.ToInt16(System.Web.HttpContext.Current.Session["SkillsIndicator"]);

            if (System.Web.HttpContext.Current.Session["FirstName"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("FirstName", 0);
            }
            FirstName = System.Web.HttpContext.Current.Session["FirstName"] as String;

            if (System.Web.HttpContext.Current.Session["LastName"] == null)
            {
                // it doesn't exist so lets build it....
                System.Web.HttpContext.Current.Session.Add("LastName", 0);
            }
            LastName = System.Web.HttpContext.Current.Session["LastName"] as String;
        }
Exemplo n.º 7
0
 public void New()
 {
     ClientLevels = new LevelResultSet();
     ClientAspects = new AspectResultSet();
     ClientHealth = new HealthResultSet();
     ClientSkills = new SkillsResultSet();
     AspectIndicator = 0;
 }
Exemplo n.º 8
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.º 9
0
        private static void CreateFastClientArrays(AspectResultSet aspectResultSet, LevelResultSet levelResultSet, HealthResultSet healthResultSet, bool [] healthvals, bool[] levelvals, int [] aspectres)
        {
            int i;
            for (i=1;i<=MaxNoOfHealth;i++){ healthvals[i] = false;} //init health array}
            if (healthResultSet!=null)
            {
                if (healthResultSet.Count  > 0)
                {
                    for (i=0; i<healthResultSet.Count;i++)
                    {
                        if (healthResultSet[i].HealthResponse==true)
                        {
                            healthvals[healthResultSet[i].HealthRef] = true;
                        }
                    }
                }
            };

            for (i=1;i<=MaxNoOfLevels;i++){ levelvals[i] = false;} //init level array}
            bool haslevels = false;
            if (levelResultSet!=null)
            {
                if (levelResultSet.Count > 0)
                {
                    for (i=0; i<levelResultSet.Count;i++)
                    {
                        if (levelResultSet[i].LevelResponse==true)
                        {
                            levelvals[levelResultSet[i].LevelRef] = true;
                            haslevels = true;

                        }
                    }
                }

            }
            // JM 01/11/2006 added for Meredith's changes - no levels selected should work the same as all levels selected

            if (haslevels == false) { for (i = 1; i <= MaxNoOfLevels; i++) { levelvals[i] = true; } };

            for (i=1;i<=MaxNoOfAspects;i++){ aspectres[i] = 0;}
            if (aspectResultSet!=null)
            {
                if (aspectResultSet.Count > 0)
                {
                    for (i=0; i<aspectResultSet.Count;i++)
                    {
                       aspectres[aspectResultSet[i].AspectRef] = aspectResultSet[i].AspectResponse ;
                    }
                }
            }
        }
Exemplo n.º 10
0
        public static DataTable createComments(int intJobRef, string strSuffixCode, string strCountry,  AspectResultSet aspectResultSet, HealthResultSet healthResultSet, LevelResultSet levelResultSet, SkillsResultSet skillsResultSet)
        {
            string asComment = "";
            string geComment = "";
               // string htComment = "";
            string lvComment = "";
            string skcomment = "";

            int i,x,cd,sd,od,cdnm,sdnm,slvm,clvm;
            int tmpcat,cscomm,sscomm;
            string strTemp;
            string aspecttblname = strCountry;

            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("MM_ALL_JOBS_" + strSuffixCode, "SELECT tblAspects" + aspecttblname + ".OccNumber, Central, Secondary, ID, Other, Education, EssentialSkills, DesirableSkills, OccName FROM Jobinfo" + strSuffixCode + " INNER JOIN tblAspects" + aspecttblname + " ON Jobinfo" + strSuffixCode + ".OccNumber = tblAspects" + aspecttblname + ".OccNumber order by OccName");
            bool [] levelvals= new bool[MaxNoOfLevels+1];
            bool [] healthvals= new bool[MaxNoOfHealth+1];
            int [] aspectres= new int[MaxNoOfAspects+1] ;
            CreateFastClientArrays(aspectResultSet, levelResultSet, healthResultSet, healthvals, levelvals, aspectres);
            DataRow[] dr = dtAspects.Select("occnumber=" + intJobRef);
            //jm 02/11/2006 - added catch here..
            if (dr.Length > 0)
            {
            DataRow rt = dr[0]; //should probably catch this

            //score job
            JobItem ji = new JobItem();
            ji.Score = ScoreArticle(rt, healthvals, levelvals, aspectres, ref ji.MatchCat, ref ji.MatchMore);
            ji.JobRef = Convert.ToInt16(rt["OccNumber"].ToString());
            ji.JobTitle = rt["OccName"].ToString();

            //prepare general comment
            tmpcat = ji.MatchCat / 100;
            if ((ji.MatchMore) && (tmpcat != 7)) { geComment = geComment + "00"; };
            cscomm = 0;
            sscomm = 0;
            cd = 0;
            cdnm = 0;
            clvm = 0;
            sd = 0;
            sdnm = 0;
            slvm = 0;
            od = 0;
            // check for unanswered core and secondry and store dislikes and LVM counts
            strTemp = rt["Central"].ToString();

            for (i = 0; (i + 1) < strTemp.Length; i = i + 3)
            {
                x = aspectres[Convert.ToInt16(strTemp.Substring(i, 3))];
                switch (x)
                {
                    case 0: cscomm = cscomm + 1; break;
                    case 1: cd = cd + 1; break;
                    case 2: cd = cd + 1; break;
                    case 3: cdnm = cdnm + 1; break;
                    case 5: clvm = clvm + 1; break;
                    case 6: clvm = clvm + 1; break;
                }

            }

            strTemp = rt["Secondary"].ToString();

            for (i = 0; (i + 1) < strTemp.Length; i = i + 3)
            {
                x = aspectres[Convert.ToInt16(strTemp.Substring(i, 3))];
                switch (x)
                {
                    case 0: sscomm = sscomm + 1; break;
                    case 1: sd = sd + 1; break;
                    case 2: sd = sd + 1; break;
                    case 3: sdnm = sdnm + 1; break;
                    case 5: slvm = slvm + 1; break;
                    case 6: slvm = slvm + 1; break;
                }

            }

            strTemp = rt["Other"].ToString();

            for (i = 0; (i + 1) < strTemp.Length; i = i + 3)
            {
                x = aspectres[Convert.ToInt16(strTemp.Substring(i, 3))];
                switch (x)
                {
                    case 1: od = od + 1; break;
                    case 2: od = od + 1; break;
                }

            }

            //if unaswered core or secondry then return appropriate comment
            if (cscomm > 1) { geComment = geComment + "07"; }
            else if (cscomm == 1) { geComment = geComment + "08"; }
            else if (sscomm > 1) { geComment = geComment + "09"; }
            else if (sscomm == 1) { geComment = geComment + "10"; };
            if (!ji.MatchMore)
            {
                switch (tmpcat)
                {
                    case 1: geComment = geComment + "01"; break;
                    case 2: geComment = geComment + "02"; break;
                    case 3: geComment = geComment + "03"; break;
                    case 4: geComment = geComment + "04"; break;
                    case 5: geComment = geComment + "04"; break;
                    case 6: geComment = geComment + "05"; break;
                    case 7: geComment = geComment + "05"; break;
                    case 8: geComment = geComment + "06"; break;
                };
            };

            //end of general comment
            //aspect comment
            asComment = "";
            tmpcat = (ji.MatchCat % 100);
            if (ji.MatchMore)
            {
                asComment = "00";
                // return positive comments
                if (clvm == 1) { asComment = asComment + "10"; };
                if (clvm > 1) { asComment = asComment + "11"; };
                if (slvm == 1) { asComment = asComment + "12"; };
                if (slvm > 1) { asComment = asComment + "13"; };
            }
            else
            {
                switch (tmpcat)
                {
                    case 1: asComment = "01"; break;
                    case 2: asComment = "02"; break;
                    case 3: asComment = "03"; break;
                    case 4: asComment = "04"; break;
                    case 5: asComment = "05"; break;
                }
                //return negative comments
                if (cd > 1) { asComment = asComment + "01"; };
                if (cd == 1) { asComment = asComment + "02"; };
                if (cdnm > 1) { asComment = asComment + "03"; };
                if (cdnm == 1) { asComment = asComment + "04"; };
                if (sd > 1) { asComment = asComment + "05"; };
                if (sd == 1) { asComment = asComment + "06"; };
                if (sdnm > 3) { asComment = asComment + "07"; };
                if (od > 1) { asComment = asComment + "08"; };
                if (od == 1) { asComment = asComment + "09"; };
            };
            //end of aspect comments
            //start of level comments
            lvComment = "";
            int iLvlCount = 0;
            foreach (LevelResult lr in levelResultSet)
            {
                iLvlCount = (lr.LevelResponse == true) ? iLvlCount + 1 : iLvlCount;
            }
            if (iLvlCount == 0) { lvComment = "07"; }//mrm changed to use flags not levelResultSet.Count
            else
            {
                bool accept = true;      //if all levels are selected
                for (i = 1; i <= 5; i++) { if (levelvals[i] == false) { accept = false; };};
                if (accept == true) { lvComment = "06"; }
                else                  //else calc comments
                {
                    //mrm need to look at flags if (levelResultSet.Count > 1) { lvComment = "00"; };
                    if (iLvlCount > 1) { lvComment = "00"; };
                    x = 0;
                    for (i = 1; i <= 5; i++)
                    {

                        if (levelvals[i] == true) { x = i; };
                    }//get highest level
                    switch (rt["Education"].ToString().Substring(x - 1, 1))//mrm 19/4/2006 bug fix - was x
                    {
                        case "+": lvComment = lvComment + "01"; break;
                        case "A": lvComment = lvComment + "02"; break;
                        case "N": lvComment = lvComment + "03"; break;
                        case "B": lvComment = lvComment + "04"; break;
                        case "-": lvComment = lvComment + "05"; break;
                    }

                }
            };
            //end of level comments
            //skills comment

            int e1 = 0;
            int e2 = 0;
            int e3 = 0;
            int e4 = 0;
            int e5 = 0;
            int e0 = 0;
            int d1 = 0;
            int d2 = 0;
            int d3 = 0;
            int d4 = 0;
            int d5 = 0;
            int d0 = 0;
            if (rt["EssentialSkills"].ToString().Length > 0)
            {
                for (i = 0; i < rt["EssentialSkills"].ToString().Length; i = i + 3)
                {
                    SkillsResult skillsResult = skillsResultSet.Find(
                                                          delegate(SkillsResult sr)
                                                          {
                                                              return sr.SkillsRef == Convert.ToInt32(rt["EssentialSkills"].ToString().Substring(i, 3));
                                                          }
                                                          );
                    if (skillsResult != null)
                    {
                        switch (skillsResult.SkillsResponse)
                        {
                            case 0: e0 = e0 + 1; break;
                            case 1: e1 = e1 + 1; break;
                            case 2: e2 = e2 + 1; break;
                            case 3: e3 = e3 + 1; break;
                            case 4: e4 = e4 + 1; break;
                            case 5: e5 = e5 + 1; break;
                            default: e0 = e0 + 1; break;
                        }
                    }
                    else { e0 = e0 + 1; };
                }
            }
            if (rt["DesirableSkills"].ToString().Length > 0)
            {
                for (i = 0; i < rt["DesirableSkills"].ToString().Length; i = i + 3)
                {
                    SkillsResult skillsResult = skillsResultSet.Find(
                                                          delegate(SkillsResult sr)
                                                          {
                                                              return sr.SkillsRef == Convert.ToInt32(rt["DesirableSkills"].ToString().Substring(i, 3));
                                                          }
                                                          );
                    if (skillsResult != null)
                    {
                        switch (skillsResult.SkillsResponse)
                        {
                            case 0: d0 = d0 + 1; break;
                            case 1: d1 = d1 + 1; break;
                            case 2: d2 = d2 + 1; break;
                            case 3: d3 = d3 + 1; break;
                            case 4: d4 = d4 + 1; break;
                            case 5: d5 = d5 + 1; break;
                            default: d0 = d0 + 1; break;
                        }
                    }
                    else { d0 = d0 + 1; };
                }
            }
            // get skills cat
            JobList jl = new JobList();
            jl.Add(ji);
            getSkillsCategories(strCountry, jl, skillsResultSet);

            skcomment = "0" + ji.SkillsCat.ToString() + '0' + ji.SkillsCat.ToString();
            if (e2 == 1) { skcomment = skcomment + "01"; };
            if (e2 == 2) { skcomment = skcomment + "02"; };
            if (e2 == 3) { skcomment = skcomment + "03"; };
            if (e2 >= 4) { skcomment = skcomment + "04"; };
            if (e1 == 1) { skcomment = skcomment + "05"; };
            if (e1 == 2) { skcomment = skcomment + "06"; };
            if (e1 == 3) { skcomment = skcomment + "07"; };
            if (e1 == 4) { skcomment = skcomment + "08"; };
            if (e1 > 4) { skcomment = skcomment + "09"; };
            if (d2 == 1) { skcomment = skcomment + "10"; };
            if (d2 == 2) { skcomment = skcomment + "11"; };
            if (d2 == 3) { skcomment = skcomment + "12"; };
            if (d2 == 4) { skcomment = skcomment + "13"; };
            if (d2 == 5) { skcomment = skcomment + "14"; };
            if (d2 > 5) { skcomment = skcomment + "15"; };
            if (d1 == 1) { skcomment = skcomment + "16"; };
            if (d1 == 2) { skcomment = skcomment + "17"; };
            if (d1 == 3) { skcomment = skcomment + "18"; };
            if (d1 == 4) { skcomment = skcomment + "19"; };
            if (d1 == 5) { skcomment = skcomment + "20"; };
            if (d1 > 5) { skcomment = skcomment + "21"; };

            if (skcomment == "") { skcomment = "00"; };

            //end skills comment
            DataTable dt = new DataTable();
            dt.Columns.Add("General", typeof(string));
            dt.Columns.Add("Aspect", typeof(string));
            dt.Columns.Add("Level", typeof(string));
            dt.Columns.Add("Skill", typeof(string));
            dt.Rows.Add();
            dt.Rows[0]["General"] = geComment;
            dt.Rows[0]["Aspect"] = asComment;
            dt.Rows[0]["Level"] = lvComment;
            dt.Rows[0]["Skill"] = skcomment;
            return (dt);
            }
            else
            {
            //we didn't find the job aspects
            DataTable dt = new DataTable();
            return (dt);

            }
        }
Exemplo n.º 11
0
        public static JobList buildJobList(string strSuffixCode, string strCountry, AspectResultSet aspectResultSet, HealthResultSet healthResultSet, LevelResultSet levelResultSet, string strClusterCode, string strCluster)
        {
            //do a match, but only include those inside a cluster
            JobList jl = new JobList();
            JobItem ji;
            string aspecttblname = strCountry;

            //mrm 15/8/2006 change SQL to exclude Talent jobs
            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("MM_ALL_JOBST_" + strSuffixCode, "SELECT tblAspects" + aspecttblname + ".OccNumber, Central, Secondary, ID, Other, Education, EssentialSkills, DesirableSkills, Talent, OccName FROM Jobinfo" + strSuffixCode + " INNER JOIN tblAspects" + aspecttblname + " ON Jobinfo" + strSuffixCode + ".OccNumber = tblAspects" + aspecttblname + ".OccNumber WHERE (Talent IS NULL) or (Talent=0) ORDER BY OccName");
            bool[] levelvals = new bool[MaxNoOfLevels + 1];
            bool[] healthvals = new bool[MaxNoOfHealth + 1];
            int[] aspectres = new int[MaxNoOfAspects + 1];
            CreateFastClientArrays(aspectResultSet, levelResultSet, healthResultSet, healthvals, levelvals, aspectres);
            //set up arrays for fast matching
            foreach (DataRow rt in dtAspects.Rows)
            {
                ji = new JobItem();
                ji.Score = ScoreArticle(rt, healthvals, levelvals, aspectres, ref ji.MatchCat, ref ji.MatchMore);
                //get job score
                ji.JobRef = Convert.ToInt16(rt["OccNumber"].ToString());
                ji.JobTitle = rt["OccName"].ToString();
                if (((int)ji.MatchCat / 100) < 6)
                {
                    jl.Add(ji);
                };

            };
            //sort the list by score
            jl.Sort(delegate(JobItem x, JobItem y) { return Comparer.Default.Compare(y.Score, x.Score); });
            // we only want the top 40
            if (jl.Count > 40)
            {
                jl.RemoveRange(40, jl.Count - 40);
            };
            //prepare rank
            int i = 1;
            foreach (JobItem ji1 in jl)
            {
                ji1.Rank = i;
                i++;
            };
            //now we check against the clusters table
            //next section is more or less lifted from cluster.aspx
            DataTable dtCluster = CCLib.Cache.GetCachedDataTable("Cluster" + strSuffixCode , "select * from Clusters" + strSuffixCode + "_View");
            DataRow[] drsClusterCodes;
            string strClusterType = strCluster;
            string strSQL=strClusterType+"= '"+strClusterCode.Replace("'","''")+"' or "+strClusterType+" like '"+strClusterCode.Replace("'","''")+",%' or "+strClusterType+" like '%,"+strClusterCode.Replace("'","''")+"' or "+strClusterType+" like '%,"+strClusterCode.Replace("'","''")+",%'";
            drsClusterCodes = dtCluster.Select(strSQL);
            //yuk!! sequential search - need to check for better way
            JobList jlResultList = new JobList();
            JobItem jitmp;
            foreach (DataRow dr in drsClusterCodes)
            {
                int strOccNumber = (int)dr["OccNumber"]; //copy into local variable to keep things quick
                jitmp = jl.Find(delegate(JobItem ji1) { return ji1.JobRef == strOccNumber; });
                if (jitmp!=null) {jlResultList.Add(jitmp);};
            }
            jlResultList.Sort(delegate(JobItem x, JobItem y) { return Comparer.Default.Compare(y.Score, x.Score); });

            return (jlResultList);
        }
Exemplo n.º 12
0
 public static JobList buildJobList(string strSuffixCode, string strCountry, AspectResultSet aspectResultSet, HealthResultSet healthResultSet, LevelResultSet levelResultSet)
 {
     //do a match
     JobList jl = new JobList();
     JobItem ji;
     string aspecttblname=strCountry;
     //mrm 15/8/2006 change SQL to exclude Talent jobs
     DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("MM_ALL_JOBST_" + strSuffixCode, "SELECT tblAspects" + aspecttblname + ".OccNumber, Central, Secondary, ID, Other, Education, EssentialSkills, DesirableSkills, Talent, OccName FROM Jobinfo" + strSuffixCode + " INNER JOIN tblAspects" + aspecttblname + " ON Jobinfo" + strSuffixCode + ".OccNumber = tblAspects" + aspecttblname + ".OccNumber WHERE (Talent IS NULL) or (Talent=0) ORDER BY OccName");
     bool [] levelvals= new bool[MaxNoOfLevels+1];
     bool [] healthvals= new bool[MaxNoOfHealth+1];
     int [] aspectres= new int[MaxNoOfAspects+1] ;
     CreateFastClientArrays(aspectResultSet, levelResultSet, healthResultSet, healthvals, levelvals, aspectres);
     foreach (DataRow rt in dtAspects.Rows)
     {
         ji = new JobItem();
         ji.Score = ScoreArticle(rt,healthvals,levelvals,aspectres,ref ji.MatchCat,ref ji.MatchMore);
         ji.JobRef = Convert.ToInt16(rt["OccNumber"].ToString());
         ji.JobTitle = rt["OccName"].ToString();// +ji.MatchCat.ToString();
         //JM 20/04/2006 don't add jobs where they are a poor match
         if (((int)ji.MatchCat/100)<6)
         {
             jl.Add(ji);
         };
     };
     jl.Sort(delegate (JobItem x, JobItem y){return Comparer.Default.Compare(y.Score,x.Score);});
     // we only want the top 40
     if (jl.Count > 40)
     {
         jl.RemoveRange(40, jl.Count - 40);
     };
     //prepare rank
     int i = 1;
     foreach (JobItem ji1 in jl)
     {
         ji1.Rank = i;
         i++;
     };
     return (jl);
 }
Exemplo n.º 13
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);
        }