|
@@ -287,126 +287,125 @@ Order By i.id Desc ", sqlWhere);
|
|
|
Grp_InvitationOfficialActivities grp_Invitation = _mapper.Map<Grp_InvitationOfficialActivities>(dto);
|
|
|
if (dto.Status == 1)//添加
|
|
|
{
|
|
|
- string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
|
|
|
- , dto.InviterArea, dto.Inviter, dto.DiId, 0);
|
|
|
- var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
|
|
|
- if (_InvitationOfficialActivities != null)
|
|
|
- {
|
|
|
- return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
|
|
|
- }
|
|
|
- else
|
|
|
+ //string selectSql = string.Format(@"select * from Grp_InvitationOfficialActivities where InviterArea='{0}' and Inviter='{1}' and DiId={2} and IsDel={3}"
|
|
|
+ // , dto.InviterArea, dto.Inviter, dto.DiId, 0);
|
|
|
+ //var _InvitationOfficialActivities = await _sqlSugar.SqlQueryable<Grp_InvitationOfficialActivities>(selectSql).FirstAsync();//查询是否存在
|
|
|
+ //if (_InvitationOfficialActivities != null)
|
|
|
+ //{
|
|
|
+ // return result = new Result() { Code = -1, Msg = "该数据已存在,请勿重复添加!" };
|
|
|
+ //}
|
|
|
+
|
|
|
+ id = await AddAsyncReturnId(grp_Invitation);
|
|
|
+ if (id != 0)//修改或添加商邀资料
|
|
|
{
|
|
|
- id = await AddAsyncReturnId(grp_Invitation);
|
|
|
- if (id != 0)//修改或添加商邀资料
|
|
|
+ Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
|
|
|
+ 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 && a.IsDel == 0);
|
|
|
+ if (ifNullUp == null)///添加或修改商邀资料
|
|
|
{
|
|
|
- Res_InvitationOfficialActivityData res_InvitationData = _mapper.Map<Res_InvitationOfficialActivityData>(dto);
|
|
|
- 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 && a.IsDel == 0);
|
|
|
- if (ifNullUp == null)///添加或修改商邀资料
|
|
|
+ res_InvitationData.Remark = dto.OtherInformation;
|
|
|
+ int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
+ if (DataID != 0)
|
|
|
{
|
|
|
- res_InvitationData.Remark = dto.OtherInformation;
|
|
|
- int DataID = await _sqlSugar.Insertable(res_InvitationData).ExecuteReturnIdentityAsync();
|
|
|
- if (DataID != 0)
|
|
|
- {
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
- }
|
|
|
-
|
|
|
+ result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- 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();
|
|
|
+ RollbackTran();
|
|
|
+ result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
}
|
|
|
|
|
|
- Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
- C.PayDId = dto.PayDId;
|
|
|
- if (C.PayDId == 72) C.IsPay = 1;
|
|
|
- else C.IsPay = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ 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();
|
|
|
+ }
|
|
|
|
|
|
- C.ConsumptionPatterns = dto.ConsumptionPatterns;
|
|
|
- C.ConsumptionDate = dto.ConsumptionDate;
|
|
|
- C.CTDId = dto.CTDId;
|
|
|
- C.BankNo = dto.BankNo;
|
|
|
- C.CardholderName = dto.CardholderName;
|
|
|
- C.PayMoney = dto.PayMoney;
|
|
|
- C.PaymentCurrency = dto.PaymentCurrency;
|
|
|
- C.CompanyBankNo = dto.CompanyBankNo;
|
|
|
- C.OtherBankName = dto.OtherBankName;
|
|
|
- C.OtherSideNo = dto.OtherSideNo;
|
|
|
- C.OtherSideName = dto.OtherSideName;
|
|
|
- C.Remark = "";
|
|
|
- C.CreateUserId = dto.CreateUserId;
|
|
|
- C.MFOperator = 0;
|
|
|
- C.MFOperatorDate = "";
|
|
|
- C.IsAuditDM = 0;
|
|
|
- C.AuditDMOperate = 0;
|
|
|
- C.AuditDMDate = "";
|
|
|
- C.IsAuditMF = 0;
|
|
|
- C.AuditMFOperate = 0;
|
|
|
- C.AuditMFDate = "";
|
|
|
- C.IsAuditGM = 0;
|
|
|
- C.AuditGMOperate = 0;
|
|
|
- C.AuditGMDate = "";
|
|
|
- //C.IsPay = 0;
|
|
|
- C.DIId = dto.DiId;
|
|
|
- C.CId = id;
|
|
|
- C.CTable = 81;
|
|
|
- C.PayPercentage = 100;
|
|
|
- C.PayThenMoney = 0;
|
|
|
- C.PayPercentageOld = 0;
|
|
|
- C.PayThenMoneyOld = 0;
|
|
|
- C.UpdateDate = "";
|
|
|
- C.Payee = dto.Payee;
|
|
|
- C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
- C.ExceedBudget = 0;
|
|
|
+ Grp_CreditCardPayment C = new Grp_CreditCardPayment();
|
|
|
+ C.PayDId = dto.PayDId;
|
|
|
+ if (C.PayDId == 72) C.IsPay = 1;
|
|
|
+ else C.IsPay = 0;
|
|
|
|
|
|
- //获取新汇率 int diId,int CId, int currencyId
|
|
|
- var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
|
|
|
+ C.ConsumptionPatterns = dto.ConsumptionPatterns;
|
|
|
+ C.ConsumptionDate = dto.ConsumptionDate;
|
|
|
+ C.CTDId = dto.CTDId;
|
|
|
+ C.BankNo = dto.BankNo;
|
|
|
+ C.CardholderName = dto.CardholderName;
|
|
|
+ C.PayMoney = dto.PayMoney;
|
|
|
+ C.PaymentCurrency = dto.PaymentCurrency;
|
|
|
+ C.CompanyBankNo = dto.CompanyBankNo;
|
|
|
+ C.OtherBankName = dto.OtherBankName;
|
|
|
+ C.OtherSideNo = dto.OtherSideNo;
|
|
|
+ C.OtherSideName = dto.OtherSideName;
|
|
|
+ C.Remark = "";
|
|
|
+ C.CreateUserId = dto.CreateUserId;
|
|
|
+ C.MFOperator = 0;
|
|
|
+ C.MFOperatorDate = "";
|
|
|
+ C.IsAuditDM = 0;
|
|
|
+ C.AuditDMOperate = 0;
|
|
|
+ C.AuditDMDate = "";
|
|
|
+ C.IsAuditMF = 0;
|
|
|
+ C.AuditMFOperate = 0;
|
|
|
+ C.AuditMFDate = "";
|
|
|
+ C.IsAuditGM = 0;
|
|
|
+ C.AuditGMOperate = 0;
|
|
|
+ C.AuditGMDate = "";
|
|
|
+ //C.IsPay = 0;
|
|
|
+ C.DIId = dto.DiId;
|
|
|
+ C.CId = id;
|
|
|
+ C.CTable = 81;
|
|
|
+ C.PayPercentage = 100;
|
|
|
+ C.PayThenMoney = 0;
|
|
|
+ C.PayPercentageOld = 0;
|
|
|
+ C.PayThenMoneyOld = 0;
|
|
|
+ C.UpdateDate = "";
|
|
|
+ C.Payee = dto.Payee;
|
|
|
+ C.OrbitalPrivateTransfer = dto.OrbitalPrivateTransfer;
|
|
|
+ C.ExceedBudget = 0;
|
|
|
|
|
|
- if (rate.Code == 0)
|
|
|
- {
|
|
|
- var rateInfo = (rate.Data as CurrencyInfo);
|
|
|
- if (rateInfo is not null)
|
|
|
- {
|
|
|
+ //获取新汇率 int diId,int CId, int currencyId
|
|
|
+ var rate = await fn(dto.DiId, 81, dto.InviteCurrency);
|
|
|
|
|
|
- C.DayRate = rateInfo.Rate;
|
|
|
- C.RMBPrice = rateInfo.Rate * C.PayMoney;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- C.DayRate = 1;
|
|
|
- C.RMBPrice = C.PayMoney;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
- var data = new { ccpId = cId, sign = 1 };
|
|
|
- if (cId != 0)
|
|
|
+ if (rate.Code == 0)
|
|
|
+ {
|
|
|
+ var rateInfo = (rate.Data as CurrencyInfo);
|
|
|
+ if (rateInfo is not null)
|
|
|
{
|
|
|
- result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
|
|
|
+
|
|
|
+ C.DayRate = rateInfo.Rate;
|
|
|
+ C.RMBPrice = rateInfo.Rate * C.PayMoney;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- RollbackTran();
|
|
|
- result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ C.DayRate = 1;
|
|
|
+ C.RMBPrice = C.PayMoney;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ int cId = await _sqlSugar.Insertable(C).ExecuteReturnIdentityAsync();
|
|
|
+ var data = new { ccpId = cId, sign = 1 };
|
|
|
+ if (cId != 0)
|
|
|
+ {
|
|
|
+ result = new Result() { Code = 0, Msg = "添加成功!", Data = data };
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ RollbackTran();
|
|
|
+ result = new Result() { Code = -1, Msg = "添加失败!" };
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
else//修改
|
|
|
{
|