Exemple #1
0
        public bool Match(IMaterialBatch batch, IBatchKeyResolver repo)
        {
            EnsureLoaded(repo);

            return(batch.MaterialId == m_materialId &&
                   batch.BatchNumber.Equals(m_batchNumber, StringComparison.InvariantCultureIgnoreCase));
        }
Exemple #2
0
        private void EnsureLoaded(IBatchKeyResolver resolver)
        {
            if (m_materialId == null || string.IsNullOrWhiteSpace(m_batchNumber))
            {
                if (resolver == null)
                {
                    throw new InvalidOperationException("No resolver");
                }

                var key = resolver.GetBatchNumberAndMaterialIdByBatchId(m_batchId ?? -1).Ensure();
                m_materialId  = key.Item1;
                m_batchNumber = key.Item2;
            }
        }
Exemple #3
0
        public bool Match(BatchKey key, IBatchKeyResolver repo)
        {
            if (key == null)
            {
                return(false);
            }

            var keyBnr = key.GetBatchNumber(repo);
            var keyMat = key.GetMaterialId(repo);
            var thiBnr = GetBatchNumber(repo);
            var thiMat = GetMaterialId(repo);

            return(keyBnr.Equals(thiBnr, StringComparison.InvariantCultureIgnoreCase) && keyMat == thiMat);
        }
Exemple #4
0
 public string ToString(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return($"{m_batchNumber}:{m_materialId}");
 }
Exemple #5
0
 public string GetBatchNumber(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return(m_batchNumber);
 }
Exemple #6
0
 public int GetMaterialId(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return(m_materialId ?? -1);
 }