示例#1
0
文件: SocialTask.cs 项目: dKluev/Site
 private static List <string> GetTemplates(IRepository2 <HtmlBlock> blockService, int blockId)
 {
     return(blockService.GetValues(blockId,
                                   x => x.Description).Split(new [] { "</p>" },
                                                             StringSplitOptions.RemoveEmptyEntries)
            .Select(x => x.Remove("<p>").Remove("\n").Remove("\r"))
            .Where(x => x.Contains("[Date]")).ToList());
 }
示例#2
0
 public static void DeleteAndSubmit <T>(this IRepository2 <T> repository,
                                        IEnumerable <T> objList) where T : class
 {
     foreach (var obj in objList)
     {
         repository.Delete(obj);
     }
     repository.SubmitChanges();
 }
示例#3
0
 public TestService(IRepository1 repository1,
                    IRepository2 repository2,
                    IRepository3 repository3,
                    IRepository4 repository4,
                    IRepository5 repository5
                    )
 {
     this.repository1 = repository1;
     this.repository2 = repository2;
     this.repository3 = repository3;
     this.repository4 = repository4;
     this.repository5 = repository5;
 }
示例#4
0
 public ResearchController(
     IRepository2 <Research> researchRepository,
     IRepository <ResearchCategory> researchCategoryRepository,
     IConfigurationRepository configurationRepository,
     IDateTimeRepository datetimeRepository,
     IResearchService researchService)
 {
     this._researchRepository         = researchRepository;
     this._researchCategoryRepository = researchCategoryRepository;
     this._configurationRepository    = configurationRepository;
     this._datetimeRepository         = datetimeRepository;
     this._researchService            = researchService;
 }
 public YandexMarketProductService(
     ICacheManager cacheManager,
     IRepository2 <YandexMarketProductRecord> productRepository,
     IYandexMarketCategoryService yandexMarketCategoryService,
     IProductService productService,
     IYugCatalogPriceParserService yugCatalogPriceParserService)
 {
     this._cacheManager                = cacheManager;
     this._productRepository           = productRepository;
     this._yandexMarketCategoryService = yandexMarketCategoryService;
     this._productService              = productService;
     _yugCatalogPriceParserService     = yugCatalogPriceParserService;
 }
 /// <summary>
 /// Ctor
 /// </summary>
 /// <param name="cacheManager">Cache manager</param>
 /// <param name="specificationAttributeRepository">Specification attribute repository</param>
 /// <param name="specificationAttributeOptionRepository">Specification attribute option repository</param>
 /// <param name="productSpecificationAttributeRepository">Product specification attribute repository</param>
 /// <param name="eventPublisher">Event published</param>
 /// <param name="dataProvider">data Provider</param>
 public SpecificationAttributeService(ICacheManager cacheManager,
                                      IRepository <SpecificationAttribute> specificationAttributeRepository,
                                      IRepository2 <SpecificationAttributeOption> specificationAttributeOptionRepository,
                                      IRepository2 <ProductSpecificationAttribute> productSpecificationAttributeRepository,
                                      IEventPublisher eventPublisher,
                                      IDataProvider dataProvider,
                                      IDbContext2 dbContext)
 {
     _cacheManager = cacheManager;
     _specificationAttributeRepository        = specificationAttributeRepository;
     _specificationAttributeOptionRepository  = specificationAttributeOptionRepository;
     _productSpecificationAttributeRepository = productSpecificationAttributeRepository;
     _eventPublisher = eventPublisher;
     _dataProvider   = dataProvider;
     _dbContext      = dbContext;
 }
示例#7
0
 public ForumController(
     IRepository2 <Forum> forumRepository,
     IRepository <ForumCategory> forumCategoryRepository,
     IRepository <Comment> commentRepository,
     IConfigurationRepository configurationRepository,
     ICommentService commentService,
     IDateTimeRepository datetimeRepository,
     IForumService forumService)
 {
     this._forumRepository         = forumRepository;
     this._forumCategoryRepository = forumCategoryRepository;
     this._commentRepository       = commentRepository;
     this._configurationRepository = configurationRepository;
     this._commentService          = commentService;
     this._datetimeRepository      = datetimeRepository;
     this._forumService            = forumService;
 }
