Пример #1
0
        public void AddEmployee(Employee employee)
        {
            if (employee.FirstName == null || employee.LastName == null || employee.Phone == default(long) || employee.Departament == null)
            {
                throw new UnfilledInstanceExeption();
            }

            var dep = employee.Departament;

            if (dep is Departament)
            {
                SimpleDepartament.AddEmployee(employee);
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.AddEmployee(employee);
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.AddEmployee(employee);
            }

            // BankDB.AddEmployee(connectionStringBuilder, employee);
            Employees.Add(employee);
        }
Пример #2
0
        public void FillTreeViewEmployees(TreeView tv)
        {
            var tvItemD = new TreeViewItem();

            SimpleDepartament.Fill();
            tvItemD.Header      = SimpleDepartament.Name;
            tvItemD.ItemsSource = SimpleDepartament.Employees;
            tv.Items.Add(tvItemD);

            var tvItemED = new TreeViewItem();

            EntityDepartament.Fill();
            tvItemED.Header      = EntityDepartament.Name;
            tvItemED.ItemsSource = EntityDepartament.Employees;
            tv.Items.Add(tvItemED);

            var tvItemV = new TreeViewItem();

            VipDepartament.Fill();
            tvItemV.Header      = VipDepartament.Name;
            tvItemV.ItemsSource = VipDepartament.Employees;
            tv.Items.Add(tvItemV);

            Employees = GetEmployees();
        }
Пример #3
0
        public void DeleteEmployee(Employee employee)
        {
            var dep = employee.Departament;

            if (dep is Departament)
            {
                SimpleDepartament.RemoveEmployee(employee);
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.RemoveEmployee(employee);
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.RemoveEmployee(employee);
            }

            Employees.Remove(employee);
        }
Пример #4
0
        public void AddEmployee(Employee employee)
        {
            var dep = employee.Departament;

            if (dep is Departament)
            {
                SimpleDepartament.AddEmployee(employee);
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.AddEmployee(employee);
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.AddEmployee(employee);
            }

            Employees.Add(employee);
        }
Пример #5
0
        public void DeleteEmployee(Employee employee)
        {
            BankDB.DeleteEmployee(connectionStringBuilder, employee);
            var dep = employee.Departament;

            if (dep is Departament)
            {
                SimpleDepartament.RemoveEmployee(employee);
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.RemoveEmployee(employee);
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.RemoveEmployee(employee);
            }

            Employees.Remove(employee);
        }
Пример #6
0
        public void AddEmployee(Employee employee, TreeView tv)
        {
            var dep = employee.Departament;

            AddEmployee(employee);

            if (dep is Departament)
            {
                SimpleDepartament.AddEmployee(employee);
                (tv.Items[0] as TreeViewItem).ItemsSource = SimpleDepartament.Employees;
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.AddEmployee(employee);
                (tv.Items[1] as TreeViewItem).ItemsSource = VipDepartament.Employees;
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.AddEmployee(employee);
                (tv.Items[2] as TreeViewItem).ItemsSource = EntityDepartament.Employees;
            }
        }
Пример #7
0
        public void DeleteEmployee(Employee employee, TreeView tv)
        {
            BankDB.DeleteEmployee(connectionStringBuilder, employee);
            var dep = employee.Departament;


            if (dep is Departament)
            {
                SimpleDepartament.RemoveEmployee(employee);
                (tv.Items[0] as TreeViewItem).ItemsSource = SimpleDepartament.Employees;
            }
            else if (dep is VIPDepartament)
            {
                VipDepartament.RemoveEmployee(employee);
                (tv.Items[1] as TreeViewItem).ItemsSource = VipDepartament.Employees;
            }
            else if (dep is LegalDepartament)
            {
                EntityDepartament.RemoveEmployee(employee);
                (tv.Items[2] as TreeViewItem).ItemsSource = EntityDepartament.Employees;
            }

            Employees.Remove(employee);
        }