Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        private void PostPageChanges()
        {
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);
            int projectId = int.Parse(hdfProjectId.Value);

            // General Data
            Int64 countryId = projectGateway.GetCountryID(projectId);
            int officeId = projectGateway.GetOfficeID(projectId);
            Int64? provinceId = projectGateway.GetProvinceID(projectId);
            Int64? cityId = projectGateway.GetCityID(projectId);
            Int64? countyId = projectGateway.GetCountyID(projectId);
            int? projectLeadId = null; if ((ddlProjectLeadId.SelectedValue != "-1") && (ddlProjectLeadId.SelectedIndex > -1)) projectLeadId = int.Parse(ddlProjectLeadId.SelectedValue);
            int salesmanId = int.Parse(ddlSalesmanId.SelectedValue);
            string projectType = projectGateway.GetProjectType(projectId);
            string projectState = projectGateway.GetProjectState(projectId);
            string name = tbxName.Text.Trim();
            string description = tbxDescription.Text.Trim();
            DateTime? proposalDate = null; if (tkrdpProposalDate.SelectedDate.HasValue) proposalDate = tkrdpProposalDate.SelectedDate.Value;
            DateTime? startDate = null; if (tkrdpStartDate.SelectedDate.HasValue) startDate = tkrdpStartDate.SelectedDate.Value;
            DateTime? endDate = null; if (tkrdpEndDate.SelectedDate.HasValue) endDate = tkrdpEndDate.SelectedDate.Value;
            int clientId = projectGateway.GetClientID(projectId);
            string clientProjectNumber = tbxClientProjectNumber.Text.Trim();
            int? clientPrimaryContactId = null; if ((ddlClientPrimaryContactId.SelectedValue != "-1") && (ddlClientPrimaryContactId.SelectedIndex > -1)) clientPrimaryContactId = int.Parse(ddlClientPrimaryContactId.SelectedValue);
            int? clientSecondaryContactId = null; if ((ddlClientSecondaryContactId.SelectedValue != "-1") && (ddlClientSecondaryContactId.SelectedIndex > -1)) clientSecondaryContactId = int.Parse(ddlClientSecondaryContactId.SelectedValue);
            bool deleted = projectGateway.GetDeleted(projectId);
            int? libraryCategoriesId = null; if (projectGateway.GetLibraryCategoriesId(projectId).HasValue) libraryCategoriesId = (int)projectGateway.GetLibraryCategoriesId(projectId);
            bool fairWageApplies = cbxFairWageApplies.Checked;

            // ... Update Project Number
            Project project = new Project(projectTDS);
            string projectNumber;

            if (projectGateway.GetOriginalProjectID(projectId) == null)
            {
                projectNumber = project.UpdateProjectNumber(projectId, salesmanId);
            }
            else
            {
                projectNumber = projectGateway.GetProjectNumber(projectId);
            }

            // ... Update Project
            project.Update(projectId, countryId, officeId, projectLeadId, salesmanId, projectNumber, projectType, projectState, name, description, proposalDate, startDate, endDate, clientId, clientProjectNumber, clientPrimaryContactId, clientSecondaryContactId, deleted, libraryCategoriesId, provinceId, cityId, Int32.Parse(hdfCompanyId.Value.Trim()), countyId, fairWageApplies);

            // ... If project type is Ballpark update Bill Price and Bill Money
            if (projectType == "Ballpark")
            {
                ProjectSaleBillingPricing projectSaleBillingPricingForGeneralData = new ProjectSaleBillingPricing(projectTDS);

                decimal? billPrice = null; if (tbxBillPrice.Text != "") billPrice = Convert.ToDecimal(tbxBillPrice.Text);
                string billMoney = ddlBillMoney.SelectedValue;

                projectSaleBillingPricingForGeneralData.UpdateBillPrice(projectId, billPrice, billMoney);
            }

            if ((projectType != "Ballpark") && (projectType != "Internal"))
            {
                // Sale/Billing/Pricing
                //bool saleBidProject = cbxSaleBidProject.Checked;
                //bool saleRFP = cbxSaleRFP.Checked;
                //bool saleSoleSource = cbxSaleSoleSource.Checked;
                //bool saleTermContract = cbxSaleTermContract.Checked;
                //string saleTermContractDetail = tbxSaleTermContractDetail.Text.Trim();
                //bool saleOther = cbxSaleOther.Checked;
                //string saleOtherDetail = tbxSaleOtherDetail.Text.Trim();
                //int? saleGettingJob = null; if (tbxSaleGettingJob.Text.Trim() != "") saleGettingJob = int.Parse(tbxSaleGettingJob.Text.Trim());
                decimal? billPriceSaleBillingPricing = null; if (tbxBillPriceSaleBillingPricing.Text.Trim() != "") billPriceSaleBillingPricing = decimal.Parse(tbxBillPriceSaleBillingPricing.Text.Trim());
                string billMoneySaleBillingPricing = ddlBillMoneySaleBillingPricing.SelectedValue;
                decimal? billSubcontractorAmount = null; if (tbxBillSubcontractorAmount.Text.Trim() != "") billSubcontractorAmount = decimal.Parse(tbxBillSubcontractorAmount.Text.Trim());
                //string billBidHardDollar = tbxBillBidHardDollar.Text.Trim();
                //bool billPerUnit = cbxBillPerUnit.Checked;
                //bool billHourly = cbxBillHourly.Checked;
                //string billExpectExtras = tbxBillExpectExtras.Text.Trim();
                //bool chargesWater = cbxChargesWater.Checked;
                //decimal? chargesWaterAmount = null; if (tbxChargesWaterAmount.Text.Trim() != "") chargesWaterAmount = decimal.Parse(tbxChargesWaterAmount.Text.Trim());
                //bool chargesDisposal = cbxChargesDisposal.Checked;
                //decimal? chargesDisposalAmount = null; if (tbxChargesDisposalAmount.Text.Trim() != "") chargesDisposalAmount = decimal.Parse(tbxChargesDisposalAmount.Text.Trim());

                // ... Update Sale/Billing/Pricing
                ProjectSaleBillingPricing projectSaleBillingPricing = new ProjectSaleBillingPricing(projectTDS);
                //projectSaleBillingPricing.Update(projectId, saleBidProject, saleRFP, saleSoleSource, saleTermContract, saleTermContractDetail, saleOther, saleOtherDetail, saleGettingJob, billPriceSaleBillingPricing, billMoneySaleBillingPricing, billBidHardDollar, billPerUnit, billHourly, billExpectExtras, billSubcontractorAmount, chargesWater, chargesWaterAmount, chargesDisposal, chargesDisposalAmount, Int32.Parse(hdfCompanyId.Value.Trim()));
                projectSaleBillingPricing.Update(projectId, billPriceSaleBillingPricing, billMoneySaleBillingPricing, billSubcontractorAmount, Int32.Parse(hdfCompanyId.Value.Trim()));

                // ... Update job info
                bool typeOfWorkMhRehab = ckbxMhRehab.Checked;
                bool typeOfWorkJunctionLining = ckbxJunctionLining.Checked;
                bool typeOfWorkProjectManagement = ckbxProjectManagement.Checked;
                bool typeOfWorkFullLenghtLining = ckbxFullLengthLining.Checked;
                bool typeOfWorkPointRepairs = ckbxPointRepairs.Checked;
                bool typeOfWorkRehabAssessment = ckbxRehabAssessment.Checked;
                bool typeOfWorkGrout = ckbxGrout.Checked;
                bool typeOfWorkOther = ckbxOther.Checked;
                bool agreement = cbxSubcontractorAgreement.Checked;
                bool writtenQuote = cbxSubcontractorWrittenQuote.Checked;
                string role = tbxSubcontractorRole.Text;

                ProjectNavigatorProjectJobInfo projectNavigatorProjectJobInfo = new ProjectNavigatorProjectJobInfo(projectNavigatorTDS);
                projectNavigatorProjectJobInfo.Update(projectId, typeOfWorkMhRehab, typeOfWorkJunctionLining, typeOfWorkProjectManagement, typeOfWorkFullLenghtLining, typeOfWorkPointRepairs, typeOfWorkRehabAssessment, typeOfWorkGrout, typeOfWorkOther, agreement, writtenQuote, role);

                // Costing Updates
                //decimal? extrasToDate = null; if (tbxExtrasToDate.Text.Trim() != "") extrasToDate = decimal.Parse(tbxExtrasToDate.Text.Trim());
                //decimal? costsIncurred = null; if (tbxCostsIncurred.Text.Trim() != "") costsIncurred = decimal.Parse(tbxCostsIncurred.Text.Trim());
                //decimal? costToComplete = null; if (tbxCostToComplete.Text.Trim() != "") costToComplete = decimal.Parse(tbxCostToComplete.Text.Trim());
                //decimal? originalProfitEstimated = null; if (tbxOriginalProfitEstimated.Text.Trim() != "") originalProfitEstimated = decimal.Parse(tbxOriginalProfitEstimated.Text.Trim());
                //decimal? invoicedToDate = null; if (tbxInvoicedToDate.Text.Trim() != "") invoicedToDate = decimal.Parse(tbxInvoicedToDate.Text.Trim());

                // ... Update Costing Updates
                //ProjectCostingUpdates projectCostingUpdates = new ProjectCostingUpdates(projectTDS);
                //projectCostingUpdates.Update(projectId, extrasToDate, costsIncurred, costToComplete, originalProfitEstimated, invoicedToDate, Int32.Parse(hdfCompanyId.Value.Trim()));

                // Terms/PO
                // ... Liquidated Damage
                //bool liquidateDamage = cbxLiquidatedDamages.Checked;
                //decimal? liquidatedRate = null;
                //if (tbxLiquidatedDamagesRate.Text.Trim() != "") { decimal damages = Decimal.Parse(tbxLiquidatedDamagesRate.Text.Trim()); liquidatedRate = Decimal.Round(damages, 2); }
                //string liquidatedUnit = null; if (tbxLiquidatedDamagesUnit.Text != "") liquidatedUnit = tbxLiquidatedDamagesUnit.Text.Trim();

                //// ... Client LFS Relationship
                //bool clientWorkedBefore = cbxWorkedBefore.Checked;
                //string clientQuirks = null; if (tbxClientQuirks.Text.Trim() != "") clientQuirks = tbxClientQuirks.Text.Trim();
                //bool clientPromises = cbxClientPromises.Checked;
                //string clientPromisesNotes = null; if (tbxClientPromises.Text.Trim() != "") clientPromisesNotes = tbxClientPromises.Text.Trim();
                //string waterObtain = null; if (tbxWaterObtain.Text.Trim() != "") waterObtain = tbxWaterObtain.Text.Trim();
                //string materialDispose = null; if (tbxMaterialDispose.Text.Trim() != "") materialDispose = tbxMaterialDispose.Text.Trim();
                //bool requireRPZ = cbxRequireRPZ.Checked;
                //string standardHydrantFitting = null; if (tbxStandardHydrantFitting.Text.Trim() != "") standardHydrantFitting = tbxStandardHydrantFitting.Text.Trim();
                //bool preconstructionMeeting = cbxPreConstructionMeetingNeed.Checked;
                //bool specificMeetingLocation = cbxSpecificMeetingLocation.Checked;
                //string specificMeetingLocationNotes = null; if (tbxSpecificMeetingLocation.Text.Trim() != "") specificMeetingLocationNotes = tbxSpecificMeetingLocation.Text.Trim();
                //string vehicleAccess = null; if (ddlVehicleAccess.Text.Trim() != "") vehicleAccess = ddlVehicleAccess.Text.Trim();
                //string vehicleAccessNotes = null; if (tbxVehicleAccess.Text.Trim() != "") vehicleAccessNotes = tbxVehicleAccess.Text.Trim();
                string projectOutcome = null; if (tbxDesireOutcomeOfProject.Text.Trim() != "") projectOutcome = tbxDesireOutcomeOfProject.Text.Trim();
                string specificReportingNeeds = null; if (tbxSpecificReportingNeeds.Text.Trim() != "") specificReportingNeeds = tbxSpecificReportingNeeds.Text.Trim();
                bool vehicleAccessRoad = ckbxVehicleAccessRoad.Checked;
                bool vehicleAccessEasement = ckbxVehicleAccessEasement.Checked;
                bool vehicleAccessOther = ckbxVehicleAccessOther.Checked;

                //... Purchase Order
                //bool orderAttached = cbxPurchaseOrderAttach.Checked;
                string orderNumber = null; if (tbxPurchaseOrderNumber.Text.Trim() != "") orderNumber = tbxPurchaseOrderNumber.Text.Trim();
                //string orderNotes = null; if (tbxPurchaseOrderWillNotProvided.Text.Trim() != "") orderNotes = tbxPurchaseOrderWillNotProvided.Text.Trim();

                // ... Update Term/PO
                ProjectTermsPO projectTermsPO = new ProjectTermsPO(projectTDS);
                //projectTermsPO.Update(projectId, liquidateDamage, liquidatedRate, liquidatedUnit, clientWorkedBefore, clientQuirks, clientPromises, clientPromisesNotes, waterObtain, materialDispose, requireRPZ, standardHydrantFitting, preconstructionMeeting, specificMeetingLocation, specificMeetingLocationNotes, vehicleAccess, vehicleAccessNotes, projectOutcome, specificReportingNeeds, orderNumber, orderAttached, orderNotes, Int32.Parse(hdfCompanyId.Value.Trim()));
                projectTermsPO.Update(projectId, projectOutcome, specificReportingNeeds, orderNumber,  Int32.Parse(hdfCompanyId.Value.Trim()), vehicleAccessRoad, vehicleAccessEasement, vehicleAccessOther);

                // Technical
                bool availableDrawings = cbxAvailableDrawings.Checked;
                bool availableVideo = cbxAvailableVideo.Checked;
                //bool groundConditions = cbxGroundConditions.Checked;
                //string groundConditionNotes = null; if (tbxGroundCondition.Text != "") groundConditionNotes = tbxGroundCondition.Text.Trim();
                //bool reviewVideoInspections = cbxReviewVideoInspections.Checked;
                //bool strangeConfigurations = cbxStrangeConfigurations.Checked;
                //string strangeConfigurationsNotes = null; if (tbxStrangeConfigurations.Text != "") strangeConfigurationsNotes = tbxStrangeConfigurations.Text.Trim();
                //string furtherObservations = null; if (tbxFurtherObservations.Text != "") furtherObservations = tbxFurtherObservations.Text.Trim();
                //string restrictiveFactors = null; if (tbxRestrictiveFactors.Text != "") restrictiveFactors = tbxRestrictiveFactors.Text.Trim();

                // ... Update Technical
                ProjectTechnical projectTechnical = new ProjectTechnical(projectTDS);
                //projectTechnical.Update(projectId, availableDrawings, availableVideo, groundConditions, groundConditionNotes, reviewVideoInspections, strangeConfigurations, strangeConfigurationsNotes, furtherObservations, restrictiveFactors, Int32.Parse(hdfCompanyId.Value.Trim()));
                projectTechnical.Update(projectId, availableDrawings, availableVideo,  Int32.Parse(hdfCompanyId.Value.Trim()));

                // Engineer/Subcontractors
                bool generalContractor = cbxGeneralContractor.Checked;
                bool generalWSIB = cbxGeneralWSIB.Checked;
                bool generalInsuranceCertificate = cbxGeneralInsuranceCertificate.Checked;
                string generalBondingSupplied = ddlGeneralBondingSupplied.SelectedValue;
                //string generalMOLForm = ddlGeneralMOLForm.SelectedValue;
                //bool generalNoticeProject = rbtnGeneralNoticeProject.Checked;
                //bool generalForm1000 = rbtnGeneralForm1000.Checked;
                //int? engineeringFirmId = null; if (ddlEngineeringFirmId.SelectedValue != "") engineeringFirmId = int.Parse(ddlEngineeringFirmId.SelectedValue);
                //int? engineerId = null; if (ddlEngineerId.SelectedValue != "") engineerId = int.Parse(ddlEngineerId.SelectedValue);
                //string engineerNumber = tbxEngineerNumber.Text.Trim();
                bool subcontractorUsed = cbxSubcontractorUsed.Checked;
                string bondNumber = tbxBondNumber.Text.Trim();

                // ... Update Engineer/Subcontractors
                ProjectEngineerSubcontractors projectEngineerSubcontractors = new ProjectEngineerSubcontractors(projectTDS);
                //projectEngineerSubcontractors.Update(projectId, generalContractor, generalWSIB, generalInsuranceCertificate, generalBondingSupplied, generalMOLForm, generalNoticeProject, generalForm1000, engineeringFirmId, engineerId, engineerNumber, subcontractorUsed, Int32.Parse(hdfCompanyId.Value.Trim()), bondNumber);
                projectEngineerSubcontractors.Update(projectId, generalContractor, generalWSIB, generalInsuranceCertificate, generalBondingSupplied, subcontractorUsed, Int32.Parse(hdfCompanyId.Value.Trim()), bondNumber);

                // ... Update subcontractors
                //ProjectSubcontractor projectSubcontractor = new ProjectSubcontractor(projectTDS);

                //bool subcontractorWrittenQuote = ((CheckBox)row.FindControl("cbxSubcontractorWrittenQuote")).Checked;
                //bool subcontractorAgreement = ((CheckBox)row.FindControl("cbxSubcontractorAgreement")).Checked;

                ////foreach (GridViewRow row in grdvSubcontractors.Rows)
                //{
                //    int subcontractorRefId = int.Parse(((HiddenField)row.FindControl("hdfRefId")).Value);
                //    int subcontractorId = int.Parse(((DropDownList)row.FindControl("ddlSubcontractorId")).SelectedValue);

                //    bool subcontractorSurveyedSite = ((CheckBox)row.FindControl("cbxSubcontractorSurveyedSite")).Checked;
                //    bool subcontractorWorkedBefore = ((CheckBox)row.FindControl("cbxSubcontractorWorkedBefore")).Checked;
                //    string subcontractorRole = ((TextBox)row.FindControl("tbxSubcontractorRole")).Text.Trim();

                //    string subcontractorIssues = ((TextBox)row.FindControl("tbxSubcontractorIssues")).Text.Trim();
                //    bool subcontractorPurchaseOrder = ((CheckBox)row.FindControl("cbxSubcontractorPurchaseOrder")).Checked;
                //    bool subcontractorInsuranceCertificate = ((CheckBox)row.FindControl("cbxSubcontractorInsuranceCertificate")).Checked;
                //    bool subcontractorWSIB = ((CheckBox)row.FindControl("cbxSubcontractorWSIB")).Checked;
                //    string subcontractorMOLForm1000 = ((DropDownList)row.FindControl("ddlSubcontractorMolForm1000")).SelectedValue;
                //    int? royalties = null;
                //    if (((TextBox)row.FindControl("tbxRoyalties")).Text != "")
                //    {
                //        royalties = Int32.Parse(((TextBox)row.FindControl("tbxRoyalties")).Text);
                //    }

                    //projectSubcontractor.Update(projectId, subcontractorRefId, subcontractorId, subcontractorWrittenQuote, subcontractorSurveyedSite, subcontractorWorkedBefore, subcontractorRole, subcontractorAgreement, subcontractorIssues, subcontractorPurchaseOrder, subcontractorInsuranceCertificate, subcontractorWSIB, subcontractorMOLForm1000, false, Int32.Parse(hdfCompanyId.Value.Trim()), royalties);
                    //projectSubcontractor.Update(projectId, 1,  subcontractorWrittenQuote, subcontractorAgreement, Int32.Parse(hdfCompanyId.Value.Trim()));
                //}

                decimal unitsBudget = 0M; if (tbxUnitsBudget.Text.Trim() != "") unitsBudget = decimal.Parse(tbxUnitsBudget.Text);
                decimal materialsBudget = 0M; if (tbxMaterialsBudget.Text.Trim() != "") materialsBudget = decimal.Parse(tbxMaterialsBudget.Text);
                decimal subcontractorsBudget = 0M; if (tbxSubcontractorsBudget.Text.Trim() != "") subcontractorsBudget = decimal.Parse(tbxSubcontractorsBudget.Text);
                decimal hotelsBudget = 0M; if (tbxHotelsBudget.Text.Trim() != "") hotelsBudget = decimal.Parse(tbxHotelsBudget.Text);
                decimal bondingsBudget = 0M; if (tbxBondingsBudget.Text.Trim() != "") bondingsBudget = decimal.Parse(tbxBondingsBudget.Text);
                decimal insurancesBudget = 0M; if (tbxInsurancesBudget.Text.Trim() != "") insurancesBudget = decimal.Parse(tbxInsurancesBudget.Text);

                ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS);
                if (projectNavigatorProjectUnitsBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectUnitsBudget.Update(projectId, unitsBudget);
                }
                else
                {
                    projectNavigatorProjectUnitsBudget.Insert(projectId, unitsBudget, false, Int32.Parse(hdfCompanyId.Value), false);
                }

                ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS);
                if (projectNavigatorProjectMaterialsBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectMaterialsBudget.Update(projectId, materialsBudget);
                }
                else
                {
                    projectNavigatorProjectMaterialsBudget.Insert(projectId, materialsBudget, false, Int32.Parse(hdfCompanyId.Value), false);
                }

                ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS);
                if (projectNavigatorProjectSubcontractorsBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectSubcontractorsBudget.Update(projectId, 1, 1, subcontractorsBudget, false, Int32.Parse(hdfCompanyId.Value));
                }
                else
                {
                    projectNavigatorProjectSubcontractorsBudget.Insert(projectId, 1, subcontractorsBudget, false, Int32.Parse(hdfCompanyId.Value), false, "");
                }

                ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS);
                if (projectNavigatorProjectHotelsBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectHotelsBudget.Update(projectId, 1, 1, hotelsBudget, false, Int32.Parse(hdfCompanyId.Value));
                }
                else
                {
                    projectNavigatorProjectHotelsBudget.Insert(projectId, 1, hotelsBudget, false, Int32.Parse(hdfCompanyId.Value), false, "");
                }

                ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS);
                if (projectNavigatorProjectBondingsBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectBondingsBudget.Update(projectId, 1, 1, bondingsBudget, false, Int32.Parse(hdfCompanyId.Value));
                }
                else
                {
                    projectNavigatorProjectBondingsBudget.Insert(projectId, 1, bondingsBudget, false, Int32.Parse(hdfCompanyId.Value), false, "");
                }

                ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS);
                if (projectNavigatorProjectInsurancesBudget.Table.Rows.Count > 0)
                {
                    projectNavigatorProjectInsurancesBudget.Update(projectId, 1, 1, insurancesBudget, false, Int32.Parse(hdfCompanyId.Value));
                }
                else
                {
                    projectNavigatorProjectInsurancesBudget.Insert(projectId, 1, insurancesBudget, false, Int32.Parse(hdfCompanyId.Value), false, "");
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set ddlTools
            DropDownList ddlTools = (DropDownList)tkrpbLeftMenuCurrentProject.FindItemByValue("Tools").FindControl("ddlTools");
            ddlTools.Attributes.Add("onchange", "return OpenTools(this);");

            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            lblHeaderTitle.Text = "Project Sections";

            // Project type check
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(Int32.Parse(hdfProjectId.Value));

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Proposal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Proposal";

                lblTitleProject.Text = " > Proposal: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Project")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Project";

                lblTitleProject.Text = " > Project: ";
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Internal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Internal Project";

                lblTitleProject.Text = " > Internal Project: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Ballpark";

                lblTitleProject.Text = " > Ballpark: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                tkrpbLeftMenuReports.Visible = false;
            }
        }
