/// <summary> /// Write Update Log For Interview /// </summary> /// <param name="newInfo"></param> /// <param name="logId"></param> /// <returns></returns> public void WriteUpdateLogForSendMailToInterView(string id, string userUpdate, ELogAction action) { try { string logId = commonDao.UniqueId; // Get old info Interview oldInfo = new InterviewDao().GetById(id); commonDao.InsertMasterLog(logId, userUpdate, ELogTable.Interview.ToString(), action.ToString()); commonDao.InsertLogDetail(logId, "IsSendMailInterviewer", "Send Meeting Request", "No", "Yes"); string key = oldInfo.CandidateId.ToString() + " [" + oldInfo.Candidate.FirstName + " " + oldInfo.Candidate.MiddleName + " " + oldInfo.Candidate.LastName + "]" + " for Interview in round " + oldInfo.Round.Value.ToString() + " in " + oldInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW); commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Update Log For Employee /// </summary> /// <param name="newInfo"></param> /// <param name="logId"></param> /// <returns></returns> public bool WriteUpdateLogForInterview(Interview newInfo, string jr, ELogAction action) { bool isUpdated = false; try { string logId = commonDao.UniqueId; // Get old info Interview oldInfo = new InterviewDao().GetById(newInfo.Id.ToString()); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Interview.ToString(), action.ToString()); if (oldInfo.InterviewDate != newInfo.InterviewDate) { commonDao.InsertLogDetail(logId, "InterviewDate", "Interview Date", newInfo.InterviewDate.HasValue ? newInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_FULL_LOG) : "", oldInfo.InterviewDate.HasValue ? oldInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_FULL_LOG) : ""); isUpdated = true; } if (oldInfo.Venue != newInfo.Venue) { commonDao.InsertLogDetail(logId, "Venue", "Venue", oldInfo.Venue, newInfo.Venue); isUpdated = true; } if (oldInfo.Pic != newInfo.Pic) { commonDao.InsertLogDetail(logId, "Pic", "Pic", oldInfo.Pic, newInfo.Pic); isUpdated = true; } if (oldInfo.Content != newInfo.Content) { commonDao.InsertLogDetail(logId, "Content", "Content", oldInfo.Content, newInfo.Content); isUpdated = true; } if (oldInfo.CandidateId != newInfo.CandidateId) { isUpdated = true; commonDao.InsertLogDetail(logId, "CandidateId", "Candidate Id", oldInfo.CandidateId.HasValue?oldInfo.CandidateId.Value.ToString():"", newInfo.CandidateId.HasValue?newInfo.CandidateId.Value.ToString():""); } if (oldInfo.InterviewStatusId != newInfo.InterviewStatusId) { isUpdated = true; commonDao.InsertLogDetail(logId, "InterviewStatusId", "Interview Status Id", oldInfo.InterviewStatusId.HasValue?oldInfo.InterviewStatus.Name:"", newInfo.InterviewStatusId.HasValue?new InterviewStatusDao().GetById(newInfo.InterviewStatusId.Value).Name:""); } if (oldInfo.Round != newInfo.Round) { isUpdated = true; commonDao.InsertLogDetail(logId, "Round", "Round", oldInfo.Round.HasValue?oldInfo.Round.Value.ToString():"", newInfo.Round.HasValue?newInfo.Round.Value.ToString():""); } if (oldInfo.InterviewResultId != newInfo.InterviewResultId) { isUpdated = true; commonDao.InsertLogDetail(logId, "InterviewResultId", "Interview Result Id",oldInfo.InterviewResultId.HasValue?oldInfo.InterviewResult.Name:"", newInfo.InterviewResultId.HasValue?new InterviewResultDao().GetById(newInfo.InterviewResultId.Value).Name:""); } if (oldInfo.Note != newInfo.Note) { isUpdated = true; commonDao.InsertLogDetail(logId, "Note", "Note", newInfo.Note, oldInfo.Note); } if (oldInfo.OldInterView != newInfo.OldInterView) { isUpdated = true; commonDao.InsertLogDetail(logId, "OldInterView", "Old InterView", oldInfo.OldInterView.HasValue ? oldInfo.OldInterView.Value == false ? "No" : "Yes" : "", newInfo.OldInterView.HasValue ? newInfo.OldInterView.Value == false ? "No" : "Yes" : ""); } if (oldInfo.IsSendMailInterviewer != newInfo.IsSendMailInterviewer) { isUpdated = true; commonDao.InsertLogDetail(logId, "IsSendMailInterviewer", "IsSendMailInterviewer", oldInfo.IsSendMailInterviewer.Value == false ? "No" : "Yes",oldInfo.IsSendMailInterviewer.Value == false ? "No" : "Yes"); } if (oldInfo.IsSentMailCandidate != newInfo.IsSentMailCandidate) { isUpdated = true; commonDao.InsertLogDetail(logId, "IsSentMailCandidate", "IsSentMailCandidate", oldInfo.IsSendMailInterviewer.Value == false ? "No" : "Yes", newInfo.IsSentMailCandidate.Value == false ? "No" : "Yes"); } if (oldInfo.InterviewFormId != newInfo.InterviewFormId) { isUpdated = true; commonDao.InsertLogDetail(logId, "TemplateRound", "TemplateRound", new EformDao().GetEFormMasterByID(oldInfo.InterviewFormId).Name, new EformDao().GetEFormMasterByID(newInfo.InterviewFormId).Name); } if (!string.IsNullOrEmpty(jr)) { Candidate objCan = new CandidateDao().GetById(oldInfo.CandidateId.Value.ToString()); if (objCan.JRId.Value.ToString() != jr) { commonDao.InsertLogDetail(logId, "JobRequest", "Job Request", objCan.JRId.Value.ToString(), jr); isUpdated = true; } } // Insert Key Name if (isUpdated) { string key = oldInfo.CandidateId.ToString() + " [" + oldInfo.Candidate.FirstName + " " + oldInfo.Candidate.MiddleName + " " + oldInfo.Candidate.LastName + "]" + " for Interview in round " + oldInfo.Round.Value.ToString() + " in " + oldInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW); commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } return isUpdated; }