Exemplo n.º 1
0
        private void LoadPeriodicReportsList()
        {
            if ((Username == null) || (Username == ""))
            {
                UserType userType = UserContext.UserData.UserType;
                if (userType == UserType.SaltAdmin)
                {
                    PeriodicReportsGrid.DataSourceID = "ReportDataSource";
                }
                else if (userType == UserType.UnitAdmin || userType == UserType.OrgAdmin)
                {
                    DataTable dtUser = new User().GetUser(UserContext.UserID);
                    Username = dtUser.Rows[0]["Username"].ToString();
                }
            }

            if ((Username != null) && (Username.Length > 0))
            {
                PeriodicReportsGrid.DataSourceID = "ReportUserDataSource";
                ReportUserDataSource.SelectParameters["Username"].DefaultValue = Username;
            }

            PeriodicReportsGrid.DataBind();

            if (PeriodicReportsGrid.Rows.Count == 0)
            {
                lblNoneFound.Visible     = true;
                ExportTypes.Visible      = false;
                btnExport.Visible        = false;
                SelectAll.Visible        = false;
                ClearAll.Visible         = false;
                DeleteSelected.Visible   = false;
                ReassignSelected.Visible = false;
                ExportType2.Visible      = false;
                btnExport2.Visible       = false;
            }
            else
            {
                lblNoneFound.Visible     = false;
                ExportTypes.Visible      = true;
                btnExport.Visible        = true;
                SelectAll.Visible        = true;
                ClearAll.Visible         = true;
                DeleteSelected.Visible   = true;
                ReassignSelected.Visible = true;
                ExportType2.Visible      = true;
                btnExport2.Visible       = true;
            }

            if (UserContext.UserData.UserType == UserType.UnitAdmin)
            {
                // hide admin type column
                PeriodicReportsGrid.Columns[12].Visible = false;
            }
        }