public ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable GetJobClassClassificationNew() { projectJobClassClassification = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassificationDummy"]; if (projectJobClassClassification == null) { projectJobClassClassification = ((ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassification"]); } return projectJobClassClassification; }
//protected void AddNotesNewEmptyFix(GridView grdView) //{ // if (grdNotes.Rows.Count == 0) // { // int companyId = Int32.Parse(hdfCompanyId.Value); // ProjectNavigatorTDS.ProjectNotesDataTable dt = new ProjectNavigatorTDS.ProjectNotesDataTable(); // dt.AddProjectNotesRow(-1, -1, "", DateTime.Now, -1, "", false, -1, companyId, "", "", false); // Session["projectNotesDummy"] = dt; // grdNotes.DataBind(); // } // // Normally executes at all postbacks // if (grdNotes.Rows.Count == 1) // { // ProjectNavigatorTDS.ProjectNotesDataTable dt = (ProjectNavigatorTDS.ProjectNotesDataTable)Session["projectNotesDummy"]; // if (dt != null) // { // grdNotes.Rows[0].Visible = false; // grdNotes.Rows[0].Controls.Clear(); // } // } //} //protected void AddServicesNewEmptyFix(GridView grdView) //{ // if (grdView.Rows.Count == 0) // { // int companyId = Int32.Parse(hdfCompanyId.Value); // ProjectNavigatorTDS.ProjectServiceDataTable dt = new ProjectNavigatorTDS.ProjectServiceDataTable(); // dt.AddProjectServiceRow(-1, -1, -1, "", "", -1, -1, false, companyId, false, -1); // Session["projectServicesDummy"] = dt; // grdView.DataBind(); // } // // Normally executes at all postbacks // if (grdView.Rows.Count == 1) // { // ProjectNavigatorTDS.ProjectServiceDataTable dt = (ProjectNavigatorTDS.ProjectServiceDataTable)Session["projectServicesDummy"]; // if (dt != null) // { // grdView.Rows[0].Visible = false; // grdView.Rows[0].Controls.Clear(); // } // } //} protected void AddJobClassClassificationNewEmptyFix(GridView grdView) { if (grdJobClassClassification.Rows.Count == 0) { int companyId = Int32.Parse(hdfCompanyId.Value); ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable dt = new ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable(); dt.AddLFS_PROJECT_JOB_CLASS_TYPE_RATERow(-1, "", 0, 0, false, companyId, false, 0); Session["projectJobClassClassificationDummy"] = dt; grdJobClassClassification.DataBind(); } // Normally executes at all postbacks if (grdJobClassClassification.Rows.Count == 1) { ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable dt = (ProjectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATEDataTable)Session["projectJobClassClassificationDummy"]; if (dt != null) { grdJobClassClassification.Rows[0].Visible = false; grdJobClassClassification.Rows[0].Controls.Clear(); } } }
//private void GrdNotesDeleteAttachment(int libraryFileId, int refId) //{ // // Button delete functionality // if (libraryFileId != 0) // { // ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS); // projectNavigatorProjectNotes.UpdateLibraryFilesId(int.Parse(hdfProjectId.Value), refId, null, "", ""); // LibraryFilesGateway libraryFilesGateway = new LibraryFilesGateway(libraryTDS); // libraryFilesGateway.DeleteByLibraryFilesId(libraryFileId); // ViewState["update"] = "no"; // Session["lfsProjectTDS"] = projectTDS; // Session["projectNavigatorTDS"] = projectNavigatorTDS; // projectNotes = projectNavigatorTDS.ProjectNotes; // Session["projectNotes"] = projectNavigatorTDS.ProjectNotes; // Session["lfsLibraryTDS"] = libraryTDS; //grdNotes.DataBind(); // } //} //private void GrdNotesOpenAttachment(string originalFileName, string fileName) //{ // // Button download functionality // if ((originalFileName != "") && (fileName != "")) // { // // Escape single quote // originalFileName = originalFileName.Replace("'", "%27"); // fileName = fileName.Replace("'", "%27"); // string script = "<script language='javascript'>"; // string url = "./project_download_attachment.aspx?original_filename=" + Server.UrlEncode(originalFileName) + "&filename=" + Server.UrlEncode(fileName); // script = script + string.Format("window.open('{0}', '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=0, height=0')", url); // script = script + "</script>"; // ScriptManager.RegisterStartupScript(this, this.GetType(), "DownloadAttachment", script, false); // } //} //private void GrdNotesAddAttachment(int? refId, string subject) //{ // Save2(); // // Escape single quote // subject = subject.Replace("'", "%27"); // if (refId.HasValue) // { // if (ViewState["libraryCategoriesId"] != null) // { // string script = "<script language='javascript'>"; // string url = "./project_add_attachment.aspx?source_page=project_notes.aspx&subject=" + Server.UrlEncode(subject) + "&refId=" + refId.ToString() + "&project_id=" + hdfProjectId.Value + "&library_categories_id=" + Int32.Parse(ViewState["libraryCategoriesId"].ToString()) + "&data_changed=" + hdfDataChanged.Value; // script = script + string.Format("window.open('{0}', '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=510, height=270')", url); // script = script + "</script>"; // ScriptManager.RegisterStartupScript(this, this.GetType(), "Notes", script, false); // } // } // else // { // ProjectNavigatorProjectNotes model = new ProjectNavigatorProjectNotes(projectNavigatorTDS); // refId = model.GetLastRefId(); // if (ViewState["libraryCategoriesId"] != null) // { // string script = "<script language='javascript'>"; // string url = "./project_add_attachment.aspx?source_page=project_notes.aspx&subject=" + Server.UrlEncode(subject) + "&refId=" + refId.ToString() + "&project_id=" + hdfProjectId.Value + "&library_categories_id=" + Int32.Parse(ViewState["libraryCategoriesId"].ToString()) + "&data_changed=" + hdfDataChanged.Value; // script = script + string.Format("window.open('{0}', '_blank', 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=510, height=270')", url); // script = script + "</script>"; // ScriptManager.RegisterStartupScript(this, this.GetType(), "Notes", script, false); // } // } //} //private void GrdNotesAdd() //{ // if (ValidateNotesFooter()) // { // Page.Validate("notesDataAdd"); // if (Page.IsValid) // { // int companyId = Int32.Parse(hdfCompanyId.Value); // int projectId = Int32.Parse(hdfProjectId.Value); // string newSubject = ((TextBox)grdNotes.FooterRow.FindControl("tbxNoteSubjectNew")).Text.Trim(); // int loginId = Convert.ToInt32(Session["loginID"]); // DateTime dateTime = DateTime.Now; // string newNote = ((TextBox)grdNotes.FooterRow.FindControl("tbxNoteNoteNew")).Text.Trim(); // bool deleted = false; // bool inNoteDatabase = false; // int? libraryFilesId = null; // string fileName = ((Label)grdNotes.FooterRow.FindControl("lblFileNameNoteAttachmentNew")).Text.Trim(); // if (fileName != "") // { // LibraryFilesGateway libraryFilesGateway = new LibraryFilesGateway(); // libraryFilesId = libraryFilesGateway.GetlibraryFilesId(fileName); // } // ProjectNavigatorProjectNotes model = new ProjectNavigatorProjectNotes(projectNavigatorTDS); // model.Insert(projectId, newSubject, dateTime, loginId, newNote, deleted, libraryFilesId, companyId, inNoteDatabase); // Session.Remove("projectNotesDummy"); // Session["projectNavigatorTDS"] = projectNavigatorTDS; // grdNotes.DataBind(); // grdNotes.PageIndex = grdNotes.PageCount - 1; // } // } //} private void GrdJobClassClassificationAdd() { Page.Validate("jobClassClassificationDataAdd"); if (Page.IsValid) { int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(hdfProjectId.Value); string jobClassType = ((DropDownList)grdJobClassClassification.FooterRow.FindControl("ddlJobClassNew")).SelectedValue; decimal rate = decimal.Parse(((TextBox)grdJobClassClassification.FooterRow.FindControl("tbxRateNew")).Text); decimal fringeRate = decimal.Parse(((TextBox)grdJobClassClassification.FooterRow.FindControl("tbxFringeRateNew")).Text); ProjectNavigatorProjectJobClassTypeRate model = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); model.Insert(projectId, jobClassType, rate, false, companyId, false, fringeRate); Session.Remove("projectJobClassClassificationDummy"); Session["projectNavigatorTDS"] = projectNavigatorTDS; projectJobClassClassification = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectJobClassClassification"] = projectJobClassClassification; grdJobClassClassification.DataBind(); } }
// //////////////////////////////////////////////////////////////////////// // 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 grdNotes_RowUpdating(object sender, GridViewUpdateEventArgs e) //{ // Page.Validate("notesDataEdit"); // if (Page.IsValid) // { // int companyId = Int32.Parse(hdfCompanyId.Value); // int projectId = Int32.Parse(((Label)grdNotes.Rows[e.RowIndex].Cells[0].FindControl("lblProjectIDEdit")).Text.Trim()); // int refId = Int32.Parse(((Label)grdNotes.Rows[e.RowIndex].Cells[1].FindControl("lblRefIDEdit")).Text.Trim()); // string subject = ((TextBox)grdNotes.Rows[e.RowIndex].Cells[4].FindControl("tbxNoteSubjectEdit")).Text.Trim(); // string note = ((TextBox)grdNotes.Rows[e.RowIndex].Cells[5].FindControl("tbxNoteNoteEdit")).Text.Trim(); // int? libraryFilesId = null; // if (((Label)grdNotes.Rows[e.RowIndex].Cells[3].FindControl("lblLibraryFileIdEdit")).Text.Trim() != "") // { // libraryFilesId = Int32.Parse(((Label)grdNotes.Rows[e.RowIndex].Cells[3].FindControl("lblLibraryFileIdEdit")).Text.Trim()); // } // // Update data // ProjectNavigatorProjectNotes model = new ProjectNavigatorProjectNotes(projectNavigatorTDS); // model.Update(projectId, refId, subject, note, libraryFilesId); // // Store dataset // Session["projectNavigatorTDS"] = projectNavigatorTDS; // } // else // { // e.Cancel = true; // } //} //protected void grdServices_RowUpdating(object sender, GridViewUpdateEventArgs e) //{ // Page.Validate("serviceDataEdit"); // if (Page.IsValid) // { // int companyId = Int32.Parse(hdfCompanyId.Value); // int projectId = Int32.Parse(((Label)grdServices.Rows[e.RowIndex].Cells[0].FindControl("lblProjectID")).Text.Trim()); // int refId = Int32.Parse(((Label)grdServices.Rows[e.RowIndex].Cells[1].FindControl("lblRefID")).Text.Trim()); // int? serviceId = null; // if (((DropDownList)grdServices.Rows[e.RowIndex].Cells[2].FindControl("ddlServiceEdit")).SelectedValue != "-1") // { // serviceId = int.Parse(((DropDownList)grdServices.Rows[e.RowIndex].Cells[2].FindControl("ddlServiceEdit")).SelectedValue); // } // string description = ((TextBox)grdServices.Rows[e.RowIndex].Cells[3].FindControl("tbxDescriptionEdit")).Text.Trim(); // int quantity = 0; // if (((TextBox)grdServices.Rows[e.RowIndex].Cells[4].FindControl("tbxQuantityEdit")).Text.Trim() != "") // { // quantity = int.Parse(((TextBox)grdServices.Rows[e.RowIndex].Cells[4].FindControl("tbxQuantityEdit")).Text.Trim()); // } // string averageSize = ((TextBox)grdServices.Rows[e.RowIndex].Cells[5].FindControl("tbxAverageSizeEdit")).Text.Trim(); // decimal? averagePrice = 0.00M; // decimal total = 0.00M; // if (((TextBox)grdServices.Rows[e.RowIndex].Cells[6].FindControl("tbxAveragePriceEdit")).Text.Trim() != "") // { // averagePrice = decimal.Parse(((TextBox)grdServices.Rows[e.RowIndex].Cells[6].FindControl("tbxAveragePriceEdit")).Text.Trim()); // total = decimal.Round(((decimal)averagePrice * quantity), 2); // } // // Update data // ProjectNavigatorProjectService model = new ProjectNavigatorProjectService(projectNavigatorTDS); // model.Update(projectId, refId, serviceId, description, averageSize, averagePrice, quantity, total); // // Store dataset // Session["projectNavigatorTDS"] = projectNavigatorTDS; // // ... Recalc total cost // tbxTotalCost.Text = Decimal.Round(model.GetTotalCost(), 2).ToString(); // } // else // { // e.Cancel = true; // } //} protected void grdJobClassClassification_RowUpdating(object sender, GridViewUpdateEventArgs e) { Page.Validate("jobClassClassificationDataEdit"); if (Page.IsValid) { int companyId = Int32.Parse(hdfCompanyId.Value); int projectId = Int32.Parse(((Label)grdJobClassClassification.Rows[e.RowIndex].Cells[0].FindControl("lblProjectIDEdit")).Text.Trim()); string jobClassType = ((Label)grdJobClassClassification.Rows[e.RowIndex].Cells[0].FindControl("lblJobClassTypeEdit")).Text.Trim(); int refId = Int32.Parse(((Label)grdJobClassClassification.Rows[e.RowIndex].Cells[1].FindControl("lblRefIDEdit")).Text.Trim()); decimal rate = Decimal.Parse(((TextBox)grdJobClassClassification.Rows[e.RowIndex].Cells[1].FindControl("tbxRateEdit")).Text.Trim()); decimal fringeRate = Decimal.Parse(((TextBox)grdJobClassClassification.Rows[e.RowIndex].Cells[1].FindControl("tbxFringeRateEdit")).Text.Trim()); // Update data ProjectNavigatorProjectJobClassTypeRate model = new ProjectNavigatorProjectJobClassTypeRate(projectNavigatorTDS); model.Update(projectId, jobClassType, refId, rate, fringeRate); projectJobClassClassification = projectNavigatorTDS.LFS_PROJECT_JOB_CLASS_TYPE_RATE; Session["projectJobClassClassification"] = projectJobClassClassification; // Store dataset Session["projectNavigatorTDS"] = projectNavigatorTDS; } else { e.Cancel = true; } }