blob: 08762ac96df443e50b2cc8ea5eff8c5786aea25b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24pre { line-height: 125%; }
td.linenos .normal { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
span.linenos { color: inherit; background-color: transparent; padding-left: 5px; padding-right: 5px; }
td.linenos .special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
span.linenos.special { color: #000000; background-color: #ffffc0; padding-left: 5px; padding-right: 5px; }
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .ges { font-weight: bold; font-style: italic } /* Generic.EmphStrong */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { colousing System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SimpleValidator.Extensions;
using Tango.SharedUI;
namespace Tango.MachineStudio.UsersAndRoles.ViewModels
{
public class UserCreationDialogVM : DialogViewVM
{
private static Random rnd = new Random();
private String _email;
[Required(ErrorMessage = "Email is required")]
[EmailAddress(ErrorMessage = "Please provide a valid email")]
public String Email
{
get { return _email; }
set { _email = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
private String _password;
public String Password
{
get { return _password; }
set { _password = value; RaisePropertyChangedAuto(); }
}
private String _firstName;
[Required(ErrorMessage = "First name is required")]
public String FirstName
{
get { return _firstName; }
set { _firstName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
private String _lastName;
[Required(ErrorMessage = "Last name is required")]
public String LastName
{
get { return _lastName; }
set { _lastName = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
protected override void Accept()
{
if (Validate())
{
base.Accept();
}
}
public override void OnShow()
{
base.OnShow();
Password = GetRandomPassword(4);
}
private String GetRandomPassword(int count)
{
String pass = String.Empty;
for (int i = 0; i < count; i++)
{
pass += rnd.Next(0, 9).ToString();
}
return pass;
}
}
}
|