public void InitializeComboBoxes()
        {
            _departmentService = new DepartmentService();
            _credentialsService = new CredentialsService();
            _doctorService = new DoctorService();

            _deptsList = _departmentService.FindAll();
            _statusList = new List<string>() { "active", "inactive" };
            ComboBoxItem cbm;
            if (_deptsList != null)
            {
                foreach (Department d in _deptsList)
                {
                    cbm = new ComboBoxItem();
                    cbm.Content = d.Name;
                    cbm.Tag = d.Id;
                    departmentComboBox.Items.Add(cbm);
                }
            }
            foreach (KeyValuePair<int, string> status in DoctorStatus.DoctorStatuses)
            {
                cbm = new ComboBoxItem();
                cbm.Content = status.Value;
                cbm.Tag = status.Key;
                statusComoBox.Items.Add(cbm);
            }
        }
 /// <summary>
 /// gets all departments using DepartmentService
 /// and buid a Expander control with header= department name and content= department description
 /// for each expander create a new row in  gridDepartaments
 /// </summary>
 private void PopulateDepartmentGrid()
 {
     _deptService = new DepartmentService();
     List<Department> depts = _deptService.FindAll();
     int i = 0;
     if (depts != null)
     {
         foreach (var dept in depts)
         {
             Expander expander = new Expander();
             expander.HorizontalAlignment = HorizontalAlignment.Stretch;
             expander.Header = dept.Name;
             StackPanel stackPanel = new StackPanel();
             TextBlock txt = new TextBlock();
             txt.Text = dept.Description + ", " + dept.Floor;
             stackPanel.Children.Add(txt);
             expander.Content = stackPanel;
             gridDepartaments.RowDefinitions.Add(new RowDefinition());
             gridDepartaments.RowDefinitions[i].Height = new GridLength(50);
             Grid.SetRow(expander, i);
             i++;
             gridDepartaments.Children.Add(expander);
         }
     }
 }
 public ActionResult DeleteConfirmed(int id)
 {
     DepartmentService service = new DepartmentService();
     Department model = service.GetDepartmentByID(new Department() { Id = id });
     service.Remove(model);
     return RedirectToAction("Index");
 }
 //
 // GET: /Department/Details/5
 public ViewResult Details(int id)
 {
     DepartmentService service = new DepartmentService();
     Department model = service.GetDepartmentByID(new Department() { Id = id });
     model.ActionOperationType = EActionOperationType.Details;
     return View("Create",model);
 }
 //
 // GET: /Department/Edit/5
 public ActionResult Edit(int id)
 {
     DepartmentService service = new DepartmentService();
     Department model = service.GetDepartmentByID(new Department() { Id = id });
     model.ActionOperationType = EActionOperationType.Edit;
     this.LoadEditViewBag(model);
     return View("Create",model);
 }
        public void it_should_call_OnSaving_for_updated_entities()
        {
            using (var work = Create.Work())
            {
                var s = new DepartmentService(work);
                var d = s.GetByID(this.Dept.DepartmentID);
                d.Name = bad_department_name;

                work.Save();
            }
        }
        public void it_should_call_OnSaving_for_added_entities()
        {
            using (var work = Create.Work())
            {
                var s = new DepartmentService(work);
                var d = s.Create();
                d.Name = bad_department_name;
                s.Add(d);

                work.Save();
            }
        }
 public ActionResult Create(Department model)
 {
     model.ActionOperationType = EActionOperationType.Create;
     if (ModelState.IsValid)
     {
         DepartmentService service = new DepartmentService();
         service.Add(model);
         return RedirectToAction("Index");
     }
     this.LoadEditViewBag(model);
     return View("Create",model);
 }
