Ejemplo n.º 1
0
 public static Teacher CopyToTeacher(User user)
 {
     return new Teacher
     {
         Id = user.Id,
         Name = user.Name,
         Email = user.Email,
         Address = user.Address,
         PostCode = user.PostCode,
         Phone = user.Phone,
         Type = user.Type,
         Payrole = 0
     };
 }
Ejemplo n.º 2
0
 public EditViewModel(User Editing_User)
 {
     if (Editing_User.Type == (int)User.User_Type.Student)
     {
         Student Current = Student.CopyToStudents(Editing_User);
         Current.GetUser_ByEmail();
         this.Editing_User = Current;
     }
     else if (Editing_User.Type == (int)User.User_Type.Teacher)
     {
         Teacher Current = Teacher.CopyToTeacher(Editing_User);
         Current.GetUser_ByEmail();
         this.Editing_User = Current;
     }
     this.View = new EditView();
 }
Ejemplo n.º 3
0
        public static Student CopyToStudents(User user)
        {
            string dateTime = DateTime.Now.ToString("yyyy-MM-dd");
            DateTime Time = DateTime.Parse(dateTime);

            return new Student {
                Id = user.Id,
                Name = user.Name,
                Email = user.Email,
                Address = user.Address,
                PostCode = user.PostCode,
                Phone = user.Phone,
                Type = user.Type,
                Education_StartDate = Time,
                Education_EndDate = Time
            };
        }
Ejemplo n.º 4
0
 public LoginViewModel()
 {
     LoginUser = new User();
     this.View = new MainLoginView();
 }
Ejemplo n.º 5
0
 private void Registradet(object sender, User NewUser)
 {
     LoginUser = NewUser;
     ((BaseViewModel)sender).Dispose();
     Login();
 }
Ejemplo n.º 6
0
        private void Register()
        {
            if (!String.IsNullOrEmpty(UserEmail))
            {
                try
                {
                    LoginUser.GetUser_ByEmail();
                    ErrorText = "User already exists";
                    ErrorActive = true;
                    LoginUser = new User();
                }
                catch (ArgumentNullException ex)
                {
                    if (ex.Message.Equals("User does not exists\r\nParameter name: Get User info fail"))
                    {
                        ViewWindow RegisterWindow;
                        BaseViewModel RegisterWindow_ViewModel;

                        RegisterWindow = new ViewWindow();
                        RegisterWindow_ViewModel = new RegisterViewModel(LoginUser);
                        ((RegisterViewModel)RegisterWindow_ViewModel).OnUserRegistrated += Registradet;
                        RegisterWindow_ViewModel.ShowInWindow(RegisterWindow);
                    }
                    else
                    {
                        ErrorText = ex.Message;
                        ErrorActive = true;
                    }
                }
                catch (Exception ex)
                {
                    ErrorText = ex.Message;
                    ErrorActive = true;
                }
            }
            else
            {
                ErrorText = "Missing email";
                ErrorActive = true;
            }
        }
Ejemplo n.º 7
0
 public RegisterViewModel(User Register_User)
 {
     RegistrateUser = Register_User;
     UserType = User.User_Type.Student;
     this.View = new RegisterView();
 }
Ejemplo n.º 8
0
 private void User_Login(object sender, User Currentuser)
 {
     ((BaseViewModel)sender).Dispose();
     CurrentUser = Currentuser;
     CurrentView = ViewModes.Editor;
 }
Ejemplo n.º 9
0
 private void User_Edited(object sender, User Currentuser)
 {
     ((BaseViewModel)sender).Dispose();
     CurrentView = ViewModes.Main;
 }
Ejemplo n.º 10
0
 public MainControler()
 {
     CurrentUser = null;
     CurrentView = ViewModes.Main;
     ViewHandler();
 }