using AutoMapper;
|
using System.Collections.Generic;
|
using Yw;
|
using Yw.Dto;
|
|
namespace HStation.BLL
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public class PumpGroup
|
{
|
private readonly HStation.CAL.IPumpGroup _cal = CALCreateHelper.CreateCAL<HStation.CAL.IPumpGroup>();
|
|
#region Query
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.PumpGroup>> GetAll()
|
{
|
var DtoList = await _cal.GetAll();
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.PumpGroupDto, Vmo.PumpGroup>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.PumpGroupDto>, List<Vmo.PumpGroup>>(DtoList);
|
|
return vmoList;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<Vmo.PumpGroup> GetByID(long ID)
|
{
|
var DtoList = await _cal.GetByID(ID);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.PumpGroupDto, Vmo.PumpGroup>()
|
).CreateMapper();
|
var vmo = mapper.Map<Dto.Assets.PumpGroupDto, Vmo.PumpGroup>(DtoList);
|
return vmo;
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<List<Vmo.PumpGroup>> GetByIds(List<long> Ids)
|
{
|
var DtoList = await _cal.GetByIds(Ids);
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Dto.Assets.PumpGroupDto, Vmo.PumpGroup>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Dto.Assets.PumpGroupDto>, List<Vmo.PumpGroup>>(DtoList);
|
return vmoList;
|
}
|
|
#endregion Query
|
|
#region Insert
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<long> Insert(Vmo.PumpGroup model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, AddPumpGroupDto>()
|
).CreateMapper();
|
var vmo = mapper.Map<Vmo.PumpGroup, AddPumpGroupDto>(model);
|
|
return await _cal.Insert(vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Inserts(List<Vmo.PumpGroup> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, AddPumpGroupDto>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.PumpGroup>, List<AddPumpGroupDto>>(list);
|
return await _cal.Inserts(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkInserts(List<Vmo.PumpGroup> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, AddPumpGroupDto>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.PumpGroup>, List<AddPumpGroupDto>>(list);
|
|
return await _cal.BulkInserts(vmoList);
|
}
|
|
#endregion Insert
|
|
#region Update
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Update(Vmo.PumpGroup model)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, UpdatePumpGroupDto>()
|
).CreateMapper();
|
var vmo = mapper.Map<Vmo.PumpGroup, UpdatePumpGroupDto>(model);
|
|
return await _cal.Update(vmo);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> Updates(List<Vmo.PumpGroup> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, UpdatePumpGroupDto>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.PumpGroup>, List<UpdatePumpGroupDto>>(list);
|
|
return await _cal.Updates(vmoList);
|
}
|
|
public bool DeleteEx(long ID)
|
{
|
return _cal.DeleteEx(ID);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> BulkUpdates(List<Vmo.PumpGroup> list)
|
{
|
var mapper = new MapperConfiguration(cfg => cfg.CreateMap<Vmo.PumpGroup, UpdatePumpGroupDto>()
|
).CreateMapper();
|
var vmoList = mapper.Map<List<Vmo.PumpGroup>, List<UpdatePumpGroupDto>>(list);
|
|
return await _cal.BulkUpdates(vmoList);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> UpdateSortCode(long ID, int SortCode)
|
{
|
return await _cal.UpdateSortCode(ID, SortCode);
|
}
|
|
public async Task<bool> UpdateSorter(List<UpdateSortCodeInput> Sorters)
|
{
|
return await _cal.UpdateSorter(Sorters);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public Task<bool> UpdateParas(long ID, Dictionary<string, string> Paras)
|
{
|
return _cal.UpdateParas(ID, Paras);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public Task<bool> UpdateFlags(long ID, List<string> Flags)
|
{
|
return _cal.UpdateFlags(ID, Flags);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public Task<bool> UpdateTagName(long ID, string TagName)
|
{
|
return _cal.UpdateTagName(ID, TagName);
|
}
|
|
#endregion Update
|
|
#region Delete
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteByID(long ID)
|
{
|
return await _cal.DeleteByID(ID);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteByIds(List<long> Ids)
|
{
|
return await _cal.DeleteByIds(Ids);
|
}
|
|
/// <summary>
|
///
|
/// </summary>
|
public async Task<bool> DeleteAll()
|
{
|
return await _cal.DeleteAll();
|
}
|
|
#endregion Delete
|
}
|
}
|