Пример #1
0
 public DetailBusiness(DetailRepository detailRepo, 
     QuestionBusiness questionBus, 
     ChoiceBusiness choiceBus)
 {
     _detailRepo = detailRepo;
     _questionBus = questionBus;
     _choiceBus = choiceBus;
 }
 public DetailController(
     ILogger <DetailController> logger,
     AccountingSubjectRepository accountingSubjectRepository,
     DetailRepository detailRepository)
 {
     this.logger = logger;
     this.accountingSubjectRepository = accountingSubjectRepository;
     this.detailRepository            = detailRepository;
 }
 public BookController(
     ILogger <BookController> logger,
     BookRepository bookRepository,
     DetailRepository detailRepository)
 {
     this.logger           = logger;
     this.bookRepository   = bookRepository;
     this.detailRepository = detailRepository;
 }
Пример #4
0
        static void Main(string[] args)
        {
            IWordRespository    wordRepo     = new WordRespository();
            IDetailRepository   detailRepo   = new DetailRepository();
            IExampleRepository  exampleRepo  = new ExampleRepository();
            ISynonymRepository  synonymRepo  = new SynonymRepository();
            ISubsenseRepository subsenseRepo = new SubsenseRepository();

            Scraper obj = new Scraper(wordRepo, detailRepo, exampleRepo, synonymRepo, subsenseRepo);

            obj.ScrapeAll();
        }
Пример #5
0
        public void Execute()
        {
            var sourceAccountingSubjectRepository = new AccountingSubjectRepository(this.sourceMongoDBOptions);
            var targetAccountingSubjectRepository = new AccountingSubjectRepository(this.targetMongoDBOptions);
            var accountingSubjects = sourceAccountingSubjectRepository.FetchAll().Result;

            targetAccountingSubjectRepository.CreateAll(accountingSubjects).Wait();

            var sourceDetailRepository = new DetailRepository(this.sourceMongoDBOptions);
            var targetDetailRepository = new DetailRepository(this.targetMongoDBOptions);
            var details = sourceDetailRepository.FetchAll().Result;

            targetDetailRepository.CreateAll(details).Wait();
        }
        // GET: Detail
        public ActionResult Index(int?page)
        {
            if (Session["UserID"] == null)
            {
                return(RedirectToAction("Login", "Login"));
            }
            var sessionId = Convert.ToInt32(Session["UserID"]);

            ViewBag.Name    = Session["FirstName"];
            ViewBag.Company = Session["Company"];
            ViewBag.Logo    = Session["Logo"];
            List <DetailModel> messages = new List <DetailModel>();
            DetailRepository   r        = new DetailRepository();

            messages = r.DetailList(sessionId);
            return(View(messages.ToList()));
        }
Пример #7
0
        static void Main(string[] args)
        {
            var connection = Connection.DetabaseConnection();

            ICarRepository    car    = new CarRepository(connection);
            IDetailRepository detail = new DetailRepository(connection);

            ICarService    carModel    = new CarService(car);
            IDetailService detailModel = new DetailService(detail);

            ICarController    carViewModel    = new CarController(carModel);
            IDetailController detailViewModel = new DetailController(detailModel);

            var detaildetail = detailViewModel.GetCar(3);

            var carCar = carViewModel.GetDetails(1);

            Console.ReadKey();
        }
        public JsonResult DetailList(string basTarih, string bitTarih)
        {
            var sessionId = Convert.ToInt32(Session["UserID"]);

            List <DetailModel> messages = new List <DetailModel>();
            DetailRepository   r        = new DetailRepository();
            DateTime           start    = DateTime.MinValue;
            DateTime           end      = DateTime.MaxValue;
            var sDs = basTarih;
            var eDs = bitTarih;

            DateTime.TryParse(sDs, out start);
            DateTime.TryParse(eDs, out end);
            messages = r.DetailList(sessionId);
            if (start != DateTime.MinValue && end != DateTime.MinValue)
            {
                messages = messages.Where(x => Convert.ToDateTime(x.CreatedDate) >= start && Convert.ToDateTime(x.CreatedDate) <= end).ToList();
            }
            return(Json(messages, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
        private static void Main(string[] args)
        {
            DetailRepository    detailRepository    = new DetailRepository();
            NodeRepository      nodeRepository      = new NodeRepository();
            MechanismRepository mechanismRepository = new MechanismRepository();

            bool showMenu = true;

            while (showMenu) //обрабатывет исключения
            {
                try
                {
                    showMenu = MainMenu(detailRepository, nodeRepository, mechanismRepository);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadKey();
                }
            }
        }
Пример #10
0
        static void Main(string[] args)
        {
            IRepository <Car>    car    = new CarRepository();
            IRepository <Detail> detail = new DetailRepository();

            ICarService    carService    = new CarService(car);
            IDetailService detailService = new DetailService(detail);

            ICarController    carController    = new CarController(carService);
            IDetailController detailController = new DetailController(detailService);

            var allCars = carController.GetAll();

            var carDetails = carController.GetCarDetailsById(1);

            var detailCar = carController.GetDetailCar(1);

            var allDetails = detailController.GetAll();

            Console.ReadKey();
        }
Пример #11
0
 public DetailService()
 {
     detailRepository = new DetailRepository();
 }
Пример #12
0
        public void Execution(string[] args)
        {
            logger.Debug($"this.localMongoDBOptions.ConnectionString: {this.localMongoDBOptions.ConnectionString}");
            logger.Debug($"this.remoteMongoDBOptions.ConnectionString: {this.remoteMongoDBOptions.ConnectionString}");

            var localAccountingSubjectRepository  = new AccountingSubjectRepository(this.localMongoDBOptions);
            var remoteAccountingSubjectRepository = new AccountingSubjectRepository(this.remoteMongoDBOptions);

            var accountingSubjects = remoteAccountingSubjectRepository.FetchAll().Result;

            logger.Debug($"accountingSubjects.Count(): {accountingSubjects.Count()}");

            localAccountingSubjectRepository.DeleteAll().Wait();
            logger.Debug($"localAccountingSubjectRepository.DeleteAll().Wait();");

            localAccountingSubjectRepository.CreateAll(accountingSubjects).Wait();
            logger.Debug($"localAccountingSubjectRepository.CreateAll(accountingSubjects).Wait();");

            var localAuthorizationRepository  = new AuthorizationRepository(this.localMongoDBOptions);
            var remoteAuthorizationRepository = new AuthorizationRepository(this.remoteMongoDBOptions);

            var authorizations = remoteAuthorizationRepository.FetchAll().Result;

            logger.Debug($"authorizations.Count(): {authorizations.Count()}");

            localAuthorizationRepository.DeleteAll().Wait();
            logger.Debug($"localAuthorizationRepository.DeleteAll().Wait();");

            localAuthorizationRepository.CreateAll(authorizations).Wait();
            logger.Debug($"localAuthorizationRepository.CreateAll(authorizations).Wait();");

            var localBookRepository  = new BookRepository(this.localMongoDBOptions);
            var remoteBookRepository = new BookRepository(this.remoteMongoDBOptions);

            var books = remoteBookRepository.FetchAll().Result;

            logger.Debug($"books.Count(): {books.Count()}");

            if (books.Count() > 0)
            {
                localBookRepository.DeleteAll().Wait();
                logger.Debug($"localBookRepository.DeleteAll().Wait();");

                localBookRepository.CreateAll(books).Wait();
                logger.Debug($"localBookRepository.CreateAll(books).Wait();");
            }

            var localDetailRepository  = new DetailRepository(this.localMongoDBOptions);
            var remoteDetailRepository = new DetailRepository(this.remoteMongoDBOptions);

            var packageInformationIds = localDetailRepository.GetPackageInformationIds();

            logger.Debug($"packageInformationIds.Count(): {packageInformationIds.Count()}");

            var details = remoteDetailRepository.FetchAll(item => !packageInformationIds.Contains(item.PackageInformation.Id)).Result;

            logger.Debug($"details.Count(): {details.Count()}");

            foreach (var detail in details)
            {
                if (localDetailRepository.Exist(detail.Id))
                {
                    localDetailRepository.Update(detail);
                }
                else
                {
                    localDetailRepository.Create(detail).Wait();
                }
            }
            logger.Debug($"localDetailRepository.CreateAll(details).Wait();");
        }
Пример #13
0
        private static bool MainMenu(DetailRepository detailRepository, NodeRepository nodeRepository, MechanismRepository mechanismRepository)
        {
            Console.Clear();

            Console.WriteLine("1. Изготовить деталь");
            Console.WriteLine("2. Перечень деталей");
            Console.WriteLine("3. Найти деталь по ID");
            Console.WriteLine("");
            Console.WriteLine("4. Добавить узел");
            Console.WriteLine("5. Просмотр узлов");
            Console.WriteLine("6. Найти узел по ID");
            Console.WriteLine("");
            Console.WriteLine("7. Создать механизм");
            Console.WriteLine("8. Список механизмов");
            Console.WriteLine("9. Найти механизм по ID");

            Console.Write("\nВыберите вариант: ");

            switch (Console.ReadLine())
            {
            case "1":
                Console.WriteLine("Введите название детали: ");
                var name = Console.ReadLine();

                Console.WriteLine("Введите артикул: ");
                var vendorCode = Console.ReadLine();

                Console.WriteLine("Введите тип детали: ");
                var detailType = Console.ReadLine();

                Console.WriteLine("Введите габариты детали(мм): ");
                var detailSize = Console.ReadLine();

                Console.WriteLine("Введите материал детали: ");
                var detailMaterial = Console.ReadLine();

                detailRepository.Save(name, vendorCode, detailType, detailSize, detailMaterial);

                return(true);

            case "2":
                var list = detailRepository.GetList();
                Console.WriteLine($"Перечень деталей: {list.Count}");

                foreach (var item in detailRepository.GetList())
                {
                    Console.WriteLine(item);
                }

                Console.WriteLine("Для продолжения нажмите любую клавишу... ");
                Console.ReadKey();
                return(true);

            case "3":
                Console.WriteLine("Введите ID: ");
                int.TryParse(Console.ReadLine(), out var detailid);
                Console.WriteLine(detailRepository.GetById(detailid));
                Console.ReadKey();
                return(true);

            case "4":
                Console.WriteLine("Введите название узла: ");
                var nodeName = Console.ReadLine();

                Console.WriteLine("Введите артикул: ");
                var nodeVendorCode = Console.ReadLine();

                Console.WriteLine("Введите предназначение для узла: ");
                var nodeFunction = Console.ReadLine();

                Console.WriteLine("Введите вес(кг): ");
                int.TryParse(Console.ReadLine(), out var nodeWeight);

                Console.WriteLine("Введите качество узла: ");
                var nodeQuality = Console.ReadLine();

                nodeRepository.Save(nodeName, nodeVendorCode, nodeFunction, nodeWeight, nodeQuality);

                return(true);

            case "5":
                var nodelist = nodeRepository.GetList();
                Console.WriteLine($"Перечень узлов: {nodelist.Count}");

                foreach (var item in nodeRepository.GetList())
                {
                    Console.WriteLine(item);
                }

                Console.WriteLine("Для продолжения нажмите любую клавишу... ");
                Console.ReadKey();
                return(true);

            case "6":
                Console.WriteLine("Введите ID: ");
                int.TryParse(Console.ReadLine(), out var nodeid);
                Console.WriteLine(nodeRepository.GetById(nodeid));
                Console.ReadKey();
                return(true);

            case "7":
                Console.WriteLine("Введите название механизма: ");
                var mechanismName = Console.ReadLine();

                Console.WriteLine("Введите предназначение для механизма: ");
                var mechanismFunction = Console.ReadLine();

                Console.WriteLine("Введите качество механизма: ");
                var mechanismQuality = Console.ReadLine();

                mechanismRepository.Save(mechanismName, mechanismFunction, mechanismQuality);

                return(true);

            case "8":
                var mechanismlist = mechanismRepository.GetList();
                Console.WriteLine($"Количество механизмов: {mechanismlist.Count}");

                foreach (var item in mechanismRepository.GetList())
                {
                    Console.WriteLine(item);
                }

                Console.WriteLine("Для продолжения нажмите любую клавишу... ");
                Console.ReadKey();
                return(true);

            case "9":
                Console.WriteLine("Введите ID: ");
                int.TryParse(Console.ReadLine(), out var mechanismid);
                Console.WriteLine(mechanismRepository.GetById(mechanismid));
                Console.ReadKey();
                return(true);

            default:
                return(true);
            }
        }
Пример #14
0
 public DetailRepositoryTest()
 {
     this.accountingSubjectRepository = new AccountingSubjectRepository(this.mongoDBOptions);
     this.detailRepository            = new DetailRepository(this.mongoDBOptions);
 }
Пример #15
0
 public DetailController(DetailRepository repository, IMapper mapper)
 {
     this.repository = repository;
     this.mapper     = mapper;
 }