Ejemplo n.º 1
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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
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);
    }