Esempio n. 1
0
        /// <summary>
        /// Binds To and From Selects to show available and selected Contacts
        /// </summary>
        protected void BindContactsData()
        {
            ProjectManagementDa da = new ProjectManagementDa();

            unassociatedContact = da.GetAllUnassignedContacts(projectId).DefaultView;
            associatedContacts  = da.GetProjectContactsByProjectId(projectId).DefaultView;

            FromContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView;
            FromContactsOrgRptr.DataBind();

            ToContactsOrgRptr.DataSource = da.GetProjectOrganizationsByProjectId(projectId).DefaultView;
            ToContactsOrgRptr.DataBind();
        }
Esempio n. 2
0
        /// <summary>
        /// Read paramaters off query string and determine context
        /// </summary>
        private void SetUserPermissions()
        {
            if (PermissionManager.HasPermission(PermissionManager.AdminProjectModule) || PermissionManager.HasPermission(PermissionManager.EditSecurity))
            {
                _userType = ProjectMgmtUsers.ModuleAdmin;
            }
            else if (PermissionManager.HasPermission(PermissionManager.AdminProject))
            {
                SecurityController sc       = new SecurityController();
                string             userName = sc.GetUserName();

                // If working with a Project, determine if user is part of project
                if (!string.IsNullOrEmpty(ProjectId))
                {
                    UserDa userDa = new UserDa();
                    int    userId = userDa.GetUserId(userName);

                    ProjectManagementDa projectDa         = new ProjectManagementDa();
                    DataTable           contactsInProject = projectDa.GetProjectContactsByProjectId(int.Parse(ProjectId));
                    string userInProjectQuery             = Contact.UserId + " IS NOT NULL AND " + Contact.UserId + " = " + userId;

                    // Query contacts in project to see if user is associated with this Project
                    if (contactsInProject.Select(userInProjectQuery).Length > 0)
                    {
                        _userType = ProjectMgmtUsers.ProjectAdmin;
                    }
                    // User permissions for this project defaults to regular user
                    else
                    {
                        _userType = ProjectMgmtUsers.ProjectUser;
                    }
                }
                // If not working in project, user will have normal access to normal
                //ProjectAdmin Administrative functions
                else
                {
                    _userType = ProjectMgmtUsers.ProjectAdmin;
                }
            }
            else if (PermissionManager.HasPermission(PermissionManager.UpdateProject))
            {
                _userType = ProjectMgmtUsers.ProjectUser;
            }
        }
Esempio n. 3
0
        protected void OnContactsOrgBind(object sender, RepeaterItemEventArgs e)
        {
            Repeater contactsRptr       = sender as Repeater;
            Repeater singleContactsRptr = e.Item.FindControl("SingleContactsRptr") as Repeater;

            if (singleContactsRptr != null)
            {
                int orgId = int.Parse(DataBinder.Eval(e.Item.DataItem, ProjectOrganization.OrganizationId).ToString());
                ProjectManagementDa da = new ProjectManagementDa();

                DataView view;

                List <string> associatedContacts = new List <string>();
                DataTable     tmp = da.GetAllContactsByOrgId(orgId);
                if (tmp.Rows.Count > 0)
                {
                    foreach (DataRow row in tmp.Rows)
                    {
                        string contactId = row[Contact.ContactId].ToString();
                        associatedContacts.Add(contactId);
                    }
                    view = da.GetProjectContactsByProjectId(projectId).DefaultView;
                    string uniqueContacts = String.Join(",", associatedContacts.ToArray());
                    string rowFilter      = "ContactId IN (" + uniqueContacts + ")";
                    view.RowFilter = rowFilter;
                    if (view.Table.Select(rowFilter).Length == 0)
                    {
                        e.Item.Visible = false;
                    }
                }
                else
                {
                    e.Item.Visible = false;
                    return;
                }



                singleContactsRptr.DataSource = view;
                singleContactsRptr.DataBind();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Binds the various summary info grids
        /// </summary>
        /// <param name="projectId"></param>
        protected void BindGrids(int projectId)
        {
            ProjectManagementDa da = new ProjectManagementDa();

            OrganizationsGrid.DataSource = da.GetAllOrganizationsSortedByProjectId(projectId);
            OrganizationsGrid.DataBind();

            ContactsGrid.DataSource = da.GetProjectContactsByProjectId(projectId);
            ContactsGrid.DataBind();

            //BusinessObject.ProjectManuscript bizMan = new BusinessObject.ProjectManuscript();
            //bizMan.GetByParent(projectId);
            //ManuscriptGrid.DataSource = bizMan.DataSourceView;
            ManuscriptGrid.DataSource = BusinessObject.GetByParentAsDataView <BOL.ProjectManuscript>(projectId);
            ManuscriptGrid.DataBind();

            //ProjectFundingSource biz = new ProjectFundingSource();
            //biz.GetByParent(projectId);
            //FundingGrid.DataSource = biz.DataSourceView;
            FundingGrid.DataSource = BusinessObject.GetByParentAsDataView <ProjectFundingSource>(projectId);
            FundingGrid.DataBind();
        }