// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP1 - BEGIN // // //////////////////////////////////////////////////////////////////////// // STEP1 - BEGIN - METHODS // private void StepBeginIn() { // Set instruction mWizard2 master = (mWizard2)this.Master; master.WizardInstruction = "What do you want to do?"; // Prepare initial data // ... for template ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS); projectCostingSheetTemplateInformation.LoadAll(Convert.ToInt32(hdfCompanyId.Value)); // Store datasets Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; templateInformation = projectCostingSheetAddTDS.TemplateInformation; Session["templateInformation"] = templateInformation; }
protected void AddCostingSheetTemplateNewEmptyFix(GridView grdTemplate) { if (grdTemplate.Rows.Count == 0) { int companyId = Int32.Parse(hdfCompanyId.Value); ProjectCostingSheetAddTDS.TemplateInformationDataTable dt = new ProjectCostingSheetAddTDS.TemplateInformationDataTable(); dt.AddTemplateInformationRow("", false, false, false, false, false, false, false, false, false, false, false, false, false, false, companyId, "", "", false, 0, 0, 0, 0, 0, 0, false); Session["templateInformationDummy"] = dt; grdTemplate.DataBind(); } // normally executes at all postbacks if (grdTemplate.Rows.Count == 1) { ProjectCostingSheetAddTDS.TemplateInformationDataTable dt = (ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformationDummy"]; if (dt != null) { grdTemplate.Rows[0].Visible = false; grdTemplate.Rows[0].Controls.Clear(); } } }
private void PostPageChanges2() { if (cbxEndSave.Checked) { int? month = null; int? day = null; int? year = null; int? month2 = null; int? day2 = null; int? year2 = null; if (tkrdpFrom.SelectedDate.HasValue) { month = tkrdpFrom.SelectedDate.Value.Month; day = tkrdpFrom.SelectedDate.Value.Day; year = tkrdpFrom.SelectedDate.Value.Year; } if (tkrdpTo.SelectedDate.HasValue) { month2 = tkrdpTo.SelectedDate.Value.Month; day2 = tkrdpTo.SelectedDate.Value.Day; year2 = tkrdpTo.SelectedDate.Value.Year; } if (rbtnEndSaveNew.Checked) { if (tbxEndSaveNew.Text != "") { ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS); projectCostingSheetTemplateInformation.Insert(tbxEndSaveNew.Text, cbxRehabAssessmentData.Checked, cbxFullLengthLiningData.Checked, cbxPointRepairData.Checked, cbxJunctionLiningData.Checked, cbxManholeRehabData.Checked, cbxMobilizationData.Checked, cbxOtherData.Checked, cbxLabourHour.Checked, cbxTrucksEquipment.Checked, cbxMaterial.Checked, cbxSubcontractor.Checked, cbxOtherCost.Checked, cbxRevenueInformation.Checked, false, Convert.ToInt32(hdfCompanyId.Value), month, day, year, month2, day2, year2); } } if (rbtnEndSaveReplace.Checked) { if (luEndSaveTemplate.SelectedIndex > 0) { ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS); projectCostingSheetTemplateInformation.Update(Convert.ToInt32(luEndSaveTemplate.SelectedValue), luEndSaveTemplate.SelectedItem.Text, cbxRehabAssessmentData.Checked, cbxFullLengthLiningData.Checked, cbxPointRepairData.Checked, cbxJunctionLiningData.Checked, cbxManholeRehabData.Checked, cbxMobilizationData.Checked, cbxOtherData.Checked, cbxLabourHour.Checked, cbxTrucksEquipment.Checked, cbxMaterial.Checked, cbxSubcontractor.Checked, cbxOtherCost.Checked, cbxRevenueInformation.Checked, false, Convert.ToInt32(hdfCompanyId.Value), month, day, year, month2, day2, year2); } } Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; templateInformation = projectCostingSheetAddTDS.TemplateInformation; Session["templateInformation"] = templateInformation; } }
protected void SaveSelectedId() { int idForUpdate = 0; bool selected = false; hdfSelectedIdTemplate.Value = "0"; ProjectCostingSheetTemplateInformation projectCostingSheetTemplateInformation = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS); foreach (GridViewRow row in grdTemplate.Rows) { // ... Update all rows selected = ((CheckBox)row.FindControl("cbxSelected")).Checked; idForUpdate = Int32.Parse(((Label)row.FindControl("lblCostingSheetTemplateID")).Text.Trim()); projectCostingSheetTemplateInformation.Update(idForUpdate, selected); // ... Save selected project if (selected) { hdfSelectedIdTemplate.Value = idForUpdate.ToString(); } } projectCostingSheetTemplateInformation.Data.AcceptChanges(); // Store datasets Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; templateInformation = projectCostingSheetAddTDS.TemplateInformation; Session["templateInformation"] = templateInformation; }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_ADMIN"])) { if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_ADD"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_costing_sheets_add.aspx"); } // Tag Page TagPage(); // Initialize viewstate variables ViewState["StepFrom"] = "Out"; Session.Remove("labourHoursInformationDummy"); Session.Remove("labourHoursInformation"); Session.Remove("unitsInformationDummy"); Session.Remove("unitsInformation"); Session.Remove("subcontractorsInformationDummy"); Session.Remove("subcontractorsInformation"); Session.Remove("materialsInformationDummy"); Session.Remove("materialsInformation"); Session.Remove("otherCostsInformationDummy"); Session.Remove("otherCostsInformation"); Session.Remove("revenueInformationDummy"); Session.Remove("revenueInformation"); Session.Remove("templateInformationDummy"); Session.Remove("templateInformation"); Session.Remove("hotelsInformationDummy"); Session.Remove("hotelsInformation"); Session.Remove("bondingsInformationDummy"); Session.Remove("bondingsInformation"); Session.Remove("insurancesInformationDummy"); Session.Remove("insurancesInformation"); Session.Remove("otherCategoryInformationDummy"); Session.Remove("otherCategoryInformation"); // ... Initialize tables projectCostingSheetAddTDS = new ProjectCostingSheetAddTDS(); labourHoursInformation = new ProjectCostingSheetAddTDS.LabourHoursInformationDataTable(); unitsInformation = new ProjectCostingSheetAddTDS.UnitsInformationDataTable(); subcontractorsInformation = new ProjectCostingSheetAddTDS.SubcontractorsInformationDataTable(); materialsInformation = new ProjectCostingSheetAddTDS.MaterialsInformationDataTable(); otherCostsInformation = new ProjectCostingSheetAddTDS.OtherCostsInformationDataTable(); revenueInformation = new ProjectCostingSheetAddTDS.RevenueInformationDataTable(); templateInformation = new ProjectCostingSheetAddTDS.TemplateInformationDataTable(); hotelsInformation = new ProjectCostingSheetAddTDS.HotelsInformationDataTable(); bondingsInformation = new ProjectCostingSheetAddTDS.BondingsInformationDataTable(); insurancesInformation = new ProjectCostingSheetAddTDS.InsurancesInformationDataTable(); otherCategoryInformation = new ProjectCostingSheetAddTDS.OtherCategoryInformationDataTable(); tbxTeamMembersTotalCostCAD.Text = "0"; tbxTeamMembersTotalCostUSD.Text = "0"; tbxUnitsTotalCostsCAD.Text = "0"; tbxUnitsTotalCostsUSD.Text = "0"; tbxSubcontractorsTotalCostsCAD.Text = "0"; tbxSubcontractorsTotalCostsUSD.Text = "0"; tbxMaterialsTotalCostsCAD.Text = "0"; tbxMaterialsTotalCostsUSD.Text = "0"; tbxOtherCostsTotalCostsCAD.Text = "0"; tbxOtherCostsTotalCostsUSD.Text = "0"; tbxRevenueTotal.Text = "0"; tbxGradRevenue.Text = "0"; tbxGrandProfit.Text = "0"; tbxGrandGrossMargin.Text = "0"; tbxHotelsTotalCostsCAD.Text = "0"; tbxHotelsTotalCostsUSD.Text = "0"; tbxBondingsTotalCostsCAD.Text = "0"; tbxBondingsTotalCostsUSD.Text = "0"; tbxInsurancesTotalCostsCAD.Text = "0"; tbxInsurancesTotalCostsUSD.Text = "0"; tbxOtherCategoryTotalCostsCAD.Text = "0"; tbxOtherCategoryTotalCostsUSD.Text = "0"; // ... Store tables Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; Session["labourHoursInformation"] = labourHoursInformation; Session["unitsInformation"] = unitsInformation; Session["subcontractorsInformation"] = subcontractorsInformation; Session["materialsInformation"] = materialsInformation; Session["otherCostsInformation"] = otherCostsInformation; Session["revenueInformation"] = revenueInformation; Session["templateInformation"] = templateInformation; Session["hotelsInformation"] = hotelsInformation; Session["bondingsInformation"] = bondingsInformation; Session["insurancesInformation"] = insurancesInformation; Session["otherCategoryInformation"] = otherCategoryInformation; // StepGeneralInformation wzProjectCostinsSheetsAdd.ActiveStepIndex = 0; } else { // Restore tables projectCostingSheetAddTDS = (ProjectCostingSheetAddTDS)Session["projectCostingSheetAddTDS"]; labourHoursInformation = (ProjectCostingSheetAddTDS.LabourHoursInformationDataTable)Session["labourHoursInformation"]; unitsInformation = (ProjectCostingSheetAddTDS.UnitsInformationDataTable)Session["unitsInformation"]; subcontractorsInformation = (ProjectCostingSheetAddTDS.SubcontractorsInformationDataTable)Session["subcontractorsInformation"]; materialsInformation = (ProjectCostingSheetAddTDS.MaterialsInformationDataTable)Session["materialsInformation"]; otherCostsInformation = (ProjectCostingSheetAddTDS.OtherCostsInformationDataTable)Session["otherCostsInformation"]; revenueInformation = (ProjectCostingSheetAddTDS.RevenueInformationDataTable)Session["revenueInformation"]; templateInformation = (ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformation"]; hotelsInformation = (ProjectCostingSheetAddTDS.HotelsInformationDataTable)Session["hotelsInformation"]; bondingsInformation = (ProjectCostingSheetAddTDS.BondingsInformationDataTable)Session["bondingsInformation"]; insurancesInformation = (ProjectCostingSheetAddTDS.InsurancesInformationDataTable)Session["insurancesInformation"]; otherCategoryInformation = (ProjectCostingSheetAddTDS.OtherCategoryInformationDataTable)Session["otherCategoryInformation"]; } }
// ///////////////////////////////////////////////////////////////////////////////////////////////////// // // STEP2 - TEMPLATE // // //////////////////////////////////////////////////////////////////////// // STEP2 - TEMPLATE - EVENTS // protected void grdTemplate_RowDeleting(object sender, GridViewDeleteEventArgs e) { int costingSheetTemplateID = (int)e.Keys["CostingSheetTemplateID"]; ProjectCostingSheetTemplateInformation model = new ProjectCostingSheetTemplateInformation(projectCostingSheetAddTDS); model.Delete(costingSheetTemplateID); // Store tables Session.Remove("templateInformationDummy"); Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; templateInformation = projectCostingSheetAddTDS.TemplateInformation; Session["templateInformation"] = templateInformation; }
// //////////////////////////////////////////////////////////////////////// // STEP2 - TEMPLATE - PUBLIC METHODS // public ProjectCostingSheetAddTDS.TemplateInformationDataTable GetCostingSheetTemplate() { templateInformation = (ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformationDummy"]; if (templateInformation == null) { templateInformation = ((ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformation"]); } return templateInformation; }
// //////////////////////////////////////////////////////////////////////// // INITIAL EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_ADMIN"])) { if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_COSTINGSHEETS_ADD"]))) { 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["client_id"] == null) || ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_combined_costing_sheets_add.aspx"); } if ((string)Request.QueryString["project_id"] == "0") { if (Session["projectsSelected"] != null) { projectsSelected = (ArrayList)Session["projectsSelected"]; } else { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_combined_costing_sheets_add.aspx"); } } else { projectsSelected = new ArrayList(); projectsSelected.Add(int.Parse((string)Request.QueryString["project_id"])); Session["projectsSelected"] = projectsSelected; } // Tag Page TagPage(); // Initialize viewstate variables ViewState["StepFrom"] = "Out"; Session.Remove("labourHoursInformationDummy"); Session.Remove("labourHoursInformation"); Session.Remove("unitsInformationDummy"); Session.Remove("unitsInformation"); Session.Remove("subcontractorsInformationDummy"); Session.Remove("subcontractorsInformation"); Session.Remove("materialsInformationDummy"); Session.Remove("materialsInformation"); Session.Remove("otherCostsInformationDummy"); Session.Remove("otherCostsInformation"); Session.Remove("revenueInformationDummy"); Session.Remove("revenueInformation"); Session.Remove("templateInformationDummy"); Session.Remove("templateInformation"); // ... Initialize tables projectCostingSheetAddTDS = new ProjectCostingSheetAddTDS(); labourHoursInformation = new ProjectCostingSheetAddTDS.CombinedLabourHoursInformationDataTable(); unitsInformation = new ProjectCostingSheetAddTDS.CombinedUnitsInformationDataTable(); subcontractorsInformation = new ProjectCostingSheetAddTDS.CombinedSubcontractorsInformationDataTable(); materialsInformation = new ProjectCostingSheetAddTDS.CombinedMaterialsInformationDataTable(); otherCostsInformation = new ProjectCostingSheetAddTDS.CombinedOtherCostsInformationDataTable(); revenueInformation = new ProjectCostingSheetAddTDS.CombinedRevenueInformationDataTable(); templateInformation = new ProjectCostingSheetAddTDS.TemplateInformationDataTable(); tbxTeamMembersTotalCostCAD.Text = "0"; tbxTeamMembersTotalCostUSD.Text = "0"; tbxUnitsTotalCostsCAD.Text = "0"; tbxUnitsTotalCostsUSD.Text = "0"; tbxSubcontractorsTotalCostsCAD.Text = "0"; tbxSubcontractorsTotalCostsUSD.Text = "0"; tbxMaterialsTotalCostsCAD.Text = "0"; tbxMaterialsTotalCostsUSD.Text = "0"; tbxOtherCostsTotalCostsCAD.Text = "0"; tbxOtherCostsTotalCostsUSD.Text = "0"; tbxRevenueTotal.Text = "0"; tbxGradRevenue.Text = "0"; tbxGrandProfit.Text = "0"; tbxGrandGrossMargin.Text = "0"; // ... Store tables Session["projectCostingSheetAddTDS"] = projectCostingSheetAddTDS; Session["labourHoursInformation"] = labourHoursInformation; Session["unitsInformation"] = unitsInformation; Session["subcontractorsInformation"] = subcontractorsInformation; Session["materialsInformation"] = materialsInformation; Session["otherCostsInformation"] = otherCostsInformation; Session["revenueInformation"] = revenueInformation; Session["templateInformation"] = templateInformation; // StepGeneralInformation wzProjectCostinsSheetsAdd.ActiveStepIndex = 0; } else { // Restore tables projectCostingSheetAddTDS = (ProjectCostingSheetAddTDS)Session["projectCostingSheetAddTDS"]; labourHoursInformation = (ProjectCostingSheetAddTDS.CombinedLabourHoursInformationDataTable)Session["labourHoursInformation"]; unitsInformation = (ProjectCostingSheetAddTDS.CombinedUnitsInformationDataTable)Session["unitsInformation"]; subcontractorsInformation = (ProjectCostingSheetAddTDS.CombinedSubcontractorsInformationDataTable)Session["subcontractorsInformation"]; materialsInformation = (ProjectCostingSheetAddTDS.CombinedMaterialsInformationDataTable)Session["materialsInformation"]; otherCostsInformation = (ProjectCostingSheetAddTDS.CombinedOtherCostsInformationDataTable)Session["otherCostsInformation"]; revenueInformation = (ProjectCostingSheetAddTDS.CombinedRevenueInformationDataTable)Session["revenueInformation"]; templateInformation = (ProjectCostingSheetAddTDS.TemplateInformationDataTable)Session["templateInformation"]; projectsSelected = (ArrayList)Session["projectsSelected"]; foreach (int projectIdSelected in projectsSelected) { ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectIdSelected); string name = projectGateway.GetName(projectIdSelected); projectList.Add(new ListItem(name, projectIdSelected.ToString())); } } }