aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Models/PPCPendingUpdate.cs
blob: 12504a1a5ab525e200f1dfbf3fd02678e9c5539e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Tango.MachineService.Models
{
    public class PPCPendingUpdate
    {
        public String Token { get; set; }
        public String TangoUpdateGuid { get; set; }
    }
}
und-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
using 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;
        }
    }
}