Esempio n. 1
0
 private T_S_Sequence GetCurrentSeq(string type)
 {
     using (var uow = GetUnitOfWork())
     {
         var          current = DateTime.Now;
         T_S_Sequence s       = uow.Repository <T_S_Sequence>()
                                .Query()
                                .Filter(
             x =>
             x.SeqType == type && x.Year == current.Year && x.Month == current.Month
             //&&x.Day == current.Day
             ).Get().FirstOrDefault();
         if (s == null)
         {
             s         = new T_S_Sequence();
             s.Id      = Guid.NewGuid();
             s.SeqType = type;
             s.Year    = current.Year;
             s.Month   = current.Month;
             s.Day     = current.Day;
             s.Seq     = 0;
             uow.Repository <T_S_Sequence>().Insert(s);
             uow.Save();
             return(uow.Repository <T_S_Sequence>()
                    .Query()
                    .Filter(
                        x =>
                        x.SeqType == type && x.Year == current.Year && x.Month == current.Month &&
                        x.Day == current.Day).Get().FirstOrDefault());
         }
         return(s);
     }
 }
Esempio n. 2
0
        private string BuildTrackingNo(T_S_Sequence s)
        {
            var r = new Random().Next(10, 99);

            return(string.Format("{0}{1:D2}{2:D2}{3}", ((char)(s.Year - 2000 + 55)).ToString(), s.Month, s.Seq, r));
        }