示例#1
0
        protected void menuFilter_MenuItemClick(object sender, MenuEventArgs e)
        {
            MenuItem item = (MenuItem)e.Item;

            if (item.ValuePath.StartsWith("Organization"))
            {
                ProjectManagementDa projDA = new ProjectManagementDa();
                ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsByOrgId(Int32.Parse(item.Value)), "Organization");
            }
            else if (item.ValuePath.StartsWith("Protocols"))
            {
                ProjectManagementDa projDA = new ProjectManagementDa();
                ContactsGrid.DataSource = CombineRows(projDA.GetAllContactsByProtocol(Int32.Parse(item.Value)), "Organization");
            }

            ContactsGrid.DataBind();
        }
示例#2
0
        private void LoadContactsGrid()
        {
            ProjectManagementDa projDA             = new ProjectManagementDa();
            DataTable           contactsDataSource = new DataTable();

            string     filterBy   = Request.QueryString["FilterBy"];
            ContactsDa contactsDa = new ContactsDa();

            if (isAdmin)
            {
                contactsDataSource = contactsDa.GetAllContacts();
            }
            else if (string.IsNullOrEmpty(filterBy))
            {
                if (contactType == "Project")
                {
                    contactsDataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(projectId), "Organization");
                }
                else
                {
                    if (!string.IsNullOrEmpty(contactType))
                    {
                        contactsDataSource = contactsDa.GetContactByContactType(contactType);
                    }
                }
            }
            else
            {
                switch (filterBy)
                {
                case ("Organization"):
                    contactsDataSource = CombineRows(projDA.GetAllContactsByOrgId(Int32.Parse(Request.QueryString["FilterID"])), "Organization");
                    break;

                case ("Protocols"):
                    contactsDataSource = CombineRows(projDA.GetAllContactsByProtocol(Int32.Parse(Request.QueryString["FilterID"])), "Organization");
                    break;

                case ("Projects"):
                    contactsDataSource = CombineRows(projDA.GetAllContactsWithOrgNameByProjectId(Int32.Parse(Request.QueryString["FilterID"])), "Organization");
                    break;

                default:
                    break;
                }
            }

            // Bind grid to datasource
            ContactsGrid.DataSource = contactsDataSource;
            ContactsGrid.DataBind();

            // Determine if there are any records and show message
            if (contactsDataSource.Rows.Count == 0)
            {
                EmptyMessageLabel.Visible = true;
            }
            else
            {
                EmptyMessageLabel.Visible = false;
            }
        }