Exemplo n.º 1
0
    /// <summary>
    /// Initializes the layout of the form.
    /// </summary>
    private void InitializeForm()
    {
        // General UI
        lnkShowAdvancedFilter.Text = GetString("general.displayadvancedfilter");
        lnkShowSimpleFilter.Text   = GetString("general.displaysimplefilter");
        plcAdvancedSearch.Visible  = isAdvancedMode;
        pnlAdvanced.Visible        = isAdvancedMode;
        pnlSimple.Visible          = !isAdvancedMode;

        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            grid.RememberDefaultState = true;
            btnReset.Text             = GetString("general.reset");
            btnReset.Click           += btnReset_Click;
        }
        else
        {
            btnReset.Visible = false;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Page Init event.
    /// </summary>
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            // Preselect default value
            SelectedUser = MembershipContext.AuthenticatedUser.UserID;
        }

        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            btnReset.Text   = GetString("general.reset");
            btnReset.Click += btnReset_Click;
        }
        else
        {
            btnReset.Visible = false;
        }

        UsersPlaceHolder.Visible = MembershipContext.AuthenticatedUser.IsGlobalAdministrator;
    }
    /// <summary>
    /// Run task list.
    /// </summary>
    protected void btnRunTasks_Click(object sender, EventArgs e)
    {
        switch (selectedServer)
        {
        case allServers:
            WebSyncHelper.SynchronizeWebFarm(true);
            // Call synchronization method
            WebSyncHelper.ProcessMyTasks();
            break;

        default:
            // Get the server info object
            WebFarmServerInfo wfsi = WebFarmServerInfoProvider.GetWebFarmServerInfo(SqlHelperClass.GetSafeQueryString(selectedServer, false));
            // If server is enabled
            if (wfsi.ServerEnabled)
            {
                if (wfsi.ServerName.ToLowerCSafe() == WebSyncHelperClass.ServerName.ToLowerCSafe())
                {
                    // Call synchronization method
                    WebSyncHelper.ProcessMyTasks();
                }
                else
                {
                    if (WebSyncHelperClass.Servers.Contains(wfsi.ServerID))
                    {
                        WebFarmUpdaterAsync wfu = new WebFarmUpdaterAsync();
                        // Add server for sync
                        wfu.Urls.Add(wfsi.ServerURL.TrimEnd('/') + WebSyncHelperClass.WebFarmUpdaterPage);
                    }
                }
            }
            break;
        }

        UniGrid.ReloadData();

        // Show info label
        ShowInformation(GetString("webfarmtasks.taskexecuted"));
    }
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void uniGrid_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "delete")
        {
            // Delete object from database
            if (selectedServer == allServers)
            {
                // Delete task object
                WebFarmTaskInfoProvider.DeleteWebFarmTaskInfo(Convert.ToInt32(actionArgument));
            }
            else
            {
                // Get infos for task and server
                WebFarmTaskInfo   wfti = WebFarmTaskInfoProvider.GetWebFarmTaskInfo(Convert.ToInt32(actionArgument));
                WebFarmServerInfo wfsi = WebFarmServerInfoProvider.GetWebFarmServerInfo(selectedServer);
                // Delete task binding to server
                WebFarmTaskInfoProvider.DeleteServerTask(wfsi.ServerID, wfti.TaskID);
            }

            UniGrid.ReloadData();
        }
    }
Exemplo n.º 5
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void uniGrid_OnAction(string actionName, object actionArgument)
    {
        if (actionName == "edit")
        {
            URLHelper.Redirect("Customer_Edit_Credit_Edit.aspx?customerid=" + customerId + "&eventid=" + Convert.ToString(actionArgument) + "&siteId=" + SiteID);
        }
        else if (actionName == "delete")
        {
            // Check customer modification permission
            if (!ECommerceContext.IsUserAuthorizedToModifyCustomer())
            {
                RedirectToAccessDenied(ModuleName.ECOMMERCE, "EcommerceModify OR ModifyCustomers");
            }

            // Check if using global credit
            if (ECommerceSettings.UseGlobalCredit(SiteContext.CurrentSiteName))
            {
                // Check Ecommerce global modify permission
                if (!ECommerceContext.IsUserAuthorizedForPermission(EcommercePermissions.ECOMMERCE_MODIFYGLOBAL))
                {
                    RedirectToAccessDenied(ModuleName.ECOMMERCE, EcommercePermissions.ECOMMERCE_MODIFYGLOBAL);
                }
            }

            // Get event info object
            int             eventId   = Convert.ToInt32(actionArgument);
            CreditEventInfo eventInfo = CreditEventInfoProvider.GetCreditEventInfo(eventId);

            // Check if deleted event exists and whether it belongs to edited customer
            if ((eventInfo != null) && (eventInfo.EventCustomerID == customerId))
            {
                // Delete CreditEventInfo object from database
                CreditEventInfoProvider.DeleteCreditEventInfo(eventInfo);
                UniGrid.ReloadData();
                // Display customer total credit
                headTotalCredit.Text = string.Format(GetString("CreditEvent_List.TotalCredit"), GetFormattedTotalCredit());
            }
        }
    }
