コード例 #1
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
        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;
            }
        }
コード例 #2
0
 public Boolean deleteAllRecommendedJob()
 {
     using (NewElasticBankContext db = new NewElasticBankContext())
     {
         try
         {
             db.Database.ExecuteSqlCommand("dbo.DeleteAllRecommendedJob");
             return true;
         }
         catch (Exception ex)
         {
             return false;
         }
     }
 }
コード例 #3
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
        public Boolean insertTask(Task obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    db.Tasks.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
コード例 #4
0
        public Boolean insertRecommendedJob(RecommendedJob obj)
        {
            using (NewElasticBankContext db = new NewElasticBankContext())
            {
                try
                {
                    db.RecommendedJobs.Add(obj);
                    db.SaveChanges();
                    return true;
                }
                catch (Exception ex)
                {
                    return false;
                }

            }
        }
コード例 #5
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
        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;
                }
            }
        }
コード例 #6
0
        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;
                }
            }
        }
コード例 #7
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
        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;
            }
        }
コード例 #8
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
 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;
 }
コード例 #9
0
ファイル: TaskSvcEFImpl.cs プロジェクト: sadallo/UMNewProject
        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;
                }

            }
        }
コード例 #10
0
        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;
            }
        }
コード例 #11
0
        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;
            }
        }
コード例 #12
0
        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;
            }
        }