Service update, import changes from web_portal

This commit is contained in:
Claudio Boggian
2023-06-21 10:38:57 +02:00
parent 39fa4dedf3
commit bb99cef33c
101 changed files with 4266 additions and 3044 deletions
+66 -23
View File
@@ -1,6 +1,4 @@
using console_spo_utils.Services;
namespace console_spo_utils.Constants;
namespace library_spo_utils.Constants;
internal static class Fields
{
@@ -11,8 +9,10 @@ internal static class Fields
return new[]
{
"ID Progetto",
"Cliente",
"Causale"
"PAL_Description",
"PAL_Customer",
"PAL_DlvReason",
"PAL_Status"
};
}
}
@@ -23,10 +23,11 @@ internal static class Fields
{
return new string[]
{
"Item",
"Codice Articolo",
"Descrizione Articolo",
"Matricola Macchina"
"PAL_Item",
"PAL_ItemCode",
"PAL_ItemDescription",
"PAL_SerialNumber",
"PAL_Status"
};
}
}
@@ -39,14 +40,15 @@ internal static class Fields
{
"Type",
"Name",
"Description",
"Item",
"Codice Articolo",
"Descrizione Articolo",
"Matricola Macchina",
"_ExtendedDescription",
"PAL_Item",
"PAL_ItemCode",
"PAL_ItemDescription",
"PAL_SerialNumber",
"Modified",
"Editor",
"Version"
"Version",
"PAL_Status"
};
}
}
@@ -59,10 +61,46 @@ internal static class Fields
{
"Type",
"Name",
"ID Offerta",
"Fornitore",
"Causale",
"Autore"
"PAL_Quotation_Reason",
"PAL_ID_Quotation",
"PAL_Quotation_Name",
"PAL_Description",
"PAL_Authors",
"PAL_Status"
};
}
}
internal static string[] NonComplianceView
{
get
{
return new string[]
{
"Type",
"Name",
"PAL_NC_Source",
"PAL_NC_Reference",
"PAL_NC_Nominative",
"PAL_NC_DateOfDetection",
"PAL_NC_Project",
"PAL_NC_ItemCode",
"PAL_NC_PortalUrl",
"PAL_Status"
};
}
}
internal static string[] PurchasingView
{
get
{
return new string[]
{
"Tipo",
"Nome",
"PAL_PO_Supplier",
"PAL_Status"
};
}
}
@@ -101,12 +139,14 @@ internal static class Fields
return new Dictionary<string, string[]>()
{
{ "PAL_ID_Project", new string[] { "URL", "ID Progetto", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_DlvReason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_DlvReason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_Description", new string[] { "Note", "Descrizione", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Customer", new string[] { "Text", "Cliente", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Item", new string[] { "Text", "Item", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_ItemCode", new string[] { "Text", "Codice Articolo", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_ItemDescription", new string[] { "Text", "Descrizione Articolo", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_SerialNumber", new string[] { "Text", "Matricola Macchina", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
{ "PAL_SerialNumber", new string[] { "Text", "Matricola Macchina", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
};
}
}
@@ -117,10 +157,12 @@ internal static class Fields
{
return new Dictionary<string, string[]>()
{
{ "PAL_Quotation_Reason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_Quotation_Reason", new string[] { "Choice", "Causale", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", "<CHOICES><CHOICE>01 VENDITA MACCHINE / IMPIANTI</CHOICE><CHOICE>02 VENDITA RICAMBI</CHOICE><CHOICE>04 VENDITA SERVIZI FUORI COMMESSA</CHOICE><CHOICE>08 VENDITA RIPARAZIONI</CHOICE><CHOICE>09 ENGINEERING</CHOICE><CHOICE>11 VENDITA E LAVORAZ.CONTO TERZI</CHOICE><CHOICE>55 PREVENDITE</CHOICE><CHOICE>NC NON CONFORMITÁ</CHOICE></CHOICES>" } },
{ "PAL_ID_Quotation", new string[] { "Text", "ID Offerta", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Quotation_Name", new string[] { "Text", "Fornitore", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Authors", new string[] { "Text", "Autore", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
{ "PAL_Description", new string[] { "Note", "Descrizione", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Authors", new string[] { "Text", "Autore", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
};
}
}
@@ -138,6 +180,7 @@ internal static class Fields
{ "PAL_NC_Project", new string[] { "Text", "Commessa", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_NC_ItemCode", new string[] { "Text", "Parte", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_NC_PortalUrl", new string[] {"URL", "Portal", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } },
{ "PAL_Status", new string[] { "Text", "Stato", "PAL Field", "FALSE", "FALSE", "TRUE", "TRUE", "TRUE", "TRUE", string.Empty } }
};
}
}
+41 -21
View File
@@ -1,7 +1,8 @@
using System.Collections;
using Microsoft.SharePoint.Client;
using Microsoft.VisualBasic;
namespace console_spo_utils.Constants;
namespace library_spo_utils.Constants;
internal static class Folders
{
@@ -24,10 +25,10 @@ internal static class Folders
{
var itemQuickMenu = new Dictionary<string, string>
{
{ $"Commerciale {projName}", $"{subSiteUrl}/Commerciale%20{projName}" },
{ $"Documenti {projName}", $"{subSiteUrl}/Documenti%20{projName}" },
{ $"Media {projName}", $"{subSiteUrl}/Media%20{projName}" },
{ $"SottoCommesse {projName}", $"{subSiteUrl}/SottoCommesse%20{projName}" }
{ $"Commerciale {projName}", $"{subSiteUrl}/Commerciale%20{projName.Replace("-","")}" },
{ $"Documenti {projName}", $"{subSiteUrl}/Documenti%20{projName.Replace("-","")}" },
{ $"Media {projName}", $"{subSiteUrl}/Media%20{projName.Replace("-","")}" },
{ $"SottoCommesse {projName}", $"{subSiteUrl}/SottoCommesse%20{projName.Replace("-", "")}" }
};
return itemQuickMenu;
}
@@ -47,33 +48,52 @@ internal static class Folders
{
get
{
return new string[]
return new string[]
{
"09_Documenti_Tecnici",
"12_Disegni_Costruttivi",
"13_Manuali",
"09_Documenti_Tecnici",
"12_Disegni_Costruttivi",
"13_Manuali",
"15_Documentazione_Elettrica",
"16_Liste_Ricambi"
};
}
}
internal static IEnumerable OfferDocSet
internal static IEnumerable OfferDocSet(string rev) =>
new string[]
{
rev,
$"{rev}/01_Costificazione",
$"{rev}/02_Offerta",
$"{rev}/03_Meeting",
$"{rev}/04_Corrispondenza",
$"{rev}/08_Specifiche_Tecniche",
$"{rev}/10_Fornitori",
$"{rev}/11_Documenti_Tecnici",
$"{rev}/14_Foto"
};
internal static IEnumerable PurchasingOneNoteDir(string year) =>
new string[]
{
$"{year}",
$"{year}/Ordini di Acquisto",
$"{year}/DDT di Acquisto",
$"{year}/Richieste di Acquisto"
};
internal static IEnumerable PurchasingOrder
{
get
{
string rev = "Rev. 1"; //TODO: Definire revisione
return new string[]
return new string[]
{
rev,
$"{rev}/01_Costificazione",
$"{rev}/02_Offerta",
$"{rev}/03_Meeting",
$"{rev}/04_Corrispondenza",
$"{rev}/08_Specifiche_Tecniche",
$"{rev}/10_Fornitori",
$"{rev}/11_Documenti_Tecnici",
$"{rev}/14_Foto"
"Conferma ordine",
"Offerte",
"Richiesta di Offerta"
};
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
namespace console_spo_utils.Enums
namespace library_spo_utils.Enums
{
internal enum PalFieldType
{
@@ -0,0 +1,12 @@
namespace library_spo_utils.Enums;
public enum FieldUpdateType
{
Project,
SubProject,
Quotation,
NonCompliance,
PurchasingOrder,
PurchasingPackingSlip,
PurchasingRequest
}
+8
View File
@@ -0,0 +1,8 @@
namespace library_spo_utils.Enums;
public enum PurchType
{
Order,
PackingSlip,
Request
}
@@ -1,42 +1,41 @@
using console_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Repositories;
using Microsoft.SharePoint.Client;
using static System.Net.WebRequestMethods;
namespace console_spo_utils.Fakes.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakeNonComplianceSettingsRepository : INonComplianceRepository
{
public string DefaultNonComplianceSource()
public string DefaultNonComplianceSource(string code)
{
return "Interno";
}
public string DefaultNonComplianceReference()
public string DefaultNonComplianceReference(string code)
{
return "Italsort";
}
public string DefaultNonComplianceNominative()
public string DefaultNonComplianceNominative(string code)
{
return "Mario Issor";
}
public string DefaultNonComplianceDateOfDetection()
public string DefaultNonComplianceDateOfDetection(string code)
{
return "28-09-2022";
}
public string DefaultNonComplianceProject()
public string DefaultNonComplianceProject(string code)
{
return "CT0001-001";
}
public string DefaultNonComplianceItemCode()
public string DefaultNonComplianceItemCode(string code)
{
return "M24x3";
}
public FieldUrlValue DefaultNonCompliancePortalUrl()
public FieldUrlValue DefaultNonCompliancePortalUrl(string code)
{
return new FieldUrlValue
{
@@ -44,4 +43,9 @@ public class FakeNonComplianceSettingsRepository : INonComplianceRepository
Url = "https://portal.pal.local/"
};
}
public string DefaultNonComplianceState(string code)
{
return "Stato";
}
}
@@ -0,0 +1,26 @@
using library_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakeProjectRepository:IProjectRepository
{
public string DefaultDlvReason(string projName)
{
return "02 VENDITA RICAMBI";
}
public string DefaultCostumer(string projName)
{
return "PAL";
}
public string DefaultState(string projName)
{
return "Stato";
}
public string DefaultDescription(string projName)
{
return "Some Description";
}
}
@@ -1,16 +0,0 @@
using console_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Fakes.Repositories;
public class FakeProjectSettingsRepository:IProjectSettingsRepository
{
public string DefaultDlvReason(string projName)
{
return "02 VENDITA RICAMBI";
}
public string DefaultCostumer(string projName)
{
return "PAL";
}
}
@@ -0,0 +1,16 @@
using library_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakePurchasingOrderSettingsRepository : IPurchasingOrderRepository
{
public string DefaultPurchasingOrderSupplier(string purchasingOrderName)
{
return "Fornitore di prova";
}
public string DefaultPurchasingOrderState(string purchasingOrderName)
{
return "Stato";
}
}
@@ -0,0 +1,16 @@
using library_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakePurchasingPackingSlipSettingsRepository : IPurchasingPackingSlipRepository
{
public string DefaultPurchasingPackingSlipSupplier(string purchasingPackingSlipName)
{
return "Fornitore di prova";
}
public string DefaultPurchasingPackingSlipState(string purchasingPackingSlipName)
{
return "Stato";
}
}
@@ -0,0 +1,16 @@
using library_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakePurchasingRequestSettingsRepository : IPurchasingRequestRepository
{
public string DefaultPurchasingRequestSupplier(string purchasingRequestName)
{
return "Fornitore di prova";
}
public string DefaultPurchasingRequestState(string purchasingRequestName)
{
return "Stato";
}
}
@@ -1,5 +1,6 @@
using console_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Fakes.Repositories;
using library_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakeQuotationSettingRepository:IQuotationRepository
{
@@ -22,4 +23,14 @@ public class FakeQuotationSettingRepository:IQuotationRepository
{
return "User";
}
public string DefaultQuotationState(string quotationName)
{
return "Stato";
}
public string DefaultDescription(string quotationName)
{
return "Some Description";
}
}
@@ -1,6 +1,6 @@
using console_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Repositories;
namespace console_spo_utils.Fakes.Repositories;
namespace library_spo_utils.Fakes.Repositories;
public class FakeSubProjectRepository:ISubProjectRepository
{
@@ -15,28 +15,33 @@ public class FakeSubProjectRepository:ISubProjectRepository
};
}
public string DefaultDescription(string projName)
public string DefaultDescription(string subProjId)
{
return "AutomationTest c.s.";
}
public string DefaultItem(string projName)
public string DefaultItem(string subProjId)
{
return "Coclea";
}
public string DefaultItemCode(string projName)
public string DefaultItemCode(string subProjId)
{
return "C84M70";
}
public string DefaultItemDescription(string projName)
public string DefaultItemDescription(string subProjId)
{
return "7m con le piastrelle";
}
public string DefaultSerialNumber(string projName)
public string DefaultSerialNumber(string subProjId)
{
return "S/N 000000988948e";
}
public string DefaultState(string subProjId)
{
return "Stato";
}
}
@@ -1,15 +1,15 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Interfaces.Repositories;
public interface INonComplianceRepository
{
public string DefaultNonComplianceSource();
public string DefaultNonComplianceReference();
public string DefaultNonComplianceNominative();
public string DefaultNonComplianceDateOfDetection();
public string DefaultNonComplianceProject();
public string DefaultNonComplianceItemCode();
public FieldUrlValue DefaultNonCompliancePortalUrl();
public string DefaultNonComplianceSource(string code);
public string DefaultNonComplianceReference(string code);
public string DefaultNonComplianceNominative(string code);
public string DefaultNonComplianceDateOfDetection(string code);
public string DefaultNonComplianceProject(string code);
public string DefaultNonComplianceItemCode(string code);
public FieldUrlValue DefaultNonCompliancePortalUrl(string code);
public string DefaultNonComplianceState(string code);
}
@@ -0,0 +1,9 @@
namespace library_spo_utils.Interfaces.Repositories;
public interface IProjectRepository
{
public string DefaultDescription(string projName);
public string DefaultDlvReason(string projName);
public string DefaultCostumer(string projName);
public string DefaultState(string projName);
}
@@ -1,7 +0,0 @@
namespace console_spo_utils.Interfaces.Repositories;
public interface IProjectSettingsRepository
{
public string DefaultDlvReason(string projName);
public string DefaultCostumer(string projName);
}
@@ -0,0 +1,7 @@
namespace library_spo_utils.Interfaces.Repositories;
public interface IPurchasingOrderRepository
{
public string DefaultPurchasingOrderSupplier(string purchasingOrderName);
public string DefaultPurchasingOrderState(string purchasingOrderName);
}
@@ -0,0 +1,7 @@
namespace library_spo_utils.Interfaces.Repositories;
public interface IPurchasingPackingSlipRepository
{
public string DefaultPurchasingPackingSlipSupplier(string purchasingPackingSlipName);
public string DefaultPurchasingPackingSlipState(string purchasingPackingSlipName);
}
@@ -0,0 +1,8 @@
namespace library_spo_utils.Interfaces.Repositories;
public interface IPurchasingRequestRepository
{
public string DefaultPurchasingRequestSupplier(string purchasingRequestName);
public string DefaultPurchasingRequestState(string purchasingRequestName);
}
@@ -1,11 +1,13 @@
namespace console_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Interfaces.Repositories;
public interface IQuotationRepository
{
public string DefaultIdQuotation(string quotationName);
public string DefaultQuotationName(string quotationName);
public string DefaultDescription(string quotationName);
public string DefaultQuotationReason(string quotationName);
public string DefaultAuthors(string quotationName);
public string DefaultQuotationState(string quotationName);
}
@@ -1,11 +1,12 @@
namespace console_spo_utils.Interfaces.Repositories;
namespace library_spo_utils.Interfaces.Repositories;
public interface ISubProjectRepository
{
public List<string> GetFromProject(string projName);
public string DefaultDescription(string projName);
public string DefaultItem(string projName);
public string DefaultItemCode(string projName);
public string DefaultItemDescription(string projName);
public string DefaultSerialNumber(string projName);
public string DefaultDescription(string subProjId);
public string DefaultItem(string subProjId);
public string DefaultItemCode(string subProjId);
public string DefaultItemDescription(string subProjId);
public string DefaultSerialNumber(string subProjId);
public string DefaultState(string subProjId);
}
@@ -0,0 +1,9 @@
using library_spo_utils.Enums;
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
internal interface IFieldEntryDataUpdate
{
public void FieldUpdate(ClientContext ctx, string listName, string element, FieldUpdateType type);
}
@@ -1,4 +1,4 @@
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface INonComplianceBuildService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface INonComplianceDocLibraryService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface INonComplianceDocSetService
{
@@ -1,11 +1,13 @@
using Microsoft.SharePoint.Client;
using library_spo_utils.Enums;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IOneNoteService
{
public bool CreateFolderInsideProject(string projName, ClientContext ctx);
public bool CreateFolderInsideQuotation(string quotationName, ClientContext ctx);
public bool CreateFolderInsideNonCompliance(string quotationName, ClientContext ctx);
public bool CreateFolderInsidePurchasing(string purchasingName, ClientContext ctx, PurchType type);
public void EnableFeature(ClientContext ctx);
}
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IProjectDocLibraryService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IProjectQuickMenuService
{
@@ -1,8 +1,6 @@
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IProjectService
{
public void BuildWebParts();
public void BuildWebParts(string projName);
}
@@ -1,10 +1,9 @@
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IProjectYearService
{
public void CreateList(string listTitle, ClientContext ctx);
public void CreateList(string projName, string listTitle, ClientContext ctx);
}
@@ -0,0 +1,6 @@
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingOrderBuildService
{
public void CreateIfNotExists(string purchasingOrder);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingOrderDocLibraryService
{
public void Create(string libName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingOrderDocSetService
{
public void Create(string purchasingOrderName, string docLibraryName, string tenantName, ClientContext ctx);
}
@@ -0,0 +1,6 @@
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingPackingSlipBuildService
{
public void CreateIfNotExists(string purchasingPackingSlipName);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingPackingSlipDocLibraryService
{
public void Create(string libName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingPackingSlipDocSetService
{
public void Create(string purchasingPackingSlipName, string docLibraryName, string tenantName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingRequestBuildService
{
public void CreateIfNotExists(string purchasingRequestName);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingRequestDocLibraryService
{
public void Create(string libName, ClientContext ctx);
}
@@ -0,0 +1,8 @@
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Interfaces.Services;
public interface IPurchasingRequestDocSetService
{
public void Create(string purchasingRequestName, string docLibraryName, string tenantName, ClientContext ctx);
}
@@ -1,4 +1,4 @@
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IQuotationBuildService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IQuotationDocLibraryService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IQuotationDocSetService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IRightsService
{
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISharePointAuthenticationManager
{
@@ -1,12 +1,13 @@
using console_spo_utils.Enums;
using library_spo_utils.Enums;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISharePointCustomOperation
{
bool SiteExist(ClientContext ctx);
bool ListExist(ClientContext ctx, string listTitle);
bool FolderExist(ClientContext ctx, string path);
bool FolderExistsInsideList(ClientContext context, string listTitle, string folderName);
bool SiteFeaturesExist(ClientContext ctx, string featureName);
void PalCustomField(ClientContext ctx, PalFieldType et);
@@ -1,8 +1,11 @@
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
public interface ISharePointStructureBuilder
{
public bool BuildProject(string projName);
public bool BuildQuotation(string quotationName);
public bool BuildNonCompliance(string nonComplianceName);
public bool BuildPurchasingOrder(string purchasingOrderName);
public bool BuildPurchasingPackingSlip(string purchasingPackingSlipName);
public bool BuildPurchasingRequest(string purchasingRequestName);
}
@@ -1,23 +1,36 @@
using System.Security;
using PnP.Core.Model.SharePoint;
using System.Security;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISiteOptions
{
public string TokenEndpoint { get; }
public string DefaultAadAppId { get; }
public Uri GetProjectYearSite();
public string GetProjYearTenant();
public Uri GetProjectYearSite(string code);
public string GetYear(string code);
public bool IsValidDate(string code);
public string GetProjYearTenant(string code);
public string GetUser();
public SecureString GetPassword();
public string GetProjListTitle();
public string GetProjListTitle(string code);
public Uri GetSubProjSite(string projName);
string GetQuotationTenant();
Uri GetQuotationSite();
string GetSubProjList(string projName);
public string GetQuotationLibrary();
public string GetQuotationLibrary(string code);
public Uri GetProjectSite();
public string GetNonComplianceTenant();
public string GetNonComplianceLibrary();
public string GetNonComplianceLibrary(string code);
public Uri GetNonComplianceSite();
public Uri GetPurchasingSite();
public string GetPurchasingOrderTenat();
public string GetPurchasingOrderLibrary(string code);
public Uri GetPurchasingOrderSite();
public string GetPurchasingPackingSlipTenat();
public string GetPurchasingPackingSlipLibrary(string code);
public Uri GetPurchasingPackingSlipSite();
public string GetPurchasingRequestTenat();
public string GetPurchasingRequestLibrary(string code);
public Uri GetPurchasingRequestSite();
}
@@ -1,8 +1,8 @@
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISiteService
{
public bool CreateProjectSiteIfNotExists();
public bool CreateProjectSiteIfNotExists(string projName);
public bool CreateSubSiteIfNotExists(string projName);
public bool CreateQuotationSiteIfNotExists(string quotationName);
public bool CreateNonComplianceSiteIfNotExists(string nonComplianceName);
@@ -1,8 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISubProjectBuilderService
{
bool SubProjectDocSet(string projName, List<string> subProjTitle);
bool SubProjectDocSet(string projName, List<string> listOfSubProjIds);
}
@@ -1,6 +1,6 @@
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ISubSiteService
{
@@ -1,11 +1,8 @@
using console_spo_utils.Enums;
using System.Security;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface ITenantService
{
public void CreateForProject();
public void CreateForProject(string projName);
public void CreateForQuotation();
public void CreateForNonCompliance();
}
@@ -1,7 +1,7 @@
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
namespace console_spo_utils.Interfaces.Services;
namespace library_spo_utils.Interfaces.Services;
internal interface IWebpartService
{
+1 -1
View File
@@ -1,4 +1,4 @@
namespace console_spo_utils.Model
namespace library_spo_utils.Model
{
internal class ParentProj
{
+1 -1
View File
@@ -1,4 +1,4 @@
namespace console_spo_utils.Model
namespace library_spo_utils.Model
{
internal class SubProj
{
+1 -1
View File
@@ -1,4 +1,4 @@
namespace console_spo_utils.Model
namespace library_spo_utils.Model
{
internal class TokenWaitInfo
{
+20 -7
View File
@@ -1,12 +1,12 @@
using console_spo_utils.Fakes.Repositories;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using console_spo_utils.Services;
using console_spo_utils.Workers;
using library_spo_utils.Fakes.Repositories;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using library_spo_utils.Services;
using library_spo_utils.Workers;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace console_spo_utils
namespace library_spo_utils
{
public static class Program
{
@@ -16,10 +16,13 @@ namespace console_spo_utils
.ConfigureServices(services =>
{
services.AddSharePointExtensions();
services.AddTransient<IProjectSettingsRepository, FakeProjectSettingsRepository>();
services.AddTransient<IProjectRepository, FakeProjectRepository>();
services.AddTransient<ISubProjectRepository, FakeSubProjectRepository>();
services.AddTransient<IQuotationRepository, FakeQuotationSettingRepository>();
services.AddTransient<INonComplianceRepository, FakeNonComplianceSettingsRepository>();
services.AddTransient<IPurchasingOrderRepository, FakePurchasingOrderSettingsRepository>();
services.AddTransient<IPurchasingPackingSlipRepository, FakePurchasingPackingSlipSettingsRepository>();
services.AddTransient<IPurchasingRequestRepository, FakePurchasingRequestSettingsRepository>();
services.AddHostedService<MainWorker>();
})
@@ -49,6 +52,16 @@ namespace console_spo_utils
services.AddTransient<INonComplianceBuildService, NonComplianceBuildService>();
services.AddTransient<INonComplianceDocLibraryService, NonComplianceDocLibraryService>();
services.AddTransient<INonComplianceDocSetService, NonComplianceDocSetService>();
services.AddTransient<IPurchasingOrderBuildService, PurchasingOrderBuildService>();
services.AddTransient<IPurchasingOrderDocLibraryService, PurchasingOrderDocLibraryService>();
services.AddTransient<IPurchasingOrderDocSetService, PurchasingOrderDocSetService>();
services.AddTransient<IPurchasingPackingSlipBuildService, PurchasingPackingSlipBuildService>();
services.AddTransient<IPurchasingPackingSlipDocLibraryService, PurchasingPackingSlipDocLibraryService>();
services.AddTransient<IPurchasingPackingSlipDocSetService, PurchasingPackingSlipDocSetService>();
services.AddTransient<IPurchasingRequestBuildService, PurchasingRequestBuildService>();
services.AddTransient<IPurchasingRequestDocLibraryService, PurchasingRequestDocLibraryService>();
services.AddTransient<IPurchasingRequestDocSetService, PurchasingRequestDocSetService>();
services.AddTransient<IFieldEntryDataUpdate, FieldEntryDataUpdate>();
services.AddTransient<IWebpartService, WebpartService>();
services.AddTransient<IProjectService, ProjectService>();
@@ -1,13 +1,13 @@
using console_spo_utils.Model;
using Microsoft.SharePoint.Client;
using System.Collections.Concurrent;
using System.Collections.Concurrent;
using System.Text;
using System.Text.Json;
using System.Web;
using library_spo_utils.Interfaces.Services;
using library_spo_utils.Model;
using Microsoft.Extensions.Logging;
using console_spo_utils.Interfaces.Services;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services
namespace library_spo_utils.Services
{
internal sealed class SharePointAuthenticationManager : IDisposable, ISharePointAuthenticationManager
{
@@ -0,0 +1,254 @@
using Microsoft.SharePoint.Client;
using System;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using AngleSharp.Dom;
using library_spo_utils.Interfaces.Services;
using PnP.Framework.Extensions;
namespace library_spo_utils.Services;
internal class FieldEntryDataUpdate : IFieldEntryDataUpdate
{
private readonly ISiteOptions _siteOptions;
private readonly IProjectRepository _projectRepository;
private readonly ISubProjectRepository _subProjectRepository;
private readonly IQuotationRepository _quotationRepository;
private readonly INonComplianceRepository _nonComplianceRepository;
private readonly IPurchasingOrderRepository _purchasingOrderRepository;
private readonly IPurchasingPackingSlipRepository _purchasingPackingSlipRepository;
private readonly IPurchasingRequestRepository _purchasingRequestRepository;
public FieldEntryDataUpdate(
ISiteOptions siteOptions,
IProjectRepository projectRepository,
ISubProjectRepository subProjectRepository,
IQuotationRepository quotationRepository,
INonComplianceRepository nonComplianceRepository,
IPurchasingOrderRepository purchasingOrderRepository,
IPurchasingPackingSlipRepository purchasingPackingSlipRepository,
IPurchasingRequestRepository purchasingRequestRepository
)
{
_siteOptions = siteOptions;
_projectRepository = projectRepository;
_subProjectRepository = subProjectRepository;
_quotationRepository = quotationRepository;
_nonComplianceRepository = nonComplianceRepository;
_purchasingOrderRepository = purchasingOrderRepository;
_purchasingPackingSlipRepository = purchasingPackingSlipRepository;
_purchasingRequestRepository = purchasingRequestRepository;
}
public void FieldUpdate(ClientContext ctx, string listName, string element, FieldUpdateType type)
{
List oList = ctx.Web.Lists.GetByTitle(listName);
switch (type)
{
case FieldUpdateType.Project:
Project(ctx, oList, element);
break;
case FieldUpdateType.SubProject:
SubProject(ctx, oList, element);
break;
case FieldUpdateType.Quotation:
Quotation(ctx, oList, element);
break;
case FieldUpdateType.NonCompliance:
NonCompliance(ctx, oList, element);
break;
case FieldUpdateType.PurchasingOrder:
PurchasingOrder(ctx, oList, element);
break;
case FieldUpdateType.PurchasingPackingSlip:
PurchasingPackingSlip(ctx, oList, element);
break;
case FieldUpdateType.PurchasingRequest:
PurchasingRequest(ctx, oList, element);
break;
}
}
private void Project(ClientContext ctx, List oList, string element)
{
var url = $"/sites/{_siteOptions.GetProjYearTenant(element).Replace(" ", string.Empty)}/{element}";
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='PAL_ID_Project'/><Value Type='URL'>{url}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_Description"] = _projectRepository.DefaultDescription(element);
oListItem["PAL_Customer"] = _projectRepository.DefaultCostumer(element);
oListItem["PAL_DlvReason"] = _projectRepository.DefaultDlvReason(element);
oListItem["PAL_Status"] = _projectRepository.DefaultState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void SubProject(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["_ExtendedDescription"] = _subProjectRepository.DefaultDescription(element);
oListItem["PAL_Item"] = _subProjectRepository.DefaultItem(element);
oListItem["PAL_ItemCode"] = _subProjectRepository.DefaultItemCode(element);
oListItem["PAL_ItemDescription"] = _subProjectRepository.DefaultItemDescription(element);
oListItem["PAL_SerialNumber"] = _subProjectRepository.DefaultSerialNumber(element);
oListItem["PAL_Status"] = _subProjectRepository.DefaultState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void Quotation(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_ID_Quotation"] = _quotationRepository.DefaultIdQuotation(element);
oListItem["PAL_Quotation_Name"] = _quotationRepository.DefaultQuotationName(element);
oListItem["PAL_Description"] = _quotationRepository.DefaultDescription(element);
oListItem["PAL_Quotation_Reason"] = _quotationRepository.DefaultQuotationReason(element);
oListItem["PAL_Authors"] = _quotationRepository.DefaultAuthors(element);
oListItem["PAL_Status"] = _quotationRepository.DefaultQuotationState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void NonCompliance(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_NC_Source"] = _nonComplianceRepository.DefaultNonComplianceSource(element);
oListItem["PAL_NC_Reference"] = _nonComplianceRepository.DefaultNonComplianceReference(element);
oListItem["PAL_NC_Nominative"] = _nonComplianceRepository.DefaultNonComplianceNominative(element);
oListItem["PAL_NC_DateOfDetection"] = _nonComplianceRepository.DefaultNonComplianceDateOfDetection(element);
oListItem["PAL_NC_Project"] = _nonComplianceRepository.DefaultNonComplianceProject(element);
oListItem["PAL_NC_ItemCode"] = _nonComplianceRepository.DefaultNonComplianceItemCode(element);
oListItem["PAL_NC_PortalUrl"] = _nonComplianceRepository.DefaultNonCompliancePortalUrl(element);
oListItem["PAL_Status"] = _nonComplianceRepository.DefaultNonComplianceState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void PurchasingOrder(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_PO_Supplier"] = _purchasingOrderRepository.DefaultPurchasingOrderSupplier(element);
oListItem["PAL_Status"] = _purchasingOrderRepository.DefaultPurchasingOrderState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void PurchasingPackingSlip(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_PO_Supplier"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipSupplier(element);
oListItem["PAL_Status"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
private void PurchasingRequest(ClientContext ctx, List oList, string element)
{
CamlQuery cQuery = new CamlQuery()
{
ViewXml = $"<View><Query><Where><Eq><FieldRef Name='Title'/><Value Type='Text'>{element}</Value></Eq></Where></Query></View>"
};
var collection = oList.GetItems(cQuery);
ctx.Load(collection);
ctx.ExecuteQuery();
foreach (var oListItem in collection)
{
oListItem["PAL_PO_Supplier"] = _purchasingRequestRepository.DefaultPurchasingRequestSupplier(element);
oListItem["PAL_Status"] = _purchasingRequestRepository.DefaultPurchasingRequestState(element);
oListItem.Update();
}
ctx.ExecuteQuery();
}
}
@@ -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 NonComplianceBuildService : INonComplianceBuildService
{
@@ -11,6 +12,7 @@ internal class NonComplianceBuildService : INonComplianceBuildService
private readonly ITenantService tenantService;
private readonly INonComplianceDocLibraryService nonComplianceDocLibraryService;
private readonly INonComplianceDocSetService nonComplianceDocSetService;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<NonComplianceBuildService> logger;
public NonComplianceBuildService(
@@ -20,6 +22,7 @@ internal class NonComplianceBuildService : INonComplianceBuildService
ITenantService tenantService,
INonComplianceDocLibraryService nonComplianceDocLibraryService,
INonComplianceDocSetService nonComplianceDocSetService,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<NonComplianceBuildService> logger)
{
this.siteOptions = siteOptions;
@@ -28,6 +31,7 @@ internal class NonComplianceBuildService : INonComplianceBuildService
this.tenantService = tenantService;
this.nonComplianceDocLibraryService = nonComplianceDocLibraryService;
this.nonComplianceDocSetService = nonComplianceDocSetService;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
this.logger = logger;
}
@@ -35,24 +39,27 @@ internal class NonComplianceBuildService : INonComplianceBuildService
{
var site = siteOptions.GetNonComplianceSite();
var ctx = sharePointAuthenticationManager.GetContext(site);
var list = siteOptions.GetNonComplianceLibrary();
var list = siteOptions.GetNonComplianceLibrary(nonComplianceName);
var tenant = siteOptions.GetNonComplianceTenant();
if (!spc.SiteExist(ctx))
{
tenantService.CreateForNonCompliance();
}
else if (!spc.ListExist(ctx, list))
if (!spc.ListExist(ctx, list))
{
nonComplianceDocLibraryService.Create(list, ctx);
}
else if (!spc.FolderExistsInsideList(ctx, list, nonComplianceName))
if (!spc.FolderExistsInsideList(ctx, list, nonComplianceName))
{
nonComplianceDocSetService.Create(nonComplianceName, list, tenant, ctx);
}
else
{
logger.LogInformation($"Quotation with {nonComplianceName} already exist");
_fieldEntryDataUpdate.FieldUpdate(ctx, list, nonComplianceName, FieldUpdateType.NonCompliance);
}
}
}
@@ -1,8 +1,9 @@
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class NonComplianceDocLibraryService : INonComplianceDocLibraryService
{
@@ -45,7 +46,7 @@ internal class NonComplianceDocLibraryService : INonComplianceDocLibraryService
ctx.ExecuteQuery();
string[] fieldName = { "Sorgente", "Rifermento", "Nominativo", "Data Rilevazione", "Commessa", "Parte", "Portal" };
string[] fieldName = { "Sorgente", "Rifermento", "Nominativo", "Data Rilevazione", "Commessa", "Parte", "Portal", "Stato" };
foreach (var fn in fieldName)
{
@@ -71,7 +72,7 @@ internal class NonComplianceDocLibraryService : INonComplianceDocLibraryService
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = new string[] { "Type", "Name", "Sorgente", "Rifermento", "Nominativo", "Data Rilevazione", "Commessa", "Parte", "Portal" };
viewCreation.ViewFields = Fields.NonComplianceView;
var view = views.Add(viewCreation);
@@ -1,26 +1,29 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class NonComplianceDocSetService : INonComplianceDocSetService
{
private readonly ISharePointCustomOperation cpt;
private readonly IOneNoteService oneNoteService;
private readonly INonComplianceRepository nonComplianceRepository;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
public NonComplianceDocSetService(
ISharePointCustomOperation cpt,
IOneNoteService oneNoteService,
INonComplianceRepository nonComplianceRepository)
INonComplianceRepository nonComplianceRepository,
IFieldEntryDataUpdate fieldEntryDataUpdate)
{
this.cpt = cpt;
this.oneNoteService = oneNoteService;
this.nonComplianceRepository = nonComplianceRepository;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
}
public void Create(string nonComplianceName, string docLibraryName, string tenantName, ClientContext ctx)
@@ -59,7 +62,6 @@ internal class NonComplianceDocSetService : INonComplianceDocSetService
#endregion
Console.WriteLine($"> Inizializzata la fase di creazione per {nonComplianceName}.");
#region DocSet Field Entry
@@ -69,33 +71,27 @@ internal class NonComplianceDocSetService : INonComplianceDocSetService
Console.WriteLine($"> DocumentSet {nonComplianceName} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(nonComplianceName).ListItemAllFields;
//var dsItem = list.RootFolder.Folders.GetByUrl(nonComplianceName).ListItemAllFields;
dsItem["PAL_NC_Source"] = nonComplianceRepository.DefaultNonComplianceSource();
dsItem["PAL_NC_Reference"] = nonComplianceRepository.DefaultNonComplianceReference();
dsItem["PAL_NC_Nominative"] = nonComplianceRepository.DefaultNonComplianceNominative();
dsItem["PAL_NC_DateOfDetection"] = nonComplianceRepository.DefaultNonComplianceDateOfDetection();
dsItem["PAL_NC_Project"] = nonComplianceRepository.DefaultNonComplianceProject();
dsItem["PAL_NC_ItemCode"] = nonComplianceRepository.DefaultNonComplianceItemCode();
dsItem["PAL_NC_PortalUrl"] = nonComplianceRepository.DefaultNonCompliancePortalUrl();
//dsItem["PAL_NC_Source"] = nonComplianceRepository.DefaultNonComplianceSource(nonComplianceName);
//dsItem["PAL_NC_Reference"] = nonComplianceRepository.DefaultNonComplianceReference(nonComplianceName);
//dsItem["PAL_NC_Nominative"] = nonComplianceRepository.DefaultNonComplianceNominative(nonComplianceName);
//dsItem["PAL_NC_DateOfDetection"] = nonComplianceRepository.DefaultNonComplianceDateOfDetection(nonComplianceName);
//dsItem["PAL_NC_Project"] = nonComplianceRepository.DefaultNonComplianceProject(nonComplianceName);
//dsItem["PAL_NC_ItemCode"] = nonComplianceRepository.DefaultNonComplianceItemCode(nonComplianceName);
//dsItem["PAL_NC_PortalUrl"] = nonComplianceRepository.DefaultNonCompliancePortalUrl(nonComplianceName);
//dsItem["PAL_Status"] = nonComplianceRepository.DefaultNonComplianceState(nonComplianceName);
dsItem.Update();
ctx.ExecuteQuery();
//dsItem.Update();
//ctx.ExecuteQuery();
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, nonComplianceName, FieldUpdateType.NonCompliance);
Console.WriteLine($"> Field value update.");
#endregion
#region Quotation Folder
foreach (var name in Folders.OfferDocSet)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {nonComplianceName}");
var rPath = ResourcePath.FromDecodedUrl($"{nonComplianceName}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
#region Folder
oneNoteService.CreateFolderInsideNonCompliance(nonComplianceName, ctx);
+76 -12
View File
@@ -1,8 +1,11 @@
using console_spo_utils.Interfaces.Services;
using System.Net;
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class OneNoteService : IOneNoteService
{
@@ -31,7 +34,7 @@ internal class OneNoteService : IOneNoteService
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetProjYearTenant()} Notebook/{projName}");
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetProjYearTenant(projName)} Notebook/{projName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
@@ -46,6 +49,7 @@ internal class OneNoteService : IOneNoteService
return true;
}
public bool CreateFolderInsideQuotation(string quotationName, ClientContext ctx)
{
try
@@ -53,18 +57,20 @@ internal class OneNoteService : IOneNoteService
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {quotationName} in OneNote.");
var year = siteOptions.GetYear(quotationName);
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
if (!spc.FolderExistsInsideList(ctx, $"{siteOptions.GetQuotationTenant()} Notebook", $"{DateTime.Today.Year}"))
if (!spc.FolderExist(ctx, $"SiteAssets/{siteOptions.GetQuotationTenant()} Notebook/{year}"))
{
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{DateTime.Today.Year}");
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{year}");
list.RootFolder.AddSubFolderUsingPath(rYearPath);
ctx.ExecuteQuery();
}
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{DateTime.Today.Year}/{quotationName}");
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetQuotationTenant()} Notebook/{year}/{quotationName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
@@ -80,29 +86,31 @@ internal class OneNoteService : IOneNoteService
return true;
}
public bool CreateFolderInsideNonCompliance(string quotationName, ClientContext ctx)
public bool CreateFolderInsideNonCompliance(string nonComplianceName, ClientContext ctx)
{
try
{
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {quotationName} in OneNote.");
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {nonComplianceName} in OneNote.");
var year = siteOptions.GetYear(nonComplianceName);
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
if (!spc.FolderExistsInsideList(ctx, $"{siteOptions.GetNonComplianceTenant()} Notebook", $"{DateTime.Today.Year}"))
if (!spc.FolderExist(ctx, $"SiteAssets/{siteOptions.GetNonComplianceTenant()} Notebook/{year}"))
{
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{DateTime.Today.Year}");
var rYearPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{year}");
list.RootFolder.AddSubFolderUsingPath(rYearPath);
ctx.ExecuteQuery();
}
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{DateTime.Today.Year}/{quotationName}");
var rPath = ResourcePath.FromDecodedUrl($"{siteOptions.GetNonComplianceTenant()} Notebook/{year}/{nonComplianceName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
logger.LogInformation($"> Completata la fase di creazione della sezione {quotationName} in OneNote.");
logger.LogInformation($"> Completata la fase di creazione della sezione {nonComplianceName} in OneNote.");
}
catch (Exception ex)
@@ -114,6 +122,62 @@ internal class OneNoteService : IOneNoteService
return true;
}
public bool CreateFolderInsidePurchasing(string purchasingName, ClientContext ctx, PurchType type)
{
try
{
logger.LogInformation($"> Inizializzata la fase di creazione della sezione {purchasingName} in OneNote.");
var purchasingOneNote = "Acquisti Notebook";
var year = siteOptions.GetYear(purchasingName);
var list = ctx.Web.Lists.EnsureSiteAssetsLibrary();
ctx.Load(list, l => l.RootFolder);
ctx.ExecuteQuery();
if (!spc.FolderExist(ctx, $"SiteAssets/{purchasingOneNote}/{year}"))
{
foreach (var dir in Folders.PurchasingOneNoteDir(year))
{
var rDirPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{dir}");
list.RootFolder.AddSubFolderUsingPath(rDirPath);
ctx.ExecuteQuery();
}
}
switch (type)
{
case PurchType.Order:
var oPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/Ordini di Acquisto/{purchasingName}");
list.RootFolder.AddSubFolderUsingPath(oPath);
ctx.ExecuteQuery();
break;
case PurchType.PackingSlip:
var psPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/DDT di Acquisto/{purchasingName}");
list.RootFolder.AddSubFolderUsingPath(psPath);
ctx.ExecuteQuery();
break;
case PurchType.Request:
var rPath = ResourcePath.FromDecodedUrl($"{purchasingOneNote}/{year}/Richieste di Acquisto/{purchasingName}");
list.RootFolder.AddSubFolderUsingPath(rPath);
ctx.ExecuteQuery();
break;
}
logger.LogInformation($"> Completata la fase di creazione della sezione {purchasingName} in OneNote.");
}
catch (Exception ex)
{
logger.LogError(ex, "OnenoteSPFeature");
return false;
}
return true;
}
public void EnableFeature(ClientContext ctx)
{
var featureName = "SiteNotebook";
@@ -1,9 +1,9 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class ProjectDocLibraryService : IProjectDocLibraryService
{
@@ -1,10 +1,9 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Navigation;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class ProjectQuickMenuService : IProjectQuickMenuService
{
@@ -50,7 +49,9 @@ internal class ProjectQuickMenuService : IProjectQuickMenuService
continue;
}
ctx.Web.RootFolder.WelcomePage = $"SottoCommesse%20{projName}/Forms/SottoCommesse%20{projName}.aspx";
var projNameWithoutDash = projName.Replace("-", "");
ctx.Web.RootFolder.WelcomePage = $"SottoCommesse%20{projNameWithoutDash}/Forms/SottoCommesse%20{projNameWithoutDash}.aspx";
ctx.Web.RootFolder.Update();
ctx.ExecuteQuery();
+15 -15
View File
@@ -1,10 +1,10 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class ProjectService : IProjectService
{
@@ -24,13 +24,13 @@ internal class ProjectService : IProjectService
this.logger = logger;
}
public void BuildWebParts()
public void BuildWebParts(string projName)
{
try
{
string wpName = siteOptions.GetProjYearTenant();
string wpName = siteOptions.GetProjYearTenant(projName);
var listView = GetListsId(siteOptions.GetProjListTitle(), Fields.SynthticProjTitle);
var listView = GetListsId(projName, siteOptions.GetProjListTitle(projName), Fields.SynthticProjTitle);
var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectSite());
Web web = ctx.Web;
@@ -40,11 +40,11 @@ internal class ProjectService : IProjectService
LimitedWebPartManager mgr = file.GetLimitedWebPartManager(PersonalizationScope.Shared);
string url = siteOptions.GetProjectYearSite() + "/Lists/" +
siteOptions.GetProjListTitle().Replace(" ", "%20") +
"/" + siteOptions.GetProjListTitle().Replace(" ", "%20") + ".aspx?viewid=";
string url = siteOptions.GetProjectYearSite(projName) + "/Lists/" +
siteOptions.GetProjListTitle(projName).Replace(" ", "%20") +
"/" + siteOptions.GetProjListTitle(projName).Replace(" ", "%20") + ".aspx?viewid=";
string htmlSchema = $"<div><h1 style=\"font-weight: bold; font-size: 18pt; clear: both;\">{siteOptions.GetProjYearTenant()}</h1></div>" +
string htmlSchema = $"<div><h1 style=\"font-weight: bold; font-size: 18pt; clear: both;\">{siteOptions.GetProjYearTenant(projName)}</h1></div>" +
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[0]]}\">Progetti Macchina</a><br>Solo i progetti di vendita Macchine/Impianti</p></div>" +
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[1]]}\">Progetti Ricambi</a><br>Solo i progetti di vendita Ricambi</p></div>" +
$"<div><p><a style=\"color: green\" href=\"{url}{listView[Fields.SynthticProjTitle[2]]}\">Altri Progetti</a><br>Tutti gli altri progetti che non siano di vendita Macchine/Impianti o Ricambi</p></div>";
@@ -53,7 +53,7 @@ internal class ProjectService : IProjectService
"<WebPart xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"" +
" xmlns=\"http://schemas.microsoft.com/WebPart/v2\">" +
$"<Title>{siteOptions.GetProjYearTenant()}</Title><FrameType>None</FrameType>" +
$"<Title>{siteOptions.GetProjYearTenant(projName)}</Title><FrameType>None</FrameType>" +
"<Assembly>Microsoft.SharePoint, Version=13.0.0.0, Culture=neutral, " +
"PublicKeyToken=94de0004b6e3fcc5</Assembly>" +
"<TypeName>Microsoft.SharePoint.WebPartPages.ContentEditorWebPart</TypeName>" +
@@ -67,8 +67,8 @@ internal class ProjectService : IProjectService
var qm = new NavigationNodeCreationInformation()
{
Title = siteOptions.GetProjYearTenant(),
Url = siteOptions.GetProjectYearSite().ToString(),
Title = siteOptions.GetProjYearTenant(projName),
Url = siteOptions.GetProjectYearSite(projName).ToString(),
AsLastNode = true
};
@@ -82,7 +82,7 @@ internal class ProjectService : IProjectService
}
}
private Dictionary<string, string> GetListsId(string listTitle, string[] listViewTitle)
private Dictionary<string, string> GetListsId(string projName, string listTitle, string[] listViewTitle)
{
Dictionary<string, string> listViewId = new Dictionary<string, string>();
@@ -90,7 +90,7 @@ internal class ProjectService : IProjectService
{
foreach (var lViewTitle in listViewTitle)
{
var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectYearSite());
var ctx = sharePointAuthenticationManager.GetContext(siteOptions.GetProjectYearSite(projName));
var list = ctx.Web.Lists.GetByTitle(listTitle);
ctx.Load(list.Views);
@@ -1,9 +1,9 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class ProjectYearService : IProjectYearService
{
@@ -18,7 +18,7 @@ internal class ProjectYearService : IProjectYearService
this.projectService = projectService;
}
public void CreateList(string listTitle, ClientContext ctx)
public void CreateList(string projName, string listTitle, ClientContext ctx)
{
try
{
@@ -66,7 +66,7 @@ internal class ProjectYearService : IProjectYearService
foreach (var fn in Fields.SiteFields)
{
var Fields = siteField.Fields.GetByTitle(fn);
var Fields = siteField.Fields.GetByInternalNameOrTitle(fn);
list.Fields.Add(Fields);
}
@@ -114,7 +114,7 @@ internal class ProjectYearService : IProjectYearService
CreateViewList(list, ctx);
projectService.BuildWebParts();
projectService.BuildWebParts(projName);
Console.WriteLine($"> Impostata come HomePage di '{viewCreation.Title}'");
@@ -0,0 +1,63 @@
using System.Reflection.Metadata.Ecma335;
using System.Runtime.CompilerServices;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
namespace library_spo_utils.Services;
internal class PurchasingOrderBuildService : IPurchasingOrderBuildService
{
private readonly ISiteOptions _siteOptions;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly ISharePointCustomOperation _spc;
private readonly IPurchasingOrderDocLibraryService _purchasingOrderDocLibraryService;
private readonly IPurchasingOrderDocSetService _purchasingOrderDocSetService;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<PurchasingOrderBuildService> _logger;
public PurchasingOrderBuildService(ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ISharePointCustomOperation spc,
IPurchasingOrderDocLibraryService purchasingOrderDocLibraryService,
IPurchasingOrderDocSetService purchasingOrderDocSetService,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<PurchasingOrderBuildService> logger)
{
_siteOptions = siteOptions;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_spc = spc;
_purchasingOrderDocLibraryService = purchasingOrderDocLibraryService;
_purchasingOrderDocSetService = purchasingOrderDocSetService;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
_logger = logger;
}
public void CreateIfNotExists(string purchasingOrder)
{
var site = _siteOptions.GetPurchasingOrderSite();
var ctx = _sharePointAuthenticationManager.GetContext(site);
var list = _siteOptions.GetPurchasingOrderLibrary(purchasingOrder);
var tenant = _siteOptions.GetPurchasingOrderTenat();
if (!_spc.SiteExist(ctx))
{
throw new Exception($"Impossibile to build site it don't exist");
}
if (!_spc.ListExist(ctx, list))
{
_purchasingOrderDocLibraryService.Create(list, ctx);
}
if (!_spc.FolderExistsInsideList(ctx, list, purchasingOrder))
{
_purchasingOrderDocSetService.Create(purchasingOrder, list, tenant, ctx);
}
else
{
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingOrder, FieldUpdateType.PurchasingOrder);
_logger.LogInformation($"Quotation with {purchasingOrder} already exist");
}
}
}
@@ -0,0 +1,116 @@
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Services;
internal class PurchasingOrderDocLibraryService : IPurchasingOrderDocLibraryService
{
private readonly ILogger<PurchasingOrderDocLibraryService> _logger;
public PurchasingOrderDocLibraryService(ILogger<PurchasingOrderDocLibraryService> logger)
{
_logger = logger;
}
public void Create(string libName, ClientContext ctx)
{
try
{
#region New DocLib
Console.WriteLine($"> Inizializzata la fase di creazione '{libName}'.");
Web web = ctx.Web;
ctx.Load(web, w => w.RootFolder.WelcomePage, w => w.Url);
ListCreationInformation lci = new ListCreationInformation();
lci.Title = libName;
lci.TemplateType = (int)ListTemplateType.DocumentLibrary;
web.Lists.Add(lci);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione '{libName}'.");
#endregion
#region Field
Console.WriteLine($"> Inizializzata la fase di importazione dei campi '{libName}'.");
List list = ctx.Web.Lists.GetByTitle(libName);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
string[] fieldName = { "Fornitore", "Stato" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
list.Fields.Add(Fields);
}
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di importazione dei campi '{libName}'.");
#endregion
#region View
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{libName}'.");
var views = list.Views;
ViewCreationInformation viewCreation = new ViewCreationInformation();
viewCreation.SetAsDefaultView = true;
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = Fields.PurchasingView;
var view = views.Add(viewCreation);
ctx.Load(view);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
var customView = views.GetByTitle(viewCreation.Title);
customView.MobileView = true;
customView.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
#endregion
#region Shortcut on Quickmenu
NavigationNodeCollection spNavNodeColl = web.Navigation.QuickLaunch;
NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation();
newNavNode.Title = $"{libName}";
newNavNode.Url = $"{web.Url}/{libName.Replace(" ", "%20")}";
newNavNode.AsLastNode = true;
spNavNodeColl.Add(newNavNode);
ctx.ExecuteQuery();
Console.WriteLine($"> Il menu rapido è stato aggiornato, il collegamento a {libName} è ora disponibile.");
#endregion
}
catch (Exception ex)
{
_logger.LogError(ex, "NonComplianceDocLibraryService");
}
}
}
@@ -0,0 +1,112 @@
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace library_spo_utils.Services;
internal class PurchasingOrderDocSetService : IPurchasingOrderDocSetService
{
private readonly IPurchasingOrderRepository _purchasingOrderRepository;
private readonly ISharePointCustomOperation _cpt;
private readonly IOneNoteService _oneNoteService;
private readonly ISiteOptions _siteOptions;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly ILogger<PurchasingOrderBuildService> _logger;
public PurchasingOrderDocSetService(
IPurchasingOrderRepository purchasingOrderRepository,
ISharePointCustomOperation cpt,
IOneNoteService oneNoteService,
ISiteOptions siteOptions,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ILogger<PurchasingOrderBuildService> logger)
{
_purchasingOrderRepository = purchasingOrderRepository;
_cpt = cpt;
_oneNoteService = oneNoteService;
_siteOptions = siteOptions;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_logger = logger;
}
public void Create(string purchasingOrderName, string docLibraryName, string tenantName, ClientContext ctx)
{
#region Context
var web = ctx.Web;
ctx.Load(web, w => w.Url);
List list = web.Lists.GetByTitle(docLibraryName);
ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
ctx.ExecuteQuery();
list.ContentTypesEnabled = true;
list.Update();
if (!_cpt.ListContentTypeExist(ctx, docLibraryName, "Set di documenti"))
{
var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
ctx.Load(documentCT);
ctx.ExecuteQuery();
var ctDocSet = new ContentTypeCreationInformation()
{
Name = "Set di documenti",
ParentContentType = documentCT
};
list.ContentTypes.Add(ctDocSet);
list.Update();
ctx.ExecuteQuery();
}
var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
var contentType = ctData.FirstOrDefault();
ctx.Load(contentType);
ctx.ExecuteQuery();
#endregion
Console.WriteLine($"> Inizializzata la fase di creazione per {purchasingOrderName}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, purchasingOrderName, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {purchasingOrderName} creata.");
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, purchasingOrderName, FieldUpdateType.PurchasingOrder);
Console.WriteLine($"> Field value update.");
#endregion
#region Folder
foreach (var name in Folders.PurchasingOrder)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {purchasingOrderName}");
var rPath = ResourcePath.FromDecodedUrl($"{purchasingOrderName}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
_oneNoteService.CreateFolderInsidePurchasing(purchasingOrderName, purchCtx, PurchType.Order);
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingOrderName}");
#endregion
Console.WriteLine($"> {purchasingOrderName} creato con successo.");
}
}
@@ -0,0 +1,62 @@
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
namespace library_spo_utils.Services;
internal class PurchasingPackingSlipBuildService : IPurchasingPackingSlipBuildService
{
private readonly ISiteOptions _siteOptions;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly ISharePointCustomOperation _spc;
private readonly IPurchasingPackingSlipDocLibraryService _purchasingPackingSlipDocLibraryService;
private readonly IPurchasingPackingSlipDocSetService _purchasingPackingSlipDocSetService;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<PurchasingOrderBuildService> _logger;
public PurchasingPackingSlipBuildService(
ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ISharePointCustomOperation spc,
IPurchasingPackingSlipDocLibraryService purchasingPackingSlipDocLibraryService,
IPurchasingPackingSlipDocSetService purchasingPackingSlipDocSetService,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<PurchasingOrderBuildService> logger)
{
_siteOptions = siteOptions;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_spc = spc;
_purchasingPackingSlipDocLibraryService = purchasingPackingSlipDocLibraryService;
_purchasingPackingSlipDocSetService = purchasingPackingSlipDocSetService;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
_logger = logger;
}
public void CreateIfNotExists(string purchasingPackingSlipName)
{
var site = _siteOptions.GetPurchasingPackingSlipSite();
var ctx = _sharePointAuthenticationManager.GetContext(site);
var list = _siteOptions.GetPurchasingPackingSlipLibrary(purchasingPackingSlipName);
var tenant = _siteOptions.GetPurchasingPackingSlipTenat();
if (!_spc.SiteExist(ctx))
{
throw new Exception($"Impossibile to build site it don't exist");
}
if (!_spc.ListExist(ctx, list))
{
_purchasingPackingSlipDocLibraryService.Create(list, ctx);
}
if (!_spc.FolderExistsInsideList(ctx, list, purchasingPackingSlipName))
{
_purchasingPackingSlipDocSetService.Create(purchasingPackingSlipName, list, tenant, ctx);
}
else
{
_logger.LogInformation($"Quotation with {purchasingPackingSlipName} already exist");
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingPackingSlipName, FieldUpdateType.PurchasingPackingSlip);
}
}
}
@@ -0,0 +1,115 @@
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Services;
internal class PurchasingPackingSlipDocLibraryService : IPurchasingPackingSlipDocLibraryService
{
private readonly ILogger<PurchasingPackingSlipDocLibraryService> _logger;
public PurchasingPackingSlipDocLibraryService(ILogger<PurchasingPackingSlipDocLibraryService> logger)
{
_logger = logger;
}
public void Create(string libName, ClientContext ctx)
{
try
{
#region New DocLib
Console.WriteLine($"> Inizializzata la fase di creazione '{libName}'.");
Web web = ctx.Web;
ctx.Load(web, w => w.RootFolder.WelcomePage, w => w.Url);
ListCreationInformation lci = new ListCreationInformation();
lci.Title = libName;
lci.TemplateType = (int)ListTemplateType.DocumentLibrary;
web.Lists.Add(lci);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione '{libName}'.");
#endregion
#region Field
Console.WriteLine($"> Inizializzata la fase di importazione dei campi '{libName}'.");
List list = ctx.Web.Lists.GetByTitle(libName);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
string[] fieldName = { "Fornitore", "Stato" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
list.Fields.Add(Fields);
}
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di importazione dei campi '{libName}'.");
#endregion
#region View
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{libName}'.");
var views = list.Views;
ViewCreationInformation viewCreation = new ViewCreationInformation();
viewCreation.SetAsDefaultView = true;
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = Fields.PurchasingView;
var view = views.Add(viewCreation);
ctx.Load(view);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
var customView = views.GetByTitle(viewCreation.Title);
customView.MobileView = true;
customView.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
#endregion
#region Shortcut on Quickmenu
NavigationNodeCollection spNavNodeColl = web.Navigation.QuickLaunch;
NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation();
newNavNode.Title = $"{libName}";
newNavNode.Url = $"{web.Url}/{libName.Replace(" ", "%20")}";
newNavNode.AsLastNode = true;
spNavNodeColl.Add(newNavNode);
ctx.ExecuteQuery();
Console.WriteLine($"> Il menu rapido è stato aggiornato, il collegamento a {libName} è ora disponibile.");
#endregion
}
catch (Exception ex)
{
_logger.LogError(ex, "NonComplianceDocLibraryService");
}
}
}
@@ -0,0 +1,113 @@
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace library_spo_utils.Services;
internal class PurchasingPackingSlipDocSetService : IPurchasingPackingSlipDocSetService
{
private readonly IPurchasingPackingSlipRepository _purchasingPackingSlipRepository;
private readonly ISharePointCustomOperation _cpt;
private readonly IOneNoteService _oneNoteService;
private readonly ISiteOptions _siteOptions;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly ILogger<PurchasingPackingSlipDocSetService> _logger;
public PurchasingPackingSlipDocSetService(
IPurchasingPackingSlipRepository purchasingPackingSlipRepository,
ISharePointCustomOperation cpt,
IOneNoteService oneNoteService,
ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ILogger<PurchasingPackingSlipDocSetService> logger)
{
_purchasingPackingSlipRepository = purchasingPackingSlipRepository;
_cpt = cpt;
_oneNoteService = oneNoteService;
_siteOptions = siteOptions;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_logger = logger;
}
public void Create(string purchasingPackingSlipName, string docLibraryName, string tenantName, ClientContext ctx)
{
#region Context
var web = ctx.Web;
ctx.Load(web, w => w.Url);
List list = web.Lists.GetByTitle(docLibraryName);
ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
ctx.ExecuteQuery();
list.ContentTypesEnabled = true;
list.Update();
if (!_cpt.ListContentTypeExist(ctx, docLibraryName, "Set di documenti"))
{
var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
ctx.Load(documentCT);
ctx.ExecuteQuery();
var ctDocSet = new ContentTypeCreationInformation()
{
Name = "Set di documenti",
ParentContentType = documentCT
};
list.ContentTypes.Add(ctDocSet);
list.Update();
ctx.ExecuteQuery();
}
var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
var contentType = ctData.FirstOrDefault();
ctx.Load(contentType);
ctx.ExecuteQuery();
#endregion
Console.WriteLine($"> Inizializzata la fase di creazione per {purchasingPackingSlipName}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, purchasingPackingSlipName, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {purchasingPackingSlipName} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(purchasingPackingSlipName).ListItemAllFields;
dsItem["PAL_PO_Supplier"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipSupplier(purchasingPackingSlipName);
dsItem["PAL_Status"] = _purchasingPackingSlipRepository.DefaultPurchasingPackingSlipState(purchasingPackingSlipName);
dsItem.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Field value update.");
#endregion
#region Folder
//foreach (var name in Folders.PurchasingOrder)
//{
// Console.WriteLine($"La sotto cartella {name} verrà creata in {nonComplianceName}");
// var rPath = ResourcePath.FromDecodedUrl($"{nonComplianceName}/{name}");
// list.RootFolder.AddSubFolderUsingPath(rPath);
//}
//ctx.ExecuteQuery();
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
_oneNoteService.CreateFolderInsidePurchasing(purchasingPackingSlipName, purchCtx, PurchType.PackingSlip);
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingPackingSlipName}");
#endregion
Console.WriteLine($"> {purchasingPackingSlipName} creato con successo.");
}
}
@@ -0,0 +1,61 @@
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
namespace library_spo_utils.Services;
internal class PurchasingRequestBuildService : IPurchasingRequestBuildService
{
private readonly ISiteOptions _siteOptions;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly ISharePointCustomOperation _spc;
private readonly IPurchasingRequestDocLibraryService _purchasingRequestDocLibraryService;
private readonly IPurchasingRequestDocSetService _purchasingRequestDocSetService;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<PurchasingRequestBuildService> _logger;
public PurchasingRequestBuildService(ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
ISharePointCustomOperation spc,
IPurchasingRequestDocLibraryService purchasingRequestDocLibraryService,
IPurchasingRequestDocSetService purchasingRequestDocSetService,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<PurchasingRequestBuildService> logger)
{
_siteOptions = siteOptions;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_spc = spc;
_purchasingRequestDocLibraryService = purchasingRequestDocLibraryService;
_purchasingRequestDocSetService = purchasingRequestDocSetService;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
_logger = logger;
}
public void CreateIfNotExists(string purchasingRequestName)
{
var site = _siteOptions.GetPurchasingRequestSite();
var ctx = _sharePointAuthenticationManager.GetContext(site);
var list = _siteOptions.GetPurchasingRequestLibrary(purchasingRequestName);
var tenant = _siteOptions.GetPurchasingRequestTenat();
if (!_spc.SiteExist(ctx))
{
throw new Exception($"Impossibile to build site it don't exist");
}
if (!_spc.ListExist(ctx, list))
{
_purchasingRequestDocLibraryService.Create(list, ctx);
}
if (!_spc.FolderExistsInsideList(ctx, list, purchasingRequestName))
{
_purchasingRequestDocSetService.Create(purchasingRequestName, list, tenant, ctx);
}
else
{
_logger.LogInformation($"Quotation with {purchasingRequestName} already exist");
_fieldEntryDataUpdate.FieldUpdate(ctx, list, purchasingRequestName, FieldUpdateType.PurchasingRequest);
}
}
}
@@ -0,0 +1,116 @@
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace library_spo_utils.Services;
internal class PurchasingRequestDocLibraryService : IPurchasingRequestDocLibraryService
{
private readonly ILogger<PurchasingRequestDocLibraryService> _logger;
public PurchasingRequestDocLibraryService(ILogger<PurchasingRequestDocLibraryService> logger)
{
_logger = logger;
}
public void Create(string libName, ClientContext ctx)
{
try
{
#region New DocLib
Console.WriteLine($"> Inizializzata la fase di creazione '{libName}'.");
Web web = ctx.Web;
ctx.Load(web, w => w.RootFolder.WelcomePage, w => w.Url);
ListCreationInformation lci = new ListCreationInformation();
lci.Title = libName;
lci.TemplateType = (int)ListTemplateType.DocumentLibrary;
web.Lists.Add(lci);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione '{libName}'.");
#endregion
#region Field
Console.WriteLine($"> Inizializzata la fase di importazione dei campi '{libName}'.");
List list = ctx.Web.Lists.GetByTitle(libName);
var siteField = ctx.Site.RootWeb;
ctx.Load(list, l => l.Fields);
ctx.Load(siteField, s => s.Fields);
ctx.ExecuteQuery();
string[] fieldName = { "Fornitore", "Stato" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
list.Fields.Add(Fields);
}
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di importazione dei campi '{libName}'.");
#endregion
#region View
Console.WriteLine($"> Inizializzata la fase di creazione della ListView '{libName}'.");
var views = list.Views;
ViewCreationInformation viewCreation = new ViewCreationInformation();
viewCreation.SetAsDefaultView = true;
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = Fields.PurchasingView;
var view = views.Add(viewCreation);
ctx.Load(view);
ctx.ExecuteQuery();
Console.WriteLine($"> Completata la fase di creazione della ListView '{viewCreation.Title}'.");
var customView = views.GetByTitle(viewCreation.Title);
customView.MobileView = true;
customView.MobileDefaultView = true;
customView.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Abilitata la visualizzazione su mobile '{viewCreation.Title}'.");
#endregion
#region Shortcut on Quickmenu
NavigationNodeCollection spNavNodeColl = web.Navigation.QuickLaunch;
NavigationNodeCreationInformation newNavNode = new NavigationNodeCreationInformation();
newNavNode.Title = $"{libName}";
newNavNode.Url = $"{web.Url}/{libName.Replace(" ", "%20")}";
newNavNode.AsLastNode = true;
spNavNodeColl.Add(newNavNode);
ctx.ExecuteQuery();
Console.WriteLine($"> Il menu rapido è stato aggiornato, il collegamento a {libName} è ora disponibile.");
#endregion
}
catch (Exception ex)
{
_logger.LogError(ex, "NonComplianceDocLibraryService");
}
}
}
@@ -0,0 +1,113 @@
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace library_spo_utils.Services;
internal class PurchasingRequestDocSetService : IPurchasingRequestDocSetService
{
private readonly IPurchasingRequestRepository _purchasingRequestRepository;
private readonly ISharePointCustomOperation _cpt;
private readonly IOneNoteService _oneNoteService;
private readonly ISiteOptions _siteOptions;
private readonly ISharePointAuthenticationManager _sharePointAuthenticationManager;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<PurchasingRequestDocSetService> _logger;
public PurchasingRequestDocSetService(
IPurchasingRequestRepository purchasingRequestRepository,
ISharePointCustomOperation cpt,
IOneNoteService oneNoteService,
ISiteOptions siteOptions,
ISharePointAuthenticationManager sharePointAuthenticationManager,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<PurchasingRequestDocSetService> logger)
{
_purchasingRequestRepository = purchasingRequestRepository;
_cpt = cpt;
_oneNoteService = oneNoteService;
_siteOptions = siteOptions;
_sharePointAuthenticationManager = sharePointAuthenticationManager;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
_logger = logger;
}
public void Create(string purchasingRequestName, string docLibraryName, string tenantName, ClientContext ctx)
{
#region Context
var web = ctx.Web;
ctx.Load(web, w => w.Url);
List list = web.Lists.GetByTitle(docLibraryName);
ctx.Load(list, l => l.RootFolder, l => l.ContentTypes, l => l.Fields, l => l.ContentTypesEnabled);
ctx.ExecuteQuery();
list.ContentTypesEnabled = true;
list.Update();
if (!_cpt.ListContentTypeExist(ctx, docLibraryName, "Set di documenti"))
{
var documentCT = ctx.Site.RootWeb.AvailableContentTypes.GetById("0x0120D5");
ctx.Load(documentCT);
ctx.ExecuteQuery();
var ctDocSet = new ContentTypeCreationInformation()
{
Name = "Set di documenti",
ParentContentType = documentCT
};
list.ContentTypes.Add(ctDocSet);
list.Update();
ctx.ExecuteQuery();
}
var ctData = list.ContentTypes.Where(c => c.Name == "Set di documenti");
var contentType = ctData.FirstOrDefault();
ctx.Load(contentType);
ctx.ExecuteQuery();
#endregion
Console.WriteLine($"> Inizializzata la fase di creazione per {purchasingRequestName}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, purchasingRequestName, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {purchasingRequestName} creata.");
//var dsItem = list.RootFolder.Folders.GetByUrl(purchasingRequestName).ListItemAllFields;
//dsItem["PAL_PO_Supplier"] = _purchasingRequestRepository.DefaultPurchasingRequestSupplier(purchasingRequestName);
//dsItem["PAL_Status"] = _purchasingRequestRepository.DefaultPurchasingRequestState(purchasingRequestName);
//dsItem.Update();
//ctx.ExecuteQuery();
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, purchasingRequestName, FieldUpdateType.PurchasingRequest);
Console.WriteLine($"> Field value update.");
#endregion
#region Folder
ctx.ExecuteQuery();
var purchCtx = _sharePointAuthenticationManager.GetContext(_siteOptions.GetPurchasingSite());
_oneNoteService.CreateFolderInsidePurchasing(purchasingRequestName, purchCtx, PurchType.Request);
Console.WriteLine($"Le sotto cartelle sono state create con successo in {purchasingRequestName}");
#endregion
Console.WriteLine($"> {purchasingRequestName} creato con successo.");
}
}
@@ -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);
}
}
}
@@ -1,8 +1,9 @@
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class QuotationDocLibraryService : IQuotationDocLibraryService
{
@@ -45,11 +46,11 @@ internal class QuotationDocLibraryService : IQuotationDocLibraryService
ctx.ExecuteQuery();
string[] fieldName = { "ID Offerta", "Fornitore", "Causale", "Autore" };
string[] fieldName = { "PAL_Quotation_Reason", "PAL_ID_Quotation", "PAL_Quotation_Name", "PAL_Description", "PAL_Authors", "PAL_Status" };
foreach (var fn in fieldName)
{
var Fields = siteField.Fields.GetByTitle(fn);
var Fields = siteField.Fields.GetByInternalNameOrTitle(fn);
list.Fields.Add(Fields);
}
@@ -71,7 +72,7 @@ internal class QuotationDocLibraryService : IQuotationDocLibraryService
viewCreation.Title = libName;
viewCreation.ViewTypeKind = ViewType.None;
viewCreation.ColumnWidth = "350";
viewCreation.ViewFields = new string[] { "Type", "Name", "ID Offerta", "Fornitore", "Causale", "Autore" };
viewCreation.ViewFields = Fields.QuotationView;
var view = views.Add(viewCreation);
@@ -1,11 +1,12 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class QuotationDocSetService : IQuotationDocSetService
{
@@ -13,16 +14,19 @@ internal class QuotationDocSetService : IQuotationDocSetService
private readonly ILogger<QuotationDocSetService> logger;
private readonly IOneNoteService oneNoteService;
private readonly IQuotationRepository quotationRepository;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
public QuotationDocSetService(ISharePointCustomOperation cpt,
ILogger<QuotationDocSetService> logger,
IOneNoteService oneNoteService,
IQuotationRepository quotationRepository)
IQuotationRepository quotationRepository,
IFieldEntryDataUpdate fieldEntryDataUpdate)
{
this.cpt = cpt;
this.logger = logger;
this.oneNoteService = oneNoteService;
this.quotationRepository = quotationRepository;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
}
public void Create(string quotationName, string docLibraryName, string tenantName, ClientContext ctx)
@@ -73,15 +77,18 @@ internal class QuotationDocSetService : IQuotationDocSetService
Console.WriteLine($"> DocumentSet {quotationName} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(quotationName).ListItemAllFields;
//var dsItem = list.RootFolder.Folders.GetByUrl(quotationName).ListItemAllFields;
dsItem["PAL_ID_Quotation"] = quotationRepository.DefaultIdQuotation(quotationName);
dsItem["PAL_Quotation_Name"] = quotationRepository.DefaultQuotationName(quotationName);
dsItem["PAL_Quotation_Reason"] = quotationRepository.DefaultQuotationReason(quotationName);
dsItem["PAL_Authors"] = quotationRepository.DefaultAuthors(quotationName);
//dsItem["PAL_ID_Quotation"] = quotationRepository.DefaultIdQuotation(quotationName);
//dsItem["PAL_Quotation_Name"] = quotationRepository.DefaultQuotationName(quotationName);
//dsItem["PAL_Quotation_Reason"] = quotationRepository.DefaultQuotationReason(quotationName);
//dsItem["PAL_Authors"] = quotationRepository.DefaultAuthors(quotationName);
//dsItem["PAL_Status"] = quotationRepository.DefaultQuotationState(quotationName);
dsItem.Update();
ctx.ExecuteQuery();
//dsItem.Update();
//ctx.ExecuteQuery();
_fieldEntryDataUpdate.FieldUpdate(ctx, docLibraryName, quotationName, FieldUpdateType.Quotation);
Console.WriteLine($"> Field value update.");
@@ -89,7 +96,9 @@ internal class QuotationDocSetService : IQuotationDocSetService
#region Quotation Folder
foreach (var name in Folders.OfferDocSet)
var revision = "Rev.00";
foreach (var name in Folders.OfferDocSet(revision))
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {quotationName}");
var rPath = ResourcePath.FromDecodedUrl($"{quotationName}/{name}");
+2 -2
View File
@@ -1,8 +1,8 @@
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services
namespace library_spo_utils.Services
{
internal class RightsService : IRightsService
{
@@ -1,13 +1,10 @@
using console_spo_utils.Enums;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Online.SharePoint.TenantAdministration;
using Microsoft.SharePoint.Client;
using System.Security;
using System.Xml.Linq;
using console_spo_utils.Constants;
namespace console_spo_utils.Services
namespace library_spo_utils.Services
{
internal class SharePointCustomOperation : ISharePointCustomOperation
{
@@ -59,6 +56,22 @@ namespace console_spo_utils.Services
}
}
public bool FolderExist(ClientContext ctx, string path)
{
var folder = ctx.Web.GetFolderByServerRelativeUrl(path).Folders;
ctx.Load(folder, f => f.Include(fi => fi.ListItemAllFields));
try
{
ctx.ExecuteQuery();
return true;
}
catch (Exception)
{
return false;
}
}
public bool FolderExistsInsideList(ClientContext context, string listTitle, string folderName)
{
var folderExists = context.Web.Lists.GetByTitle(listTitle).RootFolder;
@@ -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;
}
}
+93 -16
View File
@@ -1,28 +1,55 @@
using System.Net;
using System.Security;
using console_spo_utils.Interfaces.Services;
using System.Text.RegularExpressions;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Configuration;
using Microsoft.Graph;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
public class SiteOptions : ISiteOptions
{
private readonly IConfiguration _configuration;
public SiteOptions(IConfiguration configuration)
{
_configuration = configuration;
}
private const string SiteCollection = "https://italsortbuttrio.sharepoint.com";
public string TokenEndpoint { get; } = "https://login.microsoftonline.com/common/oauth2/token";
public string DefaultAadAppId { get; } = "46e6296e-176f-4ebb-a14b-bdd5678c16e6";
public Uri GetProjectYearSite()
public int ZeroDate { get; } = 2022;
public Uri GetProjectYearSite(string code)
{
return new Uri($"{SiteCollection}/sites/{GetProjYearTenant().Replace(" ","")}");
return new Uri($"{SiteCollection}/sites/{GetProjYearTenant(code).Replace(" ","")}");
}
private static int GetYear()
public string GetYear(string code)
{
return DateTime.Today.Year;
var codeHeader = code.Split("-")[0];
var codeYears = Regex.Replace(codeHeader, @"\D", "");
var currentCent = DateTime.Today.Year.ToString().Substring(0, 2);
return currentCent + codeYears;
}
public string GetProjYearTenant()
public bool IsValidDate(string code)
{
return $"Commesse {GetYear()}";
int zeroDate = ZeroDate;
int retDate = int.Parse(GetYear(code));
int curDate = int.Parse(DateTime.Now.Year.ToString());
if (zeroDate <= retDate && retDate <= curDate)
return true;
return false;
}
public string GetProjYearTenant(string code)
{
return $"Commesse {GetYear(code)}";
}
public string GetUser()
@@ -35,14 +62,14 @@ public class SiteOptions : ISiteOptions
return new NetworkCredential("", "$O,D1XBp1O5.OdjZt86#a=").SecurePassword;
}
public string GetProjListTitle()
public string GetProjListTitle(string code)
{
return $"Lista {GetProjYearTenant()}";
return $"Lista {GetProjYearTenant(code)}";
}
public Uri GetSubProjSite(string projName)
{
return new Uri($"{GetProjectYearSite()}/{projName}");
return new Uri($"{GetProjectYearSite(projName)}/{projName}");
}
public string GetQuotationTenant()
@@ -50,9 +77,9 @@ public class SiteOptions : ISiteOptions
return "Offerte";
}
public string GetQuotationLibrary()
public string GetQuotationLibrary(string code)
{
return $"{GetQuotationTenant()} {GetYear()}";
return $"{GetQuotationTenant()} {GetYear(code)}";
}
public Uri GetQuotationSite()
@@ -80,13 +107,63 @@ public class SiteOptions : ISiteOptions
return "Non Conformità";
}
public string GetNonComplianceLibrary()
public string GetNonComplianceLibrary(string code)
{
return $"{GetNonComplianceTenant()} {GetYear()}";
return $"{GetNonComplianceTenant()} {GetYear(code)}";
}
public Uri GetNonComplianceSite()
{
return new Uri($"{SiteCollection}/sites/{GetNonComplianceTenant().Replace(" ", String.Empty)}");
return new Uri($"{SiteCollection}/sites/{GetNonComplianceTenant().Replace(" ", string.Empty)}");
}
public Uri GetPurchasingSite()
{
return new Uri($"{SiteCollection}/teams/purchasing/");
}
public string GetPurchasingOrderTenat()
{
return "Ordini di Acquisto";
}
public string GetPurchasingOrderLibrary(string code)
{
return $"{GetPurchasingOrderTenat()} {GetYear(code)}";
}
public Uri GetPurchasingOrderSite()
{
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingOrderTenat().Replace(" ", string.Empty)}");
}
public string GetPurchasingPackingSlipTenat()
{
return "DDT di Acquisto";
}
public string GetPurchasingPackingSlipLibrary(string code)
{
return $"{GetPurchasingPackingSlipTenat()} {GetYear(code)}";
}
public Uri GetPurchasingPackingSlipSite()
{
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingPackingSlipTenat().Replace(" ", string.Empty)}");
}
public string GetPurchasingRequestTenat()
{
return "Richieste di Acquisto";
}
public string GetPurchasingRequestLibrary(string code)
{
return $"{GetPurchasingRequestTenat()} {GetYear(code)}";
}
public Uri GetPurchasingRequestSite()
{
return new Uri($"{SiteCollection}/teams/purchasing/{GetPurchasingRequestTenat().Replace(" ", string.Empty)}");
}
}
+71 -65
View File
@@ -1,24 +1,25 @@
using console_spo_utils.Enums;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class SiteService : ISiteService
{
private readonly ILogger<SiteService> logger;
private readonly ISharePointAuthenticationManager authMgr;
private readonly ISharePointCustomOperation spc;
private readonly ISiteOptions siteOptions;
private readonly ISubSiteService subSiteService;
private readonly IOneNoteService oneNoteService;
private readonly IProjectSettingsRepository projectSettingsRepository;
private readonly IProjectDocLibraryService projectDocLibraryService;
private readonly IProjectQuickMenuService projectQuickMenuService;
private readonly ITenantService tenantService;
private readonly IProjectYearService projectYearService;
private readonly ILogger<SiteService> _logger;
private readonly ISharePointAuthenticationManager _authMgr;
private readonly ISharePointCustomOperation _spc;
private readonly ISiteOptions _siteOptions;
private readonly ISubSiteService _subSiteService;
private readonly IOneNoteService _oneNoteService;
private readonly IProjectRepository _projectRepository;
private readonly IProjectDocLibraryService _projectDocLibraryService;
private readonly IProjectQuickMenuService _projectQuickMenuService;
private readonly ITenantService _tenantService;
private readonly IProjectYearService _projectYearService;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
public SiteService(
ILogger<SiteService> logger,
@@ -27,43 +28,45 @@ internal class SiteService : ISiteService
ISiteOptions siteOptions,
ISubSiteService subSiteService,
IOneNoteService oneNoteService,
IProjectSettingsRepository projectSettingsRepository,
IProjectRepository projectRepository,
IProjectDocLibraryService projectDocLibraryService,
IProjectQuickMenuService projectQuickMenuService,
ITenantService tenantService,
IProjectYearService projectYearService)
IProjectYearService projectYearService,
IFieldEntryDataUpdate fieldEntryDataUpdate)
{
this.logger = logger;
this.authMgr = authMgr;
this.spc = spc;
this.siteOptions = siteOptions;
this.subSiteService = subSiteService;
this.oneNoteService = oneNoteService;
this.projectSettingsRepository = projectSettingsRepository;
this.projectDocLibraryService = projectDocLibraryService;
this.projectQuickMenuService = projectQuickMenuService;
this.tenantService = tenantService;
this.projectYearService = projectYearService;
_logger = logger;
_authMgr = authMgr;
_spc = spc;
_siteOptions = siteOptions;
_subSiteService = subSiteService;
_oneNoteService = oneNoteService;
_projectRepository = projectRepository;
_projectDocLibraryService = projectDocLibraryService;
_projectQuickMenuService = projectQuickMenuService;
_tenantService = tenantService;
_projectYearService = projectYearService;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
}
public bool CreateProjectSiteIfNotExists()
public bool CreateProjectSiteIfNotExists(string projName)
{
try
{
var site = siteOptions.GetProjectYearSite();
var listTitle = siteOptions.GetProjListTitle();
using var ctx = authMgr.GetContext(site);
if (spc.SiteExist(ctx))
var site = _siteOptions.GetProjectYearSite(projName);
var listTitle = _siteOptions.GetProjListTitle(projName);
using var ctx = _authMgr.GetContext(site);
if (_spc.SiteExist(ctx))
{
return true;
}
tenantService.CreateForProject();
projectYearService.CreateList(listTitle,ctx);
_tenantService.CreateForProject(projName);
_projectYearService.CreateList(projName, listTitle, ctx);
}
catch (Exception e)
{
logger.LogError(e, "Site Service");
_logger.LogError(e, "Site Service");
return false;
}
@@ -73,37 +76,41 @@ internal class SiteService : ISiteService
public bool CreateSubSiteIfNotExists(string projName)
{
var projectSite = siteOptions.GetProjectYearSite();
var subProjSite = siteOptions.GetSubProjSite(projName);
var projectSite = _siteOptions.GetProjectYearSite(projName);
var subProjSite = _siteOptions.GetSubProjSite(projName);
var siteContext = authMgr.GetContext(projectSite);
var subSiteContext = authMgr.GetContext(subProjSite);
var siteContext = _authMgr.GetContext(projectSite);
var subSiteContext = _authMgr.GetContext(subProjSite);
if (!spc.SiteExist(siteContext))
if (!_spc.SiteExist(siteContext))
{
throw new Exception($"Site {siteContext.Url} not exists");
}
if (spc.SiteExist(subSiteContext))
if (_spc.SiteExist(subSiteContext))
{
logger.LogInformation($"The subsite {subSiteContext.Url} already exists");
_logger.LogInformation($"The subsite {subSiteContext.Url} already exists");
_fieldEntryDataUpdate.FieldUpdate(siteContext, _siteOptions.GetProjListTitle(projName), projName, FieldUpdateType.Project);
return true;
}
var existSubSite = subSiteService.Create(projName, siteContext);
var existSubSite = _subSiteService.Create(projName, siteContext);
if (!existSubSite)
{
return true;
}
oneNoteService.CreateFolderInsideProject(projName, siteContext);
_oneNoteService.CreateFolderInsideProject(projName, siteContext);
CreateProjectListEntry(projName, siteContext);
projectDocLibraryService.Create(projName, subSiteContext);
_projectDocLibraryService.Create(projName, subSiteContext);
subSiteService.AddColumnsToListView(projName, subSiteContext);
_subSiteService.AddColumnsToListView(projName, subSiteContext);
projectQuickMenuService.CreateForProject(projName, subSiteContext);
_projectQuickMenuService.CreateForProject(projName, subSiteContext);
return true;
}
@@ -112,17 +119,17 @@ internal class SiteService : ISiteService
{
try
{
var site = siteOptions.GetQuotationSite();
using var ctx = authMgr.GetContext(site);
if (spc.SiteExist(ctx))
var site = _siteOptions.GetQuotationSite();
using var ctx = _authMgr.GetContext(site);
if (_spc.SiteExist(ctx))
{
return true;
}
tenantService.CreateForQuotation();
_tenantService.CreateForQuotation();
}
catch (Exception e)
{
logger.LogError(e, "Site Service");
_logger.LogError(e, "Site Service");
return false;
}
@@ -133,30 +140,29 @@ internal class SiteService : ISiteService
{
try
{
var site = siteOptions.GetNonComplianceSite();
using var ctx = authMgr.GetContext(site);
if (spc.SiteExist(ctx))
var site = _siteOptions.GetNonComplianceSite();
using var ctx = _authMgr.GetContext(site);
if (_spc.SiteExist(ctx))
{
return true;
}
tenantService.CreateForNonCompliance();
_tenantService.CreateForNonCompliance();
}
catch (Exception e)
{
logger.LogError(e, "Site Service");
_logger.LogError(e, "Site Service");
return false;
}
return true;
}
private void CreateProjectListEntry(string projName, ClientContext ctx)
{
try
{
var listTitle = siteOptions.GetProjListTitle();
var tenant = siteOptions.GetProjYearTenant().Replace(" ",string.Empty);
var listTitle = _siteOptions.GetProjListTitle(projName);
var tenant = _siteOptions.GetProjYearTenant(projName).Replace(" ",string.Empty);
var list = ctx.Web.Lists.GetByTitle(listTitle);
var itemCreateInfo = new ListItemCreationInformation();
@@ -169,17 +175,17 @@ internal class SiteService : ISiteService
};
oItem["PAL_ID_Project"] = link;
oItem["PAL_Customer"] = projectSettingsRepository.DefaultCostumer(projName);
oItem["PAL_DlvReason"] = projectSettingsRepository.DefaultDlvReason(projName);
oItem.Update();
ctx.ExecuteQuery();
logger.LogInformation($"> La Commessa {projName} è stata aggiunta alla lista {listTitle} con successo!");
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, projName, FieldUpdateType.Project);
_logger.LogInformation($"> La Commessa {projName} è stata aggiunta alla lista {listTitle} con successo!");
}
catch (Exception ex)
{
logger.LogError(ex, "Create List Entry");
_logger.LogError(ex, "Create List Entry");
}
}
}
@@ -1,11 +1,12 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Repositories;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client.DocumentSet;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.DocumentSet;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class SubProjectBuilderService : ISubProjectBuilderService
{
@@ -13,23 +14,26 @@ internal class SubProjectBuilderService : ISubProjectBuilderService
private readonly ISharePointCustomOperation cpt;
private readonly ISharePointAuthenticationManager authMgr;
private readonly ISubProjectRepository subProjectRepository;
private readonly IFieldEntryDataUpdate _fieldEntryDataUpdate;
private readonly ILogger<SubProjectBuilderService> logger;
public SubProjectBuilderService(ISiteOptions siteOptions,
ISharePointCustomOperation cpt,
ISharePointAuthenticationManager authMgr,
ISubProjectRepository subProjectRepository,
IFieldEntryDataUpdate fieldEntryDataUpdate,
ILogger<SubProjectBuilderService> logger)
{
this.siteOptions = siteOptions;
this.cpt = cpt;
this.authMgr = authMgr;
this.subProjectRepository = subProjectRepository;
_fieldEntryDataUpdate = fieldEntryDataUpdate;
this.logger = logger;
}
public bool SubProjectDocSet(string projName, List<string> subProjTitle)
public bool SubProjectDocSet(string projName, List<string> listOfSubProjIds)
{
try
{
@@ -70,51 +74,56 @@ internal class SubProjectBuilderService : ISubProjectBuilderService
#endregion
foreach (var spt in subProjTitle)
foreach (var subProjId in listOfSubProjIds)
{
if (cpt.FolderExistsInsideList(ctx, listTitle, spt) == false)
if (cpt.FolderExistsInsideList(ctx, listTitle, subProjId))
{
Console.WriteLine($"> Inizializzata la fase di creazione per {spt}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, spt, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {spt} creata.");
var dsItem = list.RootFolder.Folders.GetByUrl(spt).ListItemAllFields;
dsItem["_ExtendedDescription"] = subProjectRepository.DefaultDescription(projName);
dsItem["PAL_Item"] = subProjectRepository.DefaultItem(projName);
dsItem["PAL_ItemCode"] = subProjectRepository.DefaultItemCode(projName);
dsItem["PAL_ItemDescription"] = subProjectRepository.DefaultItemDescription(projName);
dsItem["PAL_SerialNumber"] = subProjectRepository.DefaultSerialNumber(projName);
dsItem.Update();
ctx.ExecuteQuery();
Console.WriteLine($"> Field value update.");
#endregion
#region SubProject Folder
foreach (var name in Folders.SubProjectDocSet)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {spt}");
var rPath = ResourcePath.FromDecodedUrl($"{spt}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
Console.WriteLine($"Le sotto cartelle sono state create con successo in {spt}");
#endregion
Console.WriteLine($"> {spt} creato con successo in SottoCommesse {projName}.");
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, projName, FieldUpdateType.SubProject);
continue;
}
Console.WriteLine($"> Inizializzata la fase di creazione per {subProjId}.");
#region DocSet Field Entry
DocumentSet.Create(ctx, list.RootFolder, subProjId, contentType.Id);
ctx.ExecuteQuery();
Console.WriteLine($"> DocumentSet {subProjId} creata.");
//var dsItem = list.RootFolder.Folders.GetByUrl(subProjId).ListItemAllFields;
//dsItem["_ExtendedDescription"] = subProjectRepository.DefaultDescription(projName);
//dsItem["PAL_Item"] = subProjectRepository.DefaultItem(projName);
//dsItem["PAL_ItemCode"] = subProjectRepository.DefaultItemCode(projName);
//dsItem["PAL_ItemDescription"] = subProjectRepository.DefaultItemDescription(projName);
//dsItem["PAL_SerialNumber"] = subProjectRepository.DefaultSerialNumber(projName);
//dsItem["PAL_Status"] = subProjectRepository.DefaultState(projName);
//dsItem.Update();
//ctx.ExecuteQuery();
_fieldEntryDataUpdate.FieldUpdate(ctx, listTitle, subProjId, FieldUpdateType.SubProject);
Console.WriteLine($"> Field value update.");
#endregion
#region SubProject Folder
foreach (var name in Folders.SubProjectDocSet)
{
Console.WriteLine($"La sotto cartella {name} verrà creata in {subProjId}");
var rPath = ResourcePath.FromDecodedUrl($"{subProjId}/{name}");
list.RootFolder.AddSubFolderUsingPath(rPath);
}
ctx.ExecuteQuery();
Console.WriteLine($"Le sotto cartelle sono state create con successo in {subProjId}");
#endregion
Console.WriteLine($"> {subProjId} creato con successo in SottoCommesse {projName}.");
}
}
catch (Exception ex)
+4 -4
View File
@@ -1,9 +1,9 @@
using console_spo_utils.Constants;
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Constants;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class SubSiteService : ISubSiteService
{
@@ -106,7 +106,7 @@ internal class SubSiteService : ISubSiteService
{
foreach (var fieldName in Fields.SubSiteProject)
{
var fields = siteField.Fields.GetByTitle(fieldName);
var fields = siteField.Fields.GetByInternalNameOrTitle(fieldName);
list.Fields.Add(fields);
}
ctx.ExecuteQuery();
+6 -6
View File
@@ -1,9 +1,9 @@
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Enums;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.Online.SharePoint.TenantAdministration;
using console_spo_utils.Enums;
namespace console_spo_utils.Services;
namespace library_spo_utils.Services;
internal class TenantService : ITenantService
{
@@ -30,11 +30,11 @@ internal class TenantService : ITenantService
this.siteOptions = siteOptions;
}
public void CreateForProject()
public void CreateForProject(string projName)
{
TenantCreation(
siteOptions.GetProjYearTenant(),
siteOptions.GetProjectYearSite(),
siteOptions.GetProjYearTenant(projName),
siteOptions.GetProjectYearSite(projName),
PalFieldType.Project
);
}
+2 -3
View File
@@ -1,10 +1,9 @@
using console_spo_utils.Interfaces.Services;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Logging;
using Microsoft.SharePoint.Client;
using Microsoft.SharePoint.Client.WebParts;
namespace console_spo_utils.Services
namespace library_spo_utils.Services
{
internal class WebpartService : IWebpartService
{
+49 -21
View File
@@ -1,8 +1,10 @@
using Microsoft.Extensions.Hosting;
using library_spo_utils.Interfaces.Repositories;
using library_spo_utils.Interfaces.Services;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using console_spo_utils.Interfaces.Services;
using Microsoft.SharePoint.Client;
namespace console_spo_utils.Workers
namespace library_spo_utils.Workers
{
internal class MainWorker : BackgroundService
{
@@ -20,29 +22,55 @@ namespace console_spo_utils.Workers
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
var buildProjectsResult = structureBuilder.BuildProject("CT0000");
await Task.CompletedTask;
if (!buildProjectsResult)
{
logger.LogError("Impossible to create structure");
return;
}
//var buildProjectsResult = structureBuilder.BuildProject("CT22-TEST");
var buildQuotationResult = structureBuilder.BuildQuotation("OF0001");
//if (!buildProjectsResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
if (!buildQuotationResult)
{
logger.LogError("Impossible to create structure");
return;
}
//var buildQuotationResult = structureBuilder.BuildQuotation("OF23-TEST");
var buildNonComplianceResult = structureBuilder.BuildNonCompliance("NC0002");
//if (!buildQuotationResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
if (!buildNonComplianceResult)
{
logger.LogError("Impossible to create structure");
return;
}
//var buildNonComplianceResult = structureBuilder.BuildNonCompliance("NC22-TEST");
//if (!buildNonComplianceResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
//var buildPurchasingOrderResult = structureBuilder.BuildPurchasingOrder("PO22-TEST");
//if (!buildPurchasingOrderResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
//var buildPurchasingPackingSlipResult = structureBuilder.BuildPurchasingPackingSlip("DA22-TEST");
//if (!buildPurchasingPackingSlipResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
//var buildPurchasingResquestResult = structureBuilder.BuildPurchasingRequest("RDA22-TEST");
//if (!buildPurchasingResquestResult)
//{
// logger.LogError("Impossible to create structure");
// return;
//}
}
}
}
File diff suppressed because it is too large Load Diff
+10 -14
View File
@@ -8,20 +8,16 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="6.0.9" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.PowerPlatform.Dataverse.Client" Version="1.0.9" />
<PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.22810.12000" />
<PackageReference Include="PnP.Core" Version="1.7.0" />
<PackageReference Include="PnP.Core.Admin" Version="1.7.0" />
<PackageReference Include="PnP.Core.Auth" Version="1.7.0" />
<PackageReference Include="PnP.Framework" Version="1.10.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.23.1" />
</ItemGroup>
<ItemGroup>
<Folder Include="Fakes\Repositories\" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Authentication" Version="7.0.5" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="7.0.0" />
<PackageReference Include="Microsoft.PowerPlatform.Dataverse.Client" Version="1.0.39" />
<PackageReference Include="Microsoft.SharePointOnline.CSOM" Version="16.1.23508.12000" />
<PackageReference Include="PnP.Core" Version="1.9.0" />
<PackageReference Include="PnP.Core.Admin" Version="1.9.0" />
<PackageReference Include="PnP.Core.Auth" Version="1.9.0" />
<PackageReference Include="PnP.Framework" Version="1.12.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.30.0" />
</ItemGroup>
</Project>
@@ -1,4 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
@@ -5,6 +5,7 @@ build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = library_spo_utils
build_property.ProjectDir = C:\Sources\VS\console_spo_utils\library_spo_utils\
build_property.ProjectDir = C:\Sources\VS\web_portal\library_spo_utils\
@@ -169,3 +169,137 @@ C:\Sources\VS\console_spo_utils\library_spo_utils\obj\Debug\net6.0\refint\librar
C:\Sources\VS\console_spo_utils\library_spo_utils\obj\Debug\net6.0\library_spo_utils.pdb
C:\Sources\VS\console_spo_utils\library_spo_utils\obj\Debug\net6.0\library_spo_utils.genruntimeconfig.cache
C:\Sources\VS\console_spo_utils\library_spo_utils\obj\Debug\net6.0\ref\library_spo_utils.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\library_spo_utils.exe
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\library_spo_utils.deps.json
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\library_spo_utils.runtimeconfig.json
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\library_spo_utils.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\library_spo_utils.pdb
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\AngleSharp.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\AngleSharp.Css.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.ApplicationInsights.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.Hosting.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.Hosting.Server.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.Http.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.Http.Extensions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.Http.Features.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.AspNetCore.StaticFiles.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Bcl.AsyncInterfaces.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Caching.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Caching.Memory.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.Binder.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.CommandLine.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.FileExtensions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.Json.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Configuration.UserSecrets.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.DependencyInjection.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileProviders.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileProviders.Physical.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.FileSystemGlobbing.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Hosting.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Hosting.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Http.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Configuration.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Console.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.Debug.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.EventLog.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Logging.EventSource.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.ObjectPool.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Options.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.Primitives.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Extensions.WebEncoders.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Graph.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Graph.Core.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Identity.Client.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Identity.Client.Extensions.Msal.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.IdentityModel.Abstractions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.IdentityModel.JsonWebTokens.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.IdentityModel.Logging.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.IdentityModel.Tokens.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Net.Http.Headers.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Crm.Sdk.Proxy.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.PowerPlatform.Dataverse.Client.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Xrm.Sdk.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Rest.ClientRuntime.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Office.Client.Policy.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Office.Client.TranslationServices.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Office.SharePoint.Tools.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Online.SharePoint.Client.Tenant.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.ProjectServer.Client.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.DocumentManagement.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.Publishing.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.Runtime.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.Search.Applications.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.Search.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.Taxonomy.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.UserProfiles.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.WorkflowServices.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.SharePoint.Client.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Microsoft.Win32.SystemEvents.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Newtonsoft.Json.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\PnP.Core.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\PnP.Core.Admin.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\PnP.Core.Auth.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\PnP.Framework.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\Portable.Xaml.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Configuration.ConfigurationManager.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Diagnostics.EventLog.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.DirectoryServices.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Drawing.Common.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.IdentityModel.Tokens.Jwt.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.IO.Packaging.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Private.ServiceModel.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Runtime.Caching.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Security.Cryptography.Pkcs.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Security.Cryptography.ProtectedData.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Security.Cryptography.Xml.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Security.Permissions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.ServiceModel.Http.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.ServiceModel.Primitives.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.ServiceModel.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Text.Json.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Windows.Extensions.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\TimeZoneConverter.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\cs\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\de\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\es\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\fr\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\it\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\ja\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\ko\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\pl\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\pt-BR\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\ru\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\tr\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\zh-Hans\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\zh-Hant\System.Private.ServiceModel.resources.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\Microsoft.Win32.SystemEvents.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Diagnostics.EventLog.Messages.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Diagnostics.EventLog.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.DirectoryServices.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\unix\lib\net6.0\System.Drawing.Common.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Drawing.Common.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\netstandard2.0\System.Runtime.Caching.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Security.Cryptography.ProtectedData.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Windows.Extensions.dll
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.csproj.AssemblyReference.cache
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.GeneratedMSBuildEditorConfig.editorconfig
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.AssemblyInfoInputs.cache
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.AssemblyInfo.cs
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.csproj.CoreCompileInputs.cache
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.csproj.CopyComplete
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.dll
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\refint\library_spo_utils.dll
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.pdb
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\library_spo_utils.genruntimeconfig.cache
C:\Sources\VS\web_portal\library_spo_utils\obj\Debug\net6.0\ref\library_spo_utils.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Diagnostics.DiagnosticSource.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\System.Text.Encodings.Web.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\win\lib\net6.0\System.Security.Cryptography.Pkcs.dll
C:\Sources\VS\web_portal\library_spo_utils\bin\Debug\net6.0\runtimes\browser\lib\net6.0\System.Text.Encodings.Web.dll
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
@@ -0,0 +1,23 @@
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
// Versione runtime:4.0.30319.42000
//
// Le modifiche apportate a questo file possono provocare un comportamento non corretto e andranno perse se
// il codice viene rigenerato.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("library_spo_utils")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("library_spo_utils")]
[assembly: System.Reflection.AssemblyTitleAttribute("library_spo_utils")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generato dalla classe WriteCodeFragment di MSBuild.
@@ -0,0 +1,11 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property.EnforceExtendedAnalyzerRules =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = library_spo_utils
build_property.ProjectDir = C:\Sources\VS\web_portal\library_spo_utils\
@@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
@@ -1,25 +1,28 @@
{
"format": 1,
"restore": {
"C:\\Sources\\VS\\console_spo_utils\\library_spo_utils\\library_spo_utils.csproj": {}
"C:\\Sources\\VS\\web_portal\\library_spo_utils\\library_spo_utils.csproj": {}
},
"projects": {
"C:\\Sources\\VS\\console_spo_utils\\library_spo_utils\\library_spo_utils.csproj": {
"C:\\Sources\\VS\\web_portal\\library_spo_utils\\library_spo_utils.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Sources\\VS\\console_spo_utils\\library_spo_utils\\library_spo_utils.csproj",
"projectUniqueName": "C:\\Sources\\VS\\web_portal\\library_spo_utils\\library_spo_utils.csproj",
"projectName": "library_spo_utils",
"projectPath": "C:\\Sources\\VS\\console_spo_utils\\library_spo_utils\\library_spo_utils.csproj",
"projectPath": "C:\\Sources\\VS\\web_portal\\library_spo_utils\\library_spo_utils.csproj",
"packagesPath": "C:\\Users\\cbo\\.nuget\\packages\\",
"outputPath": "C:\\Sources\\VS\\console_spo_utils\\library_spo_utils\\obj\\",
"outputPath": "C:\\Sources\\VS\\web_portal\\library_spo_utils\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"C:\\Program Files\\DevExpress 22.1\\Components\\Offline Packages",
"C:\\Program Files\\DevExpress 22.2\\Components\\Offline Packages",
"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\NuGetPackages"
],
"configFilePaths": [
"C:\\Sources\\VS\\web_portal\\NuGet.Config",
"C:\\Users\\cbo\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 22.1.config",
"C:\\Program Files (x86)\\NuGet\\Config\\DevExpress 22.2.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
@@ -29,8 +32,11 @@
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"C:\\Program Files\\DevExpress 22.1\\Components\\System\\Components\\Packages": {},
"C:\\Program Files\\DevExpress 22.2\\Components\\System\\Components\\Packages": {},
"C:\\Program Files\\DevExpress 22.2\\DevExtreme\\System\\DevExtreme\\Bin\\AspNetCore": {},
"C:\\Program Files\\dotnet\\library-packs": {},
"https://api.nuget.org/v3/index.json": {}
"https://api.nuget.org/v3/index.json": {},
"https://devops.pal.it/IT/_packaging/LibraryFeed/nuget/v3/index.json": {}
},
"frameworks": {
"net6.0": {
@@ -50,43 +56,43 @@
"dependencies": {
"Microsoft.AspNetCore.Components.WebAssembly.Authentication": {
"target": "Package",
"version": "[6.0.9, )"
"version": "[7.0.5, )"
},
"Microsoft.Extensions.Hosting": {
"target": "Package",
"version": "[6.0.1, )"
"version": "[7.0.1, )"
},
"Microsoft.Extensions.Hosting.Abstractions": {
"target": "Package",
"version": "[6.0.0, )"
"version": "[7.0.0, )"
},
"Microsoft.PowerPlatform.Dataverse.Client": {
"target": "Package",
"version": "[1.0.9, )"
"version": "[1.0.39, )"
},
"Microsoft.SharePointOnline.CSOM": {
"target": "Package",
"version": "[16.1.22810.12000, )"
"version": "[16.1.23508.12000, )"
},
"PnP.Core": {
"target": "Package",
"version": "[1.7.0, )"
"version": "[1.9.0, )"
},
"PnP.Core.Admin": {
"target": "Package",
"version": "[1.7.0, )"
"version": "[1.9.0, )"
},
"PnP.Core.Auth": {
"target": "Package",
"version": "[1.7.0, )"
"version": "[1.9.0, )"
},
"PnP.Framework": {
"target": "Package",
"version": "[1.10.0, )"
"version": "[1.12.0, )"
},
"System.IdentityModel.Tokens.Jwt": {
"target": "Package",
"version": "[6.23.1, )"
"version": "[6.30.0, )"
}
},
"imports": [
@@ -105,7 +111,7 @@
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\6.0.400\\RuntimeIdentifierGraph.json"
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.302\\RuntimeIdentifierGraph.json"
}
}
}
@@ -5,17 +5,18 @@
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\cbo\.nuget\packages\;C:\Program Files\DevExpress 22.1\Components\Offline Packages;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\cbo\.nuget\packages\;C:\Program Files\DevExpress 22.1\Components\Offline Packages;C:\Program Files\DevExpress 22.2\Components\Offline Packages;C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.3.0</NuGetToolVersion>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.6.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\cbo\.nuget\packages\" />
<SourceRoot Include="C:\Program Files\DevExpress 22.1\Components\Offline Packages\" />
<SourceRoot Include="C:\Program Files\DevExpress 22.2\Components\Offline Packages\" />
<SourceRoot Include="C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages\" />
</ItemGroup>
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\6.0.9\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\6.0.9\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Configuration.UserSecrets.props" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Configuration.UserSecrets.props')" />
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\7.0.5\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.components.webassembly.authentication\7.0.5\buildTransitive\Microsoft.AspNetCore.Components.WebAssembly.Authentication.props')" />
</ImportGroup>
</Project>
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\6.0.1\buildTransitive\netstandard2.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.aspnetcore.components.analyzers\6.0.9\buildTransitive\netstandard2.0\Microsoft.AspNetCore.Components.Analyzers.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.aspnetcore.components.analyzers\6.0.9\buildTransitive\netstandard2.0\Microsoft.AspNetCore.Components.Analyzers.targets')" />
<Import Project="$(NuGetPackageRoot)system.text.json\7.0.0\buildTransitive\net6.0\System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json\7.0.0\buildTransitive\net6.0\System.Text.Json.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.logging.abstractions\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Logging.Abstractions.targets')" />
<Import Project="$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Configuration.UserSecrets.targets" Condition="Exists('$(NuGetPackageRoot)microsoft.extensions.configuration.usersecrets\7.0.0\buildTransitive\net6.0\Microsoft.Extensions.Configuration.UserSecrets.targets')" />
</ImportGroup>
</Project>

Some files were not shown because too many files have changed in this diff Show More