示例#8
0
 public CourseController(
     IDateTimeRepository datetimeRepository,
     IRepository2 <Course> courseRepository,
     IRepository2 <PhotoAlbum> photoAlbumRepository,
     IRepository <CourseCategory> courseCategoryRepository,
     ICourseService courseService,
     ICurriculumRepository curriculumRepository,
     IStudentCourseRepository studentCourseRepository,
     IRepository <StudentScore> studentScoreRepository,
     IConfigurationRepository configurationRepository,
     IPhotoAlbumService photoAlbumService,
     IRepository <Photo> photoRepository,
     ICurriculumService curriculumService,
     IStudentCourseService studentCourseService,
     IStudentScoreService studentScoreService,
     IBannerService bannerService,
     IRepository <Banner> bannerRepository,
     IRepository <Handout> handoutRepository,
     IHandoutService handoutService)
 {
     this._datetimeRepository       = datetimeRepository;
     this._courseRepository         = courseRepository;
     this._photoAlbumRepository     = photoAlbumRepository;
     this._courseCategoryRepository = courseCategoryRepository;
     this._courseService            = courseService;
     this._curriculumRepository     = curriculumRepository;
     this._studentCourseRepository  = studentCourseRepository;
     this._studentScoreRepository   = studentScoreRepository;
     this._configurationRepository  = configurationRepository;
     this._photoAlbumService        = photoAlbumService;
     this._photoRepository          = photoRepository;
     this._curriculumService        = curriculumService;
     this._studentCourseService     = studentCourseService;
     this._studentScoreService      = studentScoreService;
     this._bannerService            = bannerService;
     this._bannerRepository         = bannerRepository;
     this._handoutRepository        = handoutRepository;
     this._handoutService           = handoutService;
 }
示例#9
0
 public SharedController(
     IEmailSender emailSender,
     IRepository <Photo> photoRepository,
     IRepository2 <PhotoAlbum> photoAlbumRepository,
     IDateTimeRepository datetimeRepository,
     IConfigurationRepository configRepository,
     IPhotoAlbumService photoAlbumService,
     IRepository <Banner> bannerRepository,
     IBannerService bannerService,
     IAlumniService alumniService,
     IRepository <Alumni> alumniRepository)
 {
     this._emailSender          = emailSender;
     this._photoRepository      = photoRepository;
     this._photoAlbumRepository = photoAlbumRepository;
     this._datetimeRepository   = datetimeRepository;
     this._configRepository     = configRepository;
     this._photoAlbumService    = photoAlbumService;
     this._bannerRepository     = bannerRepository;
     this._bannerService        = bannerService;
     this._alumniService        = alumniService;
     this._alumniRepository     = alumniRepository;
 }
示例#10
0
 public static void InsertAndSubmit <T>(this IRepository2 <T> repository, T obj)
     where T : class
 {
     repository.Insert(obj);
     repository.SubmitChanges();
 }
示例#11
0
 public void Cleanup()
 {
     _service1    = null;
     _repository1 = null;
     _repository2 = null;
 }
示例#12
0
 public static void DeleteAndSubmit <T>(this IRepository2 <T> repository, T obj)
     where T : class
 {
     repository.Delete(obj);
     repository.SubmitChanges();
 }
示例#13
0
 public static K FirstOrDefault <T, K>(this IRepository2 <T> repository,
                                       Expression <Func <T, bool> > predicate, Expression <Func <T, K> > selector)
     where T : class
 {
     return(repository.GetAll(predicate).Select(selector).FirstOrDefault());
 }
示例#14
0
 public Service1(IRepository1 repository1, IRepository2 repository2)
 {
     _repository1 = repository1;
     _repository2 = repository2;
 }
示例#15
0
 public UnitOfWork(RepositoryPtrnContext context)
 {
     _context = context;
     Repo1    = new Repository1(context);
     Repo2    = new Repository2(context);
 }
示例#16
0
 public Service3(IRepository1 repo1, IRepository2 repo2, ITransactionProvider transactionProvider)
 {
     _repo1 = repo1;
     _repo2 = repo2;
     _transactionProvider = transactionProvider;
 }
示例#17
0
 public CourseService(IRepository2 <Course> courseRepository, IStudentCourseRepository studentCourseRepository)
 {
     this._userManager             = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new SwuDBContext()));
     this._courseRepository        = courseRepository;
     this._studentCourseRepository = studentCourseRepository;
 }
