79 lines
2.3 KiB
C#
79 lines
2.3 KiB
C#
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<string, string> GetPages(string dataString)
|
|
{
|
|
Dictionary<string, string> values;
|
|
try
|
|
{
|
|
values = Json.Decode<Dictionary<string, string>>(dataString);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
values = new Dictionary<string, string>();
|
|
}
|
|
|
|
return values ?? new Dictionary<string, string>();
|
|
}
|
|
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<string, string> values;
|
|
try
|
|
{
|
|
values = Json.Decode<Dictionary<string, string>>(dataString);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
values = new Dictionary<string, string>();
|
|
}
|
|
if (string.IsNullOrEmpty(dataString) || values == null)
|
|
values = new Dictionary<string, string>();
|
|
if (values.ContainsKey(pageKey))
|
|
values[pageKey] = data;
|
|
else
|
|
values.Add(pageKey, data);
|
|
return Json.Encode(values);
|
|
}
|
|
}
|
|
} |