Example #9
0
        public static IEnumerable<SelectListItem> FillddlDepartment()
        {
            var service = new DepartmentService();
            var department = service.GetAll();
            var listitems = department.Select(x =>

                new SelectListItem
                {
                    Text = x.DepartmentName,
                    Value = x.Id.ToString()
                });
            return listitems;
        }
        public ActionResult Create(DepartmentViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                DepartmentService service = new DepartmentService(db);
                service.Add(this._toBusinessModel(viewModel));
                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }
        public void entities_should_not_be_deleted_from_storage()
        {
            // using Service API, call Delete on the record
            using (var work = Ignorance.Create.Work())
            {
                var s = new DepartmentService(work);
                var d = s.GetByID(this.TestDepartmentID);
                s.Delete(d);

                // but do NOT call Save on Work.
            }

            // test (using straight EF) that the record still exists.
            using (var db = new AdventureWorksEntities())
            {
                var d = db.Departments.Find(this.TestDepartmentID);
                Assert.IsNotNull(d, "Changes were persisted without Work.Save().");
            }
        }
        public void changes_to_entities_should_not_persist()
        {
            // using Service API, call Update on the record
            using (var work = Ignorance.Create.Work())
            {
                var s = new DepartmentService(work);
                var d = s.GetByID(this.TestDepartmentID);
                d.Name = "Updated";
                s.Update(d);

                // but do NOT call Save on Work.
            }

            // test (using straight EF) that the record still exists.
            using (var db = new AdventureWorksEntities())
            {
                var d = db.Departments.Find(this.TestDepartmentID);
                Assert.AreEqual("Ignorance", d.Name, "Update was persisted without Work.Save().");
            }
        }
        public void Service_Update_should_apply_the_changes()
        {
            // change the entity outside a working context
            this.Dept.Name = new_department_name;

            // use Update to re-attach and save the changes
            using (var work = Ignorance.Create.Work())
            {
                var s = new DepartmentService(work);
                s.Update(this.Dept);

                work.Save();
            }

            // verify the changes using EF
            using (var db = new AdventureWorksEntities())
            {
                var d = db.Departments.Find(this.Dept.DepartmentID);
                Assert.AreEqual(new_department_name, d.Name, "Changes from outside of Work were not applied.");
            }
        }
        public void added_entities_should_not_persist()
        {
            var guidName = Guid.NewGuid().ToString();
            // using Service API, Add a record
            using (var work = Ignorance.Create.Work())
            {
                var s = new DepartmentService(work);
                var d = s.Create();
                d.Name = guidName;
                s.Add(d);

                // but do NOT call Save on Work.
            }

            // test (using straight EF) that the record still exists.
            using (var db = new AdventureWorksEntities())
            {
                var d = db.Departments.FirstOrDefault(p => p.Name == guidName);
                Assert.IsNull(d, "Add was persisted without Work.Save().");
            }
        }
        private void LoadSearchViewBag(ProjectPlanCollectionSearch searchModel)
        {
            #region sort
            ViewBag.IsAsc = !searchModel.IsAsc;
            ViewBag.SortBy = searchModel.SortBy;
            #endregion
                var projectplanService = new ProjectPlanService();
                if (!searchModel.ProjectPlanId.HasValue)
                {
                    ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ProjectPlanId);
                }
                var contractService = new ContractService();
                if (!searchModel.ContractId.HasValue)
                {
                    ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ContractId);
                }
                var orgchartService = new OrgChartService();
                if (!searchModel.OrgChartId.HasValue)
                {
                    ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrgChartId);
                }
                var datadictionaryService = new DataDictionaryService();
                if (!searchModel.BidTypeId.HasValue)
                {
                    ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.BidTypeId);
                }
                var departmentService = new DepartmentService();
                if (!searchModel.DepartmentId.HasValue)
                {
                    ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.DepartmentId);
                }
                var employeeService = new EmployeeService();
                if (!searchModel.ResearchOwnerEmployeeId.HasValue)
                {
                    ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.ResearchOwnerEmployeeId);
                }

                if (!searchModel.EngeerEmployeeId.HasValue)
                {
                    ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.EngeerEmployeeId);
                }

                if (!searchModel.CostOwnerEmployeeId.HasValue)
                {
                    ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.CostOwnerEmployeeId);
                }

                if (!searchModel.AuthorEmployeeId.HasValue)
                {
                    ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.AuthorEmployeeId);
                }

                if (!searchModel.OrganizerEmployeeId.HasValue)
                {
                    ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name");
                }
                else
                {
                    ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.OrganizerEmployeeId);
                }
        }
