public void ProduceByIdTest() { //Arrange string produceId = string.Empty; using (IDataContextAsync context = new PrimeActs.Data.Contexts.PAndIContext() as IDataContextAsync) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Produce> produceRepository = new Repository <Produce>(context, unitOfWork); ICache cache = Cache.Get(CacheType.Memory); IProduceService produceService = new ProduceService(produceRepository, cache); var produce = CreateProduce(); produceId = produce.ProduceID.ToString(); produceService.Insert(produce); unitOfWork.SaveChanges(); produceService.RefreshCache(); } //Act using (IDataContextAsync context = new PAndIContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Produce> produceRepository = new Repository <Produce>(context, unitOfWork); ICache cache = Cache.Get(CacheType.Memory); IProduceService produceService = new ProduceService(produceRepository, cache); var produce = produceService.ProduceById(Guid.Parse(produceId)); //Assert Assert.AreEqual(produce.ProduceID.ToString(), produceId); } }
private void butSearch_Click(object sender, EventArgs e) { if (checkFrom()) { // 设置画面显示列表数据 setGridViewList(setWhere()); ProduceService.UpData裁剪条码打印生产工序(this.ORDER_ID); } }
public void GetAllProduceTest() { using (IDataContextAsync context = new PAndIContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Produce> produceRepository = new Repository <Produce>(context, unitOfWork); ICache cache = Cache.Get(CacheType.Memory); IProduceService produceService = new ProduceService(produceRepository, cache); var produceList = produceService.GetAllProduces(); Assert.Greater(produceList.Count, 0); } }
} //订单id public UC裁剪条码打印(String orderid) { this.ORDER_ID = orderid; InitializeComponent(); this.txtBarCode.Text = OrderService.GetSBCWithOrderid(ORDER_ID); if (checkFrom()) { // 设置画面显示列表数据 setGridViewList(setWhere()); ProduceService.UpData裁剪条码打印生产工序(this.ORDER_ID); } }
private IProduceOrchestra Context() { IRepositoryAsync <Produce> divisionRepository = new Repository <Produce>(context, unitOfWork); IRepositoryAsync <MasterGroup> masterGroupRepository = new Repository <MasterGroup>(context, unitOfWork); IRepositoryAsync <ProduceGroup> produceGroupRepository = new Repository <ProduceGroup>(context, unitOfWork); ICache cache = Cache.Get(CacheType.Memory); IProduceService produceService = new ProduceService(divisionRepository, cache); IMasterGroupService masterGroupService = new MasterGroupService(masterGroupRepository, cache); IProduceGroupService produceGroupService = new ProduceGroupService(produceGroupRepository, cache); IProduceOrchestra produceOrchestra = new ProduceOrchestra(produceService, masterGroupService, produceGroupService); return(produceOrchestra); }
public UnitOfWork(SaleManagementContext context) { this._context = context; this._produceService = new ProduceService(context); this._produceGroupService = new ProduceGroupService(context); this._staffService = new StaffService(context); this._staffGroupService = new StaffGroupService(context); this._customerService = new CustomerService(context); this._unitService = new UnitService(context); this._supplierService = new SupplierService(context); this._stockService = new StockService(context); this._receiptNoteService = new ReceiptNoteService(context); this._deliveryNoteService = new DeliveryNoteService(context); }