public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrEmpty(Code))
            {
                yield return(new ValidationResult("Kode harus diisi", new List <string> {
                    "Code"
                }));
            }
            else if (!long.TryParse(Code, out long code))
            {
                yield return(new ValidationResult("Kode harus berupa angka", new List <string> {
                    "Code"
                }));
            }

            if (string.IsNullOrEmpty(Name))
            {
                yield return(new ValidationResult("Nama Packing harus diisi", new List <string> {
                    "Name"
                }));
            }

            if (ProductSKUId.GetValueOrDefault() <= 0)
            {
                yield return(new ValidationResult("Barang SKU harus diisi", new List <string> {
                    "ProductSKU"
                }));
            }

            if (UOMId.GetValueOrDefault() <= 0)
            {
                yield return(new ValidationResult("Satuan harus diisi", new List <string> {
                    "UOM"
                }));
            }

            if (PackingSize.GetValueOrDefault() <= 0)
            {
                yield return(new ValidationResult("Kuantiti per packing harus diisi", new List <string> {
                    "PackingSize"
                }));
            }
        }
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (PackingSize.GetValueOrDefault() > 0)
            {
                yield return(new ValidationResult("Quantity harus diisi", new List <string> {
                    "PackingSize"
                }));
            }

            if (SKUId.GetValueOrDefault() > 0)
            {
                yield return(new ValidationResult("SKU harus diisi", new List <string> {
                    "SKUId"
                }));
            }

            if (PackingUOMId.GetValueOrDefault() > 0)
            {
                yield return(new ValidationResult("Jenis Packing harus diisi", new List <string> {
                    "PackingUOMId"
                }));
            }
        }
Exemple #3
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (PackingSize.GetValueOrDefault() > 0)
            {
                yield return(new ValidationResult("Quantity harus diisi", new List <string> {
                    "PackingSize"
                }));
            }

            if (string.IsNullOrWhiteSpace(SKUCode))
            {
                yield return(new ValidationResult("Kode SKU harus diisi", new List <string> {
                    "SKUCode"
                }));
            }

            if (string.IsNullOrWhiteSpace(PackingUOM))
            {
                yield return(new ValidationResult("Jenis Packing harus diisi", new List <string> {
                    "PackingUOM"
                }));
            }
        }
Exemple #4
0
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            if (string.IsNullOrEmpty(ColorWay))
            {
                yield return(new ValidationResult("Warna harus diisi", new List <string> {
                    "ColorWay"
                }));
            }

            if (string.IsNullOrEmpty(ConstructionType))
            {
                yield return(new ValidationResult("Konstruksi harus diisi", new List <string> {
                    "ConstructionType"
                }));
            }

            if (string.IsNullOrEmpty(Grade))
            {
                yield return(new ValidationResult("Grade harus diisi", new List <string> {
                    "Grade"
                }));
            }

            if (PackingSize.GetValueOrDefault() > 0)
            {
                yield return(new ValidationResult("Quantity harus diisi", new List <string> {
                    "PackingSize"
                }));
            }

            if (string.IsNullOrEmpty(PackingType))
            {
                yield return(new ValidationResult("Jenis Packing harus diisi", new List <string> {
                    "Jenis Packing"
                }));
            }

            if (string.IsNullOrEmpty(ProcessType))
            {
                yield return(new ValidationResult("Jenis Proses harus diisi", new List <string> {
                    "ProcessType"
                }));
            }

            if (string.IsNullOrEmpty(UOM))
            {
                yield return(new ValidationResult("Satuan harus diisi", new List <string> {
                    "Satuan"
                }));
            }

            if (string.IsNullOrEmpty(WarpThread))
            {
                yield return(new ValidationResult("Benang Lusi harus diisi", new List <string> {
                    "WarpThread"
                }));
            }

            if (string.IsNullOrEmpty(WeftThread))
            {
                yield return(new ValidationResult("Benang Pakan harus diisi", new List <string> {
                    "WeftThread"
                }));
            }

            if (string.IsNullOrEmpty(Width))
            {
                yield return(new ValidationResult("Lebar harus diisi", new List <string> {
                    "Lebar"
                }));
            }

            if (string.IsNullOrEmpty(WovenType))
            {
                yield return(new ValidationResult("Jenis Anyaman harus diisi", new List <string> {
                    "WovenType"
                }));
            }
        }