Example #16
0
        /// <summary>
        /// 数据转换
        /// </summary>
        /// <param name="import"></param>
        /// <returns></returns>
        protected override EmployeeInfo Tran(EmployeesImportDetail import)
        {
            // 转换对象基本信息
            // 性别
            UserGender gender = UserGender.None;

            import.Gender = import.Gender.Trim();
            if (import.Gender.Contains("女") || import.Gender == "0" || import.Gender == "false")
            {
                gender = UserGender.Female;
            }
            if (import.Gender.Contains("男") || import.Gender == "1" || import.Gender == "true")
            {
                gender = UserGender.Male;
            }
            // 是否在职
            bool isDelete = false;

            import.IsHoldJob = import.IsHoldJob.Trim();
            if (import.IsHoldJob.Contains("是") || import.IsHoldJob == "1" || import.IsHoldJob == "true")
            {
                isDelete = false;
            }
            if (import.Gender.Contains("否") || import.Gender == "0" || import.Gender == "false")
            {
                isDelete = true;
            }
            EmployeeInfo info = new EmployeeInfo
            {
                OldId         = import.Code,
                Code          = import.Code,
                Name          = import.Name,
                LogonAccount  = import.LogonAccount,
                LogonPassword = import.LogonPassword,
                Gender        = gender,
                IsDelete      = isDelete,
                State         = isDelete ? UserState.Disable : UserState.Enable
            };

            // 获取部门
            if (!string.IsNullOrWhiteSpace(import.Department))
            {
                DepartmentService depService = ServiceLoader.GetService <DepartmentService>();
                DepartmentInfo    depInfo    = depService.SearchQueryable().Where(e => e.Name == import.Department).FirstOrDefault();
                if (depInfo != null)
                {
                    info.Department = new SelectView {
                        Id = depInfo.Id.ToString(), Name = depInfo.Name, Code = depInfo.Code
                    };
                    info.ParentDepartment = new ParentDepartment {
                        Id = depInfo.ParentId, Name = depInfo.ParentName, Ids = depInfo.ParentsIds
                    };
                }
            }
            // 获取角色
            if (!string.IsNullOrWhiteSpace(import.Role))
            {
                RoleService roleService = ServiceLoader.GetService <RoleService>();
                RoleInfo    roleInfo    = roleService.SearchQueryable().Where(e => e.Name == import.Role).FirstOrDefault();
                if (roleInfo != null)
                {
                    info.Role = new SelectView {
                        Id = roleInfo.Id.ToString(), Name = roleInfo.Name, Code = string.Empty
                    };
                }
            }
            // 返回信息
            return(info);
        }
 public DepartmentsController()
 {
     Service = new DepartmentService();
 }
Example #18
0
 private void LoadEditViewBag(Employee model)
 {
     DepartmentService departmentService = new DepartmentService();
     ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId);
 }
 public DepartmentsController(DepartmentService departmentService)
 {
     _departmentService = departmentService;
 }
 public void the_entity_should_not_be_null()
 {
     var s = new DepartmentService();
     var d = s.Create();
     Assert.IsNotNull(d, "The entity was not created.");
 }
 public DepartmentsController(DepartmentService service)
 {
     _service = service;
 }
