public void UpdateTagComment(string userLogin, long commentId, List <String> tags) { Comment comment = CommentDao.Find(commentId); comment.Tags.Clear(); foreach (var tag in tags) { String tagLower = tag.ToLower(); if (!TagDao.Exists(tagLower)) { Tag newTag = new Tag { tagName = tagLower }; newTag.Comment.Add(comment); TagDao.Create(newTag); comment.Tags.Add(newTag); } else { Tag tagInDatabase = TagDao.Find(tagLower); comment.Tags.Add(tagInDatabase); tagInDatabase.Comment.Add(comment); } } }
// GET: Admin/Tag public ActionResult Index() { var dao = new TagDao(); var listTag = dao.ListAllPaging(1, 10); return(View(listTag)); }
public ActionResult Create(Tag tag) { if (ModelState.IsValid) { var dao = new TagDao(); var getTag = dao.getByName(tag.TagName); //Check if tag name exits in database if (getTag != null) { ModelState.AddModelError("TagName", "Tag " + tag.TagName + " exists in database."); return(View(tag)); } var entity = new Tag(); entity.TagName = tag.TagName; entity.TagDescription = tag.TagDescription; entity.CreatedBy = ((UserLogin)Session[CommonConstants.USER_SESSION]).UserId; entity.CreatedDate = DateTime.UtcNow; entity.Status = true; long id = dao.create(entity); if (id > 0) { ViewBag.CreateTagSuccessMessage = "Create " + tag.TagName + " successful"; } else { ViewBag.CreateTagErrorMessage = "Create " + tag.TagName + " failed"; } } return(View(tag)); }
private NameValueCollection GetFiles() { var result = new NameValueCollection(); if (0 < Files.Count) { var files = FilesSecurity.FilterRead(FileDao.GetFiles(Files.ToArray())).ToList(); files.ForEach(f => result.Add(f.Title, f.ID.ToString())); TagDao.RemoveTags(files.Select(f => Tag.New(SecurityContext.CurrentAccount.ID, f)).ToArray()); } if (0 < Folders.Count) { Folders.ForEach(f => TagDao.RemoveTags(TagDao.GetTags(f, FileEntryType.Folder, TagType.New) .Where(t => t.Owner == SecurityContext.CurrentAccount.ID) .ToArray())); var filesInFolder = GetFilesInFolders(Folders, string.Empty); if (filesInFolder == null) { return(null); } result.Add(filesInFolder); } return(result); }
public void RunJob(DistributedTask _, CancellationToken cancellationToken) { try { CancellationToken = cancellationToken; CoreContext.TenantManager.SetCurrentTenant(CurrentTenant); Thread.CurrentPrincipal = principal; Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo(culture); Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(culture); FolderDao = Global.DaoFactory.GetFolderDao(); FileDao = Global.DaoFactory.GetFileDao(); TagDao = Global.DaoFactory.GetTagDao(); ProviderDao = Global.DaoFactory.GetProviderDao(); FilesSecurity = new FileSecurity(Global.DaoFactory); LinkDao = Global.GetLinkDao(); Logger = Global.Logger; Total = InitTotalProgressSteps(); Do(); } catch (AuthorizingException authError) { Error = FilesCommonResource.ErrorMassage_SecurityException; Logger.Error(Error, new SecurityException(Error, authError)); } catch (AggregateException ae) { ae.Flatten().Handle(e => e is TaskCanceledException || e is OperationCanceledException); } catch (Exception error) { Error = error is TaskCanceledException || error is OperationCanceledException ? FilesCommonResource.ErrorMassage_OperationCanceledException : error.Message; Logger.Error(error, error); } finally { try { TaskInfo.SetProperty(FINISHED, true); PublishTaskInfo(); FolderDao.Dispose(); FileDao.Dispose(); TagDao.Dispose(); LinkDao.Dispose(); if (ProviderDao != null) { ProviderDao.Dispose(); } } catch { /* ignore */ } } }
private void ImportTag(ILibrary libManager, TagViewModel add) { TagDao tagDao = new TagDao(); tagDao.Insert(add.ToEntity(), _dataOpUnit.CurrentConnection); libManager.TagManager.Tags.Add(add); }
/// <summary> /// Constructeur avec injection de dépendance /// </summary> /// <param name="business">la classe business injectée</param> public TagBusiness(IStringLocalizer <TagBusiness> localizer, LudothequeDao ludothequeDao, TagDao tagDao) : base(localizer) { this.ludothequeDao = ludothequeDao; this.tagDao = tagDao; }
public static void Insert(TagViewModel target) { TagDao dao = new TagDao(); dao.Insert(target.ToEntity()); s_logger.Debug($"INSERT Tag:{target}"); }
// GET: Admin/Tag public ActionResult Index() { var dao = new TagDao(); var listTag = dao.ListAllPaging(1, 10); SetAlert("Load thành công", "success"); return(View(listTag)); }
public override void DropTable(IConnection connection) { TagDao dao = new TagDao(typeof(VersionOrigin)); dao.CurrentConnection = connection; dao.DropTable(); ++ModifiedCount; }
public static TagViewModel FindBy(Guid id) { TagDao dao = new TagDao(); return(dao.FindBy(new Dictionary <string, object>() { { "ID", id } }).SingleOrDefault().ToViewModel()); }
internal static void DeleteByTagName(string tagName) { TagDao dao = new TagDao(); dao.Delete(new Dictionary <string, object>() { { "Name", tagName } }); }
public static bool Exists(string tagName) { TagDao dao = new TagDao(); return(dao.CountBy(new Dictionary <string, object>() { { "Name", tagName } }) > 0); }
public ProviderTagDao( IServiceProvider serviceProvider, TenantManager tenantManager, SecurityDao <string> securityDao, TagDao <string> tagDao, CrossDao crossDao) : base(serviceProvider, tenantManager, securityDao, tagDao, crossDao) { }
private void NoticeDelete(File file) { TagDao.RemoveTags(NotifySource.Instance.GetSubscriptionProvider() .GetRecipients(NotifyConstants.Event_UpdateDocument, file.UniqID) .Select(id => Tag.New(new Guid(id.ID), file)) .ToArray()); NotifySource.Instance.GetSubscriptionProvider().UnSubscribe(NotifyConstants.Event_UpdateDocument, file.UniqID); }
public static int AddInsuranceCompany(string insuranceCompanyName) { int num = 0; if (new TagDao().GetInsuranceCompany(insuranceCompanyName) <= 0) { num = new TagDao().AddInsuranceCompany(insuranceCompanyName); } return(num); }
public override void CreateTable(IConnection connection) { TagDao dao = new TagDao(typeof(VersionOrigin)); dao.CurrentConnection = connection; dao.CreateTableIfNotExists(); ++ModifiedCount; dao.CreateIndexIfNotExists(); ++ModifiedCount; }
public static int AddTags(string tagName) { int result = 0; if (new TagDao().GetTags(tagName) <= 0) { result = new TagDao().AddTags(tagName); } return(result); }
public static int AddInsuranceCompanyArea(string insuranceAreaCiteId, string insuranceAreaCiteName, string insuranceAreaProvinceId, string insuranceAreaName, string insuranceCompanyTypes, string insuranceCompanyTypesIds) { int num = 0; if (new TagDao().GetInsuranceCompanyArea(insuranceAreaCiteId) <= 0) { num = new TagDao().AddInsuranceCompanyArea(insuranceAreaCiteId, insuranceAreaCiteName, insuranceAreaProvinceId, insuranceAreaName, insuranceCompanyTypes, insuranceCompanyTypesIds); } return(num); }
public static string GetTagName(int tagId) { TagInfo tagInfo = new TagDao().Get <TagInfo>(tagId); if (tagInfo != null) { return(tagInfo.TagName); } return(""); }
public static int AddTags(string tagName) { int num = 0; if (new TagDao().GetTags(tagName) <= 0) { num = new TagDao().AddTags(tagName); } return(num); }
public static bool UpdateTags(int tagId, string tagName) { bool flag = false; int tags = new TagDao().GetTags(tagName); if ((tags == tagId) || (tags <= 0)) { flag = new TagDao().UpdateTags(tagId, tagName); } return(flag); }
public static bool UpdateInsuranceCompany(int insuranceCompanyId, string insuranceCompanyName) { bool flag = false; int tags = new TagDao().GetInsuranceCompany(insuranceCompanyName); if ((tags != insuranceCompanyId) && (tags > 0)) { return(flag); } return(new TagDao().UpdateInsuranceCompany(insuranceCompanyId, insuranceCompanyName)); }
public static bool UpdateInsuranceArea(int InsuranceAreaId, string insuranceAreaCiteId, string insuranceAreaCiteName, string insuranceAreaProvinceId, string insuranceAreaName, string insuranceCompanyTypes, string insuranceCompanyTypesIds) { bool flag = false; int tags = new TagDao().GetInsuranceArea(insuranceAreaCiteId); if ((tags != InsuranceAreaId) && (tags > 0)) { return(flag); } return(new TagDao().UpdateInsuranceArea(InsuranceAreaId, insuranceAreaCiteId, insuranceAreaCiteName, insuranceAreaProvinceId, insuranceAreaName, insuranceCompanyTypes, insuranceCompanyTypesIds)); }
public static bool UpdateTags(int tagId, string tagName) { bool result = false; int tags = new TagDao().GetTags(tagName); if (tags == tagId || tags <= 0) { result = new TagDao().UpdateTags(tagId, tagName); } return(result); }
public static bool UpdateTags(int tagId, string tagName) { bool flag = false; int tags = new TagDao().GetTags(tagName); if ((tags != tagId) && (tags > 0)) { return(flag); } return(new TagDao().UpdateTags(tagId, tagName)); }
public static int AddTags(string tagName) { TagDao tagDao = new TagDao(); int result = 0; if (tagDao.GetTags(tagName) <= 0) { result = tagDao.AddTags(tagName); } return(result); }
public TagBlock FindAllTags(int startIndex = 0, int count = 20) { List <Tag> tags = TagDao.FindAll(startIndex, count + 1); bool existMoreTags = (tags.Count == count + 1); if (existMoreTags) { tags.RemoveAt(count); } return(new TagBlock(tags, existMoreTags)); }
public void TagProduct(long productId, long tagId) { Product product = ProductDao.Find(productId); Tag tag = TagDao.Find(tagId); if (!product.Tags.Contains(tag)) { tag.Products.Add(product); } tag.timesUsed += 1; TagDao.Update(tag); }
public static TagViewModel FindByTagName(string tagName) { TagDao dao = new TagDao(); var entity = dao.FindBy(new Dictionary <string, object>() { { "Name", tagName } }).SingleOrDefault(); if (entity == null) { return(null); } return(entity.ToViewModel()); }