Service update, import changes from web_portal
This commit is contained in:
@@ -1,38 +1,54 @@
|
||||
using System.Linq.Expressions;
|
||||
using console_spo_utils.Interfaces.Repositories;
|
||||
using console_spo_utils.Interfaces.Services;
|
||||
using library_spo_utils.Interfaces.Repositories;
|
||||
using library_spo_utils.Interfaces.Services;
|
||||
|
||||
namespace console_spo_utils.Services;
|
||||
namespace library_spo_utils.Services;
|
||||
|
||||
internal class SharePointStructureBuilderService : ISharePointStructureBuilder
|
||||
{
|
||||
private readonly ISiteOptions siteOptions;
|
||||
private readonly ISiteService siteService;
|
||||
private readonly ISubProjectRepository subProjectRepository;
|
||||
private readonly ISubProjectBuilderService subProjectBuilderService;
|
||||
private readonly IQuotationBuildService quotationBuildService;
|
||||
private readonly INonComplianceBuildService nonComplianceBuildService;
|
||||
private readonly IPurchasingOrderBuildService purchasingOrderBuildService;
|
||||
private readonly IPurchasingPackingSlipBuildService purchasingPackingSlipBuildService;
|
||||
private readonly IPurchasingRequestBuildService purchasingRequestBuildService;
|
||||
private readonly IWebpartService webpartService;
|
||||
|
||||
public SharePointStructureBuilderService(
|
||||
ISiteOptions siteOptions,
|
||||
ISiteService siteService,
|
||||
ISubProjectRepository subProjectRepository,
|
||||
ISubProjectBuilderService subProjectBuilderService,
|
||||
IQuotationBuildService quotationBuildService,
|
||||
INonComplianceBuildService nonComplianceBuildService,
|
||||
IPurchasingOrderBuildService purchasingOrderBuildService,
|
||||
IPurchasingPackingSlipBuildService purchasingPackingSlipBuildService,
|
||||
IPurchasingRequestBuildService purchasingRequestBuildService,
|
||||
IWebpartService webpartService)
|
||||
{
|
||||
this.siteOptions = siteOptions;
|
||||
this.siteService = siteService;
|
||||
this.subProjectRepository = subProjectRepository;
|
||||
this.subProjectBuilderService = subProjectBuilderService;
|
||||
this.quotationBuildService = quotationBuildService;
|
||||
this.nonComplianceBuildService = nonComplianceBuildService;
|
||||
this.purchasingOrderBuildService = purchasingOrderBuildService;
|
||||
this.purchasingPackingSlipBuildService = purchasingPackingSlipBuildService;
|
||||
this.purchasingRequestBuildService = purchasingRequestBuildService;
|
||||
this.webpartService = webpartService;
|
||||
}
|
||||
|
||||
|
||||
public bool BuildProject(string projName)
|
||||
{
|
||||
var siteBuilderResult = siteService.CreateProjectSiteIfNotExists();
|
||||
if (!siteOptions.IsValidDate(projName))
|
||||
{
|
||||
throw new Exception(projName + " is not valid, return year " + siteOptions.GetYear(projName));
|
||||
}
|
||||
|
||||
var siteBuilderResult = siteService.CreateProjectSiteIfNotExists(projName);
|
||||
if (!siteBuilderResult)
|
||||
{
|
||||
throw new Exception($"Impossibile to build site");
|
||||
@@ -51,11 +67,17 @@ internal class SharePointStructureBuilderService : ISharePointStructureBuilder
|
||||
{
|
||||
throw new Exception($"Impossibile to build subSite for {projName} ");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildQuotation(string quotationName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(quotationName))
|
||||
{
|
||||
throw new Exception(quotationName + " is not valid, return year " + siteOptions.GetYear(quotationName));
|
||||
}
|
||||
|
||||
var siteBuildResult = siteService.CreateQuotationSiteIfNotExists(quotationName);
|
||||
if (!siteBuildResult)
|
||||
{
|
||||
@@ -69,6 +91,11 @@ internal class SharePointStructureBuilderService : ISharePointStructureBuilder
|
||||
|
||||
public bool BuildNonCompliance(string nonComplianceName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(nonComplianceName))
|
||||
{
|
||||
throw new Exception(nonComplianceName + " is not valid, return year " + siteOptions.GetYear(nonComplianceName));
|
||||
}
|
||||
|
||||
var siteBuildResult = siteService.CreateNonComplianceSiteIfNotExists(nonComplianceName);
|
||||
if (!siteBuildResult)
|
||||
{
|
||||
@@ -79,4 +106,40 @@ internal class SharePointStructureBuilderService : ISharePointStructureBuilder
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingOrder(string purchasingOrderName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingOrderName))
|
||||
{
|
||||
throw new Exception(purchasingOrderName + " is not valid, return year " + siteOptions.GetYear(purchasingOrderName));
|
||||
}
|
||||
|
||||
purchasingOrderBuildService.CreateIfNotExists(purchasingOrderName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingPackingSlip(string purchasingPackingSlipName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingPackingSlipName))
|
||||
{
|
||||
throw new Exception(purchasingPackingSlipName + " is not valid, return year " + siteOptions.GetYear(purchasingPackingSlipName));
|
||||
}
|
||||
|
||||
purchasingPackingSlipBuildService.CreateIfNotExists(purchasingPackingSlipName);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool BuildPurchasingRequest(string purchasingRequestName)
|
||||
{
|
||||
if (!siteOptions.IsValidDate(purchasingRequestName))
|
||||
{
|
||||
throw new Exception(purchasingRequestName + " is not valid, return year " + siteOptions.GetYear(purchasingRequestName));
|
||||
}
|
||||
|
||||
purchasingRequestBuildService.CreateIfNotExists(purchasingRequestName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user