using AutoMapper;
using Newtonsoft.Json;
using NPOI.OpenXmlFormats.Wordprocessing;
using NPOI.SS.Formula.Functions;
using OASystem.Domain;
using OASystem.Domain.AesEncryption;
using OASystem.Domain.Dtos;
using OASystem.Domain.Dtos.Financial;
using OASystem.Domain.Dtos.Groups;
using OASystem.Domain.Dtos.UserDto;
using OASystem.Domain.Entities.Customer;
using OASystem.Domain.Entities.Groups;
using OASystem.Domain.ViewModels.CRM;
using OASystem.Domain.ViewModels.Financial;
using OASystem.Domain.ViewModels.Groups;
using OASystem.Infrastructure.Repositories.System;
using Org.BouncyCastle.Asn1.Cms;
using Org.BouncyCastle.Utilities.Collections;
using Serilog;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace OASystem.Infrastructure.Repositories.Groups
{
///
/// 接团信息
///
public class DelegationInfoRepository : BaseRepository
{
private readonly SetDataRepository _setDataRepository;
private readonly UsersRepository _usersRepository;
private readonly TaskAssignmentRepository _taskAssignmentRep;
private readonly IMapper _mapper;
//private readonly TeamRateRepository _teamRateRep;
//public readonly Logs _logs;
public DelegationInfoRepository(SqlSugarClient sqlSugar, SetDataRepository setDataRepository, UsersRepository usersRepository,
TaskAssignmentRepository taskAssignmentRep, IMapper mapper)
: base(sqlSugar)
{
_setDataRepository = setDataRepository;
_usersRepository = usersRepository;
_taskAssignmentRep = taskAssignmentRep;
_mapper = mapper;
//_teamRateRep = teamRateRep;
}
#region 团组信息 团组详情共享Api
///
/// 团组信息 团组预览详情共享Api
///
///
///
public async Task PostShareGroupInfo(ShareGroupInfoDto dto)
{
Result result = new Result() { Code = -2, Msg = "未知错误" };
string sql = string.Format(@"Select Id,TeamName,TourCode,ClientName,VisitCountry,VisitStartDate,VisitEndDate,VisitDays,VisitPNumber
From Grp_DelegationInfo Where Id = {0} And IsDel = 0", dto.Id);
if (dto.PortType == 1) //Web
{
var _DelegationInfo = await _sqlSugar.SqlQueryable(sql).FirstAsync();
if (_DelegationInfo != null)
{
_DelegationInfo.VisitCountry = FormartTeamName(_DelegationInfo.VisitCountry);
}
else result.Msg = "暂无该团组信息";
result.Data = _DelegationInfo;
}
else if (dto.PortType == 2 || dto.PortType == 3) //IOS Or Android
{
var _DelegationInfo = await _sqlSugar.SqlQueryable(sql).FirstAsync();
if (_DelegationInfo != null)
{
_DelegationInfo.VisitCountry = FormartTeamName(_DelegationInfo.VisitCountry);
result.Data = _DelegationInfo;
}
else result.Msg = "暂无该团组信息";
result.Data = _DelegationInfo;
}
else result.Msg = "请输入正确的端口号。1 Web 2 Android 3 IOS";
result.Code = 0;
result.Msg = "成功!";
return result;
}
///
/// 团组信息List 团组预览详情共享Api
///
///
///
public async Task PostShareGroupInfos(int portType)
{
Result result = new Result() { Code = -2, Msg = "未知错误", Data = new List