public UnitPaymentQuantityCorrectionNoteFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <UnitPaymentCorrectionNote>(); }
public MonitoringCorrectionNoteExpenditureFacade(PurchasingDbContext dbContext) { this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentDeliveryOrder>(); }
public UnitPaymentOrderNotVerifiedReportFacade(PurchasingDbContext dbContext) { this.dbContext = dbContext; this.dbSet = this.dbContext.Set <PurchasingDocumentExpedition>(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { PurchasingDbContext dbContext = validationContext == null ? null : (PurchasingDbContext)validationContext.GetService(typeof(PurchasingDbContext)); if (Buyer == null) { yield return(new ValidationResult("Buyer tidak boleh kosong", new List <string> { "Buyer" })); } else if (String.IsNullOrWhiteSpace(Buyer.Id) || Buyer.Id.Equals("0") || String.IsNullOrWhiteSpace(Buyer.Code) || String.IsNullOrWhiteSpace(Buyer.Name)) { yield return(new ValidationResult("Data Buyer tidak benar", new List <string> { "Buyer" })); } if (String.IsNullOrWhiteSpace(Article)) { yield return(new ValidationResult("Artikel tidak boleh kosong", new List <string> { "Article" })); } if (Date.Equals(DateTimeOffset.MinValue) || Date == null) { yield return(new ValidationResult("Tanggal tidak boleh kosong", new List <string> { "Date" })); } if (SCId < 1 || string.IsNullOrWhiteSpace(SCNo)) { yield return(new ValidationResult("Sales Contract tidak boleh kosong", new List <string> { "SalesContract" })); } if (new string[] { "MASTER", "SAMPLE" }.Contains(PRType)) { if (ExpectedDeliveryDate.Equals(DateTimeOffset.MinValue) || ExpectedDeliveryDate == null) { yield return(new ValidationResult("Tanggal Diminta Datang tidak boleh kosong", new List <string> { "ExpectedDeliveryDate" })); } } else { if (String.IsNullOrWhiteSpace(RONo)) { yield return(new ValidationResult("RONo tidak boleh kosong", new List <string> { "RONo" })); } else { var duplicateRONo = dbContext.GarmentPurchaseRequests.Where(m => m.RONo.Equals(RONo) && m.Id != Id).Count(); if (duplicateRONo > 0) { yield return(new ValidationResult("RONo sudah ada", new List <string> { "RONo" })); } } if (ShipmentDate.Equals(DateTimeOffset.MinValue) || ShipmentDate == null) { yield return(new ValidationResult("Tanggal Shipment tidak boleh kosong", new List <string> { "ShipmentDate" })); } } //if (PRType != "MASTER") //{ if (Unit == null) { yield return(new ValidationResult("Unit tidak boleh kosong", new List <string> { "Unit" })); } else if (String.IsNullOrWhiteSpace(Unit.Id) || Unit.Id.Equals("0") || String.IsNullOrWhiteSpace(Unit.Code) || String.IsNullOrWhiteSpace(Unit.Name)) { yield return(new ValidationResult("Data Unit tidak benar", new List <string> { "Unit" })); } //} if (Items == null || Items.Count <= 0) { yield return(new ValidationResult("Items tidak boleh kosong", new List <string> { "ItemsCount" })); } else { string itemError = "["; int itemErrorCount = 0; foreach (var item in Items) { itemError += "{"; if (item.Product == null) { itemErrorCount++; itemError += "Product: 'Barang tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Product.Id) || item.Product.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Product.Code) || String.IsNullOrWhiteSpace(item.Product.Name)) { itemErrorCount++; itemError += "Product: 'Data Barang tidak benar', "; } if (item.Quantity <= 0) { itemErrorCount++; itemError += "Quantity: 'Jumlah harus lebih dari 0', "; } if (item.BudgetPrice < 0) { itemErrorCount++; itemError += "BudgetPrice: 'Price harus lebih dari atau sama dengan 0', "; } if (item.Uom == null) { itemErrorCount++; itemError += "UOM: 'Satuan tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Uom.Id) || item.Uom.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Uom.Unit)) { itemErrorCount++; itemError += "UOM: 'Data Satuan tidak benar', "; } if (item.Category == null) { itemErrorCount++; itemError += "Category: 'Kategori tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Category.Id) || item.Category.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Category.Name)) { itemErrorCount++; itemError += "Category: 'Data Kategori tidak benar', "; } if (new string[] { "MASTER", "SAMPLE" }.Contains(PRType)) { if (item.Category != null && item.Category.Name == "FABRIC") { if (item.Composition == null || string.IsNullOrWhiteSpace(item.Composition.Composition)) { itemErrorCount++; itemError += "Composition: 'Komposisi tidak boleh kosong', "; } else { if (item.Const == null || string.IsNullOrWhiteSpace(item.Const.Const)) { itemErrorCount++; itemError += "Const: 'Konstruksi tidak boleh kosong', "; } else { if (item.Yarn == null || string.IsNullOrWhiteSpace(item.Yarn.Yarn)) { itemErrorCount++; itemError += "Yarn: 'Yarn tidak boleh kosong', "; } else { if (item.Width == null || string.IsNullOrWhiteSpace(item.Width.Width)) { itemErrorCount++; itemError += "Width: 'Width tidak boleh kosong', "; } } } } } if (item.PriceUom == null) { itemErrorCount++; itemError += "PriceUom: 'Satuan Harga tidak boleh kosong', "; } else if (string.IsNullOrWhiteSpace(item.PriceUom.Id) || item.PriceUom.Id.Equals("0") || string.IsNullOrWhiteSpace(item.PriceUom.Unit)) { itemErrorCount++; itemError += "PriceUom: 'Data Satuan Harga tidak benar', "; } if (item.PriceConversion <= 0) { itemErrorCount++; itemError += "PriceConversion: 'Konversi harus lebih dari 0', "; } else if (item.Uom != null && item.PriceUom != null && (item.PriceUom.Id == item.Uom.Id || item.PriceUom.Unit == item.Uom.Unit) && item.PriceConversion != 1) { itemErrorCount++; itemError += "PriceConversion: 'Satuan Sama, Konversi harus 1', "; } } else { if (string.IsNullOrWhiteSpace(item.PO_SerialNumber)) { itemErrorCount++; itemError += "PO_SerialNumber: 'PO SerialNumber tidak boleh kosong', "; } else if (Id != 0) { var duplicatePO_SerialNumber = dbContext.GarmentPurchaseRequests .SingleOrDefault(m => m.Id == Id && m.Items.Any(i => i.PO_SerialNumber.Equals(item.PO_SerialNumber) && i.Id != item.Id)); if (duplicatePO_SerialNumber != null) { itemErrorCount++; itemError += "PO_SerialNumber: 'PO SerialNumber sudah ada', "; } } } itemError += "}, "; } itemError += "]"; if (itemErrorCount > 0) { yield return(new ValidationResult(itemError, new List <string> { "Items" })); } } }
public InternalPurchaseOrderFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <InternalPurchaseOrder>(); }
public PurchasingDocumentExpeditionReportFacade(PurchasingDbContext dbContext) { this.dbContext = dbContext; this.dbSet = this.dbContext.Set <PurchasingDocumentExpedition>(); }
public GarmentStockReportFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentDeliveryOrder>(); }
public UnitPaymentOrderDataUtil dataUtil(PurchasingDbContext dbContext) { return(new UnitPaymentOrderDataUtil(dbContext)); }
public MonitoringUnitReceiptAllFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.dbSet = dbContext.Set <GarmentUnitReceiptNote>(); this.serviceProvider = serviceProvider; this.dbContext = dbContext; }
public MonitoringCentralBillExpenditureFacade(PurchasingDbContext dbContext) { this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentDeliveryOrder>(); }
public GarmentDispositionPaymentReportService(IServiceProvider serviceProvider) { _dbContext = serviceProvider.GetService <PurchasingDbContext>(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { PurchasingDbContext dbContext = validationContext == null ? null : (PurchasingDbContext)validationContext.GetService(typeof(PurchasingDbContext)); if (String.IsNullOrWhiteSpace(RONo)) { yield return(new ValidationResult("RONo tidak boleh kosong", new List <string> { "RONo" })); } else { var duplicateRONo = dbContext.GarmentPurchaseRequests.Where(m => m.RONo.Equals(RONo) && m.Id != Id).Count(); if (duplicateRONo > 0) { yield return(new ValidationResult("RONo sudah ada", new List <string> { "RONo" })); } } if (Buyer == null) { yield return(new ValidationResult("Buyer tidak boleh kosong", new List <string> { "Buyer" })); } else if (String.IsNullOrWhiteSpace(Buyer.Id) || Buyer.Id.Equals("0") || String.IsNullOrWhiteSpace(Buyer.Code) || String.IsNullOrWhiteSpace(Buyer.Name)) { yield return(new ValidationResult("Data Buyer tidak benar", new List <string> { "Buyer" })); } if (String.IsNullOrWhiteSpace(Article)) { yield return(new ValidationResult("Article tidak boleh kosong", new List <string> { "Article" })); } if (Date.Equals(DateTimeOffset.MinValue) || Date == null) { yield return(new ValidationResult("Date tidak boleh kosong", new List <string> { "Date" })); } if (ShipmentDate.Equals(DateTimeOffset.MinValue) || ShipmentDate == null) { yield return(new ValidationResult("ShipmentDate tidak boleh kosong", new List <string> { "ShipmentDate" })); } if (Unit == null) { yield return(new ValidationResult("Unit tidak boleh kosong", new List <string> { "Unit" })); } else if (String.IsNullOrWhiteSpace(Unit.Id) || Unit.Id.Equals("0") || String.IsNullOrWhiteSpace(Unit.Code) || String.IsNullOrWhiteSpace(Unit.Name)) { yield return(new ValidationResult("Data Unit tidak benar", new List <string> { "Unit" })); } if (Items == null || Items.Count <= 0) { yield return(new ValidationResult("Items tidak boleh kosong", new List <string> { "ItemsCount" })); } else { string itemError = "["; int itemErrorCount = 0; foreach (var item in Items) { itemError += "{"; if (String.IsNullOrWhiteSpace(item.PO_SerialNumber)) { itemErrorCount++; itemError += "PO_SerialNumber: 'PO_SerialNumber tidak boleh kosong', "; } else if (Id != 0) { var duplicatePO_SerialNumber = dbContext.GarmentPurchaseRequests .SingleOrDefault(m => m.Id == Id && m.Items.Any(i => i.PO_SerialNumber.Equals(item.PO_SerialNumber) && i.Id != item.Id)); if (duplicatePO_SerialNumber != null) { itemErrorCount++; itemError += "PO_SerialNumber: 'PO_SerialNumber sudah ada', "; } } if (item.Product == null) { itemErrorCount++; itemError += "Product: 'Product tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Product.Id) || item.Product.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Product.Code) || String.IsNullOrWhiteSpace(item.Product.Name)) { itemErrorCount++; itemError += "Product: 'Data Product tidak benar', "; } if (item.Quantity <= 0) { itemErrorCount++; itemError += "Quantity: 'Quantity harus lebih dari 0', "; } //if (item.BudgetPrice <= 0) //{ // itemErrorCount++; // itemError += "BudgetPrice: 'BudgetPrice harus lebih dari 0', "; //} if (item.Uom == null) { itemErrorCount++; itemError += "UOM: 'UOM tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Uom.Id) || item.Uom.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Uom.Unit)) { itemErrorCount++; itemError += "UOM: 'Data UOM tidak benar', "; } if (item.Category == null) { itemErrorCount++; itemError += "Category: 'Category tidak boleh kosong', "; } else if (String.IsNullOrWhiteSpace(item.Category.Id) || item.Category.Id.Equals("0") || String.IsNullOrWhiteSpace(item.Category.Name)) { itemErrorCount++; itemError += "Category: 'Data Category tidak benar', "; } itemError += "}, "; } itemError += "]"; if (itemErrorCount > 0) { yield return(new ValidationResult(itemError, new List <string> { "Items" })); } } }
public BeacukaiNoFeature(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentDeliveryOrder>(); }
public UnitPaymentOrderExpeditionReportService(PurchasingDbContext dbContext) { _dbContext = dbContext; DateTime dt = DateTime.Parse("0001-01-01T00:00:00.0000000+00:00"); }
public GarmentFlowDetailMaterialReportFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentUnitExpenditureNote>(); }
public PurchasingDocumentExpeditionFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <PurchasingDocumentExpedition>(); }
public GarmentInternalPurchaseOrderFacade(PurchasingDbContext dbContext) { this.dbContext = dbContext; dbSet = dbContext.Set <GarmentInternalPurchaseOrder>(); }
public async Task Should_Success_AutoJournalVBRequest_when_MemoryCacheResult_Exist() { //Setup PurchasingDbContext dbContext = GetDbContext(GetCurrentAsyncMethod()); var serviceProviderMock = GetServiceProvider(); var memoryCacheManagerMock = new Mock <IMemoryCacheManager>(); memoryCacheManagerMock .Setup(x => x.Get(MemoryCacheConstant.Categories, It.IsAny <Func <ICacheEntry, List <CategoryCOAResult> > >())) .Returns(new List <CategoryCOAResult>() { new CategoryCOAResult() { Id = 1, } }); memoryCacheManagerMock .Setup(x => x.Get(MemoryCacheConstant.Units, It.IsAny <Func <ICacheEntry, List <IdCOAResult> > >())) .Returns(new List <IdCOAResult>() { new IdCOAResult() { Id = 1, } }); memoryCacheManagerMock .Setup(x => x.Get(MemoryCacheConstant.Divisions, It.IsAny <Func <ICacheEntry, List <IdCOAResult> > >())) .Returns(new List <IdCOAResult>() { new IdCOAResult() { Id = 1, } }); memoryCacheManagerMock .Setup(x => x.Get(MemoryCacheConstant.IncomeTaxes, It.IsAny <Func <ICacheEntry, List <IncomeTaxCOAResult> > >())) .Returns(new List <IncomeTaxCOAResult>() { new IncomeTaxCOAResult() { Id = 1, } }); serviceProviderMock .Setup(x => x.GetService(typeof(IMemoryCacheManager))) .Returns(memoryCacheManagerMock.Object); var purchaseRequestItemDataUtil = new PurchaseRequestItemDataUtil(); var purchaseRequestFacade = new PurchaseRequestFacade(serviceProviderMock.Object, dbContext); var purchaserequestDataUtil = new PurchaseRequestDataUtil(purchaseRequestItemDataUtil, purchaseRequestFacade); var internalPurchaseOrderItemDataUtil = new InternalPurchaseOrderItemDataUtil(); var internalPurchaseOrderFacade = new InternalPurchaseOrderFacade(serviceProviderMock.Object, dbContext); var internalPurchaseOrderDataUtil = new InternalPurchaseOrderDataUtil(internalPurchaseOrderItemDataUtil, internalPurchaseOrderFacade, purchaserequestDataUtil); var externalPurchaseOrderFacade = new ExternalPurchaseOrderFacade(serviceProviderMock.Object, dbContext); var externalPurchaseOrderDetailDataUtil = new ExternalPurchaseOrderDetailDataUtil(); var externalPurchaseOrderItemDataUtil = new ExternalPurchaseOrderItemDataUtil(externalPurchaseOrderDetailDataUtil); var data = await dataUtil(externalPurchaseOrderFacade, internalPurchaseOrderDataUtil, externalPurchaseOrderItemDataUtil).GetTestData("user"); //Act VBRequestPOExternalService service = new VBRequestPOExternalService(dbContext, serviceProviderMock.Object); VBFormDto dto = new VBFormDto() { EPOIds = new List <long>() { 1 } }; var result = await service.AutoJournalVBRequest(dto); //Assert Assert.NotEqual(0, result); }
public DebtBookReportFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext, ILocalDbCashFlowDbContext dbContextLocal) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbContextLocal = dbContextLocal; }
public TotalGarmentPurchaseFacade(IServiceProvider serviceProvider, PurchasingDbContext dbContext) { this.serviceProvider = serviceProvider; this.dbContext = dbContext; this.dbSet = dbContext.Set <GarmentExternalPurchaseOrder>(); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { if (string.IsNullOrWhiteSpace(invoiceNo)) { yield return(new ValidationResult("No is required", new List <string> { "invoiceNo" })); } else { PurchasingDbContext purchasingDbContext = (PurchasingDbContext)validationContext.GetService(typeof(PurchasingDbContext)); if (purchasingDbContext.GarmentInvoices.Where(DO => DO.InvoiceNo.Equals(invoiceNo) && DO.Id != Id && DO.InvoiceDate.ToOffset((new TimeSpan(7, 0, 0))) == invoiceDate && DO.SupplierId == supplier.Id).Count() > 0) { yield return(new ValidationResult("No is already exist", new List <string> { "no" })); } } if (invoiceDate.Equals(DateTimeOffset.MinValue) || invoiceDate == null) { yield return(new ValidationResult("Date is required", new List <string> { "invoiceDate" })); } else if (invoiceDate > DateTimeOffset.Now.Date) { yield return(new ValidationResult("Date should not be more than today", new List <string> { "invoiceDate" })); } if (currency == null) { yield return(new ValidationResult("Currency is required", new List <string> { "currency" })); } if (supplier == null) { yield return(new ValidationResult("Supplier is required", new List <string> { "supplier" })); } if (useVat == true) { if (string.IsNullOrWhiteSpace(vatNo) || vatNo == null) { yield return(new ValidationResult("No is required", new List <string> { "vatNo" })); } if (vatDate.Equals(DateTimeOffset.MinValue) || vatDate == null) { yield return(new ValidationResult("Date is required", new List <string> { "vatDate" })); } } if (useIncomeTax == true) { if (string.IsNullOrWhiteSpace(incomeTaxNo) || incomeTaxNo == null) { yield return(new ValidationResult("No is required", new List <string> { "incomeTaxNo" })); } if (incomeTaxDate.Equals(DateTimeOffset.MinValue) || incomeTaxDate == null) { yield return(new ValidationResult("Date is required", new List <string> { "incomeTaxDate" })); } if (string.IsNullOrWhiteSpace(incomeTaxName) || incomeTaxName == null) { yield return(new ValidationResult("incomeTax is required", new List <string> { "incomeTax" })); } } int itemErrorCount = 0; int detailErrorCount = 0; if (this.items == null || this.items.Count == 0) { yield return(new ValidationResult("DeliveryOrder is required", new List <string> { "itemscount" })); } else { string itemError = "["; foreach (var item in items) { itemError += "{"; if (item.deliveryOrder == null) { itemErrorCount++; itemError += "deliveryOrder: 'No deliveryOrder selected', "; } if (item.details == null || item.details.Count.Equals(0)) { itemErrorCount++; itemError += "detailscount: 'Details is required', "; } else { string detailError = "["; foreach (var detail in item.details) { detailError += "{"; if (detail.doQuantity == 0) { detailErrorCount++; detailError += "doQuantity: 'DOQuantity can not 0', "; } detailError += "}, "; } detailError += "]"; if (detailErrorCount > 0) { itemErrorCount++; itemError += $"details: {detailError}, "; } } itemError += "}, "; } itemError += "]"; if (itemErrorCount > 0) { yield return(new ValidationResult(itemError, new List <string> { "items" })); } } }