예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        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;
            }
        }
예제 #6
0
        public Boolean insertIncome(Income obj)
        {
            using (NewRecruiteeBankContext db = new NewRecruiteeBankContext())
            {
                try
                {
                    db.Incomes.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
예제 #7
0
        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;
                }
            }
        }
예제 #8
0
        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;
                }
            }
        }
예제 #9
0
        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;
                }
            }
        }
예제 #10
0
        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;
                }
            }
        }
예제 #11
0
        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;
                }
            }
        }
예제 #12
0
        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;
                }
            }
        }
예제 #13
0
        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;
                }

            }
        }
예제 #14
0
        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;
            }
        }
예제 #15
0
        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;
            }
        }
예제 #16
0
        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;
            }
        }
예제 #17
0
        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;
                }

            }
        }
예제 #18
0
        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;
            }
        }
예제 #19
0
        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;
            }
        }
예제 #20
0
        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;
            }
        }
예제 #21
0
        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;
            }
        }
예제 #22
0
        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;
            }
        }