Exemplo n.º 6
0
    /// <summary>
    /// Run task list.
    /// </summary>
    private void RunTasks()
    {
        switch (selectedServer)
        {
        case allServers:
        {
            WebSyncHelper.NotifyServers(true);
            WebSyncHelper.ProcessMyTasks();
        }
        break;

        default:
            // Get the server info object
            WebFarmServerInfo wfsi = WebFarmServerInfoProvider.GetWebFarmServerInfo(SqlHelper.GetSafeQueryString(selectedServer, false));
            // If server is enabled
            if (wfsi.ServerEnabled)
            {
                if (wfsi.ServerName.ToLowerCSafe() == WebSyncHelper.ServerName.ToLowerCSafe())
                {
                    // Call synchronization method
                    WebSyncHelper.ProcessMyTasks();
                }
                else if (WebSyncHelper.IsServerEnabled(wfsi.ServerID))
                {
                    WebFarmUpdaterAsync wfu = new WebFarmUpdaterAsync();

                    // Add server for sync
                    wfu.Urls.Add(wfsi.ServerURL.TrimEnd('/') + WebSyncHelper.WebFarmUpdaterPage);
                }
            }
            break;
        }

        UniGrid.ReloadData();

        // Show info label
        ShowInformation(GetString("webfarmtasks.taskexecuted"));
    }
Exemplo n.º 7
0
    /// <summary>
    /// Handles the UniGrid's OnAction event.
    /// </summary>
    /// <param name="actionName">Name of item (button) that throws event</param>
    /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
    protected void UniGrid_OnAction(string actionName, object actionArgument)
    {
        // Check 'Modify' permission (because of delete action in unigrid)
        if (!CheckPermissions("cms.eventmanager", "Modify"))
        {
            return;
        }

        switch (actionName)
        {
        case "delete":
            EventAttendeeInfoProvider.DeleteEventAttendeeInfo(ValidationHelper.GetInteger(actionArgument, 0));
            // Refresh parent frame header
            ltlScript.Text = ScriptHelper.GetScript("RefreshHeader();");
            UniGrid.ReloadData();
            ShowEventInfo();
            break;

        case "sendemail":
            // Resend invitation email
            TreeProvider mTree = new TreeProvider(MembershipContext.AuthenticatedUser);
            TreeNode     node  = mTree.SelectSingleNode(EventID);

            EventAttendeeInfo eai = EventAttendeeInfoProvider.GetEventAttendeeInfo(ValidationHelper.GetInteger(actionArgument, 0));

            if ((node != null) && (node.NodeClassName.EqualsCSafe("cms.bookingevent", true)) && (eai != null))
            {
                EventProvider.SendInvitation(SiteContext.CurrentSiteName, node, eai, TimeZoneHelper.ServerTimeZone);

                ShowConfirmation(GetString("eventmanager.invitationresend"));
            }
            break;

        case "edit":
            SelectedAttendeeID = ValidationHelper.GetInteger(actionArgument, 0);
            break;
        }
    }
