protected bool Equals(AtTheExpenseOfWages other) { const StringComparison comparisonIgnoreCase = StringComparison.OrdinalIgnoreCase; return(Ttn == other.Ttn && ShipmentDate.Equals(other.ShipmentDate) && string.Equals(Name, other.Name, comparisonIgnoreCase) && Count == other.Count && Cost == other.Cost); }
protected bool Equals(ControlDebts other) { const StringComparison comparisonIgnoreCase = StringComparison.OrdinalIgnoreCase; return(string.Equals(Company, other.Company, comparisonIgnoreCase) && string.Equals(Name, other.Name, comparisonIgnoreCase) && Ttn == other.Ttn && Cost == other.Cost && string.Equals(NumberContract, other.NumberContract, comparisonIgnoreCase) && string.Equals(FormPayment, other.FormPayment, comparisonIgnoreCase) && ShipmentDate.Equals(other.ShipmentDate) && PaymentDate.Equals(other.PaymentDate)); }
protected bool Equals(ForReportOnAccountingSuppliesMonth other) { const StringComparison comparisonIgnoreCase = StringComparison.OrdinalIgnoreCase; return(string.Equals(TypeGroup, other.TypeGroup, comparisonIgnoreCase) && string.Equals(Type, other.Type, comparisonIgnoreCase) && string.Equals(Category, other.Category, comparisonIgnoreCase) && string.Equals(Territory, other.Territory, comparisonIgnoreCase) && string.Equals(Name, other.Name, comparisonIgnoreCase) && Count == other.Count && Cost == other.Cost && SummNds == other.SummNds && string.Equals(NameCompany, other.NameCompany, comparisonIgnoreCase) && Ttn == other.Ttn && ShipmentDate.Equals(other.ShipmentDate) && string.Equals(ContractNumber, other.ContractNumber, comparisonIgnoreCase) && ContractDate.Equals(other.ContractDate) && string.Equals(IntentionBay, other.IntentionBay, comparisonIgnoreCase) && string.Equals(PaymentForm, other.PaymentForm, comparisonIgnoreCase) && string.Equals(WorkGuild, other.WorkGuild, comparisonIgnoreCase)); }
protected bool Equals(ExpenditureOfProductsByTerritory other) { const StringComparison comparisonIgnoreCase = StringComparison.OrdinalIgnoreCase; return(string.Equals(TerritoryName, other.TerritoryName, comparisonIgnoreCase) && Ceh == other.Ceh && NumberTtn == other.NumberTtn && NumberAkt == other.NumberAkt && ShipmentDate.Equals(other.ShipmentDate) && string.Equals(ProductName, other.ProductName, comparisonIgnoreCase) && string.Equals(CompanyName, other.CompanyName, comparisonIgnoreCase) && ProductCount == other.ProductCount && CostWithoutNds == other.CostWithoutNds && SummaWithoutNds == other.SummaWithoutNds && SummaNds == other.SummaNds && SummaWithNds == other.SummaWithNds && SummaWithoutNdsAndTaxes == other.SummaWithoutNdsAndTaxes && SummaUsd == other.SummaUsd && UsdRate == other.UsdRate && RusRate == other.RusRate); }
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 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 (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" })); } } }