public static bool IsValidItemFields(string itemCode, string categoryName, string description, string reorderLevel, string reorderQty, string UOM, string bin) { bool sucesss = true; int level, qty; if (string.IsNullOrEmpty(itemCode) || string.IsNullOrEmpty(categoryName) || string.IsNullOrEmpty(description) || string.IsNullOrEmpty(UOM) || string.IsNullOrEmpty(reorderLevel) || string.IsNullOrEmpty(reorderQty)) { sucesss = false; } else if (!(int.TryParse(reorderLevel, out level) && int.TryParse(reorderQty, out qty))) { sucesss = false; } else if (ValidatorUtil.IsInvalidfieldLength(itemCode, 10) || ValidatorUtil.IsInvalidfieldLength(categoryName, 10) || ValidatorUtil.IsInvalidfieldLength(description, 50) || ValidatorUtil.IsInvalidfieldLength(UOM, 10) || ValidatorUtil.IsInvalidfieldLength(bin, 10)) { sucesss = false; } else { Item i = EFBroker_Item.GetItembyDescription(description); if (i != null && !itemCode.Equals(i.ItemCode)) { sucesss = false; } } return(sucesss); }
protected void CstTxtDescription_ServerValidate(object source, ServerValidateEventArgs args) { if (EFBroker_Item.GetItembyDescription(args.Value) != null) { args.IsValid = false; } else { args.IsValid = true; } }