Exemplo n.º 8
0
    /// <summary>
    /// Returns correct WHERE condition.
    /// </summary>
    private string GetWhere()
    {
        UniGrid parent = ControlsHelper.GetParentControl(this, typeof(UniGrid)) as UniGrid;

        if (parent != null)
        {
            string resourceName = ValidationHelper.GetString(parent.GetValue("ResourceName"), "");
            if (!string.IsNullOrEmpty(resourceName))
            {
                string where = "MacroRuleResourceName = N'" + SqlHelperClass.GetSafeQueryString(resourceName, false) + "'";

                // Show also global rules for global administrator if requested
                if (drpOptions.SelectedIndex == 1)
                {
                    where = SqlHelperClass.AddWhereCondition(where, "MacroRuleResourceName = '' OR MacroRuleResourceName IS NULL", "OR");
                }
                return(where);
            }
        }

        // Only global rules should be displayed
        return("MacroRuleResourceName = '' OR MacroRuleResourceName IS NULL");
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
        siteSelector.DropDownSingleSelect.AutoPostBack = false;

        // Load dropdown list
        if (!RequestHelper.IsPostBack())
        {
            InitializeComponents();
            siteSelector.Value = SiteContext.CurrentSiteID;
        }

        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            btnReset.Text   = GetString("general.reset");
            btnReset.Click += btnReset_Click;
        }
        else
        {
            btnReset.Visible = false;
        }
    }
    protected override void OnInit(EventArgs e)
    {
        UsersPlaceHolder.Visible = MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin);

        if (!RequestHelper.IsPostBack())
        {
            // Preselect default value
            SelectedUser = MembershipContext.AuthenticatedUser.UserID;
        }

        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            btnReset.Text   = GetString("general.reset");
            btnReset.Click += btnReset_Click;
        }
        else
        {
            btnReset.Visible = false;
        }

        base.OnInit(e);
    }
Exemplo n.º 11
0
    /// <summary>
    /// Displays only specified control. Other controls hides.
    /// </summary>
    /// <param name="selectedControl">Specified control</param>
    private void DisplayControl(string selectedControl)
    {
        // Tree element
        treeElem.ForumID            = mForumId;
        treeElem.SelectOnlyApproved = false;
        treeElem.Selected           = postId;

        // Hide elements
        plcPostEdit.Visible = false;
        plcPostView.Visible = false;
        plcPostNew.Visible  = false;

        switch (selectedControl.ToLowerCSafe())
        {
        case "view":
            // View mode
            if ((post != null) && (post.PostAttachmentCount > 0))
            {
                string where = "(AttachmentPostID = " + postId + ")";

                // Load unigrid
                UniGrid.WhereCondition = where;
                UniGrid.Query          = "Forums.ForumAttachment.selectall";
                UniGrid.Columns        = "AttachmentID,AttachmentFileName,AttachmentFileSize,AttachmentGUID";
                UniGrid.Visible        = true;
                UniGrid.ReloadData();
            }

            if (post != null)
            {
                InitializeMenu();
                actionsElem.ReloadData();
            }

            postNew.ForumID     = mForumId;
            postView.PostID     = postId;
            postView.PostData   = null;
            plcPostView.Visible = true;
            postView.ReloadData();
            break;

        case "edit":
            // Edit mode
            postEdit.ForumID    = mForumId;
            postEdit.EditPostID = postId;
            postEdit.ReloadData();
            plcPostEdit.Visible = true;
            break;

        case "reply":
            // Reply mode
            plcPostNew.Visible    = true;
            postNew.ReplyToPostID = postId;
            postNew.ReloadData();
            break;

        case "newpreview":
            // New preview mode
            plcPostEdit.Visible = false;
            plcPostView.Visible = false;
            plcPostNew.Visible  = true;
            break;

        case "editpreview":
            // Edit preview mode
            plcPostEdit.Visible = true;
            plcPostView.Visible = false;
            plcPostNew.Visible  = false;
            break;

        default:
            // Default view mode
            postNew.ClearForm();
            if (postId > 0)
            {
                postNew.ReplyToPostID = postId;
            }
            else
            {
                postNew.ReplyToPostID = 0;
            }

            plcPostNew.Visible = true;
            postNew.ReloadData();

            break;
        }
    }
Exemplo n.º 12
0
 /// <summary>
 /// Returns <c>false</c> if <paramref name="grid"/> or any of its members is <c>null</c> and if its object type is not <see cref="PredefinedObjectType.USER"/> otherwise returns <c>true</c>.
 /// </summary>
 private static bool ShowPrivilegeLevelFilter(UniGrid grid)
 {
     return(grid?.InfoObject?.TypeInfo?.OriginalObjectType == PredefinedObjectType.USER);
 }
Exemplo n.º 13
0
    /// <summary>
    /// Applies filter on associated UniGrid control.
    /// </summary>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        UniGrid grid = FilteredControl as UniGrid;

        grid?.ApplyFilter(sender, e);
    }
Exemplo n.º 14
0
    /// <summary>
    /// Resets the associated UniGrid control.
    /// </summary>
    protected void btnReset_Click(object sender, EventArgs e)
    {
        UniGrid grid = FilteredControl as UniGrid;

        grid?.Reset();
    }
Exemplo n.º 15
0
    /// <summary>
    /// Applies filter to unigrid.
    /// </summary>
    protected void ApplyFilter(object sender, EventArgs e)
    {
        UniGrid grid = filteredControl as UniGrid;

        grid?.ApplyFilter(sender, e);
    }
Exemplo n.º 16
0
 /// <summary>
 /// Reloads data.
 /// </summary>
 public override void ReloadData()
 {
     SetupControl();
     UniGrid.ReloadData();
 }
Exemplo n.º 17
0
    /// <summary>
    /// Applies filter to unigrid.
    /// </summary>
    /// <param name="sender">Sender.</param>
    /// <param name="e">Event args.</param>
    private void ApplyFilter(object sender, EventArgs e)
    {
        UniGrid grid = FilteredControl as UniGrid;

        grid?.ApplyFilter(sender, e);
    }
Exemplo n.º 18
0
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Retrieve customer from the database
        CustomerInfo customer = CustomerInfoProvider.GetCustomerInfo(FilterCustomerID);

        // If a valid customer is specified, disable filtering by customer's properties
        if (customer != null)
        {
            CustomerFilterEnabled = false;
        }

        // If the current user is a global administrator, he or she is allowed to filter by site, otherwise, disable filtering by site
        if ((MembershipContext.AuthenticatedUser != null) && MembershipContext.AuthenticatedUser.IsGlobalAdministrator)
        {
            // If a valid customer is specified and he or she is associated with a CMS user, display only sites that the user can access, otherwise, disable filtering by site
            if (customer != null)
            {
                if (customer.CustomerIsRegistered)
                {
                    siteSelector.UserId = customer.CustomerUserID;
                }
                else
                {
                    SiteFilterEnabled = false;
                }
            }
        }
        else
        {
            SiteFilterEnabled = false;
        }

        // Initialize the control with values All, Yes and No
        InitializeThreeStateDropDownList(drpOrderIsPaid);

        // If this control is associated with an UniGrid control, disable UniGrid's buttons and initialize the Reset button
        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null)
        {
            grid.HideFilterButton = true;
            // Reset button is available only when UniGrid remembers its state
            if (grid.RememberState)
            {
                btnReset.Text   = GetString("general.reset");
                btnReset.Click += btnReset_Click;
            }
            else
            {
                btnReset.Visible = false;
            }
        }

        // Initialize the Show button
        btnFilter.Text   = GetString("general.filter");
        btnFilter.Click += btnFilter_Click;

        // Hide unwanted elements
        plcAdvancedGroup.Visible = false;
        plcSimpleFilter.Visible  = false;

        // Initialize site selector
        siteSelector.UniSelector.OnSelectionChanged += DropDownSingleSelect_SelectedIndexChanged;
        CurrencySelector.SiteID = statusSelector.SiteID;

        // Use timezones for DateTimePickers
        CMS.Globalization.TimeZoneInfo timeZone = TimeZoneHelper.GetTimeZoneInfo(MembershipContext.AuthenticatedUser, SiteContext.CurrentSite);
        dtpFrom.TimeZone            = TimeZoneTypeEnum.Custom;
        dtpFrom.CustomTimeZone      = timeZone;
        dtpCreatedTo.TimeZone       = TimeZoneTypeEnum.Custom;
        dtpCreatedTo.CustomTimeZone = timeZone;

        // Preselect current siteID by default when siteSelector is enabled
        if (!URLHelper.IsPostback())
        {
            siteSelector.SiteID = SiteContext.CurrentSiteID;
        }
    }