示例#18
0
        private void Button2_Click(object sender, EventArgs e)
        {
            //trnglRepository = new StlTriangularRepository<string>();
            tetrahedralRepository = new StlTetrahedralRepository <string>();
            trinagleRepository    = new StlTriangularRepository2 <string>();

            List <List <Triangle> > vertebras  = new List <List <Triangle> >();
            List <Triangle>         myvertebra = new List <Triangle>();

            myvertebra = ReadVertebra(1, "Vertebras/st1/");

            vertebras.Add(myvertebra);

            //vertebras.Add(ReadVertebra(1, "Vertebras/st2/"));
            //int countVertebras = 5;
            //for (int i = 2; i <= countVertebras; i++)
            //{
            //    vertebras.Add(ReadVertebra(i, "Vertebras/st2/"));
            //}

            List <Triangle> allVertebras = new List <Triangle>();

            vertebras.ForEach(trngls => allVertebras.AddRange(trngls));

            double shiftX = Math.Abs(allVertebras.Min(tngl => tngl.Center.X));
            double shiftY = Math.Abs(allVertebras.Min(tngl => tngl.Center.Y));
            double shiftZ = Math.Abs(allVertebras.Min(tngl => tngl.Center.Z));

            double minX   = allVertebras.Min(tngl => tngl.Center.X);
            double minY   = allVertebras.Min(tngl => tngl.Center.Y);
            double minZ   = allVertebras.Min(tngl => tngl.Center.Z);
            double maxX   = allVertebras.Max(tngl => tngl.Center.X);
            double maxY   = allVertebras.Max(tngl => tngl.Center.Y);
            double maxZ   = allVertebras.Max(tngl => tngl.Center.Z);
            double avX    = (minX + maxX) / 2.0;
            double avY    = (minY + maxY) / 2.0;
            double lenght = maxX - minX;
            double width  = maxY - minY;

            width = (lenght > width) ? lenght : width;
            double height = maxZ - minZ;

            ShiftModel(ref vertebras, shiftX, shiftY, shiftZ);
            //ShiftModel(ref disks, shiftX, shiftY, shiftZ);

            toolStripStatusLabel1.Text = $"Генерация конечно-элементной сетки...";
            this.Refresh();

            FeModel scene = GenerateTetrahedralModel(width, height + STEP_HEIGHT, STEP_WIDTH, STEP_HEIGHT, VERTEBRA_MATERIAL_ID);

            model = GetGeneralModelFromScene(scene, vertebras);
            var aaaaaa = model.Triangles;
            var bbbbbb = model.Tetrahedrons;

            //load = new Force(SelectedSide.TOP, new Node((int)avX, (int)avY, maxZ - 10), forceValue, true, model.Triangles);

            toolStripStatusLabel1.Text = $"Учет граничных условий и внешних нагрузок...";
            this.Refresh();

            //load = new Force(SelectedSide.TOP, new Node((int)avY, (int)avX, maxZ - 10), forceValue, true, model.Triangles);
            //load = new Pressure(SelectedSide.TOP, new Node((int)avX, (int)avY, maxZ - 10), forceValue, true, model.Triangles);
            //load = new ConcentratedForce(SelectedSide.TOP, forceValue, true, model.Nodes, height / 10.0);
            load       = new Force(SelectedSide.TOP, forceValue, true, model.Nodes, height / 18.0);
            conditions = new VolumeBoundaryCondition(SelectedSide.BOTTOM, model.Nodes, height / 20.0);
            //conditions = new VolumeBoundaryCondition(SelectedSide.BOTTOM, new Node((int)avX, (int)avY, minZ), model.Triangles);
            tetrahedralRepository.Create(model.Id + "in", model.Tetrahedrons);

            int         concentratedIndex = load.LoadVectors.FirstOrDefault().Key;
            int         step      = (int)(STEP_HEIGHT / 4.0);
            Node        tmpNode   = model.Nodes.FirstOrDefault(nd => nd.GlobalIndex == concentratedIndex);
            List <Node> nearNodes = new List <Node>(model.Nodes.Where(nd =>
                                                                      (nd.X > model.Nodes[concentratedIndex].X - step && nd.X < model.Nodes[concentratedIndex].X + step) &&
                                                                      (nd.Y > model.Nodes[concentratedIndex].Y - step && nd.Y < model.Nodes[concentratedIndex].Y + step) &&
                                                                      (nd.Z > model.Nodes[concentratedIndex].Z - step && nd.Z < model.Nodes[concentratedIndex].Z + step))
                                                    .ToList());

            nearNodes.Remove(tmpNode);

            concentratedIndex = TrueIndexOfCenter(concentratedIndex, nearNodes, 0);
            if (concentratedIndex != load.LoadVectors.FirstOrDefault().Key)
            {
                LoadVector vector = new LoadVector(load.LoadVectors.FirstOrDefault().Value.Value, VectorDirection.Z);
                load.LoadVectors.Clear();
                load.LoadVectors.Add(concentratedIndex, vector);
            }

            //trnglRepository.Create(model.Id + "in", model.Triangles);
            //trnglRepository.Create(model.Id + "load", ((Force)load).LoadedTriangles);
            //trnglRepository.Create(model.Id + "fix", ((VolumeBoundaryCondition)conditions).FixedTriangles);



            solver   = new StressStrainSparseMatrix(model);
            solution = new StaticMechanicSparseSolution(solver, model);

            var begin = DateTime.Now;

            solution.Solve(TypeOfFixation.RIGID, conditions, load);

            TimeSpan endSolve = DateTime.Now - begin;

            double[] results = solution.Results;

            toolStripStatusLabel1.Text = $"Расчет завершен.";
            this.Refresh();

            using (StreamWriter writer = new StreamWriter("results.txt"))
            {
                writer.WriteLine($"Total time solving SLAE: {endSolve.TotalSeconds} sec.");
                writer.WriteLine();
                double max = solution.Results[2];
                for (int i = 2; i < solution.Results.Length; i += 3)
                {
                    if (Math.Abs(solution.Results[i]) > Math.Abs(max))
                    {
                        max = solution.Results[i];
                    }
                }

                writer.WriteLine($"Max deformation: {max} mm.");
                writer.WriteLine();

                for (int i = 0; i < solution.Results.Length; i++)
                {
                    writer.WriteLine(solution.Results[i]);
                }
            }

            TotalEpure(model.Nodes, solution.Results, "TotalEpureSpine");

            List <Tetrahedron> outList = ApplyResultsToTetrahedrons(results);
            List <Node>        nodlist = ApplyResultsToGenList(results);

            tetrahedralRepository.Create(model.Id + "out", outList);
            tetrahedralRepository.Create2(model.Id + "out2", outList);
            trinagleRepository.Create2(model.Id + "out3", myvertebra, nodlist);

            lastname          = model.Id + "out3.stl";
            lastname_fullpath = Environment.CurrentDirectory + "\\" + lastname;

            MessageBox.Show($"Total time solving SLAE: {endSolve.TotalSeconds} sec.");

            //Process.Start("notepad.exe", "results.txt");
        }
