Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dotnet6分支异步改造(暂未完成) #602

Open
wants to merge 4 commits into
base: dotnet6
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ public async Task<QueryData<T>> StartSearchTree<T>(string url, BaseSearcher sear
}


public async void SetError(ValidateForm form, ErrorObj errors)
public async Task SetError(ValidateForm form, ErrorObj errors)
{
if (errors != null)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// WTM默认页面 Wtm buidin page
using System;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;

namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.ActionLogVMs
Expand All @@ -17,8 +18,9 @@ public ActionLogBatchVM()
public class ActionLog_BatchEdit : BaseVM
{

protected override void InitVM()
protected override Task InitVM()
{
return Task.CompletedTask;
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
// WTM默认页面 Wtm buidin page
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;

namespace WalkingTec.Mvvm.Mvc.Admin.ViewModels.ActionLogVMs
{
public class ActionLogListVM : BasePagedListVM<ActionLog, ActionLogSearcher>
{
protected override List<GridAction> InitGridAction()
protected override Task<List<GridAction>> InitGridAction()
{
var actions = new List<GridAction>
{
this.MakeStandardAction("ActionLog", GridActionStandardTypesEnum.BatchDelete, "","_Admin", dialogWidth: 800),
this.MakeStandardAction("ActionLog", GridActionStandardTypesEnum.Details, "","_Admin", dialogWidth: 800).SetHideOnToolBar(true),
this.MakeStandardAction("ActionLog", GridActionStandardTypesEnum.ExportExcel, "","_Admin"),
};
return actions;
return Task.FromResult (actions);
}

protected override IEnumerable<IGridColumn<ActionLog>> InitGridHeader()
protected override Task<IEnumerable<IGridColumn<ActionLog>>> InitGridHeader()
{
var header = new List<GridColumn<ActionLog>>();

Expand Down Expand Up @@ -62,10 +63,10 @@ protected override IEnumerable<IGridColumn<ActionLog>> InitGridHeader()
}));
header.Add(this.MakeGridHeaderAction(width: 120));

return header;
return Task.FromResult<IEnumerable<IGridColumn<ActionLog>>> (header);
}

public override IOrderedQueryable<ActionLog> GetSearchQuery()
public override Task<IOrderedQueryable<ActionLog>> GetSearchQuery()
{
var query = DC.Set<ActionLog>()
.CheckContain(Searcher.ITCode, x=>x.ITCode)
Expand All @@ -76,7 +77,7 @@ public override IOrderedQueryable<ActionLog> GetSearchQuery()
.CheckWhere(Searcher.Duration,x=>x.Duration >= Searcher.Duration)
.OrderByDescending(x=>x.ActionTime);

return query;
return Task.FromResult (query);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
Expand Down Expand Up @@ -26,8 +26,9 @@ public CityBatchVM()
public class City_BatchEdit : BaseVM
{

protected override void InitVM()
protected override Task InitVM()
{
return Task.CompletedTask;
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
Expand All @@ -19,10 +19,10 @@ public partial class CityTemplateVM : BaseTemplateVM
[Display(Name = "_Admin.Parent")]
public ExcelPropety Parent_Excel = ExcelPropety.CreateProperty<City>(x => x.ParentId);

protected override void InitVM()
protected override async Task InitVM()
{
Parent_Excel.DataType = ColumnDataType.ComboBox;
Parent_Excel.ListItems = DC.Set<City>().GetSelectListItems(Wtm, y => y.Name);
Parent_Excel.ListItems = await DC.Set<City>().GetSelectListItems(Wtm, y => y.Name);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -14,17 +14,17 @@ namespace WalkingTec.Mvvm.BlazorDemo.ViewModel.BasicData.CityVMs
public partial class CityListVM : BasePagedListVM<City_View, CitySearcher>
{

protected override IEnumerable<IGridColumn<City_View>> InitGridHeader()
protected override Task<IEnumerable<IGridColumn<City_View>>> InitGridHeader()
{
return new List<GridColumn<City_View>>{
return Task.FromResult<IEnumerable<IGridColumn<City_View>>> (new List<GridColumn<City_View>>{
this.MakeGridHeader(x => x.Name),
this.MakeGridHeader(x => x.Test),
this.MakeGridHeader(x => x.Name_view),
this.MakeGridHeaderAction(width: 200)
};
});
}

public override IOrderedQueryable<City_View> GetSearchQuery()
public override Task<IOrderedQueryable<City_View>> GetSearchQuery()
{
var query = DC.Set<City>()
.CheckContain(Searcher.Name, x=>x.Name)
Expand All @@ -38,7 +38,7 @@ public override IOrderedQueryable<City_View> GetSearchQuery()
Name_view = x.Parent.Name,
})
.OrderBy(x => x.ID);
return query;
return Task.FromResult (query);
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public partial class CitySearcher : BaseSearcher
[Display(Name = "_Admin.Parent")]
public int? ParentId { get; set; }

protected override void InitVM()
protected override async Task InitVM()
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,8 @@ public CityVM()
SetInclude(x => x.Children);
}

protected override void InitVM()
protected override async Task InitVM()
{
}

public override void DoAdd()
{
base.DoAdd();
}

public override void DoEdit(bool updateAllFields = false)
{
base.DoEdit(updateAllFields);
}

public override void DoDelete()
{
base.DoDelete();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public class GroupVMTest : BaseVM

public CityVM vm2 { get; set; } = new CityVM();

protected override void InitVM()
protected override async Task InitVM()
{
if(EntityId != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class Major_BatchEdit : BaseVM
[Display(Name = "所属学校")]
public int? SchoolId { get; set; }

protected override void InitVM()
protected override async Task InitVM()
{
AllSchools = DC.Set<School>().GetSelectListItems(Wtm, y => y.SchoolName);
AllSchools = await DC.Set<School>().GetSelectListItems(Wtm, y => y.SchoolName);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
Expand All @@ -23,10 +23,10 @@ public partial class MajorTemplateVM : BaseTemplateVM
[Display(Name = "所属学校")]
public ExcelPropety School_Excel = ExcelPropety.CreateProperty<Major>(x => x.SchoolId);

protected override void InitVM()
protected override async Task InitVM()
{
School_Excel.DataType = ColumnDataType.ComboBox;
School_Excel.ListItems = DC.Set<School>().GetSelectListItems(Wtm, y => y.SchoolName);
School_Excel.ListItems = await DC.Set<School>().GetSelectListItems(Wtm, y => y.SchoolName);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -14,20 +14,20 @@ namespace WalkingTec.Mvvm.BlazorDemo.ViewModel.BasicData.MajorVMs
public partial class MajorListVM : BasePagedListVM<Major_View, MajorSearcher>
{

protected override IEnumerable<IGridColumn<Major_View>> InitGridHeader()
protected override Task<IEnumerable<IGridColumn<Major_View>>> InitGridHeader()
{
return new List<GridColumn<Major_View>>{
return Task.FromResult<IEnumerable<IGridColumn<Major_View>>> (new List<GridColumn<Major_View>>{
this.MakeGridHeader(x => x.MajorCode),
this.MakeGridHeader(x => x.MajorName),
this.MakeGridHeader(x => x.MajorType),
this.MakeGridHeader(x => x.Remark),
this.MakeGridHeader(x => x.SchoolName_view),
this.MakeGridHeader(x => x.Name_view),
this.MakeGridHeaderAction(width: 200)
};
});
}

public override IOrderedQueryable<Major_View> GetSearchQuery()
public override Task<IOrderedQueryable<Major_View>> GetSearchQuery()
{
var query = DC.Set<Major>()
.CheckContain(Searcher.MajorCode, x=>x.MajorCode)
Expand All @@ -47,7 +47,7 @@ public override IOrderedQueryable<Major_View> GetSearchQuery()
Name_view = x.StudentMajors.Select(y=>y.Student.Name).ToSepratedString(null,","),
})
.OrderBy(x => x.ID);
return query;
return Task.FromResult (query);
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
Expand All @@ -25,8 +25,9 @@ public partial class MajorSearcher : BaseSearcher
[Display(Name = "学生")]
public List<string> SelectedStudentMajorsIDs { get; set; }

protected override void InitVM()
protected override Task InitVM()
{
return Task.CompletedTask;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public MajorVM()
SetInclude(x => x.StudentMajors);
}

protected override void InitVM()
protected override async Task InitVM()
{
SelectedStudentMajorsIDs = Entity.StudentMajors?.Select(x => x.StudentId).ToList();
}

public override void DoAdd()
public override async Task DoAdd()
{
Entity.StudentMajors = new List<StudentMajor>();
if (SelectedStudentMajorsIDs != null)
Expand All @@ -37,23 +37,23 @@ public override void DoAdd()
}
}

base.DoAdd();
await base.DoAdd();
}

public override void DoEdit(bool updateAllFields = false)
public override async Task DoEdit(bool updateAllFields = false)
{
Entity.StudentMajors = new List<StudentMajor>();
if(SelectedStudentMajorsIDs != null )
{
SelectedStudentMajorsIDs.ForEach(x => Entity.StudentMajors.Add(new StudentMajor { StudentId = x }));
}

base.DoEdit(updateAllFields);
await base.DoEdit(updateAllFields);
}

public override void DoDelete()
public override async Task DoDelete()
{
base.DoDelete();
await base.DoDelete();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
Expand Down Expand Up @@ -26,8 +26,9 @@ public SchoolBatchVM()
public class School_BatchEdit : BaseVM
{

protected override void InitVM()
protected override Task InitVM()
{
return Task.CompletedTask;
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public partial class SchoolTemplateVM : BaseTemplateVM
[Display(Name = "备注")]
public ExcelPropety Remark_Excel = ExcelPropety.CreateProperty<School>(x => x.Remark);

protected override void InitVM()
protected override async Task InitVM()
{
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -14,17 +14,17 @@ namespace WalkingTec.Mvvm.BlazorDemo.ViewModel.BasicData.SchoolVMs
public partial class SchoolListVM : BasePagedListVM<School_View, SchoolSearcher>
{

protected override IEnumerable<IGridColumn<School_View>> InitGridHeader()
protected override Task<IEnumerable<IGridColumn<School_View>>> InitGridHeader()
{
return new List<GridColumn<School_View>>{
return Task.FromResult<IEnumerable<IGridColumn<School_View>>> (new List<GridColumn<School_View>>{
this.MakeGridHeader(x => x.SchoolCode),
this.MakeGridHeader(x => x.SchoolName),
this.MakeGridHeader(x => x.SchoolType),
this.MakeGridHeader(x => x.Remark),
this.MakeGridHeader(x => x.PhotoId).SetFormat(PhotoIdFormat),
this.MakeGridHeader(x => x.FileId).SetFormat(FileIdFormat),
this.MakeGridHeaderAction(width: 200)
};
});
}
private List<ColumnFormatInfo> PhotoIdFormat(School_View entity, object val)
{
Expand All @@ -45,7 +45,7 @@ private List<ColumnFormatInfo> FileIdFormat(School_View entity, object val)
}


public override IOrderedQueryable<School_View> GetSearchQuery()
public override Task<IOrderedQueryable<School_View>> GetSearchQuery()
{
var query = DC.Set<School>()
.CheckContain(Searcher.SchoolCode, x=>x.SchoolCode)
Expand All @@ -63,7 +63,7 @@ public override IOrderedQueryable<School_View> GetSearchQuery()
FileId = x.FileId,
})
.OrderBy(x => x.ID);
return query;
return Task.FromResult (query);
}

}
Expand Down
Loading