private void UpdateDatabase() { try { ProjectGateway projectGateway = new ProjectGateway(projectTDS); //LibraryFilesGateway libraryFilesGateway = new LibraryFilesGateway(libraryTDS); //libraryFilesGateway.Update(); //libraryTDS.AcceptChanges(); //Getting projectId for Notes table ProjectNotesGateway projectNotesGateway = new ProjectNotesGateway(projectTDS); projectGateway.Update3(); projectTDS.AcceptChanges(); // Save notes int companyId = Int32.Parse(hdfCompanyId.Value); //ProjectNavigatorProjectNotesGateway projectNavigatorNotesGateway = new ProjectNavigatorProjectNotesGateway(projectNavigatorTDS); //ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); //foreach (ProjectNavigatorTDS.ProjectNotesRow rowNotes in (ProjectNavigatorTDS.ProjectNotesDataTable)projectNavigatorNotesGateway.Table) //{ // if (!rowNotes.IsLIBRARY_FILES_IDNull()) // { // if (rowNotes.LIBRARY_FILES_ID == 0 && rowNotes.FILENAME != "") // { // libraryFilesGateway.LoadByFileName(rowNotes.FILENAME, companyId); // int newLibraryFilesId = libraryFilesGateway.GetlibraryFilesId(rowNotes.FILENAME); // rowNotes.LIBRARY_FILES_ID = newLibraryFilesId; // } // } //} //projectNavigatorProjectNotes.Save(companyId); // Save job info ProjectNavigatorProjectJobInfo projectNavigatorProjectJobInfo = new ProjectNavigatorProjectJobInfo(projectNavigatorTDS); projectNavigatorProjectJobInfo.Save(companyId); // Save services ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS); projectNavigatorProjectService.UpdateForSave(); projectNavigatorProjectService.Save(companyId); // Save Cost Exceptions // ... Save Job Class Type Rate Classification ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); projectNavigatorProjectJobClassTypeRate.Save(companyId); // ... Save Work Function Fair Wage Classification ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); projectNavigatorProjectWorkFunctionFairWage.Save(companyId); // ... Save budget ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS); projectNavigatorProjectWorkFunctionBudget.Save(companyId); ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS); projectNavigatorProjectUnitsBudget.Save(companyId); ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS); projectNavigatorProjectMaterialsBudget.Save(companyId); ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS); projectNavigatorProjectSubcontractorsBudget.Save(companyId); ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS); projectNavigatorProjectHotelsBudget.Save(companyId); ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS); projectNavigatorProjectBondingsBudget.Save(companyId); ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS); projectNavigatorProjectInsurancesBudget.Save(companyId); ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS); projectNavigatorProjectOtherCostsBudget.Save(companyId); projectNavigatorTDS.AcceptChanges(); Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["lfsProjectTDS"] = projectTDS; Session["lfsLibraryTDS"] = libraryTDS; } catch (Exception ex) { string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' ')); Response.Redirect(url); } }
//protected void btnUnassociate_Click(object sender, EventArgs e) //{ // Project project = new Project(projectTDS); // project.UpdateLibraryCategoriesId(int.Parse(hdfProjectId.Value), null); // UpdateDatabase(); // ViewState["update"] = "yes"; // btnUnassociate.Visible = false; // btnAssociate.Visible = false; // string url = "./project_edit.aspx?source_page=lm&project_id=" + hdfProjectId.Value + GetNavigatorState() + "&origin=summary&update=" + ViewState["update"] + "&data_changed=" + hdfDataChanged.Value; // Response.Redirect(url); //} protected void cbxFairWageApplies_CheckedChanged(object sender, EventArgs e) { if (cbxFairWageApplies.Checked) { Session["fairWage"] = "True"; int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(hdfProjectId.Value); TeamProjectTimeWorkFunctionConcatGateway teamProjectTimeWorkFunctionGateway = new TeamProjectTimeWorkFunctionConcatGateway(); teamProjectTimeWorkFunctionGateway.LoadWorkFunctionConcat(); foreach (TeamProjectTime2TDS.TEAM_PROJECT_TIME_WORK_FUNCTION_CONCATRow originalRow in (TeamProjectTime2TDS.TEAM_PROJECT_TIME_WORK_FUNCTION_CONCATDataTable)teamProjectTimeWorkFunctionGateway.Table) { string workFunctionConcat = originalRow.WorkFunctionConcat; string[] workFunction = workFunctionConcat.ToString().Trim().Split('.'); string work_ = workFunction[0].Trim(); string function_ = workFunction[1].Trim(); ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); if (!model.ExistWorkFunction(work_, function_)) { TypeOfWorkFunctionClassificationAdd(companyId, projectId, true, workFunctionConcat, work_, function_); } } } else { Session["fairWage"] = "False"; } }
private void TypeOfWorkFunctionClassificationAdd(int companyId, int projectId, bool isFairWage, string workFunctionConcat, string work_, string function_) { ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); model.Insert(projectId, work_, function_, isFairWage, false, companyId, false, workFunctionConcat); Session.Remove("projectTypeOfWorkFunctionClassificationDummy"); Session["projectNavigatorTDS"] = projectNavigatorTDS; projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification; }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check if (!(Convert.ToBoolean(Session["sgLFS_PROJECTS_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_EDIT"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (((string)Request.QueryString["source_page"] == null) || ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_edit.aspx"); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); hdfProjectId.Value = Request.QueryString["project_id"]; hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); hdfDataChanged.Value = Request.QueryString["data_changed"]; hdfDataChangedMessage.Value = "Changes made to this project will not be saved."; // Prepare initial data Session.Remove("projectNotesDummy"); Session.Remove("projectServicesDummy"); Session.Remove("projectTypeOfWorkFunctionClassificationDummy"); Session.Remove("projectJobClassClassificationDummy"); Session.Remove("projectBudgetDummy"); Session.Remove("subcontractorsBudgetDummy"); Session.Remove("hotelsBudgetDummy"); Session.Remove("bondingsBudgetDummy"); Session.Remove("insurancesBudgetDummy"); Session.Remove("otherCostsBudgetDummy"); Session["fairWage"] = "None"; // ... Set initial tab if ((string)Session["dialogOpenedProjects"] != "1") { hdfActiveTab.Value = Request.QueryString["active_tab"]; } else { hdfActiveTab.Value = (string)Session["activeTabProjects"]; } // ... For Library if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } // If coming from // ... projects2.aspx or project_add.aspx if (Request.QueryString["source_page"] == "projects2.aspx" || Request.QueryString["source_page"] == "project_add.aspx") { // Store Navigator State, Update control and Origin StoreNavigatorState(); ViewState["update"] = "no"; ViewState["origin"] = "navigator"; // Get Project Id int projectId = int.Parse(hdfProjectId.Value); // ... Attachment control if (Session["fromAttachment"] != null) { if (Session["fromAttachment"].ToString() == "yes") { // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; } Session.Remove("fromAttachment"); } else { // Get dataset projectTDS = new ProjectTDS(); projectNavigatorTDS = new ProjectNavigatorTDS(); projectNotes = new ProjectNavigatorTDS.ProjectNotesDataTable(); projectServices = new ProjectNavigatorTDS.ProjectServiceDataTable(); projectTypeOfWorkFunctionClassification = new ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable(); projectJobClassClassification = new ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable(); projectBudget = new ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable(); unitsBudget = new ProjectNavigatorTDS.ProjectUnitsBudgetDataTable(); materialsBudget = new ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable(); subcontractorsBudget = new ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable(); hotelsBudget = new ProjectNavigatorTDS.ProjectHotelsBudgetDataTable(); bondingsBudget = new ProjectNavigatorTDS.ProjectBondingsBudgetDataTable(); insurancesBudget = new ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable(); otherCostsBudget = new ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable(); // Get General Data ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS); projectGatewayForLoad.LoadByProjectId(projectId); // Get job info ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS); projectJobInfoGateway.LoadAllByProjectId(projectId); // Get Sale/Billing/Pricing ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS); projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Sale/Billing/Pricing - Services ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS); projectNavigatorProjectService.LoadAllByProjectId(projectId); projectNavigatorProjectService.UpdateForLoad(); // Get Costing Updates ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS); projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId); // Get Project Terms ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS); projectTermsPOGatewayForLoad.LoadByProjectId(projectId); // Get Technical ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS); projectTechnicalGatewayForLoad.LoadByProjectId(projectId); // Get Engineer Subcontractors ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS); projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Subcontractors ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS); projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId); // Cost Exceptions // ... Get Type Of Work & Function Classification ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId); // ... Get Job Class Classification ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId); // Get Budget ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS); projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId); // Get Units Budget ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS); projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId); // Get Materials Budget ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS); projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId); // Get Subcontractors Budget ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS); projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId); // Get Hotels Budget ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS); projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId); // Get Bondings Budget ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS); projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId); // Get Insurances Budget ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS); projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId); // Get Other Costs Budget ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS); projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId); // Get Notes ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); projectNavigatorProjectNotes.LoadAllByProjectId(projectId); // Store dataset Session["lfsProjectTDS"] = projectTDS; Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; Session["projectServices"] = projectNavigatorTDS.ProjectService; Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget; Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget; Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget; Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget; Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget; Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget; Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget; Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget; } //grdNotes.DataBind(); //grdServices.DataBind(); grdTypeOfWorkFunctionClassification.DataBind(); grdJobClassClassification.DataBind(); grdBudget.DataBind(); /*grdSubcontractorsBudget.DataBind(); grdHotelsBudget.DataBind(); grdBondingsBudget.DataBind(); grdInsurancesBudget.DataBind();*/ grdOtherCostsBudget.DataBind(); } // ... project_summary.aspx or project_edit.aspx if ((Request.QueryString["source_page"] == "project_summary.aspx") || (Request.QueryString["source_page"] == "project_edit.aspx") || (Request.QueryString["source_page"] == "lm")) { // Store Navigator State, update control and origin StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; ViewState["origin"] = Request.QueryString["origin"]; //summary // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; // Get Project Id int projectId = int.Parse(hdfProjectId.Value); if (ViewState["update"].ToString().Trim() == "yes") { // Get General Data ProjectGateway projectGatewayForLoad = new ProjectGateway(projectTDS); projectGatewayForLoad.LoadByProjectId(projectId); // Get job info ProjectJobInfoGateway projectJobInfoGateway = new ProjectJobInfoGateway(projectNavigatorTDS); projectJobInfoGateway.LoadAllByProjectId(projectId); // Get Sale/Billing/Pricing ProjectSaleBillingPricingGateway projectSaleBillingPricingGatewayForLoad = new ProjectSaleBillingPricingGateway(projectTDS); projectSaleBillingPricingGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Sale/Billing/Pricing - Services ProjectNavigatorProjectService projectNavigatorProjectService = new ProjectNavigatorProjectService(projectNavigatorTDS); projectNavigatorProjectService.LoadAllByProjectId(projectId); projectNavigatorProjectService.UpdateForLoad(); // Get Costing Updates ProjectCostingUpdatesGateway projectCostingUpdatesGatewayForLoad = new ProjectCostingUpdatesGateway(projectTDS); projectCostingUpdatesGatewayForLoad.LoadByProjectId(projectId); // Get Project Terms ProjectTermsPOGateway projectTermsPOGatewayForLoad = new ProjectTermsPOGateway(projectTDS); projectTermsPOGatewayForLoad.LoadByProjectId(projectId); // Get Technical ProjectTechnicalGateway projectTechnicalGatewayForLoad = new ProjectTechnicalGateway(projectTDS); projectTechnicalGatewayForLoad.LoadByProjectId(projectId); // Get Engineer Subcontractors ProjectEngineerSubcontractorsGateway projectEngineerSubcontractorsGatewayForLoad = new ProjectEngineerSubcontractorsGateway(projectTDS); projectEngineerSubcontractorsGatewayForLoad.LoadAllByProjectId(projectId); // ... Get Subcontractors ProjectSubcontractorGateway projectSubcontractorGatewayForLoad = new ProjectSubcontractorGateway(projectTDS); projectSubcontractorGatewayForLoad.LoadAllByProjectId(projectId); // Cost Exceptions // ... Get Type Of Work & Function Classification ProjectNavigatorProjectWorkFunctionFairWage projectNavigatorProjectWorkFunctionFairWage = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); projectNavigatorProjectWorkFunctionFairWage.LoadAllByProjectId(projectId); // ... Get Job Class Classification ProjectNavigatorProjectJobClassTypeRate projectNavigatorProjectJobClassTypeRate = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); projectNavigatorProjectJobClassTypeRate.LoadAllByProjectId(projectId); // Get Budget ProjectNavigatorProjectWorkFunctionBudget projectNavigatorProjectWorkFunctionBudget = new ProjectNavigatorProjectWorkFunctionBudget(projectNavigatorTDS); projectNavigatorProjectWorkFunctionBudget.LoadAllByProjectId(projectId); // Get Units Budget ProjectNavigatorProjectUnitsBudget projectNavigatorProjectUnitsBudget = new ProjectNavigatorProjectUnitsBudget(projectNavigatorTDS); projectNavigatorProjectUnitsBudget.LoadAllByProjectId(projectId); // Get Materials Budget ProjectNavigatorProjectMaterialsBudget projectNavigatorProjectMaterialsBudget = new ProjectNavigatorProjectMaterialsBudget(projectNavigatorTDS); projectNavigatorProjectMaterialsBudget.LoadAllByProjectId(projectId); // Get Subcontractors Budget ProjectNavigatorProjectSubcontractorsBudget projectNavigatorProjectSubcontractorsBudget = new ProjectNavigatorProjectSubcontractorsBudget(projectNavigatorTDS); projectNavigatorProjectSubcontractorsBudget.LoadAllByProjectId(projectId); // Get Hotels Budget ProjectNavigatorProjectHotelsBudget projectNavigatorProjectHotelsBudget = new ProjectNavigatorProjectHotelsBudget(projectNavigatorTDS); projectNavigatorProjectHotelsBudget.LoadAllByProjectId(projectId); // Get Bondings Budget ProjectNavigatorProjectBondingsBudget projectNavigatorProjectBondingsBudget = new ProjectNavigatorProjectBondingsBudget(projectNavigatorTDS); projectNavigatorProjectBondingsBudget.LoadAllByProjectId(projectId); // Get Insurances Budget ProjectNavigatorProjectInsurancesBudget projectNavigatorProjectInsurancesBudget = new ProjectNavigatorProjectInsurancesBudget(projectNavigatorTDS); projectNavigatorProjectInsurancesBudget.LoadAllByProjectId(projectId); // Get Other Costs Budget ProjectNavigatorProjectOtherCostsBudget projectNavigatorProjectOtherCostsBudget = new ProjectNavigatorProjectOtherCostsBudget(projectNavigatorTDS); projectNavigatorProjectOtherCostsBudget.LoadAllByProjectId(projectId); // Get Notes ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); projectNavigatorProjectNotes.LoadAllByProjectId(projectId); //grdNotes.DataBind(); //grdServices.DataBind(); grdTypeOfWorkFunctionClassification.DataBind(); grdJobClassClassification.DataBind(); grdBudget.DataBind(); /*grdSubcontractorsBudget.DataBind(); grdHotelsBudget.DataBind(); grdBondingsBudget.DataBind(); grdInsurancesBudget.DataBind();*/ grdOtherCostsBudget.DataBind(); // Store dataset Session["lfsProjectTDS"] = projectTDS; Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; Session["projectServices"] = projectNavigatorTDS.ProjectService; Session["projectTypeOfWorkFunctionClassification"] = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectJobClassClassification"] = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectBudget"] = projectNavigatorTDS.ProjectWorkFunctionBudget; Session["unitsBudget"] = projectNavigatorTDS.ProjectUnitsBudget; Session["materialsBudget"] = projectNavigatorTDS.ProjectMaterialsBudget; Session["subcontractorsBudget"] = projectNavigatorTDS.ProjectSubcontractorsBudget; Session["hotelsBudget"] = projectNavigatorTDS.ProjectHotelsBudget; Session["bondingsBudget"] = projectNavigatorTDS.ProjectBondingsBudget; Session["insurancesBudget"] = projectNavigatorTDS.ProjectInsurancesBudget; Session["otherCostsBudget"] = projectNavigatorTDS.ProjectOtherCostsBudget; } } // Data for current project ProjectGateway projectGateway = new ProjectGateway(projectTDS); // ... for project int currentProjectId = Int32.Parse(hdfProjectId.Value.ToString()); string name = projectGateway.GetName(currentProjectId); if (name.Length > 23) name = name.Substring(0, 20) + "..."; lblTitleProjectName.Text = name + " (" + projectGateway.GetProjectNumber(currentProjectId) + ")"; // ... for client int companyId = Int32.Parse(hdfCompanyId.Value); int currentClientId = projectGateway.GetClientID(Int32.Parse(hdfProjectId.Value.ToString())); CompaniesGateway companiesGateway = new CompaniesGateway(); companiesGateway.LoadAllByCompaniesId(currentClientId, companyId); lblTitleClientName.Text = "Client: " + companiesGateway.GetName(currentClientId); // Load Data LoadData(); // Store Dataset Session["lfsProjectTDS"] = projectTDS; //// ... For total cost at services //ProjectNavigatorProjectService projectNavigatorProjectServiceForCost = new ProjectNavigatorProjectService(projectNavigatorTDS); //tbxTotalCost.Text = Decimal.Round(projectNavigatorProjectServiceForCost.GetTotalCost(), 2).ToString(); } else { // Restore dataset projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; projectServices = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServices"]; projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]; projectTypeOfWorkFunctionClassification = (ProjectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGEDataTable)Session["projectTypeOfWorkFunctionClassification"]; projectBudget = (ProjectNavigatorTDS.ProjectWorkFunctionBudgetDataTable)Session["projectBudget"]; unitsBudget = (ProjectNavigatorTDS.ProjectUnitsBudgetDataTable)Session["unitsBudget"]; materialsBudget = (ProjectNavigatorTDS.ProjectMaterialsBudgetDataTable)Session["materialsBudget"]; subcontractorsBudget = (ProjectNavigatorTDS.ProjectSubcontractorsBudgetDataTable)Session["subcontractorsBudget"]; hotelsBudget = (ProjectNavigatorTDS.ProjectHotelsBudgetDataTable)Session["hotelsBudget"]; bondingsBudget = (ProjectNavigatorTDS.ProjectBondingsBudgetDataTable)Session["bondingsBudget"]; insurancesBudget = (ProjectNavigatorTDS.ProjectInsurancesBudgetDataTable)Session["insurancesBudget"]; otherCostsBudget = (ProjectNavigatorTDS.ProjectOtherCostsBudgetDataTable)Session["otherCostsBudget"]; tbxProjectNumber.DataBind(); if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } } }
protected void grdTypeOfWorkFunctionClassification_RowUpdating(object sender, GridViewUpdateEventArgs e) { // Cancel fairWage update Session["fairWage"] = "None"; // New Values int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblProjectIDEdit")).Text.Trim()); string work_ = ((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblWork_Edit")).Text.Trim(); string function_ = ((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("lblFunction_Edit")).Text.Trim(); int refId = Int32.Parse(((Label)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[1].FindControl("lblRefIDEdit")).Text.Trim()); bool isFairWage = false; if (((CheckBox)grdTypeOfWorkFunctionClassification.Rows[e.RowIndex].Cells[0].FindControl("cbxIsFairWageEdit")).Checked) isFairWage = true; // Update data ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); model.Update(projectId, work_, function_, refId, isFairWage, false, companyId); // Store dataset Session["projectNavigatorTDS"] = projectNavigatorTDS; projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification; }
protected void grdTypeOfWorkFunctionClassification_RowDeleting(object sender, GridViewDeleteEventArgs e) { // grdTypeOfWorkFunctionClassification Gridview, if the gridview is edition mode if (grdTypeOfWorkFunctionClassification.EditIndex >= 0) { grdTypeOfWorkFunctionClassification.UpdateRow(grdTypeOfWorkFunctionClassification.EditIndex, true); } // Delete grdTypeOfWorkFunctionClassification int projectId = (int)e.Keys["ProjectID"]; string work_ = (string)e.Keys["Work_"]; string function_ = (string)e.Keys["Function_"]; int refId = (int)e.Keys["RefID"]; // Delete ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); model.Delete(projectId, work_, function_, refId); // Store dataset Session["projectNavigatorTDS"] = projectNavigatorTDS; grdTypeOfWorkFunctionClassification.DataBind(); }
protected void grdTypeOfWorkFunctionClassification_RowDataBound(object sender, GridViewRowEventArgs e) { // Validate footer if it's a fair wage if (e.Row.RowType == DataControlRowType.Footer) { if (cbxFairWageApplies.Checked) { ((CheckBox)e.Row.FindControl("cbxIsFairWageNew")).Checked = true; } else { ((CheckBox)e.Row.FindControl("cbxIsFairWageNew")).Checked = false; } } // Change values if the fair wage state changes. if ((Session["fairWage"]).ToString() != "None") { if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Normal) || (e.Row.RowState == (DataControlRowState.Normal | DataControlRowState.Alternate)))) { if ((Session["fairWage"]).ToString() == "True") { ((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked = true; } else { ((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked = false; } //Save Changes int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectID")).Text.Trim()); string work_ = ((Label)e.Row.FindControl("lblWork_")).Text.Trim(); string function_ = ((Label)e.Row.FindControl("lblFunction_")).Text.Trim(); int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefID")).Text.Trim()); bool isFairWage = false; if (((CheckBox)e.Row.FindControl("cbxIsFairWage")).Checked) isFairWage = true; // Update data if (projectId > 0) { ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); model.Update(projectId, work_, function_, refId, isFairWage, false, companyId); // Store dataset Session["projectNavigatorTDS"] = projectNavigatorTDS; projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification; } } if ((e.Row.RowType == DataControlRowType.DataRow) && ((e.Row.RowState == DataControlRowState.Edit) || (e.Row.RowState == (DataControlRowState.Edit | DataControlRowState.Alternate)))) { if ((Session["fairWage"]).ToString() == "True") { ((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked = true; } else { ((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked = false; } //Save Changes int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(((Label)e.Row.FindControl("lblProjectIDEdit")).Text.Trim()); string work_ = ((Label)e.Row.FindControl("lblWork_Edit")).Text.Trim(); string function_ = ((Label)e.Row.FindControl("lblFunction_Edit")).Text.Trim(); int refId = Int32.Parse(((Label)e.Row.FindControl("lblRefIDEdit")).Text.Trim()); bool isFairWage = false; if (((CheckBox)e.Row.FindControl("cbxIsFairWageEdit")).Checked) isFairWage = true; // Update data if (projectId > 0) { ProjectNavigatorProjectWorkFunctionFairWage model = new ProjectNavigatorProjectWorkFunctionFairWage(projectNavigatorTDS); model.Update(projectId, work_, function_, refId, isFairWage, false, companyId); // Store dataset Session["projectNavigatorTDS"] = projectNavigatorTDS; projectTypeOfWorkFunctionClassification = projectNavigatorTDS.LFS_PROJECT_WORK_FUNCTION_FAIR_WAGE; Session["projectTypeOfWorkFunctionClassification"] = projectTypeOfWorkFunctionClassification; } } } }