// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_ACTUAL_COSTS_ADMIN"]))) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_ACTUAL_COSTS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_ACTUAL_COSTS_DELETE"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null) || ((string)Request.QueryString["ref_id"] == null) || ((string)Request.QueryString["category"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in actual_costs_delete.aspx"); } } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfCurrentProjectId.Value = Request.QueryString["project_id"]; hdfCurrentRefId.Value = Request.QueryString["ref_id"]; hdfCategory.Value = Request.QueryString["category"]; // ... for titles int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int currentProjectId = int.Parse(hdfCurrentProjectId.Value); int currentRefId = int.Parse(hdfCurrentRefId.Value); string category = hdfCategory.Value; if (category == "Subcontractors") { lblDelete.Text = "Are you sure you want to delete this subcontractor cost?"; ActualCostsInformationSubcontractorBasicInformationGateway actualCostsInformationSubcontractorBasicInformationGatewayForTitle = new ActualCostsInformationSubcontractorBasicInformationGateway(); actualCostsInformationSubcontractorBasicInformationGatewayForTitle.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); lblTitle.Text = "Subcontractor: " + actualCostsInformationSubcontractorBasicInformationGatewayForTitle.GetSubcontractor(currentProjectId, currentRefId); } else { if (category == "Hotels") { lblDelete.Text = "Are you sure you want to delete this hotel cost?"; ActualCostsInformationHotelCostsBasicInformationGateway actualCostsInformationHotelCostsBasicInformationGateway = new ActualCostsInformationHotelCostsBasicInformationGateway(); actualCostsInformationHotelCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); lblTitle.Text = "Hotel: " + actualCostsInformationHotelCostsBasicInformationGateway.GetHotel(currentProjectId, currentRefId); } else { if (category == "Insurance") { lblDelete.Text = "Are you sure you want to delete this insurance company cost?"; ActualCostsInformationInsuranceCostsBasicInformationGateway actualCostsInformationInsuranceCostsBasicInformationGateway = new ActualCostsInformationInsuranceCostsBasicInformationGateway(); actualCostsInformationInsuranceCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); lblTitle.Text = "Insurance Company: " + actualCostsInformationInsuranceCostsBasicInformationGateway.GetInsurance(currentProjectId, currentRefId); } else { if (category == "Bonding") { lblDelete.Text = "Are you sure you want to delete this bonding company cost?"; ActualCostsInformationBondingCostsBasicInformationGateway actualCostsInformationBondingCostsBasicInformationGateway = new ActualCostsInformationBondingCostsBasicInformationGateway(); actualCostsInformationBondingCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); lblTitle.Text = "Bonding Company: " + actualCostsInformationBondingCostsBasicInformationGateway.GetBonding(currentProjectId, currentRefId); } else { // for other categories lblDelete.Text = "Are you sure you want to delete this insurance other cost?"; ActualCostsInformationOtherCostsBasicInformationGateway actualCostsInformationOtherCostsBasicInformationGateway = new ActualCostsInformationOtherCostsBasicInformationGateway(); actualCostsInformationOtherCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); lblTitle.Text = "Category: " + actualCostsInformationOtherCostsBasicInformationGateway.GetCategory(currentProjectId, currentRefId); } } } } // If coming from // ... actual_costs_navigator2.aspx if (Request.QueryString["source_page"] == "actual_costs_navigator2.aspx") { StoreNavigatorState(); ViewState["update"] = "no"; actualCostsInformationTDS = new ActualCostsInformationTDS(); if (category == "Subcontractors") { ActualCostsInformationSubcontractorBasicInformationGateway actualCostsInformationSubcontractorBasicInformationGateway = new ActualCostsInformationSubcontractorBasicInformationGateway(actualCostsInformationTDS); actualCostsInformationSubcontractorBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); } else { if (category == "Hotels") { ActualCostsInformationHotelCostsBasicInformationGateway actualCostsInformationHotelCostsBasicInformationGateway = new ActualCostsInformationHotelCostsBasicInformationGateway(actualCostsInformationTDS); actualCostsInformationHotelCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); } else { if (category == "Insurance") { ActualCostsInformationInsuranceCostsBasicInformationGateway actualCostsInformationInsuranceCostsBasicInformationGateway = new ActualCostsInformationInsuranceCostsBasicInformationGateway(actualCostsInformationTDS); actualCostsInformationInsuranceCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); } else { if (category == "Bonding") { ActualCostsInformationBondingCostsBasicInformationGateway actualCostsInformationBondingCostsBasicInformationGateway = new ActualCostsInformationBondingCostsBasicInformationGateway(actualCostsInformationTDS); actualCostsInformationBondingCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); } else { // other categories ActualCostsInformationOtherCostsBasicInformationGateway actualCostsInformationOtherCostsBasicInformationGateway = new ActualCostsInformationOtherCostsBasicInformationGateway(actualCostsInformationTDS); actualCostsInformationOtherCostsBasicInformationGateway.LoadByProjectIdRefId(currentProjectId, currentRefId, companyId); } } } } // ... Store dataset Session["actualCostsInformationTDS"] = actualCostsInformationTDS; } // ... actual_costs_summary.aspx if (Request.QueryString["source_page"] == "actual_costs_summary.aspx") { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; // Restore dataset actualCostsInformationTDS = (ActualCostsInformationTDS)Session["actualCostsInformationTDS"]; } } else { // Restore dataset actualCostsInformationTDS = (ActualCostsInformationTDS)Session["actualCostsInformationTDS"]; } }
// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // /// <summary> /// LoadByProjectIdRefId /// </summary> /// <param name="projectId">projectId</param> /// <param name="refId">refId</param> /// <param name="companyId">companyId</param> public void LoadByProjectIdRefId(int projectId, int refId, int companyId) { ActualCostsInformationOtherCostsBasicInformationGateway actualCostsInformationOtherCostsBasicInformationGateway = new ActualCostsInformationOtherCostsBasicInformationGateway(Data); actualCostsInformationOtherCostsBasicInformationGateway.LoadByProjectIdRefId(projectId, refId, companyId); }