Compare commits
15 Commits
1b22ffa439
...
aa38d17daf
| Author | SHA1 | Date | |
|---|---|---|---|
| aa38d17daf | |||
| d4fcbe0dc6 | |||
| 6a7bc39ff8 | |||
| b3a2ee7285 | |||
| a2326315a6 | |||
| 8684e97db7 | |||
| 1946623c9e | |||
| 40e7a3f8e0 | |||
| f0df620dc9 | |||
| 6a2bc0b4ab | |||
| c4036471f7 | |||
| e19cb5fcda | |||
| e68a1a4c3b | |||
| 7ddda56987 | |||
| 77f45fabb1 |
@ -1,105 +0,0 @@
|
|||||||
trigger:
|
|
||||||
branches:
|
|
||||||
include:
|
|
||||||
- Development
|
|
||||||
paths:
|
|
||||||
include:
|
|
||||||
- "Fab2ApprovalSystem/*"
|
|
||||||
exclude:
|
|
||||||
- "**/*.yaml"
|
|
||||||
- "**/*.yml"
|
|
||||||
- "SQL/*"
|
|
||||||
- "references/*"
|
|
||||||
- "packages/*"
|
|
||||||
- "Kendo/*"
|
|
||||||
|
|
||||||
pool:
|
|
||||||
name: Mesa-IIS
|
|
||||||
demands: Fab2ApprovalSystem-Development
|
|
||||||
|
|
||||||
variables:
|
|
||||||
# solution: '**/*.sln'
|
|
||||||
# buildPlatform: 'Any CPU'
|
|
||||||
buildConfiguration: "Debug"
|
|
||||||
ASPNETCORE_ENVIRONMENT: "Development"
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- script: |
|
|
||||||
set assemblyTitle=Fab2ApprovalSystem
|
|
||||||
echo %assemblyTitle%
|
|
||||||
echo ##vso[task.setvariable variable=AssemblyTitle;]%assemblyTitle%
|
|
||||||
echo $(AssemblyTitle)
|
|
||||||
displayName: AssemblyTitle
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
set targetFrameworkVersion=v4.8
|
|
||||||
echo %targetFrameworkVersion%
|
|
||||||
echo ##vso[task.setvariable variable=TargetFrameworkVersion;]%targetFrameworkVersion%
|
|
||||||
echo $(TargetFrameworkVersion)
|
|
||||||
displayName: TargetFrameworkVersion
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
set coreVersion=na
|
|
||||||
echo %coreVersion%
|
|
||||||
echo ##vso[task.setvariable variable=CoreVersion;]%coreVersion%
|
|
||||||
echo $(CoreVersion)
|
|
||||||
displayName: CoreVersion
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
set configuration=Debug
|
|
||||||
echo %configuration%
|
|
||||||
echo ##vso[task.setvariable variable=Configuration;]%configuration%
|
|
||||||
echo $(Configuration)
|
|
||||||
displayName: Configuration
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
REM set nugetSource=https://messa017.infineon.com/v3/index.json
|
|
||||||
set nugetSource=https://eaf-prod.mes.infineon.com/v3/index.json
|
|
||||||
echo %nugetSource%
|
|
||||||
echo ##vso[task.setvariable variable=NugetSource;]%nugetSource%
|
|
||||||
echo $(NugetSource)
|
|
||||||
displayName: NugetSource
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
set gitCommit=$(Build.SourceVersion)
|
|
||||||
set gitCommitSeven=%gitCommit:~0,7%
|
|
||||||
echo %gitCommitSeven%
|
|
||||||
echo ##vso[task.setvariable variable=GitCommitSeven;]%gitCommitSeven%
|
|
||||||
echo $(GitCommitSeven)
|
|
||||||
displayName: GitCommitSeven
|
|
||||||
|
|
||||||
- script: |
|
|
||||||
echo $(AssemblyTitle)
|
|
||||||
echo $(Build.BuildId)
|
|
||||||
echo $(Build.Reason)
|
|
||||||
echo $(Build.Repository.Id)
|
|
||||||
echo $(Build.Repository.Name)
|
|
||||||
echo $(Build.SourceVersion)
|
|
||||||
echo $(CoreVersion)
|
|
||||||
echo $(Configuration)
|
|
||||||
echo $(NugetSource)
|
|
||||||
echo $(GitCommitSeven)
|
|
||||||
echo $(TargetFrameworkVersion)
|
|
||||||
REM echo $(pipelinePassword)
|
|
||||||
displayName: "Echo Check"
|
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Restore /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:RestoreSources=$(NugetSource) $(AssemblyTitle).csproj'
|
|
||||||
workingDirectory: Fab2ApprovalSystem
|
|
||||||
displayName: "Framework Restore"
|
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /target:Build /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) $(AssemblyTitle).csproj'
|
|
||||||
workingDirectory: Fab2ApprovalSystem
|
|
||||||
displayName: "Framework Build"
|
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe" /DetailedSummary /ConsoleLoggerParameters:PerformanceSummary;ErrorsOnly; /p:Configuration=$(Configuration);TargetFrameworkVersion=$(TargetFrameworkVersion) /p:DebugSymbols=false /p:DeleteExistingFiles=true /p:DeployOnBuild=true /p:EnableUpdateAble=true /p:ExcludeApp_Data=true /p:LastUsedBuildConfiguration=$(Configuration) /p:LastUsedPlatform="Any CPU" /p:LaunchSiteAfterPublish=true /p:OutputPath="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" /p:PreCompileBeforePublish=true /p:PublishProvider=FileSystem /p:PublishUrl="D:/PublishUrl" /p:SiteUrlToLaunchAfterPublish="" /p:WDPMergeOption=DoNotMerge /p:WebPublishMethod=FileSystem $(AssemblyTitle).csproj'
|
|
||||||
workingDirectory: Fab2ApprovalSystem
|
|
||||||
displayName: "Framework Pack"
|
|
||||||
|
|
||||||
- script: '"C:/Program Files (x86)/IIS/Microsoft Web Deploy V3/MSDeploy.exe" -AllowUntrusted -dest:auto -disableLink:AppPoolExtension -disableLink:CertificateExtension -disableLink:ContentExtension -setParam:name="IIS Web Application Name",value=$(Build.Repository.Name) -setParamFile:"D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(Build.Repository.Name)_Package/$(Build.Repository.Name).SetParameters.xml" -source:package="D:\$(TargetFrameworkVersion)\$(Build.Repository.Name)\$(GitCommitSeven)-$(Build.BuildId)-$(Build.Repository.Name)-$(Configuration)" "/_PublishedWebsites/$(AssemblyTitle)_Package/$(AssemblyTitle).zip" -verb:sync'
|
|
||||||
workingDirectory: Fab2ApprovalSystem
|
|
||||||
displayName: "Framework Deploy"
|
|
||||||
enabled: false
|
|
||||||
|
|
||||||
- script: 'echo $(Build.SourceVersion)-$(Build.BuildId)>bin_x_x_\$(Configuration)\$(CoreVersion)\win-x64\$(Build.Repository.Name).txt'
|
|
||||||
displayName: "Force Fail"
|
|
||||||
enabled: false
|
|
||||||
@ -1,18 +1,19 @@
|
|||||||
/*vertical height between form-groups*/
|
/*vertical height between form-groups*/
|
||||||
.my-form .form-group {
|
.my-form .form-group {
|
||||||
margin-bottom: 4px;
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width:768px) {
|
||||||
|
.my-form .row {
|
||||||
|
margin-left: -1px;
|
||||||
|
margin-right: -1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-width:768px) {
|
.my-form [class*="col-"] {
|
||||||
.my-form .row {
|
padding: 0 2px;
|
||||||
margin-left: -1px;
|
|
||||||
margin-right: -1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.my-form [class*="col-"] {
|
|
||||||
padding: 0 2px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
padding-top: 50px;
|
padding-top: 50px;
|
||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
@ -29,12 +30,12 @@ body {
|
|||||||
/*input,
|
/*input,
|
||||||
select
|
select
|
||||||
{
|
{
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
.row{
|
.row {
|
||||||
margin-top: 2px;
|
margin-top: 2px;
|
||||||
margin-bottom: 2px
|
margin-bottom: 2px
|
||||||
}
|
}
|
||||||
|
|
||||||
textarea {
|
textarea {
|
||||||
@ -68,28 +69,28 @@ input[type="checkbox"].input-validation-error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.navbar-inner {
|
.navbar-inner {
|
||||||
padding-left: 20px;
|
padding-left: 20px;
|
||||||
padding-right: 20px;
|
padding-right: 20px;
|
||||||
background-color: #87b3de;
|
background-color: #87b3de;
|
||||||
background-image: -moz-linear-gradient(top,#87b3de, #4d79a5);
|
background-image: -moz-linear-gradient(top, #87b3de, #4d79a5);
|
||||||
background-image: -ms-linear-gradient(top,#87b3de, #4d79a5);
|
background-image: -ms-linear-gradient(top, #87b3de, #4d79a5);
|
||||||
background-image: -webkit-gradient(linear, 0 0, 0 50%, from( #87b3de), to(#4d79a5));
|
background-image: -webkit-gradient(linear, 0 0, 0 50%, from(#87b3de), to(#4d79a5));
|
||||||
background-image: -webkit-linear-gradient(top,#87b3de, #4d79a5);
|
background-image: -webkit-linear-gradient(top, #87b3de, #4d79a5);
|
||||||
background-image: -o-linear-gradient(top, #87b3de, #4d79a5);
|
background-image: -o-linear-gradient(top, #87b3de, #4d79a5);
|
||||||
background-image: linear-gradient(top, #87b3de, #4d79a5);
|
background-image: linear-gradient(top, #87b3de, #4d79a5);
|
||||||
background-repeat: repeat-x;
|
background-repeat: repeat-x;
|
||||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#87b3de', endColorstr='#4d79a5', GradientType=0);
|
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#87b3de', endColorstr='#4d79a5', GradientType=0);
|
||||||
-webkit-border-radius: 4px;
|
-webkit-border-radius: 4px;
|
||||||
-moz-border-radius: 4px;
|
-moz-border-radius: 4px;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||||
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25), inset 0 -1px 0 rgba(0, 0, 0, 0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
.label-color {
|
.label-color {
|
||||||
background-color: #e5e0e0;
|
background-color: #e5e0e0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.linkbutton {
|
.linkbutton {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
@ -101,6 +102,17 @@ input[type="checkbox"].input-validation-error {
|
|||||||
border: 0;
|
border: 0;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.linkbutton.edit {
|
.linkbutton.edit {
|
||||||
background: url('/Content/icons/edit.gif');
|
background: url('/Content/icons/edit.gif');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modal-dialog {
|
||||||
|
margin-top: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.affix {
|
||||||
|
position: fixed;
|
||||||
|
top: 55px;
|
||||||
|
left: 25px;
|
||||||
|
}
|
||||||
@ -24,12 +24,9 @@ namespace Fab2ApprovalSystem.Controllers;
|
|||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AccountController : Controller {
|
public class AccountController : Controller {
|
||||||
private string _apiBaseUrl;
|
|
||||||
|
|
||||||
public AccountController()
|
public AccountController()
|
||||||
: this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) {
|
: this(new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()))) {
|
||||||
_apiBaseUrl = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
|
|
||||||
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AccountController(UserManager<ApplicationUser> userManager) {
|
public AccountController(UserManager<ApplicationUser> userManager) {
|
||||||
@ -69,7 +66,7 @@ public class AccountController : Controller {
|
|||||||
bool isLoginValid;
|
bool isLoginValid;
|
||||||
|
|
||||||
HttpClient httpClient = HttpClientFactory.Create();
|
HttpClient httpClient = HttpClientFactory.Create();
|
||||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
|
||||||
|
|
||||||
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
|
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
|
||||||
|
|
||||||
@ -121,7 +118,7 @@ public class AccountController : Controller {
|
|||||||
bool isLoginValid;
|
bool isLoginValid;
|
||||||
|
|
||||||
HttpClient httpClient = HttpClientFactory.Create();
|
HttpClient httpClient = HttpClientFactory.Create();
|
||||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
|
||||||
|
|
||||||
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);
|
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);
|
||||||
|
|
||||||
|
|||||||
@ -52,9 +52,7 @@ public class ChangeControlController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
||||||
"https://localhost:7255";
|
|
||||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
@ -64,9 +62,7 @@ public class ChangeControlController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
||||||
"https://localhost:7255";
|
|
||||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -601,7 +601,7 @@ public class ECNController : PdfViewController {
|
|||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
emailSentList = ECNHelper.NotifySubmitter(_AppSettings, ecnNumber, ecnTypeString, ecn);
|
emailSentList = ECNHelper.NotifySubmitter(_AppSettings, ecnNumber, ecnTypeString, ecn);
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -625,7 +625,7 @@ public class ECNController : PdfViewController {
|
|||||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
IEnumerable<int> ecnAdminIDs = MiscDMO.GetUserIDsBySubRoleID(383);
|
IEnumerable<int> ecnAdminIDs = MiscDMO.GetUserIDsBySubRoleID(383);
|
||||||
foreach (int id in ecnAdminIDs) {
|
foreach (int id in ecnAdminIDs) {
|
||||||
emailSentList = ECNHelper.NotifyAdmin(_AppSettings, ecnNumber, ecnTypeString, ecn, id);
|
emailSentList = ECNHelper.NotifyAdmin(_AppSettings, ecnNumber, ecnTypeString, ecn, id);
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -650,7 +650,7 @@ public class ECNController : PdfViewController {
|
|||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
||||||
emailSentList = ECNHelper.NotifyApprovers(_AppSettings, ecnNumber, ecnTypeString, emailSentList, ecn, emailIst);
|
emailSentList = ECNHelper.NotifyApprovers(_AppSettings, ecnNumber, ecnTypeString, emailSentList, ecn, emailIst);
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -953,8 +953,7 @@ public class ECNController : PdfViewController {
|
|||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyApproversForCancellation(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
|
public void NotifyApproversForCancellation(int ecnNumber, ECN ecn, byte currentStep, int documentType, string ecnTypeString) {
|
||||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
|
||||||
string emailSentList = ECNHelper.NotifyApproversForCancellation(_AppSettings, ecnNumber, currentStep, documentType, ecnTypeString, ecn);
|
string emailSentList = ECNHelper.NotifyApproversForCancellation(_AppSettings, ecnNumber, currentStep, documentType, ecnTypeString, ecn);
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Approvers for Step " + currentStep.ToString() + ":" + emailSentList });
|
||||||
@ -977,10 +976,10 @@ public class ECNController : PdfViewController {
|
|||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath) {
|
public void NotifyTECNCancellation(int ecnNumber, string ecnFolderPath, string comments) {
|
||||||
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
List<int> notificationUserList = ecnDMO.GetTECNNotificationUsers().ToList();
|
List<int> notificationUserList = ecnDMO.GetTECNNotificationUsers().ToList();
|
||||||
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, ecn, notificationUserList);
|
string emailSentList = ECNHelper.NotifyTECNCancellation(_AppSettings, userDMO, ecnNumber, ecnFolderPath, comments, ecn, notificationUserList);
|
||||||
try {
|
try {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "E-TECN", OperationType = "Email", Comments = "Approvers for Cancellation :" + emailSentList });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "E-TECN", OperationType = "Email", Comments = "Approvers for Cancellation :" + emailSentList });
|
||||||
} catch { }
|
} catch { }
|
||||||
@ -1157,22 +1156,24 @@ public class ECNController : PdfViewController {
|
|||||||
return Content(ecnDMO.PCRBExists(pcrb).ToString());
|
return Content(ecnDMO.PCRBExists(pcrb).ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString) {
|
public ActionResult CancelDocument(int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string comments = "") {
|
||||||
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
bool lastApproverAndLastStep = false;
|
bool lastApproverAndLastStep = false;
|
||||||
|
if (ecn.IsTECN && ecn.SubmitedDate is not null && currentStep >= 1)
|
||||||
|
Approve(ecnNumber, currentStep, comments, documentType, ecnTypeString);
|
||||||
int appoverCount = ecnDMO.SubmitForCancellation(ecnNumber, (byte)GlobalVars.WorkFLowStepNumber.Step1, (int)Session[GlobalVars.SESSION_USERID], documentType, ecnTypeString, (int)GlobalVars.TECNExpirationCancellation.Cancellation);
|
int appoverCount = ecnDMO.SubmitForCancellation(ecnNumber, (byte)GlobalVars.WorkFLowStepNumber.Step1, (int)Session[GlobalVars.SESSION_USERID], documentType, ecnTypeString, (int)GlobalVars.TECNExpirationCancellation.Cancellation);
|
||||||
if (appoverCount > 0) {
|
if (appoverCount > 0) {
|
||||||
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
|
NotifyApproversForCancellation(ecnNumber, ecn, currentStep, documentType, ecnTypeString);
|
||||||
} else // TODO Automatically close the
|
} else { // TODO Automatically close the
|
||||||
{
|
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, comments, documentType, ecnTypeString);
|
||||||
lastApproverAndLastStep = ApproveCancellation(ecnNumber, currentStep, "", documentType, ecnTypeString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!lastApproverAndLastStep) {
|
if (!lastApproverAndLastStep) {
|
||||||
try {
|
try {
|
||||||
lastApproverAndLastStep = true;
|
lastApproverAndLastStep = true;
|
||||||
|
|
||||||
ECNPdf ecn = new ECNPdf();
|
ECNPdf ecnPDF = new ECNPdf();
|
||||||
GenerateECNPdf(ecnNumber, out ecn);
|
GenerateECNPdf(ecnNumber, out ecnPDF);
|
||||||
|
|
||||||
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
||||||
string outputFullFilePath = "";
|
string outputFullFilePath = "";
|
||||||
@ -1184,7 +1185,7 @@ public class ECNController : PdfViewController {
|
|||||||
|
|
||||||
Zipper zip = new Zipper();
|
Zipper zip = new Zipper();
|
||||||
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
||||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
|
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
||||||
@ -1208,19 +1209,20 @@ public class ECNController : PdfViewController {
|
|||||||
public bool ApproveCancellation(int ecnNumber, byte currentStep, string comments, int documentType, string ecnTypeString) {
|
public bool ApproveCancellation(int ecnNumber, byte currentStep, string comments, int documentType, string ecnTypeString) {
|
||||||
bool lastApproverAndLastStep = false;
|
bool lastApproverAndLastStep = false;
|
||||||
bool lastStep = false;
|
bool lastStep = false;
|
||||||
|
ECN ecn = ecnDMO.GetECN(ecnNumber);
|
||||||
bool lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
|
bool lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
|
||||||
while (lastApprover && !lastStep) {
|
while (lastApprover && !lastStep) {
|
||||||
currentStep++;
|
currentStep++;
|
||||||
lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
|
lastApprover = ecnDMO.ECNApproveCancelled_ExpiredDocument(ecnNumber, currentStep, comments, out lastStep, (int)Session[GlobalVars.SESSION_USERID], documentType);
|
||||||
NotifyApproversForCancellation(ecnNumber, currentStep, documentType, ecnTypeString);
|
NotifyApproversForCancellation(ecnNumber, ecn, currentStep, documentType, ecnTypeString);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastApprover && lastStep) {
|
if (lastApprover && lastStep) {
|
||||||
try {
|
try {
|
||||||
lastApproverAndLastStep = true;
|
lastApproverAndLastStep = true;
|
||||||
|
|
||||||
ECNPdf ecn = new ECNPdf();
|
ECNPdf ecnPDF = new ECNPdf();
|
||||||
GenerateECNPdf(ecnNumber, out ecn);
|
GenerateECNPdf(ecnNumber, out ecnPDF);
|
||||||
|
|
||||||
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
string sourceDirectory = _AppSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString() + "\\";
|
||||||
string outputFullFilePath = "";
|
string outputFullFilePath = "";
|
||||||
@ -1232,7 +1234,7 @@ public class ECNController : PdfViewController {
|
|||||||
|
|
||||||
Zipper zip = new Zipper();
|
Zipper zip = new Zipper();
|
||||||
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
zip.CreateZip(outputFullFilePath, sourceDirectory);
|
||||||
NotifyTECNCancellation(ecnNumber, outputFullFilePath);
|
NotifyTECNCancellation(ecnNumber, outputFullFilePath, comments);
|
||||||
|
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = @User.Identity.Name, DocumentType = "TECN", OperationType = "Error", Comments = ex.Message });
|
||||||
|
|||||||
@ -79,9 +79,7 @@ public class MRBController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
||||||
"https://localhost:7255";
|
|
||||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
@ -104,9 +102,7 @@ public class MRBController : Controller {
|
|||||||
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
string refreshToken = Session["RefreshToken"].ToString();
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
||||||
"https://localhost:7255";
|
|
||||||
string mrbUrl = $"{wasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/mrb/{issueID}";
|
|
||||||
|
|
||||||
return Redirect(mrbUrl);
|
return Redirect(mrbUrl);
|
||||||
}
|
}
|
||||||
|
|||||||
20
Fab2ApprovalSystem/Controllers/PCRBController.cs
Normal file
20
Fab2ApprovalSystem/Controllers/PCRBController.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
|
[Authorize]
|
||||||
|
[SessionExpireFilter]
|
||||||
|
public class PCRBController : Controller {
|
||||||
|
public ActionResult Edit(int issueID) {
|
||||||
|
string jwt = Session["JWT"].ToString();
|
||||||
|
string encodedJwt = System.Net.WebUtility.UrlEncode(jwt);
|
||||||
|
string refreshToken = Session["RefreshToken"].ToString();
|
||||||
|
string encodedRefreshToken = System.Net.WebUtility.UrlEncode(refreshToken);
|
||||||
|
string mrbUrl = $"{GlobalVars.AppSettings.WasmClientUrl}/redirect?jwt={encodedJwt}&refreshToken={encodedRefreshToken}&redirectPath=/pcrb/{issueID}";
|
||||||
|
|
||||||
|
return Redirect(mrbUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -6,6 +6,8 @@ Please review the cancelled TECN form in the attachment.
|
|||||||
<br/><br/>
|
<br/><br/>
|
||||||
https://messa016ec.infineon.com/ECN/Edit?issueID={1}
|
https://messa016ec.infineon.com/ECN/Edit?issueID={1}
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
Comments: {5}
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
If you have any questions or trouble logging on please contact a site administrator.
|
If you have any questions or trouble logging on please contact a site administrator.
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
|
|||||||
17
Fab2ApprovalSystem/EmailTemplates/TECNReturnedToProcess.txt
Normal file
17
Fab2ApprovalSystem/EmailTemplates/TECNReturnedToProcess.txt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<font size="2" face="verdana">
|
||||||
|
*****Please DO NOT reply to this email*****
|
||||||
|
<br/><br/>
|
||||||
|
{3}# {0} has been returned to process. Please remove posted TECN from point of use. The returned to process date is {4}
|
||||||
|
Please review the returned to process TECN form in the attachment.
|
||||||
|
<br/><br/>
|
||||||
|
https://messa016ec.infineon.com/ECN/Edit?issueID={1}
|
||||||
|
<br/><br/>
|
||||||
|
Comments: {5}
|
||||||
|
<br/><br/>
|
||||||
|
|
||||||
|
If you have any questions or trouble logging on please contact a site administrator.
|
||||||
|
<br/><br/>
|
||||||
|
Thank you!
|
||||||
|
|
||||||
|
|
||||||
|
</font>
|
||||||
@ -255,6 +255,7 @@
|
|||||||
<Compile Include="Controllers\TrainingController.cs" />
|
<Compile Include="Controllers\TrainingController.cs" />
|
||||||
<Compile Include="Controllers\WebAPIController.cs" />
|
<Compile Include="Controllers\WebAPIController.cs" />
|
||||||
<Compile Include="Controllers\WorkflowController.cs" />
|
<Compile Include="Controllers\WorkflowController.cs" />
|
||||||
|
<Compile Include="Controllers\PCRBController.cs" />
|
||||||
<Compile Include="DMO\AccountDMO.cs" />
|
<Compile Include="DMO\AccountDMO.cs" />
|
||||||
<Compile Include="DMO\AdminDMO.cs" />
|
<Compile Include="DMO\AdminDMO.cs" />
|
||||||
<Compile Include="DMO\ApprovalLogDMO.cs" />
|
<Compile Include="DMO\ApprovalLogDMO.cs" />
|
||||||
@ -387,8 +388,10 @@
|
|||||||
<Content Include="Views\CorrectiveAction\_D7PAAttachment.cshtml" />
|
<Content Include="Views\CorrectiveAction\_D7PAAttachment.cshtml" />
|
||||||
<Content Include="Views\CorrectiveAction\Edit.cshtml" />
|
<Content Include="Views\CorrectiveAction\Edit.cshtml" />
|
||||||
<Content Include="Views\CorrectiveAction\ReadOnlyCA.cshtml" />
|
<Content Include="Views\CorrectiveAction\ReadOnlyCA.cshtml" />
|
||||||
|
<Content Include="Views\ECN\_ECNCancel.cshtml" />
|
||||||
<Content Include="Views\ECN\_ECNLayout.cshtml" />
|
<Content Include="Views\ECN\_ECNLayout.cshtml" />
|
||||||
<Content Include="Views\ECN\_ECNReassignOriginator.cshtml" />
|
<Content Include="Views\ECN\_ECNReassignOriginator.cshtml" />
|
||||||
|
<Content Include="Views\ECN\_ECNReturnToProcess.cshtml" />
|
||||||
<Content Include="Views\ECN\Acknowledge.cshtml" />
|
<Content Include="Views\ECN\Acknowledge.cshtml" />
|
||||||
<Content Include="Views\ECN\ECNApprovalPdf.cshtml" />
|
<Content Include="Views\ECN\ECNApprovalPdf.cshtml" />
|
||||||
<Content Include="Views\ECN\ECNPdf.cshtml" />
|
<Content Include="Views\ECN\ECNPdf.cshtml" />
|
||||||
@ -513,6 +516,7 @@
|
|||||||
<Content Include="EmailTemplates\TECNExpirationApproval.txt" />
|
<Content Include="EmailTemplates\TECNExpirationApproval.txt" />
|
||||||
<Content Include="EmailTemplates\TECNExpired.txt" />
|
<Content Include="EmailTemplates\TECNExpired.txt" />
|
||||||
<Content Include="EmailTemplates\TECNExtensionReject.txt" />
|
<Content Include="EmailTemplates\TECNExtensionReject.txt" />
|
||||||
|
<Content Include="EmailTemplates\TECNReturnedToProcess.txt" />
|
||||||
<Content Include="EmailTemplates\WorkRequestApproval.txt" />
|
<Content Include="EmailTemplates\WorkRequestApproval.txt" />
|
||||||
<Content Include="EmailTemplates\WorkRequestAssigned.txt" />
|
<Content Include="EmailTemplates\WorkRequestAssigned.txt" />
|
||||||
<Content Include="EmailTemplates\WorkRequestReAssigned.txt" />
|
<Content Include="EmailTemplates\WorkRequestReAssigned.txt" />
|
||||||
|
|||||||
@ -126,7 +126,7 @@ public class ECNHelper {
|
|||||||
return emailSentList;
|
return emailSentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, ECN ecn, List<int> notificationUserList) {
|
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, string comments, ECN ecn, List<int> notificationUserList) {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
|
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
|
||||||
foreach (int userId in notificationUserList) {
|
foreach (int userId in notificationUserList) {
|
||||||
@ -135,23 +135,27 @@ public class ECNHelper {
|
|||||||
emailIst.Add(email);
|
emailIst.Add(email);
|
||||||
}
|
}
|
||||||
|
|
||||||
string subject = string.Empty;
|
string subject;
|
||||||
string userEmail = string.Empty;
|
string emailTemplate;
|
||||||
string emailTemplate = "TECNCancelled.txt";
|
|
||||||
if (ecn.CancellationApprovalDate == null) {
|
|
||||||
subject = "TECN Cancellation Initiated Notice - " + ecnNumber + " for " + ecn.Title + ", Cancellation Initiated on:" + DateTime.Now;
|
|
||||||
} else {
|
|
||||||
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + ecn.CancellationApprovalDate;
|
|
||||||
}
|
|
||||||
string senderName = "ECN";
|
string senderName = "ECN";
|
||||||
|
string userEmail = string.Empty;
|
||||||
|
DateTime dateTime = ecn.CancellationApprovalDate is null ? DateTime.Now : ecn.CancellationApprovalDate.Value;
|
||||||
|
if (ecn.ExpirationDate > DateTime.Today || ecn.ExtensionDate > DateTime.Today) {
|
||||||
|
emailTemplate = "TECNCancelled.txt";
|
||||||
|
subject = "TECN Cancellation Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Cancelled:" + dateTime;
|
||||||
|
} else {
|
||||||
|
emailTemplate = "TECNReturnedToProcess.txt";
|
||||||
|
subject = "TECN Return to Process Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Returned:" + dateTime;
|
||||||
|
}
|
||||||
|
|
||||||
EmailNotification en = new(appSettings, subject);
|
EmailNotification en = new(appSettings, subject);
|
||||||
string[] emailparams = new string[5];
|
string[] emailparams = new string[6];
|
||||||
emailparams[0] = ecnNumber.ToString();
|
emailparams[0] = ecnNumber.ToString();
|
||||||
emailparams[1] = ecnNumber.ToString();
|
emailparams[1] = ecnNumber.ToString();
|
||||||
emailparams[2] = GlobalVars.hostURL;
|
emailparams[2] = GlobalVars.hostURL;
|
||||||
emailparams[3] = "TECN";
|
emailparams[3] = "TECN";
|
||||||
emailparams[4] = DateTime.Now.ToString();
|
emailparams[4] = DateTime.Now.ToString();
|
||||||
|
emailparams[5] = comments;
|
||||||
|
|
||||||
#if (DEBUG)
|
#if (DEBUG)
|
||||||
userEmail = GlobalVars.SENDER_EMAIL;
|
userEmail = GlobalVars.SENDER_EMAIL;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Fab2ApprovalSystem.Models;
|
|||||||
public class AppSettings {
|
public class AppSettings {
|
||||||
|
|
||||||
public AppSettings(string adminNotificationRecepient,
|
public AppSettings(string adminNotificationRecepient,
|
||||||
string? apiBaseUrl,
|
string apiBaseUrl,
|
||||||
string attachmentFolder,
|
string attachmentFolder,
|
||||||
string? attachmentUrl,
|
string? attachmentUrl,
|
||||||
string caBlankFormsLocation,
|
string caBlankFormsLocation,
|
||||||
@ -46,6 +46,7 @@ public class AppSettings {
|
|||||||
string urls,
|
string urls,
|
||||||
int userId,
|
int userId,
|
||||||
bool userIsAdmin,
|
bool userIsAdmin,
|
||||||
|
string wasmClientUrl,
|
||||||
string wsr_URL,
|
string wsr_URL,
|
||||||
string? workingDirectoryName) {
|
string? workingDirectoryName) {
|
||||||
AdminNotificationRecepient = adminNotificationRecepient;
|
AdminNotificationRecepient = adminNotificationRecepient;
|
||||||
@ -88,11 +89,12 @@ public class AppSettings {
|
|||||||
UserId = userId;
|
UserId = userId;
|
||||||
UserIsAdmin = userIsAdmin;
|
UserIsAdmin = userIsAdmin;
|
||||||
WSR_URL = wsr_URL;
|
WSR_URL = wsr_URL;
|
||||||
|
WasmClientUrl = wasmClientUrl;
|
||||||
WorkingDirectoryName = workingDirectoryName;
|
WorkingDirectoryName = workingDirectoryName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string AdminNotificationRecepient { get; }
|
public string AdminNotificationRecepient { get; }
|
||||||
public string? ApiBaseUrl { get; }
|
public string ApiBaseUrl { get; }
|
||||||
public string AttachmentFolder { get; }
|
public string AttachmentFolder { get; }
|
||||||
public string? AttachmentUrl { get; }
|
public string? AttachmentUrl { get; }
|
||||||
public string CABlankFormsLocation { get; }
|
public string CABlankFormsLocation { get; }
|
||||||
@ -130,6 +132,7 @@ public class AppSettings {
|
|||||||
public string URLs { get; }
|
public string URLs { get; }
|
||||||
public int UserId { get; }
|
public int UserId { get; }
|
||||||
public bool UserIsAdmin { get; }
|
public bool UserIsAdmin { get; }
|
||||||
|
public string WasmClientUrl { get; }
|
||||||
public string WSR_URL { get; }
|
public string WSR_URL { get; }
|
||||||
public string? WorkingDirectoryName { get; }
|
public string? WorkingDirectoryName { get; }
|
||||||
|
|
||||||
@ -211,12 +214,15 @@ public class AppSettings {
|
|||||||
throw new ArgumentNullException("SSRSPassword environment variable not found");
|
throw new ArgumentNullException("SSRSPassword environment variable not found");
|
||||||
string testEmailRecipients = ConfigurationManager.AppSettings["Test Email Recipients"] ??
|
string testEmailRecipients = ConfigurationManager.AppSettings["Test Email Recipients"] ??
|
||||||
throw new ArgumentNullException("Test Email Recipients environment variable not found");
|
throw new ArgumentNullException("Test Email Recipients environment variable not found");
|
||||||
string? apiBaseUrl = ConfigurationManager.AppSettings["FabApprovalApiBaseUrl"]?.ToString();
|
string apiBaseUrl = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
|
||||||
|
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
|
||||||
string? attachmentUrl = ConfigurationManager.AppSettings["AttachmentUrl"]?.ToString();
|
string? attachmentUrl = ConfigurationManager.AppSettings["AttachmentUrl"]?.ToString();
|
||||||
string? company = ConfigurationManager.AppSettings["Company"]?.ToString();
|
string? company = ConfigurationManager.AppSettings["Company"]?.ToString();
|
||||||
string? smtpServer = ConfigurationManager.AppSettings["SMTP Server"]?.ToString();
|
string? smtpServer = ConfigurationManager.AppSettings["SMTP Server"]?.ToString();
|
||||||
string? urls = ConfigurationManager.AppSettings["URLs"]?.ToString();
|
string? urls = ConfigurationManager.AppSettings["URLs"]?.ToString();
|
||||||
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
|
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
|
||||||
|
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
|
||||||
|
"https://localhost:7255";
|
||||||
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
result = new(adminNotificationRecepient: adminNotificationRecepient,
|
||||||
apiBaseUrl: apiBaseUrl,
|
apiBaseUrl: apiBaseUrl,
|
||||||
attachmentFolder: attachmentFolder,
|
attachmentFolder: attachmentFolder,
|
||||||
@ -256,6 +262,7 @@ public class AppSettings {
|
|||||||
urls: urls,
|
urls: urls,
|
||||||
userId: userId,
|
userId: userId,
|
||||||
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||||
|
wasmClientUrl: wasmClientUrl,
|
||||||
wsr_URL: Misc.GlobalVars.WSR_URL,
|
wsr_URL: Misc.GlobalVars.WSR_URL,
|
||||||
workingDirectoryName: workingDirectoryName);
|
workingDirectoryName: workingDirectoryName);
|
||||||
return result;
|
return result;
|
||||||
|
|||||||
@ -86,29 +86,47 @@
|
|||||||
|
|
||||||
if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
||||||
&& !Model.ExpirationProcessed && !Model.Converted
|
&& !Model.ExpirationProcessed && !Model.Converted
|
||||||
&& !Model.LockedForConversion
|
&& !Model.LockedForConversion)
|
||||||
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
|
|
||||||
{
|
{
|
||||||
ViewBag.CanResubmit = "true";
|
ViewBag.CanResubmit = "true";
|
||||||
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
|
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
|
||||||
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
|
||||||
|
{
|
||||||
|
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
else if (Model.IsTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
||||||
&& !Model.ExpirationProcessed
|
&& !Model.ExpirationProcessed
|
||||||
&& Model.ConversionApprovalInProgress == false
|
&& Model.ConversionApprovalInProgress == false)
|
||||||
&& (Model.ExpirationDate >= DateTime.Today || Model.ExtensionDate >= DateTime.Today))
|
|
||||||
{
|
{
|
||||||
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
|
||||||
|
{
|
||||||
|
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (Model.IsEmergencyTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
else if (Model.IsEmergencyTECN && !Model.CancellationInProgress && !Model.CancellationApproved && !Model.ExpirationInProgress
|
||||||
&& !Model.ExpirationProcessed && !Model.Converted
|
&& !Model.ExpirationProcessed && !Model.Converted)
|
||||||
&& (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today))
|
|
||||||
{
|
{
|
||||||
ViewBag.CanResubmit = "true";
|
ViewBag.CanResubmit = "true";
|
||||||
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
|
<input type="button" value="Change Type" class="btn btn-primary btn-xs" id="ReSubmitDocument" disabled="disabled" />
|
||||||
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
if (Model.ExpirationDate > DateTime.Today || Model.ExtensionDate > DateTime.Today)
|
||||||
|
{
|
||||||
|
<input type="button" value="Cancel Document" class="btn btn-primary btn-xs" id="CancelDocument" />
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
<input type="button" value="Return to Process" class="btn btn-primary btn-xs" id="ReturnToProcessDocument" />
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1251,6 +1269,9 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@Html.Partial("_ECNCancel")
|
||||||
|
@Html.Partial("_ECNReturnToProcess")
|
||||||
|
|
||||||
@Html.Partial("_ECNReassignOriginator")
|
@Html.Partial("_ECNReassignOriginator")
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -2188,40 +2209,6 @@
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#CancelDocument').on('click', function () {
|
|
||||||
docType = 5;
|
|
||||||
if (confirm("Are you sure you want to Cancel this document?")) {
|
|
||||||
$.ajax({
|
|
||||||
url: "/ECN/CancelDocument",
|
|
||||||
type: "GET",
|
|
||||||
datatype: "json",
|
|
||||||
data: {
|
|
||||||
ecnNumber: $("#txtECNNumber").val(),
|
|
||||||
currentStep: 1,
|
|
||||||
documentType: docType,
|
|
||||||
ecnTypeString: ecnTypeString
|
|
||||||
},
|
|
||||||
success: function (data) {
|
|
||||||
|
|
||||||
if (data == 'Redirect') {
|
|
||||||
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
|
|
||||||
url = url.replace('amp;', '');
|
|
||||||
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// TODO alert an error message
|
|
||||||
}
|
|
||||||
},
|
|
||||||
error: function (result) {
|
|
||||||
alert("Failed on Cancel" + result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
var returnNoOfDays = function () {
|
var returnNoOfDays = function () {
|
||||||
//var start = new Date($('#txSubmitDate').val());
|
//var start = new Date($('#txSubmitDate').val());
|
||||||
var start = new Date();
|
var start = new Date();
|
||||||
|
|||||||
75
Fab2ApprovalSystem/Views/ECN/_ECNCancel.cshtml
Normal file
75
Fab2ApprovalSystem/Views/ECN/_ECNCancel.cshtml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<div class="modal fade" id="Cancel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel"><center>Has the process returned to the original state?</center></h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-13">
|
||||||
|
<h4 class="modal-title">Comments (Required):</h4>
|
||||||
|
<textarea class="form-control" rows="5" id="comments" style="resize: none;"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="ConfirmCancel">Confirm Cancel (Yes)</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$("#CancelDocument").click(function (e) {
|
||||||
|
|
||||||
|
$("#comments").val("");
|
||||||
|
|
||||||
|
$("#Cancel").modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#ConfirmCancel').on('click', function () {
|
||||||
|
|
||||||
|
if ($("#comments").val() == "") {
|
||||||
|
alert("Comments are required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#ConfirmCancel').attr("disabled", true);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/ECN/CancelDocument",
|
||||||
|
type: "GET",
|
||||||
|
datatype: "json",
|
||||||
|
data: {
|
||||||
|
ecnNumber: $("#txtECNNumber").val(),
|
||||||
|
currentStep: 1,
|
||||||
|
documentType: 5,
|
||||||
|
ecnTypeString: ecnTypeString,
|
||||||
|
comments: $("#comments").val(),
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
$("#Cancel").modal('hide');
|
||||||
|
|
||||||
|
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
|
||||||
|
url = url.replace('amp;', '');
|
||||||
|
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (result) {
|
||||||
|
$('#ConfirmCancel').attr("disabled", false);
|
||||||
|
alert("Server error while canceling document");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
75
Fab2ApprovalSystem/Views/ECN/_ECNReturnToProcess.cshtml
Normal file
75
Fab2ApprovalSystem/Views/ECN/_ECNReturnToProcess.cshtml
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<div class="modal fade" id="ReturnToProcess" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" data-backdrop="static">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel"><center>Has the process returned to the original state?</center></h4>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="modal-body">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-13">
|
||||||
|
<h4 class="modal-title">Comments (Required):</h4>
|
||||||
|
<textarea class="form-control" rows="5" id="ReturnToProcessComments" style="resize: none;"></textarea>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
|
||||||
|
<button type="button" class="btn btn-primary" id="ConfirmReturnToProcess">Confirm Return to Process (Yes)</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
|
||||||
|
$("#ReturnToProcessDocument").click(function (e) {
|
||||||
|
|
||||||
|
$("#ReturnToProcessComments").val("");
|
||||||
|
|
||||||
|
$("#ReturnToProcess").modal('show');
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#ConfirmReturnToProcess').on('click', function () {
|
||||||
|
|
||||||
|
if ($("#ReturnToProcessComments").val() == "") {
|
||||||
|
alert("Comments are required");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#ConfirmReturnToProcess').attr("disabled", true);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: "/ECN/CancelDocument",
|
||||||
|
type: "GET",
|
||||||
|
datatype: "json",
|
||||||
|
data: {
|
||||||
|
ecnNumber: $("#txtECNNumber").val(),
|
||||||
|
currentStep: 1,
|
||||||
|
documentType: 5,
|
||||||
|
ecnTypeString: ecnTypeString,
|
||||||
|
comments: $("#ReturnToProcessComments").val(),
|
||||||
|
},
|
||||||
|
success: function (data) {
|
||||||
|
|
||||||
|
$("#ReturnToProcess").modal('hide');
|
||||||
|
|
||||||
|
var url = '@Url.Action("ReadOnly", "ECN", new { issueID = "__id__" })';
|
||||||
|
url = url.replace('amp;', '');
|
||||||
|
window.location.href = url.replace('__id__', $("#txtECNNumber").val());
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function (result) {
|
||||||
|
$('#ConfirmReturnToProcess').attr("disabled", false);
|
||||||
|
alert("Server error while ReturnToProcessing document");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@ -53,4 +53,36 @@ public class ECNController : ControllerBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
[Route("ecn/allNumbers")]
|
||||||
|
public async Task<IActionResult> GetAllECNNumbers() {
|
||||||
|
DateTime start = DateTime.Now;
|
||||||
|
bool isInternalError = false;
|
||||||
|
string errorMessage = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
_logger.LogInformation($"Attempting to get all ECN#s");
|
||||||
|
|
||||||
|
IEnumerable<int> allEcnNumbers = await _ecnService.GetAllECNNumbers();
|
||||||
|
|
||||||
|
return Ok(allEcnNumbers);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
isInternalError = true;
|
||||||
|
errorMessage = $"Cannot get all ECN#s, because {ex.Message}";
|
||||||
|
return Problem(errorMessage);
|
||||||
|
} finally {
|
||||||
|
string metricName = "GetAllECNNumbers";
|
||||||
|
DateTime end = DateTime.Now;
|
||||||
|
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||||
|
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||||
|
|
||||||
|
if (isInternalError) {
|
||||||
|
_logger.LogError(errorMessage);
|
||||||
|
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||||
|
} else {
|
||||||
|
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -265,6 +265,7 @@ public class PCRBController : ControllerBase {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[Route("pcrb/attachment")]
|
[Route("pcrb/attachment")]
|
||||||
|
[ApiExplorerSettings(IgnoreApi = true)]
|
||||||
public async Task<IActionResult> UploadAttachment([FromForm] IFormFile file, [FromForm] PCRBAttachment attachment) {
|
public async Task<IActionResult> UploadAttachment([FromForm] IFormFile file, [FromForm] PCRBAttachment attachment) {
|
||||||
DateTime start = DateTime.Now;
|
DateTime start = DateTime.Now;
|
||||||
bool isArgumentError = false;
|
bool isArgumentError = false;
|
||||||
|
|||||||
@ -132,9 +132,6 @@ builder.Services.AddSwaggerGen(c => {
|
|||||||
|
|
||||||
WebApplication app = builder.Build();
|
WebApplication app = builder.Build();
|
||||||
|
|
||||||
if (Debugger.IsAttached)
|
|
||||||
app.Services.GetRequiredService<IApprovalService>();
|
|
||||||
|
|
||||||
app.UseCors();
|
app.UseCors();
|
||||||
|
|
||||||
// Configure the HTTP request pipeline.
|
// Configure the HTTP request pipeline.
|
||||||
|
|||||||
@ -219,7 +219,10 @@ public class ApprovalService : IApprovalService {
|
|||||||
queryBuilder.Append($"select a.*, src.SubRoleCategoryItem from Approval a ");
|
queryBuilder.Append($"select a.*, src.SubRoleCategoryItem from Approval a ");
|
||||||
queryBuilder.Append("join SubRole sr on a.SubRoleID=sr.SubRoleID ");
|
queryBuilder.Append("join SubRole sr on a.SubRoleID=sr.SubRoleID ");
|
||||||
queryBuilder.Append("join SubRoleCategory src on sr.SubRoleCategoryID=src.SubRoleCategoryID ");
|
queryBuilder.Append("join SubRoleCategory src on sr.SubRoleCategoryID=src.SubRoleCategoryID ");
|
||||||
queryBuilder.Append($"where UserID={userId} and ");
|
queryBuilder.Append($"where UserID={userId} and ItemStatus=0 and ");
|
||||||
|
queryBuilder.Append($"(AssignedDate is not null and ");
|
||||||
|
queryBuilder.Append($"AssignedDate <= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}' and ");
|
||||||
|
queryBuilder.Append($"AssignedDate > '{DateTimeOffset.Now.AddYears(-2).DateTime.ToString("yyyy-MM-dd HH:mm:ss")}') and ");
|
||||||
queryBuilder.Append($"((CompletedDate >= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}') or ");
|
queryBuilder.Append($"((CompletedDate >= '{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}') or ");
|
||||||
queryBuilder.Append($"(CompletedDate is null));");
|
queryBuilder.Append($"(CompletedDate is null));");
|
||||||
string sql = queryBuilder.ToString();
|
string sql = queryBuilder.ToString();
|
||||||
|
|||||||
@ -4,6 +4,7 @@ namespace MesaFabApproval.API.Services;
|
|||||||
|
|
||||||
public interface IECNService {
|
public interface IECNService {
|
||||||
Task<bool> IsValidECNNumber(int number);
|
Task<bool> IsValidECNNumber(int number);
|
||||||
|
Task<IEnumerable<int>> GetAllECNNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNService : IECNService {
|
public class ECNService : IECNService {
|
||||||
@ -43,4 +44,19 @@ public class ECNService : IECNService {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
||||||
|
try {
|
||||||
|
_logger.LogInformation("Attempting to get all ECN#s");
|
||||||
|
|
||||||
|
string sql = "select ECNNumber from ECN where Deleted=0 and Cancelled=0";
|
||||||
|
|
||||||
|
IEnumerable<int> allEcnNumbers = await _dalService.QueryAsync<int>(sql);
|
||||||
|
|
||||||
|
return allEcnNumbers;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
_logger.LogError($"Unable to get all ECN#s, because {ex.Message}");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -852,8 +852,8 @@ public class MRBService : IMRBService {
|
|||||||
convertToPart += partStr;
|
convertToPart += partStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.Quantity.ToString(),
|
dt.Rows.Add(action.Action, convertFromCustomer, convertFromPart, action.LotNumber,
|
||||||
convertToCustomer, convertToPart,
|
action.Quantity.ToString(), convertToCustomer, convertToPart,
|
||||||
DateTimeUtilities.GetDateAsStringMinDefault(action.AssignedDate),
|
DateTimeUtilities.GetDateAsStringMinDefault(action.AssignedDate),
|
||||||
DateTimeUtilities.GetDateAsStringMaxDefault(action.CompletedDate),
|
DateTimeUtilities.GetDateAsStringMaxDefault(action.CompletedDate),
|
||||||
action.CompletedByUser is null ? "" : action.CompletedByUser.GetFullName());
|
action.CompletedByUser is null ? "" : action.CompletedByUser.GetFullName());
|
||||||
|
|||||||
@ -485,6 +485,20 @@ public class PCRBService : IPCRBService {
|
|||||||
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
int rowsAffected = await _dalService.ExecuteAsync(queryBuilder.ToString());
|
||||||
|
|
||||||
if (rowsAffected <= 0) throw new Exception("update failed in database");
|
if (rowsAffected <= 0) throw new Exception("update failed in database");
|
||||||
|
|
||||||
|
IEnumerable<PCRBAttendee>? attendees = _cache.Get<IEnumerable<PCRBAttendee>>($"pcrbAttendees{attendee.PlanNumber}");
|
||||||
|
if (attendees is not null) {
|
||||||
|
foreach (PCRBAttendee cachedAttendee in attendees) {
|
||||||
|
if (cachedAttendee.ID == attendee.ID) {
|
||||||
|
cachedAttendee.Location = attendee.Location;
|
||||||
|
cachedAttendee.Attended = attendee.Attended;
|
||||||
|
cachedAttendee.JobTitle = attendee.JobTitle;
|
||||||
|
cachedAttendee.AttendeeID = attendee.AttendeeID;
|
||||||
|
cachedAttendee.Step = attendee.Step;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_cache.Set($"pcrbAttendees{attendee.PlanNumber}", attendees, DateTimeOffset.Now.AddMinutes(15));
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
_logger.LogError($"Unable to update attendee, because {ex.Message}");
|
_logger.LogError($"Unable to update attendee, because {ex.Message}");
|
||||||
throw;
|
throw;
|
||||||
|
|||||||
84
MesaFabApproval.API/pipeline.yml
Normal file
84
MesaFabApproval.API/pipeline.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- MesaFabApproval.API
|
||||||
|
- MesaFabApproval.Shared
|
||||||
|
|
||||||
|
variables:
|
||||||
|
buildConfiguration: "Release"
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: Test
|
||||||
|
displayName: "Test"
|
||||||
|
pool:
|
||||||
|
name: MesaFabApproval
|
||||||
|
demands: Fab2ApprovalSystem-Dev
|
||||||
|
jobs:
|
||||||
|
- job: BuildPublish
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo build configuration: $(BuildConfiguration)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Build"
|
||||||
|
inputs:
|
||||||
|
command: "build"
|
||||||
|
configuration: $(BuildConfiguration)
|
||||||
|
projects: MesaFabApproval.API
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Publish"
|
||||||
|
inputs:
|
||||||
|
command: "publish"
|
||||||
|
publishWebProjects: false
|
||||||
|
projects: MesaFabApproval.API
|
||||||
|
zipAfterPublish: true
|
||||||
|
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||||
|
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: "Copy Files"
|
||||||
|
inputs:
|
||||||
|
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||||
|
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
||||||
|
CleanTargetFolder: true
|
||||||
|
retryCount: "3"
|
||||||
|
|
||||||
|
- stage: Prod
|
||||||
|
displayName: "Prod"
|
||||||
|
pool:
|
||||||
|
name: MesaFabApproval
|
||||||
|
demands: Fab2ApprovalSystem
|
||||||
|
jobs:
|
||||||
|
- job: BuildPublish
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo build configuration: $(BuildConfiguration)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Build"
|
||||||
|
inputs:
|
||||||
|
command: "build"
|
||||||
|
configuration: $(BuildConfiguration)
|
||||||
|
projects: MesaFabApproval.API
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Publish"
|
||||||
|
inputs:
|
||||||
|
command: "publish"
|
||||||
|
publishWebProjects: false
|
||||||
|
projects: MesaFabApproval.API
|
||||||
|
zipAfterPublish: true
|
||||||
|
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||||
|
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: "Copy Files"
|
||||||
|
inputs:
|
||||||
|
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||||
|
TargetFolder: 'D:\$(Build.Repository.Name)\API\$(Build.BuildId)\$(BuildConfiguration)'
|
||||||
|
CleanTargetFolder: true
|
||||||
|
retryCount: "3"
|
||||||
@ -1,65 +1,2 @@
|
|||||||
@page "/redirect"
|
@page "/redirect"
|
||||||
@attribute [AllowAnonymous]
|
@attribute [AllowAnonymous]
|
||||||
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
|
||||||
@inject IAuthenticationService authService
|
|
||||||
@inject IUserService userService
|
|
||||||
@inject ISnackbar snackbar
|
|
||||||
@inject MesaFabApprovalAuthStateProvider authStateProvider
|
|
||||||
@inject NavigationManager navigationManager
|
|
||||||
|
|
||||||
@code {
|
|
||||||
private string? _jwt;
|
|
||||||
private string? _refreshToken;
|
|
||||||
private string? _redirectPath;
|
|
||||||
|
|
||||||
protected override async Task OnParametersSetAsync() {
|
|
||||||
try {
|
|
||||||
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
|
||||||
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
|
||||||
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
|
||||||
_redirectPath = redirectPath.ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
|
||||||
await authService.SetTokens(_jwt, _refreshToken);
|
|
||||||
|
|
||||||
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
|
||||||
|
|
||||||
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
|
||||||
|
|
||||||
await authService.ClearCurrentUser();
|
|
||||||
await authService.ClearTokens();
|
|
||||||
|
|
||||||
await authService.SetLoginId(loginId);
|
|
||||||
await authService.SetTokens(_jwt, _refreshToken);
|
|
||||||
await authService.SetCurrentUser(null);
|
|
||||||
|
|
||||||
await authStateProvider.StateHasChanged(principal);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
|
||||||
navigationManager.NavigateTo(_redirectPath);
|
|
||||||
} else {
|
|
||||||
await authStateProvider.Logout();
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
|
||||||
navigationManager.NavigateTo($"login/{_redirectPath}");
|
|
||||||
} else {
|
|
||||||
navigationManager.NavigateTo("login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (Exception ex) {
|
|
||||||
snackbar.Add($"Redirect failed, because {ex.Message}", Severity.Error);
|
|
||||||
navigationManager.NavigateTo("login");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
77
MesaFabApproval.Client/Pages/AuthenticatedRedirect.razor.cs
Normal file
77
MesaFabApproval.Client/Pages/AuthenticatedRedirect.razor.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
using MesaFabApproval.Client.Services;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.AspNetCore.WebUtilities;
|
||||||
|
|
||||||
|
using MudBlazor;
|
||||||
|
|
||||||
|
using System.Security.Claims;
|
||||||
|
|
||||||
|
namespace MesaFabApproval.Client.Pages;
|
||||||
|
|
||||||
|
public partial class AuthenticatedRedirect {
|
||||||
|
[Inject] MesaFabApprovalAuthStateProvider authStateProvider { get; set; }
|
||||||
|
[Inject] IAuthenticationService authService { get; set; }
|
||||||
|
[Inject] IUserService userService { get; set; }
|
||||||
|
[Inject] ISnackbar snackbar { get; set; }
|
||||||
|
[Inject] NavigationManager navigationManager { get; set; }
|
||||||
|
|
||||||
|
private string? _jwt;
|
||||||
|
private string? _refreshToken;
|
||||||
|
private string? _redirectPath;
|
||||||
|
|
||||||
|
protected override async Task OnParametersSetAsync() {
|
||||||
|
try {
|
||||||
|
Uri uri = navigationManager.ToAbsoluteUri(navigationManager.Uri);
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("jwt", out var jwt)) {
|
||||||
|
_jwt = System.Net.WebUtility.UrlDecode(jwt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("refreshToken", out var refreshToken)) {
|
||||||
|
_refreshToken = System.Net.WebUtility.UrlDecode(refreshToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("redirectPath", out var redirectPath)) {
|
||||||
|
_redirectPath = redirectPath.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_jwt) && !string.IsNullOrWhiteSpace(_refreshToken)) {
|
||||||
|
await authService.SetTokens(_jwt, _refreshToken);
|
||||||
|
|
||||||
|
ClaimsPrincipal principal = authService.GetClaimsPrincipalFromJwt(_jwt);
|
||||||
|
|
||||||
|
string loginId = userService.GetLoginIdFromClaimsPrincipal(principal);
|
||||||
|
|
||||||
|
await authService.ClearCurrentUser();
|
||||||
|
await authService.ClearTokens();
|
||||||
|
|
||||||
|
await authService.SetLoginId(loginId);
|
||||||
|
await authService.SetTokens(_jwt, _refreshToken);
|
||||||
|
await authService.SetCurrentUser(null);
|
||||||
|
|
||||||
|
await authStateProvider.StateHasChanged(principal);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (authStateProvider.CurrentUser is not null && !string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||||
|
navigationManager.NavigateTo(_redirectPath);
|
||||||
|
} else {
|
||||||
|
await authStateProvider.Logout();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||||
|
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||||
|
} else {
|
||||||
|
navigationManager.NavigateTo("login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
await authStateProvider.Logout();
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(_redirectPath)) {
|
||||||
|
navigationManager.NavigateTo($"login/{_redirectPath}");
|
||||||
|
} else {
|
||||||
|
navigationManager.NavigateTo("login");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -215,9 +215,7 @@
|
|||||||
bool actionIsValid = mrbAction.Action.Equals("Block") || mrbAction.Action.Equals("Convert") ||
|
bool actionIsValid = mrbAction.Action.Equals("Block") || mrbAction.Action.Equals("Convert") ||
|
||||||
mrbAction.Action.Equals("Other") || mrbAction.Action.Equals("Recall") || mrbAction.Action.Equals("Scrap") ||
|
mrbAction.Action.Equals("Other") || mrbAction.Action.Equals("Recall") || mrbAction.Action.Equals("Scrap") ||
|
||||||
mrbAction.Action.Equals("Unblock") || mrbAction.Action.Equals("Waiver");
|
mrbAction.Action.Equals("Unblock") || mrbAction.Action.Equals("Waiver");
|
||||||
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
||||||
!string.IsNullOrWhiteSpace(mrbAction.PartNumber) &&
|
|
||||||
!string.IsNullOrWhiteSpace(mrbAction.LotNumber);
|
|
||||||
actionIsValid = actionIsValid && mrbAction.Quantity > 0;
|
actionIsValid = actionIsValid && mrbAction.Quantity > 0;
|
||||||
|
|
||||||
if (mrbAction.Action.Equals("Convert", StringComparison.InvariantCultureIgnoreCase)) {
|
if (mrbAction.Action.Equals("Convert", StringComparison.InvariantCultureIgnoreCase)) {
|
||||||
@ -225,6 +223,9 @@
|
|||||||
!string.IsNullOrWhiteSpace(convertFromPart) &&
|
!string.IsNullOrWhiteSpace(convertFromPart) &&
|
||||||
!string.IsNullOrWhiteSpace(convertToCustomer) &&
|
!string.IsNullOrWhiteSpace(convertToCustomer) &&
|
||||||
!string.IsNullOrWhiteSpace(convertToPart);
|
!string.IsNullOrWhiteSpace(convertToPart);
|
||||||
|
} else {
|
||||||
|
actionIsValid = actionIsValid && !string.IsNullOrWhiteSpace(mrbAction.Customer) &&
|
||||||
|
!string.IsNullOrWhiteSpace(mrbAction.PartNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mrbAction.Action.Equals("Scrap", StringComparison.InvariantCultureIgnoreCase))
|
if (mrbAction.Action.Equals("Scrap", StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
|||||||
@ -31,16 +31,16 @@
|
|||||||
Immediate
|
Immediate
|
||||||
AutoGrow />
|
AutoGrow />
|
||||||
} else {
|
} else {
|
||||||
<MudTextField @bind-Value="@document.ECNNumber"
|
<MudAutocomplete @bind-Value="@document.ECNNumber"
|
||||||
Required
|
T="int"
|
||||||
RequiredError="You must provide a valid ECN#"
|
SearchFunc="Search"
|
||||||
Clearable
|
Required
|
||||||
Variant="Variant.Outlined"
|
Clearable
|
||||||
InputType="@InputType.Number"
|
RequiredError="You must provide a valid ECN#"
|
||||||
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
Variant="Variant.Outlined"
|
||||||
Label="ECN#"
|
Validation="@(new Func<int, Task<string>>(ECNNoIsValid))"
|
||||||
Immediate
|
Label="ECN#"
|
||||||
AutoGrow />
|
Immediate />
|
||||||
}
|
}
|
||||||
<MudCheckBox Label="Complete"
|
<MudCheckBox Label="Complete"
|
||||||
Color="Color.Tertiary"
|
Color="Color.Tertiary"
|
||||||
@ -79,6 +79,8 @@
|
|||||||
[Parameter]
|
[Parameter]
|
||||||
public required PCR3Document document { get; set; }
|
public required PCR3Document document { get; set; }
|
||||||
|
|
||||||
|
private IEnumerable<int> allEcnNumbers = new List<int>();
|
||||||
|
|
||||||
private string[] errors = { };
|
private string[] errors = { };
|
||||||
|
|
||||||
private bool complete = false;
|
private bool complete = false;
|
||||||
@ -89,6 +91,8 @@
|
|||||||
|
|
||||||
protected override async Task OnParametersSetAsync() {
|
protected override async Task OnParametersSetAsync() {
|
||||||
complete = document.CompletedByID > 0;
|
complete = document.CompletedByID > 0;
|
||||||
|
|
||||||
|
allEcnNumbers = await ecnService.GetAllECNNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task Save() {
|
private async Task Save() {
|
||||||
@ -143,6 +147,8 @@
|
|||||||
document.DocNumbers.ToLower().Equals("n/a") ||
|
document.DocNumbers.ToLower().Equals("n/a") ||
|
||||||
document.DocNumbers.ToLower().Equals("n a") ||
|
document.DocNumbers.ToLower().Equals("n a") ||
|
||||||
document.DocNumbers.ToLower().Equals("not applicable")) {
|
document.DocNumbers.ToLower().Equals("not applicable")) {
|
||||||
|
if (string.IsNullOrWhiteSpace(document.Comment))
|
||||||
|
document.Comment = "Not required";
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -155,4 +161,13 @@
|
|||||||
StateHasChanged();
|
StateHasChanged();
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task<IEnumerable<int>> Search(string searchValue, CancellationToken token) {
|
||||||
|
if (string.IsNullOrWhiteSpace(searchValue))
|
||||||
|
return allEcnNumbers;
|
||||||
|
|
||||||
|
return allEcnNumbers
|
||||||
|
.Where(x => x.ToString().StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
.Order();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,5 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
@page "/Dashboard"
|
@page "/Dashboard"
|
||||||
@inject IConfiguration Configuration
|
|
||||||
@inject MesaFabApprovalAuthStateProvider stateProvider
|
|
||||||
@inject IApprovalService approvalService
|
|
||||||
@inject IMemoryCache cache
|
|
||||||
@inject NavigationManager navigationManager
|
|
||||||
@inject ISnackbar snackbar
|
|
||||||
@inject IMRBService mrbService
|
|
||||||
@inject IPCRBService pcrbService
|
|
||||||
@inject IECNService ecnService
|
|
||||||
@inject ICAService caService
|
|
||||||
@inject IJSRuntime jsRuntime
|
|
||||||
|
|
||||||
<PageTitle>Dashboard</PageTitle>
|
<PageTitle>Dashboard</PageTitle>
|
||||||
|
|
||||||
@ -226,138 +215,3 @@
|
|||||||
</MudTabPanel>
|
</MudTabPanel>
|
||||||
</MudTabs>
|
</MudTabs>
|
||||||
</MudPaper>
|
</MudPaper>
|
||||||
|
|
||||||
@code {
|
|
||||||
private IEnumerable<Approval> approvalList = new List<Approval>();
|
|
||||||
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
|
||||||
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
|
||||||
|
|
||||||
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> caNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
|
||||||
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
|
||||||
|
|
||||||
private bool myApprovalsProcessing = false;
|
|
||||||
private bool myMrbsProcessing = false;
|
|
||||||
private bool myPcrbsProcessing = false;
|
|
||||||
|
|
||||||
private string mrbSearchString = "";
|
|
||||||
private string pcrbSearchString = "";
|
|
||||||
|
|
||||||
protected async override Task OnParametersSetAsync() {
|
|
||||||
try {
|
|
||||||
if (stateProvider.CurrentUser is not null) {
|
|
||||||
myApprovalsProcessing = true;
|
|
||||||
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
|
||||||
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(x => x.AssignedDate);
|
|
||||||
myApprovalsProcessing = false;
|
|
||||||
|
|
||||||
myMrbsProcessing = true;
|
|
||||||
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(x => x.SubmittedDate);
|
|
||||||
myMrbsProcessing = false;
|
|
||||||
|
|
||||||
myPcrbsProcessing = true;
|
|
||||||
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
|
||||||
.ToList()
|
|
||||||
.OrderByDescending(p => p.InsertTimeStamp);
|
|
||||||
myPcrbsProcessing = false;
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
myApprovalsProcessing = false;
|
|
||||||
myMrbsProcessing = false;
|
|
||||||
myPcrbsProcessing = false;
|
|
||||||
snackbar.Add($"Unable to load the dashboard, because {ex.Message}", Severity.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task FollowLink(int issueId) {
|
|
||||||
HashSet<Task> tasks = new();
|
|
||||||
|
|
||||||
bool isEcn = false;
|
|
||||||
bool isCa = false;
|
|
||||||
bool isMrb = false;
|
|
||||||
bool isPcrb = false;
|
|
||||||
if (ecnNumbers.Contains(issueId))
|
|
||||||
isEcn = true;
|
|
||||||
if (caNumbers.Contains(issueId))
|
|
||||||
isCa = true;
|
|
||||||
if (mrbNumbers.Contains(issueId))
|
|
||||||
isMrb = true;
|
|
||||||
if (pcrbNumbers.Contains(issueId))
|
|
||||||
isPcrb = true;
|
|
||||||
|
|
||||||
if (!isEcn && !isCa && !isMrb) {
|
|
||||||
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
|
||||||
tasks.Add(isEcnTask);
|
|
||||||
|
|
||||||
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
|
||||||
tasks.Add(isCaTask);
|
|
||||||
|
|
||||||
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
|
||||||
tasks.Add(isMrbTask);
|
|
||||||
|
|
||||||
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
|
||||||
tasks.Add(isPcrbTask);
|
|
||||||
|
|
||||||
await Task.WhenAll(tasks);
|
|
||||||
|
|
||||||
if (isEcnTask.Result) {
|
|
||||||
isEcn = true;
|
|
||||||
} else if (isCaTask.Result) {
|
|
||||||
isCa = true;
|
|
||||||
} else if (isMrbTask.Result) {
|
|
||||||
isMrb = true;
|
|
||||||
} else if (isPcrbTask.Result) {
|
|
||||||
isPcrb = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
|
||||||
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
|
||||||
if (isMrb) GoTo($"mrb/{issueId}");
|
|
||||||
if (isPcrb) GoTo($"pcrb/{issueId}");
|
|
||||||
}
|
|
||||||
|
|
||||||
private void GoTo(string page) {
|
|
||||||
cache.Set("redirectUrl", page);
|
|
||||||
navigationManager.NavigateTo("/" + page);
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task GoToExternal(string url, string content) {
|
|
||||||
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
|
||||||
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
|
||||||
|
|
||||||
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
|
||||||
if (string.IsNullOrWhiteSpace(searchString))
|
|
||||||
return true;
|
|
||||||
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
|
||||||
return true;
|
|
||||||
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
|
||||||
|
|
||||||
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
|
||||||
if (string.IsNullOrWhiteSpace(searchString))
|
|
||||||
return true;
|
|
||||||
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
|
||||||
return true;
|
|
||||||
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private string GetCurrentPCRBStep(int step) {
|
|
||||||
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
|
||||||
else return PCRB.Stages[step];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
157
MesaFabApproval.Client/Pages/Dashboard.razor.cs
Normal file
157
MesaFabApproval.Client/Pages/Dashboard.razor.cs
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
using MesaFabApproval.Client.Services;
|
||||||
|
using MesaFabApproval.Shared.Models;
|
||||||
|
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
|
using Microsoft.Extensions.Caching.Memory;
|
||||||
|
using Microsoft.JSInterop;
|
||||||
|
|
||||||
|
using MudBlazor;
|
||||||
|
|
||||||
|
namespace MesaFabApproval.Client.Pages;
|
||||||
|
|
||||||
|
public partial class Dashboard {
|
||||||
|
[Inject] IConfiguration Configuration { get; set; }
|
||||||
|
[Inject] MesaFabApprovalAuthStateProvider stateProvider { get; set; }
|
||||||
|
[Inject] IApprovalService approvalService { get; set; }
|
||||||
|
[Inject] IMemoryCache cache { get; set; }
|
||||||
|
[Inject] NavigationManager navigationManager { get; set; }
|
||||||
|
[Inject] ISnackbar snackbar { get; set; }
|
||||||
|
[Inject] IMRBService mrbService { get; set; }
|
||||||
|
[Inject] IPCRBService pcrbService { get; set; }
|
||||||
|
[Inject] IECNService ecnService { get; set; }
|
||||||
|
[Inject] ICAService caService { get; set; }
|
||||||
|
[Inject] IJSRuntime jsRuntime { get; set; }
|
||||||
|
|
||||||
|
private IEnumerable<Approval> approvalList = new List<Approval>();
|
||||||
|
private IEnumerable<MRB> myMRBs = new List<MRB>();
|
||||||
|
private IEnumerable<PCRB> myPCRBs = new List<PCRB>();
|
||||||
|
|
||||||
|
private IEnumerable<int> ecnNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> caNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> mrbNumbers = new HashSet<int>();
|
||||||
|
private IEnumerable<int> pcrbNumbers = new HashSet<int>();
|
||||||
|
|
||||||
|
private bool myApprovalsProcessing = false;
|
||||||
|
private bool myMrbsProcessing = false;
|
||||||
|
private bool myPcrbsProcessing = false;
|
||||||
|
|
||||||
|
private string mrbSearchString = "";
|
||||||
|
private string pcrbSearchString = "";
|
||||||
|
|
||||||
|
protected async override Task OnParametersSetAsync() {
|
||||||
|
try {
|
||||||
|
if (stateProvider.CurrentUser is not null) {
|
||||||
|
myApprovalsProcessing = true;
|
||||||
|
approvalList = (await approvalService.GetApprovalsForUserId(stateProvider.CurrentUser.UserID, true))
|
||||||
|
.Where(a => a.CompletedDate > DateTime.Now && a.ItemStatus == 0)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(x => x.AssignedDate);
|
||||||
|
myApprovalsProcessing = false;
|
||||||
|
|
||||||
|
myMrbsProcessing = true;
|
||||||
|
myMRBs = (await mrbService.GetAllMRBs(false)).Where(m => m.OriginatorID == stateProvider.CurrentUser.UserID)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(x => x.SubmittedDate);
|
||||||
|
myMrbsProcessing = false;
|
||||||
|
|
||||||
|
myPcrbsProcessing = true;
|
||||||
|
myPCRBs = (await pcrbService.GetAllPCRBs(false)).Where(p => p.OwnerID == stateProvider.CurrentUser.UserID)
|
||||||
|
.ToList()
|
||||||
|
.OrderByDescending(p => p.InsertTimeStamp);
|
||||||
|
myPcrbsProcessing = false;
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
myApprovalsProcessing = false;
|
||||||
|
myMrbsProcessing = false;
|
||||||
|
myPcrbsProcessing = false;
|
||||||
|
snackbar.Add(ex.Message, Severity.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task FollowLink(int issueId) {
|
||||||
|
HashSet<Task> tasks = new();
|
||||||
|
|
||||||
|
bool isEcn = false;
|
||||||
|
bool isCa = false;
|
||||||
|
bool isMrb = false;
|
||||||
|
bool isPcrb = false;
|
||||||
|
if (ecnNumbers.Contains(issueId))
|
||||||
|
isEcn = true;
|
||||||
|
if (caNumbers.Contains(issueId))
|
||||||
|
isCa = true;
|
||||||
|
if (mrbNumbers.Contains(issueId))
|
||||||
|
isMrb = true;
|
||||||
|
if (pcrbNumbers.Contains(issueId))
|
||||||
|
isPcrb = true;
|
||||||
|
|
||||||
|
if (!isEcn && !isCa && !isMrb) {
|
||||||
|
Task<bool> isEcnTask = ecnService.ECNNumberIsValid(issueId);
|
||||||
|
tasks.Add(isEcnTask);
|
||||||
|
|
||||||
|
Task<bool> isCaTask = caService.CANumberIsValid(issueId);
|
||||||
|
tasks.Add(isCaTask);
|
||||||
|
|
||||||
|
Task<bool> isMrbTask = mrbService.NumberIsValid(issueId);
|
||||||
|
tasks.Add(isMrbTask);
|
||||||
|
|
||||||
|
Task<bool> isPcrbTask = pcrbService.IdIsValid(issueId);
|
||||||
|
tasks.Add(isPcrbTask);
|
||||||
|
|
||||||
|
await Task.WhenAll(tasks);
|
||||||
|
|
||||||
|
if (isEcnTask.Result) {
|
||||||
|
isEcn = true;
|
||||||
|
} else if (isCaTask.Result) {
|
||||||
|
isCa = true;
|
||||||
|
} else if (isMrbTask.Result) {
|
||||||
|
isMrb = true;
|
||||||
|
} else if (isPcrbTask.Result) {
|
||||||
|
isPcrb = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isEcn) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/ECN/Edit?IssueID={issueId}", "");
|
||||||
|
if (isCa) await GoToExternal($"{Configuration["OldFabApprovalUrl"]}/CorrectiveAction/Edit?IssueID={issueId}", "");
|
||||||
|
if (isMrb) GoTo($"mrb/{issueId}");
|
||||||
|
if (isPcrb) GoTo($"pcrb/{issueId}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void GoTo(string page) {
|
||||||
|
cache.Set("redirectUrl", page);
|
||||||
|
navigationManager.NavigateTo("/" + page);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task GoToExternal(string url, string content) {
|
||||||
|
IJSObjectReference windowModule = await jsRuntime.InvokeAsync<IJSObjectReference>("import", "./js/OpenInNewWindow.js");
|
||||||
|
await windowModule.InvokeAsync<object>("OpenInNewWindow", url, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterFuncForMRBTable(MRB mrb) => MRBFilterFunc(mrb, mrbSearchString);
|
||||||
|
|
||||||
|
private bool MRBFilterFunc(MRB mrb, string searchString) {
|
||||||
|
if (string.IsNullOrWhiteSpace(searchString))
|
||||||
|
return true;
|
||||||
|
if (mrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||||
|
return true;
|
||||||
|
if (mrb.MRBNumber.ToString().Contains(searchString.Trim()))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool FilterFuncForPCRBTable(PCRB pcrb) => PCRBFilterFunc(pcrb, pcrbSearchString);
|
||||||
|
|
||||||
|
private bool PCRBFilterFunc(PCRB pcrb, string searchString) {
|
||||||
|
if (string.IsNullOrWhiteSpace(searchString))
|
||||||
|
return true;
|
||||||
|
if (pcrb.Title.ToLower().Contains(searchString.Trim().ToLower()))
|
||||||
|
return true;
|
||||||
|
if (pcrb.PlanNumber.ToString().Contains(searchString.Trim()))
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private string GetCurrentPCRBStep(int step) {
|
||||||
|
if (step < 0 || step > (PCRB.Stages.Length - 1)) return string.Empty;
|
||||||
|
else return PCRB.Stages[step];
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
1025
MesaFabApproval.Client/Pages/MRBSingle.razor.cs
Normal file
1025
MesaFabApproval.Client/Pages/MRBSingle.razor.cs
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
1139
MesaFabApproval.Client/Pages/PCRBSingle.razor.cs
Normal file
1139
MesaFabApproval.Client/Pages/PCRBSingle.razor.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -5,6 +5,7 @@ namespace MesaFabApproval.Client.Services;
|
|||||||
public interface IECNService {
|
public interface IECNService {
|
||||||
Task<string> ECNNumberIsValidStr(int ecnNumber);
|
Task<string> ECNNumberIsValidStr(int ecnNumber);
|
||||||
Task<bool> ECNNumberIsValid(int number);
|
Task<bool> ECNNumberIsValid(int number);
|
||||||
|
Task<IEnumerable<int>> GetAllECNNumbers();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNService : IECNService {
|
public class ECNService : IECNService {
|
||||||
@ -49,4 +50,32 @@ public class ECNService : IECNService {
|
|||||||
throw new Exception($"Unable to determine if {number} is a valid ECN#, because {ex.Message}");
|
throw new Exception($"Unable to determine if {number} is a valid ECN#, because {ex.Message}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<IEnumerable<int>> GetAllECNNumbers() {
|
||||||
|
try {
|
||||||
|
HttpClient httpClient = _httpClientFactory.CreateClient("API");
|
||||||
|
|
||||||
|
HttpRequestMessage requestMessage = new(HttpMethod.Get, $"ecn/allNumbers");
|
||||||
|
|
||||||
|
HttpResponseMessage responseMessage = await httpClient.SendAsync(requestMessage);
|
||||||
|
|
||||||
|
if (responseMessage.IsSuccessStatusCode) {
|
||||||
|
string responseContent = await responseMessage.Content.ReadAsStringAsync();
|
||||||
|
|
||||||
|
JsonSerializerOptions jsonSerializerOptions = new() {
|
||||||
|
PropertyNameCaseInsensitive = true
|
||||||
|
};
|
||||||
|
|
||||||
|
IEnumerable<int> allEcnNumbers =
|
||||||
|
JsonSerializer.Deserialize<IEnumerable<int>>(responseContent, jsonSerializerOptions) ??
|
||||||
|
new List<int>();
|
||||||
|
|
||||||
|
return allEcnNumbers;
|
||||||
|
} else {
|
||||||
|
throw new Exception(responseMessage.ReasonPhrase);
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new Exception($"Unable to get all ECN#s, because {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
84
MesaFabApproval.Client/pipeline.yml
Normal file
84
MesaFabApproval.Client/pipeline.yml
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
include:
|
||||||
|
- MesaFabApproval.Client
|
||||||
|
- MesaFabApproval.Shared
|
||||||
|
|
||||||
|
variables:
|
||||||
|
buildConfiguration: "Release"
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: Test
|
||||||
|
displayName: "Test"
|
||||||
|
pool:
|
||||||
|
name: MesaFabApproval
|
||||||
|
demands: Fab2ApprovalSystem-Dev
|
||||||
|
jobs:
|
||||||
|
- job: BuildPublish
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo build configuration: $(BuildConfiguration)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Build"
|
||||||
|
inputs:
|
||||||
|
command: "build"
|
||||||
|
configuration: $(BuildConfiguration)
|
||||||
|
projects: MesaFabApproval.Client
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Publish"
|
||||||
|
inputs:
|
||||||
|
command: "publish"
|
||||||
|
publishWebProjects: false
|
||||||
|
projects: MesaFabApproval.Client
|
||||||
|
zipAfterPublish: true
|
||||||
|
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||||
|
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: "Copy Files"
|
||||||
|
inputs:
|
||||||
|
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||||
|
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
||||||
|
CleanTargetFolder: true
|
||||||
|
retryCount: "3"
|
||||||
|
|
||||||
|
- stage: Prod
|
||||||
|
displayName: "Prod"
|
||||||
|
pool:
|
||||||
|
name: MesaFabApproval
|
||||||
|
demands: Fab2ApprovalSystem
|
||||||
|
jobs:
|
||||||
|
- job: BuildPublish
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo build configuration: $(BuildConfiguration)
|
||||||
|
displayName: "Echo Check"
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Build"
|
||||||
|
inputs:
|
||||||
|
command: "build"
|
||||||
|
configuration: $(BuildConfiguration)
|
||||||
|
projects: MesaFabApproval.Client
|
||||||
|
|
||||||
|
- task: DotNetCoreCLI@2
|
||||||
|
displayName: "Publish"
|
||||||
|
inputs:
|
||||||
|
command: "publish"
|
||||||
|
publishWebProjects: false
|
||||||
|
projects: MesaFabApproval.Client
|
||||||
|
zipAfterPublish: true
|
||||||
|
arguments: "-c $(BuildConfiguration) -o $(Build.ArtifactStagingDirectory) -r win-x64 --self-contained"
|
||||||
|
|
||||||
|
- task: CopyFiles@2
|
||||||
|
displayName: "Copy Files"
|
||||||
|
inputs:
|
||||||
|
SourceFolder: "$(Build.ArtifactStagingDirectory)"
|
||||||
|
TargetFolder: 'D:\$(Build.Repository.Name)\Client\$(Build.BuildId)\$(BuildConfiguration)'
|
||||||
|
CleanTargetFolder: true
|
||||||
|
retryCount: "3"
|
||||||
@ -25,7 +25,7 @@ stages:
|
|||||||
- stage: Development
|
- stage: Development
|
||||||
displayName: Development
|
displayName: Development
|
||||||
pool:
|
pool:
|
||||||
name: Mesa-FabApproval
|
name: MesaFabApproval
|
||||||
demands: Fab2ApprovalSystem-Dev
|
demands: Fab2ApprovalSystem-Dev
|
||||||
variables:
|
variables:
|
||||||
ASPNETCORE_ENVIRONMENT: "Development"
|
ASPNETCORE_ENVIRONMENT: "Development"
|
||||||
|
|||||||
Reference in New Issue
Block a user