/// -----------------------------------------------------------------------------
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	03/13/2006  Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public override void DataBind()
        {
            if (Request.IsAuthenticated)
            {
                RoleController roleController = new RoleController();
                grdServices.DataSource = roleController.GetUserRoles(UserInfo, false);
                grdServices.DataBind();

                //if no service available then hide options
                ServicesRow.Visible = (grdServices.Items.Count > 0);
            }
        }
        /// <summary>
        /// DataBind binds the data to the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	03/13/2006  Created
        /// </history>
        public override void DataBind()
        {
            if( Services == 1 )
            {
                RoleController objRoles = new RoleController();
                grdServices.DataSource = objRoles.GetUserRoles( PortalId );
                grdServices.DataBind();

                if( grdServices.Items.Count != 0 )
                {
                    lblServices.Text = string.Format( Localization.GetString( "PleaseRegister", this.LocalResourceFile ), Globals.GetPortalDomainName( PortalAlias.HTTPAlias, Request, true ) + "/" + Globals.glbDefaultPage, TabId );
                }
                else
                {
                    grdServices.Visible = false;
                    lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
                }
                lblServices.Visible = true;

                grdServices.Columns[0].Visible = false; // subscribe
                grdServices.Columns[9].Visible = false; // expiry date
            }
            else
            {
                if( Request.IsAuthenticated )
                {
                    RoleController objRoles = new RoleController();

                    grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID, false );
                    grdServices.DataBind();

                    // if no service available then hide options
                    //ServicesRow.Visible = (grdServices.Items.Count > 0)
                }
            }
        }
        private IList<UserRoleInfo> GetPagedDataSource()
        {
            var objRoleController = new RoleController();
            var roleName = RoleId != Null.NullInteger ? Role.RoleName : Null.NullString;
            var userName = UserId != Null.NullInteger ? User.Username : Null.NullString;

            var userList = objRoleController.GetUserRoles(PortalId, userName, roleName);
            _totalRecords = userList.Count;
            _totalPages = _totalRecords%PageSize == 0 ? _totalRecords/PageSize : _totalRecords/PageSize + 1;

            return userList.Skip((CurrentPage - 1 )*PageSize).Take(PageSize).ToList();
        }
