public override List<Guid> GetWorkWikiItem(Guid? trackingNumber, Guid? id, string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, DateTime? initialExpirationDate, DateTime? finalExpirationDate, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount) { List<Guid> records = new List<Guid>(); WikiDataContext db = new WikiDataContext( ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString); Table<LinqWorkWikiItem> workitems = db.GetTable<LinqWorkWikiItem>(); var query = from w in workitems where w.ApplicationName == this.ApplicationName where w.Author.Contains(!string.IsNullOrEmpty(author) ? author : string.Empty) where w.Category.Contains(!string.IsNullOrEmpty(category) ? category : string.Empty) where w.Content.Contains(!string.IsNullOrEmpty(content) ? content : string.Empty) where w.DateCreated >= (initialDateCreated.HasValue && initialDateCreated != DateTime.MinValue ? initialDateCreated : w.DateCreated) where w.DateCreated <= (finalDateCreated.HasValue && finalDateCreated != DateTime.MinValue ? finalDateCreated : w.DateCreated) where (description != null && w.Description != null ? w.Description : string.Empty) == (description != null ? description : string.Empty) where initialExpirationDate != null && w.ExpirationDate >= (initialExpirationDate.HasValue && initialExpirationDate != DateTime.MinValue ? initialExpirationDate.Value : w.ExpirationDate) where finalExpirationDate != null && w.ExpirationDate <= (finalExpirationDate.HasValue && finalExpirationDate != DateTime.MinValue ? finalExpirationDate.Value : w.ExpirationDate) where w.ID == (id.HasValue && id != Guid.Empty ? id : w.ID) where w.IsVisible == (isVisible.HasValue ? isVisible : w.IsVisible) where (keywords != null && w.Keywords != null ? w.Keywords : string.Empty) == (keywords != null ? keywords : string.Empty) where w.LastUpdated >= (initialLastUpdated.HasValue && initialLastUpdated != DateTime.MinValue ? initialLastUpdated : w.LastUpdated) where w.LastUpdated <= (finalLastUpdated.HasValue && finalLastUpdated != DateTime.MinValue ? finalLastUpdated : w.LastUpdated) where (lastUpdatedBy != null && w.LastUpdatedBy != null ? w.LastUpdatedBy : string.Empty) == (lastUpdatedBy != null ? lastUpdatedBy : string.Empty) where (ReachLevel)w.ReachLevel == (level.HasValue ? level : (ReachLevel)w.ReachLevel) where w.Slug.Contains(!string.IsNullOrEmpty(slug) ? slug : string.Empty) where w.Title.Contains(!string.IsNullOrEmpty(title) ? title : string.Empty) where w.TrackingNumber == (trackingNumber.HasValue ? trackingNumber : w.TrackingNumber) select w.TrackingNumber; totalCount = query.Count(); foreach (Guid workitemId in query.Skip(pageSize * pageIndex).Take(pageSize)) records.Add(workitemId); return records; }
public abstract List<Guid> SearchWiki(string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount);
public override List<Guid> SearchWiki(string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount) { List<Guid> records = new List<Guid>(); WikiDataContext db = new WikiDataContext( ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString); Table<LinqWiki> wikis = db.GetTable<LinqWiki>(); var q0 = (from w in wikis where w.ApplicationName == this.ApplicationName select new SearchWikiResult() { ID = Guid.Empty, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 10 }).Distinct(); var q1 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Slug.Contains(slug) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 100 }; var q2 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Title.Contains(title) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 90 }; var q3 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Keywords.Contains(keywords) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 80 }; var q4 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Category.Contains(category) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 70 }; var q5 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Description.Contains(description) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 60 }; var q6 = from w in wikis where w.ApplicationName == this.ApplicationName where w.Content.Contains(content) select new SearchWikiResult() { ID = w.ID, Author = w.Author, IsVisible = w.IsVisible, DateCreated = w.DateCreated, ReachLevel = (ReachLevel)w.ReachLevel, LastUpdated = w.LastUpdated, LastUpdatedBy = w.LastUpdatedBy, Rate = 50 }; var q7 = q0; if (!string.IsNullOrEmpty(slug)) q7 = q0.Union(q1); if (!string.IsNullOrEmpty(title)) q7 = q7.Union(q2); if (!string.IsNullOrEmpty(keywords)) q7 = q7.Union(q3); if (!string.IsNullOrEmpty(category)) q7 = q7.Union(q4); if (!string.IsNullOrEmpty(description)) q7 = q7.Union(q5); if (!string.IsNullOrEmpty(content)) q7 = q7.Union(q6); var query = (from w in q7 where w.ID != Guid.Empty where w.IsVisible == (isVisible.HasValue ? isVisible : w.IsVisible) where w.DateCreated >= (initialDateCreated.HasValue && initialDateCreated != DateTime.MinValue ? initialDateCreated : w.DateCreated) where w.DateCreated <= (finalDateCreated.HasValue && finalDateCreated != DateTime.MinValue ? finalDateCreated : w.DateCreated) where (ReachLevel)w.ReachLevel >= (level.HasValue ? level : (ReachLevel)w.ReachLevel) where w.LastUpdated >= (initialLastUpdated.HasValue && initialLastUpdated != DateTime.MinValue ? initialLastUpdated : w.LastUpdated) where w.LastUpdated <= (finalLastUpdated.HasValue && finalLastUpdated != DateTime.MinValue ? finalLastUpdated : w.LastUpdated) where (lastUpdatedBy != null && w.LastUpdatedBy != null ? w.LastUpdatedBy : string.Empty) == (lastUpdatedBy != null ? lastUpdatedBy : string.Empty) orderby w.Rate descending select w.ID ).Distinct(); totalCount = query.Count(); foreach (Guid id in query.Skip(pageSize * pageIndex).Take(pageSize)) records.Add(id); return records; }
public virtual List<Guid> SearchWiki(string title, string description, string content, string author, string slug, string category, string keywords, ReachLevel? level, int pageSize, int pageIndex, out int totalCount) { return SearchWiki(title, description, content, author, slug, null, category, keywords, level, null, null, null, null, null, pageSize, pageIndex, out totalCount); }
public abstract List<Guid> GetWorkWikiItem(Guid? trackingNumber, Guid? id, string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, DateTime? initialExpirationDate, DateTime? finalExpirationDate, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount);
public static List<Guid> SearchWiki(string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount) { return _defaultProvider.SearchWiki(title, description, content, author, slug, isVisible, category, keywords, level, initialDateCreated, finalDateCreated, initialLastUpdated, finalLastUpdated, lastUpdatedBy, pageSize, pageIndex, out totalCount); }
public static List<Guid> SearchWiki(string title, string description, string content, string author, string slug, string category, string keywords, ReachLevel? level, int pageSize, int pageIndex, out int totalCount) { return _defaultProvider.SearchWiki(title, description, content, author, slug, category, keywords, level, pageSize, pageIndex, out totalCount); }
public static List<Guid> GetWorkWikiItem(Guid? trackingNumber, Guid id, string title, string description, string content, string author, string slug, bool? isVisible, string category, string keywords, ReachLevel? level, DateTime? initialDateCreated, DateTime? finalDateCreated, DateTime? initialLastUpdated, DateTime? finalLastUpdated, DateTime? initialExpirationDate, DateTime? finalExpirationDate, string lastUpdatedBy, int pageSize, int pageIndex, out int totalCount) { return _defaultProvider.GetWorkWikiItem(trackingNumber, id, title, description, content, author, slug, isVisible, category, keywords, level, initialDateCreated, finalDateCreated, initialLastUpdated, finalLastUpdated, initialExpirationDate, finalExpirationDate, lastUpdatedBy, pageSize, pageIndex, out totalCount); }