Example #1
0
 static public bool RemoveGuest(int id)
 {
     return(DataLayer.RemoveGuest(id));
 }
Example #2
0
        static public void Authorization(string login, string password)
        {
            Dictionary <string, object> userInfo = DataLayer.GetUserInfo(login, password);

            if (userInfo == null)
            {
                throw new Exception("Неверный логин и пароль");
            }

            switch (userInfo["userType"].ToString())
            {
            case "guest":
                if (EnterGuest != null)
                {
                    EnterGuest(new Guest
                               (
                                   (int)userInfo["id"],
                                   (int)userInfo["passportNumber"],
                                   (int)userInfo["passportSeries"],
                                   (string)userInfo["name"],
                                   (string)userInfo["surname"],
                                   (string)userInfo["patronymic"],
                                   (string)userInfo["address"],
                                   (string)userInfo["phoneNumber"],
                                   (string)userInfo["login"],
                                   (string)userInfo["password"],
                                   (int)userInfo["citizenship"]
                               ), null);
                }
                break;

            case "employee":
                EnterEmployee(new Employee
                              (
                                  (int)userInfo["id"],
                                  (int)userInfo["passportNumber"],
                                  (int)userInfo["passportSeries"],
                                  (string)userInfo["name"],
                                  (string)userInfo["surname"],
                                  (string)userInfo["patronymic"],
                                  (string)userInfo["address"],
                                  (string)userInfo["phoneNumber"],
                                  (string)userInfo["login"],
                                  (string)userInfo["password"],
                                  (int)userInfo["post"]
                              ), null);
                break;

            case "admin":
                EnterAdministrator(new Admin
                                   (
                                       (int)userInfo["id"],
                                       (int)userInfo["passportNumber"],
                                       (int)userInfo["passportSeries"],
                                       (string)userInfo["name"],
                                       (string)userInfo["surname"],
                                       (string)userInfo["patronymic"],
                                       (string)userInfo["address"],
                                       (string)userInfo["phoneNumber"],
                                       (string)userInfo["login"],
                                       (string)userInfo["password"]
                                   ), null);
                break;
            }
        }