public void ShouldMapCreateModelToLocation() { _schoolRepository = Substitute.For<ISchoolRepository>(); _schoolRepository.GetSchool().Returns( new School { SchoolId = 1 }); var locationEntity = new Web.Data.Entities.Location(); var locationCreateModel = new CreateModel { ClassroomIdentificationCode = "BKL200", MaximumNumberOfSeats = 50, OptimalNumberOfSeats = 30 }; var createModelToLocationMapper = new CreateModelToLocationMapper(_schoolRepository); createModelToLocationMapper.Map(locationCreateModel, locationEntity); locationEntity.ClassroomIdentificationCode.ShouldBe("BKL200"); locationEntity.MaximumNumberOfSeats.ShouldBe(50); locationEntity.OptimalNumberOfSeats.ShouldBe(30); locationEntity.SchoolId.ShouldBe(1); }
public Superuserservice(IUOW uow, IGenericRepository<School> ScholenRepository, ISchoolRepository scholen2Repository) { this.uow = uow; this.SchoolRepository = ScholenRepository; this.userRepository = scholen2Repository; }
public StudentController(IStudentProcessingService svc, IStudentRepository studentRepo, IStudentMappingHelper helper, ISchoolRepository schoolRepo) { _svc = svc; _studentRepo = studentRepo; _helper = helper; _schoolRepo = schoolRepo; }
public SchoolController( ISchoolRepository schoolRepository, IMapper<SchoolModel, EducationOrganization> toEntityMapper, IMapper<EducationOrganization, SchoolModel> toVmMapper) { _schoolRepository = schoolRepository; _toEntityMapper = toEntityMapper; _toVmMapper = toVmMapper; }
private void SetUp() { _schoolRepository = Substitute.For<ISchoolRepository>(); _schoolRepository.GetSchool().Returns( new School { SchoolId = 1 }); }
public TextbookFeeAppl(ITypeAdapter adapter, ISchoolRepository schoolRepo, IStudentRepository stuRepo, IStudentReleaseRecordRepository stuReleaseRepo, IProfessionalClassRepository proClassRepo, ITeachingTaskRepository taskRepo, IBooksellerRepository booksellerRepo) { _adapter = adapter; _schoolRepo = schoolRepo; _classRepo = proClassRepo; _stuRepo = stuRepo; _studentRecordRepo = stuReleaseRepo; _taskRepo = taskRepo; _booksellerRepo = booksellerRepo; }
public SchoolService(ISchoolRepository schoolRepository, IUserVisitedSchoolRepository userVisitedSchoolRepository, IGradeRepository gradeRepository, IStudySubjectRepository studySubjectRepository, ISemesterRepository semesterRepository, ISemesterSubjectRepository semesterSubjectRepository, ISemesterUserRepository semesterUserRepository, IUserRepository userRepository, IUnitOfWork unitOfWork) { _schoolRepository = schoolRepository; _userVisitedSchoolRepository = userVisitedSchoolRepository; _gradeRepository = gradeRepository; _studySubjectRepository = studySubjectRepository; _semesterRepository = semesterRepository; _semesterSubjectRepository = semesterSubjectRepository; _semesterUserRepository = semesterUserRepository; _userRepository = userRepository; _unitOfWork = unitOfWork; }
private void Setup() { _schoolRepository = Substitute.For<ISchoolRepository>(); _schoolRepository.GetSchool().Returns(new School { SchoolId = Constants.SchoolId, EducationOrganization = new EducationOrganization {EducationOrganizationId = 1} }); _session = new SessionBuilder().Build(); _genericRepository = Substitute.For<IGenericRepository>(); _genericRepository.Get(Arg.Any<Expression<Func<Web.Data.Entities.Session, bool>>>()).Returns(_session); }
public CreateModelToLocationMapper(ISchoolRepository schoolRepository) { _schoolRepository = schoolRepository; }
public EducationalInstitutionController(IUniversityRepository universityRepository, ISchoolRepository schoolRepository, IMapper mapper) { _universityRepository = universityRepository; _schoolRepository = schoolRepository; Mapper = mapper; }
public SaveSchoolHandler(ISchoolRepository repository) { _repository = repository; }
public MentorsController(ISchoolRepository schoolRepository) { _schoolRepository = schoolRepository; }
private static void PrintSchoolOverview(ISchoolRepository schoolRepository) { (School School, int CntOfPupils)[] result = schoolRepository.GetAllSchoolsWithPupilCountAsNamedTuple();
public ImportResult ImportByChannel(string key, string level, int marketingYear, int infoSourceId, string filename) { ImportResult r = new ImportResult(); #region 初始化 Repository this.ProvRepository = new ProvinceRepository(this.Db); this.CityRepository = new CityRepository(this.Db); this.DistrictRepository = new DistrictRepository(this.Db); this.SchoolRepository = new SchoolRepository(this.Db); this.ImportCustomerRepository = new ImportCustomerRepository(this.Db); this.ImportDupliateRepository = new ImportDupliateRepository(this.Db); #endregion #region 读取初始数据 var provinces = this.ProvRepository.FindAll(); var cities = this.CityRepository.FindAll(); var districts = this.DistrictRepository.FindAll(); var schools = this.SchoolRepository.FindAll(); #endregion ExcelStorage provider = new ExcelStorage(typeof(ChannelData), filename, 2, 1); var data = provider.ExtractRecords() as ChannelData[]; var toImportList = new List<ImportCustomer>(); var toUpdateCustomers = new List<Customer>(); var toAddCustomers = new List<Customer>(); var duplicates = new List<ImportDupliate>(); //var currentCustomers = this.FindBySchoolId(schoolId); r.TotalQty = data.Length; foreach (var d in data) { #region 构建对象 var ic = new ImportCustomer { ProvinceName = d.ProvinceName, CityName = d.CityName, DistrictName = d.DistrictName, SchoolName = d.SchoolName, Name = d.Name, Gender = d.Gender, Score = String.IsNullOrEmpty(d.Score) ? null : (int?)Int32.Parse(d.Score.Trim()), Address = d.Address, Postcode = d.Postcode, Contact = d.Contact, Tel = d.Telephone, Mobile = d.Mobile, ImportKey = key, ImportType = "按渠道导入", InfoSource = infoSourceId, IsProcessed = false, Level = level, MarketYear = marketingYear, QQ = d.QQ, Clazz = d.Clazz }; #endregion toImportList.Add(ic); #region 读取省、市、区和学校的信息 var prov = provinces.FirstOrDefault(o => o.Name.Equals(ic.ProvinceName)); if (prov == null) { ic.ErrorMsg = "找不到省份:" + ic.ProvinceName; r.ErrorQty++; continue; } ic.ProvinceId = prov.Id; var city = cities.FirstOrDefault(o => o.ProvinceId.Equals(ic.ProvinceId) && o.Name.Equals(ic.CityName)); if (city == null) { ic.ErrorMsg = "在"+ic.ProvinceName+"里找不到"+ic.CityName; r.ErrorQty++; continue; } ic.CityId = city.Id; var district = districts.FirstOrDefault(o => o.CityId.Equals(ic.CityId) && o.Name.Equals(ic.DistrictName)); if (district == null) { ic.ErrorMsg = "在" + ic.CityName + "里找不到"+ic.DistrictName; r.ErrorQty++; continue; } ic.DistrictId = district.Id; var school = schools.FirstOrDefault(o => o.DistrictId.Equals(ic.DistrictId) && o.Name.Equals(d.SchoolName)); if (school == null) { ic.ErrorMsg = "在" + ic.DistrictName + "里找不到" + ic.SchoolName; r.ErrorQty++; continue; } ic.SchoolId = school.Id; #endregion #region 同校有同名且同电话(或手机)的,补全数据 var customer = this.Repository.FindByName(ic.Name).FirstOrDefault(o => (o.SchoolId.HasValue && o.SchoolId.Value.Equals(ic.SchoolId.Value) ) && ((o.Telephone != null && o.Telephone.Equals(ic.Tel)) || (o.Mobile != null && o.Mobile.Equals(ic.Mobile)))); if (customer != null) { if (String.IsNullOrEmpty(customer.Address)) { customer.Address = ic.Address; } if (String.IsNullOrEmpty(customer.Telephone)) { customer.Telephone = ic.Tel; } if (String.IsNullOrEmpty(customer.Mobile)) { customer.Mobile = ic.Mobile; } if (!customer.GaoKaoScore.HasValue) { customer.GaoKaoScore = ic.Score; } toUpdateCustomers.Add(customer); ic.IsProcessed = true; r.UpdatedQty++; continue; } #endregion #region 同样有同名或同电话或同手机的,认定为重复数据 var dCustomers = this.FindBySchoolId(ic.SchoolId).Where(o => o.Name.Equals(ic.Name) || (o.Telephone != null && o.Telephone.Length>0 && ic.Tel!=null && ic.Tel.Length>0 && o.Telephone.Equals(ic.Tel)) || (o.Mobile != null && o.Mobile.Length>0 && ic.Mobile!=null && ic.Mobile.Length>0 && o.Mobile.Equals(ic.Mobile)) ).ToList(); if (dCustomers.Count == 0) { #region 无重复 customer = new Customer { DistrictId = ic.DistrictId, SchoolId = ic.SchoolId, Name = ic.Name, Gender = ic.Gender, GaoKaoScore = ic.Score, Address = ic.Address, Postcode = ic.Postcode, Telephone = ic.Tel, Mobile = ic.Mobile, EduLevel = level, SmallInfoSourceId = infoSourceId, IsImport = true, MarketYear = marketingYear, TeleSalesTimes = 0, Important = false, IsClosed = false, IsDinWei = false, IsGaoKao = false, IsLeaderFollow = false, IsPay = false, IsRefund = false, IsDropIn = false, IsSignUp = false, Status = "未上门", QQ = ic.QQ, Clazz = ic.Clazz }; toAddCustomers.Add(customer); ic.IsProcessed = true; r.AddedQty++; #endregion continue; } else { //省 市 区 学校 姓名 性别 总分 地址 邮编 联系人 固定电话 移动电话 r.DuplicateQty++; #region 有重复 //var dCustomers = this.FindBySchoolId(ic.SchoolId).Where(o => o.Name.Equals(ic.Name) || //(o.Telephone != null && o.Telephone.Equals(ic.Tel)) || (o.Mobile != null && o.Mobile.Equals(ic.Mobile))).ToList(); // 处理重复的数据 var duplicate = new ImportDupliate { ImportCustomer = ic, ImportKey = key, Mobile = ic.Mobile, Name = ic.Name, SchoolName = ic.SchoolName, Tel = ic.Tel, Score =ic.Score, ErrorMsg = String.Empty }; dCustomers.ForEach(o => { var em = String.Empty; if (duplicate.Name.Equals(o.Name)) { em += "姓名重复,"; } if (duplicate.Tel != null && o.Telephone != null && duplicate.Tel.Equals(o.Telephone)) { em += "家庭电话重复,"; } if (duplicate.Mobile != null && o.Mobile != null && duplicate.Mobile.Equals(o.Mobile)) { em += "手机号码重复,"; } duplicate.ErrorMsg += em; var dup = new ImportDupliate { CustomerId=o.Id, ImportKey = key, Mobile = o.Mobile, Name = o.Name, SchoolName = o.School.Name, Tel = o.Telephone, Score=o.GaoKaoScore, ErrorMsg = em }; duplicates.Add(dup); }); duplicates.Add(duplicate); #endregion } #endregion } toImportList.ForEach(o => { this.ImportCustomerRepository.Add(o); }); toUpdateCustomers.ForEach(o => { this.Repository.Update(o); }); toAddCustomers.ForEach(o => { this.Repository.Add(o); }); duplicates.ForEach(o => { this.ImportDupliateRepository.Add(o); }); this.Db.Save(); r.Successful = true; return r; }
public SchoolController(ISchoolRepository repository) { _repository = repository; }
public StudentsController(ISchoolRepository schoolRepository, IMapper mapper) { this._schoolRepository = schoolRepository; this.mapper = mapper; }
public SchoolInformationController(ISchoolRepository schoolRepository) { this._repository = schoolRepository; }
public SchoolService(ISchoolRepository repository) { Repository = repository; School = Repository.GetSchool(); }
public SchoolController(ISchoolService schoolService, ISchoolRepository schoolRepository) { _schoolService = schoolService; _schoolRepository = schoolRepository; }
public SchoolService(ISchoolRepository _schoolRepository) { this.schoolRepository = _schoolRepository; }
public SchoolController(ISchoolRepository repo, IMapper mapper, IHttpContextAccessor httpContextAccessor) { _mapper = mapper; _repo = repo; }
public SchoolService(ISchoolRepository schoolRepository) { SchoolRepository = schoolRepository; }
internal static async Task Seed_Database(ISchoolRepository repository) { if ((await repository.CountAsync <StudentModel, Student>()) > 0) { return;//database has been seeded } InstructorModel[] instructors = new InstructorModel[] { new InstructorModel { FirstName = "Roger", LastName = "Zheng", HireDate = DateTime.Parse("2004-02-12"), EntityState = LogicBuilder.Domain.EntityStateType.Added }, new InstructorModel { FirstName = "Kim", LastName = "Abercrombie", HireDate = DateTime.Parse("1995-03-11"), EntityState = LogicBuilder.Domain.EntityStateType.Added }, new InstructorModel { FirstName = "Fadi", LastName = "Fakhouri", HireDate = DateTime.Parse("2002-07-06"), OfficeAssignment = new OfficeAssignmentModel { Location = "Smith 17" }, EntityState = LogicBuilder.Domain.EntityStateType.Added }, new InstructorModel { FirstName = "Roger", LastName = "Harui", HireDate = DateTime.Parse("1998-07-01"), OfficeAssignment = new OfficeAssignmentModel { Location = "Gowan 27" }, EntityState = LogicBuilder.Domain.EntityStateType.Added }, new InstructorModel { FirstName = "Candace", LastName = "Kapoor", HireDate = DateTime.Parse("2001-01-15"), OfficeAssignment = new OfficeAssignmentModel { Location = "Thompson 304" }, EntityState = LogicBuilder.Domain.EntityStateType.Added } }; await repository.SaveGraphsAsync <InstructorModel, Instructor>(instructors); DepartmentModel[] departments = new DepartmentModel[] { new DepartmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, Name = "English", Budget = 350000, StartDate = DateTime.Parse("2007-09-01"), InstructorID = instructors.Single(i => i.FirstName == "Kim" && i.LastName == "Abercrombie").ID, Courses = new HashSet <CourseModel> { new CourseModel { CourseID = 2021, Title = "Composition", Credits = 3 }, new CourseModel { CourseID = 2042, Title = "Literature", Credits = 4 } } }, new DepartmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, Name = "Mathematics", Budget = 100000, StartDate = DateTime.Parse("2007-09-01"), InstructorID = instructors.Single(i => i.FirstName == "Fadi" && i.LastName == "Fakhouri").ID, Courses = new HashSet <CourseModel> { new CourseModel { CourseID = 1045, Title = "Calculus", Credits = 4 }, new CourseModel { CourseID = 3141, Title = "Trigonometry", Credits = 4 } } }, new DepartmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, Name = "Engineering", Budget = 350000, StartDate = DateTime.Parse("2007-09-01"), InstructorID = instructors.Single(i => i.FirstName == "Roger" && i.LastName == "Harui").ID, Courses = new HashSet <CourseModel> { new CourseModel { CourseID = 1050, Title = "Chemistry", Credits = 3 } } }, new DepartmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, Name = "Economics", Budget = 100000, StartDate = DateTime.Parse("2007-09-01"), InstructorID = instructors.Single(i => i.FirstName == "Candace" && i.LastName == "Kapoor").ID, Courses = new HashSet <CourseModel> { new CourseModel { CourseID = 4022, Title = "Microeconomics", Credits = 3 }, new CourseModel { CourseID = 4041, Title = "Macroeconomics", Credits = 3 } } } }; await repository.SaveGraphsAsync <DepartmentModel, Department>(departments); IEnumerable <CourseModel> courses = departments.SelectMany(d => d.Courses); CourseAssignmentModel[] courseInstructors = new CourseAssignmentModel[] { new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Chemistry").CourseID, InstructorID = instructors.Single(i => i.LastName == "Kapoor").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Chemistry").CourseID, InstructorID = instructors.Single(i => i.LastName == "Harui").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID, InstructorID = instructors.Single(i => i.LastName == "Zheng").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Macroeconomics").CourseID, InstructorID = instructors.Single(i => i.LastName == "Zheng").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Calculus").CourseID, InstructorID = instructors.Single(i => i.LastName == "Fakhouri").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Trigonometry").CourseID, InstructorID = instructors.Single(i => i.LastName == "Harui").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Composition").CourseID, InstructorID = instructors.Single(i => i.LastName == "Abercrombie").ID }, new CourseAssignmentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, CourseID = courses.Single(c => c.Title == "Literature").CourseID, InstructorID = instructors.Single(i => i.LastName == "Abercrombie").ID }, }; await repository.SaveGraphsAsync <CourseAssignmentModel, CourseAssignment>(courseInstructors); StudentModel[] students = new StudentModel[] { new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Carson", LastName = "Alexander", EnrollmentDate = DateTime.Parse("2010-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Chemistry").CourseID, Grade = Contoso.Domain.Entities.Grade.A }, new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID, Grade = Contoso.Domain.Entities.Grade.C }, new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Macroeconomics").CourseID, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Meredith", LastName = "Alonso", EnrollmentDate = DateTime.Parse("2012-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Calculus").CourseID, Grade = Contoso.Domain.Entities.Grade.B }, new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Trigonometry").CourseID, Grade = Contoso.Domain.Entities.Grade.B }, new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Composition").CourseID, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Arturo", LastName = "Anand", EnrollmentDate = DateTime.Parse("2013-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Chemistry").CourseID }, new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID, Grade = Contoso.Domain.Entities.Grade.B }, } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Gytis", LastName = "Barzdukas", EnrollmentDate = DateTime.Parse("2012-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Chemistry").CourseID, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Yan", LastName = "Li", EnrollmentDate = DateTime.Parse("2012-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Composition").CourseID, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Peggy", LastName = "Justice", EnrollmentDate = DateTime.Parse("2011-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = courses.Single(c => c.Title == "Literature").CourseID, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Laura", LastName = "Norman", EnrollmentDate = DateTime.Parse("2013-09-01") }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Nino", LastName = "Olivetto", EnrollmentDate = DateTime.Parse("2005-09-01") }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Tom", LastName = "Spratt", EnrollmentDate = DateTime.Parse("2010-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = 1045, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Billie", LastName = "Spratt", EnrollmentDate = DateTime.Parse("2010-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = 1050, Grade = Contoso.Domain.Entities.Grade.B } } }, new StudentModel { EntityState = LogicBuilder.Domain.EntityStateType.Added, FirstName = "Jackson", LastName = "Spratt", EnrollmentDate = DateTime.Parse("2017-09-01"), Enrollments = new HashSet <EnrollmentModel> { new EnrollmentModel { CourseID = 2021, Grade = Contoso.Domain.Entities.Grade.B } } } }; await repository.SaveGraphsAsync <StudentModel, Student>(students); }
public SchoolsController(IUnitOfWork unitOfWork, ISchoolRepository repository) { this.repository = repository; }
public SchoolController(ISchoolRepository schoolRepo) { _schoolRepo = schoolRepo; }
public UnitOfWork(StudentEducationBoardDbContext context) { _context = context; Repository = new SchoolRepository(_context); }
public SchoolService(ISchoolRepository SchoolRepository) { this._SchoolRepository = SchoolRepository; }
public ClassesController(ISchoolRepository schoolRepo, IClasseRepository classeRepo) { schoolRepository = schoolRepo; classeRepository = classeRepo; }
// // GET: /Home/ public HomeController(IStudentRepository studentRepository, ISchoolRepository schoolRepository) { _studentRepository = studentRepository; _schoolRepository = schoolRepository; }
public SchoolController(ISchoolRepository schoolRepository) { _schoolRepository = schoolRepository; }
public SchoolService(ISchoolRepository repository) : base(repository) { _repository = repository; }
public SchoolServices(ISchoolRepository schoolRepository) { _sRepository = schoolRepository; }
public ContactController(ISchoolRepository schoolRepo ) { _schoolRepo = schoolRepo; }
public CataloguesController(ISchoolRepository schoolRepository) { _schoolRepository = schoolRepository; }
public CreateModelToSectionMapper(ISchoolRepository schoolRepository, IGenericRepository genericRepository) { _genericRepository = genericRepository; _schoolRepository = schoolRepository; }
public SchoolBL() { this.schoolRepository = new SchoolRepository(); }
public SetModelToStudentSectionAssociationMapper(IGenericRepository genericRepository, ISchoolRepository schoolRepository) { _genericRepository = genericRepository; _schoolRepository = schoolRepository; }
public SchoolBL(ISchoolRepository schoolRepository) { this.schoolRepository = schoolRepository; }
public SchoolController(ISchoolRepository schoolRepository, IUnitOfWork unitOfWork, IMapper mapper) => (_schoolRepository, _unitOfWork, _mapper) = (schoolRepository, unitOfWork, mapper);
public StudentController(IStudentRepository studentrepository, ISchoolRepository schoolrepository) { this.studentrepository = studentrepository; this.schoolrepository = schoolrepository; }
public SchoolsService(ISchoolRepository schoolRepository) { this.schoolRepository = schoolRepository; }
/// <summary> /// 构造器方法 /// </summary> /// <param name="schoolRepository"></param> public SchoolService(ISchoolRepository schoolRepository) { this.schoolRepository = schoolRepository; }
public SchoolBL(ISchoolRepository schoolRepository) { this.schoolRepository = schoolRepository; }
public StudentProcessingService(IStudentRepository studentRepo, ISchoolRepository schoolRepo) { _studentRepo = studentRepo; _schoolRepo = schoolRepo; }
public ImportResult ImportBySchool(string key, int schoolId, string level, int marketingYear, int infoSourceId, string filename, bool isDelOldData) { ImportResult r = new ImportResult(); if (isDelOldData) { this.DeleteBySchoolId(schoolId); } #region 初始化 Repository this.ProvRepository = new ProvinceRepository(this.Db); this.CityRepository = new CityRepository(this.Db); this.DistrictRepository = new DistrictRepository(this.Db); this.SchoolRepository = new SchoolRepository(this.Db); this.ImportCustomerRepository = new ImportCustomerRepository(this.Db); this.ImportDupliateRepository = new ImportDupliateRepository(this.Db); #endregion #region 读取初始数据 var provinces = this.ProvRepository.FindAll(); var cities = this.CityRepository.FindAll(); var districts = this.DistrictRepository.FindAll(); var schools = this.SchoolRepository.FindAll(); #endregion ExcelStorage provider = new ExcelStorage(typeof(QuestionaryData), filename, 3, 1); var data = provider.ExtractRecords() as QuestionaryData[]; var toImportList = new List<ImportCustomer>(); var toUpdateCustomers = new List<Customer>(); var toAddCustomers = new List<Customer>(); var duplicates = new List<ImportDupliate>(); var currentCustomers = this.FindBySchoolId(schoolId); r.TotalQty = data.Length; foreach (var d in data) { #region 构建对象 var ic = new ImportCustomer { Address = d.Address, CityName = d.CityName, Clazz = d.Clazz, DistrictName = d.DistrictName, Gender = d.Gender, ImportKey = key, ImportType = "按学校导入", InfoSource = infoSourceId, IsProcessed = false, Level = level, MarketYear = marketingYear, Mobile = d.Mobile, ProvinceName = d.ProvinceName, QQ = d.QQ, SchoolId = schoolId, SchoolName = "", Tel = d.TelPrefix + "-" + d.Telephone, Name = d.Name }; if (String.IsNullOrEmpty(d.TelPrefix) && String.IsNullOrEmpty(d.Telephone)) { ic.Tel = null; } #endregion toImportList.Add(ic); #region 读取省、市、区和学校的信息 var prov = provinces.FirstOrDefault(o => o.Name.Equals(ic.ProvinceName)); if (prov == null) { ic.ErrorMsg = "找不到省份:" + ic.ProvinceName; r.ErrorQty++; continue; } ic.ProvinceId = prov.Id; var city = cities.FirstOrDefault(o => o.ProvinceId.Equals(ic.ProvinceId) && o.Name.Equals(ic.CityName)); if (city == null) { ic.ErrorMsg = "在"+ic.ProvinceName+"里找不到"+ic.CityName; r.ErrorQty++; continue; } ic.CityId = city.Id; var district = districts.FirstOrDefault(o => o.CityId.Equals(ic.CityId) && o.Name.Equals(ic.DistrictName)); if (district == null) { ic.ErrorMsg = "在" + ic.CityName + "里找不到"+ic.DistrictName; r.ErrorQty++; continue; } ic.DistrictId = district.Id; ic.SchoolName = schools.First(o => o.Id.Equals(ic.SchoolId)).Name; #endregion #region 同校有同名且同电话(或手机)的,补全数据 var customer = currentCustomers.FirstOrDefault(o => o.Name.Equals(ic.Name) && ((o.Telephone != null && o.Telephone.Equals(ic.Tel)) || (o.Mobile != null && o.Mobile.Equals(ic.Mobile)))); if (customer != null) { if (String.IsNullOrEmpty(customer.Address)) { customer.Address = ic.Address; } if (String.IsNullOrEmpty(customer.Telephone)) { customer.Telephone = ic.Tel; } if (String.IsNullOrEmpty(customer.Mobile)) { customer.Mobile = ic.Mobile; } if (String.IsNullOrEmpty(customer.QQ)) { customer.QQ = ic.QQ; } toUpdateCustomers.Add(customer); ic.IsProcessed = true; r.UpdatedQty++; continue; } #endregion #region 同样有同名或同电话或同手机的,认定为重复数据 var dCustomers = currentCustomers.Where(o => o.Name.Equals(ic.Name) //|| (o.Telephone !=null && o.Telephone.Length>0 && ic.Tel!=null && ic.Tel.Length>0 && o.Telephone.Equals(ic.Tel)) //|| (o.Mobile != null && o.Mobile.Length>0 && ic.Mobile !=null && ic.Mobile.Length>0 && o.Mobile.Equals(ic.Mobile)) ).ToList(); if (dCustomers.Count == 0) { #region 无重复 customer = new Customer { Address = ic.Address, QQ = ic.QQ, Mobile = ic.Mobile, Telephone = ic.Tel, Name = ic.Name, Clazz = ic.Clazz, DistrictId = ic.DistrictId, EduLevel = level, Gender = ic.Gender, SmallInfoSourceId = infoSourceId, IsImport = true, MarketYear = marketingYear, SchoolId = schoolId, TeleSalesTimes = 0, Important = false, IsClosed = false, IsDinWei = false, IsGaoKao = false, ConsultType = "未电访", IsLeaderFollow = false, IsPay=false, IsRefund=false, IsDropIn=false, IsSignUp=false, Status = "未上门" }; toAddCustomers.Add(customer); ic.IsProcessed = true; r.AddedQty++; #endregion continue; } else { r.DuplicateQty++; #region 有重复 // 处理重复的数据 var duplicate = new ImportDupliate { ImportCustomer = ic, ImportKey = key, Mobile = ic.Mobile, Name = ic.Name, SchoolName = ic.SchoolName, Tel = ic.Tel }; duplicates.Add(duplicate); dCustomers.ForEach(o => { duplicate = new ImportDupliate { CustomerId=o.Id, ImportKey = key, Mobile = o.Mobile, Name = o.Name, SchoolName = o.School.Name, Tel = o.Telephone, Score=o.GaoKaoScore }; duplicates.Add(duplicate); }); #endregion } #endregion } toImportList.ForEach(o => { this.ImportCustomerRepository.Add(o); }); toUpdateCustomers.ForEach(o => { this.Repository.Update(o); }); toAddCustomers.ForEach(o => { this.Repository.Add(o); }); duplicates.ForEach(o => { this.ImportDupliateRepository.Add(o); }); this.Db.Save(); r.Successful = true; return r; }
public AcademicDetailModelToStudentSchoolAssociationMapperTest() { _schoolRepository = Substitute.For<ISchoolRepository>(); _genericRepository = Substitute.For<IGenericRepository>(); _mapper = new AcademicDetailModelToStudentSchoolAssociationMapper(_schoolRepository, _genericRepository); }
public SchoolBL() { this.schoolRepository = new SchoolRepository(); }
public StudentReportParser(ISchoolRepository schoolRepo) { _schoolRepo = schoolRepo; }
public StudentMappingHelper(ISchoolRepository schoolRepo) { _schoolRepo = schoolRepo; }
public ApplicationDataInitializer(UserManager <ApplicationUser> userManager, ISchoolRepository schoolRepository, ApplicationDbContext dbContext) { _userManager = userManager; _schoolRepository = schoolRepository; _dbContext = dbContext; }
public HomeController() { _schoolRepository = ServiceLocator.Current.GetInstance<ISchoolRepository>(); _studentRepository = ServiceLocator.Current.GetInstance<IStudentRepository>(); }
public SchoolService() { _schoolRepo = new SchoolRepository(); }
private readonly ISchoolRepository _schoolRepo; //= ServiceLocator.Current.GetInstance<ITeachingTaskRepository>(); #endregion Fields #region Constructors public DeclarationProgressAppl(ITypeAdapter adapter, ISchoolRepository schoolRepo, IDepartmentRepository departRepo) { _adapter = adapter; _schoolRepo = schoolRepo; _departRepo = departRepo; }
public SchoolRepositoryRelationshipsTests(QuestedContextFactory questedContextFactory) { _context = questedContextFactory.ContextInstance; _sut = new SchoolRepository(_context); _teacherRepository = new TeacherRepository(_context); }