Пример #1
0
        /// <summary>
        /// GetNextId
        /// </summary>
        /// <param name="projectSelectProjectTDS">projectSelectProjectTDS</param>
        /// <param name="currentProjectId">currentProjectId</param>
        /// <returns>nextProjectId</returns>
        public static int GetNextId2(ProjectSelectProjectTDS projectSelectProjectTDS, int currentProjectId)
        {
            int nextProjectId = currentProjectId;

            for (int i = 0; i < projectSelectProjectTDS.LastUsedProjects.DefaultView.Count; i++)
            {
                if ((int)projectSelectProjectTDS.LastUsedProjects.DefaultView[i]["ProjectID"] == currentProjectId)
                {
                    if (i == projectSelectProjectTDS.LastUsedProjects.DefaultView.Count - 1)
                    {
                        nextProjectId = currentProjectId;
                    }
                    else
                    {
                        nextProjectId = (int)projectSelectProjectTDS.LastUsedProjects.DefaultView[i + 1]["ProjectID"];
                    }
                    break;
                }
            }

            return nextProjectId;
        }
 /// <summary>
 /// InitData. 
 /// </summary>
 protected override void InitData()
 {
     _data = new ProjectSelectProjectTDS();
 }
Пример #3
0
        // ////////////////////////////////////////////////////////////////////////
        // 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;
                }
            }
        }
Пример #4
0
        /// <summary>
        /// GetPreviousId
        /// </summary>
        /// <param name="projectSelectProjectTDS">projectSelectProjectTDS</param>
        /// <param name="currentProjectId">currentProjectId</param>
        /// <returns>prevProjectId</returns>
        public static int GetPreviousId2(ProjectSelectProjectTDS projectSelectProjectTDS, int currentProjectId)
        {
            int prevProjectId = currentProjectId;

            for (int i = 0; i < projectSelectProjectTDS.LastUsedProjects.DefaultView.Count; i++)
            {
                if ((int)projectSelectProjectTDS.LastUsedProjects.DefaultView[i]["ProjectID"] == currentProjectId)
                {
                    if (i == 0)
                    {
                        prevProjectId = currentProjectId;
                    }
                    else
                    {
                        prevProjectId = (int)projectSelectProjectTDS.LastUsedProjects.DefaultView[i - 1]["ProjectID"];
                    }

                    break;
                }
            }

            return prevProjectId;
        }
Пример #5
0
        // ////////////////////////////////////////////////////////////////////////
        // EVENTS
        //
        protected void Page_Load(object sender, EventArgs e)
        {
            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.");
                }

                // 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;
                }

                // Validate query string
                if ((string)Request.QueryString["source_page"] == null)
                {
                    Response.Redirect("./../../error_page.aspx?error=" + "Invalid query string in projects.aspx");
                }

                // Prepare initial data
                hdfLoginId.Value = Convert.ToInt32(Session["loginID"]).ToString();
                hdfCompanyId.Value = Session["companyID"].ToString();
                Session.Remove("lastUsedProjectsDummy");
                Session.Remove("lfsProjectNavigatorTDS");
                Session.Remove("lfsLibraryTDS");
                Session.Remove("fromAttachment");

                Session["activeTabProjects"] = "0";
                Session["dialogOpenedProjects"] = "0";

                // If coming from
                projectSelectProjectTDS = new ProjectSelectProjectTDS();
                ProjectSelectProjectLastUsedProjectsGateway projectSelectProjectLastUsedProjectsGateway = new ProjectSelectProjectLastUsedProjectsGateway(projectSelectProjectTDS);
                projectSelectProjectLastUsedProjectsGateway.LoadByLoginId(Int32.Parse(hdfLoginId.Value), Int32.Parse(hdfCompanyId.Value));

                // ... Left Menu or Out
                if ((Request.QueryString["source_page"] == "lm") || (Request.QueryString["source_page"] == "out"))
                {
                    //tdNoResults.Visible = false;
                    tNoResults.Visible = false;
                    pNoResults.Visible = false;
                }

                // ... projects2.aspx
                if (Request.QueryString["source_page"] == "projects2.aspx")
                {
                    RestoreNavigatorState();
                    if ((string)Request.QueryString["no_results"] == "yes")
                    {
                        tNoResults.Visible = true;
                        pNoResults.Visible = true;
                    }
                    else
                    {
                        tNoResults.Visible = false;
                        pNoResults.Visible = false;

                        if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
                        {
                            ddlProjectType.SelectedIndex = 0;
                            ddlProjectState.SelectedIndex = 0;
                        }
                        else
                        {
                            ddlProjectTypeAdmin.SelectedIndex = 0;
                            ddlProjectStateAdmin.SelectedIndex = 0;
                        }
                    }
                }

                // ... Store datasets
                Session["projectSelectProjectTDS"] = projectSelectProjectTDS;
                Session["projectLastUsedProjects"] = projectSelectProjectTDS.LastUsedProjects;
            }
            else
            {
                // Restore datasets
                projectSelectProjectTDS = (ProjectSelectProjectTDS)Session["projectSelectProjectTDS"];
            }
        }