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 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 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); }
public static SkillsResultSet buildSkillsResultSet(string strCountry, JobItem ji, int intSection) { //build Desirable/Essential skills SkillsResultSet ds = new SkillsResultSet(); DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("ASPECT_DETAILS_" + strCountry, "select * from tblaspects" + strCountry); DataRow[] drsAspects = dtAspects.Select("OccNumber=" + ji.JobRef); if (drsAspects.Length > 0) { string strAspectList = ""; switch (intSection) { case 1: strAspectList = drsAspects[0]["EssentialSkills"].ToString(); break; case 2: strAspectList = drsAspects[0]["DesirableSkills"].ToString(); break; }; for (int i = 0; i < strAspectList.Length; i = i + 3) { SkillsResult sr = new SkillsResult(); sr.SkillsRef = Convert.ToInt16(strAspectList.Substring(i, 3).ToString()); ds.Add(sr); }; }; return (ds); }
public static SkillsResultSet buildSkillsResultSet(string strLangCode) { //build all skills SkillsResultSet ds = new SkillsResultSet(); DataTable dtAspects = CCLib.Cache.GetCachedDataTableWithNoExpire("QU_PRIMARY_SKILL_IDS_" + strLangCode, "Select ID from tblskills" + strLangCode + " order by id"); foreach (DataRow rt in dtAspects.Rows) { SkillsResult sr = new SkillsResult(); sr.SkillsRef = Convert.ToInt16(rt["ID"].ToString()); sr.SkillsResponse = -1; ds.Add(sr); }; return (ds); }