Пример #1
0
        public static bool AddLibrarian(Librarian librarian, string login, string password)
        {
            bool isUserInTable = IsUserInTable(librarian);

            if (!isUserInTable)
            {
                long cardNumber = CredentialsDataManager.AddUserCredentials(login, password);
                librarian.CardNumber = cardNumber;
                DatabaseHelper.Execute("dbo.spLibrarians_AddLibrarian @FirstName, @SecondName, @CardNumber, @Phone, @Address, @Authority",
                                       new
                {
                    FirstName  = librarian.FirstName,
                    SecondName = librarian.SecondName,
                    CardNumber = librarian.CardNumber,
                    Phone      = librarian.Phone,
                    Address    = librarian.Address,
                    Authority  = librarian.Authority
                });
            }
            return(!isUserInTable);
        }
Пример #2
0
        public static bool AddGuest(Guest guest, string login, string password)
        {
            bool isUserInTable = IsUserInTable(guest);

            if (!isUserInTable)
            {
                long cardNumber = CredentialsDataManager.AddUserCredentials(login, password);
                guest.CardNumber = cardNumber;
                DatabaseHelper.Execute("dbo.spPatrons_AddPatron @FirstName, @SecondName, @CardNumber, @Phone, @Address, @Priority, @Type",
                                       new
                {
                    FirstName  = guest.FirstName,
                    SecondName = guest.SecondName,
                    CardNumber = guest.CardNumber,
                    Phone      = guest.Phone,
                    Address    = guest.Address,
                    Priority   = guest.Priority,
                    Type       = "Guest"
                });
            }
            return(!isUserInTable);
        }
Пример #3
0
        public static bool AddFaculty(Faculty faculty, string login, string password)
        {
            bool isUserInTable = IsUserInTable(faculty);

            if (!isUserInTable)
            {
                long cardNumber = CredentialsDataManager.AddUserCredentials(login, password);
                faculty.CardNumber = cardNumber;
                DatabaseHelper.Execute("dbo.spPatrons_AddPatron @FirstName, @SecondName, @CardNumber, @Phone, @Address, @Priority, @Type",
                                       new
                {
                    FirstName  = faculty.FirstName,
                    SecondName = faculty.SecondName,
                    CardNumber = faculty.CardNumber,
                    Phone      = faculty.Phone,
                    Address    = faculty.Address,
                    Priority   = faculty.Priority,
                    Type       = "Faculty"
                });
            }
            return(!isUserInTable);
        }
Пример #4
0
 public static void DeleteUser(long userId)
 {
     CredentialsDataManager.DeleteUserCredentials(userId);
     DatabaseHelper.Execute("dbo.spUsers_DeleteUser @CardNumber", GetUserById(userId));
 }