diff --git a/Api/OnlineSalesAutoCrop.CoreAPI.Models/Enums.cs b/Api/OnlineSalesAutoCrop.CoreAPI.Models/Enums.cs index 3ff2522..cdeeb25 100644 --- a/Api/OnlineSalesAutoCrop.CoreAPI.Models/Enums.cs +++ b/Api/OnlineSalesAutoCrop.CoreAPI.Models/Enums.cs @@ -772,4 +772,10 @@ namespace OnlineSalesAutoCrop.CoreAPI.Models Sent = 1, Error = 2 } + + public enum DiscountTypeEnum : short + { + ItemType = 1, + InvoiceValueType =2 + } } \ No newline at end of file diff --git a/Api/OnlineSalesAutoCrop.CoreAPI.Models/Responses/MobileApp/MobileMasterDataResponse.cs b/Api/OnlineSalesAutoCrop.CoreAPI.Models/Responses/MobileApp/MobileMasterDataResponse.cs index d073b1f..b3a1eb5 100644 --- a/Api/OnlineSalesAutoCrop.CoreAPI.Models/Responses/MobileApp/MobileMasterDataResponse.cs +++ b/Api/OnlineSalesAutoCrop.CoreAPI.Models/Responses/MobileApp/MobileMasterDataResponse.cs @@ -166,12 +166,12 @@ public class GetAttendanceByEmpResponse public class GetDiscountResponse { - public string SalesOrgcCode { get; set; } + public string? SalesOrgCode { get; set; } public string DiscountCode { get; set; } public string DiscountName { get; set; } - public string DistributorChannelCode { get; set; } - public string DistributorChannelName { get; set; } - public string CalculationType { get; set; } + public string? DistributorChannelCode { get; set; } + public string? DistributorChannelName { get; set; } + public DiscountTypeEnum DiscountType { get; set; } } @@ -179,10 +179,10 @@ public class GetDiscountMaterialResponse { public string DiscountCode { get; set; } public string CustomerCode { get; set; } - public string MaterialCode { get; set; } + public string? MaterialCode { get; set; } public string UnitOfMeasurement { get; set; } public string CalculationType { get; set; } - public decimal ScaleValue { get; set; } + public decimal Threshold { get; set; } public decimal DiscountValue { get; set; } public DateTime StartDate { get; set; } public DateTime EndDate { get; set; } diff --git a/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/MobileApp/MobileMasterDataService.cs b/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/MobileApp/MobileMasterDataService.cs index 6f4d49c..d5fdfbe 100644 --- a/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/MobileApp/MobileMasterDataService.cs +++ b/Api/OnlineSalesAutoCrop.CoreAPI.Services/Services/MobileApp/MobileMasterDataService.cs @@ -2,6 +2,7 @@ using Ease.NetCore.DataAccess.SQL; using Microsoft.Data.SqlClient; using Microsoft.Extensions.Options; +using OnlineSalesAutoCrop.CoreAPI.Models; using OnlineSalesAutoCrop.CoreAPI.Models.Global; using OnlineSalesAutoCrop.CoreAPI.Models.Requests.MobileApp; using OnlineSalesAutoCrop.CoreAPI.Models.Responses; @@ -725,12 +726,12 @@ public class MobileMasterDataService : IMobileMasterDataService { response.Items.Add(new GetDiscountResponse { - SalesOrgcCode = dr.GetString(0), + SalesOrgCode = dr.IsDBNull(0) ? null : dr.GetString(0), DiscountCode = dr.GetString(1), DiscountName = dr.GetString(2), - DistributorChannelCode = dr.GetString(3), - DistributorChannelName = dr.GetString(4), - CalculationType = dr.GetString(5) + DistributorChannelCode = dr.IsDBNull(0) ? null : dr.GetString(3), + DistributorChannelName = dr.IsDBNull(0) ? null : dr.GetString(4), + DiscountType = (DiscountTypeEnum)dr.GetInt32(5) }); } dr.Close(); @@ -781,15 +782,15 @@ public class MobileMasterDataService : IMobileMasterDataService { response.Items.Add(new GetDiscountMaterialResponse { - DiscountCode = dr.GetString(0), - CustomerCode = dr.GetString(1), - MaterialCode = dr.GetString(2), - UnitOfMeasurement = dr.GetString(3), - CalculationType = dr.GetString(4), + DiscountCode = dr.IsDBNull(0) ? null : dr.GetString(0), + CustomerCode = dr.IsDBNull(1) ? null : dr.GetString(1), + MaterialCode = dr.IsDBNull(2) ? null : dr.GetString(2), + UnitOfMeasurement = dr.IsDBNull(3) ? null : dr.GetString(3), + CalculationType = dr.IsDBNull(4) ? null : dr.GetString(4), DiscountValue = dr.GetDecimal(5), StartDate = dr.GetDateTime(6), EndDate = dr.GetDateTime(7), - ScaleValue = dr.GetDecimal(8), + Threshold = dr.GetDecimal(8), }); } dr.Close();