// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// UpdateForProcess /// </summary> /// <param name="projectId">projectId</param> /// <param name="companiesId">companiesId</param> /// <param name="companyId">companyId</param> public void UpdateForReport(int projectId, int companiesId, int companyId) { CompaniesGateway companiesGateway = new CompaniesGateway(); ContactsGateway contactsGateway = new ContactsGateway(); ProjectSynopsisReportTDS.LFS_PROJECT_ENGINEER_SUBCONTRACTORSRow engineerSubcontractorRow = GetIngenierSubcontractorRow(projectId); // For LFS_PROJECT_ENGINEER_SUBCONTRACTORS // ... Engineering Firm Name if (!engineerSubcontractorRow.IsEngineeringFirmIDNull()) { companiesGateway.LoadAllByCompaniesId((int)engineerSubcontractorRow.EngineeringFirmID, companyId); engineerSubcontractorRow.EngineerFirmName = companiesGateway.GetName((int)engineerSubcontractorRow.EngineeringFirmID); } // ... Engineering Name if (!engineerSubcontractorRow.IsEngineerIDNull()) { contactsGateway.LoadAllByContactId((int)engineerSubcontractorRow.EngineerID, companyId); engineerSubcontractorRow.EngineerName = contactsGateway.GetCompleteName((int)engineerSubcontractorRow.EngineerID); } }
protected int GetSubContratorID(object value) { if (value != DBNull.Value) { int companyId = Int32.Parse(Session["companyID"].ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId((int)value, companyId); bool deleted = companiesGateway.GetDeleted((int)value); if (deleted) { return -1; } else { return Int32.Parse(value.ToString()); } } else { return -1; } }
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(); }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_EDIT"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_edit.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfProjectId.Value = Request.QueryString["project_id"]; hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); hdfDataChanged.Value = Request.QueryString["data_changed"]; hdfDataChangedMessage.Value = "Changes made to this project will not be saved."; // Prepare initial data Session.Remove("projectNotesDummy"); Session.Remove("projectServicesDummy"); Session.Remove("projectTypeOfWorkFunctionClassificationDummy"); Session.Remove("projectJobClassClassificationDummy"); Session.Remove("projectBudgetDummy"); Session.Remove("subcontractorsBudgetDummy"); Session.Remove("hotelsBudgetDummy"); Session.Remove("bondingsBudgetDummy"); Session.Remove("insurancesBudgetDummy"); Session.Remove("otherCostsBudgetDummy"); Session["fairWage"] = "None"; // ... Set initial tab if ((string)Session["dialogOpenedProjects"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; } else { hdfActiveTab.Value = (string)Session["activeTabProjects"]; } // ... For Library if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } // If coming from // ... projects2.aspx or project_add.aspx if (Request.QueryString["source_page"] == "projects2.aspx" || Request.QueryString["source_page"] == "project_add.aspx") { // Store Navigator State, Update control and Origin StoreNavigatorState(); ViewState["update"] = "no"; ViewState["origin"] = "navigator"; // Get Project Id int projectId = int.Parse(hdfProjectId.Value); // ... Attachment control if (Session["fromAttachment"] != null) { if (Session["fromAttachment"].ToString() == "yes") { // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; } Session.Remove("fromAttachment"); } else { // Get dataset projectTDS = new ProjectTDS(); projectNavigatorTDS = new ProjectNavigatorTDS(); projectNotes = new ProjectNavigatorTDS.ProjectNotesDataTable(); projectServices = new ProjectNavigatorTDS.ProjectServiceDataTable(); projectTypeOfWorkFunctionClassification = new ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable(); projectJobClassClassification = new ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable(); projectBudget = new ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable(); unitsBudget = new ProjectNavigatorTDS.ProjectUnitsBudgetDataTable(); materialsBudget = new ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable(); subcontractorsBudget = new ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable(); hotelsBudget = new ProjectNavigatorTDS.ProjectHotelsBudgetDataTable(); bondingsBudget = new ProjectNavigatorTDS.ProjectBondingsBudgetDataTable(); insurancesBudget = new ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable(); otherCostsBudget = new ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable(); // Get General Data ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS); projectGatewayForLoad.LoadByProjectId(projectId); // Get job info ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS); projectJobInfoGateway.LoadAllByProjectId(projectId); // Get Sale/Billing/Pricing ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS); projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Sale/Billing/Pricing - Services ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS); projectNavigatorProjectService.LoadAllByProjectId(projectId); projectNavigatorProjectService.UpdateForLoad(); // Get Costing Updates ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS); projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId); // Get Project Terms ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS); projectTermsPOGatewayForLoad.LoadByProjectId(projectId); // Get Technical ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS); projectTechnicalGatewayForLoad.LoadByProjectId(projectId); // Get Engineer Subcontractors ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS); projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Subcontractors ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS); projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId); // Cost Exceptions // ... Get Type Of Work & Function Classification ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId); // ... Get Job Class Classification ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId); // Get Budget ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS); projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId); // Get Units Budget ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS); projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId); // Get Materials Budget ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS); projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId); // Get Subcontractors Budget ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS); projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId); // Get Hotels Budget ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS); projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId); // Get Bondings Budget ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS); projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId); // Get Insurances Budget ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS); projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId); // Get Other Costs Budget ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS); projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId); // Get Notes ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); projectNavigatorProjectNotes.LoadAllByProjectId(projectId); // Store dataset Session["lfsProjectTDS"] = projectTDS; Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; Session["projectServices"] = projectNavigatorTDS.ProjectService; Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget; Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget; Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget; Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget; Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget; Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget; Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget; Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget; } //grdNotes.DataBind(); //grdServices.DataBind(); grdTypeOfWorkFunctionClassification.DataBind(); grdJobClassClassification.DataBind(); grdBudget.DataBind(); /*grdSubcontractorsBudget.DataBind(); grdHotelsBudget.DataBind(); grdBondingsBudget.DataBind(); grdInsurancesBudget.DataBind();*/ grdOtherCostsBudget.DataBind(); } // ... project_summary.aspx or project_edit.aspx if ((Request.QueryString["source_page"] == "project_summary.aspx") || (Request.QueryString["source_page"] == "project_edit.aspx") || (Request.QueryString["source_page"] == "lm")) { // Store Navigator State, update control and origin StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; ViewState["origin"] = Request.QueryString["origin"]; //summary // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; // Get Project Id int projectId = int.Parse(hdfProjectId.Value); if (ViewState["update"].ToString().Trim() == "yes") { // Get General Data ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS); projectGatewayForLoad.LoadByProjectId(projectId); // Get job info ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS); projectJobInfoGateway.LoadAllByProjectId(projectId); // Get Sale/Billing/Pricing ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS); projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Sale/Billing/Pricing - Services ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS); projectNavigatorProjectService.LoadAllByProjectId(projectId); projectNavigatorProjectService.UpdateForLoad(); // Get Costing Updates ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS); projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId); // Get Project Terms ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS); projectTermsPOGatewayForLoad.LoadByProjectId(projectId); // Get Technical ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS); projectTechnicalGatewayForLoad.LoadByProjectId(projectId); // Get Engineer Subcontractors ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS); projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Subcontractors ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS); projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId); // Cost Exceptions // ... Get Type Of Work & Function Classification ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId); // ... Get Job Class Classification ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId); // Get Budget ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS); projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId); // Get Units Budget ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS); projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId); // Get Materials Budget ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS); projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId); // Get Subcontractors Budget ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS); projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId); // Get Hotels Budget ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS); projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId); // Get Bondings Budget ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS); projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId); // Get Insurances Budget ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS); projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId); // Get Other Costs Budget ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS); projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId); // Get Notes ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); projectNavigatorProjectNotes.LoadAllByProjectId(projectId); //grdNotes.DataBind(); //grdServices.DataBind(); grdTypeOfWorkFunctionClassification.DataBind(); grdJobClassClassification.DataBind(); grdBudget.DataBind(); /*grdSubcontractorsBudget.DataBind(); grdHotelsBudget.DataBind(); grdBondingsBudget.DataBind(); grdInsurancesBudget.DataBind();*/ grdOtherCostsBudget.DataBind(); // Store dataset Session["lfsProjectTDS"] = projectTDS; Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; Session["projectServices"] = projectNavigatorTDS.ProjectService; Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget; Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget; Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget; Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget; Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget; Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget; Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget; Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget; } } // Data for current project ProjectGateway projectGateway = new ProjectGateway(projectTDS); // ... for project int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString()); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")"; // ... for client int companyId = Int32.Parse(hdfCompanyId.Value); int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId(currentClientId, companyId); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); // Load Data LoadData(); // Store Dataset Session["lfsProjectTDS"] = projectTDS; //// ... For total cost at services //ProjectNavigatorProjectService projectNavigatorProjectServiceForCost = new ProjectNavigatorProjectService(projectNavigatorTDS); //tbxTotalCost.Text = Decimal.Round(projectNavigatorProjectServiceForCost.GetTotalCost(), 2).ToString(); } else { // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; tbxProjectNumber.DataBind(); if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } } }
/// <summary> /// UpdateForProcess /// </summary> /// <param name="projectId">projectId</param> /// <param name="companiesId">companiesId</param> /// <param name="salesmanId">salesmanId</param> /// <param name="projectLeadId">projectLeadId</param> /// <param name="companyId">companyId</param> public void UpdateForReport(int projectId, int companiesId, int salesmanId, int projectLeadId, int companyId) { CompaniesGateway companiesGateway = new CompaniesGateway(); AddressGateway addressGateway = new AddressGateway(); ContactsGateway contactsGateway = new ContactsGateway(); PhoneGateway phoneGateway = new PhoneGateway(); EmployeeGateway employeeGateway = new EmployeeGateway(); ProjectSynopsisReportTDS.LFS_PROJECTRow projectRow = GetProjectRow(projectId); // Companies Name companiesGateway.LoadAllByCompaniesId(companiesId, companyId); projectRow.ClientName = companiesGateway.GetName(companiesId); // Companies Address addressGateway.LoadByCompaniesId(companiesId, companyId); projectRow.ClientAddress = addressGateway.GetAddressByCompaniesId(companiesId); // Submitted By // ...If the project has a record at history employeeGateway.LoadByEmployeeId(salesmanId); projectRow.SubmittedBy = employeeGateway.GetLastName(salesmanId) + " " + employeeGateway.GetFirstName(salesmanId); // ... Leaded By if (projectLeadId > 0) { employeeGateway.LoadByEmployeeId(projectLeadId); projectRow.LeadedBy = employeeGateway.GetLastName(projectLeadId) + " " + employeeGateway.GetFirstName(projectLeadId); } else { projectRow.LeadedBy = ""; } // ... Primary contact if (!projectRow.IsClientPrimaryContactIDNull()) { // ... ... Primary contact name contactsGateway.LoadAllByContactId(projectRow.ClientPrimaryContactID, companyId); projectRow.ClientPrimaryContactName = contactsGateway.GetCompleteName(projectRow.ClientPrimaryContactID); // ... ... Primary contact position projectRow.ClientPrimaryContactPosition = contactsGateway.GetCompaniesPosition(projectRow.ClientPrimaryContactID); // ... ... Phone phoneGateway.LoadByContactId(projectRow.ClientPrimaryContactID, companyId); projectRow.ClientPrimaryContactPhones = phoneGateway.GetPhones(projectRow.ClientPrimaryContactID); } // ... Secondary contact if (!projectRow.IsClientSecondaryContactIDNull()) { // ... ... Primary contact name contactsGateway.LoadAllByContactId(projectRow.ClientSecondaryContactID, companyId); projectRow.ClientSecondaryContactName = contactsGateway.GetCompleteName(projectRow.ClientSecondaryContactID); // ... ... Primary contact position projectRow.ClientSecondaryContactPosition = contactsGateway.GetCompaniesPosition(projectRow.ClientSecondaryContactID); // ... ... Phone phoneGateway.LoadByContactId(projectRow.ClientSecondaryContactID, companyId); projectRow.ClientSecondaryContactPhones = phoneGateway.GetPhones(projectRow.ClientSecondaryContactID); } }
protected string GetSubcontractorId(object value) { int companyId = Int32.Parse(Session["companyID"].ToString()); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId((int)value, companyId); return companiesGateway.GetName((int)value); }
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(); }