Example #22
0
 public AppUserController()
 {
     _appUserService    = new AppUserService();
     _departmentService = new DepartmentService();
     _storeService      = new StoreService();
 }
 public RequisitionController(RequisitionService reqService, InventoryService invService, DepartmentService deptService, StationeryContext dbcontext)
 {
     this.deptService = deptService;
     this.invService  = invService;
     this.reqService  = reqService;
     this.dbcontext   = dbcontext;
 }
 public DepartmentController(DepartmentService ds, CollectionPointService cps, EmployeeService es)
 {
     this.ds  = ds;
     this.cps = cps;
     this.es  = es;
 }
 /// <summary>
 /// 构造方法
 /// </summary>
 /// <param name="service"></param>
 /// <param name="roleService"></param>
 /// <param name="departmentService"></param>
 public EmployeeController(EmployeeService service, RoleService roleService, DepartmentService departmentService)
 {
     _Service           = service;
     _roleService       = roleService;
     _departmentService = departmentService;
 }
 public DepartmentsController(SalesWebMvcContext context, DepartmentService departmentService)
 {
     _context           = context;
     _departmentService = departmentService;
 }
 public DepartmentController(DepartmentService departmentService)
 {
     this.departmentService = departmentService;
 }
        //
        // GET: /Department/
        public ActionResult Index(int? page = 1)
        {
            IPagedList<DepartmentViewModel> modelList = null;

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                DepartmentService service = new DepartmentService(db);
                modelList = service.GetPagedList(this._toViewModel, page ?? 1);
            }

            return View(modelList);
        }
Example #29
0
 public SellersController(SellerService sellerservice, DepartmentService departmentService)
 { // injeção de dependencia
     _sellerService     = sellerservice;
     _departmentService = departmentService;
 }
Example #30
0
 public DepartmentsController(IDepartments deparmentRepository)
 {
     _departmentService = new DepartmentService(deparmentRepository);
 }
Example #31
0
        private readonly DepartmentService _departmentService;                                     // Dependência

        public SellersController(SellerService sellerService, DepartmentService departmentService) // Construtor recebendo SellerService
        {
            _sellerService     = sellerService;
            _departmentService = departmentService;
        }
        protected async override Task OnInitializedAsync()
        {
            Employee = await EmployeeService.GetEmployee(int.Parse(Id));

            Departments = (await DepartmentService.GetDepartments()).ToList();
        }
 public ClientViewModel(Client client)
 {
     this.client        = client;
     Name               = client.Name;
     SelectedDepartment = DepartmentService.SelectDepartment(client.DepartmentId);
 }
Example #34
0
 public void PerTestSetup()
 {
     _departmentRepositoryMock = new Mock <IDepartmentRepository>();
     _mapperMock        = new Mock <IMapper>();
     _departmentService = new DepartmentService(_mapperMock.Object, _departmentRepositoryMock.Object);
 }
Example #35
0
 private void LoadSearchViewBag(EmployeeSearch searchModel)
 {
     #region sort
     ViewBag.IsAsc = !searchModel.IsAsc;
     ViewBag.SortBy = searchModel.SortBy;
     #endregion
         var departmentService = new DepartmentService();
         if (!searchModel.DepartmentId.HasValue)
         {
             ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name");
         }
         else
         {
             ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name", searchModel.DepartmentId);
         }
 }
