Compare commits
No commits in common. "cc740be2d532f827737f7a525c45ef64545ef0cf" and "0e5a7b30ef57c6ca9a006e08c28355f2fc27ed33" have entirely different histories.
cc740be2d5
...
0e5a7b30ef
|
|
@ -34,8 +34,5 @@ public class EmployeeIntegrationResponse : ResponseBase
|
||||||
|
|
||||||
public class EmployeeIntegrationReqResponse : ResponseBase
|
public class EmployeeIntegrationReqResponse : ResponseBase
|
||||||
{
|
{
|
||||||
public string EmployeeVendorCode { get; set; }
|
|
||||||
public string SalesOrgCode { get; set; }
|
|
||||||
public bool IsUpdated { get; set; }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -9,6 +9,6 @@ public interface IIntegrationService
|
||||||
{
|
{
|
||||||
Task<CustomerIntegrationResponse> UpsertCustomerAsync(CustomerIntegrationRequest request);
|
Task<CustomerIntegrationResponse> UpsertCustomerAsync(CustomerIntegrationRequest request);
|
||||||
Task<CustomerByCompanyCodeResponse> GetCustomerByCompanyCodeAsync(CustomerByCompanyCodeRequest request);
|
Task<CustomerByCompanyCodeResponse> GetCustomerByCompanyCodeAsync(CustomerByCompanyCodeRequest request);
|
||||||
Task<EmployeeIntegrationReqResponse> UpsertEmployeeAsync(EmployeeIntegrationRequest request);
|
Task<bool> UpsertEmployeeAsync(EmployeeIntegrationRequest request);
|
||||||
Task<EmployeeIntegrationResponse> GetEmployeeBySalesOrgAsync(EmployeeBySalesOrgCodeRequest request);
|
Task<EmployeeIntegrationResponse> GetEmployeeBySalesOrgAsync(EmployeeBySalesOrgCodeRequest request);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using Ease.NetCore.DataAccess;
|
using DocumentFormat.OpenXml.Wordprocessing;
|
||||||
|
using Ease.NetCore.DataAccess;
|
||||||
using Ease.NetCore.DataAccess.SQL;
|
using Ease.NetCore.DataAccess.SQL;
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
@ -8,6 +9,8 @@ using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Integrations;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Security.Cryptography;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace OnlineSalesAutoCrop.CoreAPI.Services.Services.Integrations;
|
namespace OnlineSalesAutoCrop.CoreAPI.Services.Services.Integrations;
|
||||||
|
|
@ -62,18 +65,22 @@ public class IntegrationService : IIntegrationService
|
||||||
{
|
{
|
||||||
//Update Here
|
//Update Here
|
||||||
UpdateCustomer(tc, customer.CustomerId, request);
|
UpdateCustomer(tc, customer.CustomerId, request);
|
||||||
|
response.CustomerNumber = request.CustomerNumber;
|
||||||
|
response.CompanyCode = request.CompanyCode;
|
||||||
response.IsUpdated = true;
|
response.IsUpdated = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//Insert Here
|
//Insert Here
|
||||||
|
|
||||||
CreateCustomer(tc, request);
|
CreateCustomer(tc, request);
|
||||||
|
response.CustomerNumber = request.CustomerNumber;
|
||||||
|
response.CompanyCode = request.CompanyCode;
|
||||||
response.IsUpdated = false;
|
response.IsUpdated = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.CustomerNumber = request.CustomerNumber;
|
|
||||||
response.CompanyCode = request.CompanyCode;
|
|
||||||
tc.End();
|
tc.End();
|
||||||
}
|
}
|
||||||
catch (Exception ie)
|
catch (Exception ie)
|
||||||
|
|
@ -183,9 +190,9 @@ public class IntegrationService : IIntegrationService
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<EmployeeIntegrationReqResponse> UpsertEmployeeAsync(EmployeeIntegrationRequest request)
|
public async Task<bool> UpsertEmployeeAsync(EmployeeIntegrationRequest request)
|
||||||
{
|
{
|
||||||
EmployeeIntegrationReqResponse response = new EmployeeIntegrationReqResponse();
|
bool response = false;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
using TransactionContext tc = await TransactionContext.BeginAsync(_settings.DefaultConnection.ConnectionNode);
|
using TransactionContext tc = await TransactionContext.BeginAsync(_settings.DefaultConnection.ConnectionNode);
|
||||||
|
|
@ -224,17 +231,13 @@ public class IntegrationService : IIntegrationService
|
||||||
|
|
||||||
if (employee != null && employee.EmployeeVendorId > 0)
|
if (employee != null && employee.EmployeeVendorId > 0)
|
||||||
{
|
{
|
||||||
_= tc.ExecuteNonQuerySp("dbo.UpdateEmployee", p);
|
_= tc.ExecuteNonQuerySp("dbo.UpdateEmployee", p);
|
||||||
response.IsUpdated = true;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_= tc.ExecuteNonQuerySp("dbo.InsertEmployee", p);
|
_= tc.ExecuteNonQuerySp("dbo.InsertEmployee", p);
|
||||||
response.IsUpdated = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
response.EmployeeVendorCode = request.EmployeeVendorCode;
|
|
||||||
response.SalesOrgCode = request.SalesOrgCode;
|
|
||||||
tc.End();
|
tc.End();
|
||||||
}
|
}
|
||||||
catch (Exception ie)
|
catch (Exception ie)
|
||||||
|
|
@ -260,7 +263,8 @@ public class IntegrationService : IIntegrationService
|
||||||
SqlParameter[] p =
|
SqlParameter[] p =
|
||||||
[
|
[
|
||||||
SqlHelperExtension.CreateInParam(pName: "@EmployeeVendorCode", pType: SqlDbType.NVarChar,pValue: request.EmployeeVendorCode ),
|
SqlHelperExtension.CreateInParam(pName: "@EmployeeVendorCode", pType: SqlDbType.NVarChar,pValue: request.EmployeeVendorCode ),
|
||||||
SqlHelperExtension.CreateInParam(pName: "@SalesOrgCode", pType: SqlDbType.NVarChar,pValue: request.SalesOrgCode )
|
SqlHelperExtension.CreateInParam(pName: "@SalesOrgCode", pType: SqlDbType.NVarChar,pValue: request.SalesOrgCode ),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
using (IDataReader dr = await tc.ExecuteReaderSpAsync("dbo.GetEmployeeBySalesOrgCode", parameterValues: p))
|
using (IDataReader dr = await tc.ExecuteReaderSpAsync("dbo.GetEmployeeBySalesOrgCode", parameterValues: p))
|
||||||
|
|
@ -294,7 +298,8 @@ public class IntegrationService : IIntegrationService
|
||||||
PlantCode = dr.GetString(22),
|
PlantCode = dr.GetString(22),
|
||||||
PlantDescription = dr.GetString(23),
|
PlantDescription = dr.GetString(23),
|
||||||
Status = dr.GetString(24),
|
Status = dr.GetString(24),
|
||||||
StatusDescription = dr.GetString(25)
|
StatusDescription = dr.GetString(25)
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
dr.Close();
|
dr.Close();
|
||||||
|
|
@ -452,4 +457,6 @@ public class IntegrationService : IIntegrationService
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ using Ease.NetCore.DataAccess.SQL;
|
||||||
using Ease.NetCore.Utility;
|
using Ease.NetCore.Utility;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models;
|
using OnlineSalesAutoCrop.CoreAPI.Models;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Global;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Global;
|
||||||
|
using OnlineSalesAutoCrop.CoreAPI.Models.Objects;
|
||||||
|
using OnlineSalesAutoCrop.CoreAPI.Models.Objects.Setups;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Objects.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Objects.Systems;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Requests.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Requests.Systems;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Systems;
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using Microsoft.AspNetCore.SignalR;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
using Microsoft.IdentityModel.Tokens;
|
using Microsoft.IdentityModel.Tokens;
|
||||||
|
|
@ -19,6 +20,7 @@ using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Integrations;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Systems;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Auth;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Auth;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Systems;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Systems;
|
||||||
|
using OnlineSalesAutoCrop.CoreAPI.SignalRHub;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.DirectoryServices;
|
using System.DirectoryServices;
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,10 @@ using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Requests.Integrations;
|
||||||
|
using OnlineSalesAutoCrop.CoreAPI.Models.Responses;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Integrations;
|
using OnlineSalesAutoCrop.CoreAPI.Models.Responses.Integrations;
|
||||||
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
using OnlineSalesAutoCrop.CoreAPI.Services.Contracts.Integrations;
|
||||||
|
using OnlineSalesAutoCrop.CoreAPI.Services.Services.Integrations;
|
||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
@ -85,8 +87,8 @@ namespace OnlineSalesAutoCrop.CoreAPI.Controllers.IntegretionApi
|
||||||
EmployeeIntegrationReqResponse response = new EmployeeIntegrationReqResponse();
|
EmployeeIntegrationReqResponse response = new EmployeeIntegrationReqResponse();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
response = await _integrationService.UpsertEmployeeAsync(request);
|
bool result = await _integrationService.UpsertEmployeeAsync(request);
|
||||||
if (!response.IsUpdated)
|
if (result)
|
||||||
{
|
{
|
||||||
response.ReturnMessage.Add($"Employee Created Successfully for EmployeeVendorName :{request.EmployeeVendorName} & SalesOrgCode:{request.SalesOrgCode}");
|
response.ReturnMessage.Add($"Employee Created Successfully for EmployeeVendorName :{request.EmployeeVendorName} & SalesOrgCode:{request.SalesOrgCode}");
|
||||||
response.ReturnStatus = StatusCodes.Status201Created;
|
response.ReturnStatus = StatusCodes.Status201Created;
|
||||||
|
|
@ -108,5 +110,7 @@ namespace OnlineSalesAutoCrop.CoreAPI.Controllers.IntegretionApi
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, response);
|
return StatusCode(StatusCodes.Status500InternalServerError, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user