//Validation: /* * Password needs to At least 8 characters long," + * "One lowercase, one uppercase, one number and one special character" + * " No whitespaces * * Username needs to be at least 5 characters * * Check Validation: => */ public EmployeeViewModel() { ShowEmployees = new ShowEmployeesCommand(this); SaveEmployee = new SaveCommand(this); //events = eventAggregator; //events.Subscribe(this); WorkTypes = new ObservableCollection <string> { "SalesPerson", "WareHouseWorker" }; Genders = new ObservableCollection <string> { "Male", "Female" }; Salaries = new ObservableCollection <int>(); Salaries = newSalaries(Salaries); }
public void Run() { IExecutable command = null; var line = Console.ReadLine(); while (line != "end") { var tokens = line.Split(); switch (tokens[0]) { case "create-company": command = new CreateCompanyCommand(this.db, tokens[1], tokens[2], tokens[3], decimal.Parse(tokens[4])); break; case "create-employee": string departmentName = null; if (tokens.Length > 5) { departmentName = tokens[5]; } command = new CreateEmployeeCommand(this.db, tokens[1], tokens[2], tokens[3], tokens[4], departmentName); break; case "create-department": string mainDepartmentName = null; if (tokens.Length > 5) { mainDepartmentName = tokens[5]; } command = new CreateDepartmentCommand(this.db, tokens[1], tokens[2], tokens[3], tokens[4], mainDepartmentName); break; case "pay-salaries": command = new PaySalariesCommand(tokens[1], this.db); break; case "show-employees": command = new ShowEmployeesCommand(tokens[1], this.db); break; } try { Console.Write(command.Execute()); } catch (Exception e) { Console.WriteLine(e.Message); } finally { line = Console.ReadLine(); } } }
public void Run() { IExecutable command = null; string line = Console.ReadLine(); while (line != "end") { string[] tokens = line.Split(); switch (tokens[0]) { case "create-company": command = new CreateCompanyCommand(db, tokens[1], tokens[2], tokens[3], decimal.Parse(tokens[4])); break; case "create-employee": string departmentName = null; if (tokens.Length > 5) { departmentName = tokens[5]; } command = new CreateEmployeeCommand(db, tokens[1], tokens[2], tokens[3], tokens[4], departmentName); break; case "create-department": string mainDepartmentName = null; if (tokens.Length > 5) { mainDepartmentName = tokens[5]; } command = new CreateDepartmentCommand(db, tokens[1], tokens[2], tokens[3], tokens[4], mainDepartmentName); break; case "pay-salaries": command = new PaySalariesCommand(tokens[1], db); break; case "show-employees": command = new ShowEmployeesCommand(tokens[1], db); break; } try { Console.Write(command.Execute()); } catch (Exception e) { Console.WriteLine(e.Message); } finally { line = Console.ReadLine(); } } }