コード例 #1
0
ファイル: CCobject.cs プロジェクト: nehawadhwa/ccweb
        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);

            }
        }
コード例 #2
0
ファイル: CCobject.cs プロジェクト: nehawadhwa/ccweb
        public static void getSkillsCategories(String strCountry, JobList jl, SkillsResultSet srs)
        {
            int[] eWeightArray = new int[31];
            int[,] eScoreArray = new int[6,31];
            int[] dWeightArray = new int[31];
            int[,] dScoreArray = new int[6,31];

            initSkillsArrays(ref eWeightArray,ref eScoreArray,ref dWeightArray,ref dScoreArray );
            DataTable dtJobSkills = CCLib.Cache.GetCachedDataTableWithNoExpire("JOBSKILLS_"+strCountry, "Select OccNumber, EssentialSkills,DesirableSkills from tblAspects" + strCountry);
            foreach (JobItem ji in jl)
            {
                int[] arrESkills = {0,0,0,0,0,0};
                int[] arrDSkills = {0,0,0,0,0,0};

                DataRow[] drsJobSkill = dtJobSkills.Select("OccNumber=" + ji.JobRef.ToString());
                //get skills for each job
                if (drsJobSkill.Length >0)
                {
                    //get eskills for the job
                    string strESkills = drsJobSkill[0]["EssentialSkills"].ToString();
                    for (int i=0; i<strESkills.Length; i=i+3)
                    {
                          //for each eskill, retrieve that skill from the answers
                          SkillsResult skillsResult = srs.Find(delegate(SkillsResult sr){return sr.SkillsRef == Convert.ToInt16(strESkills.Substring(i,3));});

                          if (skillsResult != null)
                          { //if we've found it...
                                if((skillsResult.SkillsResponse <=5) & (skillsResult.SkillsResponse>=0))
                                {
                                    arrESkills[skillsResult.SkillsResponse]++;
                                    //add the skill to the results array
                                }
                                else { arrESkills[0]++;}

                          };
                    };

                //get dskills for the job
                    string strDSkills = drsJobSkill[0]["DesirableSkills"].ToString();
                    for (int i=0; i<strDSkills.Length; i=i+3)
                    {
                          //for each eskill, retrieve that skill from the answers
                          SkillsResult skillsResult = srs.Find(delegate(SkillsResult sr){return sr.SkillsRef == Convert.ToInt16(strDSkills.Substring(i,3));});

                          if (skillsResult != null)
                          { //if we've found it...
                                if((skillsResult.SkillsResponse <=5) & (skillsResult.SkillsResponse>=0))
                                {
                                    arrDSkills[skillsResult.SkillsResponse]++;
                                    //add the skill to the results array
                                }
                                else { arrDSkills[0]++;}

                          };
                    }
                    int intEscore = createEDscore(ref arrESkills,ref eScoreArray,ref eWeightArray);
                    int intDscore = createEDscore(ref arrDSkills,ref dScoreArray,ref dWeightArray);
                    if ((intEscore >341) && (intDscore>=75)){ji.SkillsCat = 1;}
                    else if (((intEscore>341) &&  ((0<=intDscore) && (intDscore<=75))) || (((115<=intEscore)&&(intEscore<=341)) && (intDscore>=23))){ji.SkillsCat =2;}
                    else if ((((intEscore>341) && ((-250<=intDscore)&& (intDscore<0)))
                          || (((115<=intEscore) && (intEscore<=341)) && ((-200<= intDscore)&& (intDscore<23))))
                          || (((-950<=intEscore)&&(intEscore<115)) && (intDscore>=-160))) {ji.SkillsCat = 3;}
                    else if ((((intEscore>341)&& ((-350<=intDscore)&&(intDscore<-250)))
                          || (((115<=intEscore)&&(intEscore<=340))&&((-300<=intDscore)&&(intDscore<-200))))
                          || ((((-950<=intEscore)&&(intEscore<115))&&((-250<=intDscore)&&(intDscore<-160)))
                     || (((-1998 <= intEscore) && (intEscore < -950)) && (intDscore >= -200)))) { ji.SkillsCat = 4; }

                        else {ji.SkillsCat= 5;};

                }
            }
            //sort the list by score
            //mrm 31/3/2006 to stop re-ordering bys skill score            jl.Sort(delegate(JobItem x, JobItem y) { return Comparer.Default.Compare(Convert.ToInt64((x.MatchCat * 1000000000) + (x.SkillsCat*10000000)-x.Score), Convert.ToInt64((y.MatchCat * 1000000000) + (y.SkillsCat*10000000)-y.Score)); });
            //prepare rank
            int j = 1;
            foreach (JobItem ji1 in jl)
            {
                ji1.Rank = j;
                j++;
            };
        }
コード例 #3
0
ファイル: CCobject.cs プロジェクト: nehawadhwa/ccweb
        public static SkillsResultSet buildSkillsResultSet(string strLangCode, SkillsResultSet srsAnswered)
        {
            //build all unanswered skills

            SkillsResultSet ds = new SkillsResultSet();
            DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("QU_ALL_SKILL_IDS_" + strLangCode, "Select ID from tblskills" + strLangCode + " order by id");

            foreach (DataRow rt in dtAspects.Rows)
            {

                SkillsResult skillsResult = srsAnswered.Find(delegate(SkillsResult sr)
                                                     {
                                                         return sr.SkillsRef == Convert.ToInt16(rt["ID"].ToString());
                                                     }
                                                     );
                if (skillsResult == null) //if it's not in the list of aspects the client has answered
                {
                    SkillsResult sr = new SkillsResult();
                    sr.SkillsRef = Convert.ToInt16(rt["ID"].ToString());
                    sr.SkillsResponse = -1;
                    ds.Add(sr);
                }
                else if (skillsResult.SkillsResponse < 1)// or it's in the list but it has no response
                {
                    SkillsResult sr = new SkillsResult();
                    sr.SkillsRef = Convert.ToInt16(rt["ID"].ToString());
                    sr.SkillsResponse = -1;
                    ds.Add(sr);
                }

            };
            return (ds);
        }