Exemplo n.º 19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        InitializeForm();

        drpLockReason.Enabled = chkEnabled.Checked;

        // Show alphabet filter if enabled
        if (pnlAlphabet.Visible)
        {
            pnlAlphabet.Controls.Add(CreateAlphabetTable());
        }

        if (scoreSelector != null)
        {
            int siteId = QueryHelper.GetInteger("siteid", 0);
            scoreSelector.Enabled = (siteId > 0) || ((siteId == 0) && (siteSelector.SiteID > 0));

            if (siteId == 0)
            {
                scoreSelector.SetValue("SiteID", siteSelector.SiteID);
            }
        }

        // Show correct filter panel
        EnsureFilterMode();
        pnlAdvancedFilter.Visible = isAdvancedMode;
        pnlSimpleFilter.Visible   = !isAdvancedMode;

        // Set reset link button
        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            if (isAdvancedMode)
            {
                btnAdvancedReset.Text   = GetString("general.reset");
                btnAdvancedReset.Click += btnReset_Click;
            }
            else
            {
                btnReset.Text   = GetString("general.reset");
                btnReset.Click += btnReset_Click;
            }
        }
        else
        {
            if (isAdvancedMode)
            {
                btnAdvancedReset.Visible = false;
            }
            else
            {
                btnReset.Visible = false;
            }
        }

        // Show group filter only if enabled
        if (SiteID > 0)
        {
            SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteID);
            if ((si != null) && isAdvancedMode)
            {
                showGroups = ModuleCommands.CommunitySiteHasGroup(si.SiteID);
            }
        }

        // Setup role selector
        selectNotInRole.SiteID = SiteID;
        selectRoleElem.SiteID  = SiteID;
        selectRoleElem.CurrentSelector.ResourcePrefix  = "addroles";
        selectNotInRole.CurrentSelector.ResourcePrefix = "addroles";
        selectRoleElem.UseFriendlyMode  = true;
        selectNotInRole.UseFriendlyMode = true;

        // Setup groups selectors
        plcGroups.Visible = showGroups;
        if (selectInGroups != null)
        {
            selectInGroups.StopProcessing       = !showGroups;
            selectInGroups.FormControlParameter = SiteID;
        }

        if (selectNotInGroups != null)
        {
            selectNotInGroups.StopProcessing       = !showGroups;
            selectNotInGroups.FormControlParameter = SiteID;
        }

        if (SessionInsteadOfUser && DisplayGuestsByDefault)
        {
            plcNickName.Visible = false;
            plcUserName.Visible = false;
        }

        if (grid != null)
        {
            string argument = ValidationHelper.GetString(Request.Params["__EVENTARGUMENT"], String.Empty);
            if (argument == "Alphabet")
            {
                grid.ApplyFilter(null, null);
            }
        }

        if (QueryHelper.GetBoolean("isonlinemarketing", false))
        {
            // Set disabled modules info (only on On-line marketing tab)
            ucDisabledModule.SettingsKeys = "CMSSessionUseDBRepository;CMSEnableOnlineMarketing";
            ucDisabledModule.InfoTexts.Add(GetString("administration.users.usedbrepository.disabled") + "<br/>");
            ucDisabledModule.InfoTexts.Add(GetString("om.onlinemarketing.disabled"));
            ucDisabledModule.Visible = true;
        }
    }
