Exemple #1
0
    /// <summary>
    /// Get items (answer) of the registered user
    /// </summary>
    /// <param name="listName">name of the list of answer</param>
    /// <param name="checkBoxList"></param>
    private void SetChkControl(string listName, RadListView checkBoxList)
    {
        var list = UserPropertiesListComponent.GetListPerCategory(userId, listName);
        RadListViewDataItem item;

        foreach (var itemL in list)
        {
            item = checkBoxList.Items.Find(a => ((List)a.DataItem).Key == itemL.Key);
            if (item != null)
            {
                item.Selected = true;
            }
        }
    }
Exemple #2
0
        public static UserProfileModel ParseUserProfile(UserProperty userProperty, string role, CultureInfo culture)
        {
            var listUserTheme         = UserPropertiesListComponent.GetListPerCategory(userProperty.UserId, "Theme");
            var listUserBeneficiaries = UserPropertiesListComponent.GetListPerCategory(userProperty.UserId, "Beneficiaries");
            var listUserSector        = UserPropertiesListComponent.GetListPerCategory(userProperty.UserId, "Sector");


            var userProfileModel = new UserProfileModel();

            userProfileModel.Themes             = Helper.HelperMethods.GetListFromUserPropertiesList(listUserTheme, culture);
            userProfileModel.Beneficiaries      = Helper.HelperMethods.GetListFromUserPropertiesList(listUserBeneficiaries, culture);
            userProfileModel.Sectors            = Helper.HelperMethods.GetListFromUserPropertiesList(listUserSector, culture);
            userProfileModel.UserId             = userProperty.UserId;
            userProfileModel.NexsoUserId        = userProperty.NexsoUserId == null ? Guid.Empty : (Guid)userProperty.NexsoUserId;
            userProfileModel.SkypeName          = userProperty.SkypeName;
            userProfileModel.Twitter            = userProperty.Twitter;
            userProfileModel.FaceBook           = userProperty.FaceBook;
            userProfileModel.Google             = userProperty.Google;
            userProfileModel.LinkedIn           = userProperty.LinkedIn;
            userProfileModel.OtherSocialNetwork = userProperty.OtherSocialNetwork;
            userProfileModel.Bio            = userProperty.Bio;
            userProfileModel.BannerPicture  = userProperty.BannerPicture.GetValueOrDefault(Guid.Empty);
            userProfileModel.ProfilePicture = userProperty.ProfilePicture.GetValueOrDefault(Guid.Empty);
            userProfileModel.City           = userProperty.City;
            userProfileModel.Region         = userProperty.Region;
            userProfileModel.Country        = userProperty.Country;
            userProfileModel.FirstName      = userProperty.FirstName;
            userProfileModel.LastName       = userProperty.LastName;
            userProfileModel.Language       = Convert.ToInt32(userProperty.Language);
            userProfileModel.Latitude       = Convert.ToDecimal(userProperty.Latitude);
            userProfileModel.Longitude      = Convert.ToDecimal(userProperty.Longitude);
            userProfileModel.GoogleLocation = userProperty.GoogleLocation;

            if (role == "Owner")
            {
                userProfileModel.Agreement               = userProperty.Agreement;
                userProfileModel.PostalCode              = userProperty.PostalCode;
                userProfileModel.Telephone               = userProperty.Telephone;
                userProfileModel.Address                 = userProperty.Address;
                userProfileModel.email                   = userProperty.email;
                userProfileModel.CustomerType            = userProperty.CustomerType.GetValueOrDefault(-1);
                userProfileModel.NexsoEnrolment          = userProperty.NexsoEnrolment.GetValueOrDefault(-1);
                userProfileModel.AllowNexsoNotifications = userProperty.AllowNexsoNotifications.GetValueOrDefault(-1);
            }



            return(userProfileModel);
        }
Exemple #3
0
    /// <summary>
    /// Get items (answer) of the registered user
    /// </summary>
    /// <param name="listName">name of the list of answer</param>
    /// <param name="checkBoxList"></param>
    private void SetChkControl(string listName, CheckBoxList checkBoxList)
    {
        var list = UserPropertiesListComponent.GetListPerCategory(userId, listName);

        ListItem item;

        foreach (var itemL in list)
        {
            item = checkBoxList.Items.FindByValue(itemL.Key);
            if (item != null)
            {
                item.Selected = true;
            }
        }
    }
