public void DepartmentRepoSetup()
 {
     _dbController  = new TestDbController();
     _instance      = DepartmentRepo.GetInstance(_dbController, practitioners);
     _departmentOne = new Department("TestDepartmentOne", "TestAddressOne");
     _departmentTwo = new Department("TestDepartmentTwo", "TestAddressTwo");
 }
Exemple #2
0
        static void Main(string[] args)
        {
            var repo         = new DepartmentRepo();
            var ITDepartment = repo.GetDepartmentById(1);

            Console.WriteLine(ITDepartment.ID + " " + ITDepartment.Name + " " + ITDepartment.Instructor);

            var nd = repo.GetDepartmentByName("HR");

            Console.WriteLine("====================");
            Console.WriteLine(nd.Name);

            var all = repo.GetAllDepartments();

            Console.WriteLine("====================");
            Console.WriteLine("All Departments");
            foreach (var item in all)
            {
                Console.WriteLine(item.Name);
            }

            var highest = repo.GetHighestDepartment();

            Console.WriteLine("=====================");
            Console.WriteLine("The highest budget department is: " + highest.Name);
            Console.ReadLine();
        }
Exemple #3
0
        public List <DepartmentLookupBySupId> GetDepartmentsBySupId(int id)
        {
            DepartmentRepo repo = new DepartmentRepo();
            List <DepartmentLookupBySupId> dep = repo.GetDepartmentsBySupId(id);

            return(dep);
        }
        public static void LoadDepartments(ref ComboBox dropDown, bool includeAll = false)
        {
            var repo     = new DepartmentRepo();
            var allItems = repo.GetAllDepartments();

            if (includeAll)
            {
                allItems.Insert(0, new Department
                {
                    DepartmentName = "All Departments",
                    Id             = Base.IdForSelectAll
                });
            }
            else
            {
                allItems.Insert(0, new Department
                {
                    DepartmentName = "Select Department",
                    Id             = Base.IdForSelect
                });
            }

            dropDown.DataSource    = allItems;
            dropDown.DisplayMember = "DepartmentName";
            dropDown.ValueMember   = "Id";
            dropDown.SelectedIndex = 0;
        }
Exemple #5
0
        public List <Department> GetAllDepartmentsAllInfo()
        {
            DepartmentRepo    repo        = new DepartmentRepo();
            List <Department> departments = repo.GetDepartmentsAllInfo();

            return(departments);
        }
Exemple #6
0
        public List <JobLookup> GetAllJobsByDepartmentId(int departmentId)
        {
            DepartmentRepo   repo = new DepartmentRepo();
            List <JobLookup> jobs = repo.GetJobsByDepartmentId(departmentId);

            return(jobs);
        }
Exemple #7
0
        public List <DepartmentLookup> GetAllDepartments()
        {
            DepartmentRepo          repo        = new DepartmentRepo();
            List <DepartmentLookup> departments = repo.GetDepartments();

            return(departments);
        }
Exemple #8
0
        public Department GetDepartmentBySupId(int id)
        {
            DepartmentRepo repo = new DepartmentRepo();

            _d = repo.GetDepartmentBySupId(id);
            return(_d);
        }
Exemple #9
0
        public void ShouldUpdateARangeOfDepartmentEntities()
        {
            var categories = new List <Department>
            {
                new Department {
                    Name = "Foo"
                },
                new Department {
                    Name = "Bar"
                },
                new Department {
                    Name = "FooBar"
                }
            };

            _repo.AddRange(categories);
            categories[0].Name = "Foo1";
            categories[1].Name = "Foo2";
            categories[2].Name = "Foo3";
            _repo.UpdateRange(categories, false);
            var count = _repo.SaveChanges();

            Assert.Equal(3, count);
            var repo = new DepartmentRepo();
            var cat  = repo.GetFirst();

            Assert.Equal("Foo1", cat.Name);
        }
