public CatalogTasksImplementation(DepartmentRepository department_repository, DepartmentItemMapper departmentItemMapper, ProductRepository product_repository, ProductItemMapper product_item_mapper) { this.department_repository = department_repository; this.product_item_mapper = product_item_mapper; this.product_repository = product_repository; this.departmentItemMapper = departmentItemMapper; }
public EmployeeMainPropertiesViewModel(Employee employee) { _departmentRepository = new DepartmentRepository(); _employee = employee; ChangeDepartmentCommand = new Command(ChangeDepartment); }
public void ShouldAddDepartment() { // Arrange using (IEmployeeContext employeeContext = new EmployeeContext()) { IEmployeeRepository employeeRepository = new EmployeeRepository(employeeContext); employeeRepository.Add(CreateEntity.Employee1); employeeRepository.Add(CreateEntity.Employee2); employeeRepository.Add(CreateEntity.Employee3); employeeContext.SaveChanges(); IDepartmentRepository departmentRepository = new DepartmentRepository(employeeContext); var department = CreateEntity.Department1; // Act departmentRepository.Add(department); var numberOfChangesCommitted = employeeContext.SaveChanges(); // Assert numberOfChangesCommitted.Should().BeGreaterThan(0); var allDepartments = departmentRepository.GetAll().ToList(); allDepartments.Should().HaveCount(1); allDepartments.ElementAt(0).ShouldBeEquivalentTo(department, options => options.IncludingAllDeclaredProperties()); } }
public UserAction() { _unitRepository = new UnitRepository(); _departmentRepository = new DepartmentRepository(); _userRepository = new UserRepository(); _phoneBookRecordRepository = new PhoneBookRecordRepository(); }
public void ShouldDeleteDepartment() { // Arrange using (IEmployeeContext employeeContext = new EmployeeContext()) { IDepartmentRepository departmentRepository = new DepartmentRepository(employeeContext); var department1 = CreateEntity.Department1; var department2 = CreateEntity.Department2; departmentRepository.Add(department1); departmentRepository.Add(department2); var numberOfAdds = +employeeContext.SaveChanges(); // Act departmentRepository.Remove(department2); var numberOfDeletes =+ employeeContext.SaveChanges(); // Assert numberOfAdds.Should().BeGreaterThan(0); ; numberOfDeletes.Should().BeGreaterThan(0); var allDepartments = departmentRepository.GetAll().ToList(); allDepartments.Should().HaveCount(1); allDepartments.ElementAt(0).ShouldBeEquivalentTo(department1, options => options.IncludingAllDeclaredProperties()); } }
public ChangeDepartmentViewModel() { var repository = new DepartmentRepository(); Departments = repository.GetDepartmentDtoList(); OkCommand = new Command<DepartmentDto>(d => d != null, _ => DialogResult = true); CancelCommand = new Command(() => DialogResult = false); }
public DashboardViewModel() { _departmentRepository = new DepartmentRepository(); _employeeRepository = new EmployeeRepository(); _projectRepository = new ProjectRepository(); RefreshAll(); }
public EmployeeController() { repository = new EmployeeRepository(); services = new EmployeeServices(); deptRepository = new DepartmentRepository(); branchRepository = new BranchRepository(); desigRepository = new DesignationRepository(); }
public DepartmentResourceCommandHandler(DepartmentRepository departmentRepository, GroupRepository groupRepository, DepartmentResourceRepository departmentResourceRepository) { this.departmentRepository = departmentRepository; this.groupRepository = groupRepository; this.departmentResourceRepository = departmentResourceRepository; }
public StudentBuilder() { this.RollNumber = string.Format("R{0}", new Random().Next(int.MaxValue)); this.FirstName = "FirstName"; this.LastName = "LastName"; var department = new DepartmentRepository().GetByCode("ECE"); this.Department = department; }
public RequisitionApiControllerTest() { context = new ApplicationDbContext(); requisitionRepository = new RequisitionRepository(context); retrievalRepository = new RetrievalRepository(context); disbursementRepository = new DisbursementRepository(context); departmentRepository = new DepartmentRepository(context); }
/// <summary> /// /// </summary> /// <param name="modelDepartment"></param> /// <returns></returns> public ObjectModel.Department GetDepartmentByID(ObjectModel.Department modelDepartment) { var rmodel = new ConvertModel(); var dao = new DepartmentRepository(); var dataDepartment = dao.Query(s => s.Id == modelDepartment.Id).FirstOrDefault(); return(rmodel.ReturnModel <ObjectModel.Department, Department>(dataDepartment)); }
public JsonResult DepartmentAllDropList() { DepartmentRepository rep = new DepartmentRepository(); DataTable source = rep.GetDropListSource(); List <DropListSource> dropList = rep.DropList(source, ""); return(DropListJson(dropList)); }
public JsonResult AddComment(Comment comment) { comment.UserId = SessionManager.LoggedInUser.UserID; DepartmentRepository _dept = new DepartmentRepository(); _dept.AddComment(comment); return(Json(true)); }
public SystemManagerController(DepartmentRepository departmentRepository, UserRepository userRepository, IRepository <TimeEnrollment> timeEnrollmentRepository) { this.departmentRepository = departmentRepository; this.userRepository = userRepository; this.timeEnrollmentRepository = timeEnrollmentRepository; }
public ChangeDepartmentViewModel() { var repository = new DepartmentRepository(); Departments = repository.GetDepartmentDtoList(); OkCommand = new Command <DepartmentDto>(d => d != null, _ => DialogResult = true); CancelCommand = new Command(() => DialogResult = false); }
public UnitOfWork(HierarichyContext context) { _context = context; DepartmentRepository = new DepartmentRepository(context); CategoryRepository = new CategoryRepository(context); SubCategoryRepository = new SubCategoryRepository(context); LocationRepository = new LocationRepository(context); }
public UnitOfWork(ApplicationDbContext context) { _context = context; ProductDetails = new ReservationDetailsRepository(_context); Products = new ProductRepository(_context); ProductCategories = new ProductCategoryRepository(_context); Services = new ServiceRepository(_context); ServiceCategories = new ServiceCategoryRepository(_context); Departments = new DepartmentRepository(_context); Menus = new MenuRepository(_context); SubMenus = new SubMenuRepository(_context); OurTeams = new OurTeamRepository(_context); Designations = new DesignationRepository(_context); Faq = new FaqRepository(_context); Client = new ClientRepository(_context); Blogs = new BlogRepository(_context); ContactUs = new ContactUsRepository(_context); Companies = new CompanyRepository(_context); Banner = new BannerRepository(_context); ChooseUs = new WhyChooseUsRepository(_context); ClientProducts = new ClientProductRepository(_context); AboutUs = new AboutUsRepository(_context); HostingPlan = new HostingPlanRepository(_context); CustomerReview = new CustomerReviewRepository(_context); Career = new CareerRepository(_context); Job = new JobRepository(_context); Softwares = new SoftwareRepository(_context); SoftwareCategories = new SoftwareCategoriesRepository(_context); Features = new FeaturesRepository(_context); BlogComment = new BlogCommentRepository(_context); QueryHelper = new QueryHelper(); }
public UnitofWork(ApplicationDbContext context) { _context = context; Departments = new DepartmentRepository(_context); Divisions = new DivisionRepository(_context); Letters = new LetterRepository(_context); LetterTypes = new LetterTypeRepository(_context); Senders = new SenderRepository(_context); }
public JsonResult DepartmentDropList(string currentId) { UserInfo sysUser = CacheInit.GetUserInfo(HttpContext); DepartmentRepository rep = new DepartmentRepository(); DataTable source = rep.GetDropListSource(sysUser.UserId, currentId); List <DropListSource> dropList = rep.DropList(source, ""); return(DropListJson(dropList)); }
public ShiftsController() { _context = new ApplicationDbContext(); _shiftRepository = new ShiftRepository(_context); _employeeRepository = new EmployeeRepository(_context); _departmentRepository = new DepartmentRepository(_context); _workRepository = new WorkRepository(_context); _shiftTypeRepository = new ShiftTypeRepository(_context); }
/// <summary> /// Constructor that sets the instances of the repositories and the converters /// </summary> /// <param name="treatmentRepository"></param> /// <param name="departmentRepository"></param> /// <param name="institutionRepository"></param> public TreatmentTypeController(TreatmentTypeRepository treatmentRepository, DepartmentRepository departmentRepository, InstitutionRepository institutionRepository) { this.repository = treatmentRepository; this.departmentRepository = departmentRepository; this.institutionRepository = institutionRepository; converter = new TreatmentTypeViewModelConverter(); }
public ActionResult DeleteDepartment(int id) { IDepartmentRepository objdep = new DepartmentRepository(); objdep.Delete(id); objdep.Save(); return(Json(new { success = true, message = "Deleted Succesfully" }, JsonRequestBehavior.AllowGet)); }
public DepartmentViewModel(Department department) { _repository = new DepartmentRepository(); PossiblesHeads = new EmployeeRepository().GetPossiblesHeads(department.Head); Department = department; OkCommand = new Command(() => !string.IsNullOrWhiteSpace(Name), Save); CancelCommand = new Command(() => DialogResult = false); }
public DepartmentListViewModel() { _repository = new DepartmentRepository(); RefreshAll(); AddDepartmentCommand = new Command(AddDepartment); EditDepartmentCommand = new Command <DepartmentDto>(x => x != null, EditDepartment); DeleteDepartmentCommand = new Command <DepartmentDto>(x => x != null, DeleteDepartment); }
public DepartmentViewModel(Department department) { _repository = new DepartmentRepository(); //TODO relevant to a head of department Department = department; OkCommand = new Command(() => !string.IsNullOrWhiteSpace(Name), Save); CancelCommand = new Command(() => DialogResult = false); }
private void BankButton_Click(object sender, RoutedEventArgs e) { IBankRepository bankRepository = new BankRepository(_dbType); IDepartmentRepository deptRepository = new DepartmentRepository(_dbType); BankMaintenance b = new BankMaintenance(deptRepository, bankRepository); b.ShowDialog(); }
public DepartmentListViewModel() { _repository = new DepartmentRepository(); RefreshAll(); AddDepartmentCommand = new Command(AddDepartment); EditDepartmentCommand = new Command<DepartmentDto>(x => x != null, EditDepartment); DeleteDepartmentCommand = new Command<DepartmentDto>(x => x != null, DeleteDepartment); }
private List <SelectListItem> GetDepartmentsSelectList() { return((from department in DepartmentRepository.GetAll() select new SelectListItem() { Text = department.DepartmentName, Value = department.DepartmentId.ToString() }).ToList()); }
public void GetByIdFalseInput() { EmptyLists(); departmentRepository = new DepartmentRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => departmentRepository.GetById(-1)); Assert.Equal("Het afdelingId is leeg.", ex.Message); }
public JsonResult Department(int?draw, int?start, int?length, List <Dictionary <string, string> > order, List <Dictionary <string, string> > columns) { var search = Request["search[value]"]; var dir = order[0]["dir"].ToLower(); var column = columns[int.Parse(order[0]["column"])]["data"]; var dataTableData = new DepartmentRepository().GetPage(search, draw, start, length, dir, column); return(Json(dataTableData, JsonRequestBehavior.AllowGet)); }
public void AddFalseInput() { EmptyLists(); departmentRepository = new DepartmentRepository(context); Exception ex = Assert.Throws <NullReferenceException>(() => departmentRepository.Insert(null)); Assert.Equal("De afdeling is leeg.", ex.Message); }
public void DepartmentRepositoryConstructorFalseInput() { EmptyLists(); IDepartmentContext testContext = null; Exception ex = Assert.Throws <NullReferenceException>(() => departmentRepository = new DepartmentRepository(testContext)); Assert.Equal("De afdelingContext is leeg.", ex.Message); }
public UnitOfWork(OfficeAttendenceSystemDbContext DbContext) { _DbContext = DbContext; Departments = new DepartmentRepository(_DbContext); Employees = new EmployeeRepository(_DbContext); Users = new UserRepository(_DbContext); Attendances = new AttendanceRepository(_DbContext); Attachments = new AttachmentRepository(_DbContext); }
static void RetrieveDepartment(Guid id) { var repo = new DepartmentRepository(); var result = repo.Retrieve(id); Console.WriteLine("Department ID: {0}", result.DepartmentID); Console.WriteLine("Department Name: {0}", result.DepartmentName); Console.WriteLine("Is Active: {0}", result.isActive); }
public OrganizationService() { _departmentRepository = new DepartmentRepository(); _staffRepository = new StaffRepository(); _applicationLoggingRepository = new ApplicationLoggingRepository(); _systemConfigDepartmentRepository = new SystemConfigDepartmentRepository(); _departmentStaffsRepository = new DepartmentStaffsRepository(); _userRepository = new AspNetUsersRepository(); }
public UnitOfWork(ApplicationDbContext context) { _context = context; Employees = new EmployeeRepository(_context); Designations = new DesignationRepository(_context); Departments = new DepartmentRepository(_context); Reclamations = new ReclamationRepository(_context); SoldDevices = new SoldDevicesRepository(_context); }
public void ShouldReturnEmptyGetAll() { // Arrange using (IEmployeeContext employeeContext = new EmployeeContext()) { var departmentRepository = new DepartmentRepository(employeeContext); // Act var allDepartments = departmentRepository.GetAll().ToList(); // Assert allDepartments.Should().HaveCount(0); } }
public void ShouldSaveAndFetchStudentWithDepartment() { var department = new DepartmentBuilder().Build(); var departmentRepository = new DepartmentRepository(); departmentRepository.SaveOrUpdate(department); var student = new StudentBuilder().Build(); student.Department = department; studentRepository.SaveOrUpdate(student); FlushAndClearSession(); var studentRetrieved = studentRepository.GetById(student.Id); Assert.IsNotNull(studentRetrieved); Assert.That(studentRetrieved.Id, Is.Not.EqualTo(0)); Assert.That(studentRetrieved.Department, Is.Not.Null); Assert.That(studentRetrieved.Department.Code, Is.EqualTo(department.Code)); }
public UnitOfWork(FypDbContext db) { _context = db; Campus = new CampusRepository(_context); Department = new DepartmentRepository(_context); Batch = new BatchRepository(_context); Section = new SectionRepository(_context); Student = new StudentRepository(_context); File = new FileRepository(_context); Teacher = new TeacherRepository(_context); EnrollDep = new EnrollDepartmentRepository(_context); EnrollBatch = new EnrollBatchRepository(_context); EnrollSection = new EnrollSectionRepository(_context); Course = new CourseRepository(_context); CourseToDep = new CourseToDepRepository(_context); StudentRegistration = new StudentRegistrationRepository(_context); subjectallocate = new SubjectAllocatRepository(_context); }
public Department CreateDepartment() { IDepartmentRepository departmentRepository = new DepartmentRepository(); var deppart = departmentRepository.SaveOrUpdate(new Department() { Name = "采购部" }); departmentRepository.SaveOrUpdate(new Department() { //Parent = deppart, Name = "客服部" }); return departmentRepository.SaveOrUpdate(new Department() { //Parent = deppart, Name = "销售部" }); }
public static ICRUDRepository<Department> GetDepartmentRepository() { if(DepartmentRepo == null) { DepartmentRepo = new DepartmentRepository(); } return DepartmentRepo; }
public ActionResult InsertDepartments_Post() { DepartmentRepository dr = new DepartmentRepository(); Department d1 = new Department { DepartmentId = 1, DepartmentName = "BS Math" }; Department d2 = new Department { DepartmentId = 2, DepartmentName = "BS Science" }; dr.InsertOnSubmit(d1); dr.InsertOnSubmit(d2); return View(); }
public ViewMainDepartmentsInTheStore(DepartmentRepository department_repository, ResponseEngine response_engine) { this.department_repository = department_repository; this.response_engine = response_engine; }
public void GetStudentDeclarationsOfDepartment() { var repo = new DepartmentRepository(_context); var id = "B1D98237-5AB1-482A-BFC6-C2000E749962".ConvertToGuid(); var result = repo.Single(t => t.ID == id); Assert.IsTrue(result.StudentDeclarationJiaoWus.Count > 0); }
public void GetDepartment() { IRepositoryContext uow = new EntityFrameworkRepositoryContext(); var repo = new DepartmentRepository(uow); var result = repo.GetAll(); Assert.IsTrue(result.Count() > 0); }
public DepartmentAction() { _departmentRepository = new DepartmentRepository(); }
public UnitAction() { _unitRepository = new UnitRepository(); _userRepository = new UserRepository(); _departmentRepository = new DepartmentRepository(); }
public HttpResponseMessage DepartmentTotals([FromBody] DepartmentTotalDTO cqDTO) { string key; var aur = new AppUserRepository(); var companyId = 0; var userId = aur.ValidateUser(cqDTO.Key, out key, ref companyId); if (userId > 0) { var ur = new DepartmentTotalRepository(); var u = new DepartmentTotal(); if (cqDTO.DTDate != null) { cqDTO.Start_DTDate = DateTime.Parse(cqDTO.DTDate).ToString(); cqDTO.End_DTDate = DateTime.Parse(cqDTO.DTDate).AddDays(1).ToString(); } else { int sm = int.Parse(cqDTO.StartDateMonth); if (sm == 1) { cqDTO.Start_DTDate = DateTime.Parse("12/23/" + (int.Parse(cqDTO.StartDateYear) - 1).ToString()).ToString(); cqDTO.End_DTDate = DateTime.Parse("2/14/" + cqDTO.StartDateYear).ToString(); } else if (sm == 12) { cqDTO.Start_DTDate = DateTime.Parse("11/23/" + cqDTO.StartDateYear).ToString(); cqDTO.End_DTDate = DateTime.Parse("1/14/" + (int.Parse(cqDTO.StartDateYear) + 1).ToString()).ToString(); } else { cqDTO.Start_DTDate = DateTime.Parse((int.Parse(cqDTO.StartDateMonth) - 1).ToString() + "/23/" + cqDTO.StartDateYear).ToString(); cqDTO.End_DTDate = DateTime.Parse((int.Parse(cqDTO.StartDateMonth) + 1).ToString() + "/14/" + cqDTO.StartDateYear).ToString(); } cqDTO.StartDateMonth = null; cqDTO.StartDateYear = null; } SGApp.DTOs.GenericDTO dto = new GenericDTO(); dto.StartDate = DateTime.Parse(cqDTO.Start_DTDate); dto.EndDate = DateTime.Parse(cqDTO.End_DTDate); var predicate = ur.GetPredicate(cqDTO, u, companyId); var data = ur.GetByPredicate(predicate); var col = new Collection<Dictionary<string, string>>(); data = data.OrderBy(x => x.DTDate).ToList(); var depr = new DepartmentRepository(); var deps = depr.GetDepartments(); foreach (Department dep in deps) { DepartmentTotal dt = data.Where(x => x.DepartmentID == dep.DepartmentID).FirstOrDefault(); var dic = new Dictionary<string, string>(); if (dt != null) { dic.Add("DepartmentTotalId", dt.DepartmentTotalID.ToString()); dic.Add("DepartmentID", dt.DepartmentID.ToString()); dic.Add("DepartmentName", dt.Department.DepartmentName); dic.Add("DTDate", dt.DTDate.ToShortDateString()); dic.Add("FinishTime", dt.FinishTime != null ? dt.FinishTime.Value.ToShortTimeString() : "---"); dic.Add("DownTime", dt.DownTime != null ? dt.DownTime.ToString() : "---"); dic.Add("ShiftWeight", dt.ShiftWeight != null ? dt.ShiftWeight.ToString() : "---"); dic.Add("Absences", dt.Absences != null ? dt.Absences.ToString() : "---"); } else { dic.Add("DepartmentTotalId", "-1"); dic.Add("DepartmentID", dep.DepartmentID.ToString()); dic.Add("DepartmentName", dep.DepartmentName); dic.Add("DTDate", dto.StartDate.ToShortDateString()); dic.Add("FinishTime", "---"); dic.Add("DownTime", "---"); dic.Add("ShiftWeight", "---"); dic.Add("Absences", "---"); } col.Add(dic); } var retVal = new GenericDTO { Key = key, ReturnData = col }; return Request.CreateResponse(HttpStatusCode.OK, retVal); } var message = "validation failed"; return Request.CreateResponse(HttpStatusCode.NotFound, message); }