Ejemplo n.º 4
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Reload data for work and functions depending if it's faire wage or not.
            grdTypeOfWorkFunctionClassification.DataBind();

            // Security check
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);

            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                // ... menu reports
                tkrpbLeftMenuReports.Visible = false;

                // ... for job info tab
                tpJobInfo.Enabled = true;

                // ... for values that comes from sales billing pricing tab
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = false;
            }
            else
            {
                // ... menu reports
                tkrpbLeftMenuReports.Visible = true;

                // ... for job info tab
                tpJobInfo.Enabled = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;
            }

            // Country check
            if (projectGateway.GetCountryID(int.Parse(hdfProjectId.Value)) == 1)
            {
                //ddlGeneralMOLForm.Visible = true;
                //tbxGeneralMOLForm.Visible = false;
                //lblGeneralNoticeProject.Visible = true;
                //rbtnGeneralNoticeProject.Visible = true;
                //lblGeneralForm1000.Visible = true;
                //rbtnGeneralForm1000.Visible = true;

                grdJobClassClassification.Columns[4].HeaderText = "Rate (CAD)";
                grdJobClassClassification.Columns[5].HeaderText = "Fringe Rate (CAD)";
            }
            else
            {
                //ddlGeneralMOLForm.Visible = false;
                //tbxGeneralMOLForm.Visible = true;
                //lblGeneralNoticeProject.Visible = false;
                //rbtnGeneralNoticeProject.Visible = false;
                //lblGeneralForm1000.Visible = false;
                //rbtnGeneralForm1000.Visible = false;

                grdJobClassClassification.Columns[4].HeaderText = "Rate (USD)";
                grdJobClassClassification.Columns[5].HeaderText = "Fringe Rate (USD)";
            }

            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Project type check
            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                // Active Tab
                tcDetailedInformation.ActiveTabIndex = 1;

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                lblHeaderTitle.Text = "Ballpark Summary";
                lblTitleProject.Text = " > Ballpark: ";

                // Initial section
                lblProposalDate.Text = "Ballpark Date";
                lblStartDate.Text = "Potential Start Date";
                lblEndDate.Text = "Potential End Date";
                lblStartDate.Visible = true;
                tkrdpStartDate.Visible = true;
                lblEndDate.Visible = true;
                tkrdpEndDate.Visible = true;

                // Client section
                lblClientProjectNumber.Visible = false;
                tbxClientProjectNumber.Visible = false;
                lblClientPrimaryContactId.Visible = false;
                ddlClientPrimaryContactId.Visible = false;
                btnClientPrimaryContact.Visible = false;
                lblClientSecondaryContactId.Visible = false;
                ddlClientSecondaryContactId.Visible = false;
                btnClientSecondaryContact.Visible = false;

                // Pricing section
                pnlPricing.Visible = true;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = false;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing update
                //tpCostingUpdates.Enabled = false;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = false;
                upnlTermsPO.Visible = false;
                upnlTermsPO1.Visible = false;
                upnlTermsPO2.Visible = false;
                upnlTermsPO3.Visible = false;

                // ... for values that comes from technical
                //tpTechnical.Enabled = false;
                upnlTechnical.Visible = false;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = false;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this ballpark";
                upnlEngineerSubcontractors.Visible = false;
                upnlEngineerSubcontractors1.Visible = false;
                upnlEngineerSubcontractors2.Visible = false;
                upnlEngineerSubcontractors3.Visible = false;
                upnlEngineerSubcontractors4.Visible = false;
                upnlEngineerSubcontractors5.Visible = false;
                upnlEngineerSubcontractors6.Visible = false;
                upnlEngineerSubcontractors7.Visible = false;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Proposal")
            {
                // Set initial tab
                tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                lblHeaderTitle.Text = "Proposal Summary";
                lblTitleProject.Text = " > Proposal: ";

                lblStartDate.Text = "Potential Start Date";
                lblEndDate.Text = "Potential End Date";

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = true;
                upnlTermsPO.Visible = true;
                upnlTermsPO1.Visible = true;
                upnlTermsPO2.Visible = true;
                upnlTermsPO3.Visible = true;

                // ... for values that comes from technical
                //tpTechnical.Enabled = true;
                upnlTechnical.Visible = true;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this proposal";
                upnlEngineerSubcontractors.Visible = true;
                upnlEngineerSubcontractors1.Visible = true;
                upnlEngineerSubcontractors2.Visible = true;
                upnlEngineerSubcontractors3.Visible = true;
                upnlEngineerSubcontractors4.Visible = true;
                upnlEngineerSubcontractors5.Visible = true;
                upnlEngineerSubcontractors6.Visible = true;
                upnlEngineerSubcontractors7.Visible = true;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                if ((projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)) == "Awarded") || (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)) == "Bidding"))
                {
                    tpJobInfo.Enabled = true;

                    //tpCostExceptions.Enabled = true;
                    pnlCostsExceptions.Visible = true;
                }

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Project")
            {
                // Set initial tab
                tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Project";

                lblHeaderTitle.Text = "Project Summary";
                lblTitleProject.Text = " > Project: ";

                lblStartDate.Text = "Start Date";
                lblEndDate.Text = "End Date";

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;

                // ... for values that comes from terms po
                // tpTermsPo.Enabled = true;
                upnlTermsPO.Visible = true;
                upnlTermsPO1.Visible = true;
                upnlTermsPO2.Visible = true;
                upnlTermsPO3.Visible = true;

                // ... for values that comes from technical
                // tpTechnical.Enabled = true;
                upnlTechnical.Visible = true;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this project";
                upnlEngineerSubcontractors.Visible = true;
                upnlEngineerSubcontractors1.Visible = true;
                upnlEngineerSubcontractors2.Visible = true;
                upnlEngineerSubcontractors3.Visible = true;
                upnlEngineerSubcontractors4.Visible = true;
                upnlEngineerSubcontractors5.Visible = true;
                upnlEngineerSubcontractors6.Visible = true;
                upnlEngineerSubcontractors7.Visible = true;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = true;
                pnlCostsExceptions.Visible = true;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Internal")
            {
                // Active Tab
                tcDetailedInformation.ActiveTabIndex = 1;

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                lblHeaderTitle.Text = "Internal Project Summary";
                lblTitleProject.Text = " > Internal Project: ";

                // Initial section
                lblProposalDate.Text = "Internal Project Date";
                lblStartDate.Visible = false;
                tkrdpStartDate.Visible = false;
                lblEndDate.Visible = false;
                tkrdpEndDate.Visible = false;
                tbxDescription.Width = Unit.Pixel(510);

                // Client section
                lblClientProjectNumber.Visible = false;
                tbxClientProjectNumber.Visible = false;
                lblClientPrimaryContactId.Visible = false;
                ddlClientPrimaryContactId.Visible = false;
                btnClientPrimaryContact.Visible = false;
                lblClientSecondaryContactId.Visible = false;
                ddlClientSecondaryContactId.Visible = false;
                btnClientSecondaryContact.Visible = false;

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = false;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing updates
                // tpCostingUpdates.Enabled = false;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = false;
                upnlTermsPO.Visible = false;
                upnlTermsPO1.Visible = false;
                upnlTermsPO2.Visible = false;
                upnlTermsPO3.Visible = false;

                // ... for values that comes from technical
                //tpTechnical.Enabled = false;
                upnlTechnical.Visible = false;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this internal project";
                upnlEngineerSubcontractors.Visible = false;
                upnlEngineerSubcontractors1.Visible = false;
                upnlEngineerSubcontractors2.Visible = false;
                upnlEngineerSubcontractors3.Visible = false;
                upnlEngineerSubcontractors4.Visible = false;
                upnlEngineerSubcontractors5.Visible = false;
                upnlEngineerSubcontractors6.Visible = false;
                upnlEngineerSubcontractors7.Visible = false;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                tkrpbLeftMenuReports.Visible = false;
            }

            // Validate grid columns
            int projectId = Int32.Parse(hdfProjectId.Value);
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            grdTeamMembers.Columns[11].Visible = false;
            grdTeamMembers.Columns[12].Visible = false;
            grdTeamMembers.Columns[13].Visible = false;
            grdTeamMembers.Columns[14].Visible = false;
            grdTeamMembers.Columns[16].Visible = false;
            grdTeamMembers.Columns[17].Visible = false;
            grdTeamMembers.Columns[20].Visible = false;
            grdTeamMembers.Columns[21].Visible = false;

            if (projectGateway.GetCountryID(projectId) == 1) //Canada
            {
                // Team Members Grid
                grdTeamMembers.Columns[15].Visible = true;
                //grdTeamMembers.Columns[15].Visible = true;
                //grdTeamMembers.Columns[16].Visible = true;
                grdTeamMembers.Columns[16].Visible = true;
                grdTeamMembers.Columns[17].Visible = false;
                //grdTeamMembers.Columns[19].Visible = false;
                //grdTeamMembers.Columns[20].Visible = false;
                grdTeamMembers.Columns[22].Visible = false;

                // Units Grid
                grdUnits.Columns[12].Visible = true;
                grdUnits.Columns[13].Visible = true;
                grdUnits.Columns[14].Visible = false;
                grdUnits.Columns[15].Visible = false;

                grdSubcontractors.Columns[9].Visible = true;
                grdSubcontractors.Columns[10].Visible = true;
                grdSubcontractors.Columns[11].Visible = false;
                grdSubcontractors.Columns[12].Visible = false;

                // Materials grid
                grdMaterials.Columns[10].Visible = true;
                grdMaterials.Columns[11].Visible = true;
                grdMaterials.Columns[12].Visible = false;
                grdMaterials.Columns[13].Visible = false;

                // Other costs
                grdOtherCosts.Columns[9].Visible = true;
                grdOtherCosts.Columns[10].Visible = true;
                grdOtherCosts.Columns[11].Visible = false;
                grdOtherCosts.Columns[12].Visible = false;

                // Totals
                lblGrandTotalCost.Text = "Total Cost (CAD) : ";
                tbxTotalCostCad.Visible = true;
                tbxTotalCostUsd.Visible = false;

                lblTeamMembersTotalCost.Text = "Total Cost (CAD) : ";
                tbxTeamMembersTotalCostCAD.Visible = true;
                tbxTeamMembersTotalCostUSD.Visible = false;

                lblUnitsTotalCosts.Text = "Total Cost (CAD) : ";
                tbxUnitsTotalCostsCAD.Visible = true;
                tbxUnitsTotalCostsUSD.Visible = false;

                lblSubcontractorsTotalCosts.Text = "Total Cost (CAD) : ";
                tbxSubcontractorsTotalCostsCAD.Visible = true;
                tbxSubcontractorsTotalCostsUSD.Visible = false;

                lblMaterialsTotalCosts.Text = "Total Cost (CAD) : ";
                tbxMaterialsTotalCostsCAD.Visible = true;
                tbxMaterialsTotalCostsUSD.Visible = false;

                lblOtherCostsTotalCosts.Text = "Total Cost (CAD) : ";
                tbxOtherCostsTotalCostsCAD.Visible = true;
                tbxOtherCostsTotalCostsUSD.Visible = false;

                lblGrandTotal.Text = "Grand Total (CAD)";
            }
            else
            {
                if (projectGateway.GetCountryID(projectId) == 2) //USA
                {
                    // Team Members Grid
                    grdTeamMembers.Columns[15].Visible = false;
                    grdTeamMembers.Columns[18].Visible = false;
                    grdTeamMembers.Columns[19].Visible = true;
                    grdTeamMembers.Columns[22].Visible = true;

                    // Units Grid
                    grdUnits.Columns[12].Visible = false;
                    grdUnits.Columns[13].Visible = false;
                    grdUnits.Columns[14].Visible = true;
                    grdUnits.Columns[15].Visible = true;

                    grdSubcontractors.Columns[9].Visible = false;
                    grdSubcontractors.Columns[10].Visible = false;
                    grdSubcontractors.Columns[11].Visible = true;
                    grdSubcontractors.Columns[12].Visible = true;

                    // Materials grid
                    grdMaterials.Columns[10].Visible = false;
                    grdMaterials.Columns[11].Visible = false;
                    grdMaterials.Columns[12].Visible = true;
                    grdMaterials.Columns[13].Visible = true;

                    // Other costs
                    grdOtherCosts.Columns[9].Visible = false;
                    grdOtherCosts.Columns[10].Visible = false;
                    grdOtherCosts.Columns[11].Visible = true;
                    grdOtherCosts.Columns[12].Visible = true;

                    // Totals
                    lblGrandTotalCost.Text = "Total Cost (USD) : ";
                    tbxTotalCostCad.Visible = false;
                    tbxTotalCostUsd.Visible = true;

                    lblTeamMembersTotalCost.Text = "Total Cost (USD) : ";
                    tbxTeamMembersTotalCostCAD.Visible = false;
                    tbxTeamMembersTotalCostUSD.Visible = true;

                    lblUnitsTotalCosts.Text = "Total Cost (USD) : ";
                    tbxUnitsTotalCostsCAD.Visible = false;
                    tbxUnitsTotalCostsUSD.Visible = true;

                    lblSubcontractorsTotalCosts.Text = "Total Cost (USD) : ";
                    tbxSubcontractorsTotalCostsCAD.Visible = false;
                    tbxSubcontractorsTotalCostsUSD.Visible = true;

                    lblMaterialsTotalCosts.Text = "Total Cost (USD) : ";
                    tbxMaterialsTotalCostsCAD.Visible = false;
                    tbxMaterialsTotalCostsUSD.Visible = true;

                    lblOtherCostsTotalCosts.Text = "Total Cost (USD) : ";
                    tbxOtherCostsTotalCostsCAD.Visible = false;
                    tbxOtherCostsTotalCostsUSD.Visible = true;

                    lblGrandTotal.Text = "Grand Total (USD)";
                }
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Proposal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Proposal";

                lblTitleProject.Text = " > Proposal: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Project")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Project";

                lblTitleProject.Text = " > Project: ";
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Internal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Internal Project";

                lblTitleProject.Text = " > Internal Project: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Ballpark";

                lblTitleProject.Text = " > Ballpark: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                tkrpbLeftMenuReports.Visible = false;
            }
        }
        private void Generate()
        {
            mReport1 master = (mReport1)this.Master;
            int projectId = Int32.Parse(Request.QueryString["project_id"]);

            // Get Data
            // ... For SubContractorName
            int companyId = Int32.Parse(hdfCompanyId.Value);

            LiquiForce.LFSLive.BL.Projects.Projects.ProjectSynopsisReport projectSynopsisReport = new LiquiForce.LFSLive.BL.Projects.Projects.ProjectSynopsisReport();
            projectSynopsisReport.Load(projectId, companyId);

            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            // ... set properties to master page
            master.Data = projectSynopsisReport.Data;
            master.Table = projectSynopsisReport.TableName;

            // Get report
            if (projectSynopsisReport.Table.Rows.Count > 0)
            {
                if (master.Format == "pdf")
                {
                    master.Report = new ProjectSynopsisReport();

                    // Report format
                    master.Report.PrintOptions.PaperOrientation = PaperOrientation.Portrait;
                    master.Report.PrintOptions.PaperSize = PaperSize.PaperLegal;

                    // Security check
                    if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
                    {
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;

                        ReportObject subServiceReport = master.Report.ReportDefinition.ReportObjects["subService"];
                        ReportDocument ee = master.Report.OpenSubreport(subServiceReport.Name);
                        ((Section)ee.ReportDefinition.Sections["ServicesAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                    }

                    if (projectGateway.GetProjectType(projectId) == "Ballpark")
                    {
                        // ... Header of Ballpark
                        ((Section)master.Report.ReportDefinition.Sections["ReportHeaderProjectProposal"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ReportHeaderBallpark"]).SectionFormat.EnableSuppress = false;
                        ((Section)master.Report.ReportDefinition.Sections["ReportHeaderInternalProjects"]).SectionFormat.EnableSuppress = true;

                        // ... Hide Section
                        ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection3"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection4"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["ChargesDetailSection1"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["TermsPurchaseOrderDetailSection1"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection3"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection4"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection5"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection6"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection7"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["PurchaseOrderDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["PurchaseOrderDetailSection2"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection2"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection3"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection4"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection5"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection6"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["EngineerSubcontractorsDetailSection1"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["subContractorsDetailSection1"]).SectionFormat.EnableSuppress = true;

                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                        ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                        // Security check
                        if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
                        {
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;

                            ReportObject subServiceReport = master.Report.ReportDefinition.ReportObjects["subService"];
                            ReportDocument ee = master.Report.OpenSubreport(subServiceReport.Name);
                            ((Section)ee.ReportDefinition.Sections["ServicesAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                        }

                    }

                    else
                    {
                        if (projectGateway.GetProjectType(projectId) == "Internal")
                        {
                            // ... Header of Internal Project
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderProjectProposal"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderBallpark"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderInternalProjects"]).SectionFormat.EnableSuppress = false;

                            // ... Hide Section
                            ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection2"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection3"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ContactInfoDetailSection4"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["ChargesDetailSection1"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["TermsPurchaseOrderDetailSection1"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection2"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection3"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection4"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection5"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection6"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ClientLfsRelationshipDetailSection7"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["PurchaseOrderDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["PurchaseOrderDetailSection2"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection2"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection3"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection4"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection5"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["TechnicalDetailSection6"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["EngineerSubcontractorsDetailSection1"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["subContractorsDetailSection1"]).SectionFormat.EnableSuppress = true;

                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                            // Security check
                            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
                            {
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                                ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                                ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;

                                ReportObject subServiceReport = master.Report.ReportDefinition.ReportObjects["subService"];
                                ReportDocument ee = master.Report.OpenSubreport(subServiceReport.Name);
                                ((Section)ee.ReportDefinition.Sections["ServicesAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                            }

                        }
                        else
                        {
                            // ... Header of Internal Project
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderProjectProposal"]).SectionFormat.EnableSuppress = false;
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderBallpark"]).SectionFormat.EnableSuppress = true;
                            ((Section)master.Report.ReportDefinition.Sections["ReportHeaderInternalProjects"]).SectionFormat.EnableSuppress = true;

                            // Security check
                            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
                            {
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails1Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails2Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails3Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails4Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails5Section"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["SaleBillingPricingDetails6Section"]).SectionFormat.EnableSuppress = true;

                                ((Section)master.Report.ReportDefinition.Sections["ServicesDetailSection1"]).SectionFormat.EnableSuppress = true;
                                ((Section)master.Report.ReportDefinition.Sections["ServicesDetailsSection"]).SectionFormat.EnableSuppress = true;

                                ((Section)master.Report.ReportDefinition.Sections["ServicesTotalAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;

                                ReportObject subServiceReport = master.Report.ReportDefinition.ReportObjects["subService"];
                                ReportDocument ee = master.Report.OpenSubreport(subServiceReport.Name);
                                ((Section)ee.ReportDefinition.Sections["ServicesAveragePriceDetailsSection"]).SectionFormat.EnableSuppress = true;
                            }
                        }
                    }
                }
                else
                {
                }

                // ... set parameters to report
                if (master.Format == "pdf")
                {
                }
            }
        }
        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();
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);

            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                // ... menu reports
                tkrpbLeftMenuReports.Visible = false;

                // ... for job info tab
                tpJobInfo.Enabled = true;

                // ... for values that comes from sales billing pricing tab
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = false;
            }
            else
            {
                // ... menu reports
                tkrpbLeftMenuReports.Visible = true;

                // ... for job info tab
                tpJobInfo.Enabled = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;
            }

            // Country check
            if (projectGateway.GetCountryID(int.Parse(hdfProjectId.Value)) == 1)
            {
                //lblGeneralNoticeProject.Visible = true;
                //rbtnGeneralNoticeProject.Visible = true;
                //lblGeneralForm1000.Visible = true;
                //rbtnGeneralForm1000.Visible = true;

                grdJobClassClassification.Columns[4].HeaderText = "Rate (CAD)";
                grdJobClassClassification.Columns[5].HeaderText = "Fringe Rate (CAD)";
            }
            else
            {
                //lblGeneralNoticeProject.Visible = false;
                //rbtnGeneralNoticeProject.Visible = false;
                //lblGeneralForm1000.Visible = false;
                //rbtnGeneralForm1000.Visible = false;

                grdJobClassClassification.Columns[4].HeaderText = "Rate (USD)";
                grdJobClassClassification.Columns[5].HeaderText = "Fringe Rate (USD)";
            }

            // Project type check
            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                // Active Tab
                tcDetailedInformation.ActiveTabIndex = 1;

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                // Top Menu
                tkrmTop.Items[1].Visible = false;
                tkrmTop.Items[2].Visible = false;
                tkrmTop.Items[3].Visible = false;
                tkrmTop.Items[4].Visible = true;

                lblHeaderTitle.Text = "Ballpark Summary";
                lblTitleProject.Text = " > Ballpark: ";

                // Initial section
                lblProposalDate.Text = "Ballpark Date";
                lblStartDate.Text = "Potential Start Date";
                lblEndDate.Text = "Potential End Date";
                lblStartDate.Visible = true;
                tbxStartDate.Visible = true;
                lblEndDate.Visible = true;
                tbxEndDate.Visible = true;

                // Client section
                lblClientProjectNumber.Visible = false;
                tbxClientProjectNumber.Visible = false;
                lblClientPrimaryContactId.Visible = false;
                tbxClientPrimaryContact.Visible = false;
                btnClientPrimaryContact.Visible = false;
                lblClientSecondaryContactId.Visible = false;
                tbxClientSecondaryContact.Visible = false;
                btnClientSecondaryContact.Visible = false;

                // Pricing section
                pnlPricing.Visible = true;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = false;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing update
                //tpCostingUpdates.Enabled = false;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = false;
                upnlTermsPO.Visible = false;
                upnlTermsPO1.Visible = false;
                upnlTermsPO2.Visible = false;
                upnlTermsPO3.Visible = false;

                // ... for values that comes from technical
                //tpTechnical.Enabled = false;
                upnlTechnical.Visible = false;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this ballpark";
                upnlEngineerSubcontractors.Visible = false;
                upnlEngineerSubcontractors1.Visible = false;
                upnlEngineerSubcontractors2.Visible = false;
                upnlEngineerSubcontractors3.Visible = false;
                upnlEngineerSubcontractors4.Visible = false;
                upnlEngineerSubcontractors5.Visible = false;
                upnlEngineerSubcontractors6.Visible = false;
                upnlEngineerSubcontractors7.Visible = false;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;

                // Project state check
                switch (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)))
                {
                    case "Active":
                        tkrmTop.Items[4].Items[0].Visible = false; //activate
                        tkrmTop.Items[4].Items[1].Visible = true; //cancel
                        tkrmTop.Items[4].Items[2].Visible = true; //hr
                        tkrmTop.Items[4].Items[3].Visible = true; //Promote to proposal
                        tkrmTop.Items[4].Items[4].Visible = true; //Promote to project
                        break;

                    case "Canceled":
                        tkrmTop.Items[4].Items[0].Visible = true; //activate
                        tkrmTop.Items[4].Items[1].Visible = false; //cancel
                        tkrmTop.Items[4].Items[2].Visible = false; //hr
                        tkrmTop.Items[4].Items[3].Visible = false; //Promote to proposal
                        tkrmTop.Items[4].Items[4].Visible = false; //Promote to project
                        break;
                }
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Proposal")
            {
                // Set initial tab
                tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                // Top Menu
                tkrmTop.Items[1].Visible = true;
                tkrmTop.Items[2].Visible = false;
                tkrmTop.Items[3].Visible = false;
                tkrmTop.Items[4].Visible = false;

                lblHeaderTitle.Text = "Proposal Summary";
                lblTitleProject.Text = " > Proposal: ";

                lblStartDate.Text = "Potential Start Date";
                lblEndDate.Text = "Potential End Date";

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = true;
                upnlTermsPO.Visible = true;
                upnlTermsPO1.Visible = true;
                upnlTermsPO2.Visible = true;
                upnlTermsPO3.Visible = true;

                // ... for values that comes from technical
                //tpTechnical.Enabled = true;
                upnlTechnical.Visible = true;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this proposal";
                upnlEngineerSubcontractors.Visible = true;
                upnlEngineerSubcontractors1.Visible = true;
                upnlEngineerSubcontractors2.Visible = true;
                upnlEngineerSubcontractors3.Visible = true;
                upnlEngineerSubcontractors4.Visible = true;
                upnlEngineerSubcontractors5.Visible = true;
                upnlEngineerSubcontractors6.Visible = true;
                upnlEngineerSubcontractors7.Visible = true;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                if ((projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)) == "Awarded") || (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)) == "Bidding"))
                {
                    tpJobInfo.Enabled = true;

                    //tpCostExceptions.Enabled = true;
                    pnlCostsExceptions.Visible = true;
                }

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;

                // Project state check
                switch (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)))
                {
                    case "Bidding":
                        tkrmTop.Items[1].Items[0].Visible = true; //award
                        tkrmTop.Items[1].Items[1].Visible = true; //lost bid
                        tkrmTop.Items[1].Items[2].Visible = true; //cancel
                        tkrmTop.Items[1].Items[3].Visible = false; //bidding
                        tkrmTop.Items[1].Items[4].Visible = true; //hr
                        tkrmTop.Items[1].Items[5].Visible = true; //unpromote
                        tkrmTop.Items[1].Items[6].Visible = false; //promote
                        break;

                    case "Canceled":
                        tkrmTop.Items[1].Items[0].Visible = false;
                        tkrmTop.Items[1].Items[1].Visible = false;
                        tkrmTop.Items[1].Items[2].Visible = false;
                        tkrmTop.Items[1].Items[3].Visible = true;
                        tkrmTop.Items[1].Items[4].Visible = false;
                        tkrmTop.Items[1].Items[5].Visible = false;
                        tkrmTop.Items[1].Items[6].Visible = false;
                        break;

                    case "Lost Bid":
                        tkrmTop.Items[1].Items[0].Visible = false;
                        tkrmTop.Items[1].Items[1].Visible = false;
                        tkrmTop.Items[1].Items[2].Visible = false;
                        tkrmTop.Items[1].Items[3].Visible = true;
                        tkrmTop.Items[1].Items[4].Visible = false; //hr
                        tkrmTop.Items[1].Items[5].Visible = false;
                        tkrmTop.Items[1].Items[6].Visible = false;
                        break;

                    case "Awarded":
                        tkrmTop.Items[1].Items[0].Visible = false;
                        tkrmTop.Items[1].Items[1].Visible = false;
                        tkrmTop.Items[1].Items[2].Visible = false;
                        tkrmTop.Items[1].Items[3].Visible = true;
                        tkrmTop.Items[1].Items[4].Visible = true; //hr
                        tkrmTop.Items[1].Items[5].Visible = false;
                        if (Convert.ToBoolean(Session["sgLFS_PROJECTS_PROMOTEPROPOSALTOPROJECT"]))
                        {
                            tkrmTop.Items[1].Items[6].Visible = true;
                        }
                        else
                        {
                            tkrmTop.Items[1].Items[6].Visible = false;
                        }
                        break;
                }
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Project")
            {
                // Set initial tab
                tcDetailedInformation.ActiveTabIndex = Int32.Parse(hdfActiveTab.Value);

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Project";

                // Top Menu
                tkrmTop.Items[1].Visible = false;
                tkrmTop.Items[2].Visible = true;
                tkrmTop.Items[3].Visible = false;
                tkrmTop.Items[4].Visible = false;

                lblHeaderTitle.Text = "Project Summary";
                lblTitleProject.Text = " > Project: ";

                lblStartDate.Text = "Start Date";
                lblEndDate.Text = "End Date";

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = true;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = true;
                upnlSaleBillingPricingValues.Visible = true;
                upnlSaleBillingPricingValues1.Visible = true;

                // ... for values that comes from costing updates
                //tpCostingUpdates.Enabled = true;

                // ... for values that comes from terms po
                // tpTermsPo.Enabled = true;
                upnlTermsPO.Visible = true;
                upnlTermsPO1.Visible = true;
                upnlTermsPO2.Visible = true;
                upnlTermsPO3.Visible = true;

                // ... for values that comes from technical
                // tpTechnical.Enabled = true;
                upnlTechnical.Visible = true;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this project";
                upnlEngineerSubcontractors.Visible = true;
                upnlEngineerSubcontractors1.Visible = true;
                upnlEngineerSubcontractors2.Visible = true;
                upnlEngineerSubcontractors3.Visible = true;
                upnlEngineerSubcontractors4.Visible = true;
                upnlEngineerSubcontractors5.Visible = true;
                upnlEngineerSubcontractors6.Visible = true;
                upnlEngineerSubcontractors7.Visible = true;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = true;
                pnlCostsExceptions.Visible = true;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;

                // Project state check
                switch (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)))
                {
                    case "Waiting":
                        tkrmTop.Items[2].Items[0].Visible = false; //waiting
                        tkrmTop.Items[2].Items[1].Visible = true; //activate
                        tkrmTop.Items[2].Items[2].Visible = false; //inactive
                        tkrmTop.Items[2].Items[3].Visible = false; //complete
                        tkrmTop.Items[2].Items[4].Visible = true; //cancel
                        tkrmTop.Items[2].Items[5].Visible = false; //hr
                        tkrmTop.Items[2].Items[6].Visible = false; //un promote to ballpark
                        tkrmTop.Items[2].Items[7].Visible = false; //un promote to proposal
                        tkrmTop.Items[2].Items[8].Visible = false; //hr
                        tkrmTop.Items[2].Items[9].Visible = false; //tag as internal
                        break;

                    case "Active":
                        tkrmTop.Items[2].Items[0].Visible = true; //waiting
                        tkrmTop.Items[2].Items[1].Visible = false; //activate
                        tkrmTop.Items[2].Items[2].Visible = true; //inactive
                        tkrmTop.Items[2].Items[3].Visible = true; //complete
                        tkrmTop.Items[2].Items[4].Visible = true; //cancel
                        tkrmTop.Items[2].Items[5].Visible = true; //hr
                        tkrmTop.Items[2].Items[6].Visible = true; //un promote to ballpark
                        tkrmTop.Items[2].Items[7].Visible = true; //un promote to proposal
                        tkrmTop.Items[2].Items[8].Visible = true; //hr
                        tkrmTop.Items[2].Items[9].Visible = true; //tag as internal
                        break;

                    case "Inactive":
                        tkrmTop.Items[2].Items[0].Visible = false; //waiting
                        tkrmTop.Items[2].Items[1].Visible = true; //activate
                        tkrmTop.Items[2].Items[2].Visible = false; //inactive
                        tkrmTop.Items[2].Items[3].Visible = false; //complete
                        tkrmTop.Items[2].Items[4].Visible = true; //cancel
                        tkrmTop.Items[2].Items[5].Visible = false; //hr
                        tkrmTop.Items[2].Items[6].Visible = false; //un promote to ballpark
                        tkrmTop.Items[2].Items[7].Visible = false; //un promote to proposal
                        tkrmTop.Items[2].Items[8].Visible = false; //hr
                        tkrmTop.Items[2].Items[9].Visible = false; //tag as internal
                        break;

                    case "Canceled":
                        tkrmTop.Items[2].Items[0].Visible = false; //waiting
                        tkrmTop.Items[2].Items[1].Visible = true; //activate
                        tkrmTop.Items[2].Items[2].Visible = false; //inactive
                        tkrmTop.Items[2].Items[3].Visible = false; //complete
                        tkrmTop.Items[2].Items[4].Visible = false; //cancel
                        tkrmTop.Items[2].Items[5].Visible = false; //hr
                        tkrmTop.Items[2].Items[6].Visible = false; //un promote to ballpark
                        tkrmTop.Items[2].Items[7].Visible = false; //un promote to proposal
                        tkrmTop.Items[2].Items[8].Visible = false; //hr
                        tkrmTop.Items[2].Items[9].Visible = false; //tag as internal
                        break;

                    case "Complete":
                        tkrmTop.Items[2].Items[0].Visible = false; //waiting
                        tkrmTop.Items[2].Items[1].Visible = true; //activate
                        tkrmTop.Items[2].Items[2].Visible = false; //inactive
                        tkrmTop.Items[2].Items[3].Visible = false; //complete
                        tkrmTop.Items[2].Items[4].Visible = false; //cancel
                        tkrmTop.Items[2].Items[5].Visible = false; //hr
                        tkrmTop.Items[2].Items[6].Visible = false; //un promote to ballpark
                        tkrmTop.Items[2].Items[7].Visible = false; //un promote to proposal
                        tkrmTop.Items[2].Items[8].Visible = false; //hr
                        tkrmTop.Items[2].Items[9].Visible = false; //tag as internal
                        break;
                }
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Internal")
            {
                // Active Tab
                tcDetailedInformation.ActiveTabIndex = 1;

                // Left menu
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[2].Visible = false; //mSeparator
                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections

                // Top Menu
                tkrmTop.Items[1].Visible = false;
                tkrmTop.Items[2].Visible = false;
                tkrmTop.Items[3].Visible = true;
                tkrmTop.Items[4].Visible = false;

                lblHeaderTitle.Text = "Internal Project Summary";
                lblTitleProject.Text = " > Internal Project: ";

                // Initial section
                lblProposalDate.Text = "Internal Project Date";
                lblStartDate.Visible = false;
                tbxStartDate.Visible = false;
                lblEndDate.Visible = false;
                tbxEndDate.Visible = false;
                tbxDescription.Width = Unit.Pixel(510);

                // Client section
                lblClientProjectNumber.Visible = false;
                tbxClientProjectNumber.Visible = false;
                lblClientPrimaryContactId.Visible = false;
                tbxClientPrimaryContact.Visible = false;
                btnClientPrimaryContact.Visible = false;
                lblClientSecondaryContactId.Visible = false;
                tbxClientSecondaryContact.Visible = false;
                btnClientSecondaryContact.Visible = false;

                // Pricing section
                pnlPricing.Visible = false;

                // Tabs visibility
                tpJobInfo.Enabled = true;
                upnlTypeOfWork.Visible = false;

                // ... for values that comes from sales billing pricing
                //tpSaleBillingPricing.Enabled = false;
                upnlSaleBillingPricingValues.Visible = false;
                upnlSaleBillingPricingValues1.Visible = false;

                // ... for values that comes from costing updates
                // tpCostingUpdates.Enabled = false;

                // ... for values that comes from terms po
                //tpTermsPo.Enabled = false;
                upnlTermsPO.Visible = false;
                upnlTermsPO1.Visible = false;
                upnlTermsPO2.Visible = false;
                upnlTermsPO3.Visible = false;

                // ... for values that comes from technical
                //tpTechnical.Enabled = false;
                upnlTechnical.Visible = false;

                // ... for values that comes from engineer subcontractors
                // tpEngineerSubcontractors.Enabled = true;
                // Subcontractor section
                // lblNoResults.Text = "Sub-Contractors are not defined for this internal project";
                upnlEngineerSubcontractors.Visible = false;
                upnlEngineerSubcontractors1.Visible = false;
                upnlEngineerSubcontractors2.Visible = false;
                upnlEngineerSubcontractors3.Visible = false;
                upnlEngineerSubcontractors4.Visible = false;
                upnlEngineerSubcontractors5.Visible = false;
                upnlEngineerSubcontractors6.Visible = false;
                upnlEngineerSubcontractors7.Visible = false;

                // ... for values that comes from cost exceptions
                //tpCostExceptions.Enabled = false;
                pnlCostsExceptions.Visible = false;

                // ... for values that comes from notes
                //tpNotes.Enabled = true;
                upnlNotes.Visible = true;

                // Project state check
                switch (projectGateway.GetProjectState(int.Parse(hdfProjectId.Value)))
                {
                    case "Active":
                        tkrmTop.Items[3].Items[0].Visible = false; //activate
                        tkrmTop.Items[3].Items[1].Visible = true; //cancel
                        tkrmTop.Items[3].Items[2].Visible = true; //complete
                        tkrmTop.Items[2].Items[3].Visible = true; //hr
                        tkrmTop.Items[3].Items[4].Visible = true; //promote to proposal
                        tkrmTop.Items[3].Items[5].Visible = true; //promote to project
                        break;

                    case "Canceled":
                        tkrmTop.Items[3].Items[0].Visible = true; //activate
                        tkrmTop.Items[3].Items[1].Visible = false; //cancel
                        tkrmTop.Items[3].Items[2].Visible = false; //complete
                        tkrmTop.Items[2].Items[3].Visible = false; //hr
                        tkrmTop.Items[3].Items[4].Visible = false; //promote to proposal
                        tkrmTop.Items[3].Items[5].Visible = false; //promote to project
                        break;

                    case "Complete":
                        tkrmTop.Items[3].Items[0].Visible = true; //activate
                        tkrmTop.Items[3].Items[1].Visible = false; //cancel
                        tkrmTop.Items[3].Items[2].Visible = false; //complete
                        tkrmTop.Items[2].Items[3].Visible = false; //hr
                        tkrmTop.Items[3].Items[4].Visible = false; //promote to proposal
                        tkrmTop.Items[3].Items[5].Visible = false; //promote to project
                        break;
                }
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                tkrpbLeftMenuReports.Visible = false;
            }

            int projectId = Int32.Parse(hdfProjectId.Value);
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(projectId);

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Proposal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Proposal";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Proposal";

                lblTitleProject.Text = " > Proposal: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Project")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Project";

                lblTitleProject.Text = " > Project: ";
            }

            if (projectGateway.GetProjectType(Int32.Parse(hdfProjectId.Value)) == "Internal")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Internal Project";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Internal Project";

                lblTitleProject.Text = " > Internal Project: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                tkrpbLeftMenuCurrentProject.Items[0].Text = "Current Ballpark";
                tkrpbLeftMenuCurrentProject.Items[0].Items[0].Text = "Ballpark";

                lblTitleProject.Text = " > Ballpark: ";

                tkrpbLeftMenuCurrentProject.Items[0].Items[3].Visible = false; //mSections
                tkrpbLeftMenuCurrentProject.Items[0].Items[4].Visible = false; //mTools
                tkrpbLeftMenuCurrentProject.Items[0].Items[5].Visible = false; //mSeparator
            }

            // Security check
            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                tkrpbLeftMenuReports.Visible = false;
            }
        }
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Project type check
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);
            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Proposal")
            {
                lblHeaderTitle.Text = "Delete Proposal";
                lblTitleProject.Text = " > Proposal: ";
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Project")
            {
                lblHeaderTitle.Text = "Delete Project";
                lblTitleProject.Text = " > Project: ";
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Internal")
            {
                lblHeaderTitle.Text = "Delete Internal Project";
                lblTitleProject.Text = " > Internal Project: ";
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                lblHeaderTitle.Text = "Delete Ballpark";
                lblTitleProject.Text = " > Ballpark: ";
            }
        }
Ejemplo n.º 11
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Set active toolbar
            mForm6 master = (mForm6)this.Master;
            master.ActiveToolbar = "Projects";

            // Project type check
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);
            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Ballpark")
            {
                lblHeaderTitle.Text = "Ballpark State";
                lblTitleProject.Text = " > Ballpark: ";
            }
            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Proposal")
            {
                lblHeaderTitle.Text = "Proposal State";
                lblTitleProject.Text = " > Proposal: ";
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Project")
            {
                lblHeaderTitle.Text = "Project State";
                lblTitleProject.Text = " > Project: ";
            }

            if (projectGateway.GetProjectType(int.Parse(hdfProjectId.Value)) == "Internal")
            {
                lblHeaderTitle.Text = "Internal Project State";
                lblTitleProject.Text = " > Internal Project: ";
            }

            // Operation check
            switch ((string)Request.QueryString["state"])
            {
                //Proposal
                case "proposal_award":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = true; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "proposal_lost_bid":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = true;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "proposal_cancel":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = true;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "proposal_bidding":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = true;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "proposal_unpromote_to_ballpark":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = true;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "proposal_promote_to_project":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = true;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                //Project
                case "project_waiting":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = true;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_activate":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = true;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_inactivate":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = true;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_complete":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = true;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_cancel":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = true;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_unpromote_to_ballpark":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = true;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_unpromote_to_proposal":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = true;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "project_tagAsInternal":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = true;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                //Internal Project
                case "internalProject_activate":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = true;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "internalProject_complete":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = true;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "internalProject_cancel":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = true;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "internalProject_promote_to_proposal":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = true;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "internalProject_promote_to_project":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = true;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "ballparkProject_activate":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = true;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "ballparkProject_cancel":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = true;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "ballparkProject_promote_to_proposal":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = true;//Promote to proposal
                    tkrmTop.Items[22].Visible = false;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;

                case "ballparkProject_promote_to_project":
                    // ...Proposal
                    tkrmTop.Items[0].Visible = false; //Award
                    tkrmTop.Items[1].Visible = false;//Lost Bid
                    tkrmTop.Items[2].Visible = false;//Cancel
                    tkrmTop.Items[3].Visible = false;//Bidding
                    tkrmTop.Items[4].Visible = false;//Unpromote
                    tkrmTop.Items[5].Visible = false;//Promote

                    // ...Project
                    tkrmTop.Items[6].Visible = false;//Waiting
                    tkrmTop.Items[7].Visible = false;//Active
                    tkrmTop.Items[8].Visible = false;//Inactive
                    tkrmTop.Items[9].Visible = false;//Complete
                    tkrmTop.Items[10].Visible = false;//Cancel
                    tkrmTop.Items[11].Visible = false;//Unpromote to ballpark
                    tkrmTop.Items[12].Visible = false;//Unpromote to proposal
                    tkrmTop.Items[13].Visible = false;//Tag as Internal

                    // ... Internal Project
                    tkrmTop.Items[14].Visible = false;//Active
                    tkrmTop.Items[15].Visible = false;//Complete
                    tkrmTop.Items[16].Visible = false;//Cancel
                    tkrmTop.Items[17].Visible = false;//Promote to proposal
                    tkrmTop.Items[18].Visible = false;//Promote to Project

                    // ... Ballpark Project
                    tkrmTop.Items[19].Visible = false;//Active
                    tkrmTop.Items[20].Visible = false;//Cancel
                    tkrmTop.Items[21].Visible = false;//Promote to proposal
                    tkrmTop.Items[22].Visible = true;//Promote to Project

                    // ...Cancel
                    tkrmTop.Items[23].Visible = true;
                    break;
            }

            // Set instruction
            switch ((string)Request.QueryString["state"])
            {
                //Proposal
                case "proposal_award":
                    lblState.Text = "Are you sure you want to set this proposal as awarded?";
                    upPnlSendMail.Visible = false;
                    break;

                case "proposal_lost_bid":
                    lblState.Text = "Are you sure you want to set this proposal as lost bid?";
                    upPnlSendMail.Visible = false;
                    break;

                case "proposal_cancel":
                    lblState.Text = "Are you sure you want to Cancel this proposal?";
                    upPnlSendMail.Visible = false;
                    break;

                case "proposal_bidding":
                    lblState.Text = "Are you sure you want to set this proposal as bidding?";
                    upPnlSendMail.Visible = false;
                    break;

                case "proposal_unpromote_to_ballpark":
                    lblState.Text = "Are you sure you want to unpromote this proposal to ballpark?";
                    upPnlSendMail.Visible = false;
                    break;

                case "proposal_promote_to_project":
                    lblState.Text = "Are you sure you want to promote this proposal to project?";
                    upPnlSendMail.Visible = true;
                    SendMailTeamMember();
                    break;

                //Project
                case "project_waiting":
                    lblState.Text = "Are you sure you want to set this project as waiting?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_activate":
                    lblState.Text = "Are you sure you want to activate this project?";
                    upPnlSendMail.Visible = false;
                    //SendMailTeamMember();
                    break;

                case "project_inactivate":
                    lblState.Text = "Are you sure you want to inactivate this project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_complete":
                    lblState.Text = "Are you sure you want to complete this project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_cancel":
                    lblState.Text = "Are you sure you want to cancel this project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_unpromote_to_ballpark":
                    lblState.Text = "Are you sure you want to unpromote this project to ballpark?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_unpromote_to_proposal":
                    lblState.Text = "Are you sure you want to unpromote this project to proposal?";
                    upPnlSendMail.Visible = false;
                    break;

                case "project_tagAsInternal":
                    lblState.Text = "Are you sure you want to tag this project as internal?";
                    upPnlSendMail.Visible = false;
                    break;

                //Internal Project
                case "internalProject_activate":
                    lblState.Text = "Are you sure you want to activate this internal project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "internalProject_complete":
                    lblState.Text = "Are you sure you want to complete this internal project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "internalProject_cancel":
                    lblState.Text = "Are you sure you want to cancel this internal project?";
                    upPnlSendMail.Visible = false;
                    break;

                case "internalProject_promote_to_proposal":
                    lblState.Text = "Are you sure you want to promote this internal project to proposal?";
                    upPnlSendMail.Visible = false;
                    break;

                case "internalProject_promote_to_project":
                    lblState.Text = "Are you sure you want to promote this internal project to project?";
                    upPnlSendMail.Visible = false;
                    break;

                //Ballpark
                case "ballparkProject_activate":
                    lblState.Text = "Are you sure you want to activate this ballpark?";
                    upPnlSendMail.Visible = false;
                    break;

                case "ballparkProject_cancel":
                    lblState.Text = "Are you sure you want to cancel this ballpark?";
                    upPnlSendMail.Visible = false;
                    break;

                case "ballparkProject_promote_to_proposal":
                    lblState.Text = "Are you sure you want to promote this ballpark to proposal?";
                    upPnlSendMail.Visible = false;
                    break;

                case "ballparkProject_promote_to_project":
                    lblState.Text = "Are you sure you want to promote this ballpark to project?";
                    upPnlSendMail.Visible = false;
                    break;
            }
        }
Ejemplo n.º 12
0
        private void UpdateState()
        {
            ProjectGateway projectGateway = new ProjectGateway(projectTDS);
            int projectId = int.Parse(hdfProjectId.Value);
            projectGateway.LoadByProjectId(projectId);

            Int64 countryId = projectGateway.GetCountryID(projectId);
            int officeId = projectGateway.GetOfficeID(projectId);
            Int64? provinceId = projectGateway.GetProvinceID(projectId);
            Int64? cityId = projectGateway.GetCityID(projectId);
            Int64? countyId = projectGateway.GetCountyID(projectId);
            int? projectLeadId = projectGateway.GetProjectLeadID(projectId);
            int salesmanId = projectGateway.GetSalesmanID(projectId);
            string projectType = projectGateway.GetProjectType(projectId);
            string projectState = null;

            switch ((string)Request.QueryString["state"])
            {
                //Proposal
                case "proposal_award":
                    projectState = "Awarded";
                    break;

                case "proposal_lost_bid":
                    projectState = "Lost Bid";
                    break;

                case "proposal_cancel":
                    projectState = "Canceled";
                    break;

                case "proposal_bidding":
                    projectState = "Bidding";
                    break;

                case "proposal_unpromote_to_ballpark":
                    projectState = "Active";
                    projectType = "Ballpark";
                    break;

                case "proposal_promote_to_project":
                    projectState = "Active";
                    projectType = "Project";
                    break;

                //Project
                case "project_waiting":
                    projectState = "Waiting";
                    break;

                case "project_activate":
                    projectState = "Active";
                    break;

                case "project_inactivate":
                    projectState = "Inactive";
                    break;

                case "project_complete":
                    projectState = "Complete";
                    break;

                case "project_cancel":
                    projectState = "Canceled";
                    break;

                case "project_unpromote_to_ballpark":
                    projectState = "Active";
                    projectType = "Ballpark";
                    break;

                case "project_unpromote_to_proposal":
                    projectState = "Awarded";
                    projectType = "Proposal";
                    break;

                case "project_tagAsInternal":
                    projectState = "Active";
                    projectType = "Internal";
                    break;

                //Internal Project
                case "internalProject_activate":
                    projectState = "Active";
                    break;

                case "internalProject_complete":
                    projectState = "Complete";
                    break;

                case "internalProject_cancel":
                    projectState = "Canceled";
                    break;

                case "internalProject_promote_to_proposal":
                    projectState = "Awarded";
                    projectType = "Proposal";
                    break;

                case "internalProject_promote_to_project":
                    projectState = "Active";
                    projectType = "Project";
                    break;

                //Ballpark
                case "ballparkProject_activate":
                    projectState = "Active";
                    break;

                case "ballparkProject_cancel":
                    projectState = "Canceled";
                    break;

                case "ballparkProject_promote_to_proposal":
                    projectState = "Bidding";
                    projectType = "Proposal";
                    break;

                case "ballparkProject_promote_to_project":
                    projectState = "Active";
                    projectType = "Project";
                    break;
            }

            string name = projectGateway.GetName(projectId);
            string description = projectGateway.GetDescription(projectId);
            DateTime? proposalDate = projectGateway.GetProposalDate(projectId);
            DateTime? startDate = projectGateway.GetStartDate(projectId);
            DateTime? endDate = projectGateway.GetEndDate(projectId);
            int clientId = projectGateway.GetClientID(projectId);
            string clientProjectNumber = projectGateway.GetClientProjectNumber(projectId);
            int? clientPrimaryContactId = projectGateway.GetClientPrimaryContactID(projectId);
            int? clientSecondaryContactId = projectGateway.GetClientSecondaryContactID(projectId);
            bool deleted = projectGateway.GetDeleted(projectId);
            int? libraryCategoriesId = projectGateway.GetLibraryCategoriesId(projectId);
            bool fairWageApplies = projectGateway.GetFairWageApplies(projectId);

            // Update project
            Project project = new Project(projectTDS);
            string projectNumber = project.UpdateProjectNumber(projectId, salesmanId);
            project.Update(projectId, countryId, officeId, projectLeadId, salesmanId, projectNumber, projectType, projectState, name, description, proposalDate, startDate, endDate, clientId, clientProjectNumber, clientPrimaryContactId, clientSecondaryContactId, deleted, libraryCategoriesId, provinceId, cityId, Int32.Parse(hdfCompanyId.Value.Trim()), countyId, fairWageApplies);

            //Insert in history
            ProjectHistory projectHistory = new ProjectHistory(projectTDS);
            int newRefId = projectHistory.GetNewRefId();
            projectHistory.Insert(projectId, newRefId, projectState, DateTime.Now, Convert.ToInt32(Session["loginID"]), Int32.Parse(hdfCompanyId.Value.Trim()));
        }
        protected void cvProject_ServerValidate(object source, ServerValidateEventArgs args)
        {
            ProjectGateway projectGateway = new ProjectGateway();
            projectGateway.LoadByProjectId(Convert.ToInt32(ddlProject.SelectedValue));

            if (projectGateway.GetProjectState(Convert.ToInt32(ddlProject.SelectedValue)) != "Active")
            {
                if (projectGateway.GetProjectType(Convert.ToInt32(ddlProject.SelectedValue)) != "Ballpark")
                {
                    cvProject.ErrorMessage = "Please select an active project or an active internal project";
                }

                if (projectGateway.GetProjectType(Convert.ToInt32(ddlProject.SelectedValue)) == "Ballpark")
                {
                    cvProject.ErrorMessage = "Please select an active ballpark";
                }

                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }