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); }
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); } }
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); }
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); } }
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); }
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); }