Example #1
0
        public static void BatchInsert(TagViewModel tag, IEnumerable <ImageViewModel> images)
        {
            if (images == null || images.Count() == 0)
            {
                s_logger.Warn("No images set.");
                return;
            }

            using (var dataOpUnit = new DataOperationUnit())
            {
                dataOpUnit.Open(ConnectionManager.DefaultConnection);

                ImageTagDao dao = new ImageTagDao();
                Queue <List <ImageViewModel> > processPool = Split(images);

                foreach (var process in processPool)
                {
                    try
                    {
                        dao.BatchInsert(tag.ToEntity(), process.Select(i => i.ToEntity()), dataOpUnit.CurrentConnection);
                    }
                    catch (Exception e)
                    {
                        s_logger.Error(e);
                    }
                }
            }
        }
Example #2
0
        private void ImportTag(ILibrary libManager, TagViewModel add)
        {
            TagDao tagDao = new TagDao();

            tagDao.Insert(add.ToEntity(), _dataOpUnit.CurrentConnection);
            libManager.TagManager.Tags.Add(add);
        }
Example #3
0
        public static void Insert(TagViewModel target)
        {
            TagDao dao = new TagDao();

            dao.Insert(target.ToEntity());
            s_logger.Debug($"INSERT Tag:{target}");
        }
Example #4
0
        public static void Update(TagViewModel target)
        {
            TagDao dao = new TagDao();

            dao.Update(target.ToEntity());
        }