Example #36
0
 public SellersController(SellerService sellerService, DepartmentService departmentService, SalesWebMvcContext context)
 {
     _sellerService     = sellerService;
     _departmentService = departmentService;
     _context           = context;
 }
        public ActionResult SaveOptions(DepartmentViewModel model)
        {
            departmentService      = new DepartmentService(context);
            collectionPointService = new CollectionPointService(context);
            userService            = new UserService(context);
            statusService          = new StatusService(context);
            delegationService      = new DelegationService(context);

            int        status     = 0;
            Department dpt        = departmentService.FindDepartmentByUser(userService.FindUserByEmail(CurrentUserName));
            Delegation delegation = new Delegation();

            dpt.UpdatedDateTime = DateTime.Now;
            dpt.UpdatedBy       = userService.FindUserByEmail(System.Web.HttpContext.Current.User.Identity.GetUserName());
            dpt.Representative  = userService.FindUserByEmail(model.DepartmentRep);
            dpt.CollectionPoint = collectionPointService.FindCollectionPointById(Convert.ToInt32(model.CollectionPoint));

            if (departmentService.Save(dpt) != null)
            {
                // Send notifications to all Store Clerks
                foreach (var user in new UserService(context).FindUsersByDepartment(departmentService.FindDepartmentByDepartmentCode("STOR")).Where(r => r.Roles.Select(ur => ur.RoleId).Contains("3")))
                {
                    var notification = new NotificationService(context).CreateChangeCollectionPointNotification(dpt, user);
                    new NotificationApiController()
                    {
                        context = context
                    }.SendNotification(notification.NotificationId.ToString());
                    new NotificationApiController()
                    {
                        context = context
                    }.SendEmail(notification.NotificationId.ToString());
                }
                status = 1;
            }

            delegation.Receipient = userService.FindUserByEmail(model.DelegationRecipient);

            if (delegation.Receipient != null && model.StartDate != null && model.EndDate != null)
            {
                delegation.DelegationId    = IdService.GetNewDelegationId(context);
                delegation.StartDate       = DateTime.Parse(model.StartDate, new CultureInfo("fr-FR", false));
                delegation.EndDate         = DateTime.Parse(model.EndDate, new CultureInfo("fr-FR", false));
                delegation.CreatedDateTime = DateTime.Now;
                //delegation.CreatedBy = user;
                delegation.CreatedBy = userService.FindUserByEmail(CurrentUserName);
                delegation.Status    = statusService.FindStatusByStatusId(1);
                delegationService.DelegateManager(delegation);
                status = 2;

                // Role
                //userService.AddDepartmentHeadRole(delegation.Receipient.Email);
            }

            if (delegation.Receipient != null && model.StartDate == null && model.EndDate == null)
            {
                status = 3;
            }

            return(new JsonResult {
                Data = new { status = status }
            });
        }
		public void DepartmentRetrieveAll()
		{
			Collection<Department> list = DepartmentService.Retrieve();
			Assert.IsNotNull(list, "DepartmentTest.RetrieveAll: null retrieved (are you missing test data?)"); 
			Assert.IsTrue(list.Count > 0, "DepartmentTest.RetrieveAll(): no rows retrieved (are you missing test data?)");
		}
        private void LoadEditViewBag(ProjectPlanCollection model)
        {
            ProjectPlanService projectplanService = new ProjectPlanService();
            ViewBag.ProjectPlanId = new SelectList(projectplanService.Query(p => p.IsActive=="1"), "Id", "Name",model.ProjectPlanId);
             ContractService contractService = new ContractService();
            ViewBag.ContractId = new SelectList(contractService.Query(p => p.IsActive=="1"), "Id", "Name",model.ContractId);
             OrgChartService orgchartService = new OrgChartService();
            ViewBag.OrgChartId = new SelectList(orgchartService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrgChartId);
             DataDictionaryService datadictionaryService = new DataDictionaryService();
            ViewBag.BidTypeId = new SelectList(datadictionaryService.Query(p => p.IsActive=="1"), "Id", "Name",model.BidTypeId);
             DepartmentService departmentService = new DepartmentService();
            ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name",model.DepartmentId);
             EmployeeService employeeService = new EmployeeService();
            ViewBag.ResearchOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.ResearchOwnerEmployeeId);

            ViewBag.EngeerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.EngeerEmployeeId);

            ViewBag.CostOwnerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.CostOwnerEmployeeId);

            ViewBag.AuthorEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.AuthorEmployeeId);

            ViewBag.OrganizerEmployeeId = new SelectList(employeeService.Query(p => p.IsActive=="1"), "Id", "Name",model.OrganizerEmployeeId);
        }
        //
        // GET: /Department/Delete
        public ActionResult Delete(long? id)
        {
            if (id == null)
            {
                return RedirectToAction("Index");
            }

            var viewModel = new DepartmentViewModel();

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                DepartmentService service = new DepartmentService(db);
                var model = service.GetObject(x => x.id == id);

                if (model == null)
                {
                    return RedirectToAction("Index");
                }

                viewModel = this._toViewModel(model);
            }

            return View(viewModel);
        }
        //
        // GET: /Department/
        public ActionResult Index()
        {
            var modelList = new List<DepartmentViewModel>();

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                DepartmentService service = new DepartmentService(db);

                foreach (var model in service.GetObjectList())
                {
                    modelList.Add(this._toViewModel(model));
                }
            }

            return View(modelList);
        }
