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