using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Web.Helpers; namespace EnVisage.Models { public class ActivationUserModel : RegisterUserModel { [Required] [MaxLength(100)] [DataType(DataType.Password)] [Display(Name = "Password")] public string Password { get; set; } [Required] [MaxLength(100)] [DataType(DataType.Password)] [Display(Name = "Confirmation password")] [Compare("Password")] public string ConfirmationPassword { get; set; } public string UserId { get; set; } } public class PagePreferencesList { public enum ItemType { Int=0, String=1, Bool=2 } public enum PagePreferencesSource { Home_Index = 0, View_Board, Team_Board, Capacity_Management, Project_Index } private static Dictionary GetPages(string dataString) { Dictionary values; try { values = Json.Decode>(dataString); } catch (Exception) { values = new Dictionary(); } return values ?? new Dictionary(); } public static string GetPage(string dataString, string key) { var values = GetPages(dataString); return values.ContainsKey(key) ? values[key] : string.Empty; } public static string SetPagePreferences(string dataString, string pageKey, string data) { Dictionary values; try { values = Json.Decode>(dataString); } catch (Exception) { values = new Dictionary(); } if (string.IsNullOrEmpty(dataString) || values == null) values = new Dictionary(); if (values.ContainsKey(pageKey)) values[pageKey] = data; else values.Add(pageKey, data); return Json.Encode(values); } } }