public void ProcessRequest(HttpContext context)
        {
            string name = context.Request.QueryString["q"];
            string pageName = context.Request.QueryString["Page"];

            #region pageName
            switch (pageName)
            {
                case "JRAdmin":
                    //JRAdminDao jrDao = new JRAdminDao();
                    //List<sp_GetJRForAdminResult> listJRAdmin = jrDao.GetListByName(name, 0, 0);
                    //var finalListJRAdmin = listJRAdmin.Select(p => p.UserName).Distinct();
                    //foreach (string item in finalListJRAdmin)
                    //{
                    //    context.Response.Write(item + Environment.NewLine);
                    //}

                    UserAdminDao userAdminDao = new UserAdminDao();
                    List<UserAdmin> listUserAdmin = userAdminDao.GetList().Where(p => p.UserName.ToLower().Contains(name)).ToList<UserAdmin>();
                    foreach (UserAdmin item in listUserAdmin)
                    {
                        Employee objEmployee = new EmployeeDao().GetByOfficeEmailInActiveList(item.UserName + Constants.PREFIX_EMAIL_LOGIGEAR);
                        string displayName = item.UserName;
                        if (objEmployee != null)
                        {
                            displayName += " - " + objEmployee.ID;
                        }
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "Group":
                    GroupDao groupDao = new GroupDao();
                    List<Group> listGroup = groupDao.GetListByName(name);
                    foreach (Group item in listGroup)
                    {
                        context.Response.Write(item.GroupName + Environment.NewLine);
                    }
                    break;
                case "Employee":
                    EmployeeDao empDao = new EmployeeDao();
                    int isActive = int.Parse(context.Request.QueryString["IsActive"]);
                    List<sp_GetEmployeeResult> empList = new List<sp_GetEmployeeResult>();
                    if (isActive == Constants.EMPLOYEE_ACTIVE)
                    {
                        empList = empDao.GetListByName(name, isActive, Constants.RESIGNED);
                    }
                    else if (isActive == Constants.EMPLOYEE_NOT_ACTIVE)
                    {
                        empList = empDao.GetListByName(name, isActive, Constants.RESIGNED);
                    }
                    //var finalListEmployee = empList.Select(p => p.DisplayName).Distinct();
                    foreach (sp_GetEmployeeResult item in empList)
                    {
                        context.Response.Write(item.DisplayName + " - " + item.ID + Environment.NewLine);
                    }
                    break;
                case "AssignEmployee":
                    ExamDao examDao = new ExamDao();
                    EmployeeDao employeeDao = new EmployeeDao();
                    int examID = int.Parse(context.Request.QueryString[CommonDataKey.EXAM_ID]);
                    List<sp_GetEmployeeResult> employeeList = new List<sp_GetEmployeeResult>();
                    employeeList = employeeDao.GetListByName(name, Constants.EMPLOYEE_ACTIVE, Constants.RESIGNED);
                    List<string> assignedEmployeeListID = examDao.AssignedEmployeeListID(examID);
                    employeeList = employeeList.Where(c => !assignedEmployeeListID.Contains(c.ID)).ToList<sp_GetEmployeeResult>();

                    var finalListEmp = employeeList.Select(p => p.DisplayName).Distinct();
                    foreach (string item in finalListEmp)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }

                    break;
                case "UserAdmin":
                    //UserAdminDao userAdminDao = new UserAdminDao();
                    //List<UserAdmin> listUserAdmin = userAdminDao.GetList().Where(p => p.UserName.ToLower().Contains(name)).ToList<UserAdmin>();
                    //foreach (UserAdmin item in listUserAdmin)
                    //{
                    //    context.Response.Write(item.UserName + Environment.NewLine);
                    //}
                    List<String> listUser = new List<string>();
                    System.DirectoryServices.SearchResultCollection entriesUser = CommonFunc.GetDomainUserList(name);

                    foreach (System.DirectoryServices.SearchResult searchResult in entriesUser)
                    {
                        System.DirectoryServices.DirectoryEntry entry = searchResult.GetDirectoryEntry();

                        if (entry.Properties["mail"] != null)
                        {
                            if (entry.Properties["mail"].Count > 0)
                            {

                                string displayName = entry.Properties[CommonFunc.GetDomainUserProperty(DomainUserProperty.LoginName)][0].ToString();
                                //string emailAddress = entry.Properties[CommonFunc.GetDomainUserProperty(DomainUserProperty.OutlookEmail)][0].ToString();
                                Employee objEmployee = new EmployeeDao().GetByOfficeEmailInActiveList(displayName + Constants.PREFIX_EMAIL_LOGIGEAR);
                                string item = displayName;
                                if (objEmployee != null)
                                {
                                    item += " - " + objEmployee.ID;
                                }
                                // +" &lt;" + emailAddress + "&gt;";
                                context.Response.Write(item + Environment.NewLine);
                            }
                        }
                    }
                    break;
                case "UserLogs":
                    //List<sp_LogMasterResult> logList = new LogDao().GetList("", "");
                    //var finalList = logList.Select(p => p.UserName).Distinct();

                    List<CRM.Models.Entities.MasterLogEntity> logList = new LogDao().GetQueryList("", "").ToList();
                    var finalList = logList.Select(p => p.UserName).Distinct();
                    foreach (string item in finalList)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;

                case "STT":
                    STTDao sttDao = new STTDao();
                    List<sp_GetSTTResult> listSTT = sttDao.GetListByName(name);
                    foreach (sp_GetSTTResult item in listSTT)
                    {
                        context.Response.Write(item.DisplayName + " - " + item.ID + Environment.NewLine);
                    }
                    break;

                case "Candidate":
                    CandidateDao candidateDao = new CandidateDao();
                    List<sp_GetCandidateResult> result = candidateDao.GetList(name, 0, 0, 0, "", "", 0);
                    List<String> lstDisplayName = result.Select(p => p.DisplayName).ToList();
                    foreach (string item in lstDisplayName)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;
                case "AssignCandidate":
                    ExamDao exDao = new ExamDao();
                    CandidateDao canDao = new CandidateDao();
                    int exID = int.Parse(context.Request.QueryString[CommonDataKey.EXAM_ID]);
                    List<sp_GetCandidateResult> canList = canDao.GetList(name, 0, 0, 0, "", "", 0);
                    List<int> assignedCandidateListID = exDao.AssignedCandidateListID(exID);
                    canList = canList.Where(c => !assignedCandidateListID.Contains(c.ID)).ToList<sp_GetCandidateResult>();
                    List<String> canListDisplayName = canList.Select(p => p.DisplayName).ToList();
                    foreach (string item in canListDisplayName)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;
                case "JR":
                    string action = context.Request.QueryString["Action"];

                    if (string.IsNullOrEmpty(action) || action == "undefined")
                    {
                        List<sp_GetJobRequestCompleteResult> listJr = new List<sp_GetJobRequestCompleteResult>();
                        listJr = new JobRequestDao().GetJRListComplete(name, 0, 0, 0, null, 0);
                        foreach (sp_GetJobRequestCompleteResult item in listJr)
                        {
                            context.Response.Write(Constants.JOB_REQUEST_ITEM_PREFIX + item.ID + Environment.NewLine);
                        }
                    }
                    else
                    {
                        List<sp_GetJobRequestCompleteInterviewResult> listJr = new List<sp_GetJobRequestCompleteInterviewResult>();
                        name = name.Replace("j", "");
                        name = name.Replace("r", "");
                        name = name.Replace("-", "");
                        listJr = new JobRequestDao().GetJRListInterView(name, 0, 0, 0, 0);

                        foreach (sp_GetJobRequestCompleteInterviewResult item in listJr)
                        {
                            context.Response.Write(Constants.JOB_REQUEST_ITEM_PREFIX + item.ID + Environment.NewLine);
                        }
                    }

                    break;
                case "JRIndex":
                    string containsJR = Constants.JOB_REQUEST_PREFIX;
                    JobRequestItemDao jrItemDao = new JobRequestItemDao ();
                    if (containsJR.ToLower().Contains(name.ToLower()) ||
                        Constants.JOB_REQUEST_ITEM_PREFIX.ToLower().Contains(name.ToLower()))
                    {
                        name = string.Empty;
                    }
                    string assignRole = context.Request.QueryString["Role"];
                    List<sp_GetJobRequestResult> listJrIndex =
                        new JobRequestDao().GetList(name, 0, 0, 0, 0, 0, assignRole, 0);
                    foreach (sp_GetJobRequestResult item in listJrIndex)
                    {
                        context.Response.Write(Constants.JOB_REQUEST_PREFIX + item.ID + Environment.NewLine);
                        List<JobRequestItem> jrItems = jrItemDao.GetListByJrId(item.ID);
                        foreach (JobRequestItem subItem in jrItems)
                        {
                            if (subItem.ID.ToString().ToLower().Contains(name.ToLower()))
                            {
                                context.Response.Write(Constants.JOB_REQUEST_ITEM_PREFIX + subItem.ID + Environment.NewLine);
                            }
                        }
                    }
                    break;
                case "SendMail":
                    List<String> list = new List<string>();
                    System.DirectoryServices.SearchResultCollection entries = CommonFunc.GetDomainUserList(name);

                    foreach (System.DirectoryServices.SearchResult searchResult in entries)
                    {
                        System.DirectoryServices.DirectoryEntry entry = searchResult.GetDirectoryEntry();

                        if (entry.Properties["mail"] != null)
                        {
                            if (entry.Properties["mail"].Count > 0)
                            {

                                string displayName = entry.Properties[CommonFunc.GetDomainUserProperty(DomainUserProperty.LoginName)][0].ToString();
                                //string emailAddress = entry.Properties[CommonFunc.GetDomainUserProperty(DomainUserProperty.OutlookEmail)][0].ToString();
                                string item = displayName;// +" &lt;" + emailAddress + "&gt;";
                                context.Response.Write(item + Environment.NewLine);
                            }
                        }
                    }

                    break;
                case "PRIndex":
                    string containsPR = Constants.PR_REQUEST_PREFIX;
                    if (containsPR.ToLower().Contains(name))
                    {
                        name = string.Empty;
                    }
                    string roles = context.Request.QueryString["Role"];
                    string isViewAll = context.Request.QueryString["IsViewAll"];
                    int requestorId = 0;
                    string loginName = context.Request.QueryString["loginName"];
                    if (isViewAll.Equals("False") && roles == Constants.PR_REQUESTOR_ID.ToString())
                    {
                        requestorId = int.Parse(context.Request.QueryString["UserLoginId"]);
                    }

                    //List<sp_GetPurchaseRequestResult> listPrIndex = new PurchaseRequestDao().GetList(name, 0, 0, requestorId, 0, 0, roles, requestorId, loginName);
                    //List<sp_GetPurchaseRequestResult> listPrIndex = new PurchaseRequestDao().GetList(name, 0, 0, 0, 0, null, requestorId, int.Parse(roles), 0, false);
                    //chau.ly update 14.02.2012
                    List<sp_GetPurchaseRequestResult> listPrIndex = new PurchaseRequestDao().GetList(name, 0, 0, 0, 0, null, null, requestorId, int.Parse(roles), 0, false);
                    foreach (sp_GetPurchaseRequestResult item in listPrIndex)
                    {
                        context.Response.Write(Constants.PR_REQUEST_PREFIX + item.ID + Environment.NewLine);
                    }
                    break;

                case "Question":
                    QuestionDao qDao = new QuestionDao();
                    List<LOT_Question> listQuestion = qDao.GetListAutoComplete(name);
                    foreach (LOT_Question item in listQuestion)
                    {
                        context.Response.Write(CommonFunc.TruncateAroundSubText(item.QuestionContent, name) + Environment.NewLine);
                    }
                    break;
                case "Manager":
                    List<sp_GetManagerResult> listManager = new EmployeeDao().GetManager(name, 0, 0);
                    foreach (sp_GetManagerResult item in listManager)
                    {
                        context.Response.Write(item.DisplayName + Environment.NewLine);
                    }
                    break;
                case "University":
                    List<University> listUniversity = new CandidateDao().GetUniversityList("");
                    listUniversity = listUniversity.Where(p => p.Name.ToLower().Contains(name.ToLower())).ToList<University>();
                    foreach (University item in listUniversity)
                    {
                        context.Response.Write(item.Name + Environment.NewLine);
                    }
                    break;
                case "PTOAdmin":
                    List<sp_GetEmployeeManagerResult> listEmployeeManagerForAdmin = new EmployeeDao().GetEmployeeManager(name);
                    foreach (sp_GetEmployeeManagerResult item in listEmployeeManagerForAdmin)
                    {
                        string displayName = item.OfficeEmail.Replace(Constants.PREFIX_EMAIL_LOGIGEAR, "") + " - " + item.ID;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "PTO_User":
                    var listEmployeeManager = new EmployeeDao().GetManager(name, 0, 0);
                    empDao = new EmployeeDao();
                    foreach (var item in listEmployeeManager)
                    {
                        context.Response.Write(empDao.FullName(item.ID, Constants.FullNameFormat.FirstMiddleLast) + " - " + item.ID + Environment.NewLine);
                    }
                    break;
                case "PTOCC":
                    EmployeeDao emplDao = new EmployeeDao();
                    List<sp_GetEmployeeResult> listEmpl = emplDao.GetListByName(name, Constants.EMPLOYEE_ACTIVE,
                                                                                Constants.RESIGNED);
                    string content = "";
                    foreach (sp_GetEmployeeResult item in listEmpl)
                    {
                        if (item.OfficeEmail != null)
                        {
                            string[] aTmp = item.OfficeEmail.Split('@');
                            content += aTmp[0] + Environment.NewLine;
                        }
                    }
                    context.Response.Write(content);
                    break;
                case "EmployeeWithID":
                    var empListWithId = new EmployeeDao().GetListByOfficeEmail(name).
                        Select(p => new { p.ID, p.OfficeEmail });
                    foreach (var item in empListWithId)
                    {
                        string displayName = item.OfficeEmail.Remove(item.OfficeEmail.IndexOf("@")) + " - " + item.ID;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "ManagerWithID":
                    var mgrList = new EmployeeDao().GetEmployeeManager(name);
                    foreach (sp_GetEmployeeManagerResult item in mgrList)
                    {
                        string displayName = item.OfficeEmail.Remove(item.OfficeEmail.IndexOf("@")) + " - " + item.ID;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "JobTitleLevel":
                    var jobTitleLevelList = new JobTitleLevelDao().GetList().Where(c => c.DisplayName.ToLower().Contains(name.Trim().ToLower()));
                    foreach (JobTitleLevel item in jobTitleLevelList)
                    {
                        string displayName = item.DisplayName;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "EditPosition":
                    var mgrList_EP = new EmployeeDao().GetListManagerWithAllAttr(name);
                    empDao = new EmployeeDao();
                    foreach (Employee item in mgrList_EP)
                    {
                        string displayName = empDao.FullName(item.ID,
                            Constants.FullNameFormat.FirstMiddleLast) + " - " + item.ID;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "Position":
                    empDao = new EmployeeDao();
                    string deptId = context.Request.QueryString["deptId"];
                    string subDeptId = context.Request.QueryString["subDeptId"];
                    string titleId = context.Request.QueryString["titleId"];
                    string project = context.Request.QueryString["project"];
                    string locationCode = null;
                    var positionList = empDao.GetListEmployeeAndSTT(name, ConvertUtil.ConvertToInt(deptId), ConvertUtil.ConvertToInt(subDeptId),
                        ConvertUtil.ConvertToInt(titleId),project, locationCode);
                    /*foreach (Employee item in positionList)
                    {
                        string displayName = CommonFunc.GetEmployeeFullName(item,
                            Constants.FullNameFormat.FirstMiddleLast);
                        context.Response.Write(displayName + Environment.NewLine);
                    }*/
                    foreach (sp_GetPositionResult item in positionList)
                    {
                        string displayName = item.FullName;
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "ManagerListPR":
                    string sStatus = context.Request.QueryString["status"];
                    string sNeed = context.Request.QueryString["need"];
                    var userName = HttpContext.Current.User.Identity.Name;

                    empDao = new EmployeeDao();
                    var prlist_Manager = empDao.GetPRList(CommonFunc.GetEmployeeByUserName(userName).ID,
                        name, sStatus, sNeed.Equals(Constants.PER_REVIEW_NEED_PR_LIST));
                    foreach (sp_GetEmployeesForPRResult item in prlist_Manager)
                    {
                        string displayName = empDao.FullName(item.ID,
                            Constants.FullNameFormat.FirstMiddleLast);
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "HRPR":
                    string status = context.Request.QueryString["status"];
                    string need = context.Request.QueryString["need"];

                    if (string.IsNullOrEmpty(status))
                        status = "0";
                    PerformanceReviewDao perDao = new PerformanceReviewDao();
                    var prlist = perDao.GetList(name, int.Parse(status), need.Equals(Constants.PER_REVIEW_NEED_PR_LIST), Constants.PRW_ROLE_HR_ID.ToString());
                    foreach (sp_GetEmployeesPRForHRResult item in prlist)
                    {
                        context.Response.Write(item.EmployeeName + Environment.NewLine);
                    }
                    break;
                case "PTOManager":
                    DateTime? from = null;
                    DateTime? to = null;
                    string month = context.Request.QueryString["month"];
                    string managerID = context.Request.QueryString["managerId"];
                    if (!string.IsNullOrEmpty(month))
                    {
                        try
                        {
                            // filter month is date end of month and this date dependent on configuration
                            // ex: month:Feb-2011 => from: 25-Feb-2011, to: 26-Feb-2011
                            to = DateTime.Parse(Constants.DATE_LOCK_PTO + month);
                            from = to.Value.AddMonths(-1).AddDays(1);
                        }
                        catch
                        {
                            // get mon by curent date
                            month = DateTime.Now.ToString(Constants.PTO_MANAGER_DATE_FORMAT);
                            to = DateTime.Parse(Constants.DATE_LOCK_PTO + month);
                            from = to.Value.AddMonths(-1).AddDays(1);
                        }
                    }
                    List<sp_GetPTOEmployeeListForManagerResult> listPTOUser = new PTODao().GetPTOEmpListForManager(name, 0, 0, 0, from, to, managerID,null);
                    List<string> finalListPTOUser = listPTOUser.Select(p => p.Submitter + " - " + p.EmployeeID).Distinct().ToList<string>();
                    foreach (string item in finalListPTOUser)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;
                case "WorkFlow":

                    int wfID = int.Parse(context.Request.QueryString["workflowID"]);

                    List<sp_GetJRForAdminResult> listUserAdminRole = new JRAdminDao().GetListByName(name, wfID, 0);
                    List<string> listStringName = listUserAdminRole.Select(q => q.UserName).Distinct().ToList();
                    foreach (string item in listStringName)
                    {
                        Employee objEmployee = new EmployeeDao().GetByOfficeEmailInActiveList(item + Constants.PREFIX_EMAIL_LOGIGEAR);
                        string displayName = item;
                        if (objEmployee != null)
                        {
                            displayName += " - " + objEmployee.ID;
                        }
                        context.Response.Write(displayName + Environment.NewLine);
                    }
                    break;
                case "LocationEmployee":
                    EmployeeDao empDao1 = new EmployeeDao();
                    List<sp_GetListEmployeeSttNotSeatResult> empList1 = new List<sp_GetListEmployeeSttNotSeatResult>();

                    empList1 = empDao1.GetListEmployeeNotSeat(name);

                    foreach (sp_GetListEmployeeSttNotSeatResult item in empList1)
                    {
                        context.Response.Write(item.FullName + " - " + item.ID + Environment.NewLine);
                    }
                    break;
                case "LocationChart":
                    EmployeeDao empDao2 = new EmployeeDao();

                    List<sp_GetEmployeeSTTListResult> empSttList = new List<sp_GetEmployeeSTTListResult>();

                    empSttList = empDao2.GetEmpSttList(name);
                    if (context.Request.QueryString.AllKeys.Contains("hasLocation"))
                        empSttList = empSttList.Where(p=>!string.IsNullOrEmpty(p.LocationCode)).ToList();
                    foreach (sp_GetEmployeeSTTListResult item in empSttList)
                    {
                        context.Response.Write(item.FullName + " - " + item.ID + Environment.NewLine);
                    }
                    break;
                case "MoveLocation":
                    LocationDao locatinoDao = new LocationDao();
                    var listSeatCode = locatinoDao.GetListSeatCode(name, 0, 0, 0, false);
                    foreach (var item in listSeatCode)
                    {
                        context.Response.Write(item.SeatCodeName + " (" + item.FloorName + ") - "
                             + item.SeatCodeID + Environment.NewLine);
                    }
                    break;
                case "ServiceRequest":
                    var listServiceRequestIT = new UserAdminDao().GetListITHelpDesk((int)Modules.ServiceRequestAdmin, (int)Permissions.ItHelpDesk);
                    foreach (var item in listServiceRequestIT)
                    {
                        context.Response.Write(item.Name + " -" + item.ID+ Environment.NewLine);
                    }
                    break;
                case "ServiceRequestSetting":
                    List<sp_GetSR_SettingResult> listSRSetting = new SRSettingDao().GetList(name,"",0,0);
                    List<string> listUserSetting = listSRSetting.Select(q => q.UserName).Distinct().ToList();
                    foreach (var item in listUserSetting)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;
                case "ClassPlaning":
                    int typeCourse = ConvertUtil.ConvertToInt(context.Request["TypeCourse"]);
                    int trainingStatus = ConvertUtil.ConvertToInt(context.Request["TrainingStatus"]);
                    List<sp_GetClassPlanningResult> listClassID = new TrainingCenterDao().GetList(name, 0, 0, trainingStatus, null, typeCourse);
                    List<string> listClassName = listClassID.Select(q => q.ClassID).Distinct().ToList();
                    foreach (var item in listClassName)
                    {
                        context.Response.Write(item + Environment.NewLine);
                    }
                    break;
                case "AAsset":
                    //List<A_Asset> aAssetList = new AAssetDao().GetParentAsset();
                    //foreach (var item in aAssetList)
                    //{
                    //    context.Response.Write(item.AssetId + Environment.NewLine);
                    //}
                    break;
            }
            #endregion

            string funcName = context.Request.QueryString["func"];
            #region funcName
            switch (funcName)
            {
                case "Employee":
                    EmployeeDao empDao = new EmployeeDao();
                    //type = 1 -> user name, type = 2 -> full name (first middle last)
                    int type = ConvertUtil.ConvertToInt(context.Request.QueryString["type"]);
                    //hasSuffixId = true -> include the Employee ID in the display result
                    bool hasSuffixId = !string.IsNullOrEmpty(context.Request.QueryString["suffixId"]);
                    //idFirst = true -> display the id first then display name
                    bool idFirst = !string.IsNullOrEmpty(context.Request.QueryString["idFirst"]);
                    if (type == 1)
                    {
                        var empList = empDao.GetListByOfficeEmail(name).Where(p=>!p.DeleteFlag);
                        foreach (var item in empList)
                        {
                            string suffix = "";
                            string mainValue = "";
                            if (hasSuffixId && !idFirst)
                            {
                                suffix = " - " + item.ID;
                                mainValue = item.OfficeEmail.Remove(item.OfficeEmail.IndexOf("@"));
                            }
                            else if (hasSuffixId && idFirst)
                            {
                                suffix = " - " + item.OfficeEmail.Remove(item.OfficeEmail.IndexOf("@"));
                                mainValue = item.ID;
                            }
                            string displayName = mainValue + suffix;
                            context.Response.Write(displayName + Environment.NewLine);
                        }
                    }
                    else if (type == 2)
                    {
                        var empList = empDao.GetList(name, 0, 0, 0, 1, 0).Where(p=>p.EmpStatusId != Constants.RESIGNED);
                        foreach (var item in empList)
                        {
                            string suffix = "";
                            string mainValue = "";
                            if (hasSuffixId && !idFirst)
                            {
                                suffix = " - " + item.ID;
                                mainValue = empDao.FullName(item.ID, Constants.FullNameFormat.FirstMiddleLast);
                            }
                            else if (hasSuffixId && idFirst)
                            {
                                suffix = " - " + empDao.FullName(item.ID, Constants.FullNameFormat.FirstMiddleLast);
                                mainValue = item.ID;
                            }
                            string displayName = mainValue + suffix;
                            context.Response.Write(displayName + Environment.NewLine);
                        }
                    }
                    break;
            }
            #endregion
        }
Esempio n. 2
0
        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;
            }
        }
Esempio n. 3
0
        public Message UpdatePromote(string sttID,string newID, Employee obj)
        {
            Message msg = null;
            try
            {
            #region Set Value for Employee
            STT objSTT = new STTDao().GetById(sttID);

            if (objSTT != null)
            {
                UpdateForPromoted(objSTT);
                //Insert Employee
                obj.OldEmployeeId = sttID;
                obj.ID = newID;
                obj.FirstName = objSTT.FirstName;
                obj.MiddleName = objSTT.MiddleName;
                obj.LastName = objSTT.LastName;
                obj.DOB = objSTT.DOB;
                obj.POB = objSTT.POB;
                obj.PlaceOfOrigin = objSTT.PlaceOfOrigin;
                obj.Nationality = objSTT.Nationality;
                obj.IDNumber = objSTT.IDNumber;
                obj.IssueDate = objSTT.IssueDate;
                obj.Gender = objSTT.Gender;
                obj.Religion = objSTT.Religion;
                obj.MarriedStatus = objSTT.MarriedStatus;
                obj.JR = objSTT.JR;
                obj.JRApproval = objSTT.JRApproval;
                obj.StartDate = objSTT.StartDate;
                obj.DepartmentId = objSTT.DepartmentId;
                obj.LaborUnion = objSTT.LaborUnion;
                obj.LaborUnionDate = objSTT.LaborUnionDate;
                obj.HomePhone = objSTT.HomePhone;
                obj.CellPhone = objSTT.CellPhone;
                obj.Floor = objSTT.Floor;
                obj.ExtensionNumber = objSTT.ExtensionNumber;
                obj.SeatCode = objSTT.SeatCode;
                obj.SkypeId = objSTT.SkypeId;
                obj.YahooId = objSTT.YahooId;
                obj.PersonalEmail = objSTT.PersonalEmail;
                obj.OfficeEmail = objSTT.OfficeEmail;
                obj.EmergencyContactName = objSTT.EmergencyContactName;
                obj.EmergencyContactPhone = objSTT.EmergencyContactPhone;
                obj.EmergencyContactRelationship = objSTT.EmergencyContactRelationship;
                obj.PermanentAddress = objSTT.PermanentAddress;
                obj.PermanentArea = objSTT.PermanentArea;
                obj.PermanentDistrict = objSTT.PermanentDistrict;
                obj.PermanentCityProvince = objSTT.PermanentCityProvince;
                obj.PermanentCountry = objSTT.PermanentCountry;
                obj.TempAddress = objSTT.TempAddress;
                obj.TempArea = objSTT.TempArea;
                obj.TempDistrict = objSTT.TempDistrict;
                obj.TempCityProvince = objSTT.TempCityProvince;
                obj.TempCountry = objSTT.TempCountry;
                obj.BankName = objSTT.BankName;
                obj.BankAccount = objSTT.BankAccount;
                obj.Remarks = objSTT.Remarks;
                obj.UpdateDate = DateTime.Now;
                obj.CreateDate = DateTime.Now;
                obj.VnFirstName = objSTT.VnFirstName;
                obj.VnMiddleName = objSTT.VnMiddleName;
                obj.VnLastName = objSTT.VnLastName;
                obj.VnPOB = objSTT.VnPOB;
                obj.VnPlaceOfOrigin = objSTT.VnPlaceOfOrigin;
                obj.Degree = objSTT.Degree;
                obj.OtherDegree = objSTT.OtherDegree;
                obj.Race = objSTT.Race;
                obj.IDIssueLocation = objSTT.IDIssueLocation;
                obj.VnIDIssueLocation = objSTT.VnIDIssueLocation;
                obj.VnPermanentAddress = objSTT.VnPermanentAddress;
                obj.VnPermanentArea = objSTT.VnPermanentArea;
                obj.VnPermanentDistrict = objSTT.VnPermanentDistrict;
                obj.VnPermanentCityProvince = objSTT.VnPermanentCityProvince;
                obj.VnPermanentCountry = objSTT.VnPermanentCountry;
                obj.VnTempAddress = objSTT.VnTempAddress;
                obj.VnTempArea = objSTT.VnTempArea;
                obj.VnTempDistrict = objSTT.VnTempDistrict;
                obj.VnTempCityProvince = objSTT.VnTempCityProvince;
                obj.VnTempCountry = objSTT.VnTempCountry;
                msg = new EmployeeDao().Insert(obj);
                if (msg.MsgType == MessageType.Info)
                {
                    msg = new EmployeeDao().InsertTracking(obj);
                }
            }
            #endregion
            msg = new Message(MessageConstants.I0001, MessageType.Info, objSTT.ID + " " + objSTT.FirstName + " " + objSTT.MiddleName + " " + objSTT.LastName, "updated");
            }
            catch
            {
                msg = new Message(MessageConstants.E0007, MessageType.Error);
            }
            return msg;
        }
Esempio n. 4
0
        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;
            }
        }
Esempio n. 5
0
        public void WriteLogForUpdateRemarks(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.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;
            }
        }
Esempio n. 6
0
        public void WriteLogForUpdatePersonal(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.VnIDIssueLocation != oldInfo.VnIDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", oldInfo.VnIDIssueLocation, newInfo.VnIDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.Major != oldInfo.Major)
                    {
                        commonDao.InsertLogDetail(logId, "Major", "Major", oldInfo.Major, newInfo.Major);
                        isUpdated = true;
                    }
                    if (newInfo.Race != oldInfo.Race)
                    {
                        commonDao.InsertLogDetail(logId, "Race", "Race", oldInfo.Race, newInfo.Race);
                        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", "OtherDegree", 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 == Constants.MALE ? "Male" : "Famale":"",newInfo.Gender.HasValue? newInfo.Gender == 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 == Constants.SINGLE ? "Single" : "Married":"",oldInfo.MarriedStatus.HasValue? newInfo.MarriedStatus == Constants.SINGLE ? "Single" : "Married":"");
                        isUpdated = true;
                    }
                    if (newInfo.Religion != oldInfo.Religion)
                    {
                        commonDao.InsertLogDetail(logId, "Religion", "Religion", oldInfo.Religion, newInfo.Religion);
                        isUpdated = true;
                    }
                    if (newInfo.STTStatusId != oldInfo.STTStatusId)
                    {
                        commonDao.InsertLogDetail(logId, "STTStatusId", "STT Status", oldInfo.STTStatusId.ToString(), new STTStatusDao().GetById(newInfo.STTStatusId).Name);
                        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;
            }
        }
Esempio n. 7
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="newInfo"></param>
        /// <param name="action"></param>
        public void WriteLogForUpdatePosition(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.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;
            }
        }
Esempio n. 8
0
        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;
            }
        }