Exemplo n.º 20
0
    /// <summary>
    /// Load event.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        InitializeForm();

        // Score selector is not null only if DisplayScore is true
        if (mScoreSelector != null)
        {
            if ((CurrentMode == "online") && DisplayContacts)
            {
                plcScore.Visible = true;

                int siteId = QueryHelper.GetInteger("siteid", 0);
                mScoreSelector.Enabled = (siteId > 0) || ((siteId == 0) && (siteSelector.SiteID > 0));

                if (siteId == 0)
                {
                    mScoreSelector.SetValue("SiteID", siteSelector.SiteID);
                }
            }
            else
            {
                // Disable loading not visible control
                mScoreSelector.StopProcessing = true;
            }
        }

        // Show correct filter panel
        SetCorrectFilterMode();

        // Set reset link button
        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null && grid.RememberState)
        {
            if (mIsAdvancedMode)
            {
                btnAdvancedReset.Click += btnReset_Click;
            }
            else
            {
                btnReset.Click += btnReset_Click;
            }
        }
        else
        {
            if (mIsAdvancedMode)
            {
                btnAdvancedReset.Visible = false;
            }
            else
            {
                btnReset.Visible = false;
            }
        }

        // Set privilege level filter
        if (ShowPrivilegeLevelFilter(grid))
        {
            plcPrivilegeLevel.Visible = true;
            mShowPrivilegeFilter      = true;
        }
        else
        {
            mShowPrivilegeFilter = false;
        }

        // Show group filter only if enabled
        if (SiteID > 0)
        {
            SiteInfo si = SiteInfoProvider.GetSiteInfo(SiteID);
            if ((si != null) && mIsAdvancedMode)
            {
                mShowGroups = ModuleCommands.CommunitySiteHasGroup(si.SiteID);
            }
        }

        // Setup role selector
        selectNotInRole.SiteID = SiteID;
        selectRoleElem.SiteID  = SiteID;
        selectRoleElem.CurrentSelector.ResourcePrefix  = "addroles";
        selectNotInRole.CurrentSelector.ResourcePrefix = "addroles";
        selectRoleElem.UseFriendlyMode  = true;
        selectNotInRole.UseFriendlyMode = true;

        // Setup groups selectors
        plcGroups.Visible = mShowGroups;
        if (mSelectInGroups != null)
        {
            mSelectInGroups.StopProcessing       = !mShowGroups;
            mSelectInGroups.FormControlParameter = SiteID;
        }

        if (mSelectNotInGroups != null)
        {
            mSelectNotInGroups.StopProcessing       = !mShowGroups;
            mSelectNotInGroups.FormControlParameter = SiteID;
        }

        if (SessionInsteadOfUser && DisplayGuestsByDefault)
        {
            plcNickName.Visible = false;
            plcUserName.Visible = false;
        }

        if (QueryHelper.GetBoolean("isonlinemarketing", false))
        {
            // Set disabled modules info (only on On-line marketing tab)
            ucDisabledModule.TestSettingKeys = "CMSSessionUseDBRepository;CMSEnableOnlineMarketing";
            ucDisabledModule.Visible         = true;
        }
    }
    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        // Retrieve customer from the database
        CustomerInfo customer = CustomerInfoProvider.GetCustomerInfo(FilterCustomerID);

        // If a valid customer is specified, disable filtering by customer's properties
        if (customer != null)
        {
            CustomerFilterEnabled = false;
        }

        // If the current user is a global administrator, he or she is allowed to filter by site, otherwise, disable filtering by site
        if ((CMSContext.CurrentUser != null) && CMSContext.CurrentUser.IsGlobalAdministrator)
        {
            // If a valid customer is specified and he or she is assciated with a CMS user, display only sites that the user can access, otherwise, disable filtering by site
            if (customer != null)
            {
                if (customer.CustomerUserID > 0)
                {
                    siteSelector.UserId = customer.CustomerUserID;
                }
                else
                {
                    SiteFilterEnabled = false;
                }
            }
        }
        else
        {
            SiteFilterEnabled = false;
        }

        // Initialize the control with values All, Yes and No
        InitializeThreeStateDropDownList(drpOrderIsPaid);

        // If this control is associated with an UniGrid control, disable UniGrid's buttons and initialize the Reset button
        UniGrid grid = FilteredControl as UniGrid;

        if (grid != null)
        {
            grid.HideFilterButton = true;
            // Reset button is available only when UniGrid remembers its state
            if (grid.RememberState)
            {
                btnReset.Text   = GetString("general.reset");
                btnReset.Click += btnReset_Click;
            }
            else
            {
                btnReset.Visible = false;
            }
        }

        // Initialize the Show button
        btnFilter.Text   = GetString("general.show");
        btnFilter.Click += btnFilter_Click;

        // Assign images
        imgArrowUp.ImageUrl   = GetImageUrl("Design/Controls/UniGrid/Actions/SortDown.png");
        imgArrowDown.ImageUrl = GetImageUrl("Design/Controls/UniGrid/Actions/SortUp.png");

        // Hide unwanted elements
        plcAdvancedGroup.Visible = false;
        plcSimpleFilter.Visible  = false;

        // Initialize site selector
        siteSelector.DropDownSingleSelect.SelectedIndexChanged += new EventHandler(DropDownSingleSelect_SelectedIndexChanged);
        CurrencySelector.SiteID = statusSelector.SiteID;

        // Preselect current siteID by default when siteSelector is enabled
        if (!URLHelper.IsPostback())
        {
            siteSelector.SiteID = CMSContext.CurrentSiteID;
        }
    }