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
 private bool SaveChkControl(string listItem, RadComboBox radComboBoxList, int UserId)
 {
     if (UserPropertiesListComponent.deleteListPerCategory(UserId, listItem))
     {
         //string result = string.Empty;
         foreach (RadComboBoxItem item in radComboBoxList.Items)
         {
             if (item.Checked)
             {
                 UserPropertiesListComponent sol = new UserPropertiesListComponent(UserId, item.Value, listItem);
                 sol.Save();
             }
         }
         return(true);
     }
     return(false);
 }
Exemple #5
0
 /// <summary>
 /// Save items (answer) of the registered user
 /// </summary>
 /// <param name="listName">name of the list of answer</param>
 /// <param name="checkBoxList"></param>
 private bool SaveChkControl(string listItem, CheckBoxList checkBoxList)
 {
     if (UserPropertiesListComponent.deleteListPerCategory(userId, listItem))
     {
         string result = string.Empty;
         foreach (ListItem item in checkBoxList.Items)
         {
             if (item.Selected)
             {
                 UserPropertiesListComponent sol = new UserPropertiesListComponent(userId, item.Value, listItem);
                 sol.Save();
             }
         }
         return(true);
     }
     return(false);
 }
Exemple #6
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;
            }
        }
    }
Exemple #7
0
    /// <summary>
    /// Save selected answers by the user in steps 2 to 5. This occurs after clicking Finish
    /// </summary>
    /// <param name="listItem"></param>
    /// <returns></returns>
    private bool SaveRadListView(string listItem)
    {
        if (userId > 0)
        {
            if (UserPropertiesListComponent.deleteListPerCategory(userId, listItem))
            {
                switch (listItem)
                {
                case "Theme":
                    var selected =
                        RadListView1.SelectedItems.Select(
                            item => ((Button)item.FindControl("DeselectButton1")).Text).ToList();
                    var list =
                        ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList();


                    for (int i = 0; i < selected.Count; i++)
                    {
                        int j = 0;
                        for (j = 0; i < list.Count; j++)
                        {
                            if (selected[i] == list[j].Label)
                            {
                                UserPropertiesListComponent sol = new UserPropertiesListComponent(userId,
                                                                                                  list[j].Key,
                                                                                                  listItem);
                                sol.Save();
                                break;
                            }
                        }
                        j = 0;
                    }
                    break;

                case "Beneficiaries":
                    var selected2 =
                        RadListView2.SelectedItems.Select(
                            item => ((Button)item.FindControl("DeselectButton2")).Text).ToList();
                    var list2 =
                        ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name)
                        .ToList();
                    for (int i = 0; i < selected2.Count; i++)
                    {
                        int j = 0;
                        for (j = 0; i < list2.Count; j++)
                        {
                            if (selected2[i] == list2[j].Label)
                            {
                                UserPropertiesListComponent sol = new UserPropertiesListComponent(userId,
                                                                                                  list2[j].Key,
                                                                                                  listItem);
                                sol.Save();
                                break;
                            }
                        }
                        j = 0;
                    }
                    break;

                case "Sector":
                    var selected3 =
                        RadListView3.SelectedItems.Select(
                            item => ((Button)item.FindControl("DeselectButton3")).Text).ToList();
                    var list3 =
                        ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name)
                        .ToList();
                    for (int i = 0; i < selected3.Count; i++)
                    {
                        int j = 0;
                        for (j = 0; i < list3.Count; j++)
                        {
                            if (selected3[i] == list3[j].Label)
                            {
                                UserPropertiesListComponent sol = new UserPropertiesListComponent(userId,
                                                                                                  list3[j].Key,
                                                                                                  listItem);
                                sol.Save();
                                break;
                            }
                        }
                        j = 0;
                    }
                    break;

                case "WhoAreYou":

                    var selected4 =
                        RadListView4.SelectedItems.Select(
                            item => ((Button)item.FindControl("DeselectButton4")).Text).ToList();
                    var list4 =
                        ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name)
                        .ToList();
                    for (int i = 0; i < selected4.Count; i++)
                    {
                        int j = 0;
                        for (j = 0; i < list4.Count; j++)
                        {
                            if (selected4[i] == list4[j].Label)
                            {
                                UserPropertiesListComponent sol = new UserPropertiesListComponent(userId,
                                                                                                  list4[j].Key,
                                                                                                  listItem);
                                sol.Save();
                                break;
                            }
                        }
                        j = 0;
                    }
                    break;

                default:
                    break;
                }
                return(true);
            }
        }
        return(false);
    }