Ejemplo n.º 1
0
        private void resetClientPassword(string id)
        {
            var tmp = _crepo.getByUsername(id);
            var pwd = _tools.passwordGen(10);

            tmp.Password = _tools.passwordHash(pwd);
            var email = new ComMails();

            email.Email = new List <string>();
            email.Email.Add(tmp.Email);
            email.Message  = "Please find below, your credentials to NRP Portal:<br/>Sign in as Client<br/>";
            email.Message += "Username " + tmp.Username + "<br/>Password: " + pwd;
            _comMail.SendMailToPar(email);
            _crepo.update(tmp.ClientContactInfoId, tmp);
        }
Ejemplo n.º 2
0
        public bool add(Employee employee)
        {
            var tmp = new ComMails();
            var rnd = new Random();
            var pwd = _passwordTools.passwordGen(10);

            employee.Username = employee.FirstName[0] + employee.LastName + rnd.Next(employee.LastName.Length * 1000).ToString();
            employee.Password = _passwordTools.passwordHash(pwd);
            tmp.Email         = new List <string>();
            tmp.Email.Add(employee.Email);
            tmp.Message  = "Please find below, your credentials to NRP Portal:<br/>Sign in as Employee<br/>";
            tmp.Message += "Username " + employee.Username + "<br/>Password: " + pwd;
            _comMail.SendMailToPar(tmp);
            try
            {
                _context.Employees.Add(employee);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        public bool add(ClientContactInfo clientContact)
        {
            var tmp = new ComMails();
            var rnd = new Random();
            var pwd = _passwordTools.passwordGen(10);

            clientContact.Username = clientContact.FirstName[0] + clientContact.LastName + rnd.Next(clientContact.LastName.Length * 1000).ToString();
            clientContact.Password = _passwordTools.passwordHash(pwd);
            tmp.Email = new List <string>();
            tmp.Email.Add(clientContact.Email);
            tmp.Message  = "Please find below, your credentials to NRP Portal:<br/>Sign in as Client<br/>";
            tmp.Message += "Username " + clientContact.Username + "<br/>Password: " + pwd;
            _comMail.SendMailToPar(tmp);
            try
            {
                clientContact.Date = DateTime.Now;
                _context.ClientContactInfos.Add(clientContact);
                _context.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(false);
            }
            return(true);
        }