Service update, import changes from web_portal
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
using console_spo_utils.Interfaces.Services;
|
||||
using library_spo_utils.Enums;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace console_spo_utils.Services;
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class QuotationBuildService : IQuotationBuildService
|
||||
{
|
||||
@@ -11,6 +12,7 @@ internal class QuotationBuildService : IQuotationBuildService
|
||||
private readonly ITenantService tenantService;
|
||||
private readonly IQuotationDocLibraryService quotationDocLibraryService;
|
||||
private readonly IQuotationDocSetService quotationDocSetService;
|
||||
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
|
||||
private readonly ILogger<QuotationBuildService> logger;
|
||||
|
||||
public QuotationBuildService(
|
||||
@@ -20,6 +22,7 @@ internal class QuotationBuildService : IQuotationBuildService
|
||||
ITenantService tenantService,
|
||||
IQuotationDocLibraryService quotationDocLibraryService,
|
||||
IQuotationDocSetService quotationDocSetService,
|
||||
IFieldEntryDataUpdate fieldEntryDataUpdate,
|
||||
ILogger<QuotationBuildService> logger)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
@@ -28,6 +31,7 @@ internal class QuotationBuildService : IQuotationBuildService
|
||||
this.tenantService = tenantService;
|
||||
this.quotationDocLibraryService = quotationDocLibraryService;
|
||||
this.quotationDocSetService = quotationDocSetService;
|
||||
_fieldEntryDataUpdate = fieldEntryDataUpdate;
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
@@ -35,24 +39,27 @@ internal class QuotationBuildService : IQuotationBuildService
|
||||
{
|
||||
var site = siteOptions.GetQuotationSite();
|
||||
var ctx = sharePointAuthenticationManager.GetContext(site);
|
||||
var list = siteOptions.GetQuotationLibrary();
|
||||
var list = siteOptions.GetQuotationLibrary(quotationName);
|
||||
var tenant = siteOptions.GetQuotationTenant();
|
||||
|
||||
if (!spc.SiteExist(ctx))
|
||||
{
|
||||
tenantService.CreateForQuotation();
|
||||
}
|
||||
else if (!spc.ListExist(ctx, list))
|
||||
|
||||
if (!spc.ListExist(ctx, list))
|
||||
{
|
||||
quotationDocLibraryService.Create(list, ctx);
|
||||
}
|
||||
else if (!spc.FolderExistsInsideList(ctx, list, quotationName))
|
||||
|
||||
if (!spc.FolderExistsInsideList(ctx, list, quotationName))
|
||||
{
|
||||
quotationDocSetService.Create(quotationName, list, tenant, ctx);
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.LogInformation($"Quotation with {quotationName} already exist");
|
||||
_fieldEntryDataUpdate.FieldUpdate(ctx, list, quotationName, FieldUpdateType.Quotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user