示例#19
0
 public Service2(IRepository2 repository)
 {
     _repository = repository;
 }
示例#20
0
 public CompanyController(IRepository2 repo)
 {
     this.repo = repo;
 }
示例#21
0
 public PhotoAlbumService(IRepository2 <PhotoAlbum> photoAlbumRepository)
 {
     this._userManager          = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new SwuDBContext()));
     this._photoAlbumRepository = photoAlbumRepository;
 }
示例#22
0
 public static IQueryable <CoursePrerequisite> GetCoursePreCourses(IRepository2 <CoursePrerequisite> coursePrerequisiteService, string courseTC)
 {
     return(coursePrerequisiteService.GetAll(x => x.Course_TC == courseTC && x.RequiredCourse_TC != null));
 }
示例#23
0
 public TestServices(IUnitOfWork2 unitOfWork, IRepository2 <Test> imeiReponsitory)
 {
     _unitOfWork      = unitOfWork;
     _imeiReponsitory = imeiReponsitory;
 }
示例#24
0
 public void Setup()
 {
     _repository1 = new Repository1TestImplementation();
     _repository2 = new Repository2TestImplementation();
     _service1    = new Service1(_repository1, _repository2);
 }
示例#25
0
 public IPOController(IRepository2 repo)
 {
     this.repo = repo;
 }
示例#26
0
 public static IQueryable <T> GetAll <T>(this IRepository2 <T> repository,
                                         Expression <Func <T, bool> > predicate)
     where T : class
 {
     return(repository.GetAll().Where(predicate));
 }
示例#27
0
 public static T FirstOrDefault <T>(this IRepository2 <T> repository,
                                    Expression <Func <T, bool> > predicate)
     where T : class
 {
     return(repository.GetAll().FirstOrDefault(predicate));
 }
示例#28
0
 public HomeController(IApplicationUserServices applicationUserServices, IRepository2 <Course> courseRepository)
 {
 }
示例#29
0
 public Stuff2(IRepository2 repository2)
 {
     _repository2 = repository2;
 }