Beispiel #1
0
        public tblUser AddUser(tblUser user)
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    tblUser newUser = new tblUser();
                    newUser.FullName    = user.FullName;
                    newUser.DateOfBirth = user.DateOfBirth;
                    newUser.Mail        = user.Mail;
                    newUser.Username    = user.Username;
                    newUser.Passwd      = user.Passwd;


                    context.tblUsers.Add(newUser);
                    context.SaveChanges();
                    return(newUser);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #2
0
        public tblEmployee AddEmployee(tblEmployee employee)
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    tblEmployee newEmployee = new tblEmployee();
                    newEmployee.HotelFloor  = employee.HotelFloor;
                    newEmployee.Citizenship = employee.Citizenship;
                    newEmployee.Engagement  = employee.Engagement;
                    newEmployee.Gender      = employee.Gender;
                    newEmployee.Salary      = employee.Salary;
                    newEmployee.UserId      = employee.UserId;

                    context.tblEmployees.Add(newEmployee);
                    context.SaveChanges();

                    return(newEmployee);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #3
0
        public tblManager AddManager(tblManager manager)
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    tblManager newManager = new tblManager();
                    newManager.HotelFloor          = manager.HotelFloor;
                    newManager.Experience          = manager.Experience;
                    newManager.QualificationsLevel = manager.QualificationsLevel;
                    newManager.UserId = manager.UserId;


                    context.tblManagers.Add(newManager);
                    context.SaveChanges();

                    return(newManager);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #4
0
        public List <tblUser> GetUsers()
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    List <tblUser> list = new List <tblUser>();
                    list = (from x in context.tblUsers select x).ToList();

                    return(list);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #5
0
        public tblEmployee GetEmloyeByUserId(int UserId)
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    tblEmployee user = (from x in context.tblEmployees
                                        where x.UserId == UserId
                                        select x).First();

                    return(user);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #6
0
        public tblUser GetGetEployeeByUserNameAndPass(string userName, string password)
        {
            try
            {
                using (HotelDataBaseEntities context = new HotelDataBaseEntities())
                {
                    tblUser user = (from x in context.tblUsers
                                    where x.Username == userName &&
                                    x.Passwd == password
                                    select x).First();

                    return(user);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Exception" + ex.Message.ToString());
                return(null);
            }
        }
Beispiel #7
0
 public PhoneNumbersTypesRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #8
0
 public StaffsPhoneNumbersRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #9
0
 public HotelStaffRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #10
0
 public EmployeesPositionsRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #11
0
 public RoomClassesRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #12
0
 public OrderRegistrationRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
 public OrderStatusesRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
 public PaymentMethodsRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #15
0
 public StaffsPassportsRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #16
0
 public ContextUnitOfWork()
 {
     db = new HotelDataBaseEntities();
 }
 public HotelsRoomRegistrationRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
Beispiel #18
0
 public HotelGuestsRepository(HotelDataBaseEntities context)
 {
     db = context;
 }
 public GuestPassportsRepository(HotelDataBaseEntities context)
 {
     db = context;
 }