|
@@ -627,16 +627,18 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
CreateUserId = _UserId
|
|
|
};
|
|
|
|
|
|
- var companyAdd = await _sqlSugar.Insertable(_CustomerCompany).ExecuteReturnIdentityAsync();
|
|
|
- if (companyAdd < 0)
|
|
|
+ var companyAdd = await _sqlSugar.Insertable(_CustomerCompany).ExecuteReturnEntityAsync();
|
|
|
+ if (companyAdd == null)
|
|
|
{
|
|
|
_Msg += string.Format("{0} 公司信息添加失败!请前往客户信息确认!\r\n", clientName);
|
|
|
}
|
|
|
- companyId = companyAdd;
|
|
|
+ _CustomerCompanies.Add(companyAdd);
|
|
|
+ companyId = companyAdd.Id;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Crm_DeleClient _DeleClient = new Crm_DeleClient() {
|
|
|
+ Crm_DeleClient _DeleClient = new Crm_DeleClient() {
|
|
|
+ CrmCompanyId = companyId,
|
|
|
LastName = item.LastName,
|
|
|
FirstName = item.FirstName,
|
|
|
Pinyin = item.Pinyin,
|
|
@@ -651,6 +653,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
var clientEdit = await _sqlSugar.Updateable(_DeleClient).UpdateColumns(it =>
|
|
|
new
|
|
|
{
|
|
|
+ it.CrmCompanyId,
|
|
|
it.LastName,
|
|
|
it.FirstName,
|
|
|
it.Sex,
|
|
@@ -760,7 +763,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
Pinyin = item.Pinyin,
|
|
|
Phone = item.Phone,
|
|
|
Sex = item.Sex,
|
|
|
- BirthDay = item.BirthDay == null ? null : Convert.ToDateTime(item.BirthDay),
|
|
|
+ BirthDay = string.IsNullOrEmpty(item.BirthDay) ? null : Convert.ToDateTime(item.BirthDay),
|
|
|
Job = item.Job,
|
|
|
CreateUserId = userId
|
|
|
};
|
|
@@ -833,6 +836,7 @@ namespace OASystem.Infrastructure.Repositories.Groups
|
|
|
if (clientInfo != null) //该客户存在 修改信息
|
|
|
{
|
|
|
clientId = clientInfo.Id;
|
|
|
+ _DeleClient.CrmCompanyId = crmCompanyId;
|
|
|
var clientEdit = await _sqlSugar.Updateable(_DeleClient).UpdateColumns(it =>
|
|
|
new
|
|
|
{
|