Example #1
0
        public List<Task> selectAllTask()
        {
            NewElasticBankContext db = new NewElasticBankContext();

            try
            {
                return db.Database.SqlQuery(typeof(Task), "dbo.SelectAllTask").Cast<Task>().ToList();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
 public Boolean deleteAllRecommendedJob()
 {
     using (NewElasticBankContext db = new NewElasticBankContext())
     {
         try
         {
             db.Database.ExecuteSqlCommand("dbo.DeleteAllRecommendedJob");
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
Example #3
0
        public Boolean insertTask(Task obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    db.Tasks.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
        public Boolean insertRecommendedJob(RecommendedJob obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    db.RecommendedJobs.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
Example #5
0
        public Boolean deleteTask(Task obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    Task task = db.Tasks.SqlQuery("dbo.SelectTaskById @TaskId='" + obj.TaskId.ToString() + "'").Single();

                    if (task != null)
                    {
                        db.Tasks.Remove(task);
                        #region Database Submission

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

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
        public Boolean deleteRecommendedJob(RecommendedJob obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    RecommendedJob rec_job = db.RecommendedJobs.SqlQuery("dbo.SelectRecommendedJobByJobIdAndRecruiteeId @JobId='" + obj.JobId.ToString() + "' @RecruiteeId='" + obj.RecruiteeId.ToString() + "'").Single();

                    if (rec_job != null)
                    {
                        db.RecommendedJobs.Remove(rec_job);
                        #region Database Submission

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

                        #endregion
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception ex)
                {
                    return false;
                }
            }
        }
Example #7
0
        public Task selectTaskById(Task obj)
        {
            NewElasticBankContext db = new NewElasticBankContext();

            try
            {

                return db.Tasks.SqlQuery("dbo.SelectTaskById @TaskId='" + obj.TaskId.ToString() + "'").Single();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
Example #8
0
 public TaskRatingDTO[] selectRatings()
 {
     NewElasticBankContext db = new NewElasticBankContext();
     TaskRatingDTO[] temp = (from a in db.Tasks
               select new TaskRatingDTO
               { JobId = a.JobId, RecruiteeId = a.RecruiteeId, Rating = (double?)a.Rating }).ToArray<TaskRatingDTO>();
     return temp;
 }
Example #9
0
        public Boolean updateTask(Task obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {

                    Task task = db.Tasks.SqlQuery("dbo.SelectTaskById @TaskId='" + obj.TaskId.ToString() + "'").Single();

                    if (task != null)
                    {
                        task.JobId = obj.JobId;
                        task.RecruiteeId = obj.RecruiteeId;
                        task.TaskDescription = obj.TaskDescription;
                        task.Rating = obj.Rating;

                        #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 RecommendedJob selectRecommendedJobByJobIdAndRecruiteeId(RecommendedJob obj)
        {
            NewElasticBankContext db = new NewElasticBankContext();

            try
            {
                return db.RecommendedJobs.SqlQuery("dbo.SelectRecommendedJobByJobIdAndRecruiteeId @JobId='" + obj.JobId.ToString() + "', @RecruiteeId='" + obj.RecruiteeId.ToString() + "'").Single();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public List<RecommendedJob> selectAllRecommendedJob()
        {
            NewElasticBankContext db = new NewElasticBankContext();

            try
            {
                return db.Database.SqlQuery(typeof(RecommendedJob), "dbo.SelectAllRecommendedJob").Cast<RecommendedJob>().ToList();
            }
            catch (Exception ex)
            {
                return null;
            }
        }
        public List<RecommendedJob> selectRecommendedJobByRecruiteeId(RecommendedJob obj)
        {
            NewElasticBankContext db = new NewElasticBankContext();

            try
            {
                return db.Database.SqlQuery(typeof(RecommendedJob), "dbo.SelectRecommendedJobByRecruiteeId @RecruiteeId='" + obj.RecruiteeId.ToString() + "'").Cast<RecommendedJob>().ToList();
            }
            catch (Exception ex)
            {
                return null;
            }
        }