Example #42
0
 public void TestSetup()
 {
     departmentService = new DepartmentService(this.departmentRepository, this.logger);
 }
        public ActionResult Edit(DepartmentViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            using (ModelRepository db = new ModelRepository(this._factory.GetDatabaseObject()))
            {
                DepartmentService service = new DepartmentService(db);
                var model = service.GetObject(x => x.id == viewModel.Id);

                if (model == null)
                {
                    return RedirectToAction("Index");
                }

                service.Update(this._toBusinessModel(viewModel));

                db.SaveChanges();
            }

            return RedirectToAction("Index");
        }
        /// <summary>
        /// opens a connection to the database and initializes necessary services
        /// </summary>
        private void OpenConnection()
        {
            try
            {
                DBConnection.CreateConnection("localhost", "xe", "hr", "hr");
            }
            catch (Exception)
            {
                try
                {
                    DBConnection.CreateConnection("localhost", "ORCL", "hr", "roxana");
                }
                catch (Exception e)
                {
                    throw e;
                }
            }

            credentialsService = new CredentialsService();
            administratorService = new AdministratorService();
            patientService = new PatientService();
            doctorService = new DoctorService();
            departmentService = new DepartmentService();
            appointmentService = new AppointmentService();
            resultService = new ResultsService();
            scheduleService = new ScheduleService();
        }
 public FormImportDepartmentFormExel()
 {
     InitializeComponent();
     _departmentService = new DepartmentService();
 }
 public LecturesController(LectureService serviceLecture, ProfessorService professorService, DepartmentService departmentService)
 {
     _serviceLecture    = serviceLecture;
     _professorService  = professorService;
     _departmentService = departmentService;
 }
