本文整理汇总了C#中eSortColumn类的典型用法代码示例。如果您正苦于以下问题:C# eSortColumn类的具体用法?C# eSortColumn怎么用?C# eSortColumn使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
eSortColumn类属于命名空间,在下文中一共展示了eSortColumn类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:38,代码来源:EventComments.cs
示例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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:22,代码来源:AdsCategories.cs
示例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);
}
开发者ID:varlo,项目名称:Unona9,代码行数:10,代码来源:AffiliatesHistory.cs
示例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;
}
开发者ID:varlo,项目名称:Unona9,代码行数:56,代码来源:ContentPages.cs
示例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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:35,代码来源:CreditsPackages.cs
示例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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:48,代码来源:GroupMembers.cs
示例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();
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:6,代码来源:EcardCategory.cs
示例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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:24,代码来源:EcardCategory.cs
示例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();
}
}
开发者ID:varlo,项目名称:Unona9,代码行数:41,代码来源:BannerCodes.cs
示例10: Fetch
public static EventComment[] Fetch(int eventID, eSortColumn sortColumn)
{
return Fetch(null, eventID, null, null, sortColumn);
}
开发者ID:varlo,项目名称:Unona9,代码行数:4,代码来源:EventComments.cs
示例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();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:35,代码来源:GroupEventsComments.cs
示例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);
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:11,代码来源:GroupEventsComments.cs
示例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();
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:13,代码来源:AdsCategories.cs
示例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();
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:6,代码来源:EcardCategory.cs
示例15: Fetch
public static GiftCategory[] Fetch(eSortColumn sortColumn)
{
return Fetch(null, null, null, sortColumn);
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:4,代码来源:EcardCategory.cs
示例16: Fetch
private static EcardType[] Fetch(int? id, int? categoryId, string name, eType? type, bool? active, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = (SqlDataReader) SqlHelper.GetDB().ExecuteReader("FetchEcardTypes",
id,
categoryId,
name,
(int?)type,
active,
sortColumn);
var lEcardType = new List<EcardType>();
while (reader.Read())
{
try
{
var ecardType = new EcardType
{
id = (int) reader["ID"],
categoryId = (int) reader["CategoryID"],
name = (string) reader["Name"],
phrase = (string) reader["Phrase"],
type = (eType) reader["Type"],
active = (bool) reader["Active"]
};
lEcardType.Add(ecardType);
}
catch { }
}
return lEcardType.ToArray();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:33,代码来源:EcardTypes.cs
示例17: Fetch
/// <summary>
/// Fetches community photo approval from DB.
/// If there are no community photo approval in DB it returns an empty array.
/// </summary>
/// <returns></returns>
public static CommunityPhotoApproval[] Fetch(eSortColumn sortColumn)
{
return Fetch(null, null, null, null, null, sortColumn);
}
开发者ID:varlo,项目名称:Unona9,代码行数:9,代码来源:CommunityPhotoApproval.cs
示例18: Fetch
private static EcardType[] Fetch(int? id, string name, eType? type, bool? active, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = SqlHelper.ExecuteReader(conn, "FetchEcardTypes",
id,
name,
type,
active,
sortColumn);
List<EcardType> lEcardType = new List<EcardType>();
while (reader.Read())
{
EcardType ecardType = new EcardType();
ecardType.id = (int)reader["ID"];
ecardType.name = (string) reader["Name"];
ecardType.type = (eType) reader["Type"];
ecardType.active = (bool) reader["Active"];
ecardType.CreditsRequired = reader["CreditsRequired"] as int?;
lEcardType.Add(ecardType);
}
return lEcardType.ToArray();
}
}
开发者ID:varlo,项目名称:Unona9,代码行数:29,代码来源:EcardTypes.cs
示例19: Fetch
private static Ecard[] Fetch(int? id, int? ecardTypeID, string fromUsername, string toUsername,
bool? isOpened, eSortColumn sortColumn)
{
using (SqlConnection conn = Config.DB.Open())
{
SqlDataReader reader = (SqlDataReader) SqlHelper.GetDB().ExecuteReader( "FetchEcards",
id,
ecardTypeID,
fromUsername,
toUsername,
isOpened,
sortColumn);
List<Ecard> lEcards = new List<Ecard>();
while (reader.Read())
{
Ecard ecard = new Ecard();
ecard.id = (int)reader["ID"];
ecard.ecardTypeID= (int) reader["EcardTypeID"];
ecard.fromUsername = (string) reader["FromUsername"];
ecard.toUsername = (string) reader["ToUsername"];
ecard.date = (DateTime) reader["Date"];
ecard.message = (string) reader["Message"];
ecard.deletedByFromUser = (bool) reader["DeletedByFromUser"];
ecard.deletedByToUser = (bool) reader["DeletedByToUser"];
ecard.isOpened = (bool) reader["IsOpened"];
lEcards.Add(ecard);
}
return lEcards.ToArray();
}
}
开发者ID:haimon74,项目名称:Easy-Fixup,代码行数:36,代码来源:Ecards.cs
示例20: Fetch
/// <summary>
/// Fetches the specified sort column.
/// </summary>
/// <param name="sortColumn">The sort column.</param>
/// <returns></returns>
public static AffiliateHistory[] Fetch(eSortColumn sortColumn)
{
return Fetch(null, null, null, null, sortColumn);
}
开发者ID:varlo,项目名称:Unona9,代码行数:9,代码来源:AffiliatesHistory.cs
注:本文中的eSortColumn类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论