/// <summary> /// Get client last updated date /// </summary> /// <param name="clientId"></param> /// <param name="client"></param> /// <returns></returns> public ActionDate GetClientLastUpdatedDate(int clientId, Client client = null) { ActionDate action; var dbContext = new dbDataContext(); if (client == null) { var tblClient = dbContext.tbl_Clients.FirstOrDefault(t => t.ClientId == clientId); if (tblClient != null) { action = new ActionDate { Date = tblClient.LastUpdatedDate.ToString("dd/MM/yyyy"), UserId = tblClient.LastUpdatedBy }; } else return null; } else { action = new ActionDate { Date = client.LastUpdatedDate.ToString("dd/MM/yyyy"), UserId = client.LastUpdatedBy }; } var user = dbContext.tbl_Users.FirstOrDefault(t => t.UserId == action.UserId); if (user != null) action.Username = user.Forename + " " + user.Surname; return action; }
/// <summary> /// Get contact added date /// </summary> /// <param name="candidateId"></param> /// <param name="candidate"></param> /// <returns></returns> public ActionDate GetCandidateAddedDate(int candidateId, Candidate candidate = null) { var action = new ActionDate(); var dbContext = new dbDataContext(); if (candidate == null) { var tblCandidate = dbContext.tbl_Candidates.FirstOrDefault(t => t.CandidateId == candidateId); if (tblCandidate != null) { action.Date = tblCandidate.CreatedDate.ToString("dd/MM/yyyy"); action.UserId = tblCandidate.CreatedBy; } } else { action.Date = candidate.CreatedDate.ToString("dd/MM/yyyy"); action.UserId = candidate.CreatedBy; } var user = dbContext.tbl_Users.FirstOrDefault(t => t.UserId == action.UserId); if (user != null) action.Username = user.Forename + " " + user.Surname; return action; }