Exemple #4
0
    /// <summary>
    /// Load the information of the selected user to edit (edit button) in controls
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
    {
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem edititem = (GridEditFormItem)e.Item;

            RadComboBox ddLanguage = (RadComboBox)edititem.FindControl("ddLanguage");
            var         list       = ListComponent.GetListPerCategory("Language", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddLanguage.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddLanguage.DataSource   = list;
            ddLanguage.DataBind();

            RadComboBox ddCustomerType = (RadComboBox)edititem.FindControl("ddCustomerType");
            list = ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddCustomerType.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddCustomerType.DataSource   = list;
            ddCustomerType.DataBind();

            RadComboBox ddNexsoEnrolment = (RadComboBox)edititem.FindControl("ddNexsoEnrolment");
            list = ListComponent.GetListPerCategory("Source", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddNexsoEnrolment.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddNexsoEnrolment.DataSource   = list;
            ddNexsoEnrolment.DataBind();

            RadComboBox ddUserTheme = (RadComboBox)edititem.FindControl("ddUserTheme");
            list = ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddUserTheme.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddUserTheme.DataSource   = list;
            ddUserTheme.DataBind();

            RadComboBox ddUserBeneficiaries = (RadComboBox)edititem.FindControl("ddUserBeneficiaries");
            list = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddUserBeneficiaries.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddUserBeneficiaries.DataSource   = list;
            ddUserBeneficiaries.DataBind();

            RadComboBox ddUserSector = (RadComboBox)edititem.FindControl("ddUserSector");
            list = ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name).ToList();
            ddUserSector.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile);
            ddUserSector.DataSource   = list;
            ddUserSector.DataBind();

            if (!(e.Item is GridEditFormInsertItem))
            {
                try
                {
                    int UserId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "UserId"));
                    currentUser = DotNetNuke.Entities.Users.UserController.GetUser(PortalSettings.PortalId, UserId, true);
                    RadTextBox txtEmail = (RadTextBox)edititem.FindControl("txtEmail");
                    txtEmail.Text = currentUser.Email;
                    var list2 = UserPropertiesListComponent.GetListPerCategory(UserId, "Theme");
                    foreach (var itemL in list2)
                    {
                        var itemm = (RadComboBoxItem)ddUserTheme.Items.FindItemByValue(itemL.Key);

                        if (itemm != null)
                        {
                            itemm.Checked = true;
                        }
                    }
                    list2 = UserPropertiesListComponent.GetListPerCategory(UserId, "Beneficiaries");
                    foreach (var itemL in list2)
                    {
                        var itemm = (RadComboBoxItem)ddUserBeneficiaries.Items.FindItemByValue(itemL.Key);

                        if (itemm != null)
                        {
                            itemm.Checked = true;
                        }
                    }
                    list2 = UserPropertiesListComponent.GetListPerCategory(UserId, "Sector");
                    foreach (var itemL in list2)
                    {
                        var itemm = (RadComboBoxItem)ddUserSector.Items.FindItemByValue(itemL.Key);
                        if (itemm != null)
                        {
                            itemm.Checked = true;
                        }
                    }

                    if (DataBinder.Eval(e.Item.DataItem, "AllowNexsoNotifications") != null)
                    {
                        int      AllowNexsoNotifications = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "AllowNexsoNotifications"));
                        CheckBox chkNotifications        = (CheckBox)edititem.FindControl("chkNotifications");
                        chkNotifications.Checked = Convert.ToBoolean(AllowNexsoNotifications);
                    }

                    if (DataBinder.Eval(e.Item.DataItem, "Language") != null)
                    {
                        ddLanguage.SelectedValue = DataBinder.Eval(e.Item.DataItem, "Language").ToString();
                    }

                    if (DataBinder.Eval(e.Item.DataItem, "CustomerType") != null)
                    {
                        RadComboBoxItem itemCustomerType = ddCustomerType.Items.FindItemByValue(DataBinder.Eval(e.Item.DataItem, "CustomerType").ToString());
                        if (itemCustomerType != null)
                        {
                            ddCustomerType.SelectedValue = DataBinder.Eval(e.Item.DataItem, "NexsoEnrolment").ToString();
                        }
                    }

                    if (DataBinder.Eval(e.Item.DataItem, "NexsoEnrolment") != null)
                    {
                        RadComboBoxItem itemNexsoEnrolment = ddNexsoEnrolment.Items.FindItemByValue(DataBinder.Eval(e.Item.DataItem, "NexsoEnrolment").ToString());
                        if (itemNexsoEnrolment != null)
                        {
                            ddNexsoEnrolment.SelectedValue = DataBinder.Eval(e.Item.DataItem, "NexsoEnrolment").ToString();
                        }
                    }
                }
                catch
                {
                }
                //Hide Password in editing mode
                RadTextBox txtEmail2 = (RadTextBox)edititem.FindControl("txtEmail");
                txtEmail2.Enabled = false;
                RequiredFieldValidator rfvEmail = (RequiredFieldValidator)edititem.FindControl("rfvEmail");
                rfvEmail.Visible         = false;
                rfvEmail.ValidationGroup = string.Empty;
                RequiredFieldValidator rvPassword = (RequiredFieldValidator)edititem.FindControl("rvPassword");
                rvPassword.Visible         = false;
                rvPassword.ValidationGroup = string.Empty;
            }
        }
    }