Example #47
0
 public UserController(UserService userService, RoleService roleService, DepartmentService departmentService)
 {
     _userService = userService;
     _roleService = roleService;
     _departmentService = departmentService;
 }
 public SellersController(SellerServices sellerServices, DepartmentService departmentService)
 {
     _sellerServices    = sellerServices;
     _departmentService = departmentService;
 }
 public HomeController(ILogger <HomeController> logger, SellerService sellerService, SalesRecordService salesRecordService, DepartmentService departmentService)
 {
     _logger             = logger;
     _sellerService      = sellerService;
     _salesRecordService = salesRecordService;
     _departmentService  = departmentService;
 }
        public IActionResult Attendance(string d)
        {
            int?uid = HttpContext.Session.GetInt32("uid");

            if (uid == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            Uzer user = UserService.FindUserByID((int)uid);


            if (user.Department == null)
            {
                return(Content("You do not have a department"));
            }

            Department userDep = DepartmentService.FindDepartmentByID((int)user.Department);

            List <Department> deps   = new List <Department>();
            Department        selDep = null;
            List <Uzer>       staffs = new List <Uzer>();


            //hard code, a little bit ugly
            if (userDep.Name.Equals("HR"))
            {
                //HR department can check other guys' attendance.
                deps = DepartmentService.FindDepartment();
                int depId = 0;
                Int32.TryParse(d, out depId);

                foreach (Department department in deps)
                {
                    if (department.Id == depId)
                    {
                        selDep = department;
                        break;
                    }
                }
                if (selDep == null && deps.Count > 0)
                {
                    selDep = deps[0];
                }


                if (selDep.Name.Equals("HR"))
                {
                    //user of HR department can only check the attendance of the staffs whose level is lower than him/her
                    staffs = UserService.FindUserByDepartmentAndUnderLevel((int)user.Department, (int)user.UzerLevel);
                    staffs.Insert(0, user);
                }
                else
                {
                    staffs = UserService.FindUserByDepartment(selDep.Id);
                }
            }
            else
            {
                //other guys can only check the attendance of the staffs with lower lever in the same department
                selDep = userDep;
                staffs = UserService.FindUserByDepartmentAndUnderLevel((int)user.Department, (int)user.UzerLevel);
                staffs.Insert(0, user);
            }


            AttendanceAttendanceViewModel attendanceAttendanceViewModel = new AttendanceAttendanceViewModel(deps, staffs, selDep);

            return(View(attendanceAttendanceViewModel));
        }
 private void PopulateDepartmentsList()
 {
     _departmentService = new DepartmentService();
     _scheduleService = new ScheduleService();
     List<Department> allDepartments = _departmentService.FindAll();
     ComboBoxItem cbm;
     if (allDepartments != null)
     {
         foreach (Department d in allDepartments)
         {
             cbm = new ComboBoxItem();
             cbm.Content = d.Name;
             cbm.Tag = d.Id;
             comboBoxDepartments.Items.Add(cbm);
         }
     }
 }
Example #52
0
 public DepartmentController(DepartmentServiceImpl departmentService)
 {
     _departmentService = departmentService;
 }
 public void the_entity_should_be_initialized_with_default_values()
 {
     var s = new DepartmentService();
     var d = s.Create();
     Assert.AreEqual("New Department", d.Name, "OnCreate was not called.");
 }
 public SellersController(SellerService sellerService, DepartmentService departmentServivce)
 {
     _sellerService      = sellerService;
     _departmentServivce = departmentServivce;
 }
        private PagedList<Department> QueryListData(DepartmentSearch searchModel)
        {
            int recordCount = 0;
            int pageSize = ConstantManager.PageSize;
            DepartmentService service = new DepartmentService();

            string Group = searchModel.IsAsc ? searchModel.SortBy : searchModel.SortBy + " Descending";

            IList<Department> allEntities = service.QueryByPage(this.GetSearchFilter(searchModel), Group, pageSize, searchModel.PageIndex + 1, out recordCount);

            var formCondition = "var condition=" + JsonConvert.SerializeObject(searchModel);
            return new PagedList<Department>(allEntities, searchModel.PageIndex, pageSize, recordCount, "Id", "Id", formCondition);
        }
 public SellersController(SellerService sellerService, DepartmentService departmentService)
 {
     this._sellerService     = sellerService;
     this._departmentService = departmentService;
 }
Example #57
0
        public IActionResult New(string r)
        {
            StaffManageNewViewModel staffManageNewViewModel = new StaffManageNewViewModel(DepartmentService.FindDepartment());

            if (r == null)
            {
                staffManageNewViewModel.LastNewSuccess = 0;
            }
            else if (r.Equals("0"))
            {
                staffManageNewViewModel.LastNewSuccess = 1;
                staffManageNewViewModel.LastNewPrompt  = "Add new user successful!";
            }
            else
            {
                staffManageNewViewModel.LastNewSuccess = -1;
                staffManageNewViewModel.LastNewPrompt  = r;
            }
            return(View(staffManageNewViewModel));
        }
Example #58
0
 private void LoadCreateViewBag()
 {
     DepartmentService departmentService = new DepartmentService();
     ViewBag.DepartmentId = new SelectList(departmentService.Query(p => p.IsActive=="1"), "Id", "Name");
 }
 public PersonnelViewModel()
 {
     _departmentService     = new DepartmentService();
     _departmentRoleService = new DepartmentRoleService();
 }
Example #60
0
 public DepartmentController(iDepartmentRepository IDepartmentRepository)
 {
     _iDepartmentRepository = IDepartmentRepository;
     departmentService      = new DepartmentService();
 }