123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using AutoMapper;
- using OASystem.Domain.Entities.Groups;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OASystem.Infrastructure.Repositories.Groups
- {
- public class GroupCostParameterRepository : BaseRepository<Grp_GroupCostParameter, Grp_GroupCostParameterView>
- {
- public GroupCostParameterRepository(SqlSugarClient sqlSugar) :
- base(sqlSugar)
- {
- }
- public List<Grp_GroupCostParameter> GetGroupCostParameterListByDiid(int diid)
- {
- return Query(x=>x.DiId == diid).ToList();
- }
- public async Task<bool> DeleteGroupCostParameterListByDiid(int diid)
- {
- return await SoftDeleteAsync(x=>x.DiId == diid);
- }
- public async Task<bool> SaveAsync(List<Grp_GroupCostParameter> List,int Userid, int diid)
- {
- bool isTrue = false;
- try
- {
- BeginTran();
- isTrue = await DeleteGroupCostParameterListByDiid(diid);
- if (List.Count > 0)
- {
- List.ForEach(x => { x.CreateUserId = Userid; x.CreateTime = DateTime.Now; });
- isTrue = Adds(List) > 0;
- }
- CommitTran();
- }
- catch (Exception ex)
- {
- RollbackTran();
- isTrue = false;
- }
- return isTrue;
- }
- }
- }
|