protected void ibtnEdit_Click(object sender, EventArgs e) { if (IsChallengeFiles) { LinkButton ee = (LinkButton)sender; string documentId = (string)ee.CommandArgument; DocumentId = new Guid(documentId); challengeFileComponent = new ChallengeFileComponent(new Guid(documentId)); WizardFile.ActiveStepIndex = 1; txtFileName.Text = challengeFileComponent.ChallengeFile.ObjectName; lblExtension.Text = challengeFileComponent.ChallengeFile.ObjectExtension; var list = ListComponent.GetListPerCategory("ChallengeFile", Thread.CurrentThread.CurrentCulture.Name).FirstOrDefault(a => a.Label == challengeFileComponent.ChallengeFile.ObjectType); ddCategory.SelectedValue = list.Key; } else { LinkButton ee = (LinkButton)sender; string documentId = (string)ee.CommandArgument; DocumentId = new Guid(documentId); documentComponent = new DocumentComponent(new Guid(documentId)); WizardFile.ActiveStepIndex = 1; ddCategory.SelectedValue = documentComponent.Document.Category; txtTitle.Text = documentComponent.Document.Title; txtFileName.Text = documentComponent.Document.Name; lblExtension.Text = documentComponent.Document.FileType; txtDescription.Text = documentComponent.Document.Description; rdbScope.SelectedValue = documentComponent.Document.Scope; } UpdateFile.Visible = true; CreateFile.Visible = false; }
/// <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; }
public static List <ListItemModel> GetListsFromCategory(string category, CultureInfo culture) { List <ListItemModel> _return = new List <ListItemModel>(); var list = ListComponent.GetListPerCategory(category, culture.Name).ToList(); foreach (var item in list) { _return.Add(new ListItemModel() { Category = item.Category, Key = item.Key, Culture = item.Culture, Order = item.Order, Value = item.Value } ); } return(_return); }
//private void PopulateData() //{ // if (!IsPostBack) // { // BindData(); // } // else // { // BindData(); // } // if (UserController.GetCurrentUserInfo().IsInRole("Administrators") || // UserController.GetCurrentUserInfo().IsInRole("NexsoSupport")) // { // BindData(); // } //} /// <summary> /// Obtener lista de elementos (respuesta) para los pasos 2 a 5 del asistente /// </summary> private void BindData() { var list = ListComponent.GetListPerCategory("Theme", Thread.CurrentThread.CurrentCulture.Name).ToList(); RadListView1.DataSource = list.Where(x => !x.Key.Contains("ctm_")).ToList(); RadListView1.DataBind(); list = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList(); RadListView2.DataSource = list; RadListView2.DataBind(); list = ListComponent.GetListPerCategory("Sector", Thread.CurrentThread.CurrentCulture.Name).ToList(); RadListView3.DataSource = list; RadListView3.DataBind(); list = ListComponent.GetListPerCategory("WhoAreYou", Thread.CurrentThread.CurrentCulture.Name).ToList(); RadListView4.DataSource = list; RadListView4.DataBind(); //If users is login load the list with its answer if (userId >= 0) { if (!IsPostBack) { SetChkControl("Theme", RadListView1); SetChkControl("Beneficiaries", RadListView2); SetChkControl("Sector", RadListView3); SetChkControl("WhoAreYou", RadListView4); txtEmail.Text = currentUser.Email; txtFirstName.Text = WebUtility.HtmlDecode(currentUser.FirstName); txtLastName.Text = WebUtility.HtmlDecode(currentUser.LastName); CountryStateCityEditMode.SelectedCity = userPropertyComponent.UserProperty.City; CountryStateCityEditMode.SelectedCountry = userPropertyComponent.UserProperty.Country; CountryStateCityEditMode.SelectedState = userPropertyComponent.UserProperty.Region; CountryStateCityEditMode.SelectedAddress = userPropertyComponent.UserProperty.Address; CountryStateCityEditMode.UpdateMap(); } } SetupWizard(Wizard1.ActiveStepIndex); }
/// <summary> /// Load categories to the dropdownlist /// </summary> public void FillDataRepeater() { if (IsChallengeFiles) { List <NestedFile> nestedFiles = new List <NestedFile>(); List <List> list = ListComponent.GetListPerCategory("ChallengeFile", Thread.CurrentThread.CurrentCulture.Name).ToList(); List <ChallengeFile> fileList = null; DocumentsLoaded = 0; foreach (var item in list) { fileList = ChallengeFileComponent.GetFilesForChallenge(ChallengeReference, item.Label).ToList().Where(a => a.Delete == false || a.Delete == null).ToList(); if (fileList.Count > 0) { nestedFiles.Add(new NestedFile() { files = fileList, list = item }); DocumentsLoaded = DocumentsLoaded + fileList.Count; } } if (nestedFiles.Count > 0) { lblEmptyMessage.Visible = false; } else { lblEmptyMessage.Visible = true; } rCategory.DataSource = nestedFiles; rCategory.DataBind(); } else { List <NestedDocument> nestedDocuments = new List <NestedDocument>(); List <List> list = ListComponent.GetListPerCategory("FileCategory", Thread.CurrentThread.CurrentCulture.Name).ToList(); List <Document> documentList = null; DocumentsLoaded = 0; foreach (var item in list) { if (Folders != null) { foreach (var item2 in Folders) { documentList = DocumentComponent.GetDocuments(SolutionId, item.Key, item2); if (documentList.Count > 0) { nestedDocuments.Add(new NestedDocument() { documents = documentList, list = item }); DocumentsLoaded = DocumentsLoaded + documentList.Count; } } } else { documentList = DocumentComponent.GetDocuments(SolutionId, item.Key, Folder); if (documentList.Count > 0) { nestedDocuments.Add(new NestedDocument() { documents = documentList, list = item }); DocumentsLoaded = DocumentsLoaded + documentList.Count; } } } if (nestedDocuments.Count > 0) { lblEmptyMessage.Visible = false; } else { lblEmptyMessage.Visible = true; } rCategory.DataSource = nestedDocuments; rCategory.DataBind(); } }
/// <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_ItemCreatedAndEdit(object sender, Telerik.Web.UI.GridItemEventArgs e) { if (e.Item is GridEditFormItem && e.Item.IsInEditMode) { GridEditFormItem edititem = (GridEditFormItem)e.Item; RadComboBox ddOrganizationType = (RadComboBox)edititem.FindControl("ddOrganizationType"); var list2 = ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList(); ddOrganizationType.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile); List <List> list = new List <List>(); List listad = new List(); listad.Culture = Localization.GetString("NewOrganizationType", this.LocalResourceFile); listad.Label = Localization.GetString("NewOrganizationType", this.LocalResourceFile); listad.Key = Localization.GetString("NewOrganizationType", this.LocalResourceFile); listad.Value = "0"; list.Add(listad); list.AddRange(ListComponent.GetListPerCategory("Beneficiaries", Thread.CurrentThread.CurrentCulture.Name).ToList()); ddOrganizationType.DataSource = list; ddOrganizationType.DataBind(); ddOrganizationType.Items.Insert(0, new RadComboBoxItem(Localization.GetString("NewOrganizationType", this.LocalResourceFile), string.Empty)); RadComboBox ddLanguage = (RadComboBox)edititem.FindControl("ddLanguage"); list = ListComponent.GetListPerCategory("Language", Thread.CurrentThread.CurrentCulture.Name).ToList(); ddLanguage.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile); ddLanguage.DataSource = list; ddLanguage.DataBind(); ddLanguage.Items.Insert(0, new RadComboBoxItem(Localization.GetString("NewOrganizationType", this.LocalResourceFile), string.Empty)); RadComboBox ddCountry = (RadComboBox)edititem.FindControl("ddCountry"); fillCountries(ddCountry); if (!(e.Item is IGridInsertItem)) { foreach (RadComboBoxItem item in ddOrganizationType.Items) { try { string OrganizationType = DataBinder.Eval(e.Item.DataItem, "OrganizationType").ToString(); string itemText = item.Text; if (OrganizationType != string.Empty) { if (OrganizationType == itemText) { NewOragnizationType = false; ddOrganizationType.SelectedValue = DataBinder.Eval(e.Item.DataItem, "OrganizationType").ToString(); return; } else { NewOragnizationType = true; } } } catch { } } if (DataBinder.Eval(e.Item.DataItem, "Language") != null) { ddLanguage.SelectedValue = DataBinder.Eval(e.Item.DataItem, "Language").ToString(); } if (DataBinder.Eval(e.Item.DataItem, "Country") != null) { try { foreach (RadComboBoxItem item in ddCountry.Items) { if (item.Text == DataBinder.Eval(e.Item.DataItem, "Country").ToString()) { ddCountry.Text = item.Text; item.Checked = true; item.Selected = true; } if (item.Value == DataBinder.Eval(e.Item.DataItem, "Country").ToString()) { ddCountry.SelectedValue = DataBinder.Eval(e.Item.DataItem, "Country").ToString(); } } } catch { } } RadTextBox txtNewOrganizationType = (RadTextBox)edititem.FindControl("txtNewOrganizationType"); if (NewOragnizationType == true) { ddOrganizationType.SelectedValue = Localization.GetString("NewOrganizationType", this.LocalResourceFile).ToString(); ddOrganizationType.Text = Localization.GetString("NewOrganizationType", this.LocalResourceFile).ToString(); txtNewOrganizationType.Text = DataBinder.Eval(e.Item.DataItem, "OrganizationType").ToString(); txtNewOrganizationType.Style.Add("display", "block!important"); } else { txtNewOrganizationType.Style.Add("display", "none!important"); } } } }
/// <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; } } }
/// ----------------------------------------------------------------------------- /// <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); } }
/// <summary> /// Load information to the grid. This method allows you to filter and sort the grid by various parameters (fisrtname, email, permissions, todate, fromdate). /// </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 rdEmail = (RadComboBox)edititem.FindControl("rdEmail"); MIFNEXSOEntities nx = new MIFNEXSOEntities(); rdEmail.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile); rdEmail.DataSource = nx.UserProperties.ToList(); rdEmail.DataBind(); RadComboBox rdPermisionLevel = (RadComboBox)edititem.FindControl("rdPermisionLevel"); var list = ListComponent.GetListPerCategory("PermisionLevel", Thread.CurrentThread.CurrentCulture.Name).ToList(); rdPermisionLevel.EmptyMessage = Localization.GetString("SelectItem", this.LocalResourceFile); rdPermisionLevel.DataSource = list; rdPermisionLevel.DataBind(); CheckBoxList cblSolutions = (CheckBoxList)edititem.FindControl("cblSolutions"); var listSolutionsAux = SolutionComponent.GetPublishSolutionPerChallenge(challenge).Where(x => x.Deleted == false || x.Deleted == null).OrderBy(x => x.Title); List <Generic> listGeneric = new List <Generic>(); int count = 1; foreach (var item in listSolutionsAux) { var text = "<span style=\"margin-right:1em;\"><b>" + count.ToString() + ".</b></span><a href='" + NexsoHelper.GetCulturedUrlByTabName("solprofile") + "/sl/" + item.SolutionId + "' Target=\"_blank\" style=\"color:#3786bd;\">" + item.Title + "<a> - " + item.Language; listGeneric.Add(new Generic { Id = item.SolutionId, Text = text }); count++; } cblSolutions.DataSource = listGeneric; cblSolutions.DataBind(); if (!(e.Item is GridEditFormInsertItem)) { try { int UserId = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "UserId")); var userProfile = new UserPropertyComponent(UserId); string challengeJudgeId = DataBinder.Eval(e.Item.DataItem, "ChallengeJudgeId").ToString(); challengeJudgeComponent = new ChallengeJudgeComponent(new Guid(challengeJudgeId)); TextBox txtEmail = (TextBox)edititem.FindControl("txtEmail"); txtEmail.Text = userProfile.UserProperty.email; txtEmail.Enabled = false; txtEmail.Visible = true; rdEmail.Visible = false; RequiredFieldValidator rfvrdEmail = (RequiredFieldValidator)edititem.FindControl("rfvrdEmail"); rfvrdEmail.Visible = false; rfvrdEmail.ValidationGroup = string.Empty; var itemm = (RadComboBoxItem)rdPermisionLevel.Items.FindItemByValue(challengeJudgeComponent.ChallengeJudge.PermisionLevel); if (itemm != null) { itemm.Selected = true; itemm.Checked = true; } var itemmaux = (RadComboBoxItem)rdEmail.Items.FindItemByValue(userProfile.UserProperty.UserId.ToString()); if (itemmaux != null) { itemmaux.Selected = true; itemmaux.Checked = true; } RadDatePicker dtFromDate = (RadDatePicker)edititem.FindControl("dtFromDate"); dtFromDate.SelectedDate = Convert.ToDateTime(challengeJudgeComponent.ChallengeJudge.FromDate); RadDatePicker dtToDate = (RadDatePicker)edititem.FindControl("dtToDate"); dtToDate.SelectedDate = Convert.ToDateTime(challengeJudgeComponent.ChallengeJudge.ToDate); var listJudgesAssignations = challengeJudgeComponent.ChallengeJudge.JudgesAssignations.ToList(); SetChkControl(listJudgesAssignations, cblSolutions); } catch { } } } }
/// <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); }