|
@@ -34,7 +34,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
try
|
|
|
{
|
|
|
Grp_InvitationOfficialActivities grp_Invitation = _sqlSugar.Queryable<Grp_InvitationOfficialActivities>().First(a => a.Id == dto.Id && a.IsDel == 0);
|
|
|
- Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0);
|
|
|
+ Grp_CreditCardPayment grp_CreditCard = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == dto.Id && a.IsDel == 0 && a.CTable==81);
|
|
|
Res_InvitationOfficialActivityData res_InvitationOfficialActivityData = new Res_InvitationOfficialActivityData();
|
|
|
if (grp_Invitation!=null)
|
|
|
{
|
|
@@ -68,7 +68,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
string sqlWhere = string.Empty;
|
|
|
if (!string.IsNullOrWhiteSpace(dto.Inviter))
|
|
|
{
|
|
|
- sqlWhere += string.Format(@" And Inviter={0}", dto.Inviter);
|
|
|
+ sqlWhere += string.Format(@" And Inviter like '%{0}%'", dto.Inviter);
|
|
|
}
|
|
|
if (!string.IsNullOrWhiteSpace(dto.StartInviteTime) && !string.IsNullOrWhiteSpace(dto.EndInviteTime))
|
|
|
{
|
|
@@ -120,7 +120,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
|
|
|
if (_InvitationOfficialActivities != null)
|
|
|
{
|
|
|
- return result = new Result() { Code = -1, Msg = "该客户已存在,请勿重复添加!" };
|
|
|
+ return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -128,11 +128,15 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (id != 0)//修改或添加商邀资料
|
|
|
{
|
|
|
Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
|
|
|
- res_InvitationData.Remark = "";
|
|
|
- int DataID = 0;
|
|
|
- if (dto.DataId == 0)
|
|
|
+ res_InvitationData.Country = dto.InviterArea;
|
|
|
+ res_InvitationData.UnitName = dto.Inviter;
|
|
|
+ res_InvitationData.Delegation = dto.DiId.ToString();
|
|
|
+ Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
|
|
|
+ (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName);
|
|
|
+ if (ifNullUp == null)///添加或修改商邀资料
|
|
|
{
|
|
|
- DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
+ res_InvitationData.Remark = dto.OtherInformation;
|
|
|
+ int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
if (DataID != 0)
|
|
|
{
|
|
|
result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
@@ -142,108 +146,102 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
RollbackTran();
|
|
|
result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- res_InvitationData.Id = dto.DataId;
|
|
|
- DataID = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(b => b.Id == res_InvitationData.Id).SetColumns(b => new Res_InvitationOfficialActivityData
|
|
|
+ int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
|
|
|
{
|
|
|
- Country = res_InvitationData.Country,
|
|
|
- UnitName = res_InvitationData.UnitName,
|
|
|
- Address = res_InvitationData.Address,
|
|
|
- Contact = res_InvitationData.Contact,
|
|
|
- Job = res_InvitationData.Job,
|
|
|
- Tel = res_InvitationData.Tel,
|
|
|
- Email = res_InvitationData.Email,
|
|
|
- OtherInformation = res_InvitationData.OtherInformation,
|
|
|
- Fax = res_InvitationData.Fax
|
|
|
+ Contact=dto.Contact,
|
|
|
+ Tel=dto.Tel,
|
|
|
+ Email=dto.Email,
|
|
|
+ Fax=dto.Fax,
|
|
|
+ Address=dto.Address,
|
|
|
+ Remark=dto.OtherInformation,
|
|
|
}).ExecuteCommandAsync();
|
|
|
}
|
|
|
- if (DataID != 0)//添加C表
|
|
|
- {
|
|
|
- Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
- C.PayDId = dto.PayDId;
|
|
|
- C.ConsumptionPatterns = "";
|
|
|
- C.ConsumptionDate = "";
|
|
|
- C.CTDId = 0;
|
|
|
- C.BankNo = "";
|
|
|
- C.CardholderName = "";
|
|
|
- C.PayMoney = dto.InviteCosts + dto.SendCost;
|
|
|
- C.PaymentCurrency = dto.Currency;
|
|
|
- //当天汇率
|
|
|
- //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
- // C.DayRate = hfRate.Value;
|
|
|
- //else
|
|
|
- //C.DayRate = "";
|
|
|
- C.CompanyBankNo = "";
|
|
|
- C.OtherBankName = "";
|
|
|
- C.OtherSideNo = "";
|
|
|
- C.OtherSideName = "";
|
|
|
- C.Remark = "";
|
|
|
- C.CreateUserId = dto.CreateUserId;
|
|
|
- C.MFOperator = "";
|
|
|
- C.MFOperatorDate = "";
|
|
|
- C.IsAuditDM = 0;
|
|
|
- C.AuditDMOperate = 0;
|
|
|
- C.AuditDMDate = "";
|
|
|
- C.IsAuditMF = 0;
|
|
|
- C.AuditMFOperate = 0;
|
|
|
- C.AuditMFDate = "";
|
|
|
- C.IsAuditGM = 0;
|
|
|
- C.AuditGMOperate = 21;
|
|
|
- C.AuditGMDate = "";
|
|
|
- C.IsPay = 0;
|
|
|
- C.DIId = dto.DiId;
|
|
|
- C.CId = id;
|
|
|
- C.CTable = 81;
|
|
|
- C.PayPercentage = 0;
|
|
|
- C.PayThenMoney = 0;
|
|
|
- C.PayPercentageOld = 0;
|
|
|
- C.PayThenMoneyOld = 0;
|
|
|
- C.UpdateDate = "";
|
|
|
- C.Payee = dto.Payee;
|
|
|
- C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
- C.ExceedBudget = 0;
|
|
|
- //C.RMBPrice = 0.00f;
|
|
|
+ Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
+ C.PayDId = dto.PayDId;
|
|
|
+ C.ConsumptionPatterns = "";
|
|
|
+ C.ConsumptionDate = "";
|
|
|
+ C.CTDId = 0;
|
|
|
+ C.BankNo = "";
|
|
|
+ C.CardholderName = "";
|
|
|
+ C.PayMoney = dto.InviteCosts + dto.SendCost;
|
|
|
+ C.PaymentCurrency = dto.Currency;
|
|
|
+ //当天汇率
|
|
|
+ //if (!string.IsNullOrEmpty(hfRate.Value))
|
|
|
+ // C.DayRate = hfRate.Value;
|
|
|
+ //else
|
|
|
+ //C.DayRate = "";
|
|
|
+ C.CompanyBankNo = "";
|
|
|
+ C.OtherBankName = "";
|
|
|
+ C.OtherSideNo = "";
|
|
|
+ C.OtherSideName = "";
|
|
|
+ C.Remark = "";
|
|
|
+ C.CreateUserId = dto.CreateUserId;
|
|
|
+ C.MFOperator = "";
|
|
|
+ C.MFOperatorDate = "";
|
|
|
+ C.IsAuditDM = 0;
|
|
|
+ C.AuditDMOperate = 0;
|
|
|
+ C.AuditDMDate = "";
|
|
|
+ C.IsAuditMF = 0;
|
|
|
+ C.AuditMFOperate = 0;
|
|
|
+ C.AuditMFDate = "";
|
|
|
+ C.IsAuditGM = 0;
|
|
|
+ C.AuditGMOperate = 21;
|
|
|
+ C.AuditGMDate = "";
|
|
|
+ C.IsPay = 0;
|
|
|
+ C.DIId = dto.DiId;
|
|
|
+ C.CId = id;
|
|
|
+ C.CTable = 81;
|
|
|
+ C.PayPercentage = 0;
|
|
|
+ C.PayThenMoney = 0;
|
|
|
+ C.PayPercentageOld = 0;
|
|
|
+ C.PayThenMoneyOld = 0;
|
|
|
+ C.UpdateDate = "";
|
|
|
+ C.Payee = dto.Payee;
|
|
|
+ C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
+ C.ExceedBudget = 0;
|
|
|
+ //C.RMBPrice = 0.00f;
|
|
|
|
|
|
- //设置该团组的汇率
|
|
|
- Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 81);
|
|
|
- if (_TeamRate != null)
|
|
|
- {
|
|
|
- if (dto.Currency == 49)
|
|
|
- {
|
|
|
- C.DayRate = _TeamRate.RateU;
|
|
|
- C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateU);
|
|
|
- //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateU);
|
|
|
- }
|
|
|
- else if (dto.Currency == 51)
|
|
|
- {
|
|
|
- C.DayRate = _TeamRate.RateE;
|
|
|
- C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateE);
|
|
|
- //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateE);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- C.DayRate = 1M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ //设置该团组的汇率
|
|
|
+ Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == dto.DiId && a.IsDel == 0 && a.CTable == 81);
|
|
|
+ if (_TeamRate != null)
|
|
|
+ {
|
|
|
+ if (dto.Currency == 49)
|
|
|
{
|
|
|
- C.DayRate = 1M;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
+ C.DayRate = _TeamRate.RateU;
|
|
|
+ C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateU);
|
|
|
+ //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateU);
|
|
|
}
|
|
|
- int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
- if (cId != 0)
|
|
|
+ else if (dto.Currency == 51)
|
|
|
{
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
+ C.DayRate = _TeamRate.RateE;
|
|
|
+ C.RMBPrice = C.PayMoney * Convert.ToDecimal(_TeamRate.RateE);
|
|
|
+ //ccp.PayMoney = ccp.PayMoney * float.Parse(tr.RateE);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ C.DayRate = 1M;
|
|
|
+ C.RMBPrice = C.PayMoney;
|
|
|
}
|
|
|
}
|
|
|
+ else
|
|
|
+ {
|
|
|
+ C.DayRate = 1M;
|
|
|
+ C.RMBPrice = C.PayMoney;
|
|
|
+ }
|
|
|
+ int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
+ if (cId != 0)
|
|
|
+ {
|
|
|
+ result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -265,11 +263,16 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (res)
|
|
|
{
|
|
|
Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
|
|
|
- res_InvitationData.Remark = "";
|
|
|
- int DataID = 0;
|
|
|
- if (dto.DataId == 0)///添加或修改商邀资料
|
|
|
+ res_InvitationData.Country = dto.InviterArea;
|
|
|
+ res_InvitationData.UnitName = dto.Inviter;
|
|
|
+ Res_InvitationOfficialActivityData ifNullUp = await _sqlSugar.Queryable<Res_InvitationOfficialActivityData>().FirstAsync
|
|
|
+ (a => a.Country == res_InvitationData.Country && a.City == res_InvitationData.City && a.UnitName == res_InvitationData.UnitName);
|
|
|
+ if (ifNullUp == null)///添加或修改商邀资料
|
|
|
{
|
|
|
- DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
+ res_InvitationData.Remark =dto.OtherInformation;
|
|
|
+ res_InvitationData.Delegation = dto.DiId.ToString();
|
|
|
+
|
|
|
+ int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
if (DataID != 0)
|
|
|
{
|
|
|
result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
@@ -279,30 +282,25 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
RollbackTran();
|
|
|
result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- res_InvitationData.Id = dto.DataId;
|
|
|
- DataID = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(b => b.Id == res_InvitationData.Id).SetColumns(b => new Res_InvitationOfficialActivityData
|
|
|
+
|
|
|
+ } else
|
|
|
{
|
|
|
- Country = res_InvitationData.Country,
|
|
|
- UnitName = res_InvitationData.UnitName,
|
|
|
- Address = res_InvitationData.Address,
|
|
|
- Contact = res_InvitationData.Contact,
|
|
|
- Job = res_InvitationData.Job,
|
|
|
- Tel = res_InvitationData.Tel,
|
|
|
- Email = res_InvitationData.Email,
|
|
|
- OtherInformation = res_InvitationData.OtherInformation,
|
|
|
- Fax = res_InvitationData.Fax
|
|
|
- }).ExecuteCommandAsync();
|
|
|
- }
|
|
|
- if (DataID != 0)//修改C表
|
|
|
- {
|
|
|
- Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId ==grp_Invitation.Id && a.IsDel == 0);
|
|
|
+ int CTable = await _sqlSugar.Updateable<Res_InvitationOfficialActivityData>().Where(a => a.Id == ifNullUp.Id).SetColumns(a => new Res_InvitationOfficialActivityData
|
|
|
+ {
|
|
|
+ Contact=dto.Contact,
|
|
|
+ Tel=dto.Tel,
|
|
|
+ Email=dto.Email,
|
|
|
+ Fax=dto.Fax,
|
|
|
+ Address=dto.Address,
|
|
|
+ Remark=dto.OtherInformation,
|
|
|
+ }).ExecuteCommandAsync();
|
|
|
+ }
|
|
|
+
|
|
|
+ Grp_CreditCardPayment grp_CreditCardPayment = _sqlSugar.Queryable<Grp_CreditCardPayment>().First(a => a.CId == grp_Invitation.Id && a.CTable==81 && a.IsDel == 0);
|
|
|
if (grp_CreditCardPayment != null)
|
|
|
{
|
|
|
grp_CreditCardPayment.PayMoney = dto.InviteCosts + dto.SendCost;
|
|
|
- Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Invitation.DiId && a.IsDel == 0 && a.CTable == 81);
|
|
|
+ Grp_TeamRate _TeamRate = _sqlSugar.Queryable<Grp_TeamRate>().First(a => a.DiId == grp_Invitation.DiId && a.IsDel == 0 && a.IsDel==0 && a.CTable == 81);
|
|
|
if (_TeamRate != null)
|
|
|
{
|
|
|
|
|
@@ -355,12 +353,6 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
RollbackTran();
|
|
|
result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
- }
|
|
|
}
|
|
|
else
|
|
|
{
|