public void WriteLogForJobRequest(JobRequest oldInfo, JobRequest newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.JobRequest.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForJobRequest(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.JobRequest.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForJobRequest(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.JobRequest.ToString(), action.ToString()); // Write Delete Log string key = newInfo.ID.ToString() + " [" + newInfo.UserAdmin.UserName + " (Requestor) ]"; commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForWorkflowAdmin(UserAdmin_WFRole oldInfo, UserAdmin_WFRole newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.WorkFlowAdmin.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForWorkflowAdmin(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.WorkFlowAdmin.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForWorkflowAdmin(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); // Write Delete Log string key = newInfo.ID + " [" + oldInfo.UserAdmin.UserName + "] with Role [" + oldInfo.WFRole.Name + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForGroup(Group oldInfo, Group newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.Group.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForGroup(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Group.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForGroup(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Group.ToString(), action.ToString()); // Write Delete Log string key = "Group name '" + newInfo.GroupName + "'"; commonDao.InsertLogDetail(logId, "GroupId", "Key for Delete ", key, null); break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForContract(Contract oldInfo, Contract newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.Contract.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForContract(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Contract.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForContract(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Contract.ToString(), action.ToString()); // Write Delete Log string key = "Contract on " + newInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW) + " of " + newInfo.EmployeeId + " [" + newInfo.Employee.FirstName + " " + newInfo.Employee.LastName + "]"; commonDao.InsertLogDetail(logId, "ContractId", "Key for Delete", key, null); break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForCandidate(Candidate oldInfo, Candidate newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.Candidate.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForCandidate(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Candidate.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForCandidate(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Candidate.ToString(), action.ToString()); // Write Delete Log string key = newInfo.ID.ToString() + " [" + newInfo.FirstName + " " + newInfo.MiddleName + " " + newInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); break; } } catch (Exception ex) { throw ex; } }
public void WriteLogForRemoveContractCV(Contract newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Contract.ToString(), action.ToString()); Contract oldInfo = new ContractRenewalDao().GetById(newInfo.ContractId); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { foreach (string item in oldInfo.ContractFile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX)) { if (!newInfo.ContractFile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX).Contains(item)) { commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", item, ""); isUpdated = true; } } if (isUpdated) { // Insert Key Name string key ="Contract on Start Date " + oldInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW) + (oldInfo.EndDate.HasValue?" to " +oldInfo.EndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"") + " of " + oldInfo.EmployeeId + " [" + oldInfo.Employee.FirstName + " " + oldInfo.Employee.LastName + "]"; commonDao.InsertLogDetail(logId, "EmployeeId", "Key for Delete", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateBanks(STT newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT oldInfo = new STTDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.BankName != oldInfo.BankName) { commonDao.InsertLogDetail(logId, "BankName", "Bank Name", oldInfo.BankName, newInfo.BankName); isUpdated = true; } if (newInfo.BankAccount != oldInfo.BankAccount) { commonDao.InsertLogDetail(logId, "BankAccount", "Bank Account", oldInfo.BankAccount, newInfo.BankAccount); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateRemarks(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.Remarks != oldInfo.Remarks) { commonDao.InsertLogDetail(logId, "Remarks", "Remarks", oldInfo.Remarks, newInfo.Remarks); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdatePersonal(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.VnIDIssueLocation != oldInfo.VnIDIssueLocation) { commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", oldInfo.VnIDIssueLocation, newInfo.VnIDIssueLocation); isUpdated = true; } if (newInfo.Race != oldInfo.Race) { commonDao.InsertLogDetail(logId, "Race", "Race", oldInfo.Race, newInfo.Race); isUpdated = true; } if (newInfo.Major != oldInfo.Major) { commonDao.InsertLogDetail(logId, "Major", "Major", oldInfo.Major, newInfo.Major); isUpdated = true; } if (newInfo.IDIssueLocation != oldInfo.IDIssueLocation) { commonDao.InsertLogDetail(logId, "IDIssueLocation", "Issue Location", oldInfo.IDIssueLocation, newInfo.IDIssueLocation); isUpdated = true; } if (newInfo.Degree != oldInfo.Degree) { commonDao.InsertLogDetail(logId, "Degree", "Degree", oldInfo.Degree, newInfo.Degree); isUpdated = true; } if (newInfo.OtherDegree != oldInfo.OtherDegree) { commonDao.InsertLogDetail(logId, "OtherDegree", "Other Degree", oldInfo.OtherDegree, newInfo.OtherDegree); isUpdated = true; } if (newInfo.VnPlaceOfOrigin != oldInfo.VnPlaceOfOrigin) { commonDao.InsertLogDetail(logId, "VnPlaceOfOrigin", "Vn Place Of Origin", oldInfo.VnPlaceOfOrigin, newInfo.VnPlaceOfOrigin); isUpdated = true; } if (newInfo.VnPOB != oldInfo.VnPOB) { commonDao.InsertLogDetail(logId, "VnPOB", "Vn Place Of Birth", oldInfo.VnPOB, newInfo.VnPOB); isUpdated = true; } if (newInfo.VnLastName != oldInfo.VnLastName) { commonDao.InsertLogDetail(logId, "VnLastName", "Vn Last Name", oldInfo.VnLastName, newInfo.VnLastName); isUpdated = true; } if (newInfo.VnMiddleName != oldInfo.VnMiddleName) { commonDao.InsertLogDetail(logId, "VnMiddleName", "Vn Middle Name", oldInfo.VnMiddleName, newInfo.VnMiddleName); isUpdated = true; } if (newInfo.VnFirstName != oldInfo.VnFirstName) { commonDao.InsertLogDetail(logId, "VnFirstName", "Vn First Name", oldInfo.VnFirstName, newInfo.VnFirstName); isUpdated = true; } if (newInfo.LastName != oldInfo.LastName) { commonDao.InsertLogDetail(logId, "LastName", "Last Name", oldInfo.LastName, newInfo.LastName); isUpdated = true; } if (newInfo.MiddleName != oldInfo.MiddleName) { commonDao.InsertLogDetail(logId, "MiddleName", "Middle Name", oldInfo.MiddleName, newInfo.MiddleName); isUpdated = true; } if (newInfo.FirstName != oldInfo.FirstName) { commonDao.InsertLogDetail(logId, "FirstName", "First Name", oldInfo.FirstName, newInfo.FirstName); isUpdated = true; } if (newInfo.Gender != oldInfo.Gender) { commonDao.InsertLogDetail(logId, "Gender", "Gender",oldInfo.Gender.HasValue?(oldInfo.Gender.Value == Constants.MALE ? "Male" : "Famale"):"", newInfo.Gender.HasValue?(newInfo.Gender.Value == Constants.MALE ? "Male" : "Famale"):""); isUpdated = true; } if (newInfo.DOB != oldInfo.DOB) { commonDao.InsertLogDetail(logId, "DOB", "Date Of Birth",oldInfo.DOB.HasValue?oldInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.DOB.HasValue?newInfo.DOB.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.POB != oldInfo.POB) { commonDao.InsertLogDetail(logId, "POB", "Place Of Birth", oldInfo.POB, newInfo.POB); isUpdated = true; } if (newInfo.Nationality != oldInfo.Nationality) { commonDao.InsertLogDetail(logId, "Nationality", "Nationality", oldInfo.Nationality, newInfo.Nationality); isUpdated = true; } if (newInfo.PlaceOfOrigin != oldInfo.PlaceOfOrigin) { commonDao.InsertLogDetail(logId, "PlaceOfOrigin", "Place Of Origin", oldInfo.PlaceOfOrigin, newInfo.PlaceOfOrigin); isUpdated = true; } if (newInfo.IDNumber != oldInfo.IDNumber) { commonDao.InsertLogDetail(logId, "IDNumber", "ID Number", oldInfo.IDNumber, newInfo.IDNumber); isUpdated = true; } if (newInfo.IssueDate != oldInfo.IssueDate) { commonDao.InsertLogDetail(logId, "IssueDate", "Issue Date",oldInfo.IssueDate.HasValue?oldInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"", newInfo.IssueDate.HasValue?newInfo.IssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.MarriedStatus != oldInfo.MarriedStatus) { commonDao.InsertLogDetail(logId, "Married Status", "Married Status", oldInfo.MarriedStatus.HasValue?(oldInfo.MarriedStatus.Value == Constants.SINGLE ? "Single" : "Married"):"", newInfo.MarriedStatus.HasValue?(newInfo.MarriedStatus.Value == Constants.SINGLE ? "Single" : "Married"):""); isUpdated = true; } if (newInfo.Religion != oldInfo.Religion) { commonDao.InsertLogDetail(logId, "Religion", "Religion", oldInfo.Religion, newInfo.Religion); isUpdated = true; } if (newInfo.EmpStatusId != oldInfo.EmpStatusId) { commonDao.InsertLogDetail(logId, "EmpStatusId", "Employee Status", oldInfo.EmpStatusId.HasValue ? oldInfo.EmployeeStatus.StatusName : "", newInfo.EmpStatusId.HasValue ? new EmployeeStatusDao().GetById(newInfo.EmpStatusId.Value).StatusName : ""); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateCompany(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.JR != oldInfo.JR) { commonDao.InsertLogDetail(logId, "JR", "Job Request", oldInfo.JR, newInfo.JR); isUpdated = true; } if (newInfo.Project != oldInfo.Project) { commonDao.InsertLogDetail(logId, "Project", "JProject", oldInfo.Project, newInfo.Project); isUpdated = true; } if (newInfo.ManagerId != oldInfo.ManagerId) { commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId); isUpdated = true; } if (newInfo.JRApproval != oldInfo.JRApproval) { commonDao.InsertLogDetail(logId, "JRApproval", "Job Request Approval", oldInfo.JRApproval, newInfo.JRApproval); isUpdated = true; } if (newInfo.StartDate != oldInfo.StartDate) { commonDao.InsertLogDetail(logId, "StartDate", "Start Date", oldInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW), newInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW)); isUpdated = true; } if (newInfo.ContractedDate != oldInfo.ContractedDate) { commonDao.InsertLogDetail(logId, "ContractedDate", "Contracted Date",oldInfo.ContractedDate.HasValue?oldInfo.ContractedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"", newInfo.ContractedDate.HasValue?newInfo.ContractedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.DepartmentId != oldInfo.DepartmentId) { Department sub = new DepartmentDao().GetById(newInfo.DepartmentId); commonDao.InsertLogDetail(logId, "DepartmentId", "Sub Department", oldInfo.Department.DepartmentName, sub.DepartmentName); isUpdated = true; } if (newInfo.TitleId != oldInfo.TitleId) { JobTitleLevel title = new JobTitleLevelDao().GetById(newInfo.TitleId); commonDao.InsertLogDetail(logId, "TitleId", "Job Title", oldInfo.JobTitleLevel.DisplayName, title.DisplayName); isUpdated = true; } if (newInfo.LaborUnion != oldInfo.LaborUnion) { commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union",oldInfo.LaborUnion.HasValue?(oldInfo.LaborUnion == true?"Yes":"No"):"", newInfo.LaborUnion.HasValue?(newInfo.LaborUnion == true?"Yes":"No"):""); isUpdated = true; } if (newInfo.LaborUnionDate != oldInfo.LaborUnionDate) { commonDao.InsertLogDetail(logId, "LaborUnionDate", "Labor Union date", oldInfo.LaborUnionDate.HasValue?oldInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.LaborUnionDate.HasValue?newInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.TaxID != oldInfo.TaxID) { commonDao.InsertLogDetail(logId, "TaxID", "TaxID", oldInfo.TaxID, newInfo.TaxID); isUpdated = true; } if (newInfo.TaxIssueDate != oldInfo.TaxIssueDate) { commonDao.InsertLogDetail(logId, "TaxIssueDate", "Tax Issue Date", oldInfo.TaxIssueDate.HasValue?oldInfo.TaxIssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.TaxIssueDate.HasValue?newInfo.TaxIssueDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.SocialInsuranceNo != oldInfo.SocialInsuranceNo) { commonDao.InsertLogDetail(logId, "SocialInsuranceNo", "Insurance Book No", oldInfo.SocialInsuranceNo, newInfo.SocialInsuranceNo); isUpdated = true; } if (newInfo.InsuranceHospitalID != oldInfo.InsuranceHospitalID) { commonDao.InsertLogDetail(logId, "InsuranceHospitalID", "Insurance Hospital", oldInfo.InsuranceHospitalID, newInfo.InsuranceHospitalID); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
/// <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 Interview /// </summary> /// <param name="newInfo"></param> /// <param name="logId"></param> /// <returns></returns> public void WriteUpdateLogForResult(Interview obj,int result,string note, string userUpdate,ELogAction action) { try { string logId = commonDao.UniqueId; // Get old info commonDao.InsertMasterLog(logId, userUpdate, ELogTable.Interview.ToString(), action.ToString()); commonDao.InsertLogDetail(logId, "Interview Result", "Interview Result", obj.InterviewResultId.HasValue ? new InterviewResultDao().GetById((int)obj.InterviewResultId).Name : "", new InterviewResultDao().GetById(result).Name); if (!string.IsNullOrEmpty(note)) { commonDao.InsertLogDetail(logId, "Interview Note", "Interview Note", obj.Note, note); } string key = obj.CandidateId.ToString() + " [" + obj.Candidate.FirstName + " " + obj.Candidate.MiddleName + " " + obj.Candidate.LastName + "]" + " for Interview in round " + obj.Round.Value.ToString() + " in " + obj.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; }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForInterview(Interview oldInfo, Interview newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { //case ELogAction.Insert: // // Insert to Master Log // commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.Interview.ToString(), action.ToString()); // // Write Insert Log // WriteInsertLogForInterview(newInfo, logId); // break; //case ELogAction.Update: // // Insert to Master Log // commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Interview.ToString(), action.ToString()); // // Write Update Log // bool isUpdated = WriteUpdateLogForInterview(newInfo, logId); // if (!isUpdated) // { // commonDao.DeleteMasterLog(logId); // } // break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Candidate.ToString(), action.ToString()); // Write Delete Log string key = newInfo.CandidateId.ToString() + " [" + newInfo.Candidate.FirstName + " " + newInfo.Candidate.MiddleName + " " + newInfo.Candidate.LastName + "]" + " for Interview in round " + (newInfo.Round.HasValue?newInfo.Round.Value.ToString():"") + " in " + (newInfo.InterviewDate.HasValue?newInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); break; } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateResult(STT_RefResult newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT oldSTTInfo = new STTDao().GetById(newInfo.SttID); if ((oldSTTInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.ResultId != oldSTTInfo.ResultId) { commonDao.InsertLogDetail(logId, "ResultId", "Result", oldSTTInfo.ResultId.HasValue?oldSTTInfo.STT_Result.Name:"", new STTResultDao().GetById(newInfo.ResultId).Name); if (newInfo.ResultId == Constants.STT_RESULT_FAIL) { commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_REJECTED).Name); } else { commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_NEED_TO_PROMOTED).Name); } } commonDao.InsertLogDetail(logId, "EndDate", "End Date", null, newInfo.EndDate.ToString(Constants.DATETIME_FORMAT_VIEW)); if (!string.IsNullOrEmpty(newInfo.Remarks)) { commonDao.InsertLogDetail(logId, "Remarks", "Remarks", null, newInfo.Remarks); } string[] array = newInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX); if (array.Count() > 0) { foreach (string item in array) { commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", null, item); } } // Insert Key Name string key = oldSTTInfo.ID + " [" + oldSTTInfo.FirstName + " " + oldSTTInfo.MiddleName + " " + oldSTTInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdatePromoted(STT newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT oldSTTInfo = new STTDao().GetById(newInfo.ID); if ((oldSTTInfo != null) && (newInfo != null) && (logId != null)) { commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_PROMOTED).Name); // Insert Key Name string key = oldSTTInfo.ID + " [" + oldSTTInfo.FirstName + " " + oldSTTInfo.MiddleName + " " + oldSTTInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "STT_ID", "Key for Update", key, null); } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateCompany(STT newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT oldInfo = new STTDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.JR != oldInfo.JR) { commonDao.InsertLogDetail(logId, "JR", "Job Request", oldInfo.JR, newInfo.JR); isUpdated = true; } if (newInfo.Project != oldInfo.Project) { commonDao.InsertLogDetail(logId, "Project", "Project", oldInfo.Project, newInfo.Project); isUpdated = true; } if (newInfo.ManagerId != oldInfo.ManagerId) { commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId); isUpdated = true; } if (newInfo.JRApproval != oldInfo.JRApproval) { commonDao.InsertLogDetail(logId, "JRApproval", "Job Request Approval", oldInfo.JRApproval, newInfo.JRApproval); isUpdated = true; } if (newInfo.StartDate != oldInfo.StartDate) { commonDao.InsertLogDetail(logId, "StartDate", "Start Date", oldInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW), newInfo.StartDate.ToString(Constants.DATETIME_FORMAT_VIEW)); isUpdated = true; } if (newInfo.ExpectedEndDate != oldInfo.ExpectedEndDate) { commonDao.InsertLogDetail(logId, "ContractedDate", "Contracted Date",oldInfo.ExpectedEndDate.HasValue? oldInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"",newInfo.ExpectedEndDate.HasValue? newInfo.ExpectedEndDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); isUpdated = true; } if (newInfo.DepartmentId != oldInfo.DepartmentId) { Department sub = new DepartmentDao().GetById(newInfo.DepartmentId); commonDao.InsertLogDetail(logId, "DepartmentId", "Sub Department", oldInfo.Department.DepartmentName, sub.DepartmentName); isUpdated = true; } if (newInfo.LaborUnion != oldInfo.LaborUnion) { commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union",oldInfo.LaborUnion.HasValue? oldInfo.LaborUnion == true ? "Yes" : "No":"",oldInfo.LaborUnion.HasValue? newInfo.LaborUnion == true ? "Yes" : "No":""); isUpdated = true; } if (newInfo.LaborUnionDate != oldInfo.LaborUnionDate) { commonDao.InsertLogDetail(logId, "LaborUnionDate", "Labor Union date", oldInfo.LaborUnionDate.HasValue ? oldInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "", newInfo.LaborUnionDate.HasValue ? newInfo.LaborUnionDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : ""); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateJR(Candidate newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Candidate.ToString(), action.ToString()); Candidate oldInfo = new CandidateDao().GetById(newInfo.ID.ToString()); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.JRId != oldInfo.JRId) { commonDao.InsertLogDetail(logId, "JRId", "Job Request", oldInfo.JRId.HasValue ? oldInfo.JRId.Value.ToString() : "", newInfo.JRId.HasValue ? newInfo.JRId.Value.ToString() : ""); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Insert Log For Interview /// </summary> /// <param name="objInfo"></param> /// <param name="logId"></param> public void WriteInsertLogForInterview(Interview objInfo, string templateRound, string jr, ELogAction action) { try { string logId = commonDao.UniqueId; if ((objInfo != null) && (logId != null)) { commonDao.InsertMasterLog(logId, objInfo.CreatedBy, ELogTable.Interview.ToString(), action.ToString()); // Insert to Log Detail commonDao.InsertLogDetail(logId, "ID", "ID", null, objInfo.Id.ToString()); if (objInfo.InterviewDate.HasValue) { commonDao.InsertLogDetail(logId, "InterviewDate", "Interview Date", null, objInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_FULL_LOG)); } if (!string.IsNullOrEmpty(objInfo.Venue)) { commonDao.InsertLogDetail(logId, "Venue", "Venue", null, objInfo.Venue); } if (!string.IsNullOrEmpty(objInfo.Pic)) { commonDao.InsertLogDetail(logId, "Pic", "Pic", null, objInfo.Pic); } if (!string.IsNullOrEmpty(objInfo.Content)) { commonDao.InsertLogDetail(logId, "Content", "Content", null, objInfo.Content); } if (objInfo.CandidateId.HasValue) { commonDao.InsertLogDetail(logId, "CandidateId", "Candidate Id", null, objInfo.CandidateId.Value.ToString()); } if (objInfo.InterviewStatusId.HasValue) { commonDao.InsertLogDetail(logId, "InterviewStatusId", "Interview Status Id", null, new InterviewStatusDao().GetById(objInfo.InterviewStatusId.Value).Name); } if (objInfo.Round.HasValue) { commonDao.InsertLogDetail(logId, "Round", "Round", null, objInfo.Round.Value.ToString()); } if (objInfo.InterviewResultId.HasValue) { commonDao.InsertLogDetail(logId, "InterviewResultId", "Interview Result Id", null, new InterviewResultDao().GetById(objInfo.InterviewResultId.Value).Name); } if (!string.IsNullOrEmpty(objInfo.Note)) { commonDao.InsertLogDetail(logId, "Note", "Note", null, objInfo.Note); } if (objInfo.OldInterView.HasValue) { commonDao.InsertLogDetail(logId, "OldInterView", "Old InterView", null, objInfo.OldInterView.HasValue ? objInfo.OldInterView.Value == false ? "No" : "Yes" : ""); } if (objInfo.IsSentMailCandidate.HasValue) { commonDao.InsertLogDetail(logId, "IsSentMailCandidate", "IsSentMailCandidate", null,objInfo.IsSentMailCandidate.HasValue?objInfo.IsSentMailCandidate.Value == false ? "No" : "Yes":""); } if (objInfo.IsSendMailInterviewer.HasValue) { commonDao.InsertLogDetail(logId, "IsSendMailInterviewer", "IsSendMailInterviewer", null, objInfo.IsSendMailInterviewer.HasValue?objInfo.IsSendMailInterviewer.Value == false ? "No" : "Yes":""); } if (!string.IsNullOrEmpty(templateRound)) { commonDao.InsertLogDetail(logId, "TemplateRound", "TemplateRound", null, new EformDao().GetEFormMasterByID(templateRound).Name); } if (!string.IsNullOrEmpty(jr)) { commonDao.InsertLogDetail(logId, "JobRequest", "Job Request", null, jr); } // Insert Key Name string key = objInfo.CandidateId.ToString() + " [" + objInfo.Candidate.FirstName + " " + objInfo.Candidate.MiddleName + " " + objInfo.Candidate.LastName + "]" + " for Interview in round " + (objInfo.Round.HasValue?objInfo.Round.Value.ToString():"") + " in " + (objInfo.InterviewDate.HasValue? objInfo.InterviewDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):""); commonDao.InsertLogDetail(logId, "ID", "Key for Insert", null, key); } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForSR(SR_ServiceRequest oldInfo, SR_ServiceRequest newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; string[] colNameArr = new string[] { "CategoryID", "Title", "Description", "SubmitUser", "RequestUser", "CCList", "UrgencyID", "Files", "OldId","StatusID", "AssignUser", "DueDate"}; string[] colDisplayNameArr = new string[] { "Category", "Title", "Description", "Submit User", "Request User", "CCList", "Urgency", "Attachments", "Related SR","Status", "Assign User", "Due Date"}; string[] oldValueArr = null; if (oldInfo != null) { oldValueArr = new string[] { oldInfo.CategoryID.ToString(), CommonFunc.SubStringRoundWord(oldInfo.Title, 100), CommonFunc.SubStringRoundWord(oldInfo.Description, 100), oldInfo.SubmitUser, oldInfo.RequestUser, oldInfo.CCList, oldInfo.UrgencyID.ToString(), oldInfo.Files, oldInfo.OldId.HasValue ? oldInfo.OldId.Value.ToString() : null, oldInfo.StatusID.ToString(), oldInfo.AssignUser, oldInfo.DueDate.HasValue ? oldInfo.DueDate.Value.ToString(Constants.DATETIME_FORMAT_FULL) : null}; } string[] newValueArr = new string[] { newInfo.CategoryID.ToString(), CommonFunc.SubStringRoundWord(newInfo.Title, 100), CommonFunc.SubStringRoundWord(newInfo.Description, 100), newInfo.SubmitUser, newInfo.RequestUser, newInfo.CCList, newInfo.UrgencyID.ToString(), newInfo.Files, newInfo.OldId.HasValue ? newInfo.OldId.Value.ToString() : null, newInfo.StatusID.ToString(), newInfo.AssignUser, newInfo.DueDate.HasValue ? newInfo.DueDate.Value.ToString(Constants.DATETIME_FORMAT_FULL) : null}; switch (action) { case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.ServiceRequest.ToString(), action.ToString()); // Write Delete Log string key = newInfo.ID + " [" + newInfo.Title + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); break; case ELogAction.Insert: commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.ServiceRequest.ToString(), action.ToString(), LogType.ServiceRequest); commonDao.InsertLogDetail(logId, "ID", "Key for Insert", null, newInfo.ID.ToString()); for (int i = 0; i < colNameArr.Length; i++) commonDao.InsertLogDetail(logId, colNameArr[i], colDisplayNameArr[i], null, newValueArr[i]); break; case ELogAction.Update: commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.ServiceRequest.ToString(), action.ToString(), LogType.ServiceRequest); bool isChanged = false; for (int i = 0; i < colNameArr.Length; i++) { if (oldValueArr[i] != newValueArr[i]) { commonDao.InsertLogDetail(logId, colNameArr[i], colDisplayNameArr[i], oldValueArr[i], newValueArr[i]); isChanged = true; } } if(isChanged) commonDao.InsertLogDetail(logId, "ID", "Key for Update", oldInfo.ID.ToString() + "[" + newInfo.UpdatedBy + "]", null); break; default: break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Log For Employee /// </summary> /// <param name="oldInfo"></param> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForEmployee(Employee oldInfo, Employee newInfo, ELogAction action) { try { if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; switch (action) { case ELogAction.Insert: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.CreatedBy, ELogTable.Employee.ToString(), action.ToString()); // Write Insert Log WriteInsertLogForEmployee(newInfo, logId); break; case ELogAction.Update: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); // Write Update Log bool isUpdated = WriteUpdateLogForEmployee(newInfo, logId); if (!isUpdated) { commonDao.DeleteMasterLog(logId); } break; case ELogAction.Delete: // Insert to Master Log commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); // Write Delete Log string key = newInfo.ID + " [" + newInfo.FirstName + " " + newInfo.MiddleName + " " + newInfo.LastName + "]"; if (newInfo.EmpStatusId == Constants.RESIGNED) { commonDao.InsertLogDetail(logId, "ID", "Key for Resign", key, null); if (newInfo.ResignedAllowance.HasValue) { commonDao.InsertLogDetail(logId, "ResignedAllowance", "Resigned Allowance", newInfo.ResignedAllowance.HasValue?newInfo.ResignedAllowance.Value.ToString():"", null); } if (!string.IsNullOrEmpty(newInfo.ResignedReason)) { commonDao.InsertLogDetail(logId, "ResignedReason", "Resigned Reason", newInfo.ResignedReason, null); } commonDao.InsertLogDetail(logId, "ResignedDate", "Resigned Date",newInfo.ResignedDate.HasValue? newInfo.ResignedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"", null); } else { commonDao.InsertLogDetail(logId, "ID", "Key for Delete", key, null); } break; } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Update Log For When Role Manager /// </summary> /// <param name="newInfo"></param> /// <param name="logId"></param> /// <returns></returns> public void WriteUpdateLogForRoleManager(JobRequest newInfo,ELogAction action) { bool isUpdated = false; try { // Get old info string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.JobRequest.ToString(), action.ToString()); JobRequest oldInfo = new JobRequestDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.WFStatusID != oldInfo.WFStatusID) { commonDao.InsertLogDetail(logId, "WFStatusID", "Status", oldInfo.WFStatus.Name, new WFStatusDao().GetByID(newInfo.WFStatusID).Name); isUpdated = true; } if (newInfo.WFResolutionID != oldInfo.WFResolutionID) { WFResolution objRes = new ResolutionDao().GetByID(newInfo.WFResolutionID); if (objRes != null) { commonDao.InsertLogDetail(logId, "WFResolutionID", "Resolution", oldInfo.WFResolution.Name, objRes.Name); isUpdated = true; } } if (newInfo.AssignRole != oldInfo.AssignRole) { if (newInfo.AssignRole.HasValue) { WFRole obj = new RoleDao().GetByID(newInfo.AssignRole.Value); if (obj != null) { UserAdmin objUserAdmin = new UserAdminDao().GetById(newInfo.AssignID.Value); if (objUserAdmin != null) { commonDao.InsertLogDetail(logId, "AssignID", " Forward to", oldInfo.UserAdmin1.UserName + " (" + oldInfo.WFRole.Name + ")", objUserAdmin.UserName + " (" + obj.Name + ")"); isUpdated = true; } } } } if (isUpdated) { // Insert Key Name string key = Constants.JOB_REQUEST_PREFIX + oldInfo.ID.ToString(); commonDao.InsertLogDetail(logId, "EmployeeId", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateContact(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.HomePhone != oldInfo.HomePhone) { commonDao.InsertLogDetail(logId, "HomePhone", "Home Phone", oldInfo.HomePhone, newInfo.HomePhone); isUpdated = true; } if (newInfo.CellPhone != oldInfo.CellPhone) { commonDao.InsertLogDetail(logId, "CellPhone", "Cell Phone", oldInfo.CellPhone, newInfo.CellPhone); isUpdated = true; } if (newInfo.ExtensionNumber != oldInfo.ExtensionNumber) { commonDao.InsertLogDetail(logId, "ExtensionNumber", "Extension Number", oldInfo.ExtensionNumber, newInfo.ExtensionNumber); isUpdated = true; } if (newInfo.LocationCode != oldInfo.LocationCode) { commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode)); isUpdated = true; } if (newInfo.SkypeId != oldInfo.SkypeId) { commonDao.InsertLogDetail(logId, "SkypeId", "SkypeId", oldInfo.SkypeId, newInfo.SkypeId); isUpdated = true; } if (newInfo.YahooId != oldInfo.YahooId) { commonDao.InsertLogDetail(logId, "YahooId", "YahooId", oldInfo.YahooId, newInfo.YahooId); isUpdated = true; } if (newInfo.PersonalEmail != oldInfo.PersonalEmail) { commonDao.InsertLogDetail(logId, "PersonalEmail", "Personal Email", oldInfo.PersonalEmail, newInfo.PersonalEmail); isUpdated = true; } if (newInfo.OfficeEmail != oldInfo.OfficeEmail) { commonDao.InsertLogDetail(logId, "OfficeEmail", "Office Email", oldInfo.OfficeEmail, newInfo.OfficeEmail); isUpdated = true; } if (newInfo.EmergencyContactName != oldInfo.EmergencyContactName) { commonDao.InsertLogDetail(logId, "EmergencyContactName", "Emergency Contact Name", oldInfo.EmergencyContactName, newInfo.EmergencyContactName); isUpdated = true; } if (newInfo.EmergencyContactPhone != oldInfo.EmergencyContactPhone) { commonDao.InsertLogDetail(logId, "EmergencyContactPhone", "Emergency Contact Phone", oldInfo.EmergencyContactPhone, newInfo.EmergencyContactPhone); isUpdated = true; } if (newInfo.EmergencyContactRelationship != oldInfo.EmergencyContactRelationship) { commonDao.InsertLogDetail(logId, "EmergencyContactRelationship", "Emergency Contact Relationship", oldInfo.EmergencyContactRelationship, newInfo.EmergencyContactRelationship); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForRemoveAttachFile(STT_RefResult newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT_RefResult oldInfo = new STTRefResultDao().GetById(newInfo.SttID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { foreach (string item in oldInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX)) { if (!newInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX).Contains(item)) { commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", item, ""); isUpdated = true; } } if (isUpdated) { // Insert Key Name STT obj = new STTDao().GetById(oldInfo.SttID); string key = oldInfo.SttID + " [" + obj.FirstName + " " + obj.MiddleName + " " + obj.LastName + "]"; commonDao.InsertLogDetail(logId, "STT_ID", "Key for Delete", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="newInfo"></param> /// <param name="action"></param> public void WriteLogForUpdatePosition(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.ManagerId != oldInfo.ManagerId) { commonDao.InsertLogDetail(logId, "Manager", "Manager", oldInfo.ManagerId, newInfo.ManagerId); isUpdated = true; } if (newInfo.Project != oldInfo.Project) { commonDao.InsertLogDetail(logId, "Project", "Project", oldInfo.Project, newInfo.Project); isUpdated = true; } if (newInfo.Floor != oldInfo.Floor) { commonDao.InsertLogDetail(logId, "Floor", "Floor", oldInfo.Floor, newInfo.Floor); isUpdated = true; } if (newInfo.SeatCode != oldInfo.SeatCode) { commonDao.InsertLogDetail(logId, "SeatCode", "SeatCode", oldInfo.SeatCode, newInfo.SeatCode); isUpdated = true; } if (newInfo.LocationCode != oldInfo.LocationCode) { commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode)); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
/// <summary> /// Write Update Log For When Approve or Reject /// </summary> /// <param name="newInfo"></param> /// <param name="logId"></param> /// <returns></returns> public void WriteUpdateLogForRoleHR(JobRequest newInfo, ELogAction action) { try { bool isUpdate = false; // Get old info string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.JobRequest.ToString(), action.ToString()); JobRequest oldInfo = new JobRequestDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (oldInfo.AssignID != newInfo.AssignID) { string oldUser = ""; if (oldInfo.AssignID != null && oldInfo.AssignID.HasValue) { UserAdmin userAdmin = userAdmintDao.GetById(oldInfo.AssignID.Value); oldUser = userAdmin != null ? userAdmin.UserName : ""; } string newUser = ""; if (newInfo.AssignID != null && newInfo.AssignID.HasValue) { UserAdmin userAdmin = userAdmintDao.GetById(newInfo.AssignID.Value); newUser = userAdmin != null ? userAdmin.UserName : ""; } commonDao.InsertLogDetail(logId, "Forward To", "Forward To", oldUser, newUser); isUpdate = true; } /* if (oldInfo.AssignRole != newInfo.AssignRole) { string oldVal = oldInfo.AssignRole.HasValue ? oldInfo.AssignRole.ToString() : ""; string newVal = (newInfo.AssignRole != null && newInfo.AssignRole.HasValue) ? newInfo.AssignRole.ToString() : ""; commonDao.InsertLogDetail(logId, "AssignRole", "AssignRole", oldVal, newVal); isUpdate = true; } if (oldInfo.InvolveID != newInfo.InvolveID) { commonDao.InsertLogDetail(logId, "InvolveID", "InvolveID", oldInfo.InvolveID, newInfo.InvolveID); isUpdate = true; } if (oldInfo.InvolveRole != newInfo.InvolveRole) { commonDao.InsertLogDetail(logId, "InvolveRole", "InvolveRole", oldInfo.InvolveRole, newInfo.InvolveRole); isUpdate = true; } if (oldInfo.InvolveDate != newInfo.InvolveDate) { commonDao.InsertLogDetail(logId, "InvolveDate", "InvolveDate", oldInfo.InvolveDate, newInfo.InvolveDate); isUpdate = true; } if (oldInfo.InvolveResolution != newInfo.InvolveResolution) { commonDao.InsertLogDetail(logId, "InvolveResolution", "InvolveResolution", oldInfo.InvolveResolution, newInfo.InvolveResolution); isUpdate = true; }*/ if (isUpdate) { // Insert Key Name string key = Constants.JOB_REQUEST_PREFIX + oldInfo.ID.ToString(); commonDao.InsertLogDetail(logId, "EmployeeId", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForUpdateAddress(Employee newInfo, ELogAction action) { try { bool isUpdated = false; if (newInfo == null) { return; } MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.Employee.ToString(), action.ToString()); Employee oldInfo = new EmployeeDao().GetById(newInfo.ID); if ((oldInfo != null) && (newInfo != null) && (logId != null)) { if (newInfo.PermanentAddress != oldInfo.PermanentAddress) { commonDao.InsertLogDetail(logId, "PermanentAddress", "Permanent Address", oldInfo.PermanentAddress, newInfo.PermanentAddress); isUpdated = true; } if (newInfo.PermanentArea != oldInfo.PermanentArea) { commonDao.InsertLogDetail(logId, "PermanentArea", "Permanent Ward", oldInfo.PermanentArea, newInfo.PermanentArea); isUpdated = true; } if (newInfo.PermanentDistrict != oldInfo.PermanentDistrict) { commonDao.InsertLogDetail(logId, "PermanentDistrict", "Permanent District", oldInfo.PermanentDistrict, newInfo.PermanentDistrict); isUpdated = true; } if (newInfo.PermanentCityProvince != oldInfo.PermanentCityProvince) { commonDao.InsertLogDetail(logId, "PermanentCityProvince", "Permanent City Province", oldInfo.PermanentCityProvince, newInfo.PermanentCityProvince); isUpdated = true; } if (newInfo.PermanentCountry != oldInfo.PermanentCountry) { commonDao.InsertLogDetail(logId, "PermanentCountry", "Permanent Country", oldInfo.PermanentCountry, newInfo.PermanentCountry); isUpdated = true; } if (newInfo.TempAddress != oldInfo.TempAddress) { commonDao.InsertLogDetail(logId, "TempAddress", "Temp Address", oldInfo.TempAddress, newInfo.TempAddress); isUpdated = true; } if (newInfo.TempArea != oldInfo.TempArea) { commonDao.InsertLogDetail(logId, "TempArea", "Temp Area", oldInfo.TempArea, newInfo.TempArea); isUpdated = true; } if (newInfo.TempDistrict != oldInfo.TempDistrict) { commonDao.InsertLogDetail(logId, "TempDistrict", "Temp District", oldInfo.TempDistrict, newInfo.TempDistrict); isUpdated = true; } if (newInfo.TempCityProvince != oldInfo.TempCityProvince) { commonDao.InsertLogDetail(logId, "TempCityProvince", "Temp City Province", oldInfo.TempCityProvince, newInfo.TempCityProvince); isUpdated = true; } if (newInfo.TempCountry != oldInfo.TempCountry) { commonDao.InsertLogDetail(logId, "TempCountry", "Temp Country", oldInfo.TempCountry, newInfo.TempCountry); isUpdated = true; } if (newInfo.VnPermanentAddress != oldInfo.VnPermanentAddress) { commonDao.InsertLogDetail(logId, "VnPermanentAddress", "Vn Permanent Address", oldInfo.VnPermanentAddress, newInfo.VnPermanentAddress); isUpdated = true; } if (newInfo.VnPermanentArea != oldInfo.VnPermanentArea) { commonDao.InsertLogDetail(logId, "VnPermanentArea", "Vn Permanent Area", oldInfo.VnPermanentArea, newInfo.VnPermanentArea); isUpdated = true; } if (newInfo.VnPermanentDistrict != oldInfo.VnPermanentDistrict) { commonDao.InsertLogDetail(logId, "VnPermanentDistrict", "Vn Permanent District", oldInfo.VnPermanentDistrict, newInfo.VnPermanentDistrict); isUpdated = true; } if (newInfo.VnPermanentCityProvince != oldInfo.VnPermanentCityProvince) { commonDao.InsertLogDetail(logId, "VnPermanentCityProvince", "Vn Permanent City Province", oldInfo.VnPermanentCityProvince, newInfo.VnPermanentCityProvince); isUpdated = true; } if (newInfo.VnPermanentCountry != oldInfo.VnPermanentCountry) { commonDao.InsertLogDetail(logId, "VnPermanentCountry", "Vn Permanent Country", oldInfo.VnPermanentCountry, newInfo.VnPermanentCountry); isUpdated = true; } if (newInfo.VnTempAddress != oldInfo.VnTempAddress) { commonDao.InsertLogDetail(logId, "VnTempAddress", "Vn Temp Address", oldInfo.VnTempAddress, newInfo.VnTempAddress); isUpdated = true; } if (newInfo.VnTempArea != oldInfo.VnTempArea) { commonDao.InsertLogDetail(logId, "VnTempArea", "Vn Temp Area", oldInfo.VnTempArea, newInfo.VnTempArea); isUpdated = true; } if (newInfo.VnTempCityProvince != oldInfo.VnTempCityProvince) { commonDao.InsertLogDetail(logId, "VnTempCityProvince", "Vn Temp City Province", oldInfo.VnTempCityProvince, newInfo.VnTempCityProvince); isUpdated = true; } if (newInfo.VnTempCountry != oldInfo.VnTempCountry) { commonDao.InsertLogDetail(logId, "VnTempCountry", "Vn Temp Country", oldInfo.VnTempCountry, newInfo.VnTempCountry); isUpdated = true; } if (isUpdated) { // Insert Key Name string key = oldInfo.ID + " [" + oldInfo.FirstName + " " + oldInfo.MiddleName + " " + oldInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }
public void WriteLogForEditResult(STT_RefResult newInfo, ELogAction action) { try { if (newInfo == null) { return; } bool isUpdated = false; MasterLog objMasterLog = new MasterLog(); string logId = commonDao.UniqueId; commonDao.InsertMasterLog(logId, newInfo.UpdatedBy, ELogTable.STT.ToString(), action.ToString()); STT oldSTTInfo = new STTDao().GetById(newInfo.SttID); STT_RefResult oldInfo = new STTRefResultDao().GetById(newInfo.SttID); if ((oldSTTInfo != null) && (newInfo != null) && (logId != null)) { if (oldInfo.Remarks != newInfo.Remarks) { commonDao.InsertLogDetail(logId, "Remarks", "Remarks", oldInfo.Remarks, newInfo.Remarks); isUpdated = true; } if (oldInfo.Attachfile != newInfo.Attachfile) { //string[] arrayNew = newInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX); //foreach (string fileNew in arrayNew) //{ // if (!oldInfo.Attachfile.Contains(fileNew)) // { // commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", "", fileNew); // isUpdated = true; // } //} string[] Attachfile = newInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX); foreach (string item in oldInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX))//case delete file { if (!newInfo.Attachfile.TrimEnd(Constants.FILE_CHAR_PREFIX).Split(Constants.FILE_CHAR_PREFIX).Contains(item)) { commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", item, ""); isUpdated = true; } } foreach (string fileNew in Attachfile) //case add new file { if (!oldInfo.Attachfile.Contains(fileNew)) { commonDao.InsertLogDetail(logId, "AttachFile", "Attach File", "", fileNew); isUpdated = true; } } } if (oldInfo.ResultId != newInfo.ResultId) { if (newInfo.ResultId == Constants.STT_RESULT_FAIL) { isUpdated = true; commonDao.InsertLogDetail(logId, "ResultId", "Result", oldInfo.STT_Result.Name,new STTResultDao().GetById(newInfo.ResultId).Name); commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_REJECTED).Name); } if (newInfo.ResultId == Constants.STT_RESULT_PASS) { isUpdated = true; commonDao.InsertLogDetail(logId, "ResultId", "Result", oldInfo.STT_Result.Name, new STTResultDao().GetById(newInfo.ResultId).Name); commonDao.InsertLogDetail(logId, "STTStatusId", "Status", oldSTTInfo.STT_Status.Name, new STTStatusDao().GetById(Constants.STT_STATUS_NEED_TO_PROMOTED).Name); } } if (oldInfo.EndDate != newInfo.EndDate) { isUpdated = true; commonDao.InsertLogDetail(logId, "EndDate", "End Date", oldInfo.EndDate.ToString(Constants.DATETIME_FORMAT_VIEW), newInfo.EndDate.ToString(Constants.DATETIME_FORMAT_VIEW)); } // Insert Key Name if (isUpdated) { string key = oldSTTInfo.ID + " [" + oldSTTInfo.FirstName + " " + oldSTTInfo.MiddleName + " " + oldSTTInfo.LastName + "]"; commonDao.InsertLogDetail(logId, "STT_ID", "Key for Update", key, null); } else { commonDao.DeleteMasterLog(logId); } } } catch (Exception ex) { throw ex; } }