public List<Ranking> selectAllRanking() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(Ranking), "dbo.SelectAllRanking").Cast<Ranking>().ToList(); } catch (Exception ex) { return null; } }
public List<Education> selectAllEducation() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(Education), "dbo.SelectAllEducation").Cast<Education>().ToList(); } catch (Exception ex) { return null; } }
public List<Income> selectAllIncome() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(Income), "dbo.SelectAllIncome").Cast<Income>().ToList(); } catch (Exception ex) { return null; } }
public List<Category> selectAllCategory() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(Category), "dbo.SelectAllCategory").Cast<Category>().ToList(); } catch (Exception ex) { return null; } }
public List<RecruiteeSkillDto> selectAllRecruiteeSkill() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(RecruiteeSkillDto), "dbo.SelectAllRecruiteeSkill").Cast<RecruiteeSkillDto>().ToList(); } catch (Exception ex) { return null; } }
public Boolean insertIncome(Income obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { db.Incomes.Add(obj); db.SaveChanges(); return true; } catch (Exception ex) { return false; } } }
public Boolean addSkillToRecruitee(Recruitee obj, String skillId) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Recruitee recruitee = db.Recruitees.SqlQuery("dbo.SelectRecruiteeById @RecruiteeId='" + obj.RecruiteeId.ToString() + "'").Single(); Skill skillAdd = db.Skills.SqlQuery("dbo.SelectSkillById @SkillId='" + skillId + "'").Single(); if (recruitee != null) { if (skillAdd != null) { recruitee.Skills.Add(skillAdd); } #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean deleteSkill(Skill obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Skill skill = db.Skills.SqlQuery("dbo.SelectSkillById @SkillId='" + obj.SkillId.ToString() + "'").Single(); if (skill != null) { db.Skills.Remove(skill); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean deleteRanking(Ranking obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Ranking ranking = db.Rankings.SqlQuery("dbo.SelectRankingById @RankingId='" + obj.RankingId.ToString() + "'").Single(); if (ranking != null) { db.Rankings.Remove(ranking); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean deleteEducation(Education obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Education edu = db.Educations.SqlQuery("dbo.SelectEducationById @EducationId='" + obj.EducationId.ToString() + "'").Single(); if (edu != null) { db.Educations.Remove(edu); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean deleteCategory(Category obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Category category = db.Categories.SqlQuery("dbo.SelectCategoryById @CategoryId='" + obj.CategoryId.ToString() + "'").Single(); if (category != null) { db.Categories.Remove(category); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean deleteIncome(Income obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Income Income = db.Incomes.SqlQuery("dbo.SelectIncomeById @IncomeId='" + obj.IncomeId.ToString() + "'").Single(); if (Income != null) { db.Incomes.Remove(Income); #region Database Submission try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Boolean updateSkill(Skill obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Skill skill = db.Skills.SqlQuery("dbo.SelectSkillById @Skill='" + obj.SkillId.ToString() + "'").Single(); if (skill != null) { skill.SkillName = obj.SkillName; skill.SkillDescription = obj.SkillDescription; #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Income selectIncomeById(Income obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Incomes.SqlQuery("dbo.SelectIncomeById @IncomeId='" + obj.IncomeId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Category selectCategoryById(Category obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Categories.SqlQuery("dbo.SelectCategoryById @CategoryId='" + obj.CategoryId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Education selectEducationById(Education obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Educations.SqlQuery("dbo.SelectEducationById @EducationId='" + obj.EducationId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Boolean updateRecruitee(Recruitee obj) { using (NewRecruiteeBankContext db = new NewRecruiteeBankContext()) { try { Recruitee recruitee = db.Recruitees.SqlQuery("dbo.SelectRecruiteeById @RecruiteeId='" + obj.RecruiteeId.ToString() + "'").Single(); if (recruitee != null) { recruitee.RankingId = obj.RankingId; recruitee.RankingValue = obj.RankingValue; recruitee.Email = obj.Email; recruitee.FirstName = obj.FirstName; recruitee.LastName = obj.LastName; recruitee.Gender = obj.Gender; recruitee.AgeId = obj.AgeId; recruitee.EducationId = obj.EducationId; recruitee.IncomeId = obj.IncomeId; #region Database Submission with Rollback try { db.SaveChanges(); return true; } catch (Exception ex) { return false; } #endregion } else { return false; } } catch (Exception ex) { return false; } } }
public Guid[] selectRecruiteeNames() { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { //return ((from a in db.Recruitees // orderby a.RecruiteeId // select a.RecruiteeId).ToArray()); // Select Recruitee Ids using any query on SelectRecruiteeSpecial stored procedure //List<Recruitee> list_recruitees = db.Database.SqlQuery(typeof(Recruitee), "dbo.SelectRecruiteeSpecial").Cast<Recruitee>().ToList(); //List<Guid> list_id = new List<Guid>(); //foreach (Recruitee rec in list_recruitees) //{ // list_id.Add(rec.RecruiteeId); //} //return list_id.ToArray(); List<Guid> list_id = db.Database.SqlQuery(typeof(Guid), "dbo.SelectRecruiteeSpecial").Cast<Guid>().ToList(); return list_id.ToArray(); } catch (Exception ex) { return null; } }
public List<Recruitee> selectRecruiteeBySkillId(String skillId) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Database.SqlQuery(typeof(Recruitee), "dbo.SelectRecruiteeBySkillId @SkillId='" + skillId + "'").Cast<Recruitee>().ToList(); } catch (Exception ex) { return null; } }
public Ranking selectRankingById(Ranking obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Rankings.SqlQuery("dbo.SelectRankingById @RankingId='" + obj.RankingId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Recruitee selectRecruiteeByEmail(Recruitee obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Recruitees.SqlQuery("dbo.SelectRecruiteeByEmail @Email='" + obj.Email.ToString() + "'").Single(); } catch (Exception ex) { return null; } }
public Skill selectSkillById(Skill obj) { NewRecruiteeBankContext db = new NewRecruiteeBankContext(); try { return db.Skills.SqlQuery("dbo.SelectSkillById @SkillId='" + obj.SkillId.ToString() + "'").Single(); } catch (Exception ex) { return null; } }