private void TagPage() { hdfWorkType.Value = Request.QueryString["work_type"].ToString(); hdfCompanyId.Value = Session["companyID"].ToString(); hdfProjectId.Value = Request.QueryString["project_id"].ToString(); // Get ids & location int projectId = Int32.Parse(hdfProjectId.Value.Trim()); ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); // ... Get ids Int64 currentCountry = projectGateway.GetCountryID(projectId); Int64? currentProvince = null; if (projectGateway.GetProvinceID(projectId).HasValue) currentProvince = (Int64)projectGateway.GetProvinceID(projectId); Int64? currentCounty = null; if (projectGateway.GetCountyID(projectId).HasValue) currentCounty = (Int64)projectGateway.GetCountyID(projectId); Int64? currentCity = null; if (projectGateway.GetCityID(projectId).HasValue) currentCity = (Int64)projectGateway.GetCityID(projectId); hdfCountryId.Value = currentCountry.ToString(); hdfProvinceId.Value = currentProvince.ToString(); hdfCountyId.Value = currentCounty.ToString(); hdfCityId.Value = currentCity.ToString(); // .. Get location string projectLocation = ""; CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(currentCountry); projectLocation = projectLocation + countryGateway.GetName(currentCountry); if (currentProvince.HasValue) { ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId((Int64)currentProvince); projectLocation = projectLocation + ", " + provinceGateway.GetName((Int64)currentProvince); } if (currentCounty.HasValue) { CountyGateway countyGateway = new CountyGateway(); countyGateway.LoadByCountyId((Int64)currentCounty); projectLocation = projectLocation + ", " + countyGateway.GetName((Int64)currentCounty); } if (currentCity.HasValue) { CityGateway cityGateway = new CityGateway(); cityGateway.LoadByCityId((Int64)currentCity); projectLocation = projectLocation + ", " + cityGateway.GetName((Int64)currentCity); } hdfSearchTitle.Value = projectLocation; }
protected string GetState(object state) { if (state == DBNull.Value) { return ""; } else { Int64 stateId = Int64.Parse(state.ToString()); if (stateId > 0) { ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); return provinceGateway.GetName(stateId); } else { return ""; } } }
private void LoadDetailedData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load for General Tab if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) tbxAcquisitionDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) tbxDispositionDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetDispositionDate(unitId)).ToShortDateString(); tbxDispositionReason.Text = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); int companyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); GetNodeForCategory(tvCategoriesRoot.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRoot.Nodes, 0, companyLevelId); foreach (TreeNode nodes in tvCategoriesRoot.Nodes) { GetCategoriesParent(nodes); } foreach (TreeNode nodes in tvCompanyLevelsRoot.Nodes) { GetCompanyLevelsParent(nodes); } // Load for Plate and Technical Tabs if (unitInformationUnitDetailsGateway.GetType(unitId) == "Vehicle") { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxLicenseCountry.Text = countryGateway.GetName(countryId); } if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetLicenseState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxLicenseState.Text = provinceGateway.GetName(stateId); } tbxLicensePlateNumber.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); tbxActualWeight.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeight.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFront.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBack.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); tbxNumberOfAxes.Text = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); tbxFuelType.Text = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometer.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquipped.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquipped.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } // Load for Ownership tab tbxOwnerType.Text = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerName.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxOwnerContact.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxOwnerCountry.Text = countryGateway.GetName(countryId); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxOwnerState.Text = provinceGateway.GetName(stateId); } } // Load for Inspection Tab (Qualification data) if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) tbxQualifiedDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetQualifiedDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) tbxNotQualifiedDate.Text = ((DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId)).ToShortDateString(); tbxIfNotQualifiedExplain.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } }
private void LoadDetailedData(int unitId) { UnitInformationUnitDetailsGateway unitInformationUnitDetailsGateway = new UnitInformationUnitDetailsGateway(unitInformationTDS); if (unitInformationUnitDetailsGateway.Table.Rows.Count > 0) { // Load for General Tab if (upnlGeneralDataEdit.Visible) { if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) { tkrdpAcquisitionDate.SelectedDate = unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId); } if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) { tkrdpDispositionDate.SelectedDate = unitInformationUnitDetailsGateway.GetDispositionDate(unitId); } tbxDispositionReason.Text = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); int companyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); GetNodeForCategory(tvCategoriesRoot.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRoot.Nodes, 0, companyLevelId); foreach (TreeNode nodes in tvCategoriesRoot.Nodes) { GetCategoriesParent(nodes); } foreach (TreeNode nodes in tvCompanyLevelsRoot.Nodes) { GetCompanyLevelsParent(nodes); } } else { if (unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId).HasValue) tbxAcquisitionDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetAcquisitionDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetDispositionDate(unitId).HasValue) tbxDispositionDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetDispositionDate(unitId)).ToShortDateString(); tbxDispositionReasonSummary.Text = unitInformationUnitDetailsGateway.GetDispositionReason(unitId); int companyLevelId = unitInformationUnitDetailsGateway.GetCompanyLevelId(unitId); GetNodeForCategory(tvCategoriesRootSummary.Nodes, 0); GetNodeForCompanyLevels(tvCompanyLevelsRootSummary.Nodes, 0, companyLevelId); foreach (TreeNode nodes in tvCategoriesRootSummary.Nodes) { GetCategoriesParent(nodes); } foreach (TreeNode nodes in tvCompanyLevelsRootSummary.Nodes) { GetCompanyLevelsParent(nodes); } } // Load for Plate and Technical Tabs if (unitInformationUnitDetailsGateway.GetType(unitId) == "Vehicle") { if (upnlPlateDataEdit.Visible) { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); ddlLicenseCountry.SelectedValue = countryId.ToString(); if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64? stateId = null; stateId = unitInformationUnitDetailsGateway.GetLicenseState(unitId); if (stateId.HasValue) { tbxLicenseState.Text = ""; hdfLicenseStateId.Value = ""; if (stateId.ToString() == "12435") { tbxLicenseState.Text = "Ontario"; hdfLicenseStateId.Value = "12435"; } else { if (ddlLicenseCountry.SelectedValue == "2") { tbxLicenseState.Text = "Michigan"; hdfLicenseStateId.Value = "84026"; } } } } } tbxLicensePlateNumber.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); } else { if (unitInformationUnitDetailsGateway.GetLicenseCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetLicenseCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxLicenseCountrySummary.Text = countryGateway.GetName(countryId); } if (unitInformationUnitDetailsGateway.GetLicenseState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetLicenseState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxLicenseStateSummary.Text = provinceGateway.GetName(stateId); } tbxLicensePlateNumberSummary.Text = unitInformationUnitDetailsGateway.GetLicensePlateNumbver(unitId); } if (upnlTechnicalEdit.Visible) { tbxActualWeight.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeight.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFront.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBack.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); ddlNumberOfAxes.SelectedValue = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); ddlFuelType.SelectedValue = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometer.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquipped.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquipped.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } else { tbxActualWeightSummary.Text = unitInformationUnitDetailsGateway.GetActualWeight(unitId); tbxRegisteredWeightSummary.Text = unitInformationUnitDetailsGateway.GetRegisteredWeight(unitId); tbxTireSizeFrontSummary.Text = unitInformationUnitDetailsGateway.GetTireSizeFront(unitId); tbxTireSizeBackSummary.Text = unitInformationUnitDetailsGateway.GetTireSizeBack(unitId); tbxNumberOfAxesSummary.Text = unitInformationUnitDetailsGateway.GetNumberOfAxes(unitId); tbxFuelTypeSummary.Text = unitInformationUnitDetailsGateway.GetFuelType(unitId); tbxBeginningOdometerSummary.Text = unitInformationUnitDetailsGateway.GetBeginningOdometer(unitId); cbxIsReeferEquippedSummary.Checked = unitInformationUnitDetailsGateway.GetIsReeferEquipped(unitId); cbxIsPtoEquippedSummary.Checked = unitInformationUnitDetailsGateway.GetIsPTOEquipped(unitId); } } // Load for Ownership tab if (upnlOwnershipEdit.Visible) { ddlOwnerType.SelectedValue = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerName.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxOwnerContact.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); ddlOwnerCountry.SelectedValue = countryId.ToString(); ProvinceList provinceList = new ProvinceList(); provinceList.LoadByCountryIdAndAddItem(-1, "(Select a state)", countryId); ddlOwnerState.DataSource = provinceList.Table; ddlOwnerState.DataValueField = "ProvinceID"; ddlOwnerState.DataTextField = "Name"; ddlOwnerState.DataBind(); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ddlOwnerState.SelectedValue = stateId.ToString(); } } } else { tbxOwnerTypeSummary.Text = unitInformationUnitDetailsGateway.GetOwnerType(unitId); tbxOwnerNameSummary.Text = unitInformationUnitDetailsGateway.GetOwnerName(unitId); tbxContactInfoSummary.Text = unitInformationUnitDetailsGateway.GetOwnerContact(unitId); if (unitInformationUnitDetailsGateway.GetOwnerCountry(unitId).HasValue) { Int64 countryId = (Int64)unitInformationUnitDetailsGateway.GetOwnerCountry(unitId); CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(countryId); tbxOwnerCountrySummary.Text = countryGateway.GetName(countryId); if (unitInformationUnitDetailsGateway.GetOwnerState(unitId).HasValue) { Int64 stateId = (Int64)unitInformationUnitDetailsGateway.GetOwnerState(unitId); ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(stateId); tbxOwnerStateSummary.Text = provinceGateway.GetName(stateId); } } } // Load for Inspection Tab (Qualification data) if (upnlInspectionEdit.Visible) { if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) { tkrdpQualifiedDate.SelectedDate = unitInformationUnitDetailsGateway.GetQualifiedDate(unitId); } if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) { tkrdpNotQualifiedDate.SelectedDate = (DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId); } tbxIfNotQualifiedExplain.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } else { if (unitInformationUnitDetailsGateway.GetQualifiedDate(unitId).HasValue) tbxQualifiedDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetQualifiedDate(unitId)).ToShortDateString(); if (unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId).HasValue) tbxNotQualifiedDateSummary.Text = ((DateTime)unitInformationUnitDetailsGateway.GetNotQualifiedDate(unitId)).ToShortDateString(); tbxIfNotQualifiedExplainSummary.Text = unitInformationUnitDetailsGateway.GetNotQualifiedExplain(unitId); } } }
private void LoadGeneralData() { // ... for geographical location hdfCountryId.DataBind(); if (hdfCountryId.Value != "") { CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(Int64.Parse(hdfCountryId.Value)); tbxCountry.Text = countryGateway.GetName(Int64.Parse(hdfCountryId.Value)); } else { tbxCountry.Text = ""; } hdfProvinceStateId.DataBind(); if (hdfProvinceStateId.Value != "") { ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(Int64.Parse(hdfProvinceStateId.Value)); tbxProvinceState.Text = provinceGateway.GetName(Int64.Parse(hdfProvinceStateId.Value)); } else { tbxProvinceState.Text = ""; } hdfCountyId.DataBind(); if (hdfCountyId.Value != "") { CountyGateway countyGateway = new CountyGateway(); countyGateway.LoadByCountyId(Int64.Parse(hdfCountyId.Value)); tbxCounty.Text = countyGateway.GetName(Int64.Parse(hdfCountyId.Value)); } else { tbxCounty.Text = ""; } hdfCityId.DataBind(); if (hdfCityId.Value != "") { CityGateway cityGateway = new CityGateway(); cityGateway.LoadByCityId(Int64.Parse(hdfCityId.Value)); tbxCity.Text = cityGateway.GetName(Int64.Parse(hdfCityId.Value)); } else { tbxCity.Text = ""; } // ... for project ProjectGateway projectGateway = new ProjectGateway(projectTDS); int currentCompanyId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())); hdfClientId.Value = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value)).ToString(); // ... for client int companyId = Int32.Parse(hdfCompanyId.Value); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId(currentCompanyId, companyId); if (projectTDS.LFS_PROJECT.Rows.Count > 0) { tkrdpStartDate.DataBind(); tkrdpEndDate.DataBind(); tkrdpProposalDate.DataBind(); tbxProjectNumber.DataBind(); tbxName.DataBind(); tbxDescription.DataBind(); tbxClientName.Text = companiesGateway.GetName(projectGateway.GetClientID(int.Parse(hdfProjectId.Value))); tbxClientProjectNumber.DataBind(); // ... ... for primary contact ContactsList contactList = new ContactsList(); contactList.LoadAllAndAddItemByCompaniesId(-1, " ", projectGateway.GetClientID(int.Parse(hdfProjectId.Value)), companyId); ddlClientPrimaryContactId.DataSource = contactList.Table; ddlClientPrimaryContactId.DataValueField = "CONTACTS_ID"; ddlClientPrimaryContactId.DataTextField = "Name"; if (projectGateway.GetClientPrimaryContactID(int.Parse(hdfProjectId.Value)).HasValue) { ddlClientPrimaryContactId.SelectedValue = projectGateway.GetClientPrimaryContactID(int.Parse(hdfProjectId.Value)).ToString(); } else { ddlClientPrimaryContactId.SelectedValue = "-1"; } ddlClientPrimaryContactId.DataBind(); // ... ... for secondary contact ddlClientSecondaryContactId.DataSource = contactList.Table; ddlClientSecondaryContactId.DataValueField = "CONTACTS_ID"; ddlClientSecondaryContactId.DataTextField = "Name"; if (projectGateway.GetClientSecondaryContactID(int.Parse(hdfProjectId.Value)).HasValue) { ddlClientSecondaryContactId.SelectedValue = projectGateway.GetClientSecondaryContactID(int.Parse(hdfProjectId.Value)).ToString(); } else { ddlClientSecondaryContactId.SelectedValue = "-1"; } ddlClientSecondaryContactId.DataBind(); // ... for resources // ... ... for project lead EmployeeList employeeList = new EmployeeList(); employeeList.LoadAndAddItem(-1, " "); ddlProjectLeadId.DataSource = employeeList.Table; ddlProjectLeadId.DataValueField = "EmployeeID"; ddlProjectLeadId.DataTextField = "FullName"; ddlProjectLeadId.SelectedValue = (projectGateway.GetProjectLeadID(int.Parse(hdfProjectId.Value)).HasValue) ? ((int)projectGateway.GetProjectLeadID(int.Parse(hdfProjectId.Value))).ToString() : "-1"; ddlProjectLeadId.DataBind(); // ... ... for salesman SalesmanListGateway salesmanListGateway = new SalesmanListGateway(new DataSet()); salesmanListGateway.Load(); ddlSalesmanId.DataSource = salesmanListGateway.Table; ddlSalesmanId.DataValueField = "SalesmanID"; ddlSalesmanId.DataTextField = "FullName"; ddlSalesmanId.SelectedValue = ((int)projectGateway.GetSalesmanID(int.Parse(hdfProjectId.Value))).ToString(); ddlSalesmanId.DataBind(); // ... ... for Pricing if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark") { ProjectSaleBillingPricingGateway projectSaleBillingPricingGateway = new ProjectSaleBillingPricingGateway(projectTDS); if (projectSaleBillingPricingGateway.Table.Rows.Count > 0) { tbxBillPrice.DataBind(); ddlBillMoney.DataBind(); } else { if (projectGateway.GetCountryID(int.Parse(hdfProjectId.Value)) == 1) { ddlBillMoney.SelectedValue = "CAD"; } else { ddlBillMoney.SelectedValue = "USD"; } } } } cbxFairWageApplies.DataBind(); // Data for unit budget tab ProjectNavigatorProjectUnitsBudgetGateway projectNavigatorProjectUnitsBudgetGateway = new ProjectNavigatorProjectUnitsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectUnitsBudgetGateway.Table.Rows.Count > 0) { tbxUnitsBudget.Text = projectNavigatorProjectUnitsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value)).ToString("n2"); } // Data for materials budget tab ProjectNavigatorProjectMaterialsBudgetGateway projectNavigatorProjectMaterialsBudgetGateway = new ProjectNavigatorProjectMaterialsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectMaterialsBudgetGateway.Table.Rows.Count > 0) { tbxMaterialsBudget.Text = projectNavigatorProjectMaterialsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value)).ToString("n2"); } // Data for subcontractors budget tab ProjectNavigatorProjectSubcontractorsBudgetGateway projectNavigatorProjectSubcontractorsBudgetGateway = new ProjectNavigatorProjectSubcontractorsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectSubcontractorsBudgetGateway.Table.Rows.Count > 0) { tbxSubcontractorsBudget.Text = projectNavigatorProjectSubcontractorsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for hotels budget tab ProjectNavigatorProjectHotelsBudgetGateway projectNavigatorProjectHotelsBudgetGateway = new ProjectNavigatorProjectHotelsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectHotelsBudgetGateway.Table.Rows.Count > 0) { tbxHotelsBudget.Text = projectNavigatorProjectHotelsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for bondings budget tab ProjectNavigatorProjectBondingsBudgetGateway projectNavigatorProjectBondingsBudgetGateway = new ProjectNavigatorProjectBondingsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectBondingsBudgetGateway.Table.Rows.Count > 0) { tbxBondingsBudget.Text = projectNavigatorProjectBondingsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for insurances budget tab ProjectNavigatorProjectInsurancesBudgetGateway projectNavigatorProjectInsurancesBudgetGateway = new ProjectNavigatorProjectInsurancesBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectInsurancesBudgetGateway.Table.Rows.Count > 0) { tbxInsurancesBudget.Text = projectNavigatorProjectInsurancesBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } CalculateTotalBudget(); }
private void LoadGeneralData() { // Data for General Data tbxProjectNumber.DataBind(); tbxName.DataBind(); tbxProposalDate.DataBind(); tbxStartDate.DataBind(); tbxEndDate.DataBind(); tbxDescription.DataBind(); cbxFairWageApplies.DataBind(); // ... for geographical location hdfCountryId.DataBind(); if (hdfCountryId.Value != "") { CountryGateway countryGateway = new CountryGateway(); countryGateway.LoadByCountryId(Int64.Parse(hdfCountryId.Value)); tbxCountry.Text = countryGateway.GetName(Int64.Parse(hdfCountryId.Value)); } else { tbxCountry.Text = ""; } hdfProvinceStateId.DataBind(); if (hdfProvinceStateId.Value != "") { ProvinceGateway provinceGateway = new ProvinceGateway(); provinceGateway.LoadByProvinceId(Int64.Parse(hdfProvinceStateId.Value)); tbxProvinceState.Text = provinceGateway.GetName(Int64.Parse(hdfProvinceStateId.Value)); } else { tbxProvinceState.Text = ""; } hdfCountyId.DataBind(); if (hdfCountyId.Value != "") { CountyGateway countyGateway = new CountyGateway(); countyGateway.LoadByCountyId(Int64.Parse(hdfCountyId.Value)); tbxCounty.Text = countyGateway.GetName(Int64.Parse(hdfCountyId.Value)); } else { tbxCounty.Text = ""; } hdfCityId.DataBind(); if (hdfCityId.Value != "") { CityGateway cityGateway = new CityGateway(); cityGateway.LoadByCityId(Int64.Parse(hdfCityId.Value)); tbxCity.Text = cityGateway.GetName(Int64.Parse(hdfCityId.Value)); } else { tbxCity.Text = ""; } // ... for project ProjectGateway projectGateway = new ProjectGateway(projectTDS); int currentCompanyId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())); // ... for client int companyId = Int32.Parse(hdfCompanyId.Value); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId(currentCompanyId, companyId); tbxClientName.Text = companiesGateway.GetName(currentCompanyId); hdfClientId.Value = projectGateway.GetClientID(int.Parse(hdfProjectId.Value)).ToString(); tbxClientProjectNumber.DataBind(); // ... ... for primary contact if (projectGateway.GetClientPrimaryContactID(int.Parse(hdfProjectId.Value)).HasValue) { hdfClientPrimaryContactID.Value = ((int)projectGateway.GetClientPrimaryContactID(int.Parse(hdfProjectId.Value))).ToString(); ContactsGateway contactsGatewayForPrimaryContact = new ContactsGateway(); contactsGatewayForPrimaryContact.LoadAllByContactId(int.Parse(hdfClientPrimaryContactID.Value), companyId); tbxClientPrimaryContact.Text = contactsGatewayForPrimaryContact.GetCompleteName(int.Parse(hdfClientPrimaryContactID.Value)); } // ... ... for secondary contact if (projectGateway.GetClientSecondaryContactID(int.Parse(hdfProjectId.Value)).HasValue) { hdfClientSecondaryContactID.Value = ((int)projectGateway.GetClientSecondaryContactID(int.Parse(hdfProjectId.Value))).ToString(); ContactsGateway contactsGatewayForSecondaryContact = new ContactsGateway(); contactsGatewayForSecondaryContact.LoadAllByContactId(int.Parse(hdfClientSecondaryContactID.Value), companyId); tbxClientSecondaryContact.Text = contactsGatewayForSecondaryContact.GetCompleteName(int.Parse(hdfClientSecondaryContactID.Value)); } // ... for resources // ... ... for project lead if (projectGateway.GetProjectLeadID(int.Parse(hdfProjectId.Value)).HasValue) { EmployeeGateway employeeGateway = new EmployeeGateway(); employeeGateway.LoadByEmployeeId((int)projectGateway.GetProjectLeadID(int.Parse(hdfProjectId.Value))); tbxProjectLead.Text = employeeGateway.GetFullName((int)projectGateway.GetProjectLeadID(int.Parse(hdfProjectId.Value))); } // ... ... for salesman SalesmanGateway salesmanGateway = new SalesmanGateway(); salesmanGateway.LoadExpandedBySalesmanId(projectGateway.GetSalesmanID(int.Parse(hdfProjectId.Value))); tbxSalesman.Text = salesmanGateway.GetFullName(projectGateway.GetSalesmanID(int.Parse(hdfProjectId.Value))); // ... ... for Pricing if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark") { ProjectSaleBillingPricingGateway projectSaleBillingPricingGateway = new ProjectSaleBillingPricingGateway(projectTDS); if (projectSaleBillingPricingGateway.Table.Rows.Count > 0) { if (projectSaleBillingPricingGateway.GetBillPrice(int.Parse(hdfProjectId.Value)).HasValue) tbxBillPrice.Text = ((decimal)projectSaleBillingPricingGateway.GetBillPrice(int.Parse(hdfProjectId.Value))).ToString("n2"); tbxBillMoney.Text = projectSaleBillingPricingGateway.GetBillMoney(int.Parse(hdfProjectId.Value)); } else { if (projectGateway.GetCountryID(int.Parse(hdfProjectId.Value)) == 1) { tbxBillMoney.Text = "CAD"; } else { tbxBillMoney.Text = "USD"; } } } // Data for unit budget tab ProjectNavigatorProjectUnitsBudgetGateway projectNavigatorProjectUnitsBudgetGateway = new ProjectNavigatorProjectUnitsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectUnitsBudgetGateway.Table.Rows.Count > 0) { tbxUnitsBudget.Text = projectNavigatorProjectUnitsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value)).ToString("n2"); } // Data for materials budget tab ProjectNavigatorProjectMaterialsBudgetGateway projectNavigatorProjectMaterialsBudgetGateway = new ProjectNavigatorProjectMaterialsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectMaterialsBudgetGateway.Table.Rows.Count > 0) { tbxMaterialsBudget.Text = projectNavigatorProjectMaterialsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value)).ToString("n2"); } // Data for subcontractors budget tab ProjectNavigatorProjectSubcontractorsBudgetGateway projectNavigatorProjectSubcontractorsBudgetGateway = new ProjectNavigatorProjectSubcontractorsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectSubcontractorsBudgetGateway.Table.Rows.Count > 0) { tbxSubcontractorsBudget.Text = projectNavigatorProjectSubcontractorsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for hotels budget tab ProjectNavigatorProjectHotelsBudgetGateway projectNavigatorProjectHotelsBudgetGateway = new ProjectNavigatorProjectHotelsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectHotelsBudgetGateway.Table.Rows.Count > 0) { tbxHotelsBudget.Text = projectNavigatorProjectHotelsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for bondings budget tab ProjectNavigatorProjectBondingsBudgetGateway projectNavigatorProjectBondingsBudgetGateway = new ProjectNavigatorProjectBondingsBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectBondingsBudgetGateway.Table.Rows.Count > 0) { tbxBondingsBudget.Text = projectNavigatorProjectBondingsBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } // Data for insurances budget tab ProjectNavigatorProjectInsurancesBudgetGateway projectNavigatorProjectInsurancesBudgetGateway = new ProjectNavigatorProjectInsurancesBudgetGateway(projectNavigatorTDS); if (projectNavigatorProjectInsurancesBudgetGateway.Table.Rows.Count > 0) { tbxInsurancesBudget.Text = projectNavigatorProjectInsurancesBudgetGateway.GetBudget(int.Parse(hdfProjectId.Value), 1, 1).ToString("n2"); } CalculateTotalBudget(); }