本文整理汇总了C#中eSortColumn类的典型用法代码示例。如果您正苦于以下问题:C# eSortColumn类的具体用法?C# eSortColumn怎么用?C# eSortColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
eSortColumn类属于命名空间,在下文中一共展示了eSortColumn类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Fetch
private static EventComment[] Fetch(int? id, int? eventID, string username, int? numberOfComments, eSortColumn sortColumn)
{
using (var db = new ezFixUpDataContext())
{
var comments = from c in db.EventComments
where (!id.HasValue || c.ec_id == id)
&& (!eventID.HasValue || eventID == c.e_id)
&& (username == null || username == c.u_username)
select new EventComment
{
id = c.ec_id,
eventID = c.e_id,
username = c.u_username,
comment = c.ec_comment,
date = c.ec_date
};
if (sortColumn == eSortColumn.Date)
{
comments = comments.OrderByDescending(c => c.date);
}
else if (sortColumn == eSortColumn.Username)
{
comments = comments.OrderBy(c => c.username);
}
else if (sortColumn == eSortColumn.EventID)
{
comments = comments.OrderBy(c => c.eventID);
}
if (numberOfComments.HasValue)
{
comments = comments.Take(numberOfComments.Value);
}
return comments.ToArray();
}
}
示例2: Fetch
private static AdsCategory[] Fetch(int? id, int? parentID, string title, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = SqlHelper.ExecuteReader(conn, "FetchAdsCategories", id, parentID, title, sortColumn);
List<AdsCategory> categories = new List<AdsCategory>();
while (reader.Read())
{
AdsCategory category = new AdsCategory();
category.id = (int)reader["ID"];
category.parentID = reader["ParentID"] != DBNull.Value ? (int?) reader["ParentID"] : null;
category.title = (string)reader["Title"];
categories.Add(category);
}
return categories.ToArray();
}
}
示例3: FetchByAffiliateID
/// <summary>
/// Fetches the by affiliate ID.
/// </summary>
/// <param name="affiliateID">The affiliate ID.</param>
/// <param name="sortColumn">The sort column.</param>
/// <returns></returns>
public static AffiliateHistory[] FetchByAffiliateID(int affiliateID, eSortColumn sortColumn)
{
return Fetch(null, affiliateID, null, null, sortColumn);
}
示例4: FetchContentPages
/// <summary>
/// Fetches all content pages from database by specified id or language.
/// </summary>
/// <param name="id">Represents content page id.</param>
/// <param name="languageID">The language ID.</param>
/// <param name="sortColumn">The sort column.</param>
/// <returns>Array of content pages.</returns>
public static ContentPage[] FetchContentPages(object id, object languageID, eSortColumn sortColumn)
{
string cacheKey = String.Format("ContentPage_FetchContentPages_{0}_{1}_{2}", id, languageID, sortColumn);
if (HttpContext.Current != null && HttpContext.Current.Cache[cacheKey] != null)
{
return HttpContext.Current.Cache[cacheKey] as ContentPage[];
}
var lPages = new List<ContentPage>(5);
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader =
SqlHelper.ExecuteReader(conn,
"FetchContentPages", id, languageID, sortColumn);
while (reader.Read())
{
var contentPage = new ContentPage();
contentPage.id = (int) reader["ID"];
contentPage.title = (string) reader["Title"];
contentPage.linkText = (string)reader["LinkText"];
contentPage.content = (string) reader["Content"];
contentPage.headerPosition = reader["HeaderPosition"] == DBNull.Value
? null
: (int?) reader["HeaderPosition"];
contentPage.footerPosition = reader["FooterPosition"] == DBNull.Value
? null
: (int?) reader["FooterPosition"];
contentPage.visibleFor = (eVisibility) (int) reader["VisibleFor"];
contentPage.url = reader["URL"] == DBNull.Value ? null : (string) reader["URL"];
contentPage.metaDescription = (string) reader["MetaDescription"];
contentPage.metaKeyword = (string) reader["MetaKeyword"];
contentPage.languageID = (int) reader["LanguageID"];
contentPage.urlRewrite = reader["UrlRewrite"] as string;
lPages.Add(contentPage);
}
}
ContentPage[] pages = lPages.ToArray();
if (HttpContext.Current != null)
{
HttpContext.Current.Cache.Insert(cacheKey, pages, null, DateTime.Now.AddMinutes(30),
Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null);
}
return pages;
}
示例5: Fetch
/// <summary>
/// Fetches credits packages by specified arguments.
/// It returns an empty array if there are no credits packages in DB by specified arguments.
/// If these arguments are null it returns all credits packages from DB.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="name">The name.</param>
/// <param name="quantity">The quantity.</param>
/// <param name="price">The price.</param>
/// <param name="sortColumn">The sort column.</param>
/// <returns></returns>
private static CreditsPackage[] Fetch(int? id, string name, int? quantity, decimal? price, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = (SqlDataReader)
SqlHelper.GetDB().ExecuteReader( "FetchCreditsPackages", id, name, quantity, price, sortColumn);
List <CreditsPackage> lCreditsPackage = new List<CreditsPackage>();
while (reader.Read())
{
CreditsPackage creditsPackage = new CreditsPackage();
creditsPackage.id = (int) reader["ID"];
creditsPackage.name = (string) reader["Name"];
creditsPackage.quantity = (int) reader["Quantity"];
creditsPackage.price = (decimal) reader["Price"];
lCreditsPackage.Add(creditsPackage);
}
return lCreditsPackage.ToArray();
}
}
示例6: Fetch
/// <summary>
/// Fetches group members from DB by specified group ID, username, type or active status.
/// If all arguments are null it returns all group members from DB.
/// If it cannot find a record in DB by specified arguments it returns an empty array.
/// </summary>
/// <param name="groupID">The group ID.</param>
/// <param name="username">The username.</param>
/// <param name="type">The type.</param>
/// <param name="active">The active.</param>
/// <param name="joinDate">The join date.</param>
/// <param name="invitedBy">The invited by.</param>
/// <param name="numberOfMembers">The number of members.</param>
/// <returns>Group members array or an empty array if no group members are found in DB.</returns>
private static GroupMember[] Fetch(int? groupID, string username, eType? type, bool? active,
DateTime? joinDate, string invitedBy,
int? numberOfMembers, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = (SqlDataReader) SqlHelper.GetDB().ExecuteReader( "FetchGroupMembers",
groupID, username, type, active, joinDate, invitedBy, numberOfMembers, sortColumn);
List<GroupMember> groupMembers = new List<GroupMember>();
while (reader.Read())
{
GroupMember groupMember = new GroupMember();
groupMember.groupID = (int) reader["GroupID"];
groupMember.username = (string) reader["Username"];
groupMember.type = (eType) reader["Type"];
groupMember.active = (bool) reader["Active"];
groupMember.joinDate = (DateTime) reader["JoinDate"];
groupMember.invitedBy = reader["InvitedBy"] != DBNull.Value
? (string) reader["InvitedBy"] : null;
groupMember.joinAnswer = (string) reader["JoinAnswer"];
groupMember.isWarned = (bool) reader["IsWarned"];
groupMember.warnReason = reader["WarnReason"] != DBNull.Value ? (string) reader["WarnReason"] : null;
groupMember.warnExpirationDate = reader["WarnExpirationDate"] != DBNull.Value
? (DateTime?) reader["WarnExpirationDate"]
: null;
groupMembers.Add(groupMember);
}
return groupMembers.ToArray();
}
}
示例7: FetchCategories
public static GiftCategory[] FetchCategories(eSortColumn sortColumn)
{
GiftCategory[] categories = Fetch(sortColumn);
return categories.Where(category => category._parentID == null /*&& category.IsActive*/)
.Select(category => category).ToArray();
}
示例8: Fetch
private static WinkCategory[] Fetch(int? id, int? parentID, string title, eSortColumn sortColumn)
{
//using (var conn = Config.DB.Open())
{
var categories = new List<WinkCategory>();
using (var reader = SqlHelper.GetDB().ExecuteReader(FetchProcedureName,
id, parentID, title, sortColumn))
{
while (reader.Read())
{
var category = new WinkCategory
{
_id = (int) reader["ID"],
_parentID = (int?) reader["LanguageID"],
_title = (string) reader["Title"]
};
categories.Add(category);
}
reader.Close();
}
return categories.ToArray();
}
}
示例9: Fetch
private static BannerCode[] Fetch(int? id, ePosition? position, bool? getDefault, eSortColumn sortColumn)
{
string cacheKey = String.Format("BannerCode_Fetch_{0}_{1}_{2}_{3}", id, position, getDefault, sortColumn);
if (HttpContext.Current != null && HttpContext.Current.Cache[cacheKey] != null)
{
return HttpContext.Current.Cache[cacheKey] as BannerCode[];
}
using (var db = new Model.AspNetDatingDataContext())
{
var bannerCodes = from bc in db.BannerCodes
where (!id.HasValue || bc.bc_id == id)
&& (!position.HasValue || bc.bc_position == (int?) position)
&& (!getDefault.HasValue || bc.bc_target == null)
select new BannerCode
{
id = bc.bc_id,
position = (ePosition) bc.bc_position,
priority = bc.bc_priority,
target = bc.bc_target,
code = bc.bc_code
};
switch (sortColumn)
{
case eSortColumn.None :
break;
case eSortColumn.Priority :
bannerCodes = bannerCodes.OrderByDescending(bc => bc.priority);
break;
}
if (HttpContext.Current != null)
{
HttpContext.Current.Cache.Insert(cacheKey, bannerCodes.ToArray(), CacheDependencies.Get(), DateTime.Now.AddMinutes(30),
Cache.NoSlidingExpiration);
}
return bannerCodes.ToArray();
}
}
示例10: Fetch
public static EventComment[] Fetch(int eventID, eSortColumn sortColumn)
{
return Fetch(null, eventID, null, null, sortColumn);
}
示例11: Fetch
/// <summary>
/// Fetches group event comments by specified arguments.
/// It returns an empty array if there are no group event comments in DB by specified arguments.
/// If these arguments are null it returns all group event comments from DB.
/// </summary>
/// <param name="id">The id.</param>
/// <param name="groupEventID">The group event ID.</param>
/// <param name="username">The username.</param>
/// <param name="sortColumn">The sort column.</param>
/// <returns></returns>
private static GroupEventsComment[] Fetch(int? id, int? groupEventID, string username, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader =
SqlHelper.ExecuteReader(conn, "FetchGroupEventsComments", id, groupEventID, username, sortColumn);
List <GroupEventsComment> lGroupEventsComments = new List<GroupEventsComment>();
while(reader.Read())
{
GroupEventsComment groupEventsComment = new GroupEventsComment();
groupEventsComment.id = (int) reader["ID"];
groupEventsComment.groupEventID = (int) reader["GroupEventID"];
groupEventsComment.username = (string) reader["Username"];
groupEventsComment.comment = (string) reader["Comment"];
groupEventsComment.date = (DateTime) reader["Date"];
lGroupEventsComments.Add(groupEventsComment);
}
return lGroupEventsComments.ToArray();
}
}
示例12: FetchByGroupEventID
/// <summary>
/// Fetches group event comments by specified group event id.
/// If there are no group event comments in DB for the specified group event id it returns an empty array.
/// </summary>
/// <param name="groupEventID">The group event ID.</param>
/// <param name="sortColumn">The sort column.</param>
/// <returns></returns>
public static GroupEventsComment[] FetchByGroupEventID(int groupEventID, eSortColumn sortColumn)
{
return Fetch(null, groupEventID, null, sortColumn);
}
示例13: FetchCategories
public static AdsCategory[] FetchCategories(eSortColumn sortColumn)
{
List<AdsCategory> lAdsCategories = new List<AdsCategory>();
AdsCategory[] categories = Fetch(sortColumn);
foreach (var category in categories)
{
if (category.parentID != null) continue;
lAdsCategories.Add(category);
}
return lAdsCategories.ToArray();
}
示例14: FetchCategoriesByLaguageId
public static WinkCategory[] FetchCategoriesByLaguageId(int languageId, eSortColumn sortColumn)
{
WinkCategory[] categories = Fetch(sortColumn);
return categories.Where(category => category._parentID == languageId)
.Select(category => category).ToArray();
}
示例15: Fetch
public static GiftCategory[] Fetch(eSortColumn sortColumn)
{
return Fetch(null, null, null, sortColumn);
}