public static void DeleteEmployeeDepartmentHistoryEntity(EmployeeDepartmentHistory selectedRecord)
 {
     using (AdventureWorksContext db = new AdventureWorksContext())
     {
         db.Entry(selectedRecord).State = System.Data.Entity.EntityState.Deleted;
         db.SaveChanges();
     }
 }
        public static ObservableCollection<Shift> GetShifts(EmployeeDepartmentHistory selectedItem)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                if (selectedItem != null)
                {
                    List<Shift> query = (from s in db.Shifts
                                         where selectedItem.ShiftID == s.ShiftID
                                         select s).ToList();

                    return new ObservableCollection<Shift>(query);
                }
                else return null;
            }
        }
        public static ObservableCollection<Employee> GetEmployees(EmployeeDepartmentHistory selectedItem)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                if (selectedItem != null)
                {
                    List<Employee> query = (from e in db.Employees
                                            where selectedItem.BusinessEntityID == e.BusinessEntityID
                                            select e).ToList();

                    return new ObservableCollection<Employee>(query);
                }
                else return null;
            }
        }
        public static void EditEmployeeDepartmentHistoryEntity(EmployeeDepartmentHistory employeeDepartmentHistory)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                db.Entry(employeeDepartmentHistory).State = System.Data.Entity.EntityState.Modified;
                try
                {
                    db.SaveChanges();

                }
                catch (Exception e)
                {
                    db.Dispose();
                    throw new Exception("Błędne dane obiektu!!");
                }
            }
        }
        public static void AddEmployeeDepartmentHistoryEntity(EmployeeDepartmentHistory employeeDepartmentHistory)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                db.EmployeeDepartmentHistories.Add(employeeDepartmentHistory);
                try
                {
                    db.SaveChanges();

                }
                catch (Exception e)
                {
                    db.Dispose();
                    throw new Exception("Błędne dane obiektu!!");
                }
            }
        }
Esempio n. 6
0
        public static ObservableCollection <Department> GetDepartments(EmployeeDepartmentHistory selectedItem)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                if (selectedItem != null)
                {
                    List <Department> query = (from d in db.Departments
                                               where selectedItem.DepartmentID == d.DepartmentID
                                               select d).ToList();

                    return(new ObservableCollection <Department>(query));
                }
                else
                {
                    return(null);
                }
            }
        }
Esempio n. 7
0
        public static ObservableCollection <Employee> GetEmployees(EmployeeDepartmentHistory selectedItem)
        {
            using (AdventureWorksContext db = new AdventureWorksContext())
            {
                if (selectedItem != null)
                {
                    List <Employee> query = (from e in db.Employees
                                             where selectedItem.BusinessEntityID == e.BusinessEntityID
                                             select e).ToList();

                    return(new ObservableCollection <Employee>(query));
                }
                else
                {
                    return(null);
                }
            }
        }
 void ChildWindow_Closed(EmployeeDepartmentHistory employeeDepartmentHistory)
 {
     if (Closed != null)
         Closed(employeeDepartmentHistory);
     ChildWindowManager.Instance.CloseChildWindow();
 }