统一表达式
This commit is contained in:
parent
bfb99d2885
commit
768528f59c
|
@ -1,5 +1,6 @@
|
|||
using CalendarNotepad.Extends;
|
||||
using CalendarNotepad.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace CalendarNotepad
|
||||
{
|
||||
|
@ -35,18 +36,15 @@ namespace CalendarNotepad
|
|||
var wd = this.mcWorkDay.SelectionStart.ToString("yyyyMMdd");
|
||||
var dr = "全天";
|
||||
var msg = this.rtbMsg.Text;
|
||||
var qu = this.Db.Queryable<WorkUnit>().Where(a => a.DayRange == dr && a.WorkDay == wd).ToList();
|
||||
var exp = Expressionable.Create<WorkUnit>().And(a => a.DayRange == dr && a.WorkDay == wd).ToExpression();
|
||||
|
||||
var qu = this.Db.Queryable<WorkUnit>().Where(exp).ToList();
|
||||
if(qu.Any() && msg.IsNullOrEmpty()) {
|
||||
this.Db.Deleteable<WorkUnit>()
|
||||
.Where(a => a.DayRange == dr && a.WorkDay == wd)
|
||||
.ExecuteCommand();
|
||||
this.Db.Deleteable<WorkUnit>().Where(exp).ExecuteCommand();
|
||||
return;
|
||||
}
|
||||
if(qu.Any() && msg.IsNotNullOrEmpty()) {
|
||||
this.Db.Updateable<WorkUnit>()
|
||||
.Where(a => a.DayRange == dr && a.WorkDay == wd)
|
||||
.SetColumns(a => a.WorkMessage == msg)
|
||||
.ExecuteCommand();
|
||||
this.Db.Updateable<WorkUnit>().Where(exp).SetColumns(a => a.WorkMessage == msg).ExecuteCommand();
|
||||
return;
|
||||
}
|
||||
if(!qu.Any() && msg.IsNotNullOrEmpty()) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user