本文整理汇总了C#中Criteria类的典型用法代码示例。如果您正苦于以下问题:C# Criteria类的具体用法?C# Criteria怎么用?C# Criteria使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Criteria类属于命名空间,在下文中一共展示了Criteria类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Edit
public ActionResult Edit(long[] ids)
{
using (var session = new SessionFactory().OpenSession())
{
var model = session.Load<TrainManagementItem>(ids[0]);
if (model.ExamStatus != null && !model.ExamStatus.Equals(ExamStatusConst.未考试))
{
FlashWarn("您已经完成该考试!");
return Close();
}
var q = new Criteria<Exam>(session)
.AndIn<TrainManagementItem>(m => m.TrainManId, n => n.TrainManId, n => n.Id == ids[0]);
var exam = q.Load();
if (exam == null)
{
FlashWarn("考试不存在!请联系管理员!");
return Close();
}
var models = session.Find<Question>(m => m.ExamId == exam.Id);
if (models == null || !models.Any())
{
FlashWarn("考试题目未设置!");
return Close();
}
Response.Write(string.Format("<script>window.open('Exam?ids={0}','_blank')</script>", ids[0]));
return Close();
}
}
开发者ID:dalinhuang,项目名称:info_platform_i,代码行数:28,代码来源:OnlineExamController.cs
示例2: AllOrganizationList
public static SelectList AllOrganizationList()
{
var q = new Criteria<Organization>();
var d = q.Find();
d.Insert(0, new Organization { Id = 0, Name = "全部" });
return new SelectList(d, "Id", "Name");
}
开发者ID:dalinhuang,项目名称:info_platform,代码行数:7,代码来源:SelectListFactory.cs
示例3: TearDown
public void TearDown()
{
TransactionCommitterDB committer = new TransactionCommitterDB(DatabaseConnection.CurrentConnection);
Criteria criteria1 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "MyShape");
Criteria criteria2 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "MyShapeChanged");
Criteria criteria = new Criteria(criteria1, Criteria.LogicalOp.Or, criteria2);
BusinessObjectCollection<Shape> shapes =
BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObjectCollection<Shape>(criteria, null);
while (shapes.Count > 0)
{
Shape shape = shapes[0];
shape.MarkForDelete();
committer.AddBusinessObject(shape);
}
criteria1 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "Circle");
criteria2 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "CircleChanged");
criteria = new Criteria(criteria1, Criteria.LogicalOp.Or, criteria2);
BusinessObjectCollection<CircleNoPrimaryKey> circles
= BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObjectCollection
<CircleNoPrimaryKey>(criteria, null);
foreach (CircleNoPrimaryKey circle in circles)
{
circle.MarkForDelete();
committer.AddBusinessObject(circle);
}
committer.CommitTransaction();
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:29,代码来源:TestInheritanceSingleTable.cs
示例4: BasicRequestCommand
public BasicRequestCommand(
Criteria<FrontControllerRequest> request_criteria,
ApplicationCommand application_command)
{
this.request_specification = request_criteria;
this.application_command = application_command;
}
开发者ID:josephvano,项目名称:nbdn_2009_august_orlando,代码行数:7,代码来源:BasicRequestCommand.cs
示例5: TearDown
public void TearDown()
{
Criteria criteria1 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "MyShape");
Shape shape = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject<Shape>(
criteria1);
if (shape != null)
{
shape.MarkForDelete();
shape.Save();
}
criteria1 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "Circle");
Criteria criteria2 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "CircleChanged");
Criteria criteria = new Criteria(criteria1, Criteria.LogicalOp.Or, criteria2);
CircleNoPrimaryKey circle = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject<CircleNoPrimaryKey>(
criteria);
if (circle != null)
{
circle.MarkForDelete();
circle.Save();
}
criteria1 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "FilledCircle");
criteria2 = new Criteria("ShapeName", Criteria.ComparisonOp.Equals, "FilledCircleChanged");
criteria = new Criteria(criteria1, Criteria.LogicalOp.Or, criteria2);
FilledCircleNoPrimaryKey filledCircle = BORegistry.DataAccessor.BusinessObjectLoader.GetBusinessObject<FilledCircleNoPrimaryKey>(
criteria);
if (filledCircle == null) return;
filledCircle.MarkForDelete();
filledCircle.Save();
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:29,代码来源:TestInheritanceHierarchySingleTable.cs
示例6: UserHelper
static UserHelper()
{
var users = new Criteria<User>().Find();
foreach (var user in users)
{
Maps.Add(user.Name, user.Realname);
}
}
开发者ID:dalinhuang,项目名称:info_platform,代码行数:8,代码来源:UserHelper.cs
示例7: RoleForViewCustomerInfo
public RoleForViewCustomerInfo()
{
var specialRolesSetting = new Criteria<Setting>()
.Where(m => m.Code.Equals(Setting.RecruitingPlanExportTypeGjg)).Load();
var specialRoleNames = specialRolesSetting == null ? new string[0] :
specialRolesSetting.Value.Split(new[] { ',', ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
_roleNames = specialRoleNames.ToList();
}
开发者ID:dalinhuang,项目名称:info_platform,代码行数:8,代码来源:SingletonModule.cs
示例8: AllSchoolSectionList
public static SelectList AllSchoolSectionList()
{
var q = new Criteria<Department>();
q.And(m => m.Type.Equals(DeparmentTypeList.Section));
var d = q.Find();
d.Insert(0, new Department { Id = 0, Name = "全部" });
return new SelectList(d, "Id", "Name");
}
开发者ID:dalinhuang,项目名称:info_platform_i,代码行数:8,代码来源:SelectListFactory.cs
示例9: GetScrollNotices
/// <summary>
/// 读取滚动公告
/// </summary>
/// <returns></returns>
public static IList<Notice> GetScrollNotices()
{
using (var session = new SessionFactory().OpenSession())
{
var today = DateTime.Today;
var q = new Criteria<Notice>(session).Where(m => m.StopAt >= today);
return q.Find();
}
}
开发者ID:dalinhuang,项目名称:info_platform_i,代码行数:13,代码来源:NoticeService.cs
示例10: ClassStudentList
public static SelectList ClassStudentList(long id)
{
var q = new Criteria<SchoolStudent>().Where(m => m.ClassId.Equals(id)).Asc(m => m.StudentNo);
var d = q.Find();
foreach (var x in d)
{
x.StudentName = "[" + x.StudentNo + "]" + x.StudentName;
}
return new SelectList(d, "StudentNo", "StudentName");
}
开发者ID:dalinhuang,项目名称:info_platform,代码行数:10,代码来源:SelectListFactory.cs
示例11: GetName
public static string GetName(this string accountNo)
{
if (string.IsNullOrEmpty(accountNo)) return null;
if (Maps.ContainsKey(accountNo)) return Maps[accountNo];
var user = new Criteria<User>().Where(m => m.Name.Equals(accountNo)).Load();
if (user == null) return null;
Maps.Add(accountNo, user.Realname);
return user.Realname;
}
开发者ID:dalinhuang,项目名称:info_platform,代码行数:10,代码来源:UserHelper.cs
示例12: Display_View
protected void Display_View()
{
pnl_viewall.Visible = false;
List<OrderData> orderList = new List<OrderData>();
List<AddressData> aAddreses = new List<AddressData>();
List<Ektron.Cms.Commerce.Basket> basketList;
OrderApi orderApi = new OrderApi();
BasketApi basketApi = new BasketApi();
// customer
cCustomer = CustomerManager.GetItem(this.m_iID);
m_iCustomerId = cCustomer.Id;
this.ltr_id.Text = cCustomer.Id.ToString();
this.ltr_uname.Text = cCustomer.UserName;
this.ltr_fname.Text = cCustomer.FirstName;
this.ltr_lname.Text = cCustomer.LastName;
this.ltr_dname.Text = cCustomer.DisplayName;
this.ltr_ordertotal.Text = cCustomer.TotalOrders.ToString();
this.ltr_orderval.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.TotalOrderValue, defaultCurrency.CultureCode);
this.ltr_pervalue.Text = defaultCurrency.ISOCurrencySymbol + EkFunctions.FormatCurrency(cCustomer.AverageOrderValue, defaultCurrency.CultureCode);
// customer
// orders
Criteria<OrderProperty> orderCriteria = new Criteria<OrderProperty>();
orderCriteria.AddFilter(OrderProperty.CustomerId, CriteriaFilterOperator.EqualTo, m_iID);
orderList = orderApi.GetList(orderCriteria);
if (orderList.Count == 0)
{
ltr_orders.Text = this.GetMessage("lbl no orders");
}
dg_orders.DataSource = orderList;
dg_orders.DataBind();
// orders
// addresses
aAddreses = AddressManager.GetList(m_iID);
if (aAddreses.Count == 0)
{
ltr_address.Text = this.GetMessage("lbl no addresses");
}
dg_address.DataSource = aAddreses;
dg_address.DataBind();
// addresses
// baskets
if (this.m_iID > 0)
{
basketList = basketApi.GetList(this.m_iID);
if (basketList.Count == 0)
{
ltr_baskets.Text = this.GetMessage("lbl no baskets");
}
dg_baskets.DataSource = basketList;
dg_baskets.DataBind();
}
}
开发者ID:jaytem,项目名称:minGit,代码行数:54,代码来源:customers.aspx.cs
示例13: DepartmentList
public static SelectList DepartmentList()
{
var q = new Criteria<SchoolDepartment>();
var d = q.Find();
foreach (var item in d)
{
item.Name = string.Format("{0} [{1}]", item.Name, item.ShortName);
}
d.Insert(0, new SchoolDepartment { Id = 0, Name = "无" });
return new SelectList(d, "Id", "Name");
}
开发者ID:dalinhuang,项目名称:info_platform_i,代码行数:11,代码来源:SelectListFactory.cs
示例14: DoConditionlessQuery
private void DoConditionlessQuery(Func<FilterDescriptor<ElasticSearchProject>, BaseFilter> filter)
{
var criteria = new Criteria { };
var s = new SearchDescriptor<ElasticSearchProject>()
.Strict()
.From(0)
.Take(10)
.Filter(filter);
this.JsonEquals(s, System.Reflection.MethodInfo.GetCurrentMethod(), "MatchAll");
}
开发者ID:rmarinho,项目名称:NEST,代码行数:11,代码来源:ConditionLessTests.cs
示例15: TestCriteria
public void TestCriteria()
{
//---------------Set up test pack-------------------
var selectQuery = new SelectQuery {Source = new Source("bob")};
//---------------Execute Test ----------------------
var criteria = new Criteria("test", Criteria.ComparisonOp.Equals, "testValue");
selectQuery.Criteria = criteria;
//---------------Test Result -----------------------
Assert.AreSame(criteria, selectQuery.Criteria);
//---------------Tear Down -------------------------
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:11,代码来源:TestSelectQuery.cs
示例16: TestConstructor
public void TestConstructor()
{
//-------------Setup Test Pack ------------------
const string surname = "Surname";
string surnameValue = TestUtil.GetRandomString();
Criteria criteria = new Criteria(surname, Criteria.ComparisonOp.Equals, surnameValue);
//-------------Execute test ---------------------
CriteriaDB criteriaDB = new CriteriaDB(criteria);
//-------------Test Result ----------------------
Assert.AreEqual(criteria, criteriaDB);
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:12,代码来源:TestCriteriaDB.cs
示例17: Util_GetDates
public Criteria<OrderProperty> Util_GetDates(Criteria<OrderProperty> orderCriteria)
{
string periodText = String.Empty;
switch (hdn_filter.Value)
{
case "#yesterday":
periodText = GetMessage("lbl yesterday");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.LessThanOrEqualTo, DateTime.Now.Date);
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Date.Subtract(new TimeSpan(1, 0, 0, 0)));
break;
case "#thisweek":
periodText = GetMessage("lbl this week");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.DayOfWeek.GetHashCode(), 0, 0, 0)));
break;
case "#last7days":
periodText = GetMessage("lbl last seven days");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(7, 0, 0, 0)));
break;
case "#thismonth":
periodText = GetMessage("lbl this month");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.Date.Day, 0, 0, 0)));
break;
case "#last30days":
periodText = GetMessage("lbl last thirty days");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(30, 0, 0, 0)));
break;
case "#thisyear":
periodText = GetMessage("lbl this year");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Subtract(new TimeSpan(DateTime.Now.DayOfYear, 0, 0, 0)));
break;
default: // "#today":
periodText = GetMessage("today");
orderCriteria.AddFilter(OrderProperty.DateCreated, CriteriaFilterOperator.GreaterThanOrEqualTo, DateTime.Now.Date);
break;
}
SetTitle(GetMessage("lbl top products label"));
ltr_period.Text = "<a href=\"#periodMenu" + this.ClientID + "\" class=\"commerceperiod" + this.ClientID + " commerceperiodlink\">"
+ periodText + "</a>" + "   "
+ GetMessage("lbl quantity") + " "
+ "<a href=\"#\" class=\"quantitySection" + this.ClientID + " commerceactionlink\" >"
+ _qty.ToString() + "</a>";
return orderCriteria;
}
开发者ID:jaytem,项目名称:minGit,代码行数:52,代码来源:TopProducts.ascx.cs
示例18: MergeCriteriaSource
private void MergeCriteriaSource(Criteria criteria)
{
if (criteria == null) return;
if (criteria.IsComposite())
{
MergeCriteriaSource(criteria.LeftCriteria);
MergeCriteriaSource(criteria.RightCriteria);
}
else
{
this.Source.MergeWith(criteria.Field.Source);
}
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:13,代码来源:SelectQuery.cs
示例19: TestEquals_Null
public void TestEquals_Null()
{
//---------------Set up test pack-------------------
DateTime dateTimeValue = DateTime.Now;
const string datetimePropName = "DateTime";
Criteria criteria1 = new Criteria(datetimePropName, Criteria.ComparisonOp.GreaterThan, dateTimeValue);
//---------------Execute Test ----------------------
bool areEquals = criteria1.Equals(null);
//---------------Test Result -----------------------
Assert.IsFalse(areEquals);
//---------------Tear Down -------------------------
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:13,代码来源:TestCriteria.cs
示例20: TestLeafProperties_AlternateConstructor
public void TestLeafProperties_AlternateConstructor()
{
//-------------Setup Test Pack ------------------
QueryField field1 = new QueryField("MyField", "MyField", null);
//-------------Test Pre-conditions --------------
//-------------Execute test ---------------------
Criteria criteria = new Criteria(field1, Criteria.ComparisonOp.Equals, "MyValue");
//-------------Test Result ----------------------
Assert.AreSame(field1, criteria.Field);
Assert.AreEqual("MyValue", criteria.FieldValue);
Assert.AreEqual(Criteria.ComparisonOp.Equals, criteria.ComparisonOperator);
}
开发者ID:kevinbosman,项目名称:habanero,代码行数:14,代码来源:TestCriteria.cs
注:本文中的Criteria类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论