Exemple #10
0
 public void AppointmentRepoSetup()
 {
     _dbController   = new TestDbController();
     _controller     = Controller.GetInstance();
     _departmentRepo = DepartmentRepo.GetInstance(_dbController, practitioners);
     departments     = _departmentRepo.GetDepartments();
     users           = _controller.GetUsers();
     _instance       = AppointmentRepo.GetInstance(_dbController, users, departments);
 }
Exemple #11
0
 private List <SelectListItem> GetDepartmentSelectList()
 {
     return((from department in DepartmentRepo.GetAll()
             select new SelectListItem()
     {
         Text = department.DepartmentName,
         Value = department.DepartmentId.ToString()
     }).ToList());
 }
 public DepartmentHeadServiceImpl(RequisitionRepo rrepo, RequisitionDetailRepo rdrepo, EmployeeRepo erepo, DepartmentRepo drepo, IMailer mailservice, CollectionPointRepo crepo)
 {
     this.rrepo       = rrepo;
     this.rdrepo      = rdrepo;
     this.erepo       = erepo;
     this.drepo       = drepo;
     this.mailservice = mailservice;
     this.crepo       = crepo;
 }
Exemple #13
0
        public void GetTestA()
        {
            InitializeDatabase(new HardcodedDataV2());

            IDepartmentRepo _departmentRepo = new DepartmentRepo();

            var ret = _departmentRepo.Get();

            Assert.Equal(2, ret.Count());
        }
Exemple #14
0
 public DepartmentsViewModel()
 {
     SearchValue               = "";
     _repository               = new DepartmentRepo();
     Departments               = new DataView();
     Departments.Table         = _repository.dataSet.Tables[0].DefaultView.Table.Copy();
     this.PropertyChanged     += DepartmentsViewModel_PropertyChanged;
     FilteredDepartments       = new DataView();
     FilteredDepartments.Table = Departments.Table.Copy();
 }
Exemple #15
0
        public DepartmentList(string apiEndpoint)
        {
            InitializeComponent();

            ApiEndpoint = apiEndpoint;

            dRepo  = new DepartmentRepo(ApiEndpoint);
            dhRepo = new DepartmentHeadRepo(ApiEndpoint);
            tRepo  = new TeacherRepo(ApiEndpoint);
        }
Exemple #16
0
        public IHttpActionResult CreateDepartment(DepartmentModel dept)
        {
            string          error = "";
            DepartmentModel dm    = DepartmentRepo.CreateDepartment(dept, out error);

            if (error != "" || dm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(dm));
        }
Exemple #17
0
 public DepartmentEmpServiceImpl(RequisitionRepo rrepo, RequisitionDetailRepo rdrepo, ProductRepo prepo, EmployeeRepo erepo,
                                 DepartmentRepo drepo, CollectionPointRepo cprepo, IMailer mailservice)
 {
     this.rrepo       = rrepo;
     this.rdrepo      = rdrepo;
     this.prepo       = prepo;
     this.erepo       = erepo;
     this.drepo       = drepo;
     this.cprepo      = cprepo;
     this.mailservice = mailservice;
 }
Exemple #18
0
        public ActionResult DeleteConfirm(int id)
        {
            Responses responses = (DepartmentRepo.Delete(id));

            if (responses.Success)
            {
                return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new { success = false, message = "Error Msg" }, JsonRequestBehavior.AllowGet));
        }
Exemple #19
0
        public FrmDept(string deptId = "")
        {
            InitializeComponent();
            _repo = new DepartmentRepo();
            _id   = deptId;

            if (deptId != "")
            {
                lblTitle.Text = "Update Department";
                GetItem(deptId);
            }
        }
 public DepartmentForm(Department data = null)
 {
     InitializeComponent();
     _deptRepo = new DepartmentRepo();
     if (data != null)
     {
         lblId.Text       = data.Id.ToString();
         txtDeptName.Text = data.DepartmentName;
         txtDeptCode.Text = data.DepartmentCode;
         lblTitle.Text    = "Update Department";
     }
 }
Exemple #21
0
        public bool UpdateDepartment(Department d)
        {
            _d = d;
            DepartmentRepo repo = new DepartmentRepo();

            ValidateForMod();
            if (Errors.Count == 0)
            {
                return(repo.Update(_d));
            }
            return(false);
        }
