示例#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);
        }