iotgateway/IoTGateway.ViewModel/Config/SystemConfigVMs/SystemConfigListVM.cs

68 lines
2.9 KiB
C#
Raw Normal View History

2021-12-12 06:55:48 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Core.Extensions;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using IoTGateway.Model;
namespace IoTGateway.ViewModel.Config.SystemConfigVMs
{
public partial class SystemConfigListVM : BasePagedListVM<SystemConfig_View, SystemConfigSearcher>
{
protected override List<GridAction> InitGridAction()
{
return new List<GridAction>
{
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.Create, Localizer["Sys.Create"],"Config", dialogWidth: 800),
this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.Edit, Localizer["Sys.Edit"], "Config", dialogWidth: 800),
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.Delete, Localizer["Sys.Delete"], "Config", dialogWidth: 800),
this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.Details, Localizer["Sys.Details"], "Config", dialogWidth: 800),
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.BatchEdit, Localizer["Sys.BatchEdit"], "Config", dialogWidth: 800),
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.BatchDelete, Localizer["Sys.BatchDelete"], "Config", dialogWidth: 800),
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.Import, Localizer["Sys.Import"], "Config", dialogWidth: 800),
//this.MakeStandardAction("SystemConfig", GridActionStandardTypesEnum.ExportExcel, Localizer["Sys.Export"], "Config"),
};
}
protected override IEnumerable<IGridColumn<SystemConfig_View>> InitGridHeader()
{
return new List<GridColumn<SystemConfig_View>>{
this.MakeGridHeader(x => x.GatewayName),
this.MakeGridHeader(x => x.MqttIp),
this.MakeGridHeader(x => x.MqttPort),
this.MakeGridHeader(x => x.MqttUName),
this.MakeGridHeader(x => x.MqttUPwd),
2021-12-20 15:38:59 +00:00
this.MakeGridHeader(x => x.Disperse),
2021-12-12 06:55:48 +00:00
this.MakeGridHeaderAction(width: 200)
};
}
public override IOrderedQueryable<SystemConfig_View> GetSearchQuery()
{
var query = DC.Set<SystemConfig>()
.Select(x => new SystemConfig_View
{
ID = x.ID,
GatewayName = x.GatewayName,
MqttIp = x.MqttIp,
MqttPort = x.MqttPort,
MqttUName = x.MqttUName,
MqttUPwd = x.MqttUPwd,
2021-12-20 15:38:59 +00:00
Disperse = x.Disperse,
2021-12-12 06:55:48 +00:00
})
.OrderBy(x => x.ID);
return query;
}
}
public class SystemConfig_View : SystemConfig{
}
}