// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Store navigator state StoreNavigatorState(); hdfUpdate.Value = "yes"; hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); tbxDescription.Text = Server.UrlDecode(Request.QueryString["subject"].ToString()); ViewState["refId"] = Request.QueryString["refId"].ToString(); ViewState["projectId"] = Request.QueryString["project_id"].ToString(); ViewState["libraryCategoriesId"] = Request.QueryString["library_categories_id"].ToString(); projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } Session["lfsProjectTDS"] = projectTDS; } else { projectTDS = (ProjectTDS)Session["lfsProjectTDS"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; if (Session["lfsLibraryTDS"] != null) { libraryTDS = (LibraryTDS)Session["lfsLibraryTDS"]; } else { libraryTDS = new LibraryTDS(); } } }
/// <summary> /// GetNextId /// </summary> /// <param name="projectNavigatorTDS">projectNavigatorTDS</param> /// <param name="currentProjectId">currentProjectId</param> /// <returns>nextProjectId</returns> public static int GetNextId(ProjectNavigatorTDS projectNavigatorTDS, int currentProjectId) { int nextProjectId = currentProjectId; for (int i = 0; i < projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView.Count; i++) { if ((int)projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView[i]["ProjectID"] == currentProjectId) { if (i == projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView.Count - 1) { nextProjectId = currentProjectId; } else { nextProjectId = (int)projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView[i + 1]["ProjectID"]; } break; } } return nextProjectId; }
// //////////////////////////////////////////////////////////////////////// // 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["client_id"] == null) || ((string)Request.QueryString["project_id"] == null)) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in project_notes.aspx"); } // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); hdfCurrentProjectId.Value = Request.QueryString["project_id"].ToString(); hdfCurrentClientId.Value = Request.QueryString["client_id"].ToString(); hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); hdfUpdate.Value = "yes"; // Prepare initial data Session.Remove("projectNotesDummy"); // ... Names for UserList int companyId = Int32.Parse(hdfCompanyId.Value); LoginGateway loginGateway = new LoginGateway(); loginGateway.LoadByLoginId(Convert.ToInt32(hdfLoginId.Value),companyId); hdfCreatedBy.Value = loginGateway.GetLastName(Convert.ToInt32(hdfLoginId.Value), companyId) + " " + loginGateway.GetFirstName(Convert.ToInt32(hdfLoginId.Value), companyId); hdfCreationDateTime.Value = DateTime.Now.ToString(); // If coming from // ... project_summary.aspx or project_edit.aspx if (Request.QueryString["source_page"] == "project_summary.aspx" || Request.QueryString["source_page"] == "project_edit.aspx") { StoreNavigatorState(); ViewState["update"] = Request.QueryString["update"]; projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; int currentProjectId = Int32.Parse(hdfCurrentProjectId.Value.Trim()); // Get Notes ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); projectNavigatorProjectNotes.LoadAllByProjectId(currentProjectId); // ... Store datasets Session["projectNavigatorTDS"] = projectNavigatorTDS; Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; } } else { // Restore datasets projectNavigatorTDS = (ProjectNavigatorTDS)Session["projectNavigatorTDS"]; projectNotes = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotes"]; } }
/// <summary> /// InitData /// </summary> protected override void InitData() { _data = new ProjectNavigatorTDS(); }
// //////////////////////////////////////////////////////////////////////// // 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(); } } }
/// <summary> /// GetPreviousId /// </summary> /// <param name="projectNavigatorTDS">projectNavigatorTDS</param> /// <param name="currentProjectId">currentProjectId</param> /// <returns>prevProjectId</returns> public static int GetPreviousId(ProjectNavigatorTDS projectNavigatorTDS, int currentProjectId) { int prevProjectId = currentProjectId; for (int i = 0; i < projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView.Count; i++) { if ((int)projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView[i]["ProjectID"] == currentProjectId) { if (i == 0) { prevProjectId = currentProjectId; } else { prevProjectId = (int)projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.DefaultView[i - 1]["ProjectID"]; } break; } } return prevProjectId; }
// //////////////////////////////////////////////////////////////////////// // 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_VIEW"]) && Convert.ToBoolean(Session["sgLFS_PROJECTS_ADD"]))) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Tag page hdfCompanyId.Value = Session["companyID"].ToString(); Session.Remove("projectNavigatorNewDummy"); Session.Remove("addDuplicateProjectNavigator"); // Initialize viewstate variables ViewState["StepFrom"] = "Out"; // Store navigator state StoreNavigatorState(); // Store datasets duplicateProjectNavigatorTDS = new ProjectNavigatorTDS(); Session["duplicateProjectNavigatorTDS"] = duplicateProjectNavigatorTDS; // StepProposalsIn StepProposalsIn(); } else { //Restore datasets duplicateProjectNavigatorTDS = (ProjectNavigatorTDS)Session["duplicateProjectNavigatorTDS"]; } }
// //////////////////////////////////////////////////////////////////////// // 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"])) { Response.Redirect("./../../error_page.aspx?error=" + "You are not authorized to view this page. Contact your system administrator."); } // Validate query string if (Request.QueryString["source_page"] == null) { Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in projects2.aspx"); } // Security check if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"])) { ddlProjectType.Visible = true; ddlProjectTypeAdmin.Visible = false; ddlProjectType.SelectedIndex = 0; ddlProjectState.Visible = true; ddlProjectStateAdmin.Visible = false; ddlProjectState.SelectedIndex = 0; } else { ddlProjectType.Visible = false; ddlProjectTypeAdmin.Visible = true; ddlProjectTypeAdmin.SelectedIndex = 0; ddlProjectState.Visible = false; ddlProjectStateAdmin.Visible = true; ddlProjectStateAdmin.SelectedIndex = 0; } // Tag Page Session.Remove("projectNavigatorNewDummy"); Session.Remove("projectNavigator"); Session.Remove("projectsSelected"); hdfPageIndex.Value = "0"; // Prepare initial data lblError.Visible = false; hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString(); hdfCompanyId.Value = Session["companyID"].ToString(); Session.Remove("lastUsedProjectsDummy"); // If coming from projectSelectProjectTDS = new ProjectSelectProjectTDS(); ProjectSelectProjectLastUsedProjectsGateway projectSelectProjectLastUsedProjectsGateway = new ProjectSelectProjectLastUsedProjectsGateway(projectSelectProjectTDS); projectSelectProjectLastUsedProjectsGateway.LoadByLoginId(Int32.Parse(hdfLoginId.Value), Int32.Parse(hdfCompanyId.Value)); // ... projects.aspx or projects2.aspx if ((Request.QueryString["source_page"] == "projects.aspx") || (Request.QueryString["source_page"] == "projects2.aspx")) { // Restore navigator state RestoreNavigatorState(); // Restore data projectNavigatorTDS = (ProjectNavigatorTDS)Session["lfsProjectNavigatorTDS"]; projectNavigator = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; // Store data Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; //... for the total rows if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count; lblTotalRows.Visible = true; } else { lblTotalRows.Visible = false; } } // ... project_summary.aspx, project_edit.aspx, project_sections_navigator.aspx or project_sections_navigator2.aspx if ((Request.QueryString["source_page"] == "project_summary.aspx") || (Request.QueryString["source_page"] == "project_edit.aspx") || (Request.QueryString["source_page"] == "project_sections_navigator.aspx") || (Request.QueryString["source_page"] == "project_sections_navigator2.aspx") || (Request.QueryString["source_page"] == "project_costing_sheets_navigator.aspx")) { // Restore navigator state RestoreNavigatorState(); if (Request.QueryString["update"] == "no") { projectNavigatorTDS = (ProjectNavigatorTDS)Session["lfsProjectNavigatorTDS"]; projectNavigator = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; // Store data Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; } else { // ... Delete store data Session.Contents.Remove("lfsProjectNavigatorTDS"); // ... Search data with updates projectNavigatorTDS = SubmitSearch(); // ... store datasets Session["lfsProjectNavigatorTDS"] = projectNavigatorTDS; Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; } //... for the total rows if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count; lblTotalRows.Visible = true; } else { lblTotalRows.Visible = false; } } // ... project_delete.aspx if (Request.QueryString["source_page"] == "project_delete.aspx") { // Restore navigator state RestoreNavigatorState(); if (Request.QueryString["update"] == "no") { projectNavigatorTDS = (ProjectNavigatorTDS)Session["lfsProjectNavigatorTDS"]; projectNavigator = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; // Store data Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; } else { // ... Delete store data Session.Contents.Remove("lfsProjectNavigatorTDS"); // ... Search data with updates projectNavigatorTDS = SubmitSearch(); // ... store datasets Session["lfsProjectNavigatorTDS"] = projectNavigatorTDS; Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; } //... for the total rows if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count; lblTotalRows.Visible = true; } else { lblTotalRows.Visible = false; } // Databind if (Request.QueryString["update"] != "no") { if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count == 0) { string url = "./projects.aspx?source_page=projects2.aspx&" + GetNavigatorState() + "&no_results=no"; Response.Redirect(url); } } } // ... Store datasets Session["projectSelectProjectTDS"] = projectSelectProjectTDS; Session["projectLastUsedProjects"] = projectSelectProjectTDS.LastUsedProjects; } else { // Restore datasets projectSelectProjectTDS = (ProjectSelectProjectTDS)Session["projectSelectProjectTDS"]; // Restore searched data (if any) projectNavigatorTDS = (ProjectNavigatorTDS)Session["lfsProjectNavigatorTDS"]; projectNavigator = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; //... for the total rows if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count > 0) { lblTotalRows.Text = "Total Rows: " + projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count; } else { lblTotalRows.Visible = false; } } }
protected void btnSearch_Click(object sender, EventArgs e) { string url = ""; // Delete store data Session.Contents.Remove("lfsProjectNavigatorTDS"); Session.Contents.Remove("projectNavigator"); // Get data from DA gateway projectNavigatorTDS = SubmitSearch(); // Show results if (projectNavigatorTDS.LFS_PROJECT_NAVIGATOR.Rows.Count > 0) { // ... Store data Session["lfsProjectNavigatorTDS"] = projectNavigatorTDS; Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR; // ... Go to the results page url = "./projects2.aspx?source_page=projects2.aspx&" + GetNavigatorState(); } else { // ... Go to the search page url = "./projects.aspx?source_page=projects2.aspx&" + GetNavigatorState() + "&no_results=yes"; } Response.Redirect(url); }