private void UpdateDatabase() { int companyId = Int32.Parse(hdfCompanyId.Value); DB.Open(); DB.BeginTransaction(); try { ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Save(companyId); DB.CommitTransaction(); // Store datasets projectCostingSheetInformationTDS.AcceptChanges(); Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void UpdateState() { int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.UpdateState(costingSheetId, hdfCostingSheetState.Value); }
private void UpdateDatabase() { // Get ids int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); int companyId = Int32.Parse(hdfCompanyId.Value); // Delete DB.Open(); DB.BeginTransaction(); try { ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.DeleteDirect(costingSheetId, companyId); DB.CommitTransaction(); } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void Generate() { mReport1 master = (mReport1)this.Master; int companyId = Convert.ToInt32(Session["companyID"]); string type = Request.QueryString["type"].ToString(); int costingSheetId = 0; int projectId = 0; ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(); if (ddlCostingSheets.SelectedValue != "-1") { // Get Data costingSheetId = Convert.ToInt32(ddlCostingSheets.SelectedValue); projectCostingSheetInformationBasicInformation.LoadByCostingSheetIdForPreviewReport(costingSheetId, companyId); ProjectCostingSheetInformationBasicInformationGateway projectCostingSheetInformationBasicInformationGateway = new ProjectCostingSheetInformationBasicInformationGateway(projectCostingSheetInformationBasicInformation.Data); projectId = projectCostingSheetInformationBasicInformationGateway.GetProjectID(costingSheetId); // ... set properties to master page master.Data = projectCostingSheetInformationBasicInformation.Data; master.Table = projectCostingSheetInformationBasicInformation.TableName; master.Report = new ProjectCostingSheetsPreview(); // Get report if (projectCostingSheetInformationBasicInformation.Table.Rows.Count > 0) { ProjectGateway projectGateway = new ProjectGateway(); projectGateway.LoadByProjectId(projectId); int clientId = projectGateway.GetClientID(projectId); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadByCompaniesId(clientId, companyId); master.SetParameter("Client", companiesGateway.GetName(clientId)); string name = projectGateway.GetName(projectId); master.SetParameter("Project", name); int loginId = Convert.ToInt32(Session["loginID"]); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(loginId, companyId); string user = loginGateway.GetLastName(loginId, companyId) + " " + loginGateway.GetFirstName(loginId, companyId); master.SetParameter("User", user.Trim()); master.SetParameter("CostingSheet", projectCostingSheetInformationBasicInformationGateway.GetName(costingSheetId)); if (type == "resume") { ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = true; //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = true; } else { ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsLabourHours2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsUnits"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsUnits2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsMaterials2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsOtherCosts2"]).SectionFormat.EnableSuppress = false; ((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors"]).SectionFormat.EnableSuppress = false; //((Section)master.Report.ReportDefinition.Sections["detailsSubcontractors2"]).SectionFormat.EnableSuppress = false; } if (projectGateway.GetCountryID(projectId) == 1)//Canada { // General ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text32"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text34"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text36"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text38"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsUsd"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsUsd1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalUsd2"].ObjectFormat.EnableSuppress = true; // Labour Hours ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails"); ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume"); ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Units ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails"); ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume"); ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Materials ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails"); ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume"); ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Subcontractors ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails"); //ReportDocument rpSubcontractorsResune = master.Report.OpenSubreport("SubcontractorsResume"); ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; /// //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; //((Section)rpSubcontractorsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; //((Section)rpSubcontractorsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; // Other Costs ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails"); ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume"); ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text3"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text2"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostUsd1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostUsd2"].ObjectFormat.EnableSuppress = true; } else//USA { // General ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text31"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text33"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text35"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text37"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["Text1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupHeaderSection1"]).ReportObjects["headerTotalSubcontractorsCad"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalLabourHoursCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalUnitsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalMaterialsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalOtherCostsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["GrandTotalCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["Section3"]).ReportObjects["TotalSubcontractorsCad1"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)master.Report.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["GrandTotalCad2"].ObjectFormat.EnableSuppress = true; // Labour Hours ReportDocument rpLabourHoursDetails = master.Report.OpenSubreport("LabourHoursDetails"); ReportDocument rpLabourHoursResume = master.Report.OpenSubreport("LabourHoursResume"); ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text9"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text6"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["LHCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpLabourHoursResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Units ReportDocument rpUnitsDetails = master.Report.OpenSubreport("UnitsDetails"); ReportDocument rpUnitsResume = master.Report.OpenSubreport("UnitsResume"); ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // ((Section)rpUnitsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpUnitsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Materials ReportDocument rpMaterialsDetails = master.Report.OpenSubreport("MaterialsDetails"); ReportDocument rpMaterialsResune = master.Report.OpenSubreport("MaterialsResume"); ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpMaterialsResune.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; // Subcontractors ReportDocument rpSubcontractorsDetails = master.Report.OpenSubreport("SubcontractorsDetails"); ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpSubcontractorsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; // Other Costs ReportDocument rpOtherCostsDetails = master.Report.OpenSubreport("OtherCostsDetails"); ReportDocument rpOtherCostsResume = master.Report.OpenSubreport("OtherCostsResume"); ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text5"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["CostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["DetailSection1"]).ReportObjects["TotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsDetails.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; /// ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportHeaderSection2"]).ReportObjects["Text4"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["GroupFooterSection1"]).ReportObjects["SumofTotalCostCad1"].ObjectFormat.EnableSuppress = true; ((Section)rpOtherCostsResume.ReportDefinition.Sections["ReportFooterSection1"]).ReportObjects["SumofTotalCostCad2"].ObjectFormat.EnableSuppress = true; } } } }
private void Delete() { Page.Validate(); if (Page.IsValid) { // Delete all data for service int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Delete(costingSheetId); // Update databse UpdateDatabase(); // Store datasets Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; // Redirect string url = ""; url = "./project_costing_sheets_navigator.aspx?source_page=project_costing_sheets_delete.aspx&costing_sheet_id=" + hdfCostingSheetId.Value + "&project_id=" + hdfProjectId.Value + "&active_tab=" + (string)ViewState["active_tab"] + GetNavigatorState() + "&origin=" + (string)ViewState["origin"] + "&update=yes&data_changed=" + hdfDataChanged.Value + "&state=" + (string)ViewState["state"]; Response.Redirect(url); } }
// //////////////////////////////////////////////////////////////////////// // 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_EDIT"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["costing_sheet_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_costing_sheets_summary.aspx"); } // Tag Page hdfCostingSheetId.Value = Request.QueryString["costing_sheet_id"].ToString(); hdfCompanyId.Value = Session["companyID"].ToString(); hdfProjectId.Value = Request.QueryString["project_id"]; hdfDataChanged.Value = Request.QueryString["data_changed"]; hdfDataChangedMessage.Value = "Changes made to this project will not be saved."; ViewState["state"] = Request.QueryString["state"]; ViewState["active_tab"] = Request.QueryString["active_tab"]; ViewState["origin"] = Request.QueryString["origin"]; ViewState["update"] = Request.QueryString["update"]; projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; Session.Remove("labourHoursInformationDummy"); Session.Remove("unitsInformationDummy"); Session.Remove("materialsInformationDummy"); Session.Remove("otherCostsInformationDummy"); Session.Remove("revenueInformationDummy"); Session.Remove("subcontractorsInformationDummy"); Session.Remove("hotelsInformationDummy"); Session.Remove("bondingsInformationDummy"); Session.Remove("insurancesInformationDummy"); Session.Remove("otherCategoryInformationDummy"); // If coming from project_costing_sheets_navigator.aspx or project_costing_sheets_add.aspx if (Request.QueryString["source_page"] == "project_costing_sheets_navigator.aspx" || Request.QueryString["source_page"] == "project_costing_sheets_add.aspx") { // Store Navigator State and Update control StoreNavigatorState(); ViewState["update"] = "no"; // Get Costing sheet ID int companyId = Int32.Parse(hdfCompanyId.Value.Trim()); int costingSheetId = Int32.Parse(hdfCostingSheetId.Value.Trim()); // Get dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectCostingSheetInformationTDS = new ProjectCostingSheetInformationTDS(); labourHoursInformation = new ProjectCostingSheetInformationTDS.LabourHoursInformationDataTable(); unitsInformation = new ProjectCostingSheetInformationTDS.UnitsInformationDataTable(); materialsInformation = new ProjectCostingSheetInformationTDS.MaterialsInformationDataTable(); otherCostsInformation = new ProjectCostingSheetInformationTDS.OtherCostsInformationDataTable(); revenueInformation = new ProjectCostingSheetInformationTDS.RevenueInformationDataTable(); subcontractorsInformation = new ProjectCostingSheetInformationTDS.SubcontractorsInformationDataTable(); hotelsInformation = new ProjectCostingSheetInformationTDS.HotelsInformationDataTable(); bondingsInformation = new ProjectCostingSheetInformationTDS.BondingsInformationDataTable(); insurancesInformation = new ProjectCostingSheetInformationTDS.InsurancesInformationDataTable(); otherCategoryInformation = new ProjectCostingSheetInformationTDS.OtherCategoryInformationDataTable(); // Get General Data ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationLabourHoursInformationGateway projectCostingSheetInformationLabourHoursInformationGateway = new ProjectCostingSheetInformationLabourHoursInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationLabourHoursInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationUnitsInformationGateway projectCostingSheetInformationUnitsInformationGateway = new ProjectCostingSheetInformationUnitsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationUnitsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationMaterialsInformationGateway projectCostingSheetInformationMaterialsInformationGateway = new ProjectCostingSheetInformationMaterialsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationMaterialsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationOtherCostsInformationGateway projectCostingSheetInformationOtherCostsInformationGateway = new ProjectCostingSheetInformationOtherCostsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCostsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); projectCostingSheetInformationRevenueInformationGateway projectCostingSheetInformationRevenueInformationGateway = new projectCostingSheetInformationRevenueInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationRevenueInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationSubcontractorsInformationGateway projectCostingSheetInformationSubcontractorsInformationGateway = new ProjectCostingSheetInformationSubcontractorsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationSubcontractorsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationHotelsInformationGateway projectCostingSheetInformationHotelsInformationGateway = new ProjectCostingSheetInformationHotelsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationHotelsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationBondingsInformationGateway projectCostingSheetInformationBondingsInformationGateway = new ProjectCostingSheetInformationBondingsInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationBondingsInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationInsurancesInformationGateway projectCostingSheetInformationInsurancesInformationGateway = new ProjectCostingSheetInformationInsurancesInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationInsurancesInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); ProjectCostingSheetInformationOtherCategoryInformationGateway projectCostingSheetInformationOtherCategoryInformationGateway = new ProjectCostingSheetInformationOtherCategoryInformationGateway(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCategoryInformationGateway.LoadByCostingSheetId(costingSheetId, companyId); Session["lfsProjectTDS"] = projectTDS; Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; Session["labourHoursInformation"] = projectCostingSheetInformationTDS.LabourHoursInformation; Session["unitsInformation"] = projectCostingSheetInformationTDS.UnitsInformation; Session["materialsInformation"] = projectCostingSheetInformationTDS.MaterialsInformation; Session["otherCostsInformation"] = projectCostingSheetInformationTDS.OtherCostsInformation; Session["revenueInformation"] = projectCostingSheetInformationTDS.RevenueInformation; Session["subcontractorsInformation"] = projectCostingSheetInformationTDS.SubcontractorsInformation; Session["hotelsInformation"] = projectCostingSheetInformationTDS.HotelsInformation; Session["bondingsInformation"] = projectCostingSheetInformationTDS.BondingsInformation; Session["insurancesInformation"] = projectCostingSheetInformationTDS.InsurancesInformation; Session["otherCategoryInformation"] = projectCostingSheetInformationTDS.OtherCategoryInformation; labourHoursInformation = projectCostingSheetInformationTDS.LabourHoursInformation; unitsInformation = projectCostingSheetInformationTDS.UnitsInformation; materialsInformation = projectCostingSheetInformationTDS.MaterialsInformation; otherCostsInformation = projectCostingSheetInformationTDS.OtherCostsInformation; revenueInformation = projectCostingSheetInformationTDS.RevenueInformation; subcontractorsInformation = projectCostingSheetInformationTDS.SubcontractorsInformation; hotelsInformation = projectCostingSheetInformationTDS.HotelsInformation; bondingsInformation = projectCostingSheetInformationTDS.BondingsInformation; insurancesInformation = projectCostingSheetInformationTDS.InsurancesInformation; otherCategoryInformation = projectCostingSheetInformationTDS.OtherCategoryInformation; } // ... project_costing_sheets_add.aspx if (Request.QueryString["source_page"] == "project_costing_sheets_add.aspx") { ViewState["update"] = "yes"; } // ... left menu, project_costing_sheets_edit.aspx, project_costing_sheets_delete.aspx or project_costing_sheets_state.aspx if ((Request.QueryString["source_page"] == "lm") || (Request.QueryString["source_page"] == "project_costing_sheets_edit.aspx") || (Request.QueryString["source_page"] == "project_costing_sheets_delete.aspx") || (Request.QueryString["source_page"] == "project_costing_sheets_state.aspx")) { // Store Navigator State and Update control StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; } // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectCostingSheetInformationTDS = (ProjectCostingSheetInformationTDS)Session["projectCostingSheetInformationTDS"]; labourHoursInformation = (ProjectCostingSheetInformationTDS.LabourHoursInformationDataTable)Session["labourHoursInformation"]; unitsInformation = (ProjectCostingSheetInformationTDS.UnitsInformationDataTable)Session["unitsInformation"]; materialsInformation = (ProjectCostingSheetInformationTDS.MaterialsInformationDataTable)Session["materialsInformation"]; otherCostsInformation = (ProjectCostingSheetInformationTDS.OtherCostsInformationDataTable)Session["otherCostsInformation"]; revenueInformation = (ProjectCostingSheetInformationTDS.RevenueInformationDataTable)Session["revenueInformation"]; subcontractorsInformation = (ProjectCostingSheetInformationTDS.SubcontractorsInformationDataTable)Session["subcontractorsInformation"]; hotelsInformation = (ProjectCostingSheetInformationTDS.HotelsInformationDataTable)Session["hotelsInformation"]; bondingsInformation = (ProjectCostingSheetInformationTDS.BondingsInformationDataTable)Session["bondingsInformation"]; insurancesInformation = (ProjectCostingSheetInformationTDS.InsurancesInformationDataTable)Session["insurancesInformation"]; otherCategoryInformation = (ProjectCostingSheetInformationTDS.OtherCategoryInformationDataTable)Session["otherCategoryInformation"]; ProjectGateway projectGateway = new ProjectGateway(projectTDS); hdfClientId.Value = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())).ToString(); // ... for project int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString()); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")"; // ... for client int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId(currentClientId, Int32.Parse(hdfCompanyId.Value)); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); LoadBasicData(); } else { // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectCostingSheetInformationTDS = (ProjectCostingSheetInformationTDS)Session["projectCostingSheetInformationTDS"]; labourHoursInformation = (ProjectCostingSheetInformationTDS.LabourHoursInformationDataTable)Session["labourHoursInformation"]; unitsInformation = (ProjectCostingSheetInformationTDS.UnitsInformationDataTable)Session["unitsInformation"]; materialsInformation = (ProjectCostingSheetInformationTDS.MaterialsInformationDataTable)Session["materialsInformation"]; otherCostsInformation = (ProjectCostingSheetInformationTDS.OtherCostsInformationDataTable)Session["otherCostsInformation"]; revenueInformation = (ProjectCostingSheetInformationTDS.RevenueInformationDataTable)Session["revenueInformation"]; subcontractorsInformation = (ProjectCostingSheetInformationTDS.SubcontractorsInformationDataTable)Session["subcontractorsInformation"]; hotelsInformation = (ProjectCostingSheetInformationTDS.HotelsInformationDataTable)Session["hotelsInformation"]; bondingsInformation = (ProjectCostingSheetInformationTDS.BondingsInformationDataTable)Session["bondingsInformation"]; insurancesInformation = (ProjectCostingSheetInformationTDS.InsurancesInformationDataTable)Session["insurancesInformation"]; otherCategoryInformation = (ProjectCostingSheetInformationTDS.OtherCategoryInformationDataTable)Session["otherCategoryInformation"]; } }
private void UpdateDatabase() { int companyId = Int32.Parse(hdfCompanyId.Value); int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); DB.Open(); DB.BeginTransaction(); try { ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Save(companyId); // Save costs information ProjectCostingSheetInformationLabourHoursInformation projectCostingSheetInformationLabourHoursInformation = new ProjectCostingSheetInformationLabourHoursInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationLabourHoursInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationUnitsInformation projectCostingSheetInformationUnitsInformation = new ProjectCostingSheetInformationUnitsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationUnitsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationMaterialsInformation projectCostingSheetInformationMaterialsInformation = new ProjectCostingSheetInformationMaterialsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationMaterialsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationOtherCostsInformation projectCostingSheetInformationOtherCostsInformation = new ProjectCostingSheetInformationOtherCostsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCostsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationSubcontractorsInformation projectCostingSheetInformationSubcontractorsInformation = new ProjectCostingSheetInformationSubcontractorsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationSubcontractorsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationHotelsInformation projectCostingSheetInformationHotelsInformation = new ProjectCostingSheetInformationHotelsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationHotelsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationBondingsInformation projectCostingSheetInformationBondingsInformation = new ProjectCostingSheetInformationBondingsInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBondingsInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationInsurancesInformation projectCostingSheetInformationInsurancesInformation = new ProjectCostingSheetInformationInsurancesInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationInsurancesInformation.Save(companyId, costingSheetId); ProjectCostingSheetInformationOtherCategoryInformation projectCostingSheetInformationOtherCategoryInformation = new ProjectCostingSheetInformationOtherCategoryInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationOtherCategoryInformation.Save(companyId, costingSheetId); DB.CommitTransaction(); // Store datasets projectCostingSheetInformationTDS.AcceptChanges(); Session["lfsProjectTDS"] = projectTDS; Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; Session["labourHoursInformation"] = projectCostingSheetInformationTDS.LabourHoursInformation; Session["unitsInformation"] = projectCostingSheetInformationTDS.UnitsInformation; Session["subcontractorsInformation"] = projectCostingSheetInformationTDS.SubcontractorsInformation; Session["materialsInformation"] = projectCostingSheetInformationTDS.MaterialsInformation; Session["otherCostsInformation"] = projectCostingSheetInformationTDS.OtherCostsInformation; Session["hotelssInformation"] = projectCostingSheetInformationTDS.HotelsInformation; Session["bondingsInformation"] = projectCostingSheetInformationTDS.BondingsInformation; Session["insurancesInformation"] = projectCostingSheetInformationTDS.InsurancesInformation; Session["otherCategoryInformation"] = projectCostingSheetInformationTDS.OtherCategoryInformation; } catch (Exception ex) { DB.RollbackTransaction(); string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
private void Save() { // Validate data bool validData = true; // Validate general data Page.Validate("general"); // For valid data if (validData) { // Team Members Gridview, if the gridview is edition mode if (grdTeamMembers.EditIndex >= 0) { grdTeamMembers.UpdateRow(grdTeamMembers.EditIndex, true); } // Units Gridview, if the gridview is edition mode if (grdUnits.EditIndex >= 0) { grdUnits.UpdateRow(grdUnits.EditIndex, true); } // Materials Gridview, if the gridview is edition mode if (grdMaterials.EditIndex >= 0) { grdMaterials.UpdateRow(grdMaterials.EditIndex, true); } // Other Costs Gridview, if the gridview is edition mode if (grdOtherCosts.EditIndex >= 0) { grdOtherCosts.UpdateRow(grdOtherCosts.EditIndex, true); } // Subcontractors Costs Gridview, if the gridview is edition mode if (grdSubcontractors.EditIndex >= 0) { grdSubcontractors.UpdateRow(grdSubcontractors.EditIndex, true); } // Hotel Costs Gridview, if the gridview is edition mode if (grdHotels.EditIndex >= 0) { grdHotels.UpdateRow(grdHotels.EditIndex, true); } // Bondings Costs Gridview, if the gridview is edition mode if (grdBondings.EditIndex >= 0) { grdBondings.UpdateRow(grdBondings.EditIndex, true); } // Insurances Costs Gridview, if the gridview is edition mode if (grdInsurances.EditIndex >= 0) { grdInsurances.UpdateRow(grdInsurances.EditIndex, true); } // Other Category Costs Gridview, if the gridview is edition mode if (grdOtherCategory.EditIndex >= 0) { grdOtherCategory.UpdateRow(grdOtherCategory.EditIndex, true); } // Basic int companyId = Int32.Parse(hdfCompanyId.Value); int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); // General string state = tbxState.Text; decimal teamMembersTotalCostCad = decimal.Parse(tbxTeamMembersTotalCostCAD.Text); decimal teamMembersTotalCostUsd = decimal.Parse(tbxTeamMembersTotalCostUSD.Text); decimal unitsTotalCostCad = decimal.Parse(tbxUnitsTotalCostsCAD.Text); decimal unitsTotalCostUsd = decimal.Parse(tbxUnitsTotalCostsUSD.Text); decimal materialsTotalCostCad = decimal.Parse(tbxMaterialsTotalCostsCAD.Text); decimal materialsTotalCostUsd = decimal.Parse(tbxMaterialsTotalCostsUSD.Text); decimal otherCostsTotalCostCad = decimal.Parse(tbxOtherCostsTotalCostsCAD.Text); decimal otherCostsTotalCostUsd = decimal.Parse(tbxOtherCostsTotalCostsUSD.Text); decimal grandTotalCostCad = decimal.Parse(tbxTotalCostCad.Text); decimal grandTotalCostUsd = decimal.Parse(tbxTotalCostUsd.Text); decimal subcontractorsTotalCostCad = decimal.Parse(tbxSubcontractorsTotalCostsCAD.Text); decimal subcontractorsTotalCostUsd = decimal.Parse(tbxSubcontractorsTotalCostsUSD.Text); decimal grandRevenue = 0.0M; if (tbxGrandRevenue.Text != "") grandRevenue = decimal.Parse(tbxGrandRevenue.Text); decimal grandProfit = 0.0M; if (tbxGrandProfit.Text != "") grandProfit = decimal.Parse(tbxGrandProfit.Text); decimal grandGrossMargin = 0.0M; if (tbxGrandGrossMargin.Text != "") { tbxGrandGrossMargin.Text = tbxGrandGrossMargin.Text.Replace('%', ' '); grandGrossMargin = decimal.Parse(tbxGrandGrossMargin.Text.Trim()); } // Update unit data ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Update(costingSheetId, hdfCostingSheetName.Value, teamMembersTotalCostCad, teamMembersTotalCostUsd, materialsTotalCostCad, materialsTotalCostUsd, unitsTotalCostCad, unitsTotalCostUsd, otherCostsTotalCostCad, otherCostsTotalCostUsd, grandTotalCostCad, grandTotalCostUsd, subcontractorsTotalCostCad, subcontractorsTotalCostUsd, grandRevenue, grandProfit, grandGrossMargin); // Store dataset Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; // Redirect string url = ""; if (Request.QueryString["source_page"] == "project_costing_sheets_navigator.aspx" || Request.QueryString["source_page"] == "project_costing_sheets_add.aspx") { url = "./project_costing_sheets_navigator.aspx?source_page=project_costing_sheets_edit.aspx&costing_sheet_id=" + hdfCostingSheetId.Value + "&project_id=" + hdfProjectId.Value + "&costing_sheet_state=Approved&active_tab=" + (string)ViewState["active_tab"] + GetNavigatorState() + "&origin=" + (string)ViewState["origin"] + "&update=" + (string)ViewState["update"] + "&data_changed=" + hdfDataChanged.Value + "&state=" + (string)ViewState["state"]; } if (Request.QueryString["source_page"] == "project_costing_sheets_summary.aspx") { url = "./project_costing_sheets_summary.aspx?source_page=project_costing_sheets_edit.aspx&costing_sheet_id=" + hdfCostingSheetId.Value + "&project_id=" + hdfProjectId.Value + "&costing_sheet_state=Approved&active_tab=" + (string)ViewState["active_tab"] + GetNavigatorState() + "&origin=" + (string)ViewState["origin"] + "&update=" + (string)ViewState["update"] + "&data_changed=" + hdfDataChanged.Value + "&state=" + (string)ViewState["state"]; } Response.Redirect(url); } }
private void Apply() { // Validate data bool validData = true; // Validate general data Page.Validate("general"); // For valid data if (validData) { // Team Members Gridview, if the gridview is edition mode if (grdTeamMembers.EditIndex >= 0) { grdTeamMembers.UpdateRow(grdTeamMembers.EditIndex, true); } // Units Gridview, if the gridview is edition mode if (grdUnits.EditIndex >= 0) { grdUnits.UpdateRow(grdUnits.EditIndex, true); } // Materials Gridview, if the gridview is edition mode if (grdMaterials.EditIndex >= 0) { grdMaterials.UpdateRow(grdMaterials.EditIndex, true); } // Other Costs Gridview, if the gridview is edition mode if (grdOtherCosts.EditIndex >= 0) { grdOtherCosts.UpdateRow(grdOtherCosts.EditIndex, true); } // Subcontractors Costs Gridview, if the gridview is edition mode if (grdSubcontractors.EditIndex >= 0) { grdSubcontractors.UpdateRow(grdSubcontractors.EditIndex, true); } // Hotel Costs Gridview, if the gridview is edition mode if (grdHotels.EditIndex >= 0) { grdHotels.UpdateRow(grdHotels.EditIndex, true); } // Bondings Costs Gridview, if the gridview is edition mode if (grdBondings.EditIndex >= 0) { grdBondings.UpdateRow(grdBondings.EditIndex, true); } // Insurances Costs Gridview, if the gridview is edition mode if (grdInsurances.EditIndex >= 0) { grdInsurances.UpdateRow(grdInsurances.EditIndex, true); } // Other Category Costs Gridview, if the gridview is edition mode if (grdOtherCategory.EditIndex >= 0) { grdOtherCategory.UpdateRow(grdOtherCategory.EditIndex, true); } // Basic int companyId = Int32.Parse(hdfCompanyId.Value); int costingSheetId = Int32.Parse(hdfCostingSheetId.Value); // General string state = tbxState.Text; decimal teamMembersTotalCostCad = decimal.Parse(tbxTeamMembersTotalCostCAD.Text); decimal teamMembersTotalCostUsd = decimal.Parse(tbxTeamMembersTotalCostUSD.Text); decimal unitsTotalCostCad = decimal.Parse(tbxUnitsTotalCostsCAD.Text); decimal unitsTotalCostUsd = decimal.Parse(tbxUnitsTotalCostsUSD.Text); decimal materialsTotalCostCad = decimal.Parse(tbxMaterialsTotalCostsCAD.Text); decimal materialsTotalCostUsd = decimal.Parse(tbxMaterialsTotalCostsUSD.Text); decimal otherCostsTotalCostCad = decimal.Parse(tbxOtherCostsTotalCostsCAD.Text); decimal otherCostsTotalCostUsd = decimal.Parse(tbxOtherCostsTotalCostsUSD.Text); decimal grandTotalCostCad = decimal.Parse(tbxTotalCostCad.Text); decimal grandTotalCostUsd = decimal.Parse(tbxTotalCostUsd.Text); decimal subcontractorsTotalCostCad = decimal.Parse(tbxSubcontractorsTotalCostsCAD.Text); decimal subcontractorsTotalCostUsd = decimal.Parse(tbxSubcontractorsTotalCostsUSD.Text); decimal grandRevenue = 0.0M; if (tbxGrandRevenue.Text != "") grandRevenue = decimal.Parse(tbxGrandRevenue.Text); decimal grandProfit = 0.0M; if (tbxGrandProfit.Text != "") grandProfit = decimal.Parse(tbxGrandProfit.Text); decimal grandGrossMargin = 0.0M; if (tbxGrandGrossMargin.Text != "") { tbxGrandGrossMargin.Text = tbxGrandGrossMargin.Text.Replace('%', ' '); grandGrossMargin = decimal.Parse(tbxGrandGrossMargin.Text.Trim()); } // Update unit data ProjectCostingSheetInformationBasicInformation projectCostingSheetInformationBasicInformation = new ProjectCostingSheetInformationBasicInformation(projectCostingSheetInformationTDS); projectCostingSheetInformationBasicInformation.Update(costingSheetId, hdfCostingSheetName.Value, teamMembersTotalCostCad, teamMembersTotalCostUsd, materialsTotalCostCad, materialsTotalCostUsd, unitsTotalCostCad, unitsTotalCostUsd, otherCostsTotalCostCad, otherCostsTotalCostUsd, grandTotalCostCad, grandTotalCostUsd, subcontractorsTotalCostCad, subcontractorsTotalCostUsd, grandRevenue, grandProfit, grandGrossMargin); // Store dataset Session["projectCostingSheetInformationTDS"] = projectCostingSheetInformationTDS; // Update database UpdateDatabase(); ViewState["update"] = "yes"; } }