protected int SaveSelectedProjectId()
        {
            int projectIdForUpdate = 0;
            int clientIdForUpdate = 0;
            bool selected = false;
            hdfSelectedProjectId.Value = "0";
            int countOfSelectedProjects = 0;
            ArrayList projectsSelected = new ArrayList();

            ProjectNavigator projectNavigatorForUpdate = new ProjectNavigator(projectNavigatorTDS);

            foreach (GridViewRow row in grdNavigator.Rows)
            {
                // ... Update all rows
                selected = ((CheckBox)row.FindControl("cbxSelected")).Checked;
                projectIdForUpdate = Int32.Parse(((Label)row.FindControl("lblProjectID")).Text.Trim());
                clientIdForUpdate = Int32.Parse(((Label)row.FindControl("lblClientID")).Text.Trim());
                projectNavigatorForUpdate.Update(projectIdForUpdate, selected);

                // ... Save selected project
                if (selected)
                {
                    hdfSelectedProjectId.Value = projectIdForUpdate.ToString();
                    hdfSelectedClientId.Value = clientIdForUpdate.ToString();
                    countOfSelectedProjects++;

                    if (!projectsSelected.Contains(projectIdForUpdate))
                    {
                        projectsSelected.Add(projectIdForUpdate);
                    }
                }
            }
            projectNavigatorForUpdate.Data.AcceptChanges();

            // ... Store datasets
            Session["projectNavigator"] = projectNavigatorTDS.LFS_PROJECT_NAVIGATOR;
            Session["projectsSelected"] = projectsSelected;

            return countOfSelectedProjects;
        }
        private bool StepProposalsFinish()
        {
            // Proposal election check
            if (grdProposals.Rows.Count > 0)
            {
                int projectId = 0;

                ProjectNavigator model = new ProjectNavigator(duplicateProjectNavigatorTDS);
                foreach (GridViewRow row in grdProposals.Rows)
                {
                    int projectIdForUpdate = Int32.Parse(((Label)row.FindControl("lblProjectID")).Text.Trim());
                    bool selected = ((CheckBox)row.FindControl("cbxSelected")).Checked;
                    if (selected)
                    {
                        projectId = projectIdForUpdate;
                    }

                    model.Update(projectIdForUpdate, selected);
                }
                model.Data.AcceptChanges();

                // ... Store datasets
                Session["duplicateProjectNavigatorTDS"] = duplicateProjectNavigatorTDS;

                if (projectId == 0)
                {
                    lblError.Visible = true;
                    lblError.Text = "At least one proposal must be selected";
                    return false;
                }
                else
                {
                    PostPageChanges(projectId);
                    UpdateDatabase();
                    return true;
                }
            }
            else
            {
                lblError.Visible = true;
                lblError.Text = "Proposal unavailable";
                return false;
            }
        }
        private ProjectNavigatorTDS SubmitSearch()
        {
            // Retrive parameters
            string projectNumber = tbxProjectNumber.Text.Trim();
            string name = tbxName.Text.Trim();
            string client = tbxClient.Text.Trim();
            string projectType = "";
            string projectState = "";
            string country = "";

            if (!Convert.ToBoolean(Session["sgLFS_PROJECTS_ADMIN"]))
            {
                projectType = ddlProjectType.SelectedItem.Value.ToString();
                projectState = ddlProjectState.SelectedItem.Value.ToString();
            }
            else
            {
                projectType = ddlProjectTypeAdmin.SelectedItem.Value.ToString();
                projectState = ddlProjectStateAdmin.SelectedItem.Value.ToString();
            }

            if (ddlCountry.SelectedIndex > 0)
            {
                country = ddlCountry.SelectedValue;
            }

            // Load data
            ProjectNavigatorGateway projectNavigatorGateway = new ProjectNavigatorGateway();
            projectNavigatorGateway.LoadByProjectNumberNameClientProjectTypeProjectStateCountry(projectNumber, name, client, projectType, projectState, country);

            ProjectNavigator projectNavigator = new ProjectNavigator(projectNavigatorGateway.Data);
            hdfProjectId.Value = projectNavigator.GetProjectId().ToString();

            return (ProjectNavigatorTDS) projectNavigatorGateway.Data;
        }