public void RegisterNewUser(LoginCredentionals credits, LoginCredentionals newUserCredits, Position position, Person p) { Logger.Info("Trying to register new user..."); if (CheckPermission(credits)) { Console.WriteLine("Registing new user [" + p + "][" + position + "..."); try { Id_Position_Map.Add(p.Id, position); Id_Person_Map.Add(p.Id, p); Id_Login_Map.Add(p.Id, newUserCredits.Username); Login_Id_Map.Add(newUserCredits.Username, p.Id); Login_Password_Map.Add(newUserCredits.Username, newUserCredits.Password); Logger.Info("Regestering new user succeeded."); } catch { Logger.Warn("Registering new user failed."); } } }
public void MockFill() { Person h1 = new Person("admin", "admin", "admin", new DateTime(1990, 11, 3), Person.SexT.Male); Id_Person_Map.Add(h1.Id, h1); Id_Position_Map.Add(h1.Id, Position.Administrator); Login_Password_Map.Add("admin", "admin"); Login_Id_Map.Add("admin", h1.Id); Id_Login_Map.Add(h1.Id, "admin"); Person h2 = new Person("Anrey", "Andreevich", "Tikhonov", new DateTime(1970, 10, 5), Person.SexT.Male); Id_Person_Map.Add(h2.Id, h2); Id_Position_Map.Add(h2.Id, Position.Teacher); Login_Password_Map.Add("teacher", "teacher"); Login_Id_Map.Add("teacher", h2.Id); Id_Login_Map.Add(h2.Id, "teacher"); Id_Subject_Map.Add(h2.Id, Subject.Mathematics); Person h3 = new Person("Petr", "Ivanovich", "Sobolev", new DateTime(1998, 2, 2), Person.SexT.Male); Id_Person_Map.Add(h3.Id, h3); Id_Position_Map.Add(h3.Id, Position.Student); Login_Password_Map.Add("student", "student"); Login_Id_Map.Add("student", h3.Id); Id_Login_Map.Add(h3.Id, "student"); Person h4 = new Person("Anna", "Ivanovna", "Soboleva", new DateTime(1973, 4, 20), Person.SexT.Female); Id_Person_Map.Add(h4.Id, h4); Id_Position_Map.Add(h4.Id, Position.Guest); Login_Password_Map.Add("parent", "parent"); Login_Id_Map.Add("parent", h4.Id); Id_Login_Map.Add(h4.Id, "parent"); Guest_Studednt_Map.Add(h4.Id, h3.Id); }