private void LoadBasicData(int employeeId) { // Load Data EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway(employeeInformationTDS); if (employeeInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load employee basic data tbxFisrtName.Text = employeeInformationBasicInformationGateway.GetFirstName(employeeId); tbxLastName.Text = employeeInformationBasicInformationGateway.GetLastName(employeeId); tbxeMail.Text = employeeInformationBasicInformationGateway.GeteMail(employeeId); ckbxIsSalesman.Checked = employeeInformationBasicInformationGateway.GetIsSalesman(employeeId); ckbxRequestTimesheet.Checked = employeeInformationBasicInformationGateway.GetRequestProjectTime(employeeId); ckbxSalaried.Checked = employeeInformationBasicInformationGateway.GetSalaried(employeeId); ckbxAssignableSrs.Checked = employeeInformationBasicInformationGateway.GetAssignableSRS(employeeId); ddlType.SelectedValue = employeeInformationBasicInformationGateway.GetType(employeeId); ddlState.SelectedValue = employeeInformationBasicInformationGateway.GetState(employeeId); ddlCategory.SelectedValue = employeeInformationBasicInformationGateway.GetCategory(employeeId); ddlPersonalAgency.SelectedValue = employeeInformationBasicInformationGateway.GetPersonalAgencyName(employeeId); ckbxVacationsManager.Checked = employeeInformationBasicInformationGateway.GetIsVacationsManager(employeeId); ckbxApproveTimesheets.Checked = employeeInformationBasicInformationGateway.GetApproveTimesheets(employeeId); if (employeeInformationBasicInformationGateway.GetCrew(employeeId) != "") { ddlCrew.SelectedValue = employeeInformationBasicInformationGateway.GetCrew(employeeId); } else { ddlCrew.SelectedIndex = 0; } if (employeeInformationBasicInformationGateway.GetType(employeeId).Contains("CA")) { ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList(); projectTimeJobClassTypeList.LoadAndAddItem(1, 3, ""); ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table; ddlJobClassType.DataValueField = "JobClassType"; ddlJobClassType.DataTextField = "JobClassType"; ddlJobClassType.DataBind(); } else { ProjectTimeJobClassTypeList projectTimeJobClassTypeList = new ProjectTimeJobClassTypeList(); projectTimeJobClassTypeList.LoadAndAddItem(2, 3, ""); ddlJobClassType.DataSource = projectTimeJobClassTypeList.Table; ddlJobClassType.DataValueField = "JobClassType"; ddlJobClassType.DataTextField = "JobClassType"; ddlJobClassType.DataBind(); } ddlJobClassType.SelectedValue = employeeInformationBasicInformationGateway.GetJobClassType(employeeId); // Job costing factors decimal? bourdenFactor = employeeInformationBasicInformationGateway.GetBourdenFactor(employeeId); if (bourdenFactor.HasValue) { tbxBourdenFactor.Text = decimal.Round((decimal)bourdenFactor, 1).ToString(); } decimal? usHealthBenefitFactor = employeeInformationBasicInformationGateway.GetUSHealthBenefitFactor(employeeId); if (usHealthBenefitFactor.HasValue) { tbxUSHealthBenefitFactor.Text = decimal.Round((decimal)usHealthBenefitFactor, 1).ToString(); } decimal? benefitFactorCad = employeeInformationBasicInformationGateway.GetBenefitFactorCad(employeeId); if (benefitFactorCad.HasValue) { tbxBenefitFactorCad.Text = decimal.Round((decimal)benefitFactorCad, 2).ToString(); } decimal? benefitFactorUsd = employeeInformationBasicInformationGateway.GetBenefitFactorUsd(employeeId); if (benefitFactorUsd.HasValue) { tbxBenefitFactorUsd.Text = decimal.Round((decimal)benefitFactorUsd, 2).ToString(); } } }
private void LoadBasicData(int employeeId) { EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway(employeeInformationTDS); if (employeeInformationBasicInformationGateway.Table.Rows.Count > 0) { // Load employee basic data tbxFisrtName.Text = employeeInformationBasicInformationGateway.GetFirstName(employeeId); tbxLastName.Text = employeeInformationBasicInformationGateway.GetLastName(employeeId); tbxeMail.Text = employeeInformationBasicInformationGateway.GeteMail(employeeId); ckbxIsSalesman.Checked = employeeInformationBasicInformationGateway.GetIsSalesman(employeeId); ckbxRequestTimesheet.Checked = employeeInformationBasicInformationGateway.GetRequestProjectTime(employeeId); ckbxSalaried.Checked = employeeInformationBasicInformationGateway.GetSalaried(employeeId); ckbxAssignableSrs.Checked = employeeInformationBasicInformationGateway.GetAssignableSRS(employeeId); tbxJobClassType.Text = employeeInformationBasicInformationGateway.GetJobClassType(employeeId); tbxCategory.Text = employeeInformationBasicInformationGateway.GetCategory(employeeId); tbxPersonalAgency.Text = employeeInformationBasicInformationGateway.GetPersonalAgencyName(employeeId); ckbxVacationsManager.Checked = employeeInformationBasicInformationGateway.GetIsVacationsManager(employeeId); ckbxApproveTimesheets.Checked = employeeInformationBasicInformationGateway.GetApproveTimesheets(employeeId); tbxCrew.Text = employeeInformationBasicInformationGateway.GetCrew(employeeId); string type = employeeInformationBasicInformationGateway.GetType(employeeId); EmployeeTypeGateway employeeTypeGateway = new EmployeeTypeGateway(); employeeTypeGateway.LoadByType(type); tbxType.Text = employeeTypeGateway.GetDescription(type); string state = employeeInformationBasicInformationGateway.GetState(employeeId); EmployeeStateGateway employeeStateGateway = new EmployeeStateGateway(); employeeStateGateway.LoadByState(state); tbxState.Text = employeeStateGateway.GetDescription(state); // Job costing factors decimal? bourdenFactor = employeeInformationBasicInformationGateway.GetBourdenFactor(employeeId); if (bourdenFactor.HasValue) { tbxBourdenFactor.Text = decimal.Round((decimal)bourdenFactor,1).ToString(); } decimal? usHealthBenefitFactor = employeeInformationBasicInformationGateway.GetUSHealthBenefitFactor(employeeId); if (usHealthBenefitFactor.HasValue) { tbxUSHealthBenefitFactor.Text = decimal.Round((decimal)usHealthBenefitFactor, 1).ToString(); } decimal? benefitFactorCad = employeeInformationBasicInformationGateway.GetBenefitFactorCad(employeeId); if (benefitFactorCad.HasValue) { tbxBenefitFactorCad.Text = decimal.Round((decimal)benefitFactorCad, 2).ToString(); } decimal? benefitFactorUsd = employeeInformationBasicInformationGateway.GetBenefitFactorUsd(employeeId); if (benefitFactorUsd.HasValue) { tbxBenefitFactorUsd.Text = decimal.Round((decimal)benefitFactorUsd, 2).ToString(); } } }
/// <summary> /// Save /// </summary> /// <param name="companyId">companyId</param> public void Save(int companyId) { EmployeeInformationTDS employeeInformationChanges = (EmployeeInformationTDS)Data.GetChanges(); if (employeeInformationChanges.BasicInformation.Rows.Count > 0) { EmployeeInformationBasicInformationGateway employeeInformationBasicInformationGateway = new EmployeeInformationBasicInformationGateway(employeeInformationChanges); // Update employee foreach (EmployeeInformationTDS.BasicInformationRow basicInformationRow in (EmployeeInformationTDS.BasicInformationDataTable)employeeInformationChanges.BasicInformation) { // Unchanged values int employeeId = basicInformationRow.EmployeeID; int? loginId = null; if(!basicInformationRow.IsLoginIDNull()) loginId = basicInformationRow.LoginID; int? contactsId = null; if (!basicInformationRow.IsContactsIDNull()) contactsId = basicInformationRow.ContactsID; string middleInitial = ""; if (!basicInformationRow.IsMiddleInitialNull()) middleInitial = basicInformationRow.MiddleInitial; bool deleted = basicInformationRow.Deleted; decimal? bourdenFactor = null; if (!basicInformationRow.IsBourdenFactorNull()) bourdenFactor = (decimal)basicInformationRow.BourdenFactor; decimal? usHealthBenefitFactor = null; if (!basicInformationRow.IsUSHealthBenefitFactorNull()) usHealthBenefitFactor = (decimal)basicInformationRow.USHealthBenefitFactor; decimal? benefitFactorCad = null; if (!basicInformationRow.IsBenefitFactorCadNull()) benefitFactorCad = (decimal)basicInformationRow.BenefitFactorCad; decimal? benefitFactorUsd = null; if (!basicInformationRow.IsBenefitFactorUsdNull()) benefitFactorUsd = (decimal)basicInformationRow.BenefitFactorUsd; // Original values string originalFirstName = employeeInformationBasicInformationGateway.GetFirstNameOriginal(employeeId); string originalLastName = employeeInformationBasicInformationGateway.GetLastNameOriginal(employeeId); string originalFullName = originalFirstName + ' ' + originalLastName; string originalType = employeeInformationBasicInformationGateway.GetTypeOriginal(employeeId); string originalState = employeeInformationBasicInformationGateway.GetStateOriginal(employeeId); bool originalIsSalessman = employeeInformationBasicInformationGateway.GetIsSalesmanOriginal(employeeId); bool originalRequestProjectTime = employeeInformationBasicInformationGateway.GetRequestProjectTimeOriginal(employeeId); bool originalSalaried = employeeInformationBasicInformationGateway.GetSalariedOriginal(employeeId); string originalEMail = employeeInformationBasicInformationGateway.GeteMailOriginal(employeeId); bool originalAssignableSrs = employeeInformationBasicInformationGateway.GetAssignableSRSOriginal(employeeId); string originalJobClassType = employeeInformationBasicInformationGateway.GetJobClassTypeOriginal(employeeId); string originalCategory = employeeInformationBasicInformationGateway.GetCategoryOriginal(employeeId); string originalPersonalAgencyName = employeeInformationBasicInformationGateway.GetPersonalAgencyNameOriginal(employeeId); bool originalIsVacationsManager = employeeInformationBasicInformationGateway.GetIsVacationsManagerOriginal(employeeId); bool originalApproveTimesheets = employeeInformationBasicInformationGateway.GetApproveTimesheetsOriginal(employeeId); string originalCrew = employeeInformationBasicInformationGateway.GetCrewOriginal(employeeId); // New variables string newFirstName = employeeInformationBasicInformationGateway.GetFirstName(employeeId); string newLastName = employeeInformationBasicInformationGateway.GetLastName(employeeId); string newFullName = newFirstName + ' ' + newLastName; string newType = employeeInformationBasicInformationGateway.GetType(employeeId); string newState = employeeInformationBasicInformationGateway.GetState(employeeId); bool newIsSalessman = employeeInformationBasicInformationGateway.GetIsSalesman(employeeId); bool newRequestProjectTime = employeeInformationBasicInformationGateway.GetRequestProjectTime(employeeId); bool newSalaried = employeeInformationBasicInformationGateway.GetSalaried(employeeId); string newEMail = employeeInformationBasicInformationGateway.GeteMail(employeeId); bool newAssignableSrs = employeeInformationBasicInformationGateway.GetAssignableSRS(employeeId); string newJobClassType = employeeInformationBasicInformationGateway.GetJobClassType(employeeId); string newCategory = employeeInformationBasicInformationGateway.GetCategory(employeeId); string newPersonalAgencyName = employeeInformationBasicInformationGateway.GetPersonalAgencyName(employeeId); bool newIsVacationsManager = employeeInformationBasicInformationGateway.GetIsVacationsManager(employeeId); bool newApproveTimesheets = employeeInformationBasicInformationGateway.GetApproveTimesheets(employeeId); string newCrew = employeeInformationBasicInformationGateway.GetCrew(employeeId); // ... Update Employee employee = new Employee(null); employee.UpdateDirect(employeeId, loginId, contactsId, originalFullName, originalFirstName, middleInitial, originalLastName, originalType, originalState, originalIsSalessman, originalRequestProjectTime, deleted, originalSalaried, originalEMail, originalAssignableSrs, originalJobClassType, originalCategory, originalPersonalAgencyName, originalIsVacationsManager, originalApproveTimesheets, bourdenFactor, usHealthBenefitFactor, benefitFactorCad, benefitFactorUsd, originalCrew, newFullName, newFirstName, middleInitial, newLastName, newType, newState, newIsSalessman, newRequestProjectTime, deleted, newSalaried, newEMail, newAssignableSrs, newJobClassType, newCategory, newPersonalAgencyName, newIsVacationsManager, newApproveTimesheets, bourdenFactor, usHealthBenefitFactor, benefitFactorCad, benefitFactorUsd, newCrew); } } }