public Result UpdateFeedbackFromEmployer(JobApplicationEntity entity) { Result result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Entity = entity; query.Query = @" BEGIN TRAN Update JobApplications SET FeedbackFromEmployer = @FeedbackFromEmployer WHERE JobApplicationId = @JobApplicationId; Select * From JobApplications WHERE JobApplicationId = @JobApplicationId; COMMIT TRAN "; result = con.ExecuteGetOneItemQuery <JobApplicationEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result.Success = false; result.Message = ex.Message; } return(result); }
public Result ShortListApplication(int applicationId) { Result result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Entity = new { ApplicationId = applicationId, ApplicationStatus = "SHORTLISTED", IsShortlisted = true, ShortListedDate = DateTime.Now, IsDeclined = false }; query.Query = @" Update JobApplications SET IsShortlisted = @IsShortlisted, ShortListedDate = @ShortListedDate, IsDeclined = @IsDeclined WHERE ApplicationId = @ApplicationId "; result = con.ExecuteGetOneItemQuery <JobApplicationEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result.Success = false; result.Message = ex.Message; } return(result); }
public Result GetJobApplicationByApplicationId(int applicationId) { Result result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Entity = new { ApplicationId = applicationId }; query.Query = @" SELECT * FROM JobApplications WHERE JobApplicationId = @ApplicationId "; result = con.ExecuteGetOneItemQuery <JobApplicationEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result.Success = false; result.Message = ex.Message; } return(result); }
public Result ShortlistOrDeclineJobApplication(JobApplicationEntity jobApplication) { Result result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Entity = jobApplication; query.Query = @" UPDATE JobApplications SET ApplicationStatus = @ApplicationStatus , IsShortlisted = @IsShortlisted, IsDeclined = @IsDeclined, ShortListedDate = ISNULL(@ShortListedDate, NULL), DeclinedDate = ISNULL(@DeclinedDate, NULL) WHERE JobApplicationId = @JobApplicationId AND JobListingId = @JobListingId AND UserId = @UserId; SELECT * FROM JobApplications WHERE JobApplicationId = @JobApplicationId AND JobListingId = @JobListingId and UserId = @UserId; "; result = con.ExecuteGetOneItemQuery <JobApplicationEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result.Success = false; result.Message = ex.Message; } return(result); }
public Result GetEmployerById(int employerId) { var result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Query = @"SELECT * FROM Employers where EmployerId = @EmployerId"; query.Entity = new { EmployerId = employerId }; result = con.ExecuteGetOneItemQuery <EmployerEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result = result ?? new Result(false); result.Message = "An error occurred" + ex.Message; } return(result); }
public Result GetSecuredUserDetails(int userId) { var result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); var credentials = new CredentialsManager(); query.Query = @"SELECT [UserId] ,[Name] ,[Email] ,[NurseType] ,[ActiveWorking] ,[Area] ,[Country] ,[Suburb] ,[PostalCode] ,[State] ,[defaultQuizId] ,[salary] FROM Users where UserId = @UserId and Active = 1 and ApnaUser = 0"; query.Entity = new { UserId = userId }; result = con.ExecuteGetOneItemQuery <UserEntity>(query); if (!result.Success) { result.Message = "Login error"; return(result); } var user = (UserEntity)result.Entity; if (user == null) { result.Message = "Invalid user"; result.Success = false; result.Entity = null; return(result); } } catch (Exception ex) { Logger.Log(ex); result.Entity = null; result = result ?? new Result(false); result.Message = "An error occurred"; } return(result); }
public Result GetUserDetails(UserEntity entity) { var result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Query = @"SELECT [UserId] ,[Name] ,[Email] ,[ApnaMemberId] ,[ApnaUser] ,[NurseType] ,[Area] ,[Age] ,[Country] ,[Suburb] ,[PostalCode] ,[State] ,[Patients] ,[PatientsTitle] ,[Qualification] ,[IsLookingForJob] ,[defaultQuizId] ,[salary] FROM Users where UserId = @UserId"; query.Entity = entity; result = con.ExecuteGetOneItemQuery <UserEntity>(query); if (!result.Success) { result.Entity = null; result.Message = "Login error"; return(result); } result.Message = "The current user details"; } catch (Exception ex) { Logger.Log(ex); result = result ?? new Result(false); result.Message = "An error occurred"; throw; } return(result); }
public Result GetListingById(int listingId) { var result = new Result(); try { var credentials = new CredentialsManager(); var con = new DapperConnectionManager(); var query = new QueryEntity { Entity = new { JobListingId = listingId }, Query = @"SELECT * FROM JobListings where JobListingId = @JobListingId" }; result = con.ExecuteGetOneItemQuery <JobListingEntity>(query); var listing = (JobListingEntity)result.Entity; var listing_cri_man = new JobListingCriteriaManager(); var criteria = (List <JobListingCriteriaEntity>)listing_cri_man.GetCriteriaByListingId(listing.JobListingId).Entity; listing.JobListingCriteria = criteria; result.Entity = listing; return(result); } catch (Exception ex) { if (result == null) { result = new Result(); } Logger.Log(ex); result.Entity = null; result.Success = false; result.Message = "An error occurred" + ex.Message; } return(result); }
public Result CreateJobApplication(JobApplicationEntity jobApplication) { Result result = new Result(); try { var con = new DapperConnectionManager(); var query = new QueryEntity(); query.Entity = jobApplication; query.Query = @" BEGIN TRAN IF EXISTS (SELECT * FROM JobApplications WHERE JobListingId = @JobListingId and UserId = @UserId ) BEGIN UPDATE JobApplications SET Summary = @Summary , EmployerId = @EmployerId, IsDraft = @IsDraft, ApplicationStatus = @ApplicationStatus , AppliedDate = @AppliedDate , LastModifiedDate= @LastModifiedDate WHERE JobListingId = @JobListingId and UserId = @UserId END ELSE BEGIN INSERT INTO JobApplications (JobListingId, UserId, EmployerId, Summary, IsDraft, ApplicationStatus, AppliedDate, LastModifiedDate) VALUES (@JobListingId, @UserId, @EmployerId, @Summary, @IsDraft, @ApplicationStatus, @AppliedDate, @LastModifiedDate) END SELECT * FROM JobApplications WHERE JobListingId = @JobListingId and UserId = @UserId COMMIT TRAN "; result = con.ExecuteGetOneItemQuery <JobApplicationEntity>(query); return(result); } catch (Exception ex) { Logger.Log(ex); result.Success = false; result.Message = ex.Message; } return(result); }