Exemplo n.º 1
0
 protected int GetNextNumber(SequenceNumberTypes type)
 {
     int nextNumber = 1;
     var sequence = (from n in _sequenceNumberRepo.Table
                     where n.SequenceNumberType == type
                     select n).FirstOrDefault();
     if (sequence == null)
     {
         sequence = new SequenceNumber();
         sequence.Description = Enum.GetName(typeof(SequenceNumberTypes), type);
         sequence.UsePrefix = false;
         sequence.SequenceNumberType = type;
         sequence.NextNumber = nextNumber + 1;
         _sequenceNumberRepo.Insert(sequence);
     }
     else
     {
         nextNumber = sequence.NextNumber;
         sequence.NextNumber += 1;
         _sequenceNumberRepo.Update(sequence);
     }
     return nextNumber;
 }
Exemplo n.º 2
0
        protected int GetNextNumber(SequenceNumberTypes type)
        {
            int nextNumber = 1;
            var sequence   = (from n in _sequenceNumberRepo.Table
                              where n.SequenceNumberType == type
                              select n).FirstOrDefault();

            if (sequence == null)
            {
                sequence                    = new SequenceNumber();
                sequence.Description        = Enum.GetName(typeof(SequenceNumberTypes), type);
                sequence.UsePrefix          = false;
                sequence.SequenceNumberType = type;
                sequence.NextNumber         = nextNumber + 1;
                _sequenceNumberRepo.Insert(sequence);
            }
            else
            {
                nextNumber           = sequence.NextNumber;
                sequence.NextNumber += 1;
                _sequenceNumberRepo.Update(sequence);
            }
            return(nextNumber);
        }