Esempio n. 9
0
        public void WriteLogForUpdateContact(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.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;
            }
        }
Esempio n. 10
0
        public void WriteLogForUpdateAddress(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.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;
            }
        }
Esempio n. 11
0
        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;
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Write Update Log For STT
        /// </summary>
        /// <param name="newInfo"></param>
        /// <param name="logId"></param>
        /// <returns></returns>
        private bool WriteUpdateLogForSTT(STT newInfo, string logId)
        {
            bool isUpdated = false;
            try
            {
                // Get old info
                STT oldInfo = new STTDao().GetById(newInfo.ID);

                if ((oldInfo != null) && (newInfo != null) && (logId != null))
                {
                    if (newInfo.IDNumber != oldInfo.IDNumber)
                    {
                        commonDao.InsertLogDetail(logId, "IDNumber", "ID Number", oldInfo.IDNumber, newInfo.IDNumber);
                        isUpdated = true;
                    }
                    if (newInfo.LastName != oldInfo.LastName)
                    {
                        commonDao.InsertLogDetail(logId, "LastName", "Last Name", oldInfo.LastName, newInfo.LastName);
                        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.Major != oldInfo.Major)
                    {
                        commonDao.InsertLogDetail(logId, "Major", "Major", oldInfo.Major, newInfo.Major);
                        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.VnFirstName != oldInfo.VnFirstName)
                    {
                        commonDao.InsertLogDetail(logId, "VnFirstName", "Vn First Name", oldInfo.VnFirstName, newInfo.VnFirstName);
                        isUpdated = true;
                    }
                    if (newInfo.VnMiddleName != oldInfo.VnMiddleName)
                    {
                        commonDao.InsertLogDetail(logId, "VnMiddleName", "Vn Middle Name", oldInfo.VnMiddleName, newInfo.VnMiddleName);
                        isUpdated = true;
                    }
                    if (newInfo.VnLastName != oldInfo.VnLastName)
                    {
                        commonDao.InsertLogDetail(logId, "VnLastName", "Vn Last Name", oldInfo.VnLastName, newInfo.VnLastName);
                        isUpdated = true;
                    }
                    if (newInfo.VnPOB != oldInfo.VnPOB)
                    {
                        commonDao.InsertLogDetail(logId, "VnPOB", "Vn Place Of Birth", oldInfo.VnPOB, newInfo.VnPOB);
                        isUpdated = true;
                    }
                    if (newInfo.VnPlaceOfOrigin != oldInfo.VnPlaceOfOrigin)
                    {
                        commonDao.InsertLogDetail(logId, "VnPlaceOfOrigin", "Vn Place Of Origin", oldInfo.VnPlaceOfOrigin, newInfo.VnPlaceOfOrigin);
                        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", "OtherDegree", oldInfo.OtherDegree, newInfo.OtherDegree);
                        isUpdated = true;
                    }
                    if (newInfo.Race != oldInfo.Race)
                    {
                        commonDao.InsertLogDetail(logId, "Race", "Race", oldInfo.Race, newInfo.Race);
                        isUpdated = true;
                    }
                     if (newInfo.IDIssueLocation != oldInfo.IDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "IDIssueLocation", "Issue Location", oldInfo.IDIssueLocation, newInfo.IDIssueLocation);
                        isUpdated = true;
                    }
                    if (newInfo.VnIDIssueLocation != oldInfo.VnIDIssueLocation)
                    {
                        commonDao.InsertLogDetail(logId, "VnIDIssueLocation", "Vn Issue Location", oldInfo.VnIDIssueLocation, newInfo.VnIDIssueLocation);
                        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 (newInfo.Gender != oldInfo.Gender)
                    {
                        commonDao.InsertLogDetail(logId, "Gender", "Gender",oldInfo.Gender.HasValue?oldInfo.Gender.Value == Constants.MALE ? "Male" : "Female":"",newInfo.Gender.HasValue?newInfo.Gender.Value == Constants.MALE ? "Male" : "Female":"");
                        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, "ExpectedEndDate", "Expected End 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.Photograph != oldInfo.Photograph)
                    {
                        commonDao.InsertLogDetail(logId, "Photograph", "Photograph", oldInfo.Photograph, newInfo.Photograph);
                        isUpdated = true;
                    }
                    if (newInfo.JR != oldInfo.JR)
                    {
                        commonDao.InsertLogDetail(logId, "JobRequest", "Job Request", oldInfo.JR, newInfo.JR);
                        isUpdated = true;
                    }
                    if (newInfo.JRApproval != oldInfo.JRApproval)
                    {
                        commonDao.InsertLogDetail(logId, "JobRequestApproval", "Job Request Approval", oldInfo.JRApproval, newInfo.JRApproval);
                        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.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 Area", 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.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.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.ExtensionNumber != oldInfo.ExtensionNumber)
                    {
                        commonDao.InsertLogDetail(logId, "ExtensionNumber", "Extension Number", oldInfo.ExtensionNumber, newInfo.ExtensionNumber);
                        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.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.BankAccount != oldInfo.BankAccount)
                    {
                        commonDao.InsertLogDetail(logId, "BankAccount", "Bank Account", oldInfo.BankAccount, newInfo.BankAccount);
                        isUpdated = true;
                    }
                    if (newInfo.BankName != oldInfo.BankName)
                    {
                        commonDao.InsertLogDetail(logId, "BankName", "Bank Name", oldInfo.BankName, newInfo.BankName);
                        isUpdated = true;
                    }
                    if (newInfo.ResignedDate != oldInfo.ResignedDate)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedDate", "Resigned Date", oldInfo.ResignedDate.HasValue ? oldInfo.ResignedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW) : "", newInfo.ResignedDate.HasValue?newInfo.ResignedDate.Value.ToString(Constants.DATETIME_FORMAT_VIEW):"");
                        isUpdated = true;
                    }
                    if (newInfo.ResignedReason != oldInfo.ResignedReason)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedReason", "Resigned Reason", oldInfo.ResignedReason, newInfo.ResignedReason);
                        isUpdated = true;
                    }
                    if (newInfo.ResignedAllowance != oldInfo.ResignedAllowance)
                    {
                        commonDao.InsertLogDetail(logId, "ResignedAllowance", "Resigned Allowance",oldInfo.ResignedAllowance.HasValue?oldInfo.ResignedAllowance.ToString():"", newInfo.ResignedAllowance.HasValue?newInfo.ResignedAllowance.ToString():"");
                        isUpdated = true;
                    }
                    if (newInfo.LaborUnion != oldInfo.LaborUnion)
                    {
                        commonDao.InsertLogDetail(logId, "LaborUnion", "Labor Union",oldInfo.LaborUnion.HasValue? oldInfo.LaborUnion.Value == Constants.LABOR_UNION_FALSE ? "No" : "Yes":"",newInfo.LaborUnion.HasValue?newInfo.LaborUnion.Value == Constants.LABOR_UNION_FALSE ? "No" : "Yes":"");
                        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.Remarks != oldInfo.Remarks)
                    {
                        commonDao.InsertLogDetail(logId, "Remarks", "Remarks", oldInfo.Remarks, newInfo.Remarks);
                        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.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 (newInfo.DepartmentId != oldInfo.DepartmentId)
                    {
                        DepartmentDao departDao = new DepartmentDao();
                        Department objDepart = departDao.GetById(newInfo.DepartmentId);
                        if (objDepart != null)
                        {
                            commonDao.InsertLogDetail(logId, "DepartmentId", "Department", oldInfo.Department.DepartmentName, objDepart.DepartmentName);
                            commonDao.InsertLogDetail(logId, "Department", "Department", new DepartmentDao().GetDepartmentNameBySub(oldInfo.DepartmentId), new DepartmentDao().GetDepartmentNameBySub(newInfo.DepartmentId));
                            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.LocationCode != oldInfo.LocationCode)
                    {
                        commonDao.InsertLogDetail(logId, "LocationCode", "LocationCode", CommonFunc.GenerateStringOfLocation(oldInfo.LocationCode), CommonFunc.GenerateStringOfLocation(newInfo.LocationCode));
                        isUpdated = true;
                    }
                    if (newInfo.CVFile != oldInfo.CVFile)
                    {
                        commonDao.InsertLogDetail(logId, "CVFile", "CVFile", oldInfo.CVFile, newInfo.CVFile);
                        isUpdated = true;
                    }
                    if (newInfo.STTStatusId != oldInfo.STTStatusId)
                    {
                        commonDao.InsertLogDetail(logId, "STTStatusId", "STT Status", oldInfo.STT_Status.Name, new STTStatusDao().GetById(newInfo.STTStatusId).Name);
                        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);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return isUpdated;
        }
Esempio n. 13
0
        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;
            }
        }
Esempio n. 14
0
 public Message Swap(string id1, string id2)
 {
     Message msg = null;
     STTDao sttDao = new STTDao ();
     EmployeeDao empDao =new EmployeeDao ();
     try
     {
         if (id1.IsSttId())
         {
             STT obj1 = sttDao.GetById(id1);
             string tmp = obj1.LocationCode;
             if (id2.IsSttId())
             {
                 STT obj2 = sttDao.GetById(id2);
                 obj1.LocationCode = obj2.LocationCode;
                 obj2.LocationCode = tmp;
             }
             else
             {
                 Employee obj2 = empDao.GetById(id2);
                 obj1.LocationCode = obj2.LocationCode;
                 obj2.LocationCode = tmp;
             }
         }
         else
         {
             Employee obj1 = empDao.GetById(id1);
             string tmp = obj1.LocationCode;
             if (id2.IsSttId())
             {
                 STT obj2 = sttDao.GetById(id2);
                 obj1.LocationCode = obj2.LocationCode;
                 obj2.LocationCode = tmp;
             }
             else
             {
                 Employee obj2 = empDao.GetById(id2);
                 obj1.LocationCode = obj2.LocationCode;
                 obj2.LocationCode = tmp;
             }
         }
         msg = new Message(MessageConstants.I0001, MessageType.Info, "Work Location", "swapped");
         dbContext.SubmitChanges();
     }
     catch
     {
         msg = new Message(MessageConstants.E0033, MessageType.Error);
     }
     return msg;
 }