예제 #1
0
 private void InsertVietLoot(VietlottVN obj)
 {
     try
     {
         if (obj != null && !_context.VietlottVNs.Any(o => o.DayPrize.Equals(obj.DayPrize)))
         {
             _context.VietlottVNs.InsertOnSubmit(obj);
             _context.SubmitChanges();
         }
     }
     catch (Exception ex)
     {
     }
 }
예제 #2
0
 public void ImportVietLottPage(List <VietlottVNDto> lst)
 {
     if (lst != null && lst.Count > 0)
     {
         foreach (var dto in lst)
         {
             try
             {
                 var        datePize      = dto.DatePize.Trim();
                 DateTime   dt            = DateTime.ParseExact(datePize, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                 List <int> listNumberInt = new List <int>();
                 if (dto.ListNumbers != null && dto.ListNumbers.Count > 0)
                 {
                     foreach (var number in dto.ListNumbers)
                     {
                         int iNumber = 0;
                         int.TryParse(number, out iNumber);
                         if (iNumber > 0)
                         {
                             listNumberInt.Add(iNumber);
                         }
                     }
                 }
                 listNumberInt = listNumberInt.OrderBy(o => o).ToList();
                 if (dto.ListNumbers != null && listNumberInt.Count == 6)
                 {
                     var obj = new VietlottVN()
                     {
                         DayPrize        = dt,
                         DrawId          = 0,
                         FullBlockNumber = String.Join(" ", dto.ListNumbers),
                         ImportDate      = DateTime.UtcNow,
                         NumberOne       = listNumberInt[0],
                         NumberTwo       = listNumberInt[1],
                         NumberThree     = listNumberInt[2],
                         NumberFour      = listNumberInt[3],
                         NumberFive      = listNumberInt[4],
                         NumberSix       = listNumberInt[5]
                     };
                     InsertVietLoot(obj);
                 }
             }
             catch (Exception exception)
             {
                 ;
             }
         }
     }
 }
예제 #3
0
        /// <summary>
        /// Import VietLott
        /// </summary>
        /// <param name="obj"></param>
        public void ImportVietlottVN(VietlottVNDto obj)
        {
            var vObj = _dataContext.VietlottVNs.FirstOrDefault(o => o.DrawId == obj.DrawId && o.DayPrize == obj.DatePizeDateTime);

            if (vObj == null)
            {
                var dbEntity = new VietlottVN()
                {
                    DrawId          = obj.DrawId,
                    DayPrize        = obj.DatePizeDateTime,
                    FullBlockNumber = obj.FullBlockNumber,
                    ImportDate      = DateTime.Now,
                    NumberOne       = obj.NumberOne,
                    NumberTwo       = obj.NumberTwo,
                    NumberThree     = obj.NumberThree,
                    NumberFour      = obj.NumberFour,
                    NumberFive      = obj.NumberFive,
                    NumberSix       = obj.NumberSix
                };
                _dataContext.VietlottVNs.InsertOnSubmit(dbEntity);
                _dataContext.SubmitChanges();
            }
        }
예제 #4
0
 partial void DeleteVietlottVN(VietlottVN instance);
예제 #5
0
 partial void UpdateVietlottVN(VietlottVN instance);
예제 #6
0
 partial void InsertVietlottVN(VietlottVN instance);