Service update, import changes from web_portal
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user