Exemple #22
0
        public TeacherCardsList(string apiEndpoint)
        {
            InitializeComponent();

            ApiEndpoint = apiEndpoint;

            tcRepo   = new TeacherCardRepo(ApiEndpoint);
            tciRepo  = new TeacherCardItemRepo(ApiEndpoint);
            dRepo    = new DepartmentRepo(ApiEndpoint);
            tRepo    = new TeacherRepo(ApiEndpoint);
            pyrhRepo = new PositionYearRateHoursRepo(ApiEndpoint);
        }
Exemple #23
0
        public IHttpActionResult RejectDepartmentCollectionPoint(DepartmentCollectionPointModel dcpm)
        {
            string error = "";

            dcpm.Status = ConDepartmentCollectionPoint.Status.REJECTED;
            dcpm        = DepartmentRepo.UpdateDepartmentCollectionPoint(dcpm, out error);
            if (error != "" || dcpm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(dcpm));
        }
Exemple #24
0
 /// <summary>
 /// Obtener cantidad de registros de Sancion
 /// Autor: Jair Guerrero
 /// Fecha: 2020-08-06
 /// </summary>
 public int Count()
 {
     try
     {
         IRepository <Department> repo = new DepartmentRepo(context);
         return(repo.Count());
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message, ex.InnerException);
     }
 }
Exemple #25
0
        public bool AddDepartment(Department d)
        {
            _d = d;
            DepartmentRepo repo = new DepartmentRepo();

            ValidateForCreate();
            if (Errors.Count == 0)
            {
                return(repo.Insert(_d));
            }

            return(false);
        }
Exemple #26
0
        /// <summary>
        /// Crear registro de Sancion
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public long Create(DepartmentAM entity)
        {
            try
            {
                var sancion = mapper.Map <Department>(entity);

                IRepository <Department> repo = new DepartmentRepo(context);
                return(repo.Create(sancion));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
        public UnitOfWorkPersonTest()
        {
            var dbInMemory     = DbInMemory.getDbInMemoryOptions(dbName);
            var personRepo     = new PersonRepo(dbInMemory);
            var classRepo      = new ClassRepo(dbInMemory);
            var scheduleRepo   = new ScheduleRepo(dbInMemory);
            var semesterRepo   = new SemesterRepo(dbInMemory);
            var departmentRepo = new DepartmentRepo(dbInMemory);

            db = new TCSContext(dbInMemory);
            mockBannerService = new Mock <IBannerService>();

            unitPerson = new UnitOfWorkPerson(personRepo, scheduleRepo, classRepo, semesterRepo, departmentRepo, mockBannerService.Object);
        }
Exemple #28
0
        /// <summary>
        /// Obtener Sancion por Id
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public DepartmentAM Get(long id)
        {
            try
            {
                IRepository <Department> repo = new DepartmentRepo(context);
                var sancion = repo.Get(id);

                return(mapper.Map <DepartmentAM>(sancion));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Exemple #29
0
        /// <summary>
        /// Obtener cantidad de registros de Sancion según filtro
        /// Autor: Jair Guerrero
        /// Fecha: 2020-08-06
        /// </summary>
        public int Count(Expression <Func <DepartmentAM, bool> > predicate)
        {
            try
            {
                var where = mapper.MapExpression <Expression <Func <Department, bool> > >(predicate);

                IRepository <Department> repo = new DepartmentRepo(context);
                return(repo.Count(where));
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message, ex.InnerException);
            }
        }
Exemple #30
0
        public ActionResult Index()
        {
            IEnumerable <EmployeeListViewModel> model = from employee in EmployeeRepo.GetAll()
                                                        join department in DepartmentRepo.GetAll()
                                                        on employee.DepartmentId equals department.DepartmentId
                                                        select new EmployeeListViewModel()
            {
                Name       = employee.FirstName + " " + employee.LastName,
                Department = department.DepartmentName,
                Phone      = employee.Phone,
                EmployeeId = employee.EmployeeId,
            };

            return(View(model));
        }