Exemplo n.º 4
0
        /// -----------------------------------------------------------------------------
        /// <summary>
        ///   CreateUserNotifications creates HtmlTextUser records and optionally sends email notifications to participants in a Workflow
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <param name="objHtmlText">An HtmlTextInfo object</param>
        /// <history>
        /// </history>
        /// -----------------------------------------------------------------------------
        private void CreateUserNotifications(HtmlTextInfo objHtmlText)
        {
            var _htmlTextUserController = new HtmlTextUserController();
            HtmlTextUserInfo _htmlTextUser = null;
            UserInfo _user = null;

            // clean up old user notification records
            _htmlTextUserController.DeleteHtmlTextUsers();

            // ensure we have latest htmltext object loaded
            objHtmlText = GetHtmlText(objHtmlText.ModuleID, objHtmlText.ItemID);

            // build collection of users to notify
            var objWorkflow = new WorkflowStateController();
            var arrUsers = new ArrayList();

            // if not published
            if (objHtmlText.IsPublished == false)
            {
                arrUsers.Add(objHtmlText.CreatedByUserID); // include content owner 
            }

            // if not draft and not published
            if (objHtmlText.StateID != objWorkflow.GetFirstWorkflowStateID(objHtmlText.WorkflowID) && objHtmlText.IsPublished == false)
            {
                // get users from permissions for state
                var objRoles = new RoleController();
                foreach (WorkflowStatePermissionInfo permission in
                    WorkflowStatePermissionController.GetWorkflowStatePermissions(objHtmlText.StateID))
                {
                    if (permission.AllowAccess)
                    {
                        if (Null.IsNull(permission.UserID))
                        {
                            int roleId = permission.RoleID;
                            RoleInfo objRole = TestableRoleController.Instance.GetRole(objHtmlText.PortalID, r => r.RoleID == roleId);
                            if ((objRole != null))
                            {
                                foreach (UserRoleInfo objUserRole in objRoles.GetUserRoles(objHtmlText.PortalID, null, objRole.RoleName))
                                {
                                    if (!arrUsers.Contains(objUserRole.UserID))
                                    {
                                        arrUsers.Add(objUserRole.UserID);
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (!arrUsers.Contains(permission.UserID))
                            {
                                arrUsers.Add(permission.UserID);
                            }
                        }
                    }
                }
            }

            // process notifications
            if (arrUsers.Count > 0 || (objHtmlText.IsPublished && objHtmlText.Notify))
            {
                // get tabid from module 
                var objModules = new ModuleController();
                ModuleInfo objModule = objModules.GetModule(objHtmlText.ModuleID);

                PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
                if (objPortalSettings != null)
                {
                    string strResourceFile = string.Format("{0}/DesktopModules/{1}/{2}/{3}",
                                                           Globals.ApplicationPath,
                                                           objModule.DesktopModule.FolderName,
                                                           Localization.LocalResourceDirectory,
                                                           Localization.LocalSharedResourceFile);
                    string strSubject = Localization.GetString("NotificationSubject", strResourceFile);
                    string strBody = Localization.GetString("NotificationBody", strResourceFile);
                    strBody = strBody.Replace("[URL]", Globals.NavigateURL(objModule.TabID));
                    strBody = strBody.Replace("[STATE]", objHtmlText.StateName);

                    // process user notification collection

                    foreach (int intUserID in arrUsers)
                    {
                        // create user notification record 
                        _htmlTextUser = new HtmlTextUserInfo();
                        _htmlTextUser.ItemID = objHtmlText.ItemID;
                        _htmlTextUser.StateID = objHtmlText.StateID;
                        _htmlTextUser.ModuleID = objHtmlText.ModuleID;
                        _htmlTextUser.TabID = objModule.TabID;
                        _htmlTextUser.UserID = intUserID;
                        _htmlTextUserController.AddHtmlTextUser(_htmlTextUser);

                        // send an email notification to a user if the state indicates to do so
                        if (objHtmlText.Notify)
                        {
                            _user = UserController.GetUserById(objHtmlText.PortalID, intUserID);
                            if (_user != null)
                            {
                                AddHtmlNotification(strSubject, strBody, _user);
                            }
                        }
                    }

                    // if published and the published state specifies to notify members of the workflow
                    if (objHtmlText.IsPublished && objHtmlText.Notify)
                    {
                        // send email notification to the author
                        _user = UserController.GetUserById(objHtmlText.PortalID, objHtmlText.CreatedByUserID);
                        if (_user != null)
                        {
                            try
                            {
                                Services.Mail.Mail.SendEmail(objPortalSettings.Email, objPortalSettings.Email, strSubject, strBody);
                            }
                            catch (Exception exc)
                            {
                                Exceptions.LogException(exc);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void BindPortal(int portalId, string activeLanguage)
        {
            //Ensure localization
            DataProvider.Instance().EnsureLocalizationExists(portalId, activeLanguage);

            var portalController = new PortalController();
            var portal = portalController.GetPortal(portalId, activeLanguage);

            BindDetails(portal);

            BindMarketing(portal);

            ctlLogo.FilePath = portal.LogoFile;
            ctlLogo.FileFilter = Globals.glbImageFileTypes;
            ctlBackground.FilePath = portal.BackgroundFile;
            ctlBackground.FileFilter = Globals.glbImageFileTypes;
            ctlFavIcon.FilePath = new FavIcon(portal.PortalID).GetSettingPath();
            chkSkinWidgestEnabled.Checked = PortalController.GetPortalSettingAsBoolean("EnableSkinWidgets", portalId, true);

            BindSkins(portal);

            BindPages(portal, activeLanguage);

            lblHomeDirectory.Text = portal.HomeDirectory;

            optUserRegistration.SelectedIndex = portal.UserRegistration;

            BindPaymentProcessor(portal);

            BindUsability(portal);

            BindMessaging(portal);

            var roleController = new RoleController();
            cboAdministratorId.DataSource = roleController.GetUserRoles(portalId, null, portal.AdministratorRoleName);
            cboAdministratorId.DataBind(portal.AdministratorId.ToString());

            //PortalSettings for portal being edited
            var portalSettings = new PortalSettings(portal);

            cboTimeZone.DataBind(portalSettings.TimeZone.Id);

            if (UserInfo.IsSuperUser)
            {
                BindAliases(portal);

                BindSSLSettings(portal);

                BindHostSettings(portal);
            }

            LoadStyleSheet(portal);

            ctlAudit.Entity = portal;

            var overrideDefaultSettings = Boolean.Parse(PortalController.GetPortalSetting(ClientResourceSettings.OverrideDefaultSettingsKey, portalId, "false"));
            chkOverrideDefaultSettings.Checked = overrideDefaultSettings;
            BindClientResourceManagementUi(portal.PortalID, overrideDefaultSettings);
            ManageMinificationUi();
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// BindGrid loads the data grid from the Database
        /// </summary>
        /// <remarks>
        /// </remarks>
        /// <history>
        /// 	[cnurse]	9/10/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        /// -----------------------------------------------------------------------------
        private void BindGrid()
        {
            var objRoleController = new RoleController();

            if (RoleId != Null.NullInteger)
            {
                cmdAdd.Text = Localization.GetString("AddUser.Text", LocalResourceFile);
                grdUserRoles.DataKeyField = "UserId";
                grdUserRoles.Columns[2].Visible = false;
                grdUserRoles.DataSource = objRoleController.GetUserRoles(PortalId, null, Role.RoleName);
                grdUserRoles.DataBind();
            }
            if (UserId != -1)
            {
                cmdAdd.Text = Localization.GetString("AddRole.Text", LocalResourceFile);
                grdUserRoles.DataKeyField = "RoleId";
                grdUserRoles.Columns[1].Visible = false;
                grdUserRoles.DataSource = objRoleController.GetUserRoles(PortalId, User.Username, Null.NullString);
                grdUserRoles.DataBind();
            }
        }
Exemplo n.º 7
0
        private ArrayList GetRoles(int portalId, int userId)
        {
            var objRoles = new RoleController();

            return objRoles.GetUserRoles(portalId, userId, false);
        }
Exemplo n.º 8
0
        // Existing Tickets

        #region DisplayExistingTickets
        private void DisplayExistingTickets(HelpDesk_LastSearch objLastSearch)
        {
            string[] UsersRoles = UserInfo.Roles;
            List<int> UsersRoleIDs = new List<int>();
            string strSearchText = (objLastSearch.SearchText == null) ? "" : objLastSearch.SearchText;

            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            IQueryable<ExistingTasks> result = from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                               where HelpDesk_Tasks.PortalID == PortalId
                                               orderby HelpDesk_Tasks.CreatedDate descending
                                               select new ExistingTasks
                                               {
                                                   TaskID = HelpDesk_Tasks.TaskID,
                                                   Status = HelpDesk_Tasks.Status,
                                                   Priority = HelpDesk_Tasks.Priority,
                                                   DueDate = HelpDesk_Tasks.DueDate,
                                                   CreatedDate = HelpDesk_Tasks.CreatedDate,
                                                   Assigned = HelpDesk_Tasks.AssignedRoleID.ToString(),
                                                   Description = HelpDesk_Tasks.Description,
                                                   Requester = HelpDesk_Tasks.RequesterUserID.ToString(),
                                                   RequesterName = HelpDesk_Tasks.RequesterName
                                               };

            #region Only show users the records they should see
            // Only show users the records they should see
            if (!(UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser))
            {
                RoleController objRoleController = new RoleController();
				foreach (RoleInfo objRoleInfo in objRoleController.GetUserRoles(UserInfo, true))
                {
                    UsersRoleIDs.Add(objRoleInfo.RoleID);
                }

                result = from UsersRecords in result
                         where Convert.ToInt32(UsersRecords.Requester) == UserId ||
                         UsersRoleIDs.Contains(Convert.ToInt32(UsersRecords.Assigned))
                         select UsersRecords;
            }
            #endregion

            #region Filter Status
            // Filter Status
            if (objLastSearch.Status != null)
            {
                result = from Status in result
                         where Status.Status == objLastSearch.Status
                         select Status;
            }
            #endregion

            #region Filter Priority
            // Filter Priority
            if (objLastSearch.Priority != null)
            {
                result = from Priority in result
                         where Priority.Priority == objLastSearch.Priority
                         select Priority;
            }
            #endregion

            #region Filter Assigned
            // Filter Assigned
            if (objLastSearch.AssignedRoleID.HasValue)
            {
                if (!(objLastSearch.AssignedRoleID == -2))
                {
                    result = from Assigned in result
                             where Assigned.Assigned == objLastSearch.AssignedRoleID.ToString()
                             select Assigned;
                }
            }
            #endregion

            #region Filter DueDate
            // Filter DueDate
            if (objLastSearch.DueDate.HasValue)
            {
                result = from objDueDate in result
                         where objDueDate.DueDate > objLastSearch.DueDate
                         select objDueDate;
            }
            #endregion

            #region Filter CreatedDate
            // Filter CreatedDate
            if (objLastSearch.CreatedDate.HasValue)
            {
                result = from CreatedDate in result
                         where CreatedDate.CreatedDate > objLastSearch.CreatedDate
                         select CreatedDate;
            }
            #endregion

            #region Filter TextBox (Search)
            // Filter TextBox
            if (strSearchText.Trim().Length > 0)
            {
                result = (from Search in result
                          join details in objHelpDeskDALDataContext.HelpDesk_TaskDetails
                          on Search.TaskID equals details.TaskID into joined
                          from leftjoin in joined.DefaultIfEmpty()
                          where Search.Description.Contains(strSearchText) ||
                          Search.RequesterName.Contains(strSearchText) ||
                          Search.TaskID.ToString().Contains(strSearchText) ||
                          leftjoin.Description.Contains(strSearchText)
                          select Search).Distinct();
            }
            #endregion

            // Convert the results to a list because the query to filter the tags 
            // must be made after the preceeding query results have been pulled from the database
            List<ExistingTasks> FinalResult = result.Distinct().ToList();

            #region Filter Tags
            // Filter Tags
            if (objLastSearch.Categories != null)
            {
                char[] delimiterChars = { ',' };
                string[] ArrStrCategories = objLastSearch.Categories.Split(delimiterChars);
                // Convert the Categories selected from the Tags tree to an array of integers
                int[] ArrIntHelpDesk = Array.ConvertAll<string, int>(ArrStrCategories, new Converter<string, int>(ConvertStringToInt));

                // Perform a query that does in intersect between all the R7.HelpDesk selected and all the categories that each TaskID has
                // The number of values that match must equal the number of values that were selected in the Tags tree
                FinalResult = (from Categories in FinalResult.AsQueryable()
                               where ((from HelpDesk_TaskCategories in objHelpDeskDALDataContext.HelpDesk_TaskCategories
                                       where HelpDesk_TaskCategories.TaskID == Categories.TaskID
                                       select HelpDesk_TaskCategories.CategoryID).ToArray<int>()).Intersect(ArrIntHelpDesk).Count() == ArrIntHelpDesk.Length
                               select Categories).ToList();
            }
            #endregion

            #region Sort
            switch (SortExpression)
            {
                case "TaskID":
                case "TaskID ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.TaskID).ToList();
                    break;
                case "TaskID DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.TaskID).ToList();
                    break;
                case "Status":
                case "Status ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.Status).ToList();
                    break;
                case "Status DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.Status).ToList();
                    break;
                case "Priority":
                case "Priority ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.Priority).ToList();
                    break;
                case "Priority DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.Priority).ToList();
                    break;
                case "DueDate":
                case "DueDate ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.DueDate).ToList();
                    break;
                case "DueDate DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.DueDate).ToList();
                    break;
                case "CreatedDate":
                case "CreatedDate ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.CreatedDate).ToList();
                    break;
                case "CreatedDate DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.CreatedDate).ToList();
                    break;
                case "Assigned":
                case "Assigned ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.Assigned).ToList();
                    break;
                case "Assigned DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.Assigned).ToList();
                    break;
                case "Description":
                case "Description ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.Description).ToList();
                    break;
                case "Description DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.Description).ToList();
                    break;
                case "Requester":
                case "Requester ASC":
                    FinalResult = FinalResult.AsEnumerable().OrderBy(p => p.RequesterName).ToList();
                    break;
                case "Requester DESC":
                    FinalResult = FinalResult.AsEnumerable().OrderByDescending(p => p.RequesterName).ToList();
                    break;
            }
            #endregion

            #region Paging
            int intPageSize = (objLastSearch.PageSize != null) ? Convert.ToInt32(objLastSearch.PageSize) : Convert.ToInt32(ddlPageSize.SelectedValue);
            int intCurrentPage = (Convert.ToInt32(objLastSearch.CurrentPage) == 0) ? 1 : Convert.ToInt32(objLastSearch.CurrentPage);

            //Paging
            int intTotalPages = 1;
            int intRecords = FinalResult.Count();
            if ((intRecords > 0) && (intRecords > intPageSize))
            {
                intTotalPages = (intRecords / intPageSize);

                // If there are more records add 1 to page count
                if (intRecords % intPageSize > 0)
                {
                    intTotalPages += 1;
                }

                // If Current Page is -1 then it is intended to be set to last page
                if (intCurrentPage == -1)
                {
                    intCurrentPage = intTotalPages;
                    HelpDesk_LastSearch objHelpDesk_LastSearch = GetLastSearchCriteria();
                    objHelpDesk_LastSearch.CurrentPage = intCurrentPage;
                    SaveLastSearchCriteria(objHelpDesk_LastSearch);
                }

                // Show and hide buttons
                lnkFirst.Visible = (intCurrentPage > 1);
                lnkPrevious.Visible = (intCurrentPage > 1);
                lnkNext.Visible = (intCurrentPage != intTotalPages);
                lnkLast.Visible = (intCurrentPage != intTotalPages);
            }
            #endregion

            // If the current page is greater than the number of pages
            // reset to page one and save 
            if (intCurrentPage > intTotalPages)
            {
                intCurrentPage = 1;
                HelpDesk_LastSearch objHelpDesk_LastSearch = GetLastSearchCriteria();
                objHelpDesk_LastSearch.CurrentPage = intCurrentPage;
                SaveLastSearchCriteria(objHelpDesk_LastSearch);

                lnkPrevious.Visible = true;
            }

            // Display Records
            lvTasks.DataSource = FinalResult.Skip((intCurrentPage - 1) * intPageSize).Take(intPageSize);
            lvTasks.DataBind();

            // Display paging panel
            pnlPaging.Visible = (intTotalPages > 1);

            // Set CurrentPage
            CurrentPage = intCurrentPage.ToString();

            #region Page number list
            List<ListPage> pageList = new List<ListPage>();

            int nStartRange = intCurrentPage > 10 ? intCurrentPage - 10 : 1;
            if (intTotalPages - nStartRange < 19)
                nStartRange = intTotalPages > 19 ? intTotalPages - 19 : 1;

            for (int nPage = nStartRange; nPage < nStartRange + 20 && nPage <= intTotalPages; nPage++)
                pageList.Add(new ListPage { PageNumber = nPage });
            PagingDataList.DataSource = pageList;
            PagingDataList.DataBind();
            #endregion
        }
Exemplo n.º 9
0
        private void BindData()
        {
            LocalizeModule();

            if (ProfileTabId == Null.NullInteger)
            {
                rptGroupList.Visible = false;
                litMessage.Text = string.Format(MESSAGE_ERROR_FORMAT, GetLocalizedString("SettingsEmpty.ErrorMessage"));
                return;
            }

            if (ProfileId > Null.NullInteger)
            {
                // only show groups if this module is on a profile page

                var ctlUser = new UserController();
                var ctlRole = new RoleController();
                var oUser = ctlUser.GetUser(PortalId, ProfileId);

                // get a list of the groups that this site member is a part of
                // This does not return the groups that only belong to this user like you expect. It returns all roles.
                //var roles = ctlRole.GetUserRoles(oUser, false);
                // This overload does.
                //var roles = ctlRole.GetUserRoles(PortalId, oUser.Username, string.Empty);
                var bindableRoles = from r in ctlRole.GetUserRoles(PortalId, oUser.Username, string.Empty)
                    where r.RoleType != 0 && r.Status == RoleStatus.Approved && r.SecurityMode == SecurityMode.SocialGroup
                    select r;

                if (bindableRoles.Any())
                {

                    /*
                    // some of the possibly helpful role properties for this module
                    roles[0].CreatedByUser(PortalId);
                    roles[0].CreatedByUserID;
                    roles[0].CreatedOnDate;
                    roles[0].Description;
                    roles[0].FullName;
                    roles[0].IconFile;
                    roles[0].IsOwner;
                    roles[0].IsPublic;
                    roles[0].PhotoURL;
                    roles[0].RoleName;
                    */

                    // assign the roles to the repeater to be displayed
                    rptGroupList.DataSource = bindableRoles;
                    rptGroupList.DataBind();

                    // hide the message placeholder
                    litMessage.Visible = false;
                }
                else
                {
                    // hide the repeater
                    rptGroupList.Visible = false;

                    // there are no roles for this user
                    litMessage.Text = string.Format(MESSAGE_FORMAT, GetLocalizedString("NoRoles.ErrorMessage"));
                }
            }
            else
            {
                // send back a user-friendly message that this module cannot be used on this page
                // hide the repeater
                rptGroupList.Visible = false;

                // there are no roles for this user
                litMessage.Text = string.Format(MESSAGE_FORMAT, GetLocalizedString("WrongPage.ErrorMessage"));
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// BindData binds the data from the DB to the controls
        /// </summary>
        /// <history>
        /// 	[cnurse]	9/13/2004	Updated to reflect design changes for Help, 508 support
        ///                       and localisation
        /// </history>
        private void BindData()
        {
            ModuleController objModules = new ModuleController();

            userControl.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
            userControl.StartTabIndex = 1;
            addressUser.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
            addressUser.StartTabIndex = 9;

            if( Services == 1 )
            {
                UserRow.Visible = false;
                PasswordManagementRow.Visible = false;

                RoleController objRoles = new RoleController();
                grdServices.DataSource = objRoles.GetUserRoles( PortalId );
                grdServices.DataBind();

                if( grdServices.Items.Count != 0 )
                {
                    lblServices.Text = string.Format(Localization.GetString("PleaseRegister", this.LocalResourceFile), Globals.GetPortalDomainName(PortalAlias.HTTPAlias, Request, true) + "/" + Globals.glbDefaultPage, TabId);
                }
                else
                {
                    grdServices.Visible = false;
                    lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
                }
                lblServices.Visible = true;

                grdServices.Columns[ 0 ].Visible = false; // subscribe
                grdServices.Columns[ 9 ].Visible = false; // expiry date

                ServicesRow.Visible = true;
            }
            else
            {
                UserRow.Visible = true;

                //Populate the timezone combobox (look up timezone translations based on currently set culture)
                Localization.LoadTimeZoneDropDownList( cboTimeZone, ( (PageBase)Page ).PageCulture.Name, Convert.ToString( PortalSettings.TimeZoneOffset ) );
                Localization.LoadCultureDropDownList( cboLocale, CultureDropDownTypes.NativeName, ( (PageBase)Page ).PageCulture.Name );
                if( cboLocale.Items.Count == 1 )
                {
                    cboLocale.Enabled = false;
                }

                if( Request.IsAuthenticated )
                {
                    lblRegister.Text = Localization.GetString( "RegisterNote", this.LocalResourceFile );
                    cmdRegister.Text = Localization.GetString( "cmdUpdate" );

                    PasswordManagementRow.Visible = true;
                    userControl.ShowPassword = false;

                    if( UserInfo.UserID >= 0 )
                    {
                        userControl.FirstName = UserInfo.FirstName;
                        userControl.LastName = UserInfo.LastName;
                        userControl.UserName = UserInfo.Username;
                        userControl.Email = UserInfo.Email;
                        userControl.IM = UserInfo.Profile.IM;
                        userControl.Website = UserInfo.Profile.Website;
                        if( cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ) != null )
                        {
                            cboTimeZone.ClearSelection();
                            cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ).Selected = true;
                        }

                        addressUser.Unit = UserInfo.Profile.Unit;
                        addressUser.Street = UserInfo.Profile.Street;
                        addressUser.City = UserInfo.Profile.City;
                        addressUser.Region = UserInfo.Profile.Region;
                        addressUser.Country = UserInfo.Profile.Country;
                        addressUser.Postal = UserInfo.Profile.PostalCode;
                        addressUser.Telephone = UserInfo.Profile.Telephone;
                        addressUser.Fax = UserInfo.Profile.Fax;
                        addressUser.Cell = UserInfo.Profile.Cell;
                        if( cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ) != null )
                        {
                            cboLocale.ClearSelection();
                            cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ).Selected = true;
                        }
                    }

                    RoleController objRoles = new RoleController();

                    grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID );
                    grdServices.DataBind();

                    if( UserInfo.IsSuperUser )
                    {
                        cmdUnregister.Visible = false;
                        ServicesRow.Visible = false;
                    }
                    else
                    {
                        // if no service available then hide options
                        ServicesRow.Visible = grdServices.Items.Count > 0;
                    }
                }
                else
                {
                    switch( PortalSettings.UserRegistration )
                    {
                        case (int)Globals.PortalRegistrationType.PrivateRegistration:

                            lblRegister.Text = Localization.GetString( "PrivateMembership", this.LocalResourceFile );
                            break;
                        case (int)Globals.PortalRegistrationType.PublicRegistration:

                            lblRegister.Text = Localization.GetString( "PublicMembership", this.LocalResourceFile );
                            break;
                        case (int)Globals.PortalRegistrationType.VerifiedRegistration:

                            lblRegister.Text = Localization.GetString( "VerifiedMembership", this.LocalResourceFile );
                            break;
                    }
                    lblRegister.Text += Localization.GetString( "Required", this.LocalResourceFile );
                    cmdRegister.Text = Localization.GetString( "cmdRegister", this.LocalResourceFile );

                    cmdUnregister.Visible = false;
                    ServicesRow.Visible = false;
                    PasswordManagementRow.Visible = false;
                    userControl.ShowPassword = true;
                }
            }
        }