public void TestSQLite() { string dbPath = ".\\Example.db3"; //如果不存在改数据库文件,则创建该数据库文件 if (!System.IO.File.Exists(dbPath)) { CreateDB(dbPath); } var u = new ExUsers(); u.Name = "张三"; u.Age = 23; u.Email = "*****@*****.**"; u.Status = 2; //OyEngine<ExUsers>.Insert(u); var cd = new OyCondition(ExUsers.sTatus, ConditionOperator.NotEqual, 9) & new OyCondition(ExUsers.aGe, ConditionOperator.Greater, 1); var mp = new MPager { PageIndex = 1, PageSize = 2 }; var us = OyEngine<ExUsers>.Filter(cd, mp); if (us != null && us.Count > 0) { u = us[0]; } OyEngine<ExUsers>.Update( new OyValue(ExUsers.nAme, "张山是个好名字") & new OyValue(ExUsers.eMail, "*****@*****.**") , new OyCondition(ExUsers.iD, u.Id)); }
public ActionResult Index(CxActivitySendOy cxact = null, decimal ysmin = 0, decimal ysmax = 0) { return View(); var cond = new OyCondition(CxActivitySendOy.sTatus, ConditionOperator.NotEqual, -1); if (cxact != null) { if (!string.IsNullOrEmpty(cxact.ActivityType) && cxact.ActivityType != "-1") { cond &= new OyCondition(CxActivitySendOy.aCtivityType, cxact.ActivityType); } if (!string.IsNullOrEmpty(cxact.ActivityName)) { cond &= new OyCondition(CxActivitySendOy.aCtivityName, ConditionOperator.Like, cxact.ActivityName); } if (!string.IsNullOrEmpty(cxact.CxDiscount)) { cond &= new OyCondition(CxActivitySendOy.cXDiscount, ConditionOperator.Like, cxact.CxDiscount); } if (ysmin > 0 && ysmax > 0) { cond &= (new OyCondition(CxActivitySendOy.aCtivityBudget, ConditionOperator.GreaterThanOrEqual, ysmin) & new OyCondition(CxActivitySendOy.aCtivityBudget, ConditionOperator.Less, ysmax)); } else { if (ysmax > 0) { cond &= new OyCondition(CxActivitySendOy.aCtivityBudget, ConditionOperator.Less, ysmax); } if (ysmin > 0) { cond &= new OyCondition(CxActivitySendOy.aCtivityBudget, ConditionOperator.GreaterThanOrEqual, ysmin); } } } var _mp = ViewData["_MP"] as MPager; _mp = _mp == null ? new MPager { PageSize = 20, PageIndex = 1 } : _mp; var ls = OyEngine<CxActivitySendOy>.Filter(cond, _mp); return View(); }
public OyCondition(OyCondition left, ConditionOperator op, OyCondition right) : base(left, op, right) { }