Exemplo n.º 1
0
        public Boolean insertCompensation(Compensation obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    db.Compensations.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 2
0
        public Boolean insertSkill(Skill obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    db.Skills.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 3
0
        public Boolean insertCategory(Category obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    db.Categories.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 4
0
        public Boolean addSkillToJob(Job obj, String skillId)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    Job Job = db.Jobs.SqlQuery("dbo.SelectJobById @JobId='" + obj.JobId.ToString() + "'").Single();
                    Skill skillAdd = db.Skills.SqlQuery("dbo.SelectSkillById @SkillId='" + skillId + "'").Single();

                    if (Job != null)
                    {
                        if (skillAdd != null)
                        {
                            Job.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;
                }
            }
        }
Exemplo n.º 5
0
        public Boolean deleteCompensation(Compensation obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    Compensation compensation = db.Compensations.SqlQuery("dbo.SelectCompensationById @CompensationId='" + obj.CompensationId.ToString() + "'").Single();

                    if (compensation != null)
                    {
                        db.Compensations.Remove(compensation);
                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Exemplo n.º 6
0
        public Boolean deleteJob(Job obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    Job job = db.Jobs.SqlQuery("dbo.SelectJobById @JobId='" + obj.JobId.ToString() + "'").Single();

                    if (job != null)
                    {
                        db.Jobs.Remove(job);
                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Exemplo n.º 7
0
        public Boolean deleteSkill(Skill obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                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;
                }
            }
        }
Exemplo n.º 8
0
        public Boolean deleteEmployer(Employer obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {
                    Employer employer = db.Employers.SqlQuery("dbo.SelectEmployerById @EmployerId='" + obj.EmployerId.ToString() + "'").Single();

                    if (employer != null)
                    {
                        db.Employers.Remove(employer);
                        #region Database Submission

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Exemplo n.º 9
0
        public Boolean deleteCategory(Category obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                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;
                }
            }
        }
Exemplo n.º 10
0
        public Boolean updateJob(Job obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {

                    Job job = db.Jobs.SqlQuery("dbo.SelectJobById @JobId='" + obj.JobId.ToString() + "'").Single();

                    if (job != null)
                    {
                        job.JobName = obj.JobName;
                        job.CompensationId = obj.CompensationId;
                        job.EmployerId = obj.EmployerId;
                        job.JobDescription = obj.JobDescription;
                        job.JobQuota = obj.JobQuota;
                        job.JobExperienceLevel = obj.JobExperienceLevel;
                        job.JobCompensationValue = obj.JobCompensationValue;

                        #region Database Submission with Rollback

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }
                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Exemplo n.º 11
0
        public Boolean updateSkill(Skill obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {

                    Skill skill = db.Skills.SqlQuery("dbo.SelectSkillById @SkillId='" + 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;
                }

            }
        }
Exemplo n.º 12
0
        public Boolean updateCategory(Category obj)
        {
            using (NewJobBankContext db = new NewJobBankContext())
            {
                try
                {

                    Category category = db.Categories.SqlQuery("dbo.SelectCategoryById @CategoryId='" + obj.CategoryId.ToString() + "'").Single();

                    if (category != null)
                    {
                        category.CategoryName = obj.CategoryName;
                        category.CategoryDescription = obj.CategoryDescription;

                        #region Database Submission with Rollback

                        try
                        {
                            db.SaveChanges();
                            return true;
                        }
                        catch (Exception ex)
                        {
                            return false;
                        }
                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }