Ejemplo n.º 1
0
        public override void GetError()
        {
            StringBuilder builder = new StringBuilder();

            foreach (PartToImport partToImport in m_importList)
            {
                OnItemProcessing(new ProcessingImportPartEventArgs(partToImport));
                Part part = PartService.GetPartByPartNumber
                                (m_purchaseOrder.Session, partToImport.PartNumber);

                if (part == null)
                {
                    string msg = string.Format("{0} is not a valid part number",
                                               partToImport.PartNumber);
                    builder.AppendLine(msg);
                    partToImport.Error = msg;
                }
                else
                {
                    partToImport.Part = part;
                }
            }

            if (builder.Length > 0)
            {
                m_error = "The import contains invalid line items please view the roll up for details.";
            }

            OnFinishedValidation();
        }
Ejemplo n.º 2
0
        public SuperService()
        {
            EmployeeService          = new EmployeeService();
            MaintenanceDetailService = new MaintenanceDetailService();
            MaintenanceService       = new MaintenanceService();
            PartService            = new PartService();
            PartUsageService       = new PartUsageService();
            ReportService          = new ReportService();
            ReservationFormService = new ReservationFormService();
            ReservationService     = new ReservationService();
            VehicleService         = new VehicleService();

            AdvisoryService          = new AdvisoryService();
            ContractService          = new ContractService();
            CourseService            = new CourseService();
            DepartmentService        = new DepartmentService();
            EnrollmentService        = new EnrollmentService();
            ProfessorContractService = new ProfessorContractService();
            ProfessorService         = new ProfessorService();
            ProfessorshipService     = new ProfessorshipService();
            ScheduleService          = new ScheduleService();
            SchoolService            = new SchoolService();
            SectionService           = new SectionService();
            StudentService           = new StudentService();
            TenureService            = new TenureService();
        }
Ejemplo n.º 3
0
 public WarehouseController(
     WarehouseService warehouseService,
     PartService partService)
 {
     this.warehouseService = warehouseService;
     this.partService      = partService;
 }
Ejemplo n.º 4
0
        public ActionResult Details(int blockId)
        {
            PartService service = new PartService();
            Part        set     = service.GetById(blockId);

            return(View(set));
        }
Ejemplo n.º 5
0
        public async Task Findpart()
        {
            PartService partService = new PartService(new Weaselware.Knoodle.Data.EFCode.KnoodleContext());
            var         parts       = await partService.Find(1);

            Assert.True(parts[1].PartID == 1);
        }
Ejemplo n.º 6
0
        public async Task FindCarById()
        {
            //Arrange
            var dbOptions = new DbContextOptionsBuilder <HyperCarsDbContext>()
                            .UseInMemoryDatabase("HyperCarsDb")
                            .Options;

            var db = new HyperCarsDbContext(dbOptions);

            var partService = new PartService(db);

            var part = new Part
            {
                Id   = 2,
                Name = "Test2"
            };

            db.AddRange(part);

            await db.SaveChangesAsync();

            //Act
            var result = partService.FindById(2);

            //Assert
            result.Name.Equals("Test2");
        }
        public async Task PartService_Should_Update_Part()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new PartService(_unitOfWork.Object, _mapper);
            var entity  = new PartDTO()
            {
                Name = "TestName",
                Code = "12345",
            };

            var newEntity = new PartDTO()
            {
                Name = "NewTestName",
                Code = "12345678",
            };

            await service.CreateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Act
            entity.Name = newEntity.Name;
            entity.Code = newEntity.Code;
            await service.UpdateAsync(entity);

            await _unitOfWork.Object.SaveAsync();

            // Assert
            Assert.NotNull(entity);
            Assert.Equal(newEntity.Name, entity.Name);
            Assert.Equal(newEntity.Code, entity.Code);
        }
Ejemplo n.º 8
0
        public async Task CheckIfPartExists()
        {
            //Arrange
            var dbOptions = new DbContextOptionsBuilder <HyperCarsDbContext>()
                            .UseInMemoryDatabase("HyperCarsDb")
                            .Options;

            var db = new HyperCarsDbContext(dbOptions);

            var partService = new PartService(db);

            var part = new Part
            {
                Id   = 1,
                Name = "Test1"
            };

            db.AddRange(part);

            await db.SaveChangesAsync();

            //Act
            var result = partService.Exists(1);

            //Assert
            result.Equals(true);
        }
Ejemplo n.º 9
0
        public async Task DeletePart()
        {
            //Arrange
            var dbOptions = new DbContextOptionsBuilder <HyperCarsDbContext>()
                            .UseInMemoryDatabase("HyperCarsDb")
                            .Options;

            var db = new HyperCarsDbContext(dbOptions);

            var part = new Part
            {
                Id   = 3,
                Name = "Test3"
            };

            var partService = new PartService(db);

            var totalCars = db.Parts.CountAsync();

            await db.SaveChangesAsync();

            //Act
            var result = partService.DeletePart(3);

            //Assert
            result.Equals(true);
        }
Ejemplo n.º 10
0
        public ICollection <OrderAllocationDetails> SearchOrders(string partNumber)
        {
            Part part = PartService.GetPartByPartNumber(m_uow, partNumber);

            return(CurrentConfiguration.ShipmentAllocationInstance
                   .GetOrdersByPartNumber(m_uow, CurrentShopfloorline, part));
        }
Ejemplo n.º 11
0
        public async Task GetAllPart()
        {
            PartService partService = new PartService(new Weaselware.Knoodle.Data.EFCode.KnoodleContext());
            var         parts       = await partService.GetAllParts();

            Assert.True(parts.Count > 5400);
            var k = parts[2].ItemDescription;
        }
Ejemplo n.º 12
0
 void newPartNumberEdit_Validated(object sender, EventArgs e)
 {
     if (newPartNumberEdit.Text.Length == 0)
     {
         return;
     }
     m_newPart = PartService.GetPartByPartNumber(m_session, newPartNumberEdit.Text);
 }
Ejemplo n.º 13
0
        protected override async void OnStart(string[] args)
        {
            var sessionModService = new SessionModService();
            var sessionId         = sessionModService.Login();

            var partService = new PartService(sessionId);
            await partService.SyncParts();
        }
Ejemplo n.º 14
0
 public void OnGet(int partID)
 {
     Part       = PartService.GetById(partID);
     Categories = PartCategoryService.GetAll().Select(a => new SelectListItem
     {
         Value = a.CategoryID.ToString(),
         Text  = a.Title
     });
 }
Ejemplo n.º 15
0
        public void GetPartById_ValidId_ReturnsPart()
        {
            var partService = new PartService(_partRepository);
            var part        = partService.GetById(ValidPartId);

            Assert.IsInstanceOfType(part, typeof(Part));
            Assert.AreEqual(part.PartId, ValidPartId);
            Assert.AreEqual(part.Price, ValidPartAmount);
        }
Ejemplo n.º 16
0
        public PartController(PartService partService, PlantService plantService, MachineService machineService, LineService lineService)
        {
            //  this._lineService = lineService;

            this._partService    = partService;
            this._plantService   = plantService;
            this._machineService = machineService;
            this._lineService    = lineService;
        }
Ejemplo n.º 17
0
 public void OnGet()
 {
     List       = PartService.GetAll(CategoryID);
     Categories = PartCategoryService.GetAll().Select(a => new SelectListItem
     {
         Value    = a.CategoryID.ToString(),
         Text     = a.Title,
         Selected = CategoryID == a.CategoryID
     });
 }
Ejemplo n.º 18
0
 private void Bind()
 {
     m_session = m_family.Session;
     familyLabelText.DataBindings.Add("Text", m_family, "Label");
     memberGrid.DataSource = m_family.Members;
     commodityLookup.Properties.DataSource = PartService.GetPartServiceCommodities(m_session);
     commodityLookup.DataBindings.Add("EditValue", m_family, "ServiceCommodity!");
     allowOutgoingOverrideCheck.DataBindings.Add("Checked", m_family,
                                                 "AllowOutgoingOverride");
 }
Ejemplo n.º 19
0
        public static PartService Return(SKAutoDbContext db,
                                         BrandService brandService,
                                         ModelService modelService,
                                         CategoryService categoryService,
                                         ManufactoryService manufactoryService)
        {
            var partRepository = new Repository <Part>(db);
            var partService    = new PartService(partRepository, brandService, modelService, categoryService, manufactoryService);

            return(partService);
        }
        /// <summary>
        ///     部位ピッカー作成
        /// </summary>
        /// <returns></returns>
        private static Picker CreatePartPicker()
        {
            var pick = new Picker
            {
                ItemsSource        = PartService.GetPartDataList(),
                ItemDisplayBinding = new Binding("PartName"),
                SelectedIndex      = 0
            };

            return(pick);
        }
        public async Task PartService_Should_Get_Null_When_Part_Not_Exist()
        {
            // Arrange
            SetUpUnitOfWork();
            var service = new PartService(_unitOfWork.Object, _mapper);

            // Act
            var entity = await service.GetAsync((new Random()).Next());

            // Assert
            Assert.Null(entity);
        }
Ejemplo n.º 22
0
        public async Task PartService_ShouldGetCorrectParts()
        {
            //Arrange
            var db = DatabaseInitializer.GetDbForPartService();

            var service = new PartService(db);

            //Act
            var parts = await service.All();

            //Assert
            parts.Should().HaveCount(2);
        }
Ejemplo n.º 23
0
        private bool SerialNumberMatchesFormat()
        {
            if (OrderService.ForceSerialFormatFor(m_facts.PurchaseOrder, m_facts.Part))
            {
                if (!PartService.SnMatchesFormat(m_facts.Part, m_facts.SerialNumber))
                {
                    m_error = "This serial number doesnt match any of the defined serial formats";
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 24
0
        public async Task PartService_ShouldDeleteCorrectlyPart()
        {
            //Arrange
            var db = DatabaseInitializer.GetDbForPartService();

            var service = new PartService(db);

            //Act
            await service.Delete(1);

            //Assert
            db.Parts.Should().HaveCount(1);
        }
Ejemplo n.º 25
0
        private string CheckInputForWarnings(string ppid)
        {
            StringBuilder msg = new StringBuilder();

            if (new PPIDValidator(ppid).Validate())
            {
                PPIDParser parser = new PPIDParser(ppid);
                if (!parser.PN.Equals(m_inventoryItem.PartNumber))
                {
                    msg.AppendLine(
                        "The part number contained in the PPID does not match the part number of the associated inventory item");
                    msg.AppendLine();
                }

                Part part = PartService.GetPartByPartNumber(m_session, parser.PN);
                if (part == null)
                {
                    msg.AppendLine("The part number extracted from the PPID is not a valid part number.");
                    msg.AppendLine();
                }

                if (m_inventoryItem.PurchaseOrder == null)
                {
                    msg.AppendLine("This inventory item is not associated with a purchase order.");
                    msg.AppendLine();
                }
                else
                {
                    if (m_inventoryItem.PurchaseOrder.LineItemByPart(part) == null)
                    {
                        msg.AppendLine("The part number extracted from the PPID does not match a part number from the purchase order.");
                        msg.AppendLine();
                    }
                }

                if (Scout.Core.Service <IInventoryService>()
                    .GetNSLotBySerialNumber(Scout.Core.Data.GetUnitOfWork(), ppid) != null)
                {
                    msg.AppendLine("This PPID is a multi-return");
                    msg.AppendLine();
                }
            }

            if (revText.Text.Contains("X"))
            {
                msg.AppendLine("This unit is a X revision");
                msg.AppendLine();
            }

            return(msg.ToString());
        }
Ejemplo n.º 26
0
        public ActionResult Index(int?page)
        {
            int             pageIndex = PagingHelper.GetPageIndex(page);
            PartSearchModel q         = new PartSearchModel();
            IPartService    ps        = new PartService(Settings.Default.db);

            IPagedList <Part> parts = ps.Search(q).ToPagedList(pageIndex, Settings.Default.pageSize);

            ViewBag.Query = q;

            SetPartTypeList(null);

            return(View(parts));
        }
Ejemplo n.º 27
0
        private void partText_Validated(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(partText.Text))
            {
                return;
            }

            Part part = PartService.GetPartByPartNumber(m_session, partText.Text);

            if (part != null)
            {
                LoadWarehouseItemsNeedingPutAway(part);
            }
        }
Ejemplo n.º 28
0
        public static ReplacementComponentFacts CreateNoPartComponent(RouteStationRepair repair)
        {
            ReplacementComponentFacts facts = new ReplacementComponentFacts(repair);
            Part noPart = PartService.GetPartByPartNumber(repair.Session,
                                                          "NoPart");

            facts.PartIn          = noPart;
            facts.PartOut         = noPart;
            facts.Component       = null;
            facts.Repair          = repair;
            facts.SerialNumberIn  = "";
            facts.SerialNumberOut = "";

            return(facts);
        }
Ejemplo n.º 29
0
        public async Task GetPartWeaponsAsync()
        {
            var service = new PartService(DataSource);
            var parts   = await DataSource.From("Sources.Part").ToInt32List("PartKey").ExecuteAsync();

            foreach (var partKey in parts)
            {
                var rows = await service.GetPartWeaponsAsync(partKey, null);

                foreach (var row in rows)
                {
                    Assert.IsFalse(string.IsNullOrWhiteSpace(row.PrimaryWeaponName), "PrimaryWeaponName shouldn't be null");
                }
            }
        }
Ejemplo n.º 30
0
        public async Task GetPartDetailAsync()
        {
            var service = new PartService(DataSource);
            var books   = await DataSource.From("Sources.Book").ToStringList("BookSlug").ExecuteAsync();

            foreach (var bookSlug in books)
            {
                var parts = await DataSource.From("Sources.PartDetail", new { bookSlug }).ToStringList("PartSlug").ExecuteAsync();

                foreach (var partSlug in parts)
                {
                    var row = await service.GetPartDetailAsync(bookSlug, partSlug, null);
                }
            }
        }
        public void WhenGettingEntity_ThenReturnsCorrectEntity()
        {
            // Arrange
            var repositoryMock = new Mock<IPartRepository>();
            Part newEntity = DefaultModelHelper.DummyPopulatedPart();

            repositoryMock.Setup(repo => repo.GetById(It.IsAny<int>())).Returns(newEntity);

            // Act
            var services = new PartService(repositoryMock.Object, new Mock<IUnitOfWork>().Object);
            Part returnedEntity = services.GetById(1);

            // Assert
            Assert.NotNull(returnedEntity);
            Assert.Equal("Title", returnedEntity.Title);
        }
 private void InitializeServices()
 {
     this.domainService = new DomainService(this.domainRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.clientAssetConfigService = new ClientAssetConfigService(
         this.clientAssetConfigRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.clientAssetService = new ClientAssetService(
         this.clientAssetRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.clientAssetTypeService = new ClientAssetTypeService(
         this.clientAssetTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.pageService = new PageService(this.pageRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.pageTemplateService = new PageTemplateService(
         this.pageTemplateRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.pageTemplateZoneMapService =
         new PageTemplateZoneMapService(
             this.pageTemplateZoneMapRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.pageZoneService = new PageZoneService(
         this.pageZoneRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.partService = new PartService(this.partRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.partTypeService = new PartTypeService(
         this.partTypeRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.seoDecoratorService = new SeoDecoratorService(
         this.seoDecoratorRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.userService = new UserService(this.userRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
     this.partContainerService = new PartContainerService(
         this.partContainerRepositoryMock.Object, new Mock<IUnitOfWork>().Object);
 }