Exemple #1
0
    /// <summary>
    /// Load text to labels and load the all categories of user preferences
    /// </summary>
    private void PopulateControls()
    {
        var list          = ListComponent.GetListPerCategory("AvailableResource", Thread.CurrentThread.CurrentCulture.Name).ToList();
        var listEmptyItem = new NexsoProDAL.List();

        listEmptyItem.Value = "0";
        listEmptyItem.Label = Localization.GetString("SelectItem", LocalResourceFile);
        list = ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkTheme.DataSource = list;
        chkTheme.DataBind();
        list = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkBeneficiaries.DataSource = list;
        chkBeneficiaries.DataBind();
        list = ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name).ToList();
        chkSector.DataSource = list;
        chkSector.DataBind();
        list = ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlWhoareYou.DataSource = list;
        ddlWhoareYou.DataBind();
        list = ListComponent.GetListPerCategory("Source", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlSource.DataSource = list;
        ddlSource.DataBind();
        list = ListComponent.GetListPerCategory("Language", Thread.CurrentThread.CurrentCulture.Name).ToList();
        list.Insert(0, listEmptyItem);
        ddlLanguage.DataSource = list;
        ddlLanguage.DataBind();
        if (userId > 0)
        {
            txtEmail.Text    = currentUser.Email;
            lblEmailTxt.Text = txtEmail.Text;
            foreach (ProfilePropertyDefinition property in currentUser.Profile.ProfileProperties)
            {
                MapPropToPage(property.PropertyName, property.PropertyValue);
            }
            MapPropToPage(userId);
        }

        var    returnUrl = Globals.UserProfileURL(userId);
        string url       = NexsoHelper.GetCulturedUrlByTabName("Change Password") + "?returnurl=" + returnUrl;

        passwordLink.NavigateUrl = url;
        if (PortalSettings.EnablePopUps)
        {
            passwordLink.Attributes.Add("onclick", "return " + UrlUtils.PopUpUrl(url, this, PortalSettings, true, false, 300, 650));
        }
    }
    /// <summary>
    /// Load information to the controls (textbox and dropdownlist)
    /// </summary>
    public void BindData()
    {
        var listEmptyItem = new NexsoProDAL.List();

        listEmptyItem.Key   = "0";
        listEmptyItem.Label = Localization.GetString("SelectItem", LocalResourceFile);
        var list = ListComponent.GetListPerCategory("FileCategory", Thread.CurrentThread.CurrentCulture.Name).ToList();

        if (IsChallengeFiles)
        {
            list = ListComponent.GetListPerCategory("ChallengeFile", Thread.CurrentThread.CurrentCulture.Name).ToList();
            list.Insert(0, listEmptyItem);
            ddCategory.DataSource = list;
            ddCategory.DataBind();
            txtTitle.Visible              = true;
            lblTitle.Visible              = true;
            lblDescription.Visible        = false;
            txtDescription.Visible        = false;
            RadButton1.ValidationGroup    = "ChallengeFiles";
            btnBackUpdate.ValidationGroup = "ChallengeFiles";
            btnBackUpdate.ValidationGroup = "ChallengeFiles";
            if (string.IsNullOrEmpty(ChallengeReference))
            {
                aUploadFile.Enabled = false;
                rdProgressAreaUploadFile.Visible = false;
            }
            else
            {
                aUploadFile.Enabled = true;
                rdProgressAreaUploadFile.Visible = true;
            }
        }
        else
        {
            list.Insert(0, listEmptyItem);
            ddCategory.DataSource = list;
            ddCategory.DataBind();
        }
        FillDataRepeater();
        list = ListComponent.GetListPerCategory("FileScope", Thread.CurrentThread.CurrentCulture.Name).ToList();
        rdbScope.DataSource = list;
        rdbScope.DataBind();
        lblTitle.Text    = TextTitle;
        rfvtxtTitle.Text = TextTitleValidator;
    }
Exemple #3
0
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// LoadSettings loads the settings from the Database and displays them
    /// </summary>
    /// -----------------------------------------------------------------------------
    public override void LoadSettings()
    {
        try
        {
            if (Settings.Contains("ChallengeReference"))
            {
                challengeComponent = new ChallengeComponent(Settings["ChallengeReference"].ToString());
            }
            else
            {
                challengeComponent = new ChallengeComponent();
            }

            if (Page.IsPostBack == false)
            {
                //Check for existing settings and use those on this page
                //Settings["SettingName"]

                if (Settings.Contains("ChallengeReference"))
                {
                    txtChallengeReference.Text = Settings["ChallengeReference"].ToString();
                }

                if (Settings.Contains("RadEditor"))
                {
                    RadEditor.RichText.Text        = string.Empty;
                    RadEditor.BasicTextEditor.Text = string.Empty;
                    RadEditor.Text = Settings["RadEditor"].ToString();
                }
                if (!string.IsNullOrEmpty(challengeComponent.Challenge.EntryFrom.ToString()))
                {
                    dtAvailableFrom.SelectedDate = Convert.ToDateTime(challengeComponent.Challenge.EntryFrom.ToString());
                }
                if (!string.IsNullOrEmpty(challengeComponent.Challenge.EntryTo.ToString()))
                {
                    dtAvailableTo.SelectedDate = Convert.ToDateTime(challengeComponent.Challenge.EntryTo.ToString());
                }
                if (!string.IsNullOrEmpty(challengeComponent.Challenge.Closed.ToString()))
                {
                    dtCloseDate.SelectedDate = Convert.ToDateTime(challengeComponent.Challenge.Closed.ToString());
                }

                txtChallengeTitle.Text = challengeComponent.Challenge.ChallengeTitle;
                txtTagUrl.Text         = challengeComponent.Challenge.Url;
                txtOutUrl.Text         = challengeComponent.Challenge.OutUrl;
                txtEnterUrl.Text       = challengeComponent.Challenge.EnterUrl;

                var list          = ListComponent.GetListPerCategory("Flavor", Thread.CurrentThread.CurrentCulture.Name).ToList();
                var listEmptyItem = new NexsoProDAL.List();
                listEmptyItem.Key   = "Default";
                listEmptyItem.Label = Localization.GetString("SelectItem", LocalResourceFile);
                list.Insert(0, listEmptyItem);

                ddFlavor.DataSource = list;
                ddFlavor.DataBind();

                ddFlavor.SelectedValue = challengeComponent.Challenge.Flavor;

                list                = ListComponent.GetListPerCategory("PublishState", Thread.CurrentThread.CurrentCulture.Name).ToList();
                listEmptyItem       = new NexsoProDAL.List();
                listEmptyItem.Value = "1000";
                listEmptyItem.Label = Localization.GetString("SelectItem", LocalResourceFile);
                list.Insert(0, listEmptyItem);


                ddPublishState.DataSource = list;
                ddPublishState.DataBind();


                if (Settings.Contains("PublishState"))
                {
                    ddPublishState.SelectedValue = Settings["PublishState"].ToString();
                }
                if (Settings.Contains("ThemeFilter"))
                {
                    txtThemeFilter.Text = Settings["ThemeFilter"].ToString();
                }
                if (Settings.Contains("BeneficiaryFilter"))
                {
                    txtBeneficiaryFilter.Text = Settings["BeneficiaryFilter"].ToString();
                }
            }
        }
        catch (Exception exc) //Module failed to load
        {
            Exceptions.ProcessModuleLoadException(this, exc);
        }
    }