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

            return(batch.MaterialId == m_materialId &&
                   batch.BatchNumber.Equals(m_batchNumber, StringComparison.InvariantCultureIgnoreCase));
        }
예제 #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;
            }
        }
예제 #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);
        }
예제 #4
0
 public string ToString(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return($"{m_batchNumber}:{m_materialId}");
 }
예제 #5
0
 public string GetBatchNumber(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return(m_batchNumber);
 }
예제 #6
0
 public int GetMaterialId(IBatchKeyResolver repo)
 {
     EnsureLoaded(repo);
     return(m_materialId ?? -1);
 }