public async Task <IdentityResult> EnsureAdminUserExists() { /*To ensure Admin post this in postman*/ /*{ * "AdminEmail": "*****@*****.**", * "AdminPassword": "******" * }*/ var user = new EmployeeAuthentication() { Email = AdminUserEmail, UserName = AdminUserEmail, Employee = new Employee() { SchoolId = null, FirstName = AdminUserFirstName, LastName = AdminUserLastName, Email = AdminUserEmail, HireDate = DateTime.UtcNow, IsAdmin = true, } }; var response = await _userManager.CreateAsync(user, "P@ss0wrd!"); return(response);; }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); EmployeeAuthentication auth = new EmployeeAuthentication(); auth.Login("*****@*****.**", "ondra"); //Application.Run(new Form1()); Application.Run(new UserList(auth)); }
public UserList(EmployeeAuthentication auth) { this.auth = auth; InitializeComponent(); this.Visible = true; employeeList = Employee.getList(); foreach (Employee emp in employeeList) { employeeListBox.Items.Add(emp.FirstName + " " + emp.LastName); } }
public CarList(EmployeeAuthentication auth) { this.auth = auth; InitializeComponent(); this.Visible = true; carList = Car.getList(); foreach (Car car in carList) { carListBox.Items.Add("ID: " + car.ID + " Název: " + car.Name + " Typ: " + car.Type + " Email: " + car.user.Email); } }
public async Task <IdentityResult> RegisterEmployee(EmployeeToRegister employeeToRegister) { var employee = new EmployeeAuthentication() { UserName = employeeToRegister.Email, Email = employeeToRegister.Email, Employee = new Employee() { SchoolId = employeeToRegister.SchoolId, FirstName = employeeToRegister.FirstName, LastName = employeeToRegister.LastName, Email = employeeToRegister.Email, HireDate = DateTime.UtcNow, IsAdmin = false, } }; var response = await _userManager.CreateAsync(employee, employeeToRegister.Password); return(response); }
private void Login_Click(object sender, EventArgs e) { EmployeeAuthentication auth = new EmployeeAuthentication(); if (auth.Login(Email.Text, Password.Text)) { /*Home home = new Home(auth); * home.ShowDialog();*/ var frm = new CarList(auth); frm.Location = this.Location; frm.StartPosition = FormStartPosition.Manual; frm.FormClosing += delegate { this.Show(); }; frm.Show(); this.Hide(); } else { ErrorMessage.Visible = true; } }
public Home(EmployeeAuthentication auth) { this.auth = auth; InitializeComponent(); //test.Text = auth.employee.FirstName; }
static void Main(string[] args) { try { Employee test = Employee.GetByID(2); Console.WriteLine(test.ID); Console.WriteLine(test.FirstName); Console.WriteLine(test.LastName); Console.WriteLine(test.address.PSC); Console.WriteLine(test.SalaryValue); Console.WriteLine(test.isAdmin); Console.WriteLine(test.salaryList[1].Hours); } catch { Console.WriteLine("Zadny zaznam"); } List <Employee> list = Employee.getList(); foreach (Employee emp in list) { Console.WriteLine(emp.ID); Console.WriteLine(emp.FirstName); Console.WriteLine(emp.LastName); Console.WriteLine(emp.address.Street); Console.WriteLine(emp.SalaryValue); } EmployeeAuthentication auth = new EmployeeAuthentication(); if (auth.Login("*****@*****.**", "ondra1")) { Console.WriteLine("Login succes"); } else { Console.WriteLine("Login failed"); } if (auth.Login("*****@*****.**", "ondra")) { Console.WriteLine("Login succes"); Console.WriteLine(auth.employee.Email); } else { Console.WriteLine("Login failed"); } List <Car> cars = Car.getCarsByUserID(1); foreach (Car car in cars) { Console.WriteLine(car.user.Email); } Employee test2 = Employee.GetByID(2); SalaryCalculator calc = new SalaryCalculator(); List <SalaryResultDTO> res = calc.getSalaryForEmployee(test2); foreach (SalaryResultDTO r in res) { Console.WriteLine(r.GrossWage); Console.WriteLine(r.Wage); } Console.WriteLine("AUKCE TEST!!!"); User user = User.GetByID(2); Car b = Car.getCarByID(1); //Car.toXML(); foreach (Car c in Car.loadFromXML()) { Console.WriteLine(c.Name); } //b.Insert(); UserAuthentication ua = new UserAuthentication(); //Console.WriteLine(ua.Login("*****@*****.**", "michal")); }