private void UpdateDatabase()
        {
            try
            {
                ProjectGateway projectGateway = new ProjectGateway(projectTDS);
                projectGateway.Update3();

                projectTDS.AcceptChanges();

                // Save notes
                int companyId = Int32.Parse(Session["companyID"].ToString());
                ProjectNavigatorGateway projectNavigatorGateway = new ProjectNavigatorGateway(projectNavigatorTDS);

                ProjectNavigatorProjectNotes projectNavigatorProjectNotes = new ProjectNavigatorProjectNotes(projectNavigatorTDS);
                projectNavigatorProjectNotes.Save(companyId);

                Session["lfsProjectTDS"] = projectTDS;
                Session["projectNavigatorTDS"] = projectNavigatorTDS;
                Session["lfsLibraryTDS"] = libraryTDS;
            }
            catch (Exception ex)
            {
                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }
        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);
            }
        }
        private void UpdateDatabase()
        {
            try
            {
                ProjectGateway projectGateway = new ProjectGateway(projectTDS);
                projectGateway.Update3();

                projectTDS.AcceptChanges();
            }
            catch (Exception ex)
            {
                string url = string.Format("./../../error_page.aspx?error={0}", ex.Message.Replace('\n', ' '));
                Response.Redirect(url);
            }
        }