Compare commits

..

1 Commits
master ... mrb

Author SHA1 Message Date
Chase Tucker
2dbb541c1a MRB webassembly 2024-07-11 09:11:01 -07:00
308 changed files with 35834 additions and 44018 deletions

View File

@ -0,0 +1,229 @@
# Remove the line below if you want to inherit .editorconfig settings from higher directories
root = true
# C# files
[*.cs]
#### Core EditorConfig Options ####
# Indentation and spacing
indent_size = 4
indent_style = space
tab_width = 4
# New line preferences
end_of_line = crlf
insert_final_newline = false
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
file_header_template = unset
# this. and Me. preferences
dotnet_style_qualification_for_event = true
dotnet_style_qualification_for_field = true
dotnet_style_qualification_for_method = true
dotnet_style_qualification_for_property = true
# Language keywords vs BCL types preferences
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true
# Parentheses preferences
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity:error
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity:error
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity:error
# Modifier preferences
dotnet_style_require_accessibility_modifiers = for_non_interface_members
# Expression-level preferences
dotnet_style_coalesce_expression = false
dotnet_style_collection_initializer = true
dotnet_style_explicit_tuple_names = true:error
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true
dotnet_style_object_initializer = true
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_prefer_auto_properties = true
dotnet_style_prefer_compound_assignment = true
dotnet_style_prefer_conditional_expression_over_assignment = true:suggestion
dotnet_style_prefer_conditional_expression_over_return = true:suggestion
dotnet_style_prefer_foreach_explicit_cast_in_source = when_strongly_typed
dotnet_style_prefer_inferred_anonymous_type_member_names = false
dotnet_style_prefer_inferred_tuple_names = false
dotnet_style_prefer_is_null_check_over_reference_equality_method = true
dotnet_style_prefer_simplified_boolean_expressions = true
dotnet_style_prefer_simplified_interpolation = true
# Field preferences
dotnet_style_readonly_field = true:warning
# Parameter preferences
dotnet_code_quality_unused_parameters = all:error
# Suppression preferences
dotnet_remove_unnecessary_suppression_exclusions = none
# New line preferences
dotnet_style_allow_multiple_blank_lines_experimental = false:error
dotnet_style_allow_statement_immediately_after_block_experimental = false:warning
#### C# Coding Conventions ####
# var preferences
csharp_style_var_elsewhere = false:error
csharp_style_var_for_built_in_types = false:error
csharp_style_var_when_type_is_apparent = false:error
# Expression-bodied members
csharp_style_expression_bodied_accessors = false
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_indexers = false
csharp_style_expression_bodied_lambdas = true
csharp_style_expression_bodied_local_functions = false
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_operators = false
csharp_style_expression_bodied_properties = false
# Pattern matching preferences
csharp_style_pattern_matching_over_as_with_null_check = false
csharp_style_pattern_matching_over_is_with_cast_check = false
csharp_style_prefer_extended_property_pattern = true
csharp_style_prefer_not_pattern = true
csharp_style_prefer_pattern_matching = true
csharp_style_prefer_switch_expression = false
# Null-checking preferences
csharp_style_conditional_delegate_call = false
# Modifier preferences
csharp_prefer_static_local_function = false
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async
csharp_style_prefer_readonly_struct = true:warning
csharp_style_prefer_readonly_struct_member = true
# Code-block preferences
csharp_prefer_braces = when_multiline:error
csharp_prefer_simple_using_statement = false
csharp_style_namespace_declarations = file_scoped:error
csharp_style_prefer_method_group_conversion = true:suggestion
csharp_style_prefer_top_level_statements = true:error
# Expression-level preferences
csharp_prefer_simple_default_expression = true
csharp_style_deconstructed_variable_declaration = false
csharp_style_implicit_object_creation_when_type_is_apparent = false
csharp_style_inlined_variable_declaration = true
csharp_style_prefer_index_operator = false:error
csharp_style_prefer_local_over_anonymous_function = true:error
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_range_operator = false:error
csharp_style_prefer_tuple_swap = true
csharp_style_prefer_utf8_string_literals = true
csharp_style_throw_expression = false
csharp_style_unused_value_assignment_preference = unused_local_variable
csharp_style_unused_value_expression_statement_preference = unused_local_variable
# 'using' directive preferences
csharp_using_directive_placement = outside_namespace:error
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false:error
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
# Wrapping preferences
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
#### Naming styles ####
# Naming rules
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
# Symbol specifications
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =
# Naming styles
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

19
.gitignore vendored
View File

@ -337,23 +337,6 @@ ASALocalRun/
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.vscode
.env
/Fab2ApprovalMKLink/App_Start
/Fab2ApprovalMKLink/Controllers
/Fab2ApprovalMKLink/DMO
/Fab2ApprovalMKLink/Jobs
/Fab2ApprovalMKLink/JobSchedules
/Fab2ApprovalMKLink/Misc
/Fab2ApprovalMKLink/Models
/Fab2ApprovalMKLink/PdfGenerator
/Fab2ApprovalMKLink/Utilities
/Fab2ApprovalMKLink/ViewModels
/Fab2ApprovalMKLink/.vscode/.UserSecrets
/Fab2ApprovalSystem/.vscode/.UserSecrets
/Fab2ApprovalTests/.vscode/.UserSecrets
/MesaFabApproval.API/.vscode/.UserSecrets
/MesaFabApproval.Client/.vscode/.UserSecrets
/MesaFabApproval.Shared/.vscode/.UserSecrets

41
.vscode/launch.json vendored
View File

@ -1,41 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console) - Fab2ApprovalSystem",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "Fab2ApprovalSystem-build",
"program": "${workspaceFolder}/Fab2ApprovalSystem/bin/Debug/net8.0/win-x64/Fab2ApprovalSystem.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Launch (console) - MesaFabApproval.API",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "MesaFabApproval.API-build",
"program": "${workspaceFolder}/MesaFabApproval.API/bin/Debug/net8.0/MesaFabApproval.API.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
}
]
}

425
.vscode/settings.json vendored
View File

@ -1,425 +0,0 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"files.exclude": {
"**/.git": false,
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"cSpell.words": [
"abutton",
"accessibilities",
"accodingly",
"acknowledgmentby",
"Acks",
"actionsheet",
"Additonal",
"Addtional",
"againm",
"agendaview",
"Antlr",
"Appover",
"Appprrovers",
"Approvalog",
"Aprovers",
"Aproverslist",
"asax",
"aspnetmvc",
"Assignedto",
"Atachments",
"Attachemnt",
"Attachemnts",
"Attchment",
"auditee",
"Auditee",
"Auditees",
"automaically",
"Autthorized",
"beacuase",
"beforeunload",
"Belguim",
"bfound",
"bgcolor",
"Bies",
"binded",
"blackbackground",
"blackhover",
"blackpressed",
"blueenergy",
"blueopal",
"buttongroup",
"BYMRB",
"bytesgot",
"CAID",
"casection",
"CAXXXX",
"CCPCR",
"CCPCRB",
"cellspacing",
"Cheeso's",
"chkbx",
"Clib",
"colorpicker",
"columnmenu",
"columnsreorder",
"columnsresize",
"comming",
"Containmen",
"Copmments",
"correctiv",
"Correctivet",
"Creat",
"currentd",
"Cyle",
"dadada",
"darkbluehover",
"darkbluepressed",
"darkred",
"datafields",
"datasource",
"dataviz",
"datepicker",
"datetimepicker",
"dayview",
"Deletet",
"Delgation",
"DENITED",
"Deparmtent",
"departmentids",
"Descirption",
"devprog",
"dfeffc",
"Disp",
"Dispo",
"Dispoitio",
"Dispos",
"Dispositon",
"Dispostion",
"Dispostions",
"dispotypevalidation",
"Docbase",
"Documentum",
"Documetum",
"dont",
"downlaoded",
"draganddrop",
"dragcancel",
"dropdownlist",
"Eamils",
"ECNPCRB",
"Ecns",
"edmx",
"EECN",
"emai",
"emailparams",
"Emergrncy",
"energyblue",
"Eran",
"Esql",
"ETECN",
"EXCELOPENXML",
"existinglocation",
"Expando",
"extrafield",
"fadc",
"fbec",
"fcfdfd",
"fdff",
"fece",
"feeebd",
"ffdc",
"ffdd",
"fieldset",
"FILIPE",
"filtermenu",
"Fldr",
"flintstone",
"FLOWLOCS",
"FMEA",
"ftplib",
"FTPSPN",
"GETDATE",
"gitea",
"globaldocudms",
"glyphicons",
"groupable",
"Guids",
"halflings",
"Hexsize",
"highcontrast",
"Hmac",
"holdsteps",
"hostspecific",
"icenium",
"IECN",
"imagebrowser",
"IMRB",
"Infineon",
"Insertd",
"inverseicons",
"IPCRB",
"ISADMIN",
"islast",
"ISNULL",
"ITAR",
"jquery",
"jqueryval",
"jqwidgets",
"jqxbuttongroup",
"jqxbuttons",
"jqxcalendar",
"jqxchart",
"jqxcheckbox",
"jqxcolorpicker",
"jqxcombobox",
"jqxcore",
"jqxdata",
"jqxdatatable",
"jqxdatetimeinput",
"jqxdocking",
"jqxdockpanel",
"jqxdragdrop",
"jqxdropdownbutton",
"jqxdropdownlist",
"jqxexpander",
"jqxgauge",
"jqxgrid",
"jqxinput",
"jqxknockout",
"jqxlistbox",
"jqxlistmenu",
"jqxmaskedinput",
"jqxmenu",
"jqxnavigationbar",
"jqxnumberinput",
"jqxpanel",
"jqxpasswordinput",
"jqxprogressbar",
"jqxradiobutton",
"jqxrangeselector",
"jqxrating",
"jqxresponse",
"jqxscrollbar",
"jqxscrollview",
"jqxslider",
"jqxsplitter",
"jqxswitchbutton",
"jqxtabs",
"jqxtooltip",
"jqxtouch",
"jqxtree",
"jqxtreegrid",
"jqxtreemap",
"jqxvalidator",
"jqxwindow",
"kendogridcustom",
"kendoui",
"labelelement",
"labelledby",
"Leanred",
"lightgray",
"linkbutton",
"Linq",
"Listdiv",
"listview",
"Lnks",
"localfilename",
"loclist",
"logis",
"logtext",
"loopmis",
"lotdispo",
"LOTDISPSITION",
"Lotfile",
"lotlist",
"lotstatusoption",
"LTRIM",
"MADUREIRA",
"mailrelay",
"MDTM",
"meego",
"meetingid",
"menubutton",
"mesafi",
"metroblack",
"metrodark",
"miliseconds",
"modalview",
"modernizr",
"Modernizr",
"monthview",
"MRBIs",
"Mrbs",
"msecs",
"multipleextended",
"Navigatable",
"nbsp",
"newbase",
"newchange",
"newdi",
"newfilename",
"newsource",
"Newtonsoft",
"notications",
"Notifcation",
"Notifyf",
"NTLM",
"Nullcc",
"numerictextbox",
"objdata",
"OCAP",
"occured",
"odata",
"oldfilename",
"OLHOLD",
"onclick",
"onmousemove",
"OPDESC",
"OPENQUERY",
"Oper",
"operationslist",
"Orginator",
"Originatorname",
"Ouellette",
"Owin",
"pageable",
"Pageable",
"panelbar",
"parentid",
"parminput",
"parms",
"Parms",
"particula",
"pasv",
"PASV",
"PATINDEX",
"PCRB",
"PCRBID",
"pcrvalues",
"pdbonly",
"Preventitive",
"preventivet",
"Prevetative",
"proces",
"Processedl",
"procs",
"productfamilies",
"progess",
"progressbar",
"qrcode",
"Quanityt",
"rangebar",
"Recep",
"Recepient",
"recieved",
"recordlock",
"remotefilename",
"reorderable",
"reportform",
"reportslist",
"reportslistdiv",
"Reqquired",
"Reqs",
"Requiest",
"Responsibles",
"RETR",
"Revisioing",
"Revisioned",
"Revison",
"rgba",
"rkotian",
"RNFR",
"RNTO",
"Roless",
"roundbg",
"RTRIM",
"SAMDB",
"scroller",
"scrollview",
"seleced",
"selectionlog",
"Selectpart",
"sess",
"Sfisharepoint",
"shinyblack",
"showpassword",
"SIGNON",
"simpleparser",
"slddrw",
"sldprt",
"sortasc",
"sortascbutton",
"sortdesc",
"sortdescbutton",
"sortremove",
"sparkline",
"splitview",
"SPNMRB",
"SPNPDB",
"SSRS",
"Sssign",
"Staus",
"stylesheet",
"Submited",
"subrole",
"subroles",
"Succefully",
"Succesfully",
"sucessfully",
"SURP",
"Swashbuckle",
"SWRN",
"tabindex",
"tabstrip",
"Tahoma",
"taskcompleted",
"Tasklist",
"Taveler",
"TECN",
"TECNs",
"TEMIRWAP",
"tempecd",
"tempimplement",
"templabel",
"tempvalue",
"TEMSA",
"timepicker",
"Tobe",
"Toplevel",
"Totrav",
"trainingby",
"Traininglist",
"traininglistdiv",
"transanction",
"Trav",
"Traveller",
"Traverler",
"TRAVLELER",
"Travler",
"TREEVIEW",
"trigerred",
"ttinclude",
"Uhandled",
"Updat",
"Uplaod",
"Upto",
"userevents",
"userids",
"userlist",
"Validatable",
"valueelement",
"Variabls",
"Verdana",
"vgrid",
"viewmodel",
"vsdoc",
"whethere",
"windowsphone",
"Winsock",
"worlflow"
],
"dotnet.preferCSharpExtension": true
}

515
.vscode/tasks.json vendored
View File

@ -1,515 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "MSBuild-Debug",
"command": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"type": "process",
"args": [
"/target:Build",
"/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
"Fab2ApprovalSystem/Fab2ApprovalSystem.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "MSBuild-Release",
"command": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"type": "process",
"args": [
"/target:Build",
"/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Release;TargetFrameworkVersion=v4.8",
"Fab2ApprovalSystem/Fab2ApprovalSystem.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj",
"set",
"_UserSecretsId",
"f2da5035-aba9-4676-9f8d-d6689f84663d"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalMKLink-Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"set",
"_UserSecretsId",
"3942d1fb-d585-40ae-8985-d276d1b94b77"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-testDebug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-testRelease",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Fab2ApprovalTests-Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Fab2ApprovalTests/Fab2ApprovalTests.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"set",
"_UserSecretsId",
"0b98e1f2-95ed-4edd-8149-58cce51ca059"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-testDebug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-testRelease",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.API-Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/MesaFabApproval.API/MesaFabApproval.API.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-testDebug",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-testRelease",
"command": "dotnet",
"type": "process",
"args": [
"test",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"-c",
"Release"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "MesaFabApproval.Client-Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/MesaFabApproval.Client/MesaFabApproval.Client.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,381 +0,0 @@
[*.md]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.csproj]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.cs]
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false
csharp_prefer_qualified_reference = true:error
csharp_prefer_simple_default_expression = true:warning
csharp_prefer_simple_using_statement = true:warning
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
csharp_style_conditional_delegate_call = true
csharp_style_deconstructed_variable_declaration = false
csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:warning
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:warning
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = false
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_switch_expression = true:warning
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_using_directive_placement = outside_namespace
dotnet_analyzer_diagnostic.category-Design.severity = error
dotnet_analyzer_diagnostic.category-Documentation.severity = error
dotnet_analyzer_diagnostic.category-Globalization.severity = none
dotnet_analyzer_diagnostic.category-Interoperability.severity = error
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
dotnet_analyzer_diagnostic.category-Naming.severity = none
dotnet_analyzer_diagnostic.category-Performance.severity = none
dotnet_analyzer_diagnostic.category-Reliability.severity = error
dotnet_analyzer_diagnostic.category-Security.severity = error
dotnet_analyzer_diagnostic.category-SingleFile.severity = error
dotnet_analyzer_diagnostic.category-Style.severity = error
dotnet_analyzer_diagnostic.category-Usage.severity = error
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public
dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1001.severity = error # CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1511.severity = warning # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1513.severity = warning # Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = error # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
dotnet_diagnostic.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
dotnet_diagnostic.CA2201.severity = none # CA2201: Exception type System.NullReferenceException is reserved by the runtime
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = error # Using directive is unnecessary
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0048.severity = none # Parentheses preferences (IDE0047 and IDE0048)
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
dotnet_diagnostic.IDE0058.severity = error # IDE0058: Expression value is never used
dotnet_diagnostic.IDE0060.severity = error # IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
dotnet_naming_style.private_of_internal_field.required_prefix = _
dotnet_naming_style.private_of_internal_field.required_suffix =
dotnet_naming_style.private_of_internal_field.word_separator =
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.delegate.applicable_kinds = delegate
dotnet_naming_symbols.delegate.required_modifiers =
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enum.applicable_kinds = enum
dotnet_naming_symbols.enum.required_modifiers =
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.event.applicable_kinds = event
dotnet_naming_symbols.event.required_modifiers =
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_accessibilities = public
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.struct.applicable_kinds = struct
dotnet_naming_symbols.struct.required_modifiers =
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.required_modifiers =
dotnet_remove_unnecessary_suppression_exclusions = 0
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members
end_of_line = crlf
file_header_template = unset
indent_size = 4
indent_style = space
insert_final_newline = false
root = true
tab_width = 4
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
# https://github.com/dotnet/project-system/blob/main/.editorconfig
# Question
csharp_prefer_simple_using_statement = false # Question
csharp_style_expression_bodied_constructors = when_on_single_line:none # Question
csharp_style_expression_bodied_properties = true # Question
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning # Question
csharp_style_pattern_matching_over_as_with_null_check = false # Question
csharp_style_prefer_pattern_matching = false # Question
csharp_style_prefer_range_operator = false # Question
csharp_style_prefer_switch_expression = false # Question
csharp_style_unused_value_assignment_preference = unused_local_variable # Question
csharp_style_unused_value_expression_statement_preference = false # Question
csharp_style_var_elsewhere = false:none # Question
csharp_style_var_for_built_in_types = false:none # Question
csharp_style_var_when_type_is_apparent = false:warning # Question
dotnet_diagnostic.CA1001.severity = none # Question - Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = none # Question - Do not declare visible instance fields
dotnet_diagnostic.CA1416.severity = none # Question - This call site is reachable on all platforms.
dotnet_diagnostic.CA1510.severity = none # Question - Use
dotnet_diagnostic.CA1834.severity = none # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = none # Question - Avoid using
dotnet_diagnostic.CA1862.severity = none # Question - Prefer using
dotnet_diagnostic.CA2208.severity = none # Question - Instantiate argument exceptions correctly
dotnet_diagnostic.CA2211.severity = none # Question - Non-constant fields should not be visible
dotnet_diagnostic.CA2249.severity = none # Question - Use
dotnet_diagnostic.CA2253.severity = none # Question - Named placeholders should not be numeric values
dotnet_diagnostic.CS0103.severity = none # Question - The name
dotnet_diagnostic.CS0168.severity = none # Question - The variable
dotnet_diagnostic.CS0219.severity = none # Question - The variable
dotnet_diagnostic.CS0612.severity = none # Question - is obsolete
dotnet_diagnostic.CS0618.severity = none # Question - Compiler Warning (level 2)
dotnet_diagnostic.CS0659.severity = none # Question - Compiler Warning (level 3)
dotnet_diagnostic.CS8019.severity = warning # Question - Unnecessary using directive.
dotnet_diagnostic.CS8600.severity = none # Question - Converting null literal or possible null value to non-nullable type
dotnet_diagnostic.CS8602.severity = none # Question - Dereference of a possibly null reference.
dotnet_diagnostic.CS8603.severity = none # Question - Possible null reference return
dotnet_diagnostic.CS8604.severity = none # Question - Possible null reference argument for parameter.
dotnet_diagnostic.CS8618.severity = none # Question - Non-nullable variable must contain a non-null value when exiting constructor
dotnet_diagnostic.CS8625.severity = none # Question - Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8629.severity = none # Question - Nullable value type may be null
dotnet_diagnostic.CS8765.severity = none # Question - Nullability of type of parameter
dotnet_diagnostic.IDE0005.severity = none # Question - Remove unnecessary using directives
dotnet_diagnostic.IDE0008.severity = warning # Question - Use explicit type instead of
dotnet_diagnostic.IDE0017.severity = none # Question - Object initialization can be simplified
dotnet_diagnostic.IDE0019.severity = none # Question - Use pattern matching
dotnet_diagnostic.IDE0021.severity = none # Question - Use expression body for constructor
dotnet_diagnostic.IDE0022.severity = none # Question - Use expression body for method
dotnet_diagnostic.IDE0025.severity = none # Question - Use expression body for property
dotnet_diagnostic.IDE0027.severity = none # Question - Use expression body for accessor
dotnet_diagnostic.IDE0028.severity = none # Question - Use collection initializers or expressions
dotnet_diagnostic.IDE0031.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0032.severity = none # Question - Use auto property
dotnet_diagnostic.IDE0037.severity = none # Question - Member name can be simplified
dotnet_diagnostic.IDE0041.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0047.severity = none # Question - Parentheses preferences
dotnet_diagnostic.IDE0049.severity = warning # Question - Name can be simplified
dotnet_diagnostic.IDE0051.severity = none # Question - Remove unused private member
dotnet_diagnostic.IDE0053.severity = none # Question - Use expression body for lambdas
dotnet_diagnostic.IDE0054.severity = none # Question - Use compound assignment
dotnet_diagnostic.IDE0055.severity = none # Question - Formatting rule
dotnet_diagnostic.IDE0057.severity = none # Question - Substring can be simplified
dotnet_diagnostic.IDE0058.severity = none # Question - Remove unnecessary expression value
dotnet_diagnostic.IDE0059.severity = none # Question - Unnecessary assignment of a value to
dotnet_diagnostic.IDE0060.severity = none # Question - Remove unused parameter
dotnet_diagnostic.IDE0063.severity = none # Question - Use simple
dotnet_diagnostic.IDE0065.severity = none # Question -
dotnet_diagnostic.IDE0066.severity = none # Question - Use
dotnet_diagnostic.IDE0078.severity = none # Question - Use pattern matching (may change code meaning)
dotnet_diagnostic.IDE0090.severity = warning # Question - Simplify new expression
dotnet_diagnostic.IDE0100.severity = error # Question - Remove redundant equality
dotnet_diagnostic.IDE0160.severity = warning # Question - Use block-scoped namespace
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE0270.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0300.severity = none # Question - Collection initialization can be simplified
dotnet_diagnostic.IDE1006.severity = none # Question - Use collection expression for builder dotnet_style_prefer_collection_expression
dotnet_style_null_propagation = false # Question
dotnet_style_object_initializer = false # Question
dotnet_style_prefer_auto_properties = false # Question
dotnet_style_allow_statement_immediately_after_block_experimental = true # Question
dotnet_style_prefer_inferred_anonymous_type_member_names = false:warning # Question
dotnet_style_prefer_is_null_check_over_reference_equality_method = false # Question

View File

@ -1 +0,0 @@
[]

View File

@ -1,33 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0/Fab2ApprovalMKLink.dll",
"args": [
"s",
"test"
],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
}
]
}

View File

@ -1,49 +0,0 @@
# mklink
```bash 1731546128283 = 638671429282830000 = Wed Nov 13 2024 18:02:07 GMT-0700 (Mountain Standard Time)
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\App_Start" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\App_Start"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\bin" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\bin"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Content" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Content"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Controllers" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Controllers"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\DMO" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\DMO"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\EmailTemplates" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\EmailTemplates"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\fonts" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\fonts"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\FTPBatch" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\FTPBatch"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Jobs" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Jobs"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\JobSchedules" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\JobSchedules"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Lib" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Lib"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Misc" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Misc"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Models" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Models"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\obj" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\obj"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\PdfGenerator" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\PdfGenerator"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Properties" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Properties"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\SafeModels" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\SafeModels"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Scripts" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Scripts"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Utilities" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Utilities"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\View" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\View"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\ViewModels" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\ViewModels"
```
```bash 1731615429577 = 638672122295770000 = Thu Nov 14 2024 13:17:09 GMT-0700 (Mountain Standard Time)
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\.vscode\.UserSecrets" "C:\Users\phares\AppData\Roaming\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\ViewModels" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\ViewModels"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Models" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Models"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Misc" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Misc"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\DMO" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\DMO"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Utilities" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Utilities"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\PdfGenerator" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\PdfGenerator"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\Jobs" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\Jobs"
mklink /J "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalMKLink\JobSchedules" "L:\DevOps\Mesa_FI\MesaFabApproval\Fab2ApprovalSystem\JobSchedules"
```
```bash 1734015544321 = 638696123443210000 = Thu Dec 12 2024 07:59:03 GMT-0700 (Mountain Standard Time)
mklink /J ".vscode\.UserSecrets" "%AppData%\Microsoft\UserSecrets\f2da5035-aba9-4676-9f8d-d6689f84663d"
mklink /J "DMO" "..\Fab2ApprovalSystem\DMO"
mklink /J "Jobs" "..\Fab2ApprovalSystem\Jobs"
mklink /J "JobSchedules" "..\Fab2ApprovalSystem\JobSchedules"
mklink /J "Misc" "..\Fab2ApprovalSystem\Misc"
mklink /J "Models" "..\Fab2ApprovalSystem\Models"
mklink /J "PdfGenerator" "..\Fab2ApprovalSystem\PdfGenerator"
mklink /J "Utilities" "..\Fab2ApprovalSystem\Utilities"
mklink /J "ViewModels" "..\Fab2ApprovalSystem\ViewModels"
```

View File

@ -1,424 +0,0 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"files.exclude": {
"**/.git": false,
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"cSpell.words": [
"abutton",
"accessibilities",
"accodingly",
"acknowledgmentby",
"Acks",
"actionsheet",
"Additonal",
"Addtional",
"againm",
"agendaview",
"Antlr",
"Appover",
"Appprrovers",
"Approvalog",
"Aprovers",
"Aproverslist",
"asax",
"aspnetmvc",
"Assignedto",
"Atachments",
"Attachemnt",
"Attachemnts",
"Attchment",
"auditee",
"Auditee",
"Auditees",
"automaically",
"Autthorized",
"beacuase",
"beforeunload",
"Belguim",
"bfound",
"bgcolor",
"Bies",
"binded",
"blackbackground",
"blackhover",
"blackpressed",
"blueenergy",
"blueopal",
"buttongroup",
"BYMRB",
"bytesgot",
"CAID",
"casection",
"CAXXXX",
"CCPCR",
"CCPCRB",
"cellspacing",
"Cheeso's",
"chkbx",
"Clib",
"colorpicker",
"columnmenu",
"columnsreorder",
"columnsresize",
"comming",
"Containmen",
"Copmments",
"correctiv",
"Correctivet",
"Creat",
"currentd",
"Cyle",
"dadada",
"darkbluehover",
"darkbluepressed",
"darkred",
"datafields",
"datasource",
"dataviz",
"datepicker",
"datetimepicker",
"dayview",
"Deletet",
"Delgation",
"DENITED",
"Deparmtent",
"departmentids",
"Descirption",
"devprog",
"dfeffc",
"Disp",
"Dispo",
"Dispoitio",
"Dispos",
"Dispositon",
"Dispostion",
"Dispostions",
"dispotypevalidation",
"Docbase",
"Documentum",
"Documetum",
"dont",
"downlaoded",
"draganddrop",
"dragcancel",
"dropdownlist",
"Eamils",
"ECNPCRB",
"Ecns",
"edmx",
"EECN",
"emai",
"emailparams",
"Emergrncy",
"energyblue",
"Eran",
"Esql",
"ETECN",
"EXCELOPENXML",
"existinglocation",
"Expando",
"extrafield",
"fadc",
"fbec",
"fcfdfd",
"fdff",
"fece",
"feeebd",
"ffdc",
"ffdd",
"fieldset",
"FILIPE",
"filtermenu",
"Fldr",
"flintstone",
"FLOWLOCS",
"FMEA",
"ftplib",
"FTPSPN",
"GETDATE",
"gitea",
"globaldocudms",
"glyphicons",
"groupable",
"Guids",
"halflings",
"Hexsize",
"highcontrast",
"Hmac",
"holdsteps",
"hostspecific",
"icenium",
"IECN",
"imagebrowser",
"IMRB",
"Infineon",
"Insertd",
"inverseicons",
"IPCRB",
"ISADMIN",
"islast",
"ISNULL",
"ITAR",
"jquery",
"jqueryval",
"jqwidgets",
"jqxbuttongroup",
"jqxbuttons",
"jqxcalendar",
"jqxchart",
"jqxcheckbox",
"jqxcolorpicker",
"jqxcombobox",
"jqxcore",
"jqxdata",
"jqxdatatable",
"jqxdatetimeinput",
"jqxdocking",
"jqxdockpanel",
"jqxdragdrop",
"jqxdropdownbutton",
"jqxdropdownlist",
"jqxexpander",
"jqxgauge",
"jqxgrid",
"jqxinput",
"jqxknockout",
"jqxlistbox",
"jqxlistmenu",
"jqxmaskedinput",
"jqxmenu",
"jqxnavigationbar",
"jqxnumberinput",
"jqxpanel",
"jqxpasswordinput",
"jqxprogressbar",
"jqxradiobutton",
"jqxrangeselector",
"jqxrating",
"jqxresponse",
"jqxscrollbar",
"jqxscrollview",
"jqxslider",
"jqxsplitter",
"jqxswitchbutton",
"jqxtabs",
"jqxtooltip",
"jqxtouch",
"jqxtree",
"jqxtreegrid",
"jqxtreemap",
"jqxvalidator",
"jqxwindow",
"kendogridcustom",
"kendoui",
"labelelement",
"labelledby",
"Leanred",
"lightgray",
"linkbutton",
"Linq",
"Listdiv",
"listview",
"Lnks",
"localfilename",
"loclist",
"logis",
"logtext",
"loopmis",
"lotdispo",
"LOTDISPSITION",
"Lotfile",
"lotlist",
"lotstatusoption",
"LTRIM",
"MADUREIRA",
"mailrelay",
"MDTM",
"meego",
"meetingid",
"menubutton",
"mesafi",
"metroblack",
"metrodark",
"miliseconds",
"modalview",
"modernizr",
"Modernizr",
"monthview",
"MRBIs",
"Mrbs",
"msecs",
"multipleextended",
"Navigatable",
"nbsp",
"newbase",
"newchange",
"newdi",
"newfilename",
"newsource",
"Newtonsoft",
"notications",
"Notifcation",
"Notifyf",
"NTLM",
"Nullcc",
"numerictextbox",
"objdata",
"OCAP",
"occured",
"odata",
"oldfilename",
"OLHOLD",
"onclick",
"onmousemove",
"OPDESC",
"OPENQUERY",
"Oper",
"operationslist",
"Orginator",
"Originatorname",
"Ouellette",
"Owin",
"pageable",
"Pageable",
"panelbar",
"parentid",
"parminput",
"parms",
"Parms",
"particula",
"pasv",
"PASV",
"PATINDEX",
"PCRB",
"PCRBID",
"pcrvalues",
"pdbonly",
"Preventitive",
"preventivet",
"Prevetative",
"proces",
"Processedl",
"procs",
"productfamilies",
"progess",
"progressbar",
"qrcode",
"Quanityt",
"rangebar",
"Recep",
"Recepient",
"recieved",
"recordlock",
"remotefilename",
"reorderable",
"reportform",
"reportslist",
"reportslistdiv",
"Reqquired",
"Reqs",
"Requiest",
"Responsibles",
"RETR",
"Revisioing",
"Revisioned",
"Revison",
"rgba",
"rkotian",
"RNFR",
"RNTO",
"Roless",
"roundbg",
"RTRIM",
"SAMDB",
"scroller",
"scrollview",
"seleced",
"selectionlog",
"Selectpart",
"sess",
"Sfisharepoint",
"shinyblack",
"showpassword",
"SIGNON",
"simpleparser",
"slddrw",
"sldprt",
"sortasc",
"sortascbutton",
"sortdesc",
"sortdescbutton",
"sortremove",
"sparkline",
"splitview",
"SPNMRB",
"SPNPDB",
"SSRS",
"Sssign",
"Staus",
"stylesheet",
"Submited",
"subrole",
"subroles",
"Succefully",
"Succesfully",
"sucessfully",
"SURP",
"Swashbuckle",
"SWRN",
"tabindex",
"tabstrip",
"Tahoma",
"taskcompleted",
"Tasklist",
"Taveler",
"TECN",
"TECNs",
"TEMIRWAP",
"tempecd",
"tempimplement",
"templabel",
"tempvalue",
"TEMSA",
"timepicker",
"Tobe",
"Toplevel",
"Totrav",
"trainingby",
"Traininglist",
"traininglistdiv",
"transanction",
"Trav",
"Traveller",
"Traverler",
"TRAVLELER",
"Travler",
"TREEVIEW",
"trigerred",
"ttinclude",
"Uhandled",
"Updat",
"Uplaod",
"Upto",
"userevents",
"userids",
"userlist",
"Validatable",
"valueelement",
"Variabls",
"Verdana",
"vgrid",
"viewmodel",
"vsdoc",
"whethere",
"windowsphone",
"Winsock",
"worlflow"
]
}

View File

@ -1,109 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "User Secrets Init",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj",
"init"
],
"problemMatcher": "$msCompile"
},
{
"label": "User Secrets Set",
"command": "dotnet",
"type": "process",
"args": [
"user-secrets",
"-p",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj",
"set",
"_UserSecretsId",
"f2da5035-aba9-4676-9f8d-d6689f84663d"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format",
"command": "dotnet",
"type": "process",
"args": [
"format",
"--report",
".vscode",
"--verbosity",
"detailed",
"--severity",
"warn"
],
"problemMatcher": "$msCompile"
},
{
"label": "Format-Whitespaces",
"command": "dotnet",
"type": "process",
"args": [
"format",
"whitespace"
],
"problemMatcher": "$msCompile"
},
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"--project",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj"
],
"problemMatcher": "$msCompile"
},
{
"label": "Publish AOT",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"-r",
"win-x64",
"-c",
"Release",
"-p:PublishAot=true",
"${workspaceFolder}/Fab2ApprovalMKLink.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,57 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
<UserSecretsId>f2da5035-aba9-4676-9f8d-d6689f84663d</UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<ImplicitUsings>disable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
<OutputType>Exe</OutputType>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<DefineConstants>NET8</DefineConstants>
</PropertyGroup>
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleTo">
<_Parameter1>Fab2ApprovalTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
<PackageReference Include="Dapper" Version="2.1.44" />
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
<PackageReference Include="EntityFramework" Version="6.5.1" />
<PackageReference Include="ExcelDataReader" Version="3.7.0" />
<PackageReference Include="jQuery" Version="3.7.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="8.0.10" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="5.2.0" />
<PackageReference Include="Microsoft.Data.Sqlite" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting.WindowsServices" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="8.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="Quartz.Extensions.Hosting" Version="3.8.1" />
<PackageReference Include="Quartz" Version="3.8.1" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" />
<PackageReference Include="System.DirectoryServices.AccountManagement" Version="9.0.0" />
<PackageReference Include="System.DirectoryServices" Version="9.0.0" />
<PackageReference Include="System.Drawing.Common" Version="8.0.7" />
</ItemGroup>
</Project>

View File

@ -1,77 +0,0 @@
using System;
using System.Diagnostics;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Hosting.WindowsServices;
using Microsoft.Extensions.Logging;
namespace Fab2ApprovalMKLink;
public class Program {
public static int Main(string[] args) {
ILogger<Program>? logger = null;
WebApplicationBuilder webApplicationBuilder = WebApplication.CreateBuilder(args);
_ = webApplicationBuilder.Configuration.AddUserSecrets<Program>();
AppSettings appSettings = AppSettings.Get(webApplicationBuilder.Configuration);
if (string.IsNullOrEmpty(appSettings.Company))
throw new Exception("Company name must have a value!");
if (string.IsNullOrEmpty(appSettings.WorkingDirectoryName))
throw new Exception("Working directory name must have a value!");
try {
_ = webApplicationBuilder.Services.Configure<ApiBehaviorOptions>(options => options.SuppressModelStateInvalidFilter = true);
_ = webApplicationBuilder.Services.AddControllers();
_ = webApplicationBuilder.Services.AddDistributedMemoryCache();
_ = webApplicationBuilder.Services.AddHttpClient();
_ = webApplicationBuilder.Services.AddSingleton(_ => appSettings);
_ = webApplicationBuilder.Services.AddSwaggerGen();
_ = webApplicationBuilder.Services.AddSession(sessionOptions => {
sessionOptions.IdleTimeout = TimeSpan.FromSeconds(2000);
sessionOptions.Cookie.HttpOnly = true;
sessionOptions.Cookie.IsEssential = true;
}
);
if (WindowsServiceHelpers.IsWindowsService()) {
_ = webApplicationBuilder.Services.AddSingleton<IHostLifetime, WindowsServiceLifetime>();
_ = webApplicationBuilder.Logging.AddEventLog(settings => {
#pragma warning disable CA1416
if (string.IsNullOrEmpty(settings.SourceName))
settings.SourceName = webApplicationBuilder.Environment.ApplicationName;
#pragma warning restore
});
}
WebApplication webApplication = webApplicationBuilder.Build();
if (Debugger.IsAttached)
webApplication.Services.GetRequiredService<AppSettings>();
logger = webApplication.Services.GetRequiredService<ILogger<Program>>();
_ = webApplication.UseCors(corsPolicyBuilder => corsPolicyBuilder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
if (!webApplicationBuilder.Environment.IsDevelopment()) {
_ = webApplication.UseExceptionHandler("/Error");
_ = webApplication.UseHttpsRedirection();
_ = webApplication.UseHsts();
} else {
if (string.IsNullOrEmpty(appSettings.URLs)) {
Environment.ExitCode = -1;
webApplication.Lifetime.StopApplication();
}
_ = webApplication.UseSwagger();
_ = webApplication.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Server V1"));
}
_ = webApplication.UseSession();
_ = webApplication.MapControllers();
logger.LogInformation("Starting Web Application");
webApplication.Run();
return 0;
} catch (Exception ex) {
try { logger?.LogCritical(ex, "Host terminated unexpectedly"); } catch (Exception) { }
throw;
}
}
}

View File

@ -0,0 +1,105 @@
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

View File

@ -6,9 +6,6 @@ MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fab2ApprovalSystem", "Fab2ApprovalSystem\Fab2ApprovalSystem.csproj", "{AAE52608-4DD1-4732-92BD-CC8915DEC71E}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MesaFabApproval.API", "MesaFabApproval.API\MesaFabApproval.API.csproj", "{852E528D-015A-43B5-999D-F281E3359E5E}"
ProjectSection(ProjectDependencies) = postProject
{2C16014D-B04E-46AF-AB4C-D2691D44A339} = {2C16014D-B04E-46AF-AB4C-D2691D44A339}
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MesaFabApproval.Shared", "MesaFabApproval.Shared\MesaFabApproval.Shared.csproj", "{2C16014D-B04E-46AF-AB4C-D2691D44A339}"
EndProject
@ -17,18 +14,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MesaFabApproval.Client", "M
{2C16014D-B04E-46AF-AB4C-D2691D44A339} = {2C16014D-B04E-46AF-AB4C-D2691D44A339}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MesaFabApproval.API.Test", "MesaFabApproval.API.Test\MesaFabApproval.API.Test.csproj", "{D03AB305-BA29-4EB1-AC66-ABBF76FBF5C1}"
ProjectSection(ProjectDependencies) = postProject
{2C16014D-B04E-46AF-AB4C-D2691D44A339} = {2C16014D-B04E-46AF-AB4C-D2691D44A339}
{852E528D-015A-43B5-999D-F281E3359E5E} = {852E528D-015A-43B5-999D-F281E3359E5E}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MesaFabApproval.Client.Test", "MesaFabApproval.Client.Test\MesaFabApproval.Client.Test.csproj", "{A0E5BD7D-3910-43BD-BBA3-3820AD524423}"
ProjectSection(ProjectDependencies) = postProject
{2C16014D-B04E-46AF-AB4C-D2691D44A339} = {2C16014D-B04E-46AF-AB4C-D2691D44A339}
{34D52F44-A81F-4247-8180-16E204824A07} = {34D52F44-A81F-4247-8180-16E204824A07}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -51,14 +36,6 @@ Global
{34D52F44-A81F-4247-8180-16E204824A07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{34D52F44-A81F-4247-8180-16E204824A07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{34D52F44-A81F-4247-8180-16E204824A07}.Release|Any CPU.Build.0 = Release|Any CPU
{D03AB305-BA29-4EB1-AC66-ABBF76FBF5C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D03AB305-BA29-4EB1-AC66-ABBF76FBF5C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D03AB305-BA29-4EB1-AC66-ABBF76FBF5C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D03AB305-BA29-4EB1-AC66-ABBF76FBF5C1}.Release|Any CPU.Build.0 = Release|Any CPU
{A0E5BD7D-3910-43BD-BBA3-3820AD524423}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0E5BD7D-3910-43BD-BBA3-3820AD524423}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0E5BD7D-3910-43BD-BBA3-3820AD524423}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0E5BD7D-3910-43BD-BBA3-3820AD524423}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -1,380 +0,0 @@
[*.md]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.csproj]
end_of_line = crlf
file_header_template = unset
indent_size = 2
indent_style = space
insert_final_newline = false
root = true
tab_width = 2
[*.cs]
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_case_contents_when_block = true
csharp_indent_labels = one_less_than_current
csharp_indent_switch_labels = true
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = false
csharp_prefer_qualified_reference = true:error
csharp_prefer_simple_default_expression = true:warning
csharp_prefer_simple_using_statement = true:warning
csharp_prefer_static_local_function = true:warning
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true
csharp_style_allow_embedded_statements_on_same_line_experimental = true
csharp_style_conditional_delegate_call = true
csharp_style_deconstructed_variable_declaration = false
csharp_style_expression_bodied_accessors = when_on_single_line:warning
csharp_style_expression_bodied_constructors = when_on_single_line:warning
csharp_style_expression_bodied_indexers = when_on_single_line:warning
csharp_style_expression_bodied_lambdas = when_on_single_line:warning
csharp_style_expression_bodied_local_functions = when_on_single_line:warning
csharp_style_expression_bodied_methods = when_on_single_line:warning
csharp_style_expression_bodied_operators = when_on_single_line:warning
csharp_style_expression_bodied_properties = when_on_single_line:warning
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning
csharp_style_inlined_variable_declaration = false
csharp_style_namespace_declarations = file_scoped:warning
csharp_style_pattern_local_over_anonymous_function = true:warning
csharp_style_pattern_matching_over_as_with_null_check = true:warning
csharp_style_pattern_matching_over_is_with_cast_check = true:warning
csharp_style_prefer_index_operator = true:warning
csharp_style_prefer_not_pattern = true:warning
csharp_style_prefer_null_check_over_type_check = true
csharp_style_prefer_pattern_matching = true:warning
csharp_style_prefer_range_operator = true:warning
csharp_style_prefer_switch_expression = true:warning
csharp_style_throw_expression = true
csharp_style_unused_value_assignment_preference = discard_variable:warning
csharp_style_unused_value_expression_statement_preference = discard_variable:warning
csharp_style_var_elsewhere = false:warning
csharp_style_var_for_built_in_types = false:warning
csharp_style_var_when_type_is_apparent = false:warning
csharp_using_directive_placement = outside_namespace
dotnet_analyzer_diagnostic.category-Design.severity = error
dotnet_analyzer_diagnostic.category-Documentation.severity = error
dotnet_analyzer_diagnostic.category-Globalization.severity = none
dotnet_analyzer_diagnostic.category-Interoperability.severity = error
dotnet_analyzer_diagnostic.category-Maintainability.severity = error
dotnet_analyzer_diagnostic.category-Naming.severity = none
dotnet_analyzer_diagnostic.category-Performance.severity = none
dotnet_analyzer_diagnostic.category-Reliability.severity = error
dotnet_analyzer_diagnostic.category-Security.severity = error
dotnet_analyzer_diagnostic.category-SingleFile.severity = error
dotnet_analyzer_diagnostic.category-Style.severity = error
dotnet_analyzer_diagnostic.category-Usage.severity = error
dotnet_code_quality_unused_parameters = all
dotnet_code_quality_unused_parameters = non_public
dotnet_code_quality.CAXXXX.api_surface = private, internal
dotnet_diagnostic.CA1001.severity = error # CA1001: Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = error # CA1051: Do not declare visible instance fields
dotnet_diagnostic.CA1511.severity = warning # CA1511: Use 'ArgumentException.ThrowIfNullOrEmpty' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1513.severity = warning # Use 'ObjectDisposedException.ThrowIf' instead of explicitly throwing a new exception instance
dotnet_diagnostic.CA1825.severity = warning # CA1825: Avoid zero-length array allocations
dotnet_diagnostic.CA1829.severity = error # CA1829: Use Length/Count property instead of Count() when available
dotnet_diagnostic.CA1834.severity = warning # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = error # CA1860: Prefer comparing 'Count' to 0 rather than using 'Any()', both for clarity and for performance
dotnet_diagnostic.CA1862.severity = warning # CA1862: Prefer using 'string.Equals(string, StringComparison)' to perform a case-insensitive comparison, but keep in mind that this might cause subtle changes in behavior, so make sure to conduct thorough testing after applying the suggestion, or if culturally sensitive comparison is not required, consider using 'StringComparison.OrdinalIgnoreCase'
dotnet_diagnostic.CA1869.severity = none # CA1869: Avoid creating a new 'JsonSerializerOptions' instance for every serialization operation. Cache and reuse instances instead.
dotnet_diagnostic.CA2201.severity = none # CA2201: Exception type System.NullReferenceException is reserved by the runtime
dotnet_diagnostic.CA2254.severity = none # CA2254: The logging message template should not vary between calls to 'LoggerExtensions.LogInformation(ILogger, string?, params object?[])'
dotnet_diagnostic.IDE0001.severity = warning # IDE0001: Simplify name
dotnet_diagnostic.IDE0002.severity = warning # Simplify (member access) - System.Version.Equals("1", "2"); Version.Equals("1", "2");
dotnet_diagnostic.IDE0004.severity = warning # IDE0004: Cast is redundant.
dotnet_diagnostic.IDE0005.severity = error # Using directive is unnecessary
dotnet_diagnostic.IDE0010.severity = none # Add missing cases to switch statement (IDE0010)
dotnet_diagnostic.IDE0028.severity = error # IDE0028: Collection initialization can be simplified
dotnet_diagnostic.IDE0031.severity = warning # Use null propagation (IDE0031)
dotnet_diagnostic.IDE0047.severity = warning # IDE0047: Parentheses can be removed
dotnet_diagnostic.IDE0048.severity = none # Parentheses preferences (IDE0047 and IDE0048)
dotnet_diagnostic.IDE0049.severity = warning # Use language keywords instead of framework type names for type references (IDE0049)
dotnet_diagnostic.IDE0051.severity = error # Private member '' is unused [, ]
dotnet_diagnostic.IDE0058.severity = error # IDE0058: Expression value is never used
dotnet_diagnostic.IDE0060.severity = error # IDE0060: Remove unused parameter
dotnet_diagnostic.IDE0074.severity = warning # IDE0074: Use compound assignment
dotnet_diagnostic.IDE0130.severity = none # Namespace does not match folder structure (IDE0130)
dotnet_diagnostic.IDE0270.severity = warning # IDE0270: Null check can be simplified
dotnet_diagnostic.IDE0290.severity = none # Use primary constructor [Distance]csharp(IDE0290)
dotnet_diagnostic.IDE0300.severity = error # IDE0300: Collection initialization can be simplified
dotnet_diagnostic.IDE0301.severity = error #IDE0301: Collection initialization can be simplified
dotnet_diagnostic.IDE0305.severity = none # IDE0305: Collection initialization can be simplified
dotnet_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines
dotnet_naming_rule.abstract_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.abstract_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.abstract_method_should_be_pascal_case.symbols = abstract_method
dotnet_naming_rule.class_should_be_pascal_case.severity = warning
dotnet_naming_rule.class_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.class_should_be_pascal_case.symbols = class
dotnet_naming_rule.delegate_should_be_pascal_case.severity = warning
dotnet_naming_rule.delegate_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.delegate_should_be_pascal_case.symbols = delegate
dotnet_naming_rule.enum_should_be_pascal_case.severity = warning
dotnet_naming_rule.enum_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.enum_should_be_pascal_case.symbols = enum
dotnet_naming_rule.event_should_be_pascal_case.severity = warning
dotnet_naming_rule.event_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.event_should_be_pascal_case.symbols = event
dotnet_naming_rule.interface_should_be_begins_with_i.severity = warning
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.method_should_be_pascal_case.severity = warning
dotnet_naming_rule.method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.method_should_be_pascal_case.symbols = method
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = warning
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.private_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.private_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.private_method_should_be_pascal_case.symbols = private_method
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_field_should_be_private_of_internal_field.symbols = private_or_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.private_or_internal_static_field_should_be_private_of_internal_field.symbols = private_or_internal_static_field
dotnet_naming_rule.property_should_be_pascal_case.severity = warning
dotnet_naming_rule.property_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.property_should_be_pascal_case.symbols = property
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.severity = warning
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.style = private_of_internal_field
dotnet_naming_rule.public_or_protected_field_should_be_private_of_internal_field.symbols = public_or_protected_field
dotnet_naming_rule.static_field_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_field_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_field_should_be_pascal_case.symbols = static_field
dotnet_naming_rule.static_method_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_method_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.static_method_should_be_pascal_case.symbols = static_method
dotnet_naming_rule.struct_should_be_pascal_case.severity = warning
dotnet_naming_rule.struct_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.struct_should_be_pascal_case.symbols = struct
dotnet_naming_rule.types_should_be_pascal_case.severity = warning
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_style.begins_with_i.capitalization = pascal_case
dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.private_of_internal_field.capitalization = pascal_case
dotnet_naming_style.private_of_internal_field.required_prefix = _
dotnet_naming_style.private_of_internal_field.required_suffix =
dotnet_naming_style.private_of_internal_field.word_separator =
dotnet_naming_symbols.abstract_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.abstract_method.applicable_kinds = method
dotnet_naming_symbols.abstract_method.required_modifiers = abstract
dotnet_naming_symbols.class.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.class.applicable_kinds = class
dotnet_naming_symbols.class.required_modifiers =
dotnet_naming_symbols.delegate.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.delegate.applicable_kinds = delegate
dotnet_naming_symbols.delegate.required_modifiers =
dotnet_naming_symbols.enum.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.enum.applicable_kinds = enum
dotnet_naming_symbols.enum.required_modifiers =
dotnet_naming_symbols.event.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.event.applicable_kinds = event
dotnet_naming_symbols.event.required_modifiers =
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.required_modifiers =
dotnet_naming_symbols.method.applicable_accessibilities = public
dotnet_naming_symbols.method.applicable_kinds = method
dotnet_naming_symbols.method.required_modifiers =
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.required_modifiers =
dotnet_naming_symbols.private_method.applicable_accessibilities = private
dotnet_naming_symbols.private_method.applicable_kinds = method
dotnet_naming_symbols.private_method.required_modifiers =
dotnet_naming_symbols.private_or_internal_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_field.required_modifiers =
dotnet_naming_symbols.private_or_internal_static_field.applicable_accessibilities = internal, private, private_protected
dotnet_naming_symbols.private_or_internal_static_field.applicable_kinds = field
dotnet_naming_symbols.private_or_internal_static_field.required_modifiers = static
dotnet_naming_symbols.property.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.property.applicable_kinds = property
dotnet_naming_symbols.property.required_modifiers =
dotnet_naming_symbols.public_or_protected_field.applicable_accessibilities = public, protected
dotnet_naming_symbols.public_or_protected_field.applicable_kinds = field
dotnet_naming_symbols.public_or_protected_field.required_modifiers =
dotnet_naming_symbols.static_field.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_field.applicable_kinds = field
dotnet_naming_symbols.static_field.required_modifiers = static
dotnet_naming_symbols.static_method.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.static_method.applicable_kinds = method
dotnet_naming_symbols.static_method.required_modifiers = static
dotnet_naming_symbols.struct.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.struct.applicable_kinds = struct
dotnet_naming_symbols.struct.required_modifiers =
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.required_modifiers =
dotnet_remove_unnecessary_suppression_exclusions = 0
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
dotnet_style_allow_multiple_blank_lines_experimental = false:warning
dotnet_style_allow_statement_immediately_after_block_experimental = true
dotnet_style_coalesce_expression = true
dotnet_style_collection_initializer = true:warning
dotnet_style_explicit_tuple_names = true:warning
dotnet_style_namespace_match_folder = true
dotnet_style_null_propagation = true:warning
dotnet_style_object_initializer = true:warning
dotnet_style_operator_placement_when_wrapping = beginning_of_line
dotnet_style_parentheses_in_arithmetic_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_binary_operators = always_for_clarity
dotnet_style_parentheses_in_other_operators = never_if_unnecessary
dotnet_style_parentheses_in_relational_binary_operators = always_for_clarity
dotnet_style_predefined_type_for_locals_parameters_members = true
dotnet_style_predefined_type_for_member_access = true:warning
dotnet_style_prefer_auto_properties = true:warning
dotnet_style_prefer_compound_assignment = true:warning
dotnet_style_prefer_conditional_expression_over_assignment = false
dotnet_style_prefer_conditional_expression_over_return = false
dotnet_style_prefer_inferred_anonymous_type_member_names = true:warning
dotnet_style_prefer_inferred_tuple_names = true:warning
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:warning
dotnet_style_prefer_simplified_boolean_expressions = true:warning
dotnet_style_prefer_simplified_interpolation = true
dotnet_style_qualification_for_event = false:error
dotnet_style_qualification_for_field = false
dotnet_style_qualification_for_method = false:error
dotnet_style_qualification_for_property = false:error
dotnet_style_readonly_field = true:warning
dotnet_style_require_accessibility_modifiers = for_non_interface_members
end_of_line = crlf
file_header_template = unset
indent_size = 4
indent_style = space
insert_final_newline = false
root = true
tab_width = 4
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1822
# https://github.com/dotnet/aspnetcore/blob/main/.editorconfig
# https://github.com/dotnet/project-system/blob/main/.editorconfig
# Question
csharp_prefer_simple_using_statement = false # Question
csharp_style_expression_bodied_constructors = when_on_single_line:none # Question
csharp_style_expression_bodied_properties = true # Question
csharp_style_implicit_object_creation_when_type_is_apparent = true:warning # Question
csharp_style_pattern_matching_over_as_with_null_check = false # Question
csharp_style_prefer_pattern_matching = false # Question
csharp_style_prefer_range_operator = false # Question
csharp_style_prefer_switch_expression = false # Question
csharp_style_unused_value_assignment_preference = unused_local_variable # Question
csharp_style_unused_value_expression_statement_preference = false # Question
csharp_style_var_elsewhere = false:none # Question
csharp_style_var_for_built_in_types = false:none # Question
csharp_style_var_when_type_is_apparent = false:warning # Question
dotnet_diagnostic.CA1001.severity = none # Question - Types that own disposable fields should be disposable
dotnet_diagnostic.CA1051.severity = none # Question - Do not declare visible instance fields
dotnet_diagnostic.CA1416.severity = none # Question - This call site is reachable on all platforms.
dotnet_diagnostic.CA1510.severity = none # Question - Use
dotnet_diagnostic.CA1834.severity = none # CA1834: Consider using 'StringBuilder.Append(char)' when applicable
dotnet_diagnostic.CA1860.severity = none # Question - Avoid using
dotnet_diagnostic.CA1862.severity = none # Question - Prefer using
dotnet_diagnostic.CA2208.severity = none # Question - Instantiate argument exceptions correctly
dotnet_diagnostic.CA2211.severity = none # Question - Non-constant fields should not be visible
dotnet_diagnostic.CA2249.severity = none # Question - Use
dotnet_diagnostic.CA2253.severity = none # Question - Named placeholders should not be numeric values
dotnet_diagnostic.CS0103.severity = none # Question - The name
dotnet_diagnostic.CS0168.severity = none # Question - The variable
dotnet_diagnostic.CS0219.severity = none # Question - The variable
dotnet_diagnostic.CS0612.severity = none # Question - is obsolete
dotnet_diagnostic.CS0618.severity = none # Question - Compiler Warning (level 2)
dotnet_diagnostic.CS0659.severity = none # Question - Compiler Warning (level 3)
dotnet_diagnostic.CS8019.severity = warning # Question - Unnecessary using directive.
dotnet_diagnostic.CS8600.severity = none # Question - Converting null literal or possible null value to non-nullable type
dotnet_diagnostic.CS8602.severity = none # Question - Dereference of a possibly null reference.
dotnet_diagnostic.CS8603.severity = none # Question - Possible null reference return
dotnet_diagnostic.CS8604.severity = none # Question - Possible null reference argument for parameter.
dotnet_diagnostic.CS8618.severity = none # Question - Non-nullable variable must contain a non-null value when exiting constructor
dotnet_diagnostic.CS8625.severity = none # Question - Cannot convert null literal to non-nullable reference type.
dotnet_diagnostic.CS8629.severity = none # Question - Nullable value type may be null
dotnet_diagnostic.CS8765.severity = none # Question - Nullability of type of parameter
dotnet_diagnostic.IDE0005.severity = none # Question - Remove unnecessary using directives
dotnet_diagnostic.IDE0008.severity = warning # Question - Use explicit type instead of
dotnet_diagnostic.IDE0017.severity = none # Question - Object initialization can be simplified
dotnet_diagnostic.IDE0019.severity = none # Question - Use pattern matching
dotnet_diagnostic.IDE0021.severity = none # Question - Use expression body for constructor
dotnet_diagnostic.IDE0022.severity = none # Question - Use expression body for method
dotnet_diagnostic.IDE0025.severity = none # Question - Use expression body for property
dotnet_diagnostic.IDE0027.severity = none # Question - Use expression body for accessor
dotnet_diagnostic.IDE0028.severity = none # Question - Use collection initializers or expressions
dotnet_diagnostic.IDE0031.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0032.severity = none # Question - Use auto property
dotnet_diagnostic.IDE0037.severity = none # Question - Member name can be simplified
dotnet_diagnostic.IDE0041.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0047.severity = none # Question - Parentheses preferences
dotnet_diagnostic.IDE0049.severity = warning # Question - Name can be simplified
dotnet_diagnostic.IDE0051.severity = none # Question - Remove unused private member
dotnet_diagnostic.IDE0053.severity = none # Question - Use expression body for lambdas
dotnet_diagnostic.IDE0054.severity = none # Question - Use compound assignment
dotnet_diagnostic.IDE0055.severity = none # Question - Formatting rule
dotnet_diagnostic.IDE0057.severity = none # Question - Substring can be simplified
dotnet_diagnostic.IDE0058.severity = none # Question - Remove unnecessary expression value
dotnet_diagnostic.IDE0059.severity = none # Question - Unnecessary assignment of a value to
dotnet_diagnostic.IDE0060.severity = none # Question - Remove unused parameter
dotnet_diagnostic.IDE0063.severity = none # Question - Use simple
dotnet_diagnostic.IDE0065.severity = none # Question -
dotnet_diagnostic.IDE0066.severity = none # Question - Use
dotnet_diagnostic.IDE0078.severity = none # Question - Use pattern matching (may change code meaning)
dotnet_diagnostic.IDE0090.severity = warning # Question - Simplify new expression
dotnet_diagnostic.IDE0160.severity = warning # Question - Use block-scoped namespace
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE0270.severity = none # Question - Null check can be simplified
dotnet_diagnostic.IDE0300.severity = none # Question - Collection initialization can be simplified
dotnet_diagnostic.IDE1006.severity = none # Question - Use collection expression for builder dotnet_style_prefer_collection_expression
dotnet_style_null_propagation = false # Question
dotnet_style_object_initializer = false # Question
dotnet_style_prefer_auto_properties = false # Question
dotnet_style_allow_statement_immediately_after_block_experimental = true # Question
dotnet_style_prefer_is_null_check_over_reference_equality_method = false # Question
dotnet_style_prefer_inferred_anonymous_type_member_names = false:warning # Question

View File

@ -1 +0,0 @@
[]

View File

@ -1,30 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/net8.0/win-x64/Fab2ApprovalSystem.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"stopAtEntry": false
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"type": "node",
"request": "launch",
"name": "node Launch Current Opened File",
"program": "${file}"
}
]
}

View File

@ -1,424 +0,0 @@
{
"[markdown]": {
"editor.wordWrap": "off"
},
"files.exclude": {
"**/.git": false,
"**/node_modules": true
},
"files.watcherExclude": {
"**/node_modules": true
},
"cSpell.words": [
"abutton",
"accessibilities",
"accodingly",
"acknowledgmentby",
"Acks",
"actionsheet",
"Additonal",
"Addtional",
"againm",
"agendaview",
"Antlr",
"Appover",
"Appprrovers",
"Approvalog",
"Aprovers",
"Aproverslist",
"asax",
"aspnetmvc",
"Assignedto",
"Atachments",
"Attachemnt",
"Attachemnts",
"Attchment",
"auditee",
"Auditee",
"Auditees",
"automaically",
"Autthorized",
"beacuase",
"beforeunload",
"Belguim",
"bfound",
"bgcolor",
"Bies",
"binded",
"blackbackground",
"blackhover",
"blackpressed",
"blueenergy",
"blueopal",
"buttongroup",
"BYMRB",
"bytesgot",
"CAID",
"casection",
"CAXXXX",
"CCPCR",
"CCPCRB",
"cellspacing",
"Cheeso's",
"chkbx",
"Clib",
"colorpicker",
"columnmenu",
"columnsreorder",
"columnsresize",
"comming",
"Containmen",
"Copmments",
"correctiv",
"Correctivet",
"Creat",
"currentd",
"Cyle",
"dadada",
"darkbluehover",
"darkbluepressed",
"darkred",
"datafields",
"datasource",
"dataviz",
"datepicker",
"datetimepicker",
"dayview",
"Deletet",
"Delgation",
"DENITED",
"Deparmtent",
"departmentids",
"Descirption",
"devprog",
"dfeffc",
"Disp",
"Dispo",
"Dispoitio",
"Dispos",
"Dispositon",
"Dispostion",
"Dispostions",
"dispotypevalidation",
"Docbase",
"Documentum",
"Documetum",
"dont",
"downlaoded",
"draganddrop",
"dragcancel",
"dropdownlist",
"Eamils",
"ECNPCRB",
"Ecns",
"edmx",
"EECN",
"emai",
"emailparams",
"Emergrncy",
"energyblue",
"Eran",
"Esql",
"ETECN",
"EXCELOPENXML",
"existinglocation",
"Expando",
"extrafield",
"fadc",
"fbec",
"fcfdfd",
"fdff",
"fece",
"feeebd",
"ffdc",
"ffdd",
"fieldset",
"FILIPE",
"filtermenu",
"Fldr",
"flintstone",
"FLOWLOCS",
"FMEA",
"ftplib",
"FTPSPN",
"GETDATE",
"gitea",
"globaldocudms",
"glyphicons",
"groupable",
"Guids",
"halflings",
"Hexsize",
"highcontrast",
"Hmac",
"holdsteps",
"hostspecific",
"icenium",
"IECN",
"imagebrowser",
"IMRB",
"Infineon",
"Insertd",
"inverseicons",
"IPCRB",
"ISADMIN",
"islast",
"ISNULL",
"ITAR",
"jquery",
"jqueryval",
"jqwidgets",
"jqxbuttongroup",
"jqxbuttons",
"jqxcalendar",
"jqxchart",
"jqxcheckbox",
"jqxcolorpicker",
"jqxcombobox",
"jqxcore",
"jqxdata",
"jqxdatatable",
"jqxdatetimeinput",
"jqxdocking",
"jqxdockpanel",
"jqxdragdrop",
"jqxdropdownbutton",
"jqxdropdownlist",
"jqxexpander",
"jqxgauge",
"jqxgrid",
"jqxinput",
"jqxknockout",
"jqxlistbox",
"jqxlistmenu",
"jqxmaskedinput",
"jqxmenu",
"jqxnavigationbar",
"jqxnumberinput",
"jqxpanel",
"jqxpasswordinput",
"jqxprogressbar",
"jqxradiobutton",
"jqxrangeselector",
"jqxrating",
"jqxresponse",
"jqxscrollbar",
"jqxscrollview",
"jqxslider",
"jqxsplitter",
"jqxswitchbutton",
"jqxtabs",
"jqxtooltip",
"jqxtouch",
"jqxtree",
"jqxtreegrid",
"jqxtreemap",
"jqxvalidator",
"jqxwindow",
"kendogridcustom",
"kendoui",
"labelelement",
"labelledby",
"Leanred",
"lightgray",
"linkbutton",
"Linq",
"Listdiv",
"listview",
"Lnks",
"localfilename",
"loclist",
"logis",
"logtext",
"loopmis",
"lotdispo",
"LOTDISPSITION",
"Lotfile",
"lotlist",
"lotstatusoption",
"LTRIM",
"MADUREIRA",
"mailrelay",
"MDTM",
"meego",
"meetingid",
"menubutton",
"mesafi",
"metroblack",
"metrodark",
"miliseconds",
"modalview",
"modernizr",
"Modernizr",
"monthview",
"MRBIs",
"Mrbs",
"msecs",
"multipleextended",
"Navigatable",
"nbsp",
"newbase",
"newchange",
"newdi",
"newfilename",
"newsource",
"Newtonsoft",
"notications",
"Notifcation",
"Notifyf",
"NTLM",
"Nullcc",
"numerictextbox",
"objdata",
"OCAP",
"occured",
"odata",
"oldfilename",
"OLHOLD",
"onclick",
"onmousemove",
"OPDESC",
"OPENQUERY",
"Oper",
"operationslist",
"Orginator",
"Originatorname",
"Ouellette",
"Owin",
"pageable",
"Pageable",
"panelbar",
"parentid",
"parminput",
"parms",
"Parms",
"particula",
"pasv",
"PASV",
"PATINDEX",
"PCRB",
"PCRBID",
"pcrvalues",
"pdbonly",
"Preventitive",
"preventivet",
"Prevetative",
"proces",
"Processedl",
"procs",
"productfamilies",
"progess",
"progressbar",
"qrcode",
"Quanityt",
"rangebar",
"Recep",
"Recepient",
"recieved",
"recordlock",
"remotefilename",
"reorderable",
"reportform",
"reportslist",
"reportslistdiv",
"Reqquired",
"Reqs",
"Requiest",
"Responsibles",
"RETR",
"Revisioing",
"Revisioned",
"Revison",
"rgba",
"rkotian",
"RNFR",
"RNTO",
"Roless",
"roundbg",
"RTRIM",
"SAMDB",
"scroller",
"scrollview",
"seleced",
"selectionlog",
"Selectpart",
"sess",
"Sfisharepoint",
"shinyblack",
"showpassword",
"SIGNON",
"simpleparser",
"slddrw",
"sldprt",
"sortasc",
"sortascbutton",
"sortdesc",
"sortdescbutton",
"sortremove",
"sparkline",
"splitview",
"SPNMRB",
"SPNPDB",
"SSRS",
"Sssign",
"Staus",
"stylesheet",
"Submited",
"subrole",
"subroles",
"Succefully",
"Succesfully",
"sucessfully",
"SURP",
"Swashbuckle",
"SWRN",
"tabindex",
"tabstrip",
"Tahoma",
"taskcompleted",
"Tasklist",
"Taveler",
"TECN",
"TECNs",
"TEMIRWAP",
"tempecd",
"tempimplement",
"templabel",
"tempvalue",
"TEMSA",
"timepicker",
"Tobe",
"Toplevel",
"Totrav",
"trainingby",
"Traininglist",
"traininglistdiv",
"transanction",
"Trav",
"Traveller",
"Traverler",
"TRAVLELER",
"Travler",
"TREEVIEW",
"trigerred",
"ttinclude",
"Uhandled",
"Updat",
"Uplaod",
"Upto",
"userevents",
"userids",
"userlist",
"Validatable",
"valueelement",
"Variabls",
"Verdana",
"vgrid",
"viewmodel",
"vsdoc",
"whethere",
"windowsphone",
"Winsock",
"worlflow"
]
}

View File

@ -1,20 +0,0 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "MSBuild",
"command": "C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Current/Bin/MSBuild.exe",
"type": "process",
"args": [
"/target:Build",
"/restore:True",
"/p:RestoreSources=https://artifactory.intra.infineon.com/artifactory/api/nuget/ngt-fi-package-main-vir/%3Bhttps://packagemanagement.eu.infineon.com:4430/api/v2/%3Bhttps://api.nuget.org/v3/index.json",
"/detailedsummary",
"/consoleloggerparameters:PerformanceSummary;ErrorsOnly;",
"/property:Configuration=Debug;TargetFrameworkVersion=v4.8",
"Fab2ApprovalSystem.csproj"
],
"problemMatcher": "$msCompile"
}
]
}

View File

@ -1,31 +0,0 @@
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
####
insert_final_newline = false
csharp_style_namespace_declarations = file_scoped:warning
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines

View File

@ -1,17 +1,19 @@
using System.Web;
using System.Web.Optimization;
namespace Fab2ApprovalSystem;
public class BundleConfig {
namespace Fab2ApprovalSystem
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles) {
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js")
);
// bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
//bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
// "~/Scripts/jquery.validate*"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
@ -28,6 +30,7 @@ public class BundleConfig {
"~/Scripts/respond.min.js",
"~/Scripts/common.js"));
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
"~/Scripts/kendo/kendo.all.min.js",
"~/Scripts/kendo/kendo.aspnetmvc.min.js"));
@ -42,6 +45,7 @@ public class BundleConfig {
"~/Scripts/jqwidgets/styles/jqx.arctic.css",
"~/Scripts/jqwidgets/styles/jqx.energyblue.css"));
bundles.Add(new ScriptBundle("~/Content/jqw/jq").Include(
"~/Scripts/jqwidgets/jqxcore.js",
"~/Scripts/jqwidgets/jqxdata.js",
@ -51,8 +55,12 @@ public class BundleConfig {
"~/Scripts/jqwidgets/jqxpanel.js",
"~/Scripts/jqwidgets/jqxtree.js"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.min.css",
"~/Content/site.css",
"~/Content/jquery-ui.css"));
}
}
}

View File

@ -1,10 +1,13 @@
using System.Web;
using System.Web.Mvc;
namespace Fab2ApprovalSystem;
public class FilterConfig {
public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
namespace Fab2ApprovalSystem
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}

View File

@ -6,10 +6,12 @@ using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace Fab2ApprovalSystem;
public class RouteConfig {
public static void RegisterRoutes(RouteCollection routes) {
namespace Fab2ApprovalSystem
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
@ -20,5 +22,11 @@ public class RouteConfig {
// otherwise MVC generates the wrong form action url
defaults: new { controller = "Home", action = "MyTasks", id = UrlParameter.Optional }
);
//routes.MapHttpRoute(
// name: "ApiRoute",
// routeTemplate: "api/{controller}/{id}",
// defaults: new { id = RouteParameter.Optional }
//);
}
}
}

View File

@ -1,20 +1,38 @@
using Microsoft.AspNet.Identity;
using Microsoft.Owin;
using Microsoft.Owin.Security.Cookies;
using Owin;
namespace Fab2ApprovalSystem;
public partial class Startup {
namespace Fab2ApprovalSystem
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app) {
public void ConfigureAuth(IAppBuilder app)
{
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(new CookieAuthenticationOptions {
app.UseCookieAuthentication(new CookieAuthenticationOptions
{
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
LoginPath = new PathString("/Account/Login")
});
// Use a cookie to temporarily store information about a user logging in with a third party login provider
// app.UseExternalSignInCookie(DefaultAuthenticationTypes.ExternalCookie);
// Uncomment the following lines to enable logging in with third party login providers
//app.UseMicrosoftAccountAuthentication(
// clientId: "",
// clientSecret: "");
//app.UseTwitterAuthentication(
// consumerKey: "",
// consumerSecret: "");
//app.UseFacebookAuthentication(
// appId: "",
// appSecret: "");
//app.UseGoogleAuthentication();
}
}
}

View File

@ -1,9 +1,14 @@
using System.Web.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace Fab2ApprovalSystem;
public static class WebApiConfig {
public static void Register(HttpConfiguration config) {
namespace Fab2ApprovalSystem
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
@ -12,4 +17,5 @@ public static class WebApiConfig {
defaults: new { id = RouteParameter.Optional }
);
}
}
}

View File

@ -1,9 +1,9 @@
/*vertical height between form-groups*/
.my-form .form-group {
 /*vertical height between form-groups*/
.my-form .form-group {
margin-bottom: 4px;
}
}
@media (min-width:768px) {
@media (min-width:768px) {
.my-form .row {
margin-left: -1px;
margin-right: -1px;
@ -12,8 +12,7 @@
.my-form [class*="col-"] {
padding: 0 2px;
}
}
}
body {
padding-top: 50px;
padding-bottom: 20px;
@ -30,10 +29,10 @@ body {
/*input,
select
{
max-width: 280px;
max-width: 280px;
}*/
.row {
.row{
margin-top: 2px;
margin-bottom: 2px
}
@ -72,10 +71,10 @@ input[type="checkbox"].input-validation-error {
padding-left: 20px;
padding-right: 20px;
background-color: #87b3de;
background-image: -moz-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-linear-gradient(top, #87b3de, #4d79a5);
background-image: -moz-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-linear-gradient(top,#87b3de, #4d79a5);
background-image: -o-linear-gradient(top, #87b3de, #4d79a5);
background-image: linear-gradient(top, #87b3de, #4d79a5);
background-repeat: repeat-x;
@ -90,7 +89,7 @@ input[type="checkbox"].input-validation-error {
.label-color {
background-color: #e5e0e0;
}
}
.linkbutton {
display: inline-block;
@ -102,17 +101,6 @@ input[type="checkbox"].input-validation-error {
border: 0;
vertical-align: middle;
}
.linkbutton.edit {
background: url('/Content/icons/edit.gif');
}
.modal-dialog {
margin-top: 80px;
}
.affix {
position: fixed;
top: 55px;
left: 25px;
}

View File

@ -1,31 +0,0 @@
#### .NET Coding Conventions ####
# Organize usings
dotnet_separate_import_directive_groups = true
dotnet_sort_system_directives_first = true
# New line preferences
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
csharp_style_allow_embedded_statements_on_same_line_experimental = true
#### C# Formatting Rules ####
# New line preferences
csharp_new_line_before_catch = false
csharp_new_line_before_else = false
csharp_new_line_before_finally = false
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_open_brace = none
csharp_new_line_between_query_expression_clauses = true
####
insert_final_newline = false
csharp_style_namespace_declarations = file_scoped:warning
dotnet_diagnostic.IDE0161.severity = warning # Question - Namespace declaration preferences
dotnet_diagnostic.IDE2000.severity = error # IDE2000: Allow multiple blank lines

View File

@ -1,32 +1,32 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Security;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Fab2ApprovalSystem.Models;
using System.Web.Security;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.DMO;
using Microsoft.AspNet.Identity.Owin;
using System.Net.Http;
using Newtonsoft.Json;
using System.Net.Http.Headers;
using System.Text;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
public class AccountController : Controller {
namespace Fab2ApprovalSystem.Controllers {
[Authorize]
public class AccountController : Controller {
private string _apiBaseUrl;
public AccountController()
: 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) {
@ -35,6 +35,7 @@ public class AccountController : Controller {
public UserManager<ApplicationUser> UserManager { get; private set; }
//
// GET: /Account/Login
[AllowAnonymous]
// try to make the browser refresh the login page every time, to prevent issues with changing usernames and the anti-forgery token validation
@ -44,7 +45,60 @@ public class AccountController : Controller {
return View();
}
private void SetSessionParameters(LoginResult loginResult, LoginModel user) {
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginModel model, string returnUrl) {
try {
bool isLoginValid;
HttpClient httpClient = HttpClientFactory.Create();
httpClient.BaseAddress = new Uri(_apiBaseUrl);
AuthAttempt authAttempt = new AuthAttempt() {
LoginID = model.LoginID,
Password = model.Password
};
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "auth/login");
request.Content = new StringContent(JsonConvert.SerializeObject(authAttempt),
Encoding.UTF8,
"application/json");
HttpResponseMessage httpResponseMessage = await httpClient.SendAsync(request);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new Exception($"The authentication API failed, because {httpResponseMessage.ReasonPhrase}");
string responseContent = await httpResponseMessage.Content.ReadAsStringAsync();
LoginResult loginResult = JsonConvert.DeserializeObject<LoginResult>(responseContent);
#if(DEBUG)
isLoginValid = true;
#endif
#if (!DEBUG)
bool isIFX = false;
//domainProvider = Membership.Providers["NA_ADMembershipProvider"];
//isLoginValid = domainProvider.ValidateUser(model.LoginID, model.Password);
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
isLoginValid = true;
} else {
isLoginValid = loginResult.IsAuthenticated;
if (isLoginValid) isIFX = true;
}
#endif
if (isLoginValid) {
UserAccountDMO userDMO = new UserAccountDMO();
LoginModel user = userDMO.GetUser(model.LoginID);
if (user != null) {
Session["JWT"] = loginResult.AuthTokens.JwtToken;
Session["RefreshToken"] = loginResult.AuthTokens.RefreshToken;
@ -56,43 +110,6 @@ public class AccountController : Controller {
Session[GlobalVars.CAN_CREATE_PARTS_REQUEST] = user.IsAdmin || PartsRequestController.CanCreatePartsRequest(user.UserID);
FormsAuthentication.SetAuthCookie(user.LoginID, true);
}
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginModel model, string returnUrl) {
try {
bool isLoginValid;
HttpClient httpClient = HttpClientFactory.Create();
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
#if (DEBUG)
isLoginValid = true;
#endif
#if (!DEBUG)
bool isIFX = false;
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
isLoginValid = true;
} else {
isLoginValid = loginResult.IsAuthenticated;
if (isLoginValid)
isIFX = true;
}
#endif
if (isLoginValid) {
UserAccountDMO userDMO = new UserAccountDMO();
LoginModel user = userDMO.GetUser(model.LoginID);
if (user != null) {
SetSessionParameters(loginResult, user);
return RedirectToLocal(returnUrl);
} else {
@ -102,68 +119,14 @@ public class AccountController : Controller {
ModelState.AddModelError("", "The user name or password provided is incorrect.");
}
} catch (Exception ex) {
Functions.WriteEvent(GlobalVars.AppSettings, @User.Identity.Name + " " + ex.InnerException, System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(@User.Identity.Name + " " + ex.InnerException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = 99999, UserID = @User.Identity.Name, DocumentType = "Login", OperationType = "Error", Comments = "Reject - " + ex.Message });
ModelState.AddModelError("", ex.Message);
}
return View(model);
// If we got this far, something failed, redisplay form
}
[HttpPost]
[AllowAnonymous]
public async Task<HttpResponseMessage> ExternalAuthSetup(AuthAttempt authAttempt) {
try {
bool isLoginValid;
HttpClient httpClient = HttpClientFactory.Create();
httpClient.BaseAddress = new Uri(GlobalVars.AppSettings.ApiBaseUrl);
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);
#if (DEBUG)
isLoginValid = true;
#endif
#if (!DEBUG)
bool isIFX = false;
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
isLoginValid = true;
} else {
isLoginValid = loginResult.IsAuthenticated;
if (isLoginValid)
isIFX = true;
}
#endif
if (isLoginValid) {
UserAccountDMO userDMO = new UserAccountDMO();
LoginModel user = userDMO.GetUser(authAttempt.LoginID);
if (user != null) {
SetSessionParameters(loginResult, user);
return new HttpResponseMessage(HttpStatusCode.OK);
} else {
ModelState.AddModelError("", "The user name does not exist in the DB. Please contact the System Admin");
return new HttpResponseMessage(HttpStatusCode.NotFound);
}
} else {
ModelState.AddModelError("", "The user name or password provided is incorrect.");
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
}
} catch (Exception ex) {
Functions.WriteEvent(GlobalVars.AppSettings, @User.Identity.Name + " " + ex.InnerException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = 99999, UserID = @User.Identity.Name, DocumentType = "Login", OperationType = "Error", Comments = "Reject - " + ex.Message });
ModelState.AddModelError("", ex.Message);
return new HttpResponseMessage(HttpStatusCode.InternalServerError);
}
}
// GET: /Account/Register
@ -210,6 +173,7 @@ public class AccountController : Controller {
return new ChallengeResult(provider, Url.Action("LinkLoginCallback", "Account"), User.Identity.GetUserId());
}
//
// GET: /Account/LinkLoginCallback
public async Task<ActionResult> LinkLoginCallback() {
ExternalLoginInfo loginInfo = await AuthenticationManager.GetExternalLoginInfoAsync(XsrfKey, User.Identity.GetUserId());
@ -320,4 +284,5 @@ public class AccountController : Controller {
}
}
#endregion
}
}

View File

@ -1,95 +1,178 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Kendo.Mvc.Extensions;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
public class AdminController : Controller {
namespace Fab2ApprovalSystem.Controllers
{
[Authorize]
[SessionExpireFilter]
public class AdminController : Controller
{
// GET: /Admin/
UserAccountDMO userDMO = new UserAccountDMO();
AdminDMO adminDMO = new AdminDMO();
TrainingDMO trainingDMO = new TrainingDMO();
LotDispositionDMO ldDMO = new LotDispositionDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public ActionResult Index() {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Index()
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
var model = userDMO.GetAllUsers();
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
return View(model);
} else
}
else
return Content("Not Autthorized");
}
public ActionResult AssignRoles() {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult AssignRoles()
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
ViewBag.ToplevelNode = GetRoles_SubRolesList();
return View();
} else
}
else
return Content("Not Autthorized");
}
public ActionResult GetAllUserList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetAllUserList([DataSourceRequest] DataSourceRequest request)
{
IEnumerable<LoginModel> userlist = userDMO.GetAllActiveUsers();
return Json(userlist, JsonRequestBehavior.AllowGet);
}
/// <summary>
/// For the Administration of the Users
/// </summary>
public ActionResult GetGridUserList([DataSourceRequest] DataSourceRequest request) {
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetGridUserList([DataSourceRequest] DataSourceRequest request)
{
return Json(userDMO.GetAllUsers().ToDataSourceResult(request));
}
public JsonResult GetAllUserListBySubRole(int subRole) {
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <returns></returns>
public JsonResult GetAllUserListBySubRole(int subRole)
{
IEnumerable<LoginModel> userlist = adminDMO.GetAllUsersBySubRole(subRole);
return Json(userlist, JsonRequestBehavior.AllowGet);
}
public JsonResult AllSubRoles(string showInactiveRoles = "") {
List<ParentChildModel> newRoles = adminDMO.GetAllSubRoles(showInactiveRoles);
/// <summary>
///
/// </summary>
/// <returns></returns>
public JsonResult AllSubRoles(string showInactiveRoles = "")
{
List<Role> roles = adminDMO.GetSubRoles();
return Json(newRoles, JsonRequestBehavior.AllowGet);
ParentChildModel parent;
ParentChildModel child = new ParentChildModel();
List<ParentChildModel> newRoles = new List<ParentChildModel>();
foreach (Role r in roles)
{
parent = new ParentChildModel();
parent.id = r.RoleID;
parent.parentid = -1;
parent.text = r.RoleName;
parent.value = r.RoleID.ToString();
foreach (SubRole sr in r.SubRoles)
{
if (sr.Inactive)
{
// hide inactive roles unless parameter says otherwise
if (showInactiveRoles.Equals("true") == false)
continue;
}
public ActionResult GetSubRoleListByUserId([DataSourceRequest] DataSourceRequest request, string userId) {
child = new ParentChildModel();
child.id = sr.SubRoleID;
child.parentid = r.RoleID;
child.text = sr.SubRoleCategoryItem + (sr.Inactive ? " (Inactive)" : "");
child.value = sr.SubRoleID.ToString();
newRoles.Add(child);
}
newRoles.Add(parent);
};
return Json(newRoles, JsonRequestBehavior.AllowGet);
}
public ActionResult GetSubRoleListByUserId([DataSourceRequest] DataSourceRequest request, string userId)
{
int userIdInt = Convert.ToInt32(userId);
return Json(adminDMO.GetUserSubRoles(userIdInt).ToDataSourceResult(request));
}
//
/// <summary>
/// OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
///OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
/// </summary>
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList() {
/// <returns></returns>
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList()
{
List<Role> roles = adminDMO.GetSubRoles();
List<TreeViewItemModel> ToplevelNode = new List<TreeViewItemModel>();
List<TreeViewItemModel> parentList = new List<TreeViewItemModel>();
List<TreeViewItemModel> childList = new List<TreeViewItemModel>();
TreeViewItemModel parent = new TreeViewItemModel();
TreeViewItemModel child = new TreeViewItemModel();
foreach (Role r in roles) {
foreach (Role r in roles)
{
parent = new TreeViewItemModel();
parent.HasChildren = true;
parent.Text = r.RoleName;
parent.Id = r.RoleID.ToString();
foreach (SubRole sr in r.SubRoles) {
foreach (SubRole sr in r.SubRoles)
{
child = new TreeViewItemModel();
child.Text = sr.SubRoleCategoryItem;
child.Id = sr.SubRoleID.ToString();
@ -100,290 +183,576 @@ public class AdminController : Controller {
ToplevelNode.Add(parent);
};
return ToplevelNode;
}
public ActionResult AddUserRoles(int subRole, string users) {
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <param name="users"></param>
/// <returns></returns>
public ActionResult AddUserRoles(int subRole, string users)
{
adminDMO.AddUserRoles(subRole, users);
return View();
}
public ActionResult ReplaceUserRoles(int subRole, string users) {
public ActionResult ReplaceUserRoles(int subRole, string users)
{
adminDMO.AddUserRoles(subRole, users);
return Content("Success");
}
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <param name="users"></param>
/// <returns></returns>
public ActionResult DeleteUserRoles(int subRole, string users)
{
public ActionResult DeleteUserRoles(int subRole, string users) {
adminDMO.DeleteUserRoles(subRole, users);
return Content("");
}
//
// GET: /Workflow/Details/5
public ActionResult Details(int id) {
public ActionResult Details(int id)
{
return View();
}
//
// GET: /Workflow/Create
public ActionResult Create() {
public ActionResult Create()
{
return View();
}
//
// POST: /Workflow/Create
[HttpPost]
public ActionResult Create(FormCollection collection) {
try {
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index");
} catch {
}
catch
{
return View();
}
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="model"></param>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult BatchUpdateUser([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable<LoginModel> model) {
public ActionResult BatchUpdateUser([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<LoginModel> model)
{
//if (model != null && ModelState.IsValid)
//{
// userDMO.UpdateUser(model);
//}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult UpdateUser([DataSourceRequest] DataSourceRequest request, LoginModel model) {
if (model != null && ModelState.IsValid) {
public ActionResult UpdateUser([DataSourceRequest] DataSourceRequest request, LoginModel model)
{
if (model != null && ModelState.IsValid)
{
userDMO.UpdateUser(model);
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
public ActionResult DeleteUser(string userId) {
LoginModel loginModel = userDMO.GetUserByID(Convert.ToInt32(userId));
adminDMO.DeleteUser(userDMO, trainingDMO, loginModel);
return Content("Success");
///// <summary>
/////
///// </summary>
///// <param name="request"></param>
///// <param name="model"></param>
///// <returns></returns>
//[AcceptVerbs(HttpVerbs.Post)]
//public ActionResult DeleteUser([DataSourceRequest] DataSourceRequest request, LoginModel model)
//{
// if (model != null && ModelState.IsValid)
// {
// userDMO.DeleteUser(model);
// //Remove open trainings
// //Get a list of all user assigned trainings.
// List<TrainingAssignment> trainingAssignments = trainingDMO.GetTrainingAssignmentsByUserID(model.UserID);
// //Go Through that list.
// foreach(var trainingAssignment in trainingAssignments)
// {
// //Delete Any document acknowledgements.
// trainingDMO.DeleteTrainingDocAck(trainingAssignment.ID);
// //Delete the training assignment itself
// trainingDMO.DeleteTrainingAssignment(trainingAssignment.ID);
// //Check the parent Training task to set to to complete if applicable.
// if (trainingDMO.CheckTrainingStatus(trainingAssignment.ID))
// {
// int TrainingID = trainingDMO.GetTrainingIdByAssignment(trainingAssignment.TrainingID);
// //Set Training status to complete
// trainingDMO.UpdateTrainingStatus(TrainingID);
// }
// }
// //Remove user from any Training Groups
// adminDMO.DeleteUserFromAllTrainingGroups(model.UserID);
// //Remove User from training report notifications
// adminDMO.TrainingReportDeleteUser(model.UserID);
// //Remove user from TECN Expiration Notifications
// adminDMO.TECNExpirationDeleteUser(model.UserID);
// //Get user subroles
// List<UserSubRoles> userSubRoles = adminDMO.GetUserSubRoles(model.UserID);
// //Delete user from any subroles
// foreach (var userSubRole in userSubRoles)
// {
// DeleteUserRoles(userSubRole.SubRoleID, model.UserID.ToString());
// }
// }
// return Json(new[] { model }.ToDataSourceResult(request, ModelState));
//}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="model"></param>
/// <returns></returns>
public ActionResult DeleteUser(string userId)
{
LoginModel model = userDMO.GetUserByID(Convert.ToInt32(userId));
if (model != null)
{
userDMO.DeleteUser(model);
//Remove open trainings
//Get a list of all user assigned trainings.
List<TrainingAssignment> trainingAssignments = trainingDMO.GetTrainingAssignmentsByUserID(model.UserID);
//Go Through that list.
foreach (var trainingAssignment in trainingAssignments)
{
//Delete Any document acknowledgements.
trainingDMO.DeleteTrainingDocAck(trainingAssignment.ID);
//Delete the training assignment itself
trainingDMO.DeleteTrainingAssignment(trainingAssignment.ID);
//Check the parent Training task to set to to complete if applicable.
if (trainingDMO.CheckTrainingStatus(trainingAssignment.ID))
{
int TrainingID = trainingAssignment.TrainingID;
//Set Training status to complete
trainingDMO.UpdateTrainingStatus(TrainingID);
}
}
//Remove user from any Training Groups
adminDMO.DeleteUserFromAllTrainingGroups(model.UserID);
//Remove User from training report notifications
adminDMO.TrainingReportDeleteUser(model.UserID);
//Remove user from TECN Expiration Notifications
adminDMO.TECNExpirationDeleteUser(model.UserID);
//Get user subroles
List<UserSubRoles> userSubRoles = adminDMO.GetUserSubRoles(model.UserID);
//Delete user from any subroles
foreach (var userSubRole in userSubRoles)
{
DeleteUserRoles(userSubRole.SubRoleID, model.UserID.ToString());
}
}
return Content("Success");
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="model"></param>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult InsertUser([DataSourceRequest] DataSourceRequest request, LoginModel model) {
try {
if (model != null && ModelState.IsValid) {
public ActionResult InsertUser([DataSourceRequest] DataSourceRequest request, LoginModel model)
{
try
{
if (model != null && ModelState.IsValid)
{
userDMO.InsertUser(model);
}
} catch (Exception ex) {
}
catch (Exception ex)
{
// TODO
throw new Exception(ex.Message);
}
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
}
public ActionResult EnableOOOStatus(int oooUserID, int delegatedTo, DateTime startDate, DateTime endDate) {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult EnableOOOStatus(int oooUserID, int delegatedTo, DateTime startDate, DateTime endDate)
{
int returnValue = MiscDMO.EnableOOOStatus(oooUserID, delegatedTo, startDate, endDate);
if (returnValue == 3) // the delegator is already a delegator to someone else
{
return Content("3");
} else
}
else
return Content("");
// TODO - Send an email to the OOO person and to the Delegated person
//return View();
}
public void ExpireOOOStatus(int oooUserID) {
/// <summary>
///
/// </summary>
/// <param name="oooUserID"></param>
public void ExpireOOOStatus(int oooUserID)
{
MiscDMO.ExpireOOOStatus(oooUserID);
// TODO - Does it need to send an email
}
public ActionResult ManageTrainingGroups() {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
public ActionResult ManageTrainingGroups()
{
//List<TrainingGroup> allGroups = GetTrainingGroups();
//return View(allGroups);
if ((bool)Session[GlobalVars.IS_ADMIN])
{
ViewBag.AllGroups = GetTrainingGroups();
return View();
} else
}
else
return Content("Not Autthorized");
}
public void RefreshGroups() {
public void RefreshGroups()
{
ViewBag.AllGroups = GetTrainingGroups();
}
public ActionResult TrainingGroups() {
public ActionResult TrainingGroups()
{
List<TrainingGroup> trainingGroups = adminDMO.GetTrainingGroups();
return PartialView(trainingGroups);
}
public List<TrainingGroup> GetTrainingGroups()
{
public List<TrainingGroup> GetTrainingGroups() {
List<TrainingGroup> TrainingGroups = adminDMO.GetTrainingGroups();
return TrainingGroups;
}
public ActionResult GetTaskListByUser([DataSourceRequest] DataSourceRequest request, string userId) {
//List<TreeViewItemModel> ToplevelNode = new List<TreeViewItemModel>();
//List<TreeViewItemModel> parentList = new List<TreeViewItemModel>();
//List<TreeViewItemModel> childList = new List<TreeViewItemModel>();
//TreeViewItemModel parent = new TreeViewItemModel();
//TreeViewItemModel child = new TreeViewItemModel();
//parent = new TreeViewItemModel();
//parent.HasChildren = true;
//parent.Text = "Training Groups";
//foreach (TrainingGroup group in TrainingGroups)
//{
// child = new TreeViewItemModel();
// child.Text = group.TrainingGroupName;
// child.Id = group.TrainingGroupID.ToString();
// parent.Items.Add(child);
//}
//ToplevelNode.Add(parent);
////foreach (Role r in roles)
////{
//// parent = new TreeViewItemModel();
//// parent.HasChildren = true;
//// parent.Text = r.RoleName;
//// parent.Id = r.RoleID.ToString();
//// foreach (SubRole sr in r.SubRoles)
//// {
//// child = new TreeViewItemModel();
//// child.Text = sr.SubRoleCategoryItem;
//// child.Id = sr.SubRoleID.ToString();
//// parent.Items.Add(child);
//// }
//// ToplevelNode.Add(parent);
////};
return TrainingGroups;
}
public ActionResult GetTaskListByUser([DataSourceRequest]DataSourceRequest request, string userId)
{
IEnumerable<IssuesViewModel> data = ldDMO.GetTaskList(Convert.ToInt32(userId));
data = from a in data where a.PendingApprovers != null select a;
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public ActionResult GetOpenActionItemsByUser([DataSourceRequest] DataSourceRequest request, string userId) {
public ActionResult GetOpenActionItemsByUser([DataSourceRequest]DataSourceRequest request, string userId)
{
IEnumerable<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems(Convert.ToInt32(userId));
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
public ActionResult AddNewTrainingGroup(string groupName) {
try {
public ActionResult AddNewTrainingGroup(string groupName)
{
try
{
adminDMO.AddNewTrainingGroup(groupName);
return Json(new { test = "Succesfully saved" });
} catch {
return Json(new {test = "Succesfully saved" });
}
catch
{
return Content("Unable to Save Group", "application/json");
}
}
public ActionResult DeleteTrainingGroup(int groupID) {
try {
}
public ActionResult DeleteTrainingGroup(int groupID)
{
try
{
adminDMO.DeleteTrainingGroup(groupID);
return Json(new { response = "Successfully Deleted" });
} catch {
}
catch
{
return Json(new { response = "Unsuccessfully Deleted" });
}
}
public ActionResult ViewTrainingGroup(int TrainingGroupID) {
public ActionResult ViewTrainingGroup(int TrainingGroupID)
{
ViewBag.GroupID = TrainingGroupID;
return View();
}
public ActionResult TrainingGroupPartial(int TrainingGroupID) {
public ActionResult TrainingGroupPartial(int TrainingGroupID)
{
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
ViewBag.TrainingGroupId = TrainingGroupID;
List<TrainingGroupMember> trainingGroupMembers = adminDMO.GetTrainingGroupMembers(TrainingGroupID);
return PartialView(trainingGroupMembers);
}
public ActionResult AddToGroup(int userId, int groupId) {
try {
public ActionResult AddToGroup(int userId, int groupId)
{
try
{
adminDMO.AddUserToGroup(userId, groupId);
} catch (Exception e) {
}
catch(Exception e)
{
return Json(new { test = e.Message });
}
return Json(new { test = "Succesfully saved" });
}
public ActionResult DeleteFromGroup(int userId, int groupId) {
try {
public ActionResult DeleteFromGroup(int userId, int groupId)
{
try
{
adminDMO.DeleteFromGroup(userId, groupId);
} catch (Exception e) {
}
catch (Exception e)
{
return Json(new { test = e.Message });
}
return Json(new { test = "Succesfully removed" });
}
public ActionResult JobSchedulerConfiguration()
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
public ActionResult JobSchedulerConfiguration() {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
return View();
} else
}
else
return Content("Not Autthorized");
}
public ActionResult TrainingReportConfig() {
public ActionResult TrainingReportConfig()
{
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
List<TrainingReportUser> currentTrainingReportUsersIds = adminDMO.GetTrainingReportUsers();
List<LoginModel> currentTrainingReportUsers = new List<LoginModel>();
foreach (TrainingReportUser id in currentTrainingReportUsersIds) {
foreach (TrainingReportUser id in currentTrainingReportUsersIds)
{
currentTrainingReportUsers.Add(userDMO.GetUserByID(id.UserId));
}
ViewBag.CurrentReportUsers = currentTrainingReportUsers;
return PartialView();
}
public ActionResult TECNNotificationConfig() {
public ActionResult TECNNotificationConfig()
{
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
List<TECNNotificationsUser> currentTECNNotificationUsersIds = adminDMO.GetTECNNotificationUsers();
List<LoginModel> currentTECNNotificationUsers = new List<LoginModel>();
foreach (TECNNotificationsUser id in currentTECNNotificationUsersIds) {
foreach (TECNNotificationsUser id in currentTECNNotificationUsersIds)
{
currentTECNNotificationUsers.Add(userDMO.GetUserByID(id.UserId));
}
ViewBag.CurrentReportUsers = currentTECNNotificationUsers;
return PartialView();
}
public ActionResult AddToTrainingReport(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
// Check to make sure user is not apart of the group already
public ActionResult AddToTrainingReport(int userId)
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
//Check to make sure user is not apart of the group already
bool userExists = false;
//bool userValid = true;
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
foreach (var item in existingUsers) {
if (item.UserId == userId) {
foreach (var item in existingUsers)
{
if (item.UserId == userId)
{
userExists = true;
}
}
// Check if user is valid
//Check if user is valid
var validUser = userDMO.GetUserByID(userId);
// Add to group
if (!userExists && validUser != null) {
//Add to group
if (!userExists && validUser != null)
{
adminDMO.TrainingReportAddUser(userId);
return Json("Success Added");
} else {
}
else
{
return Content("User either doesn't exist OR is already added");
}
} else {
}
else
{
return Content("Not Autthorized");
}
}
public ActionResult AddToTECNNotification(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
// Check to make sure user is not apart of the group already
public ActionResult AddToTECNNotification(int userId)
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
//Check to make sure user is not apart of the group already
bool userExists = false;
//bool userValid = true;
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
foreach (var item in existingUsers) {
if (item.UserId == userId) {
foreach (var item in existingUsers)
{
if (item.UserId == userId)
{
userExists = true;
}
}
// Check if user is valid
//Check if user is valid
var validUser = userDMO.GetUserByID(userId);
// Add to group
if (!userExists && validUser != null) {
try {
//Add to group
if (!userExists && validUser != null)
{
try
{
adminDMO.TECNExpirationAddUser(userId);
} catch (Exception e) {
}
catch (Exception e)
{
string exception = e.Message;
return Content(exception);
}
return Json("Success Added");
} else {
}
else
{
return Content("User either doesn't exist OR is already added");
}
} else {
}
else
{
return Content("Not Autthorized");
}
}
public ActionResult DeleteFromTrainingReport(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
try {
public ActionResult DeleteFromTrainingReport(int userId)
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
try
{
adminDMO.TrainingReportDeleteUser(userId);
return Content("Successfully Deleted");
} catch {
}
catch
{
return Content("Error while trying to delete");
}
} else {
}
else
{
return Content("Not Autthorized");
}
}
public ActionResult DeleteFromTECNNotification(int userId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
try {
public ActionResult DeleteFromTECNNotification(int userId)
{
if ((bool)Session[GlobalVars.IS_ADMIN])
{
try
{
adminDMO.TECNExpirationDeleteUser(userId);
return Content("Successfully Deleted");
} catch {
}
catch
{
return Content("Error while trying to delete");
}
} else {
}
else
{
return Content("Not Autthorized");
}
}
}
}

View File

@ -1,118 +1,215 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Utilities;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using System.IO;
using System.Configuration;
using Fab2ApprovalSystem.Utilities;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
[SessionExpireFilter]
public class AuditController : Controller {
AuditDMO auditDMO = new AuditDMO(GlobalVars.AppSettings);
namespace Fab2ApprovalSystem.Controllers
{
[Authorize]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
[SessionExpireFilter]
public class AuditController : Controller
{
AuditDMO auditDMO = new AuditDMO();
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
UserUtilities adUsers = new UserUtilities();
// GET: Audit
public ActionResult Index() {
public ActionResult Index()
{
return View();
}
public ActionResult Create() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Create()
{
Audit audit = new Audit();
try {
try
{
// TODO: Add insert logic here
audit.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
auditDMO.InsertAudit(audit);
return RedirectToAction("Edit", new { issueID = audit.AuditNo });
} catch (Exception e) {
}
catch (Exception e)
{
string detailedException = "";
try {
try
{
detailedException = e.InnerException.ToString();
} catch {
}
catch
{
detailedException = e.Message;
}
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n SubmitDocument - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(@User.Identity.Name + "\r\n SubmitDocument - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = audit.AuditNo, UserID = @User.Identity.Name, DocumentType = "Audit", OperationType = "Error", Comments = "SubmitDocument - " + exceptionString });
throw new Exception(e.Message);
}
}
public ActionResult Edit(int issueID) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <returns></returns>
public ActionResult Edit(int issueID)
{
int isITARCompliant = 1;
Audit audit = new Audit();
try {
bool isAdmin = (bool)Session[GlobalVars.IS_ADMIN];
int userId = (int)Session[GlobalVars.SESSION_USERID];
audit = auditDMO.GetAuditItem(issueID, userId);
AuditEdit auditEdit = auditDMO.GetAuditEdit(issueID, audit, isAdmin, userId);
if (auditEdit.RedirectToAction)
try
{
List<int> userList = auditDMO.Get8DQA();
ViewBag.MesaUsers = adUsers.GetMesaUsers();
int QAs = userList.Find(delegate(int al) { return al == (int)Session[GlobalVars.SESSION_USERID]; });
ViewBag.Is8DQA = "false";
if (QAs != 0)
{
ViewBag.Is8DQA = "true";
}
audit = auditDMO.GetAuditItem(issueID, (int)Session[GlobalVars.SESSION_USERID]);
//transform audit users from string to list, delimited by a comma.
if(audit.Auditees == null || !audit.Auditees.Contains(","))
{
ViewBag.AuditeeNames = audit.Auditees;
}
else
{
string[] auditeeNames = audit.Auditees.Split(',');
ViewBag.AuditeeNames = auditeeNames.ToList();
}
ViewBag.IsSubmitter = false;
if(audit.OriginatorID == (int)Session[GlobalVars.SESSION_USERID])
{
ViewBag.IsSubmitter = true;
}
if((bool)Session[GlobalVars.IS_ADMIN] != true)
{
ViewBag.IsAdmin = false;
}
else
{
ViewBag.IsAdmin = true;
}
if ((audit.RecordLockIndicator && audit.RecordLockedBy != (int)Session[GlobalVars.SESSION_USERID])
|| audit.AuditStatus != 0 ) //open
{
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
ViewBag.AuditAreaList = auditEdit.AuditAreaList;
ViewBag.AuditeeNames = auditEdit.AuditeeNames;
ViewBag.AuditFindingCategoryList = auditEdit.AuditFindingCategoryList;
ViewBag.AuditorList = auditEdit.AuditorList;
ViewBag.AuditTypeList = auditEdit.AuditTypeList;
ViewBag.CANoList = auditEdit.CANoList;
ViewBag.Is8DQA = auditEdit.Is8DQA;
ViewBag.IsAdmin = auditEdit.IsAdmin;
ViewBag.IsSubmitter = auditEdit.IsSubmitter;
ViewBag.MesaUsers = auditEdit.MesaUsers;
ViewBag.UserList = auditEdit.UserList;
} catch (Exception e) {
}
if (ViewBag.IsAdmin == false && ViewBag.IsSubmitter == false)
{
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
}
else
{
ViewBag.UserList = auditDMO.GetUserList();
ViewBag.AuditTypeList = auditDMO.GetAuditTypeList();
//ViewBag.AuditStandardList = auditDMO.GetAuditStandardList();
ViewBag.AuditorList = auditDMO.GetAuditorList();
ViewBag.AuditAreaList = auditDMO.GetAuditAreaList();
ViewBag.AuditFindingCategoryList = auditDMO.GetAuditFindingCategories();
ViewBag.CANoList = auditDMO.GetCorrectiveActionNoList();
}
}
catch (Exception e)
{
string detailedException = "";
try {
try
{
detailedException = e.InnerException.ToString();
} catch {
}
catch
{
detailedException = e.Message;
}
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n Edit - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(@User.Identity.Name + "\r\n Edit - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = audit.AuditNo, UserID = @User.Identity.Name, DocumentType = "Audit", OperationType = "Error", Comments = "Edit - " + exceptionString });
throw new Exception(e.Message);
}
return View(audit);
}
/// <summary>
///
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
[HttpPost]
public ActionResult Edit(Audit model) {
try {
public ActionResult Edit(Audit model)
{
try
{
var data = model;
auditDMO.UpdateAudit(model, (int)Session[GlobalVars.SESSION_USERID]);
} catch (Exception ex) {
}
catch (Exception ex)
{
return Content(ex.Message);
}
return Content("Successfully Saved");
}
public ActionResult CheckCAStatus(int auditNo) {
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <returns></returns>
public ActionResult CheckCAStatus(int auditNo)
{
int dataCount = -1;
try {
try
{
dataCount = auditDMO.GetOpenCACountByAuditNo(auditNo);
} catch (Exception ex) {
}
catch (Exception ex)
{
throw;
}
return Content(dataCount.ToString());
}
public ActionResult ReadOnlyAudit(int auditNo) {
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <returns></returns>
public ActionResult ReadOnlyAudit(int auditNo)
{
Audit audit = new Audit();
audit = auditDMO.GetAuditItemReadOnly(auditNo, (int)Session[GlobalVars.SESSION_USERID]);
@ -121,106 +218,255 @@ public class AuditController : Controller {
ViewBag.AuditAreaList = auditDMO.GetAuditAreaList();
ViewBag.AuditFindingCategoryList = auditDMO.GetAuditFindingCategories();
return View(audit);
}
public ActionResult AuditReportAttachSave(IEnumerable<HttpPostedFileBase> AuditReportFiles, int auditNo) {
try {
/// <summary>
///
/// </summary>
/// <param name="AuditReportFiles"></param>
/// <param name="auditNo"></param>
/// <returns></returns>
public ActionResult AuditReportAttachSave(IEnumerable<HttpPostedFileBase> AuditReportFiles, int auditNo)
{
try
{
// The Name of the Upload component is "files"
if (AuditReportFiles != null) {
int userId = (int)Session[GlobalVars.SESSION_USERID];
foreach (var file in AuditReportFiles) {
AuditHelper.AuditReportAttachSave(_AppSettings, auditDMO, auditNo, userId, file.FileName, file.InputStream);
if (AuditReportFiles != null)
{
foreach (var file in AuditReportFiles)
{
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(file.FileName);
var fileExtension = Path.GetExtension(file.FileName);
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
DirectoryInfo di;
var ccPhysicalPath = Functions.GetAttachmentFolder() + @"Audit\" + auditNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(Functions.GetAttachmentFolder() + @"Audit\" + auditNo + @"\", guid + fileExtension);
file.SaveAs(physicalPath);
AuditReportAttachment attach = new AuditReportAttachment()
{
AuditNo = auditNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = (int)Session[GlobalVars.SESSION_USERID]
};
//ccDMO.InsertCCAttachment(attach);
auditDMO.InsertAuditReportAttachment(attach);
}
}
} catch {
}
catch
{
throw;
}
return Content("");
}
public ActionResult AuditReportAttachment_Read([DataSourceRequest] DataSourceRequest request, int auditNo) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="auditNo"></param>
/// <returns></returns>
public ActionResult AuditReportAttachment_Read([DataSourceRequest] DataSourceRequest request, int auditNo)
{
return Json(auditDMO.GetAuditReportAttachments(auditNo).ToDataSourceResult(request));
}
[HttpPost]
public void DeleteAuditReportAttachment(int attachID) {
auditDMO.DeleteAuditReportAttachment(attachID);
}
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo) {
try {
string fileName, sDocument;
List<string> results = AuditHelper.GetFileNameAndDocument(_AppSettings, auditDMO, fileGuid, auditNo);
fileName = results[0];
sDocument = results[1];
if (string.IsNullOrEmpty(sDocument)) {
/// <summary>
///
/// </summary>
/// <param name="attachID"></param>
[HttpPost]
public void DeleteAuditReportAttachment(int attachID)
{
auditDMO.DeleteAuditReportAttachment(attachID);
}
/// <summary>
///
/// </summary>
/// <param name="fileGuid"></param>
/// <param name="auditNo"></param>
/// <returns></returns>
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo)
{
try
{
string fileName = auditDMO.GetAuditReportAttachmentFileName(fileGuid);
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
string ecnFolderPath = Functions.GetAttachmentFolder() + "Audit\\" + auditNo.ToString();
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
var FDir_AppData = Functions.GetAttachmentFolder();
if (!sDocument.StartsWith(FDir_AppData))
{
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
// and block requests outside like "../web.config"
throw new HttpException(403, "Forbidden");
}
if (!System.IO.File.Exists(sDocument)) {
if (!System.IO.File.Exists(sDocument))
{
return null;
//throw new Exception("File not found");
}
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
} catch {
}
catch
{
// TODO - proces the error
throw;
}
}
public ActionResult GetAuditFindingsList([DataSourceRequest] DataSourceRequest request, int auditNo) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="auditNo"></param>
/// <returns></returns>
public ActionResult GetAuditFindingsList([DataSourceRequest] DataSourceRequest request, int auditNo)
{
return Json(auditDMO.GetAuditFindingsList(auditNo).ToDataSourceResult(request));
}
public ActionResult InsertAuditFindingsItem(AuditFindings data) {
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
public ActionResult InsertAuditFindingsItem(AuditFindings data)
{
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0)
{
throw new ArgumentException("You must select add a CA for a Major or Minor finding.");
} else {
int userId = (int)Session[GlobalVars.SESSION_USERID];
Audit audit = auditDMO.InsertAndGetAudit(caDMO, data, userId);
}
else
{
Audit audit = new Audit();
auditDMO.InsertAuditFindingsItem(data);
audit = auditDMO.GetAuditItem(data.AuditNo, (int)Session[GlobalVars.SESSION_USERID]);
//Transfer Finding Details to CA
if(data.CANo != 0)
{
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, (int)Session[GlobalVars.SESSION_USERID]);
ca.CATitle = data.Title;
ca.CASourceID = 1;//Audit
caDMO.UpdateCorrectiveAction(ca);
}
return Json(audit, JsonRequestBehavior.AllowGet);
}
}
public ActionResult UpdateAuditFindingsItem(AuditFindings data) {
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
public ActionResult UpdateAuditFindingsItem(AuditFindings data)
{
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0)
{
throw new ArgumentException("You must select add a CA for a Major or Minor finding.");
} else {
int userId = (int)Session[GlobalVars.SESSION_USERID];
Audit audit = auditDMO.UpdateAndGetAudit(caDMO, data, userId);
}
else
{
Audit audit = new Audit();
auditDMO.UpdateAuditFindingsItem(data);
audit = auditDMO.GetAuditItem(data.AuditNo, (int)Session[GlobalVars.SESSION_USERID]);
//Transfer Finding Details to CA
if (data.CANo != 0)
{
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, (int)Session[GlobalVars.SESSION_USERID]);
ca.CATitle = data.Title;
ca.CASourceID = 1;//Audit
caDMO.UpdateCorrectiveAction(ca);
}
return Json(audit, JsonRequestBehavior.AllowGet);
}
}
public ActionResult DeleteAuditFindingsItem(int auditFindingsID) {
int userId = (int)Session[GlobalVars.SESSION_USERID];
Audit audit = auditDMO.DeleteAndGetAudit(auditFindingsID, userId);
public ActionResult DeleteAuditFindingsItem(int auditFindingsID)
{
var af = auditDMO.GetAuditFindingsByID(auditFindingsID);
auditDMO.DeleteAuditFindingsItem(auditFindingsID);
var audit = auditDMO.GetAuditItem(af.AuditNo, (int)Session[GlobalVars.SESSION_USERID]);
return Json(audit, JsonRequestBehavior.AllowGet);
}
public void ReleaseLockOnDocument(int issueID) {
try {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
public void ReleaseLockOnDocument(int issueID)
{
try
{
auditDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], issueID);
} catch (Exception e) {
try {
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n ReleaseLockOnDocument CA\r\n" + issueID.ToString() + "\r\n" + e.Message, System.Diagnostics.EventLogEntryType.Error);
} catch { }
}
catch (Exception e)
{
try
{
Functions.WriteEvent(@User.Identity.Name + "\r\n ReleaseLockOnDocument CA\r\n" + issueID.ToString() + "\r\n" + e.Message, System.Diagnostics.EventLogEntryType.Error);
}
catch { }
auditDMO.ReleaseLockOnDocument(-1, issueID);
}
}
// CA Findings ======================================================================================================================
public ActionResult InsertCAFindingsItem(CAFindings data) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ActionResult InsertCAFindingsItem(CAFindings data)
{
auditDMO.InsertCAFindings(data);
if (data.ResponsibilityOwnerID != null) {
if (data.ResponsibilityOwnerID != null)
{
// send an email notification
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
}
@ -228,74 +474,196 @@ public class AuditController : Controller {
return Content("");
}
public ActionResult UpdateCAFindingsItem(CAFindings data) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ActionResult UpdateCAFindingsItem(CAFindings data)
{
auditDMO.UpdateCAFindings(data);
if (data.ResponsibilityOwnerID != data.CurrentResponsibilityOwnerID) {
if (data.ResponsibilityOwnerID != data.CurrentResponsibilityOwnerID)
{
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
}
return Content("");
}
public ActionResult GetCAFindingsList([DataSourceRequest] DataSourceRequest request, int auditNo) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="caNo"></param>
/// <returns></returns>
public ActionResult GetCAFindingsList([DataSourceRequest] DataSourceRequest request, int auditNo)
{
return Json(auditDMO.GetCAFindingsList(auditNo).ToDataSourceResult(request));
}
public ActionResult GetCAFindingsItemAttachments([DataSourceRequest] DataSourceRequest request, int caFindingsID) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="d7PAID"></param>
/// <returns></returns>
public ActionResult GetCAFindingsItemAttachments([DataSourceRequest] DataSourceRequest request, int caFindingsID)
{
return Json(auditDMO.GetCAFindingsItemAttachments(caFindingsID).ToDataSourceResult(request));
}
public ActionResult GetCAFindingsItem(int caFindingsID) {
/// <summary>
///
/// </summary>
/// <param name="d7paID"></param>
/// <returns></returns>
public ActionResult GetCAFindingsItem(int caFindingsID)
{
var model = new CAFindings();
model = auditDMO.GetCAFindingsItem(caFindingsID);
return PartialView("_CAFindingsAttachment", model);
}
/// <summary>
///
/// </summary>
/// <param name="caFindingsID"></param>
[HttpPost]
public void DeleteCAFindingsItem(int caFindingsID) {
public void DeleteCAFindingsItem(int caFindingsID)
{
auditDMO.DeleteCAFindingsItem(caFindingsID);
}
public ActionResult SaveCAFindings_Attachemnt(IEnumerable<HttpPostedFileBase> CAFindings_Attachemnt, int caFindingsID, int auditNo) {
try {
/// <summary>
///
/// </summary>
/// <param name="D7PA_Attachemnt"></param>
/// <param name="d7PAID"></param>
/// <param name="caNo"></param>
/// <returns></returns>
public ActionResult SaveCAFindings_Attachemnt(IEnumerable<HttpPostedFileBase> CAFindings_Attachemnt, int caFindingsID, int auditNo)
{
try
{
// The Name of the Upload component is "files"
if (CAFindings_Attachemnt != null) {
int userId = (int)Session[GlobalVars.SESSION_USERID];
foreach (var file in CAFindings_Attachemnt) {
AuditHelper.SaveAndInsert(_AppSettings, auditDMO, caFindingsID, auditNo, userId, file.FileName, file.InputStream);
if (CAFindings_Attachemnt != null)
{
foreach (var file in CAFindings_Attachemnt)
{
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(file.FileName);
var fileExtension = Path.GetExtension(file.FileName);
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
DirectoryInfo di;
var ccPhysicalPath = Functions.GetAttachmentFolder() + @"Audit\" + auditNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(Functions.GetAttachmentFolder() + @"Audit\" + auditNo + @"\", guid + fileExtension);
file.SaveAs(physicalPath);
AuditReportAttachment attach = new AuditReportAttachment()
{
CAFindingsID = caFindingsID,
AuditNo = auditNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = (int)Session[GlobalVars.SESSION_USERID]
};
auditDMO.InsertAuditReportAttachment(attach);
}
}
} catch {
}
catch
{
throw;
}
return Content("");
}
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID) {
try {
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, _AppSettings.EmailTemplatesPath);
try {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <param name="currentStep"></param>
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID)
{
try
{
string emailSentList = "";
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
string email = MiscDMO.GetEmail(responsibleOwnerID);
string emailTemplate = "CorrectiveActionFindingAssigned.txt";
string userEmail = string.Empty;
string subject = "5s/CA Findings";
string senderName = "CorrectiveAction";
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnAuditNoStringFormat(issueID);
emailparams[1] = dueDate.ToString();
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.Audit);
emailparams[3] = GlobalVars.hostURL;
emailparams[4] = issueID.ToString();
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
try
{
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Email", Comments = "Task Assigned for 5S/CA Findings" + ":" + email });
} catch { }
} catch (Exception e) {
}
catch { }
}
catch (Exception e)
{
string detailedException = "";
try {
try
{
detailedException = e.InnerException.ToString();
} catch {
}
catch
{
detailedException = e.Message;
}
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 5s/CAFindings:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n 5s/CAFindings - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(@User.Identity.Name + "\r\n 5s/CAFindings - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "5s/CAFindings Notification - " + exceptionString });
}
//throw e;
}
public ActionResult IsCAAssignedToAudit(int caNo, int auditNo) {
}
public ActionResult IsCAAssignedToAudit(int caNo, int auditNo)
{
return Content(auditDMO.IsCAAssignedToAudit(caNo, auditNo).ToString());
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,10 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Utilities;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Configuration;
@ -5,199 +12,351 @@ using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Utilities;
using Fab2ApprovalSystem.ViewModels;
namespace Fab2ApprovalSystem.Controllers
{
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public class HomeController : Controller {
MRB_DMO mrbDMO = new MRB_DMO(GlobalVars.AppSettings);
PartsRequestDMO prDMO = new PartsRequestDMO();
[Authorize]
[SessionExpireFilter]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
public class HomeController : Controller
{
LotDispositionDMO ldDMO = new LotDispositionDMO();
MRB_DMO mrbDMO = new MRB_DMO();
WorkflowDMO wfDMO = new WorkflowDMO();
ECN_DMO ecnDMO = new ECN_DMO();
PartsRequestDMO prDMO = new PartsRequestDMO();
UserUtilities userDMO = new UserUtilities();
UserAccountDMO originalUserDMO = new UserAccountDMO();
TrainingDMO trainingDMO = new TrainingDMO();
MiscDMO miscDMO = new MiscDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public ActionResult Index(string tabName) {
/// <summary>
///
/// </summary>
/// <param name="tabName"></param>
/// <returns></returns>
public ActionResult Index(string tabName)
{
ViewBag.ActiveTabName = tabName;
return View();
}
public ActionResult MyTasks() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult MyTasks()
{
return View();
}
public ActionResult AllDocuments() {
public ActionResult AllDocuments()
{
return View();
}
public ActionResult SpecialWorkRequestList() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult SpecialWorkRequestList()
{
return View();
}
public ActionResult MRBList() {
public ActionResult MRBList()
{
return View();
}
public ActionResult ECNList() {
public ActionResult ECNList()
{
return View();
}
public ActionResult TrainingList() {
public ActionResult TrainingList()
{
return View();
}
public ActionResult LotDispositionList() {
public ActionResult LotDispositionList()
{
return View();
}
public ActionResult AuditList() {
public ActionResult AuditList()
{
return View();
}
public ActionResult CorrectiveActionList() {
public ActionResult CorrectiveActionList()
{
return View();
}
public ActionResult ECN_TECN(string viewOption) {
/// <summary>
///
/// </summary>
/// <param name="viewOption"></param>
/// <returns></returns>
public ActionResult ECN_TECN(string viewOption)
{
ViewBag.ViewOption = viewOption;
return View();
}
public ActionResult ChangeControlList() {
public ActionResult ChangeControlList()
{
return View();
}
public ActionResult GetTaskList([DataSourceRequest] DataSourceRequest request, string tabName) {
try {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetTaskList([DataSourceRequest]DataSourceRequest request, string tabName)
{
try
{
ViewBag.ActiveTabName = tabName;
List<IssuesViewModel> data = ldDMO.GetTaskList((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
} catch (Exception ex) {
}
catch (Exception ex)
{
// TODO record the error
throw ex;
}
}
public ActionResult GetMyOpenActionItems([DataSourceRequest] DataSourceRequest request, string tabName) {
try {
public ActionResult GetMyOpenActionItems([DataSourceRequest]DataSourceRequest request, string tabName)
{
try
{
ViewBag.ActiveTabName = tabName;
List<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
} catch (Exception ex) {
}
catch (Exception ex)
{
// TODO record the error
throw ex;
}
}
public ActionResult GetDocuments([DataSourceRequest] DataSourceRequest request, string tabName) {
public ActionResult GetDocuments([DataSourceRequest]DataSourceRequest request, string tabName)
{
ViewBag.ActiveTabName = tabName;
//IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositions();
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetWorkRequests([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetWorkRequests([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ldDMO.GetWorkRequests();
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetChangeControlList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetChangeControlList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<ChangeControlList> data = ldDMO.GetChangeControls(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetAuditList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetAuditList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<AuditList> data = ldDMO.GetAuditList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetCorrectiveActionList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetCorrectiveActionList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<CorrectiveAction> data = ldDMO.GetCorrectiveActionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetMRBList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetMRBList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ldDMO.GetMRBList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetLotDispositionList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetLotDispositionList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetECNList([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetECNList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ldDMO.GetECNList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetTrainingList([DataSourceRequest] DataSourceRequest request) {
public ActionResult GetTrainingList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<Training> data = trainingDMO.GetAllTrainings();
return Json(data.ToDataSourceResult(request));
}
public ActionResult MyECNsTECNs(string dataType) {
/// <summary>
///
/// </summary>
/// <param name="dataType"></param>
/// <returns></returns>
public ActionResult MyECNsTECNs(string dataType)
{
ViewBag.ActiveTabName = dataType;
return View();
}
public ActionResult GetECN_TECNsPendingApproval([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetECN_TECNsPendingApproval([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ecnDMO.GetECN_TECNPendingApprovals(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
ViewBag.ViewOption = "Pending Approvals";
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetMyExpiredTECNs([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetMyExpiredTECNs([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiredTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
ViewBag.ViewOption = "Expired TECNs";
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetAllTECNs([DataSourceRequest] DataSourceRequest request) {
public ActionResult GetAllTECNs([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ecnDMO.GetAllTECNs();
ViewBag.ViewOption = "All TECNs";
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetMyConvertedTECNsToECNs([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetMyConvertedTECNsToECNs([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyConvertedTECNsToECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
ViewBag.ViewOption = "Converted TECNs";
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetMyExpiringTECNs([DataSourceRequest] DataSourceRequest request) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <returns></returns>
public ActionResult GetMyExpiringTECNs([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiringTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
ViewBag.ViewOption = "Expiring TECNs";
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID) {
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="workRequestID"></param>
/// <returns></returns>
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID)
{
LotTravelerDMO LotTravDMO = new LotTravelerDMO();
return Json(LotTravDMO.GetLotListBasedOnSWRNumber(workRequestID).ToDataSourceResult(request));
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult SetOOOStatus(int delegatedTo, DateTime startDate, DateTime endDate, string tab) {
if (Session[GlobalVars.SESSION_USERID] != null) {
public ActionResult SetOOOStatus(int delegatedTo, DateTime startDate, DateTime endDate, string tab)
{
if (Session[GlobalVars.SESSION_USERID] != null)
{
int returnValue = MiscDMO.EnableOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), delegatedTo, startDate, endDate);
if (returnValue == 3) // the delegator is already a delegator to someone else
{
@ -212,15 +371,32 @@ public class HomeController : Controller {
return Content("");
}
public void ExpireOOOStatus(string tab) {
if (Session[GlobalVars.SESSION_USERID] != null) {
/// <summary>
///
/// </summary>
/// <param name="oooUserID"></param>
public void ExpireOOOStatus(string tab)
{
if (Session[GlobalVars.SESSION_USERID] != null)
{
MiscDMO.ExpireOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
Session[GlobalVars.OOO] = false;
}
}
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="issue"></param>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteItem([DataSourceRequest] DataSourceRequest request, IssuesViewModel issue) {
public ActionResult DeleteItem([DataSourceRequest] DataSourceRequest request, IssuesViewModel issue)
{
GlobalVars.DocumentType dType;
Enum.TryParse(issue.DocumentType, out dType);
if (dType == GlobalVars.DocumentType.MRB)
@ -232,42 +408,67 @@ public class HomeController : Controller {
else if (dType == GlobalVars.DocumentType.CorrectiveAction)
ldDMO.DeleteCADocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
return Json(new[] { issue }.ToDataSourceResult(request, ModelState));
}
/// <summary>
///
/// </summary>
/// <param name="request"></param>
/// <param name="ca"></param>
/// <returns></returns>
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeleteCAItem([DataSourceRequest] DataSourceRequest request, CorrectiveAction ca) {
public ActionResult DeleteCAItem([DataSourceRequest] DataSourceRequest request, CorrectiveAction ca)
{
ldDMO.DeleteCADocument(ca.CANo, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
return Json(new[] { ca }.ToDataSourceResult(request, ModelState));
}
public ActionResult About() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult About()
{
ViewBag.Message = "Your application description page.";
return View();
}
public ActionResult Contact() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Contact()
{
ViewBag.Message = "Your contact page.";
return View();
}
#region testing purpose
public ActionResult Edit() {
public ActionResult Edit()
{
return View(DemoHelper.Instance.ListOfModels[0]);
}
[HttpPost]
public ActionResult Edit(TestModel editTest) {
public ActionResult Edit(TestModel editTest)
{
DemoHelper.Instance.ListOfModels[0] = editTest;
return RedirectToAction("Index");
}
public static void Test() {
public static void Test()
{
string[] colorStrings = { "0", "2", "8", "blue", "Blue", "Yellow", "Red, Green" };
foreach (string colorString in colorStrings) {
foreach (string colorString in colorStrings)
{
GlobalVars.Colors colorValue;
if (Enum.TryParse(colorString, true, out colorValue))
if (Enum.IsDefined(typeof(GlobalVars.Colors), colorValue) | colorValue.ToString().Contains(","))
@ -281,160 +482,338 @@ public class HomeController : Controller {
#endregion
public void DelegateDocumentApproval(int issueID, int delegateTo, string ecnTypeString, string title) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <param name="delegateTo"></param>
/// <param name="step"></param>
/// <param name="docType"></param>
/// <param name="ecnTypeString"></param>
public void DelegateDocumentApproval(int issueID, int delegateTo, string ecnTypeString, string title)
{
var email = "";
int delegateFrom = (int)Session[GlobalVars.SESSION_USERID];
try {
try
{
email = wfDMO.DelegateDocumentApproval(issueID, delegateFrom, delegateTo);
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Delegation", Comments = "Delegated from - " + delegateFrom + " to " + delegateTo });
} catch (Exception e) {
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString , OperationType = "Delegation", Comments = "Delegated from - " + delegateFrom + " to " + delegateTo });
}
catch (Exception e)
{
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(_AppSettings, @User.Identity.Name + "\r\n DelegateApproval\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(@User.Identity.Name + "\r\n DelegateApproval\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
throw new Exception(e.Message);
}
HomeHelper.DelegateDocumentApproval(_AppSettings, issueID, ecnTypeString, title, email);
try {
string emailTemplate = "DelegateApproval.txt";
string userEmail = string.Empty;
string subject;
string senderName = ecnTypeString;
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title; ;
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
try
{
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
} catch { }
}
catch { }
}
public JsonResult GetAllUsersList() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public JsonResult GetAllUsersList()
{
UserAccountDMO userDMO = new UserAccountDMO();
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
return Json(userlist, JsonRequestBehavior.AllowGet);
}
public ActionResult SaveAllDocumentsFilter(string data) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ActionResult SaveAllDocumentsFilter(string data)
{
Session["AllDocumentsFilterData"] = data;
return new EmptyResult();
}
public ActionResult LoadAllDocumentsFilter() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult LoadAllDocumentsFilter()
{
return Json(Session["AllDocumentsFilterData"], JsonRequestBehavior.AllowGet);
}
public ActionResult SaveSWRFilter(string data) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ActionResult SaveSWRFilter(string data)
{
Session["SWRFilterData"] = data;
return new EmptyResult();
}
public ActionResult LoadSWRFilter() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult LoadSWRFilter()
{
return Json(Session["SWRFilterData"], JsonRequestBehavior.AllowGet);
}
public ActionResult SavePCRBFilter(string data) {
/// <summary>
///
/// </summary>
/// <param name="data"></param>
/// <returns></returns>
public ActionResult SavePCRBFilter(string data)
{
Session["PCRBFilterData"] = data;
return new EmptyResult();
}
public ActionResult LoadPCRBFilter() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult LoadPCRBFilter()
{
return Json(Session["PCRBFilterData"], JsonRequestBehavior.AllowGet);
}
public ActionResult PartsRequestList() {
public ActionResult PartsRequestList()
{
ViewBag.CanDeletePR = Session[GlobalVars.CAN_CREATE_PARTS_REQUEST];
return View();
}
public ActionResult GetPartsRequestList([DataSourceRequest] DataSourceRequest request) {
public ActionResult GetPartsRequestList([DataSourceRequest]DataSourceRequest request)
{
IEnumerable<PartsRequestList> data = prDMO.GetPartsRequestList();
return Json(data.ToDataSourceResult(request));
}
public ActionResult GetMyPartsRequestsList([DataSourceRequest] DataSourceRequest request, string tabName) {
try {
public ActionResult GetMyPartsRequestsList([DataSourceRequest]DataSourceRequest request, string tabName)
{
try
{
ViewBag.ActiveTabName = tabName;
var data = prDMO.GetMyPartsRequests((int)Session[GlobalVars.SESSION_USERID]);
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
} catch (Exception ex) {
}
catch (Exception ex)
{
// TODO record the error
throw ex;
}
}
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult DeletePR([DataSourceRequest] DataSourceRequest request, MyPartsRequestList pr) {
try {
public ActionResult DeletePR([DataSourceRequest] DataSourceRequest request, MyPartsRequestList pr)
{
try
{
if (Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
throw new Exception("Permission denied");
prDMO.DeleteDocument(pr.PRNumber, (int)Session[GlobalVars.SESSION_USERID]);
return Json(new[] { pr }.ToDataSourceResult(request, ModelState));
} catch (Exception ex) {
}
catch (Exception ex)
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message);
}
}
public void NotifyDelegation(int delegatedUser, DateTime startDate, DateTime endDate) {
public void NotifyDelegation(int delegatedUser, DateTime startDate, DateTime endDate)
{
LoginModel delegateFrom = originalUserDMO.GetUserByID((int)Session[GlobalVars.SESSION_USERID]);
LoginModel delegateTo = originalUserDMO.GetUserByID(delegatedUser);
List<string> emailList = new List<string>();
emailList.Add(delegateFrom.Email);
emailList.Add(delegateTo.Email);
HomeHelper.NotifyDelegation(_AppSettings, startDate, endDate, delegateFrom, delegateTo, emailList);
try {
} catch { }
string emailTemplate = "DelegationOn.txt";
string userEmail = string.Empty;
string subject = "Mesa Approval Delegation Notification";
string senderName = "Mesa Approval";
foreach (string email in emailList)
{
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
string[] emailparams = new string[5];
emailparams[0] = delegateFrom.FullName;
emailparams[1] = delegateTo.FullName;
emailparams[2] = startDate.ToString("yyyy-MM-dd");
emailparams[3] = endDate.ToString("yyyy-MM-dd");
userEmail = email;
//#if(DEBUG)
// userEmail = GlobalVars.SENDER_EMAIL;
//#endif
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public bool ProcessOoO() {
try
{
try {
//EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Rejection: " + userEmail });
}
catch { }
}
public bool ProcessOoO()
{
try
{
UserAccountDMO userDMO = new UserAccountDMO();
userDMO.ProcessOoO();
return true;
} catch {
}
catch
{
return false;
}
}
public bool ExpireOoO() {
try {
public bool ExpireOoO()
{
try
{
UserAccountDMO userDMO = new UserAccountDMO();
userDMO.ExpireOoO();
return true;
} catch {
}
catch
{
return false;
}
}
public bool ApprovalsReminderNotifications() {
try {
// Get list of approvals
public bool ApprovalsReminderNotifications()
{
try
{
//Get list of approvals
List<ApproveListModel> approveList = miscDMO.GetApprovalReminderList();
foreach (var item in approveList) {
try {
foreach (var item in approveList)
{
try
{
NotifyApprover(item.AssignedEmail, item.Title, item.IssueID, item.DocType);
} catch (Exception e) {
}
catch(Exception e)
{
EventLogDMO.Add(new WinEventLog() { IssueID = item.ApprovalKey, UserID = "SYSTEM", DocumentType = "Approval Reminders", OperationType = "Email", Comments = e.Message });
}
// We want to update the last notification anyway so we don't continue trying on something that may be failing.
//We want to update the last notification anyway so we don't continue trying on something that may be failing.
miscDMO.UpdateApprovalNotifyDate(item.ApprovalKey);
}
// List<ApproveListModel> approveList = miscDMO.
return true;
} catch {
}
catch
{
return false;
}
}
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
try {
HomeHelper.NotifyApprover(_AppSettings, toEmail, title, issueId, docType);
public void NotifyApprover(string toEmail, string title, int issueId, string docType)
{
try
{
string emailSentList = "";
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
//List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
//string ecnCreatedByEmail = MiscDMO.GetEmail(ecnCreatedById);
string emailTemplate = "ApprovalReminders.txt";
string userEmail = string.Empty;
string subject = string.Empty;
string senderName = docType;
subject = docType + " Approval Reminder: " + title;
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
string[] emailparams = new string[4];
emailparams[0] = docType;
emailparams[1] = title;
emailparams[2] = issueId.ToString();
userEmail = toEmail;
//#if(DEBUG)
//string SenderEmail = "MesaFabApproval@infineon.com";
//userEmail = "jonathan.ouellette@infineon.com";
//#endif
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, "jonathan.ouellette@infineon.com", subject, emailparams);
//en.SendNotificationEmail(emailTemplate, SenderEmail, senderName, userEmail, null, subject, emailparams);
//emailSentList = ecnCreatedByEmail;
try
{
try {
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
} catch { }
}
catch { }
} catch (Exception e) {
//EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
//string[] emailparams = new string[4];
//emailparams[0] = issueID.ToString();
//emailparams[1] = issueID.ToString();
//emailparams[2] = GlobalVars.hostURL;
//emailparams[3] =Session[GlobalVars.SESSION_USERNAME].ToString();
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
}
catch (Exception e)
{
string detailedException = "";
try {
try
{
detailedException = e.InnerException.ToString();
} catch {
}
catch
{
detailedException = e.Message;
}
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
throw e;
}
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -3,29 +3,35 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
public class ManagerController : Controller {
namespace Fab2ApprovalSystem.Controllers
{
[Authorize]
[SessionExpireFilter]
public class ManagerController : Controller
{
UserAccountDMO userDMO = new UserAccountDMO();
AdminDMO adminDMO = new AdminDMO();
TrainingDMO trainingDMO = new TrainingDMO();
LotDispositionDMO ldDMO = new LotDispositionDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public ActionResult Index() {
if ((bool)Session[GlobalVars.IS_MANAGER]) {
/// <summary>
///
/// </summary>
/// <returns></returns>
public ActionResult Index()
{
if ((bool)Session[GlobalVars.IS_MANAGER])
{
var model = userDMO.GetAllUsers();
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
return View(model);
} else
}
else
return Content("Not Autthorized");
}
}
}

View File

@ -1,20 +0,0 @@
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);
}
}

View File

@ -3,45 +3,46 @@ using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
[SessionExpireFilter]
public class PartsRequestController : Controller {
const int WorkflowNumber = 1;
namespace Fab2ApprovalSystem.Controllers
{
[Authorize]
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
[SessionExpireFilter]
public class PartsRequestController : Controller
{
PartsRequestDMO prDMO = new PartsRequestDMO();
UserAccountDMO userDMO = new UserAccountDMO();
WorkflowDMO wfDMO = new WorkflowDMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public PartsRequestController() {
const int WorkflowNumber = 1;
public PartsRequestController()
{
ViewBag.ShowReAssignApprovers = false;
}
protected ActionResult HandleValidationError(string msg) {
protected ActionResult HandleValidationError(string msg)
{
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
return Json(new { result = "Invalid", detail = msg });
}
protected ActionResult HandleAPIException(int issueID, Exception ex, string additionalKeys = "") {
protected ActionResult HandleAPIException(int issueID, Exception ex, string additionalKeys = "")
{
HandleException(issueID, ex, additionalKeys);
Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
return Json(new { result = "Error", issueID = issueID, detail = ex.Message });
}
protected void HandleException(int issueID, Exception ex, string additionalKeys = "") {
protected void HandleException(int issueID, Exception ex, string additionalKeys = "")
{
var st = new System.Diagnostics.StackTrace();
var sf = st.GetFrame(1);
@ -59,44 +60,59 @@ public class PartsRequestController : Controller {
additionalKeys);
Exception x = ex;
while (x != null) {
while (x != null)
{
detailedException += x.ToString();
detailedException += "\r\n=====\r\n";
x = x.InnerException;
}
Functions.WriteEvent(_AppSettings, detailedException, System.Diagnostics.EventLogEntryType.Error);
Functions.WriteEvent(detailedException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() {
EventLogDMO.Add(new WinEventLog()
{
IssueID = issueID,
UserID = @User.Identity.Name,
DocumentType = controller,
OperationType = "Error",
Comments = detailedException
});
}
// GET: PartsRequest
public ActionResult Index() {
public ActionResult Index()
{
return View();
}
public ActionResult Edit(int issueID) {
public ActionResult Edit(int issueID)
{
var pr = new PartsRequest();
try {
try
{
pr = prDMO.Get(issueID);
if (pr == null) {
if (pr == null)
{
ViewBag.ErrorDescription = "Document does not exist";
return View("Error");
} else if (pr.CurrentStep < 0) {
}
else if (pr.CurrentStep < 0)
{
ViewBag.ErrorDescription = "Document is deleted";
return View("Error");
} else if (pr.CurrentStep >= 1) {
}
else if (pr.CurrentStep >= 1)
{
return RedirectToAction("EditApproval", new { issueID = issueID });
} else {
if (pr.OriginatorID != (int)Session[GlobalVars.SESSION_USERID]) {
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false) {
}
else
{
if (pr.OriginatorID != (int)Session[GlobalVars.SESSION_USERID])
{
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false)
{
return RedirectToAction("ReadOnly", new { issueID = issueID });
}
}
@ -104,47 +120,60 @@ public class PartsRequestController : Controller {
ViewBag.UserList = userDMO.GetAllUsers();
return View(pr);
}
} catch (Exception e) {
}
catch (Exception e)
{
HandleException(issueID, e);
return View("Error");
}
}
[HttpPost]
public ActionResult Edit(PartsRequest pr) {
try {
public ActionResult Edit(PartsRequest pr)
{
try
{
var pr_srv = prDMO.Get(pr.PRNumber);
if (pr_srv == null) {
if (pr_srv == null)
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Document does not exist");
}
if (pr_srv.CurrentStep < 0) {
if (pr_srv.CurrentStep < 0)
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Document is deleted");
}
if (pr_srv.CurrentStep >= 1) {
if (pr_srv.CurrentStep >= 1)
{
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Parts Request is not editable");
}
prDMO.Update(pr);
return Content("");
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(pr.PRNumber, e);
}
}
public ActionResult EditApproval(int issueID) {
public ActionResult EditApproval(int issueID)
{
var pr = new PartsRequest();
try {
try
{
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
pr = prDMO.Get(issueID);
if (pr == null) {
if (pr == null)
{
ViewBag.ErrorDescription = "Document does not exist";
return View("Error");
}
if (pr.CurrentStep < 0) {
if (pr.CurrentStep < 0)
{
ViewBag.ErrorDescription = "Document is deleted";
return View("Error");
}
@ -154,9 +183,12 @@ public class PartsRequestController : Controller {
var userList = MiscDMO.GetPendingApproversListByDocument(issueID, Convert.ToByte(pr.CurrentStep), (int)GlobalVars.DocumentType.PartsRequest);
ViewBag.IsApprover = (userList.Count(u => u.UserID == myUserID) > 0);
if (ViewBag.IsApprover == false) {
if (pr.OriginatorID != myUserID) {
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false) {
if (ViewBag.IsApprover == false)
{
if (pr.OriginatorID != myUserID)
{
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false)
{
return RedirectToAction("ReadOnly", new { issueID = issueID });
}
}
@ -169,24 +201,30 @@ public class PartsRequestController : Controller {
ViewBag.ShowAddApprovers = ViewBag.IsAdmin || ViewBag.IsApprover || ViewBag.IsOriginator;
ViewBag.UserList = userDMO.GetAllUsers();
return View(pr);
} catch (Exception e) {
}
catch (Exception e)
{
HandleException(issueID, e);
return View("Error");
}
}
public ActionResult ReadOnly(int issueID) {
public ActionResult ReadOnly(int issueID)
{
var pr = new PartsRequest();
try {
try
{
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
pr = prDMO.Get(issueID);
if (pr == null) {
if (pr == null)
{
ViewBag.ErrorDescription = "Document does not exist";
return View("Error");
}
if (pr.CurrentStep < 0) {
if (pr.CurrentStep < 0)
{
ViewBag.ErrorDescription = "Document is deleted";
return View("Error");
}
@ -195,15 +233,19 @@ public class PartsRequestController : Controller {
ViewBag.IsOriginator = (pr.OriginatorID == myUserID);
ViewBag.UserList = userDMO.GetAllUsers();
return View(pr);
} catch (Exception e) {
}
catch (Exception e)
{
HandleException(issueID, e);
return View("Error");
}
}
public ActionResult Create() {
public ActionResult Create()
{
var pr = new PartsRequest();
try {
try
{
pr.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
if (!CanCreatePartsRequest(pr.OriginatorID) && Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
@ -212,19 +254,25 @@ public class PartsRequestController : Controller {
prDMO.Insert(pr);
return RedirectToAction("Edit", new { issueID = pr.PRNumber });
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(pr.PRNumber, e);
}
}
public static bool CanCreatePartsRequest(int userID) {
public static bool CanCreatePartsRequest(int userID)
{
var adminDMO = new AdminDMO();
var role = adminDMO.GetSubRoles().Where(r => string.Equals(r.RoleName, "Parts Request", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (role != null) {
if (role != null)
{
var subrole = role.SubRoles.FirstOrDefault(sr => string.Equals(sr.SubRoleCategoryItem, "Originator", StringComparison.OrdinalIgnoreCase));
if (subrole != null) {
if (subrole != null)
{
var users = adminDMO.GetAllUsersBySubRole(subrole.SubRoleID);
if (users.Count(u => u.UserID == userID) > 0) {
if (users.Count(u => u.UserID == userID) > 0)
{
return true;
}
}
@ -232,35 +280,62 @@ public class PartsRequestController : Controller {
return false;
}
public ActionResult Attachment_Read([DataSourceRequest] DataSourceRequest request, int prNumber) {
try {
public ActionResult Attachment_Read([DataSourceRequest]DataSourceRequest request, int prNumber)
{
try
{
return Json(prDMO.GetAttachments(prNumber).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
} catch (Exception ex) {
}
catch (Exception ex)
{
return HandleAPIException(prNumber, ex);
}
}
[HttpPost]
public ActionResult AttachSave(IEnumerable<HttpPostedFileBase> files, int prNumber) {
public ActionResult AttachSave(IEnumerable<HttpPostedFileBase> files, int prNumber)
{
// The Name of the Upload component is "files"
if (files != null) {
int userId = (int)Session[GlobalVars.SESSION_USERID];
foreach (var file in files) {
PartsRequestHelper.AttachSave(_AppSettings, prDMO, prNumber, userId, file.FileName, file.InputStream);
if (files != null)
{
foreach (var file in files)
{
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = System.IO.Path.GetFileName(file.FileName);
string prFolderPath = Functions.GetAttachmentFolder() + "PartsRequest\\" + prNumber.ToString();
var di = new System.IO.DirectoryInfo(prFolderPath);
if (!di.Exists)
di.Create();
var physicalPath = System.IO.Path.Combine(prFolderPath, fileName);
file.SaveAs(physicalPath);
var attach = new PartsRequestAttachment()
{
PRNumber = prNumber,
FileName = fileName,
UserID = (int)Session[GlobalVars.SESSION_USERID],
};
prDMO.InsertAttachment(attach);
}
}
return Content("");
}
public FileResult DownloadFile(string attachmentID, string prNumber) {
public FileResult DownloadFile(string attachmentID, string prNumber)
{
string fileName = prDMO.GetFileName(attachmentID);
string folderPath = _AppSettings.AttachmentFolder + "PartsRequest\\" + prNumber.ToString();
string folderPath = Functions.GetAttachmentFolder() + "PartsRequest\\" + prNumber.ToString();
var sDocument = System.IO.Path.Combine(folderPath, fileName);
var FDir_AppData = _AppSettings.AttachmentFolder;
if (!sDocument.StartsWith(FDir_AppData)) {
var FDir_AppData = Functions.GetAttachmentFolder();
if (!sDocument.StartsWith(FDir_AppData))
{
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
// and block requests outside like "../web.config"
throw new HttpException(403, "Forbidden");
@ -273,25 +348,33 @@ public class PartsRequestController : Controller {
}
[HttpPost]
public ActionResult DeleteAttachment(int attachmentID, string fileName, int prNumber) {
try {
if (ModelState.IsValid) {
public ActionResult DeleteAttachment(int attachmentID, string fileName, int prNumber)
{
try
{
if (ModelState.IsValid)
{
prDMO.DeleteAttachment(attachmentID);
var physicalPath = System.IO.Path.Combine(_AppSettings.AttachmentFolder + @"PartsRequest\" + prNumber.ToString(), fileName);
var physicalPath = System.IO.Path.Combine(Functions.GetAttachmentFolder() + @"PartsRequest\" + prNumber.ToString(), fileName);
if (System.IO.File.Exists(physicalPath)) {
if (System.IO.File.Exists(physicalPath))
{
System.IO.File.Delete(physicalPath);
}
}
return Content("");
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(prNumber, e, "AttachmentID=" + attachmentID.ToString());
}
}
[HttpPost]
public ActionResult Submit(int prNumber) {
try {
public ActionResult Submit(int prNumber)
{
try
{
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
var pr = prDMO.Get(prNumber);
@ -310,67 +393,90 @@ public class PartsRequestController : Controller {
var approvers = MiscDMO.GetApprovalsByDocument(prNumber, (int)GlobalVars.DocumentType.PartsRequest);
if (approvers.Count(a => a.Step.HasValue && a.Step.Value == 1 && a.UserID == myUserID) > 0) {
if (approvers.Count(a => a.Step.HasValue && a.Step.Value == 1 && a.UserID == myUserID) > 0)
{
// Auto-Approve if the user is an approver for workflow step 1
var c = Approve(prNumber, 1, "Auto-Approve");
if (c != null && c is ContentResult) {
if (c != null && c is ContentResult)
{
var result = ((ContentResult)c).Content;
if (!String.Equals(result, "OK"))
throw new Exception(result);
}
if (c != null && c is JsonResult)
return c;
} else {
}
else
{
// Do step 1 notification
NotifyApprovers(prNumber, 1);
}
if (Request.IsAjaxRequest()) {
if (Request.IsAjaxRequest())
{
return Content("Redirect");
} else {
}
else
{
return Content("Invalid");
}
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(prNumber, e);
}
}
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
try {
public ActionResult GetApproversList([DataSourceRequest]DataSourceRequest request, int issueID, byte step)
{
try
{
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.PartsRequest).ToDataSourceResult(request));
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(issueID, e, "Step=" + step.ToString());
}
}
public ActionResult GetAllUsersList() {
try {
public ActionResult GetAllUsersList()
{
try
{
UserAccountDMO userDMO = new UserAccountDMO();
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
return Json(userlist, JsonRequestBehavior.AllowGet);
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(0, e);
}
}
[HttpPost]
public ActionResult ReAssignApproval(int issueID, int fromUserID, int userIDs, byte step) {
try {
public ActionResult ReAssignApproval(int issueID, int fromUserID, int userIDs, byte step)
{
try
{
String email = wfDMO.ReAssignApproval(
issueID, fromUserID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
NotifyReAssignment(issueID, email);
return Content("OK");
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(issueID, e);
}
}
[HttpPost]
public ActionResult Approve(int prNumber, byte currentStep, string comments) {
try {
public ActionResult Approve(int prNumber, byte currentStep, string comments)
{
try
{
bool lastStep = false;
bool lastApproverInCurrentStep = false;
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
@ -380,20 +486,18 @@ public class PartsRequestController : Controller {
if (pr == null)
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Document does not exist");
while (true) {
while (true)
{
lastApproverInCurrentStep = wfDMO.Approve(
_AppSettings,
prNumber,
currentStep,
comments,
out lastStep,
prNumber, currentStep, comments, out lastStep,
(int)Session[GlobalVars.SESSION_USERID],
(int)GlobalVars.DocumentType.PartsRequest,
WorkflowNumber);
if (!lastApproverInCurrentStep)
break;
if (lastStep) {
if (!lastApproverInCurrentStep) break;
if (lastStep)
{
NotifyCompletion(prNumber);
break;
}
@ -405,32 +509,54 @@ public class PartsRequestController : Controller {
return Content("No approvers found for next step, contact support!");
// only continue with approving if the next step has me as an approver also
if (approvers.Count(a => a.Step.HasValue && a.Step.Value == currentStep && a.UserID == myUserID) == 0) {
if (approvers.Count(a => a.Step.HasValue && a.Step.Value == currentStep && a.UserID == myUserID) == 0)
{
NotifyApprovers(prNumber, currentStep);
break;
}
}
return Content("OK");
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(prNumber, e);
}
}
protected void NotifyReAssignment(int prNumber, string email) {
protected void SendEmailNotification(String subject, int prNumber, string toEmail, string emailTemplate)
{
string senderName = "Parts Request";
EmailNotification en = new EmailNotification(subject, System.Configuration.ConfigurationManager.AppSettings["EmailTemplatesPath"]);
string[] emailparams = new string[5];
emailparams[0] = prNumber.ToString();
emailparams[1] = prNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Parts Request";
emailparams[4] = Session[GlobalVars.SESSION_USERNAME].ToString();
String userEmail = toEmail;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
protected void NotifyReAssignment(int prNumber, string email)
{
var pr = prDMO.Get(prNumber);
if (pr == null)
return;
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
SendEmailNotification(
subject: String.Format("Parts Request Re-Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
prNumber: prNumber,
toEmail: email,
emailTemplate: "PRReAssigned.txt");
EventLogDMO.Add(new WinEventLog() {
EventLogDMO.Add(new WinEventLog()
{
IssueID = prNumber,
UserID = @User.Identity.Name,
DocumentType = "PR",
@ -439,22 +565,24 @@ public class PartsRequestController : Controller {
});
}
protected void NotifyCompletion(int prNumber) {
protected void NotifyCompletion(int prNumber)
{
var pr = prDMO.Get(prNumber);
if (pr == null)
return;
var u = userDMO.GetUserByID(pr.RequestorID);
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email)))
{
SendEmailNotification(
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
prNumber: prNumber,
toEmail: u.Email,
emailTemplate: "PRCompleted.txt");
EventLogDMO.Add(new WinEventLog() {
EventLogDMO.Add(new WinEventLog()
{
IssueID = prNumber,
UserID = @User.Identity.Name,
DocumentType = "PR",
@ -464,22 +592,24 @@ public class PartsRequestController : Controller {
}
}
public void NotifyRejection(int prNumber) {
public void NotifyRejection(int prNumber)
{
var pr = prDMO.Get(prNumber);
if (pr == null)
return;
var u = userDMO.GetUserByID(pr.OriginatorID);
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email)))
{
SendEmailNotification(
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
prNumber: prNumber,
toEmail: u.Email,
emailTemplate: "PRReject.txt");
EventLogDMO.Add(new WinEventLog() {
EventLogDMO.Add(new WinEventLog()
{
IssueID = prNumber,
UserID = @User.Identity.Name,
DocumentType = "PR",
@ -489,8 +619,10 @@ public class PartsRequestController : Controller {
}
}
protected void NotifyApprovers(int prNumber, byte step) {
try {
protected void NotifyApprovers(int prNumber, byte step)
{
try
{
string emailSentList = "";
var pr = prDMO.Get(prNumber);
@ -501,69 +633,81 @@ public class PartsRequestController : Controller {
List<string> emailList = MiscDMO.GetApproverEmailListByDocument(
prNumber, step, (int)GlobalVars.DocumentType.PartsRequest).Distinct().ToList();
foreach (string email in emailList) {
try {
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
foreach (string email in emailList)
{
try
{
SendEmailNotification(
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
prNumber: prNumber,
toEmail: email,
emailTemplate: "PRAssigned.txt");
} catch (Exception ex) {
}
catch (Exception ex)
{
HandleException(prNumber, ex, "email=" + email);
}
emailSentList += email + ",";
}
try {
try
{
EventLogDMO.Add(new WinEventLog() {
IssueID = prNumber,
UserID = @User.Identity.Name,
DocumentType = "PR",
OperationType = "Email",
Comments = "Approvers for Step " + step.ToString() + ":" + emailSentList
});
} catch { }
} catch (Exception e) {
IssueID = prNumber, UserID = @User.Identity.Name, DocumentType = "PR", OperationType = "Email",
Comments = "Approvers for Step " + step.ToString() + ":" + emailSentList });
}
catch { }
}
catch (Exception e)
{
HandleException(prNumber, e, "Step=" + step.ToString());
}
}
[HttpPost]
public ActionResult Reject(int prNumber, byte currentStep, string comments) {
try {
if (Session[GlobalVars.SESSION_USERID] != null) {
public ActionResult Reject(int prNumber, byte currentStep, string comments)
{
try
{
if (Session[GlobalVars.SESSION_USERID] != null)
{
wfDMO.Reject(prNumber, currentStep, comments, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.PartsRequest);
NotifyRejection(prNumber);
} else {
}
else
{
Response.Redirect("~/Account/Login");
}
return Content("OK");
} catch (Exception e) {
}
catch (Exception e)
{
return HandleAPIException(prNumber, e);
}
}
public ActionResult ApprovalLogHistory_Read([DataSourceRequest] DataSourceRequest request, int prNumber) {
public ActionResult ApprovalLogHistory_Read([DataSourceRequest] DataSourceRequest request, int prNumber)
{
return Json(prDMO.GetApprovalLogHistory(prNumber).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
}
protected void NotifyAssignment(int prNumber, string email) {
protected void NotifyAssignment(int prNumber, string email)
{
var pr = prDMO.Get(prNumber);
if (pr == null)
return;
string username = Session[GlobalVars.SESSION_USERNAME].ToString();
PartsRequestHelper.SendEmailNotification(_AppSettings, username,
SendEmailNotification(
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
prNumber: prNumber,
toEmail: email,
emailTemplate: "PRAssigned.txt");
EventLogDMO.Add(new WinEventLog() {
EventLogDMO.Add(new WinEventLog()
{
IssueID = prNumber,
UserID = @User.Identity.Name,
DocumentType = "PR",
@ -573,33 +717,37 @@ public class PartsRequestController : Controller {
}
[HttpPost]
public void AddAdditionalApproval(int issueID, byte step, string userIDs) {
public void AddAdditionalApproval(int issueID, byte step, string userIDs)
{
var emailArray = "";
try {
try
{
emailArray = wfDMO.AddAdditionalApproval(issueID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
} catch (Exception e) {
}
catch (Exception e)
{
HandleAPIException(issueID, e);
}
string emailSentList = "";
string[] emaiList = emailArray.Split(new char[] { '~' });
foreach (string email in emaiList) {
if (email.Length > 0) {
foreach (string email in emaiList)
{
if (email.Length > 0)
{
NotifyAssignment(issueID, email);
emailSentList += email + ",";
}
}
try {
EventLogDMO.Add(new WinEventLog() {
IssueID = issueID,
UserID = @User.Identity.Name,
DocumentType = "PR",
OperationType = "Email",
Comments = "Additional Approver: " + emailSentList
});
} catch { }
try
{
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "PR",
OperationType = "Email", Comments = "Additional Approver: " + emailSentList });
}
catch { }
}
}
}

View File

@ -6,27 +6,27 @@ using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
public class ReportsController : Controller {
namespace Fab2ApprovalSystem.Controllers
{
[Authorize]
[SessionExpireFilter]
public class ReportsController : Controller
{
public const String specialNullString = "~NULL~";
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
// GET: Export
public ActionResult Index() {
public ActionResult Index()
{
UserAccountDMO userDMO = new UserAccountDMO();
ViewBag.HasITARAccess = userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]);
return View();
}
public ActionResult Report(String id, String docType = "") {
public ActionResult Report(String id, String docType = "")
{
if (String.IsNullOrEmpty(id))
return RedirectToAction("Index");
@ -34,10 +34,12 @@ public class ReportsController : Controller {
if (!userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]))
return View("UnAuthorizedAccess");
var m = new ReportViewModel<System.Web.Mvc.SelectListItem>();
var m = new ReportViewModel();
var reports = GetReportList(docType);
foreach (var report in reports) {
if (String.Equals(report.ReportID, id, StringComparison.OrdinalIgnoreCase)) {
foreach (var report in reports)
{
if (String.Equals(report.ReportID, id, StringComparison.OrdinalIgnoreCase))
{
m.ReportID = report.ReportID;
m.ReportName = report.Name;
m.Description = report.Description;
@ -45,8 +47,9 @@ public class ReportsController : Controller {
var c = SetupSSRSHelperClient();
m.Parameters = c.GetReportParameters(report.FullPath).Select(parm => {
var r = new ReportParameterViewModel<System.Web.Mvc.SelectListItem>();
m.Parameters = c.GetReportParameters(report.FullPath).Select(parm =>
{
var r = new ReportParameterViewModel();
r.Visible = (parm.PromptUser.HasValue == false || parm.PromptUser == true) && !String.IsNullOrEmpty(parm.Prompt);
r.Prompt = parm.Prompt;
r.Name = parm.Name;
@ -62,9 +65,11 @@ public class ReportsController : Controller {
r.ControlType = ParameterControlTypes.Textbox;
r.SelectList = null;
if (parm.ValidValues != null) {
if (parm.ValidValues != null)
{
r.SelectList = parm.ValidValues.Select(vv => {
return new SelectListItem() {
return new SelectListItem()
{
Text = vv.Value,
Value = (vv.Key == null ? specialNullString : vv.Key),
Selected = (parm.DefaultValues != null && parm.DefaultValues.Contains(vv.Key))
@ -85,24 +90,26 @@ public class ReportsController : Controller {
return View(m);
}
public SSRSHelper.SSRSClient SetupSSRSHelperClient() {
public SSRSHelper.SSRSClient SetupSSRSHelperClient()
{
var useCfgForBindings = false;
if (String.Equals(_AppSettings.SSRSBindingsByConfiguration, "true", StringComparison.OrdinalIgnoreCase))
if (String.Equals(System.Configuration.ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"], "true", StringComparison.OrdinalIgnoreCase))
useCfgForBindings = true;
var c = new SSRSHelper.SSRSClient(
Convert.ToString(_AppSettings.SSRSBaseURL),
Convert.ToString(_AppSettings.SSRSDomain),
Convert.ToString(_AppSettings.SSRSUsername),
Convert.ToString(_AppSettings.SSRSPassword),
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSBaseURL"]),
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSDomain"]),
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSUsername"]),
Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSPassword"]),
useCfgForBindings);
c.Initialize();
return c;
}
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType) {
String folderName = Convert.ToString(_AppSettings.SSRSFolder);
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType)
{
String folderName = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSFolder"]);
if (folderName.EndsWith("/"))
folderName = folderName.TrimEnd('/');
if (!String.IsNullOrWhiteSpace(docType))
@ -112,12 +119,13 @@ public class ReportsController : Controller {
return c.ListReports(folderName);
}
public ActionResult GetReports(String docType) {
public ActionResult GetReports(String docType)
{
var reports = GetReportList(docType);
return Json(new {
Data =
reports.Select(r => new ReportViewModel<System.Web.Mvc.SelectListItem>() {
return Json(new { Data =
reports.Select(r => new ReportViewModel()
{
ReportName = r.Name ?? "",
Description = r.Description ?? "",
ReportID = r.ReportID ?? "",
@ -128,7 +136,8 @@ public class ReportsController : Controller {
}
[HttpPost]
public ActionResult ExportReport(String DocType, String ReportID) {
public ActionResult ExportReport(String DocType, String ReportID)
{
var c = SetupSSRSHelperClient();
var reports = GetReportList(DocType);
@ -143,12 +152,17 @@ public class ReportsController : Controller {
parms.Add("UserID", Convert.ToString(Session[GlobalVars.SESSION_USERID]));
parms.Add("BaseURL", GlobalVars.hostURL);
foreach (var rp in reportParms) {
if (rp.MultiValue.HasValue && rp.MultiValue.Value) {
foreach (String v in Request.Params.GetValues("parm_" + rp.Name)) {
foreach (var rp in reportParms)
{
if (rp.MultiValue.HasValue && rp.MultiValue.Value)
{
foreach (String v in Request.Params.GetValues("parm_" + rp.Name))
{
parms.Add(rp.Name, v);
}
} else {
}
else
{
String value = null;
if (Request.Params.AllKeys.Contains("parm_" + rp.Name))
@ -160,8 +174,10 @@ public class ReportsController : Controller {
if ((rp.AllowBlank.HasValue == false || rp.AllowBlank.Value == false) && value == "")
value = null;
if (value == null) {
if (rp.Nullable.HasValue == false || rp.Nullable.Value == false) {
if (value == null)
{
if (rp.Nullable.HasValue == false || rp.Nullable.Value == false)
{
if (rp.DefaultValues != null && rp.DefaultValues.Length > 0)
value = rp.DefaultValues[0];
if (value == null)
@ -174,18 +190,25 @@ public class ReportsController : Controller {
}
var b = c.ExportReport(report.FullPath, @User.Identity.Name, parms, "EXCELOPENXML");
try {
try
{
var b2 = c.FreezeExcelHeaders(b);
return File(b2, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
} catch {
}
catch
{
}
return File(b, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
}
protected String MakeFilename(String reportName) {
protected String MakeFilename(String reportName)
{
String r = "";
char[] invalidChars = System.IO.Path.GetInvalidFileNameChars();
foreach (char c in reportName) {
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
foreach (char c in reportName)
{
if (invalidChars.Contains(c))
r += '_';
else
@ -194,4 +217,5 @@ public class ReportsController : Controller {
return r;
}
}
}

View File

@ -1,38 +1,35 @@
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using Fab2ApprovalSystem.Utilities;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.Utilities;
using Fab2ApprovalSystem.ViewModels;
using Kendo.Mvc.Extensions;
using Fab2ApprovalSystem.Misc;
using System.Configuration;
namespace Fab2ApprovalSystem.Controllers;
[Authorize]
[SessionExpireFilter]
public class TrainingController : Controller {
namespace Fab2ApprovalSystem.Controllers {
[Authorize]
[SessionExpireFilter]
public class TrainingController : Controller {
UserAccountDMO userDMO = new UserAccountDMO();
AdminDMO adminDMO = new AdminDMO();
TrainingDMO trainingDMO = new TrainingDMO();
ECN_DMO ecnDMO = new ECN_DMO();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public EmailUtilities emailer = new EmailUtilities();
// GET: Training
public ActionResult Index() {
return View();
}
//public int Create(int ecnId, List<int> groupIds)
public int Create(int ecnId) {
ECN_DMO ecnDMO = new ECN_DMO();
// Delete old training if exists
//Delete old training if exists
int oldTrainingId = trainingDMO.GetTrainingId(ecnId);
if (oldTrainingId != null && oldTrainingId != 0) {
trainingDMO.DeleteTraining(oldTrainingId);
@ -57,34 +54,34 @@ public class TrainingController : Controller {
}
public ActionResult AddUserToTrainingAdHoc(int trainingId, int traineeId, int ecnId) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
// Get ECN
//Get ECN
ECN ecn = ecnDMO.GetECN(ecnId);
// Get User
//Get User
LoginModel user = userDMO.GetUserByID(traineeId);
// Get Training
//Get Training
Training training = trainingDMO.GetTraining(trainingId);
if (ecn != null) {
if (user != null) {
if (training != null) {
if (!trainingDMO.IsUserAssigned(traineeId, trainingId)) {
if (training.DeletedDate == null && !ecn.Deleted) {
// Both the ECN and training still exist
//Both the ECN and training still exist
if (training.CompletedDate != null) {
// Training is completed and now we need to re-open it.
//Training is completed and now we need to re-open it.
trainingDMO.reOpenTraining(trainingId);
int assignmentId = trainingDMO.CreateAssignment(trainingId, traineeId);
NotifyTrainee(traineeId, assignmentId, ecnId, ecn.Title);
return Content("Success");
} else {
// training is still open, just add a user and notify
//training is still open, just add a user and notify
int assignmentId = trainingDMO.CreateAssignment(trainingId, traineeId);
NotifyTrainee(traineeId, assignmentId, ecnId, ecn.Title);
return Content("Success");
}
} else {
// Ecn or training task have been deleted.
//Ecn or training task have been deleted.
return Content("Training or ECN has been deleted.");
}
} else {
@ -116,9 +113,9 @@ public class TrainingController : Controller {
if (training != null) {
if (training.DeletedDate == null && !ecn.Deleted) {
if (training.CompletedDate != null) {
// Training is completed and now we need to re-open it.
//Training is completed and now we need to re-open it.
foreach (int id in groupMemberIds) {
// Check to make sure user doesn't have an active assignment for this training
//Check to make sure user doesn't have an active assignment for this training
if (!trainingDMO.IsUserAssigned(id, trainingId)) {
usersAdded++;
int assignmentId = trainingDMO.CreateAssignment(trainingId, id);
@ -129,9 +126,9 @@ public class TrainingController : Controller {
trainingDMO.reOpenTraining(trainingId);
}
} else {
// training is still open, just add a users and notify
//training is still open, just add a users and notify
foreach (int id in groupMemberIds) {
// Check to make sure user doesn't have an active assignment for this training
//Check to make sure user doesn't have an active assignment for this training
if (!trainingDMO.IsUserAssigned(id, trainingId)) {
usersAdded++;
int assignmentId = trainingDMO.CreateAssignment(trainingId, id);
@ -178,8 +175,28 @@ public class TrainingController : Controller {
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
try {
string recipient = userDMO.GetUserEmailByID(userId);
TrainingHelper.NotifyTrainee(_AppSettings, userId, assignmentId, ecnId, title, recipient);
string emailSentList = "";
string recipient = userDMO.GetUserEmailByID(userId.ToString());
string emailTemplate = "ECNTrainingAssigned.txt";
string userEmail = string.Empty;
string subject = string.Empty;
string senderName = "ECN Training";
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
userEmail = recipient;
string[] emailparams = new string[4];
emailparams[0] = assignmentId.ToString();
emailparams[1] = ecnId.ToString();
emailparams[2] = GlobalVars.hostURL;
//#if(DEBUG)
//string SenderEmail = "MesaFabApproval@infineon.com";
//userEmail = "jonathan.ouellette@infineon.com";
//#endif
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch (Exception e) {
string detailedException = "";
try {
@ -200,12 +217,13 @@ public class TrainingController : Controller {
public ActionResult ViewTrainingDocsPartial(int trainingAssignmentId) {
ViewBag.trainingAssignmentId = trainingAssignmentId;
//IEnumerable<TrainingDocAck> attachments = ecnDMO.GetECNAttachments(ecnNumber);
IEnumerable<TrainingDocAck> attachments = trainingDMO.GetAssignedDocs(trainingAssignmentId);
return PartialView(attachments);
}
public ActionResult AcknowledgeDocument(int trainingAssignmentID, int trainingDocAckID) {
// Check to see if acknowledgement is valid(Security Feature to protect data integrity)
//Check to see if acknowledgement is valid(Security Feature to protect data integrity)
if (trainingDMO.CheckValidDocAck(trainingDocAckID)) {
trainingDMO.AcknowledgeDocument(trainingDocAckID);
bool isFinishedTrainingAssignment = trainingDMO.CheckTrainingAssignmentStatus(trainingAssignmentID);
@ -251,7 +269,7 @@ public class TrainingController : Controller {
public ActionResult TrainingReportsView(int? filterType, string filterValue) {
ViewBag.TrainingGroups = adminDMO.GetTrainingGroups();
IEnumerable<Training> trainingList = trainingDMO.GetAllTrainings();
// Group Filter
//Group Filter
if (filterType == 1 && filterValue != "") {
ViewBag.GroupFilter = filterValue;
List<Training> filteredTraining = new List<Training>();
@ -266,27 +284,27 @@ public class TrainingController : Controller {
trainingList = filteredTraining;
return PartialView(trainingList);
}
// Status Filter
//Status Filter
if (filterType == 2 && filterValue != "") {
List<Training> filteredTraining = new List<Training>();
switch (filterValue) {
case "1":
// Completed
//Completed
filteredTraining = (from a in trainingList where a.Status == true && a.Deleted != true select a).ToList();
break;
case "2":
// In Progress
//In Progress
filteredTraining = (from a in trainingList where a.Status != true && a.Deleted != true select a).ToList();
break;
case "3":
// Cancelled
//Cancelled
filteredTraining = (from a in trainingList where a.Deleted == true select a).ToList();
break;
}
trainingList = filteredTraining;
return PartialView(trainingList);
}
// Default return all.
//Default return all.
else {
return PartialView(trainingList);
}
@ -302,8 +320,9 @@ public class TrainingController : Controller {
ViewBag.ECNTitle = ECNTitle;
ViewBag.trainingID = trainingID;
IEnumerable<TrainingAssignment> trainingAssignments = trainingDMO.GetAllTrainingAssignments(trainingID);
// Calculate Percent Complete:
//Calculate Percent Complete:
float percentComplete = 0;
//float assignmentCount = trainingAssignments.Count();
float assignmentCount = (from a in trainingAssignments where a.Deleted != true select a).Count();
float totalCompleted = 0;
foreach (TrainingAssignment assignment in trainingAssignments) {
@ -324,20 +343,22 @@ public class TrainingController : Controller {
}
}
trainingAssignments = groupFilteredTraining;
}
if (statusFilter != "" && statusFilter != null) {
List<TrainingAssignment> filteredTraining = new List<TrainingAssignment>();
switch (statusFilter) {
case "1":
// Completed
//Completed
filteredTraining = (from a in trainingAssignments where a.status == true && a.Deleted != true select a).ToList();
break;
case "2":
// In Progress
//In Progress
filteredTraining = (from a in trainingAssignments where a.status != true && a.Deleted != true select a).ToList();
break;
case "3":
// Cancelled
//Cancelled
filteredTraining = (from a in trainingAssignments where a.Deleted == true select a).ToList();
break;
default:
@ -345,6 +366,7 @@ public class TrainingController : Controller {
break;
}
trainingAssignments = filteredTraining;
//return PartialView(trainingList);
}
return PartialView(trainingAssignments);
@ -368,6 +390,8 @@ public class TrainingController : Controller {
/// <summary>
/// Method to return all the training assignments for a specified user
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public ActionResult ViewMyTrainingAssignments() {
int userID = (int)Session[GlobalVars.SESSION_USERID];
List<TrainingAssignment> assignments = trainingDMO.GetTrainingAssignmentsByUserID(userID);
@ -393,6 +417,8 @@ public class TrainingController : Controller {
/// <summary>
/// Method to return all assigned documents for a specified training assignment
/// </summary>
/// <param name="assignmentID"></param>
/// <returns></returns>
public ActionResult ViewMyTrainingAssignment(int assignmentID, int ECNNumber) {
ViewBag.ECNNumber = ECNNumber;
ViewBag.AssignmentID = assignmentID;
@ -404,7 +430,7 @@ public class TrainingController : Controller {
IEnumerable<Training> AllTrainings = trainingDMO.GetTrainings();
ViewBag.TrainingGroups = adminDMO.GetTrainingGroups();
ViewBag.AllGroups = trainingDMO.GetTrainingGroups();
// Group Filter
//Group Filter
if (filterType == 1 && filterValue != "") {
ViewBag.GroupFilter = filterValue;
List<Training> filteredTraining = new List<Training>();
@ -432,8 +458,8 @@ public class TrainingController : Controller {
trainingDMO.DeleteTrainingAssignment(assignmentId);
trainingDMO.DeleteTrainingDocAck(assignmentId);
// Below checks and updates the training status
// TO-DO Put this in its own method.
//Below checks and updates the training status
//TO-DO Put this in its own method.
bool isFinishedTrainingAssignment = trainingDMO.CheckTrainingAssignmentStatus(assignmentId);
if (isFinishedTrainingAssignment) {
@ -456,11 +482,12 @@ public class TrainingController : Controller {
public ActionResult ManuallyExecuteECNTraining(int ecnId, int[] trainingGroupsIn) {
if ((bool)Session[GlobalVars.IS_ADMIN]) {
List<int> newTrainingGroupIds = new List<int>(trainingGroupsIn);
//Get ECN
ECN ecn = ecnDMO.GetECN(ecnId);
if (ecn != null) {
if (ecn.CloseDate != null) {
if (newTrainingGroupIds.Count > 0) {
// Check each assigned group id and see if it's already saved to the ECN
//Check each assigned group id and see if it's already saved to the ECN
List<int> assignedTrainingGroups = trainingDMO.GetECNAssignedTrainingGroups(ecnId);
IEnumerable<int> onlyNewTrainingIds = newTrainingGroupIds.Except(assignedTrainingGroups);
try {
@ -515,14 +542,15 @@ public class TrainingController : Controller {
emailBody += "Please ensure the following users complete their training assignments. ";
emailBody += "Dates in red font identify past due training tasks.</p><br />";
emailBody += "<style>table,th,td{border: 1px solid black;}</style>";
// Get all users set up to receive the training report email.
//Get all users set up to receive the training report email.
List<TrainingReportUser> trainingReportUsers = adminDMO.GetTrainingReportUsers();
List<string> emailList = new List<string>();
foreach (TrainingReportUser user in trainingReportUsers) {
string userEmail = userDMO.GetUserByID(user.UserId).Email;
emailList.Add(userEmail);
}
// Get a list of open trainings
//emailList.Add("Chase.Tucker@infineon.com");
//Get a list of open trainings
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
foreach (Training training in openTrainings) {
@ -535,6 +563,7 @@ public class TrainingController : Controller {
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
foreach (TrainingAssignment assignment in openAssignments) {
if (!userDMO.GetUserByID(assignment.UserID).OOO) {
trainingSectionUserCount++;
@ -552,16 +581,16 @@ public class TrainingController : Controller {
}
}
trainingSection += "</table>";
if (trainingSectionUserCount > 0)
emailBody += trainingSection;
if (trainingSectionUserCount > 0) emailBody += trainingSection;
}
string recipientEmail = "";
List<string> ccRecipients = emailList;
EmailUtilities.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Daily Open Training Report", emailBody);
emailer.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Mesa Approval Daily Open Training Report", emailBody, "Daily Open Training Report");
isSuccess = true;
} catch {
isSuccess = false;
}
return isSuccess;
}
}
}

View File

@ -5,64 +5,87 @@ using System.Net;
using System.Net.Http;
using System.Web.Http;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Controllers;
namespace Fab2ApprovalSystem.Controllers
{
public class WebAPIController : ApiController {
public class WebAPIController : ApiController
{
public TrainingController trainingFunctions = new TrainingController();
public CorrectiveActionController carFunctions = new CorrectiveActionController();
public AccountController accountFunctions = new AccountController();
public HomeController homeFunctions = new HomeController();
private readonly AppSettings _AppSettings = GlobalVars.AppSettings;
public string Get() {
public string Get()
{
return "Welcome To Web API";
}
public List<string> Get(int Id) {
public List<string> Get(int Id)
{
return new List<string> {
"Data1",
"Data2"
};
}
public void Post() {
public void Post()
{
}
public HttpResponseMessage Post(HttpRequestMessage request, string action) {
switch (action) {
public HttpResponseMessage Post(HttpRequestMessage request, string action)
{
switch (action)
{
case "TrainingReport":
if (trainingFunctions.RunTrainingReport()) {
if (trainingFunctions.RunTrainingReport())
{
return request.CreateResponse(HttpStatusCode.OK);
} else {
}
else
{
return request.CreateResponse(HttpStatusCode.InternalServerError);
}
case "CARDueDates":
if (carFunctions.ProcessCARDueDates()) {
if (carFunctions.ProcessCARDueDates())
{
return request.CreateResponse(HttpStatusCode.OK);
} else {
}
else
{
return request.CreateResponse(HttpStatusCode.InternalServerError);
}
case "ProcessOoO":
if (homeFunctions.ProcessOoO()) {
if (homeFunctions.ProcessOoO())
{
return request.CreateResponse(HttpStatusCode.OK);
} else {
}
else
{
return request.CreateResponse(HttpStatusCode.InternalServerError);
}
case "ExpireOoO":
if (homeFunctions.ExpireOoO()) {
if (homeFunctions.ExpireOoO())
{
return request.CreateResponse(HttpStatusCode.OK);
} else {
}
else
{
return request.CreateResponse(HttpStatusCode.InternalServerError);
}
case "ApprovalReminders":
if (homeFunctions.ApprovalsReminderNotifications()) {
if (homeFunctions.ApprovalsReminderNotifications())
{
return request.CreateResponse(HttpStatusCode.OK);
} else {
}
else
{
return request.CreateResponse(HttpStatusCode.InternalServerError);
}
default:
return request.CreateResponse(HttpStatusCode.InternalServerError, "Action Not Found");
}
}
}
}

View File

@ -1,73 +1,99 @@
using System;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Kendo.Mvc.UI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Kendo.Mvc.Extensions;
using Kendo.Mvc.UI;
namespace Fab2ApprovalSystem.Controllers;
public class WorkflowController : Controller {
namespace Fab2ApprovalSystem.Controllers
{
public class WorkflowController : Controller
{
//
//
// GET: /Workflow/Details/5
public ActionResult Details(int id) {
public ActionResult Details(int id)
{
return View();
}
//
// GET: /Workflow/Create
public ActionResult Create() {
public ActionResult Create()
{
return View();
}
//
// POST: /Workflow/Create
[HttpPost]
public ActionResult Create(FormCollection collection) {
try {
public ActionResult Create(FormCollection collection)
{
try
{
// TODO: Add insert logic here
return RedirectToAction("Index");
} catch {
}
catch
{
return View();
}
}
//
// GET: /Workflow/Edit/5
public ActionResult Edit(int id) {
public ActionResult Edit(int id)
{
return View();
}
//
// POST: /Workflow/Edit/5
[HttpPost]
public ActionResult Edit(int id, FormCollection collection) {
try {
public ActionResult Edit(int id, FormCollection collection)
{
try
{
// TODO: Add update logic here
return RedirectToAction("Index");
} catch {
}
catch
{
return View();
}
}
//
// GET: /Workflow/Delete/5
public ActionResult Delete(int id) {
public ActionResult Delete(int id)
{
return View();
}
//
// POST: /Workflow/Delete/5
[HttpPost]
public ActionResult Delete(int id, FormCollection collection) {
try {
public ActionResult Delete(int id, FormCollection collection)
{
try
{
// TODO: Add delete logic here
return RedirectToAction("Index");
} catch {
}
catch
{
return View();
}
}
}
}

View File

@ -1,59 +0,0 @@
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Fab2ApprovalSystem.Models;
using Newtonsoft.Json;
namespace Fab2ApprovalSystem.DMO;
public class AccountDMO {
public static async Task<LoginResult> LoginAsync(HttpClient httpClient, LoginModel loginModel) {
LoginResult result;
HttpRequestMessage request = new(HttpMethod.Post, "auth/login");
AuthAttempt authAttempt = loginModel is null ? null : new AuthAttempt() {
LoginID = loginModel.LoginID,
Password = loginModel.Password
};
string json = authAttempt is null ? "{}" : JsonConvert.SerializeObject(authAttempt);
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage httpResponseMessage = await httpClient.SendAsync(request);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new Exception($"The authentication API failed, because {httpResponseMessage.ReasonPhrase}");
string responseContent = await httpResponseMessage.Content.ReadAsStringAsync();
result = JsonConvert.DeserializeObject<LoginResult>(responseContent);
return result;
}
public static async Task<LoginResult> ExternalAuthSetupAsync(HttpClient httpClient, AuthAttempt authAttempt) {
LoginResult result;
HttpRequestMessage request = new(HttpMethod.Post, "auth/refresh");
string json = authAttempt is null ? "{}" : JsonConvert.SerializeObject(authAttempt);
request.Content = new StringContent(json, Encoding.UTF8, "application/json");
HttpResponseMessage httpResponseMessage = await httpClient.SendAsync(request);
if (!httpResponseMessage.IsSuccessStatusCode)
throw new Exception($"The authentication API failed, because {httpResponseMessage.ReasonPhrase}");
string responseContent = await httpResponseMessage.Content.ReadAsStringAsync();
result = JsonConvert.DeserializeObject<LoginResult>(responseContent);
return result;
}
}

View File

@ -1,62 +1,29 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using System.Text;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
public class AdminDMO {
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
#if !NET8
namespace Fab2ApprovalSystem.DMO
{
public class AdminDMO
{
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
#endif
public List<ParentChildModel> GetAllSubRoles(string showInactiveRoles = "") {
List<ParentChildModel> results = new();
List<Role> roles = GetSubRoles();
ParentChildModel child;
ParentChildModel parent;
foreach (Role r in roles) {
parent = new ParentChildModel {
id = r.RoleID,
parentid = -1,
text = r.RoleName,
value = r.RoleID.ToString()
};
foreach (SubRole sr in r.SubRoles) {
if (sr.Inactive) {
// hide inactive roles unless parameter says otherwise
if (!showInactiveRoles.Equals("true"))
continue;
}
child = new ParentChildModel {
id = sr.SubRoleID,
parentid = r.RoleID,
text = sr.SubRoleCategoryItem + (sr.Inactive ? " (Inactive)" : ""),
value = sr.SubRoleID.ToString()
};
results.Add(child);
}
results.Add(parent);
};
return results;
}
public List<Role> GetSubRoles() {
StringBuilder sql = new();
/// <summary>
///
/// </summary>
/// <returns></returns>
public List<Role> GetSubRoles()
{
StringBuilder sql = new StringBuilder();
sql.Append(
"SELECT R.RoleID, R.RoleName, SubRoleID, SubRoleCategoryItem, SR.RoleID, SR.Inactive " +
"FROM vSubRoles SR " +
@ -64,176 +31,233 @@ public class AdminDMO {
"ORDER BY R.RoleID, SubRoleCategoryItem ");
db.Open();
Dictionary<int, Role> lookup = new();
List<Role> data = db.Query<Role, SubRole, Role>(sql.ToString(),
(parent, child) => {
var lookup = new Dictionary<int, Role>();
List<Role> data = this.db.Query<Role, SubRole, Role>(sql.ToString(),
(parent, child) =>
{
Role role;
if (!lookup.TryGetValue(parent.RoleID, out role)) {
if (!lookup.TryGetValue(parent.RoleID, out role))
{
lookup.Add(parent.RoleID, role = parent);
}
//if (role.RoleID == null)
// role.SubRoles = new List<SubRole>();
role.SubRoles.Add(child);
return role;
},
splitOn: "SubRoleID").Distinct().ToList();
return data;
}
public List<UserSubRoles> GetUserSubRoles(int userId) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// /// <param name="userId"></param>
/// <returns></returns>
public List<UserSubRoles> GetUserSubRoles(int userId)
{
var parameters = new DynamicParameters();
parameters.Add("@UserId", userId);
List<UserSubRoles> userSubRoleList = db.Query<UserSubRoles>("GetSubRolesByUserId", parameters, commandType: CommandType.StoredProcedure).ToList();
var userSubRoleList = this.db.Query<UserSubRoles>("GetSubRolesByUserId", parameters, commandType: CommandType.StoredProcedure).ToList();
return userSubRoleList;
}
public IEnumerable<LoginModel> GetAllUsersBySubRole(int subRole) {
StringBuilder sql = new();
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <returns></returns>
public IEnumerable<LoginModel> GetAllUsersBySubRole(int subRole)
{
StringBuilder sql = new StringBuilder();
sql.Append("SELECT FirstName + ' ' + LastName AS FullName , LoginID, FirstName, LastName, U.UserID, SubRoleID ");
sql.Append("FROM UserSubRole UR ");
sql.Append("INNER JOIN Users U ON UR.UserID = U.UserID ");
sql.Append("WHERE UR.SubRoleID = " + subRole.ToString() + " ");
sql.Append("ORDER BY FirstName");
return db.Query<LoginModel>(sql.ToString()).ToList();
return this.db.Query<LoginModel>(sql.ToString()).ToList();
}
public void AddUserRoles(int subRole, string userids) {
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <param name="userids"></param>
public void AddUserRoles(int subRole, string userids)
{
string sql;
string[] arrayOfUsers = userids.Split(new char[] { '~' });
for (int i = 0; i < arrayOfUsers.Length; i++) {
for (int i = 0; i < arrayOfUsers.Length; i++)
{
sql = "INSERT INTO UserSubRole (UserID, SubRoleID) VALUES (" + arrayOfUsers[i] + ", " + subRole + " )";
db.Execute(sql);
this.db.Execute(sql);
}
}
public void DeleteUserFromAllTrainingGroups(int userId) {
public void DeleteUserFromAllTrainingGroups(int userId)
{
string sql = "DELETE FROM TrainingGroupMembers WHERE UserId = " + userId;
db.Open();
db.Execute(sql);
return;
}
public void DeleteUserRoles(int subRole, string userids) {
this.db.Open();
this.db.Execute(sql);
return;
}
/// <summary>
///
/// </summary>
/// <param name="subRole"></param>
/// <param name="userids"></param>
public void DeleteUserRoles(int subRole, string userids)
{
string sql;
string[] arrayOfUsers = userids.Split(new char[] { '~' });
for (int i = 0; i < arrayOfUsers.Length; i++) {
for (int i = 0; i < arrayOfUsers.Length; i++)
{
sql = "DELETE FROM UserSubRole WHERE UserID = " + arrayOfUsers[i] + " AND SubRoleID = " + subRole;
db.Execute(sql);
this.db.Execute(sql);
}
}
#if !NET8
public List<TrainingReportUser> GetTrainingReportUsers() {
public List<TrainingReportUser> GetTrainingReportUsers()
{
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
return CurrentReportUsers;
}
#else
public List<TrainingReportUser> GetTrainingReportUsers() =>
throw new NotImplementedException();
#endif
#if !NET8
public List<TECNNotificationsUser> GetTECNNotificationUsers() {
public List<TECNNotificationsUser> GetTECNNotificationUsers()
{
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
return currentTECNNotificationUsers;
}
#endif
public void TrainingReportAddUser(int userId) {
public void TrainingReportAddUser(int userId)
{
string sql = "INSERT INTO TrainingReportUsers (UserId) " + "VALUES ('" + userId + "') ";
db.Open();
db.Execute(sql);
this.db.Open();
this.db.Execute(sql);
return;
}
public void TECNExpirationAddUser(int userId) {
public void TECNExpirationAddUser(int userId)
{
string sql = "INSERT INTO TECNNotificationsUsers (UserId) " + "VALUES ('" + userId + "') ";
db.Open();
db.Execute(sql);
this.db.Open();
this.db.Execute(sql);
return;
}
public void TrainingReportDeleteUser(int userId)
{
var parameters = new DynamicParameters();
public void TrainingReportDeleteUser(int userId) {
DynamicParameters parameters = new();
parameters = new DynamicParameters();
parameters.Add("@UserID", userId);
db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
return;
}
public void TECNExpirationDeleteUser(int userId)
{
var parameters = new DynamicParameters();
public void TECNExpirationDeleteUser(int userId) {
DynamicParameters parameters = new();
parameters = new DynamicParameters();
parameters.Add("@UserID", userId);
db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
return;
}
public List<TrainingGroup> GetTrainingGroups()
{
//StringBuilder sql = new StringBuilder();
//sql.Append(
// "SELECT 'TrainingGroupID', TrainingGroupName " +
// "FROM TrainingGroups " +
// "ORDER BY TrainingGroupID ");
#if !NET8
public List<TrainingGroup> GetTrainingGroups() {
//db.Open();
//var lookup = new Dictionary<int, TrainingGroup>();
////List<TrainingGroup> data = this.db.Query<TrainingGroup>(sql.ToString()
//return this.db.Query<TrainingGroup>(sql.ToString()).ToList();
var TrainingGroups = from a in FabApprovalDB.TrainingGroups select a;
List<TrainingGroup> GroupsToReturn = TrainingGroups.ToList();
return GroupsToReturn;
}
public void AddNewTrainingGroup(string groupName) {
public void AddNewTrainingGroup(string groupName)
{
TrainingGroup existing = null;
// Check to see that the group name doesn't exist.
try {
//Check to see that the group name doesn't exist.
try
{
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
} catch {
}
catch
{
// string test = "";
}
if (existing == null) {
if (existing == null)
{
//string sql = new StringBuilder();
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
this.db.Open();
this.db.Execute(sql);
return;
} else {
}
else
{
return;
}
}
#endif
public void DeleteTrainingGroup(int groupID) {
try {
public void DeleteTrainingGroup(int groupID)
{
try
{
string sql = "DELETE FROM TrainingGroups WHERE TrainingGroupID = " + groupID;
db.Open();
db.Execute(sql);
this.db.Open();
this.db.Execute(sql);
sql = "DELETE FROM TrainingGroupMembers WHERE TrainingGroupID = " + groupID;
db.Execute(sql);
this.db.Execute(sql);
return;
} catch {
}
}
catch
{
#if !NET8
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID) {
}
}
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID)
{
return (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == GroupID select a).ToList();
}
public void AddUserToGroup(int userId, int groupId) {
public void AddUserToGroup(int userId, int groupId)
{
UserAccountDMO userDB = new UserAccountDMO();
string userFullName = userDB.GetUserByID(userId).FullName;
TrainingGroupMember existing = null;
existing = (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == groupId && a.UserID == userId select a).FirstOrDefault();
if (existing == null) {
if (existing == null)
{
var parameters = new DynamicParameters();
parameters = new DynamicParameters();
@ -242,58 +266,46 @@ public class AdminDMO {
parameters.Add("@UserFullName", userFullName);
this.db.Execute("AddUserToTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
} else {
}
else
{
throw new Exception("The user already exists in this training group.");
}
//if (existing == null)
//{
// //string sql = new StringBuilder();
// string sql = "INSERT INTO TrainingGroupMembers (TrainingGroupID, UserID, FullName) " + "VALUES ('" + groupId + "','" + userId + "','" + userFullName + "') ";
// try
// {
// this.db.Open();
// this.db.Execute(sql);
// }
// catch(Exception e)
// {
// return;
// }
// return;
//}
//else
//{
// return;
}
#endif
public void DeleteFromGroup(int userId, int groupId) {
DynamicParameters parameters = new();
public void DeleteFromGroup(int userId, int groupId)
{
var parameters = new DynamicParameters();
parameters = new DynamicParameters();
parameters.Add("@GroupID", groupId);
parameters.Add("@UserID", userId);
db.Execute("DeleteUserFromTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("DeleteUserFromTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
return;
}
public void DeleteUser(UserAccountDMO userDMO, TrainingDMO trainingDMO, LoginModel loginModel) {
if (loginModel != null) {
userDMO.DeleteUser(loginModel);
// Remove open trainings
// Get a list of all user assigned trainings.
List<TrainingAssignment> trainingAssignments = trainingDMO.GetTrainingAssignmentsByUserID(loginModel.UserID);
// Go Through that list.
foreach (var trainingAssignment in trainingAssignments) {
// Delete Any document acknowledgements.
trainingDMO.DeleteTrainingDocAck(trainingAssignment.ID);
// Delete the training assignment itself
trainingDMO.DeleteTrainingAssignment(trainingAssignment.ID);
// Check the parent Training task to set to to complete if applicable.
if (trainingDMO.CheckTrainingStatus(trainingAssignment.ID)) {
int TrainingID = trainingAssignment.TrainingID;
// Set Training status to complete
trainingDMO.UpdateTrainingStatus(TrainingID);
}
}
// Remove user from any Training Groups
DeleteUserFromAllTrainingGroups(loginModel.UserID);
// Remove User from training report notifications
TrainingReportDeleteUser(loginModel.UserID);
// Remove user from TECN Expiration Notifications
TECNExpirationDeleteUser(loginModel.UserID);
// Get user subroles
List<UserSubRoles> userSubRoles = GetUserSubRoles(loginModel.UserID);
// Delete user from any subroles
foreach (var userSubRole in userSubRoles) {
DeleteUserRoles(userSubRole.SubRoleID, loginModel.UserID.ToString());
}
}
}
}

View File

@ -1,19 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Dapper;
using System.Configuration;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public static class ApprovalLogDMO
{
public static class ApprovalLogDMO {
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public static void Add(ApprovalLog appLog) {
DynamicParameters parameters = new();
public static void Add(ApprovalLog appLog)
{
var parameters = new DynamicParameters();
parameters.Add("@IssueID", appLog.IssueID);
parameters.Add("@UserID", appLog.UserID);
parameters.Add("@OperationType", appLog.OperationType);
@ -22,5 +27,7 @@ public static class ApprovalLogDMO {
parameters.Add("@DocumentTypeID", appLog.DocumentTypeID);
db.Execute("InsertApprovalLogByDocument", parameters, commandType: CommandType.StoredProcedure);
}
}
}

View File

@ -1,102 +1,149 @@
using Dapper;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
#if !NET8
using System.Data.Linq;
#endif
using System.Linq;
using System.Text;
using System.Transactions;
using System.Web;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Utilities;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public class AuditDMO
{
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
WorkflowDMO wfDMO = new WorkflowDMO();
public class AuditDMO {
/// <summary>
///
/// </summary>
/// <param name="audit"></param>
/// <returns></returns>
public Audit InsertAudit(Audit audit)
{
var parameters = new DynamicParameters();
private readonly AppSettings _AppSettings;
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public AuditDMO(AppSettings appSettings) =>
_AppSettings = appSettings;
public Audit InsertAudit(Audit audit) {
DynamicParameters parameters = new();
parameters = new DynamicParameters();
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
parameters.Add("@OriginatorID", audit.OriginatorID);
db.Execute("_8DInsertAuditItem", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditItem", parameters, commandType: CommandType.StoredProcedure);
audit.AuditNo = parameters.Get<int>("@AuditNo");
return audit;
}
public Audit GetAuditItem(int auditNo, int userID) {
Audit audit = new();
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <param name="isITAR"></param>
/// <param name="userID"></param>
/// <returns></returns>
public Audit GetAuditItem(int auditNo, int userID)
{
Audit audit = new Audit();
// isITAR = 2;
//isITAR = 2;
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", value: auditNo);
parameters.Add("@UserID", userID);
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure)) {
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
using (var multipleResultItems = this.db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure))
{
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
List<int> auditors = multipleResultItems.Read<int>().ToList();
var auditors = multipleResultItems.Read<int>().ToList();
if (audit != null && auditors != null) {
if (audit != null && auditors != null)
{
if (auditors.Count > 0)
audit.AuditorIDs.AddRange(auditors);
}
List<int> auditorTypes = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorTypes != null) {
var auditorTypes = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorTypes != null)
{
if (auditorTypes.Count > 0)
audit.AuditTypeIDs.AddRange(auditorTypes);
}
List<int> auditorAreas = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorAreas != null) {
var auditorAreas = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorAreas != null)
{
if (auditorAreas.Count > 0)
audit.AuditedAreaIDs.AddRange(auditorAreas);
}
}
//FabApprovalSystemEntitiesAll auditDb = new FabApprovalSystemEntitiesAll();
//var auditedStandardIDs = (from a in auditDb.C_8DAuditedStandardByAudit where a.AuditNo == audit.AuditNo select a.AuditedStandardID).ToList();
//foreach (var id in auditedStandardIDs)
//{
// audit.AuditedStandardIDs.Add(id);
//}
return audit;
}
public Audit GetAuditItemReadOnly(int auditNo, int userID) {
Audit audit = new();
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <param name="userID"></param>
/// <returns></returns>
public Audit GetAuditItemReadOnly(int auditNo, int userID)
{
Audit audit = new Audit();
DynamicParameters parameters = new();
//isITAR = 2;
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", value: auditNo);
parameters.Add("@UserID", userID);
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure)) {
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
using (var multipleResultItems = this.db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure))
{
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
List<int> auditors = multipleResultItems.Read<int>().ToList();
var auditors = multipleResultItems.Read<int>().ToList();
if (audit != null && auditors != null) {
if (audit != null && auditors != null)
{
if (auditors.Count > 0)
audit.AuditorIDs.AddRange(auditors);
}
List<int> auditorTypes = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorTypes != null) {
var auditorTypes = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorTypes != null)
{
if (auditorTypes.Count > 0)
audit.AuditTypeIDs.AddRange(auditorTypes);
}
List<int> auditorAreas = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorAreas != null) {
var auditorAreas = multipleResultItems.Read<int>().ToList();
if (audit != null && auditorAreas != null)
{
if (auditorAreas.Count > 0)
audit.AuditedAreaIDs.AddRange(auditorAreas);
}
@ -105,165 +152,290 @@ public class AuditDMO {
return audit;
}
public IEnumerable<AuditType> GetAuditTypeList() {
DynamicParameters parameters = new();
List<AuditType> auditTypeList = db.Query<AuditType>("_8DGetAuditTypeList", parameters, commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<AuditType> GetAuditTypeList()
{
var parameters = new DynamicParameters();
var auditTypeList = this.db.Query<AuditType>("_8DGetAuditTypeList", parameters, commandType: CommandType.StoredProcedure).ToList();
return auditTypeList;
}
#if !NET8
public IEnumerable<C_8DAuditedStandard> GetAuditStandardList() {
public IEnumerable<C_8DAuditedStandard> GetAuditStandardList()
{
FabApprovalSystemEntitiesAll db = new FabApprovalSystemEntitiesAll();
var auditStandardList = from a in db.C_8DAuditedStandard select a;
return auditStandardList;
}
#endif
public IEnumerable<Auditor> GetAuditorList() {
DynamicParameters parameters = new();
List<Auditor> auditorList = db.Query<Auditor>("_8DGetAuditorList", parameters, commandType: CommandType.StoredProcedure).ToList();
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<Auditor> GetAuditorList()
{
var parameters = new DynamicParameters();
var auditorList = this.db.Query<Auditor>("_8DGetAuditorList", parameters, commandType: CommandType.StoredProcedure).ToList();
return auditorList;
}
public IEnumerable<AuditedArea> GetAuditAreaList() {
DynamicParameters parameters = new();
List<AuditedArea> auditAreaList = db.Query<AuditedArea>("_8DGetAuditAreaList", parameters, commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<AuditedArea> GetAuditAreaList()
{
var parameters = new DynamicParameters();
var auditAreaList = this.db.Query<AuditedArea>("_8DGetAuditAreaList", parameters, commandType: CommandType.StoredProcedure).ToList();
return auditAreaList;
}
public void UpdateAudit(Audit audit, int userID) {
int result = 0;
DynamicParameters parameters = new();
using (TransactionScope transaction = new()) {
try {
/// <summary>
///
/// </summary>
/// <param name="audit"></param>
public void UpdateAudit(Audit audit, int userID)
{
int result = 0;
var parameters = new DynamicParameters();
using(var transaction = new TransactionScope())
{
try
{
parameters.Add("AuditNo", audit.AuditNo);
parameters.Add("Title", audit.AuditTitle);
//parameters.Add("AuditTypeID", audit.AuditTypeID);
parameters.Add("AuditDate", audit.AuditDate);
parameters.Add("AuditStatus", audit.AuditStatus);
parameters.Add("AuditScore", audit.AuditScore);
//parameters.Add("AuditedAreaID", audit.AuditedAreaID);
parameters.Add("Auditees", audit.Auditees);
db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
db.Execute("_8DDeleteAuditors", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteAuditors", parameters, commandType: CommandType.StoredProcedure);
List<int> auditors = audit.AuditorIDs;
if (auditors != null) {
foreach (int auditorID in auditors) {
if (auditors != null)
{
foreach (int auditorID in auditors)
{
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
parameters.Add("@AuditorID", auditorID);
db.Execute("_8DInsertAuditor", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditor", parameters, commandType: CommandType.StoredProcedure);
}
}
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
db.Execute("_8DDeleteAuditTypes", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteAuditTypes", parameters, commandType: CommandType.StoredProcedure);
List<int> auditTypes = audit.AuditTypeIDs;
if (auditTypes != null) {
foreach (int auditTypeID in auditTypes) {
if (auditTypes != null)
{
foreach (int auditTypeID in auditTypes)
{
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
parameters.Add("@AuditTypeID", auditTypeID);
db.Execute("_8DInsertAuditType", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditType", parameters, commandType: CommandType.StoredProcedure);
}
}
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
db.Execute("_8DDeleteAuditedAreas", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteAuditedAreas", parameters, commandType: CommandType.StoredProcedure);
List<int> auditedAreas = audit.AuditedAreaIDs;
if (auditedAreas != null) {
foreach (int auditedAreaID in auditedAreas) {
if (auditedAreas != null)
{
foreach (int auditedAreaID in auditedAreas)
{
parameters = new DynamicParameters();
parameters.Add("@AuditNo", audit.AuditNo);
parameters.Add("@AuditedAreaID", auditedAreaID);
db.Execute("_8DInsertAuditedArea", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditedArea", parameters, commandType: CommandType.StoredProcedure);
}
}
transaction.Complete();
} catch (Exception ex) {
}
catch (Exception ex)
{
transaction.Dispose();
throw new Exception(ex.Message + " " + ex.InnerException);
}
}
//FabApprovalSystemEntitiesAll auditDb = new FabApprovalSystemEntitiesAll();
//List<int> auditedStandards = audit.AuditedStandardIDs;
//if (auditedStandards != null)
//{
// foreach (int auditedStandard in auditedStandards)
// {
// var auditStandardExists = (from a in auditDb.C_8DAuditedStandardByAudit where a.AuditNo == audit.AuditNo && a.AuditedStandardID == auditedStandard select a).ToList();
// if (auditStandardExists.Count() <= 0)
// {
// C_8DAuditedStandardByAudit standard = new C_8DAuditedStandardByAudit
// {
// AuditNo = audit.AuditNo,
// AuditedStandardID = auditedStandard
// };
// auditDb.C_8DAuditedStandardByAudit.Add(standard);
// auditDb.SaveChanges();
// }
// }
//}
//parameters = new DynamicParameters();
//parameters.Add("AuditNo", audit.AuditNo);
//this.db.Execute("_8DUpdateAuditScore", parameters, commandType: CommandType.StoredProcedure);
}
public IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <returns></returns>
public IEnumerable<AuditReportAttachment> GetAuditReportAttachments(int auditNo)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", auditNo);
List<AuditReportAttachment> data = db.Query<AuditReportAttachment>("_8DGetAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
var data = this.db.Query<AuditReportAttachment>("_8DGetAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
return data;
}
public IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <returns></returns>
public IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID)
{
var parameters = new DynamicParameters();
parameters.Add("@CAFindingsID", caFindingsID);
List<AuditReportAttachment> data = db.Query<AuditReportAttachment>("_8DGetCAFindingsItemAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
var data = this.db.Query<AuditReportAttachment>("_8DGetCAFindingsItemAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
return data;
}
public IEnumerable<CAUserList> GetUserList() {
DynamicParameters parameters = new();
List<CAUserList> userList = db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<CAUserList> GetUserList()
{
var parameters = new DynamicParameters();
var userList = this.db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
return userList;
}
public AuditFindings GetAuditFindingsByID(int auditFindingsID) {
DynamicParameters parameters = new();
public AuditFindings GetAuditFindingsByID(int auditFindingsID)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditFindingsID", auditFindingsID);
var data = db.Query<AuditFindings>("SELECT * FROM _8DAuditFinding WHERE ID = @AuditFindingsID", parameters).SingleOrDefault();
var data = this.db.Query<AuditFindings>("SELECT * FROM _8DAuditFinding WHERE ID = @AuditFindingsID", parameters).SingleOrDefault();
return data;
}
public IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID) {
DynamicParameters parameters = new();
public IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditFindingID", auditFindingsID);
List<int> data = db.Query<int>("SELECT CategoryID FROM _8DAuditFindingCategoryByAuditFinding WHERE AuditFindingID = @AuditFindingID", parameters).ToList();
var data = this.db.Query<int>("SELECT CategoryID FROM _8DAuditFindingCategoryByAuditFinding WHERE AuditFindingID = @AuditFindingID", parameters).ToList();
return data;
}
public IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <returns></returns>
public IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", auditNo);
List<AuditFindings> data = db.Query<AuditFindings>("_8DGetAuditFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
var data = this.db.Query<AuditFindings>("_8DGetAuditFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
return data;
}
public void DeleteAuditReportAttachment(int attachmentID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="attachmentID"></param>
public void DeleteAuditReportAttachment(int attachmentID)
{
var parameters = new DynamicParameters();
parameters.Add("@AttachmentID", attachmentID);
db.Execute("_8DDeleteAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure);
}
public void InsertAuditReportAttachment(AuditReportAttachment attach) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="attach"></param>
public void InsertAuditReportAttachment(AuditReportAttachment attach)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", attach.AuditNo);
parameters.Add("@CAFindingsID", attach.CAFindingsID);
parameters.Add("@UploadedByID", attach.UploadedByID);
parameters.Add("@FileName", attach.FileName);
parameters.Add("@FileGUID", attach.FileGUID);
db.Execute("_8DInsertAuditReportAttachment", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditReportAttachment", parameters, commandType: CommandType.StoredProcedure);
}
internal string GetAuditReportAttachmentFileName(string fileGUID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="fileGUID"></param>
/// <returns></returns>
internal string GetAuditReportAttachmentFileName(string fileGUID)
{
var parameters = new DynamicParameters();
parameters.Add("@FileGUID", fileGUID);
var fileName = db.Query<string>("_8DGetAuditReportAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
var fileName = this.db.Query<string>("_8DGetAuditReportAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
return fileName;
}
internal void InsertAuditFindingsItem(AuditFindings data) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="data"></param>
internal void InsertAuditFindingsItem(AuditFindings data)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", data.AuditNo);
parameters.Add("@Findings", data.Findings);
parameters.Add("@ViolatedClause", data.ViolatedClause);
@ -272,11 +444,18 @@ public class AuditDMO {
parameters.Add("@CANo", data.CANo);
parameters.Add("@Title", data.Title);
db.Execute("_8DInsertAuditFinding", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertAuditFinding", parameters, commandType: CommandType.StoredProcedure);
}
internal void UpdateAuditFindingsItem(AuditFindings data) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="data"></param>
internal void UpdateAuditFindingsItem(AuditFindings data)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditFindingsID", data.ID);
parameters.Add("@Findings", data.Findings);
parameters.Add("@ViolatedClause", data.ViolatedClause);
@ -285,53 +464,104 @@ public class AuditDMO {
parameters.Add("@CANo", data.CANo);
parameters.Add("@Title", data.Title);
db.Execute("_8DUpdateAuditFinding", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DUpdateAuditFinding", parameters, commandType: CommandType.StoredProcedure);
}
internal void DeleteAuditFindingsItem(int auditFindingsID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="auditFindingsID"></param>
internal void DeleteAuditFindingsItem(int auditFindingsID )
{
var parameters = new DynamicParameters();
parameters.Add("@AuditFindingsID", auditFindingsID);
db.Execute("_8DDeleteAuditFinding", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteAuditFinding", parameters, commandType: CommandType.StoredProcedure);
}
internal List<AuditFindingCategory> GetAuditFindingCategories() {
DynamicParameters parameters = new();
return db.Query<AuditFindingCategory>("_8DGetAuditFindingCategories", commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
internal List<AuditFindingCategory> GetAuditFindingCategories()
{
var parameters = new DynamicParameters();
return this.db.Query<AuditFindingCategory>("_8DGetAuditFindingCategories", commandType: CommandType.StoredProcedure).ToList();
}
public void ReleaseLockOnDocument(int userID, int issueID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <param name="issueID"></param>
public void ReleaseLockOnDocument(int userID, int issueID)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", issueID);
parameters.Add("@UserID", userID);
db.Execute("_8DReleaseLockOnAuditDocuments", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DReleaseLockOnAuditDocuments", parameters, commandType: CommandType.StoredProcedure);
}
public IEnumerable<CANoList> GetCorrectiveActionNoList() {
DynamicParameters parameters = new();
List<CANoList> dataList = db.Query<CANoList>("_8DGetCorrectiveActionNoList", parameters, commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<CANoList> GetCorrectiveActionNoList()
{
var parameters = new DynamicParameters();
var dataList = this.db.Query<CANoList>("_8DGetCorrectiveActionNoList", parameters, commandType: CommandType.StoredProcedure).ToList();
return dataList;
}
public List<int> Get8DQA() {
List<int> users = new();
DynamicParameters parameters = new();
users = db.Query<int>("_8DGet8DQA", parameters, commandType: CommandType.StoredProcedure).ToList();
/// <summary>
///
/// </summary>
/// <param name="subRoleCategoryID"></param>
/// <returns></returns>
public List<int> Get8DQA()
{
List<int> users = new List<int>();
var parameters = new DynamicParameters();
users = this.db.Query<int>("_8DGet8DQA", parameters, commandType: CommandType.StoredProcedure).ToList();
return users;
}
public int GetOpenCACountByAuditNo(int auditNo) {
int rowCount = 0;
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="auditNo"></param>
/// <returns></returns>
public int GetOpenCACountByAuditNo(int auditNo)
{
int rowCount = 0 ;
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", auditNo);
rowCount = db.Query<int>("_8DGetOpenCACountByAuditNo", parameters, commandType: CommandType.StoredProcedure).Single();
rowCount = this.db.Query<int>("_8DGetOpenCACountByAuditNo", parameters, commandType: CommandType.StoredProcedure).Single();
return rowCount;
}
// CA Findings ====================================================================================================================================
public void InsertCAFindings(CAFindings model) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="model"></param>
public void InsertCAFindings(CAFindings model)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", model.AuditNo);
parameters.Add("@CAFinding", model.CAFinding);
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
@ -340,11 +570,18 @@ public class AuditDMO {
parameters.Add("@ECD", model.ECD);
parameters.Add("@ImplementedDate", model.ImplementedDate);
db.Execute("_8DInsertCAFindings", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DInsertCAFindings", parameters, commandType: CommandType.StoredProcedure);
}
public void UpdateCAFindings(CAFindings model) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="model"></param>
public void UpdateCAFindings(CAFindings model)
{
var parameters = new DynamicParameters();
parameters.Add("@CAFindingsID", model.ID);
parameters.Add("@CAFinding", model.CAFinding);
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
@ -353,154 +590,70 @@ public class AuditDMO {
parameters.Add("@ECD", model.ECD);
parameters.Add("@ImplementedDate", model.ImplementedDate);
db.Execute("_8DUpdateCAFindings", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DUpdateCAFindings", parameters, commandType: CommandType.StoredProcedure);
}
public void DeleteCAFindingsItem(int caFindingsID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="caFindingsID"></param>
public void DeleteCAFindingsItem(int caFindingsID)
{
var parameters = new DynamicParameters();
parameters.Add("@CAFindingsID", caFindingsID);
db.Execute("_8DDeleteCAFindingsItem", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DDeleteCAFindingsItem", parameters, commandType: CommandType.StoredProcedure);
}
public CAFindings GetCAFindingsItem(int caFindingsID) {
CAFindings model = new();
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="caFindingsID"></param>
/// <returns></returns>
public CAFindings GetCAFindingsItem(int caFindingsID)
{
var model = new CAFindings();
var parameters = new DynamicParameters();
parameters.Add("@CAFindingsID", caFindingsID);
var data = db.Query<CAFindings>("_8DGetCAFindings", parameters, commandType: CommandType.StoredProcedure).Single();
var data = this.db.Query<CAFindings>("_8DGetCAFindings", parameters, commandType: CommandType.StoredProcedure).Single();
return data;
}
public IEnumerable<CAFindings> GetCAFindingsList(int auditNo) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="caNo"></param>
/// <returns></returns>
public IEnumerable<CAFindings> GetCAFindingsList(int auditNo)
{
var parameters = new DynamicParameters();
parameters.Add("@AuditNo", auditNo);
List<CAFindings> dataList = db.Query<CAFindings>("_8DGetCAFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
var dataList = this.db.Query<CAFindings>("_8DGetCAFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
return dataList;
}
public int IsCAAssignedToAudit(int CANo, int auditNo) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="CANo"></param>
/// <returns></returns>
public int IsCAAssignedToAudit(int CANo, int auditNo)
{
var parameters = new DynamicParameters();
int returnValue = 1;
parameters.Add("@CANo", CANo);
parameters.Add("@AuditNo", auditNo);
parameters.Add("@IsCAAssignedToAudit", returnValue, direction: ParameterDirection.Output);
db.Execute("_8DIsCAAssignedtoAudit", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("_8DIsCAAssignedtoAudit", parameters, commandType: CommandType.StoredProcedure);
returnValue = parameters.Get<int>("IsCAAssignedToAudit");
return returnValue;
}
public AuditEdit GetAuditEdit(int issueID, Audit audit, bool isAdmin, int userId) {
AuditEdit result = new();
List<int> userList = Get8DQA();
result.MesaUsers = UserUtilities.GetMesaUsers();
int QAs = userList.Find(delegate (int al) { return al == userId; });
result.Is8DQA = "false";
if (QAs != 0) {
result.Is8DQA = "true";
}
// transform audit users from string to list, delimited by a comma.
if (audit.Auditees == null) {
result.AuditeeNames = new List<string>();
} else {
string[] auditeeNames = audit.Auditees.Split(',');
result.AuditeeNames = auditeeNames.ToList();
}
result.IsSubmitter = false;
if (audit.OriginatorID == userId) {
result.IsSubmitter = true;
}
if (!isAdmin) {
result.IsAdmin = false;
} else {
result.IsAdmin = true;
}
if ((audit.RecordLockIndicator && audit.RecordLockedBy != userId)
|| audit.AuditStatus != 0) // open
{
result.RedirectToAction = true;
}
if (!result.IsAdmin && !result.IsSubmitter) {
result.RedirectToAction = true;
} else {
result.UserList = GetUserList();
result.AuditTypeList = GetAuditTypeList();
// result.AuditStandardList = GetAuditStandardList();
result.AuditorList = GetAuditorList();
result.AuditAreaList = GetAuditAreaList();
result.AuditFindingCategoryList = GetAuditFindingCategories();
result.CANoList = GetCorrectiveActionNoList();
}
return result;
}
public Audit InsertAndGetAudit(CorrectiveActionDMO caDMO, AuditFindings data, int userID) {
Audit audit = new();
InsertAuditFindingsItem(data);
audit = GetAuditItem(data.AuditNo, userID);
// Transfer Finding Details to CA
if (data.CANo != 0) {
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, userID);
ca.CATitle = data.Title;
ca.CASourceID = 1; // Audit
caDMO.UpdateCorrectiveAction(ca);
}
return audit;
}
public Audit UpdateAndGetAudit(CorrectiveActionDMO caDMO, AuditFindings data, int userID) {
Audit audit = new();
UpdateAuditFindingsItem(data);
audit = GetAuditItem(data.AuditNo, userID);
// Transfer Finding Details to CA
if (data.CANo != 0) {
CorrectiveAction ca = caDMO.GetCAItem(data.CANo, userID);
ca.CATitle = data.Title;
ca.CASourceID = 1; // Audit
caDMO.UpdateCorrectiveAction(ca);
}
return audit;
}
public Audit DeleteAndGetAudit(int auditFindingsID, int userID) {
var af = GetAuditFindingsByID(auditFindingsID);
DeleteAuditFindingsItem(auditFindingsID);
var audit = GetAuditItem(af.AuditNo, userID);
return audit;
}
public string NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string emailTemplatesPath) {
string emailSentList = "";
string email = MiscDMO.GetEmail(responsibleOwnerID);
string emailTemplate = "CorrectiveActionFindingAssigned.txt";
string userEmail = string.Empty;
string subject = "5s/CA Findings";
string senderName = "CorrectiveAction";
EmailNotification en = new(_AppSettings, subject, emailTemplatesPath);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnAuditNoStringFormat(issueID);
if (dueDate is null)
emailparams[1] = string.Empty;
else
emailparams[1] = dueDate.Value.ToString();
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.Audit);
emailparams[3] = GlobalVars.hostURL;
emailparams[4] = issueID.ToString();
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
return email;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Dapper;
using System.Configuration;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
/// <summary>
///
/// </summary>
public static class ECNTypeChangeLogDMO
{
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public static class ECNTypeChangeLogDMO {
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
/// <summary>
///
/// </summary>
/// <param name="changeLog"></param>
public static void Add(ECNTypeChangeLog changeLog)
{
public static void Add(ECNTypeChangeLog changeLog) {
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@ECNNumber", changeLog.ECNNumber);
parameters.Add("@UserID", changeLog.UserID);
parameters.Add("@ECNTypeFrom", changeLog.ECNTypeFrom);
@ -21,4 +34,8 @@ public static class ECNTypeChangeLogDMO {
db.Execute("ECNInsertECNTypeChangeLog", parameters, commandType: CommandType.StoredProcedure);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,18 +1,41 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using Dapper;
using Fab2ApprovalSystem.Misc;
using System.Linq;
using System.Text;
using System.Web;
using Fab2ApprovalSystem.Models;
using Dapper;
using System.Transactions;
using Fab2ApprovalSystem.ViewModels;
using System.Reflection;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public static class EventLogDMO {
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public static class EventLogDMO
{
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public static void Add(WinEventLog eventLog) {
DynamicParameters parameters = new();
//public static void Add(WinEventLog eventLog)
//{
// var parameters = new DynamicParameters();
// parameters.Add("@IssueID", eventLog.IssueID);
// parameters.Add("@UserID", eventLog.UserID);
// parameters.Add("@OperationType", eventLog.OperationType);
// parameters.Add("@Comments", eventLog.Comments);
// db.Execute("InsertEventLog", parameters, commandType: CommandType.StoredProcedure);
//}
public static void Add(WinEventLog eventLog)
{
var parameters = new DynamicParameters();
parameters.Add("@IssueID", eventLog.IssueID);
parameters.Add("@UserID", eventLog.UserID);
parameters.Add("@DocumentType", eventLog.DocumentType);
@ -20,6 +43,9 @@ public static class EventLogDMO {
parameters.Add("@Comments", eventLog.Comments);
db.Execute("InsertEventLogByDocument", parameters, commandType: CommandType.StoredProcedure);
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +1,61 @@
using Fab2ApprovalSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Dapper;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Configuration;
using System.Text;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public class MiscDMO
{
public class MiscDMO {
public static IEnumerable<Lot> SearchLots(string searchText, string searchBy) {
/// <summary>
///
/// </summary>
/// <param name="searchText"></param>
/// <returns></returns>
public static IEnumerable<Lot> SearchLots(string searchText, string searchBy)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
IEnumerable<Lot> lotList;
string sql = "";
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY")
{
if (searchBy == GlobalVars.LOT_NO)
//sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM WP_RECORD_MJ WHERE WP_LOT_NO LIKE '%" + searchText + "%' ";
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_LOT_NO LIKE '%" + searchText + "%' ";
else if (searchBy == GlobalVars.LOCATION) {
else if (searchBy == GlobalVars.LOCATION)
{
sql = "SELECT WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') AS LotNumber FROM SPNLot WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "' AND WP_LOT_NO + '/' + ISNULL(WP_LOT_NO,'') IS NOT NULL";
}
lotList = db.Query<Lot>(sql).ToList();
db.Close();
} else {
}
else
{
if (searchBy == GlobalVars.LOT_NO)
sql = "SELECT WP_LOT_NO + '/' + ISNULL(DieLotNumber,'') AS LotNumber FROM SPNLot WHERE WP_LOT_NO LIKE '%" + searchText + "%' OR DieLotNumber LIKE '%" + searchText + "%' ";
else if (searchBy == GlobalVars.LOCATION) {
else if (searchBy == GlobalVars.LOCATION)
{
sql = "SELECT WP_LOT_NO + '/' + ISNULL(DieLotNumber,'') AS LotNumber FROM SPNLot WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "' AND WP_LOT_NO + '/' + ISNULL(DieLotNumber,'') IS NOT NULL";
}
lotList = db.Query<Lot>(sql).ToList();
db.Close();
}
return lotList;
}
public static IEnumerable<int> GetUserIDsBySubRoleID(int subRoleID) {
public static IEnumerable<int> GetUserIDsBySubRoleID(int subRoleID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
IEnumerable<int> userList;
@ -52,47 +66,79 @@ public class MiscDMO {
return userList;
}
public static IEnumerable<Lot> SearchLTLots(string searchText, string searchBy) {
/// <summary>
///
/// </summary>
/// <param name="searchText"></param>
/// <param name="searchBy"></param>
/// <returns></returns>
public static IEnumerable<Lot> SearchLTLots(string searchText, string searchBy)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
string sql = "";
if (searchBy == GlobalVars.LOT_NO)
sql = "SELECT DISTINCT WP_LOT_NO AS LotNumber FROM vFAB2SPN_WP_RECORD WP WHERE WP_LOT_NO LIKE '%" + searchText.Trim() + "%' ";
else if (searchBy == GlobalVars.LOCATION) {
else if (searchBy == GlobalVars.LOCATION)
{
sql = "SELECT DISTINCT WP_LOT_NO AS LotNumber FROM vFAB2SPN_WP_RECORD WP WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "'";
}
List<Lot> lotList = db.Query<Lot>(sql).ToList();
var lotList = db.Query<Lot>(sql).ToList();
db.Close();
return lotList;
}
public static IEnumerable<WIPPart> SearchLTParts(string searchText) {
/// <summary>
///
/// </summary>
/// <param name="searchText"></param>
/// <returns></returns>
public static IEnumerable<WIPPart> SearchLTParts(string searchText)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
StringBuilder sql = new();
StringBuilder sql = new StringBuilder();
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
sql.Append("FROM vWIPPartData WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber");
List<WIPPart> parList = db.Query<WIPPart>(sql.ToString()).ToList();
//StringBuilder sql = new StringBuilder();
//sql.Append("SELECT TO_PART AS PartNumber, FROM_PART AS SiliconPart, P.MP_DESCRIPTION AS PartDescirption, ");
//sql.Append("RTRIM(LTRIM(SUBSTRING(TO_PART_PROC, PATINDEX('% %', TO_PART_PROC), LEN(TO_PART_PROC)))) AS ProcessFlow ");
//sql.Append("FROM TEMIRWAP019.FAB2SPN.dbo.PG_RECORD W ");
//sql.Append("INNER JOIN TEMIRWAP019.Fab2SPN.dbo.MP_RECORD P ON W.TO_PART = P.MP_PART_NUMBER ");
//sql.Append("WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber ");
var parList = db.Query<WIPPart>(sql.ToString()).ToList();
db.Close();
return parList;
}
public static void GetLotInformation(Lot lot) {
/// <summary>
///
/// </summary>
/// <param name="lot"></param>
public static void GetLotInformation(Lot lot)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
StringBuilder qryLotInfo = new();
StringBuilder qryLotInfo = new StringBuilder();
qryLotInfo.Append("SELECT WP_STATUS , WP_LOT_NO, WP_PART_NUMBER, MP_PRODUCT_FAMILY, MP_DESCRIPTION, ");
qryLotInfo.Append("WP_CURRENT_QTY, WP_CURRENT_LOCATION, DieLotNumber, DiePartNo, DieCount, MP_QUALITY_CODE FROM SPNLot ");
qryLotInfo.Append("WHERE WP_Lot_No = @LotNumber ");
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
var tempLotNumber = "";
if (lot.LotNumber.IndexOf('/') >= 0) {
if (lot.LotNumber.IndexOf('/') >= 0)
{
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
} else
}
else
tempLotNumber = lot.LotNumber;
lot.LotNumber = tempLotNumber;
List<dynamic> lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
foreach (dynamic lotInfoColumn in lotInfoRow) {
var lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
foreach (dynamic lotInfoColumn in lotInfoRow)
{
lot.LotNumber = lotInfoColumn.WP_LOT_NO;
if (lot.DieLotNumber == null || lot.DieLotNumber == "")
lot.DieLotNumber = lotInfoColumn.DieLotNumber;
@ -100,36 +146,48 @@ public class MiscDMO {
if (lotInfoColumn.WP_PART_NUMBER != null)
lot.WipPartNo = lotInfoColumn.WP_PART_NUMBER.Trim();
if (lotInfoColumn.WP_CURRENT_LOCATION != null) {
if (lotInfoColumn.WP_CURRENT_LOCATION != null)
{
// The data is returned from a view which is a combination from various sources and at times when the
// Lot is at the QDB location, which is extracted out of SAP, it also shows up at the 6600 location in SPN.
// There is a duplication.
// if the result returns 2 records , QDB overrides the other location (6600)
//if the result returns 2 records , QDB overrides the other location (6600)
if (lot.Location == "QDB" && lotInfoColumn.WP_CURRENT_LOCATION == "6600")
lot.Location = "QDB";
else
lot.Location = lotInfoColumn.WP_CURRENT_LOCATION;
}
if (lotInfoColumn.MP_DESCRIPTION != null) {
lot.Description = lotInfoColumn.MP_DESCRIPTION;
if (lot.Description.Length > 0) {
string[] temp = lot.Description.Split(new char[] { ',' });
if (temp.Length > 0) {
try {
lot.ProductFamily = temp[0];
} catch { } // ignore the error
try {
if (lotInfoColumn.MP_DESCRIPTION != null)
{
lot.Description = lotInfoColumn.MP_DESCRIPTION;
if (lot.Description.Length > 0)
{
string[] temp = lot.Description.Split(new char[] { ',' });
if (temp.Length > 0)
{
try
{
lot.ProductFamily = temp[0];
}
catch { } // ignore the error
try
{
//lot.Gen = double.Parse(temp[2].Substring(1, temp[2].Length - 1));
if (lot.Description.StartsWith("MA,"))
lot.Gen = temp[2];
else
lot.Gen = temp[2].Substring(1, temp[2].Length - 1);
} catch { }// ignore the error
try {
// lot.Hexsize = double.Parse(temp[6]);
}
catch { }// ignore the error
try
{
//lot.Hexsize = double.Parse(temp[6]);
lot.Hexsize = temp[6];
} catch { }// ignore the error
}
catch { }// ignore the error
}
}
@ -138,24 +196,30 @@ public class MiscDMO {
if (lotInfoColumn.WP_STATUS != null)
lot.Status = lotInfoColumn.WP_STATUS;
if (lotInfoColumn.DiePartNo != null)
lot.DiePartNo = lotInfoColumn.DiePartNo.Trim();
if (lotInfoColumn.WP_CURRENT_QTY != null)
lot.WaferCount = lotInfoColumn.WP_CURRENT_QTY;
if (lot.WipPartNo.Length > 0 || lot.DiePartNo.Length > 0) {
if (lot.WipPartNo.Length > 0 || lot.DiePartNo.Length > 0)
{
qryLotInfo.Clear();
qryLotInfo.Append("SELECT DiePartNo, SourceFAB, Diameter, Silicon, Gen, Layers,HexSize,Voltage,Channel, Type AS ProductFamily, ");
qryLotInfo.Append("WaferCost, DieCost FROM StdCost WHERE WIPWaferNo = @WIPPartNo OR DiePartNo = @DiePartNo ");
List<dynamic> moreLotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { WIPPartNo = lot.WipPartNo, DiePartNo = lot.DiePartNo }).ToList();
var moreLotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { WIPPartNo = lot.WipPartNo, DiePartNo = lot.DiePartNo }).ToList();
foreach (var moreLotInfoColumn in moreLotInfoRow) {
foreach (var moreLotInfoColumn in moreLotInfoRow)
{
if (lotInfoColumn.DieCount != null && lotInfoColumn.DieCount != 0)
lot.DieCount = int.Parse(lotInfoColumn.DieCount.ToString());
lot.DieCost = double.Parse(moreLotInfoColumn.DieCost.ToString());
lot.WaferCost = double.Parse(moreLotInfoColumn.WaferCost.ToString());
if (moreLotInfoColumn.Channel != null)
lot.Channel = moreLotInfoColumn.Channel;
@ -165,6 +229,7 @@ public class MiscDMO {
if (moreLotInfoColumn.Voltage != null)
lot.Voltage = moreLotInfoColumn.Voltage;
if (lot.DieCount > 0)
lot.TotalCost = Math.Round(lot.DieCount * lot.DieCost, 2);
else if (lot.WaferCount > 0)
@ -174,6 +239,8 @@ public class MiscDMO {
}
// added this code if the data shows up at the 6600 location and also at QDB for a lot.
//if (lot.DieCost > 0)
// lot.Location = "QDB";
if (lotInfoColumn.MP_QUALITY_CODE != null)
lot.QualityCode = lotInfoColumn.MP_QUALITY_CODE.Trim();
@ -181,12 +248,20 @@ public class MiscDMO {
}
db.Close();
//return lotStatusOption;
}
public static IEnumerable<UserProfile> GetUserList() {
/// <summary>
/// /
/// </summary>
/// <returns></returns>
public static IEnumerable<UserProfile> GetUserList()
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
StringBuilder sql = new();
StringBuilder sql = new StringBuilder();
sql.Append("SELECT FirstName + ' ' + LastName AS FullName, U.UserID AS UserId ");
sql.Append("FROM Users U ");
sql.Append("ORDER BY FirstName");
@ -194,32 +269,56 @@ public class MiscDMO {
return db.Query<UserProfile>(sql.ToString()).ToList();
}
public static List<string> GetApproverEmailListByDocument(int issueID, byte step, int documentType) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <param name="step"></param>
/// <param name="documentType"></param>
/// <returns></returns>
public static List<string> GetApproverEmailListByDocument(int issueID, byte step, int documentType)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@DocumentTypeID", documentType);
parameters.Add("@IssueID", issueID);
parameters.Add("@Step", step);
List<string> emailList = db.Query<string>("GetApproverEmailListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
var emailList = db.Query<string>("GetApproverEmailListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
return emailList;
}
public static List<ApproversListViewModel> GetApproversListByDocument(int issueID, byte step, int documentType) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <param name="step"></param>
/// <param name="documentType"></param>
/// <returns></returns>
public static List<ApproversListViewModel> GetApproversListByDocument(int issueID, byte step, int documentType)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@DocumentTypeID", documentType);
parameters.Add("@IssueID", issueID);
parameters.Add("@Step", step);
List<ApproversListViewModel> approverList = db.Query<ApproversListViewModel>("GetApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
var approverList = db.Query<ApproversListViewModel>("GetApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
return approverList;
}
public static IEnumerable<ApprovalModel> GetApprovalsByDocument(int issueID, int documentType) {
public static IEnumerable<ApprovalModel> GetApprovalsByDocument(int issueID, int documentType)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@DocumentTypeID", documentType);
parameters.Add("@IssueID", issueID);
var approvalList = db.Query<ApprovalModel>(
@ -230,81 +329,149 @@ public class MiscDMO {
/// <summary>
/// NOT IN USE YET
/// </summary>
public static IEnumerable<LoginModel> GetApprovedApproversListByDocument(int issueID, int currentStep, int documentType) {
/// <param name="issueID"></param>
/// <param name="currentStep"></param>
/// <param name="documentType"></param>
/// <returns></returns>
public static IEnumerable<LoginModel> GetApprovedApproversListByDocument(int issueID, int currentStep, int documentType)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
return db.Query<LoginModel>("GetApprovedApproversListByDocument", new { @DocumentTypeID = documentType, @IssueID = issueID, @Step = currentStep }, commandType: CommandType.StoredProcedure).ToList();
}
public static List<ApproversListViewModel> GetPendingApproversListByDocument(int issueID, byte step, int documentType) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <param name="step"></param>
/// <param name="documentType"></param>
/// <returns></returns>
public static List<ApproversListViewModel> GetPendingApproversListByDocument(int issueID, byte step, int documentType)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@DocumentTypeID", documentType);
parameters.Add("@IssueID", issueID);
parameters.Add("@Step", step);
List<ApproversListViewModel> approverList = db.Query<ApproversListViewModel>("GetPendingApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
var approverList = db.Query<ApproversListViewModel>("GetPendingApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
return approverList;
}
public static List<string> GetEmergencyTECNApprovalNotifyList(int ecnNumber) {
/// <summary>
///
/// </summary>
/// <param name="ecnNumber"></param>
/// <returns></returns>
public static List<string> GetEmergencyTECNApprovalNotifyList(int ecnNumber)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@ECNNumber", ecnNumber);
List<string> approverList = db.Query<string>("ECNGetETECNApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
var approverList = db.Query<string>("ECNGetETECNApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
return approverList;
}
public static List<string> GetTECNCancelledApprovalNotifyList(int ecnNumber) {
/// <summary>
///
/// </summary>
/// <param name="ecnNumber"></param>
/// <returns></returns>
public static List<string> GetTECNCancelledApprovalNotifyList(int ecnNumber)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@ECNNumber", ecnNumber);
List<string> approverList = db.Query<string>("ECN_TECNCancelledApprovalNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
var approverList = db.Query<string>("ECN_TECNCancelledApprovalNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
return approverList;
}
public static List<string> GetFabGroupNotifyList(int workRequestID) {
/// <summary>
///
/// </summary>
/// <param name="workRequestID"></param>
/// <returns></returns>
public static List<string> GetFabGroupNotifyList(int workRequestID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@WorkRequestID", workRequestID);
List<string> notifyList = db.Query<string>("LTFabGroupApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
var notifyList = db.Query<string>("LTFabGroupApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
return notifyList;
}
public static List<string> GetWorkRequestRevisionNotifyList(int notificationType, int workRequestID, int userID) {
/// <summary>
///
/// </summary>
/// <param name="workRequestID"></param>
/// <returns></returns>
public static List<string> GetWorkRequestRevisionNotifyList(int notificationType, int workRequestID, int userID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@NotificationType", notificationType);
parameters.Add("@UserID", userID);
parameters.Add("@WorkRequestID", workRequestID);
List<string> notifyList = db.Query<string>("LTGetWorkRequestRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
var notifyList = db.Query<string>("LTGetWorkRequestRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
return notifyList;
}
public static List<string> GetWorkRequestApprovedNotifyList(int notificationType, int workRequestID, int userID) {
/// <summary>
///
/// </summary>
/// <param name="notificationType"></param>
/// <param name="workRequestID"></param>
/// <param name="userID"></param>
/// <returns></returns>
public static List<string> GetWorkRequestApprovedNotifyList(int notificationType, int workRequestID, int userID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@NotificationType", notificationType);
parameters.Add("@UserID", userID);
parameters.Add("@WorkRequestID", workRequestID);
List<string> notifyList = db.Query<string>("LTGetWorkRequestApprovedNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
var notifyList = db.Query<string>("LTGetWorkRequestApprovedNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
return notifyList;
}
public static List<string> GetLotTravelerCreationAndRevisionNotifyList(int ltLotID, int workRequestID, int userID) {
/// <summary>
///
/// </summary>
/// <param name="notificationType"></param>
/// <param name="workRequestID"></param>
/// <param name="userID"></param>
/// <returns></returns>
public static List<string> GetLotTravelerCreationAndRevisionNotifyList(int ltLotID, int workRequestID, int userID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@LotID", ltLotID);
parameters.Add("@UserID", userID);
parameters.Add("@WorkRequestID", workRequestID);
List<string> notifyList = db.Query<string>("LTGetLotTravelerCreationAndRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
var notifyList = db.Query<string>("LTGetLotTravelerCreationAndRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
return notifyList;
}
public static int EnableOOOStatus(int oooUserID, int delegatedTo, DateTime startDate, DateTime endDate) {
/// <summary>
///
/// </summary>
/// <param name="oooUserID"></param>
/// <param name="delegatedTo"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
public static int EnableOOOStatus(int oooUserID, int delegatedTo, DateTime startDate, DateTime endDate)
{
int returnValue = 0;
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@OOOUserID", oooUserID);
parameters.Add("@DelegatedTo", delegatedTo);
parameters.Add("@OOOStartDate", startDate);
@ -316,32 +483,69 @@ public class MiscDMO {
returnValue = parameters.Get<int>("@ReturnValue");
return returnValue;
}
public static void ExpireOOOStatus(int oooUserID) {
/// <summary>
///
/// </summary>
/// <param name="oooUserID"></param>
/// <param name="delegatedTo"></param>
/// <param name="startDate"></param>
/// <param name="endDate"></param>
public static void ExpireOOOStatus(int oooUserID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@OOOUserID", oooUserID);
var approverList = db.Execute("ExpireOOOStatus", parameters, commandType: CommandType.StoredProcedure);
}
public static List<Department> GetDepartments() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public static List<Department> GetDepartments()
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
List<Department> departments = db.Query<Department>("GetDepartments", null, commandType: CommandType.StoredProcedure).ToList();
var departments = db.Query<Department>("GetDepartments", null, commandType: CommandType.StoredProcedure).ToList();
return departments;
}
public static List<AffectedModule> GetModules() {
/// <summary>
///
/// </summary>
/// <returns></returns>
public static List<AffectedModule> GetModules()
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
List<AffectedModule> modules = db.Query<AffectedModule>("GetModules", null, commandType: CommandType.StoredProcedure).ToList();
var modules = db.Query<AffectedModule>("GetModules", null, commandType: CommandType.StoredProcedure).ToList();
return modules;
}
public static void GetLTLotInformation(LTLot lot) {
/// <summary>
///
/// </summary>
/// <param name="lot"></param>
public static void GetLTLotInformation(LTLot lot)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
StringBuilder qryLotInfo = new();
StringBuilder qryLotInfo = new StringBuilder();
//qryLotInfo.Append("SELECT DISTINCT ");
//qryLotInfo.Append("WP_LOT_NO, WP_CURRENT_QTY, WP.WP_PART_NUMBER, MP_DESCRIPTION, WP_PROCESS, WO_LOCATION, WO_OPER_NO, WP_STATUS ");
//qryLotInfo.Append("FROM TEMIRWAP019.FAB2SPN.dbo.WO_RECORD WO ");
//qryLotInfo.Append("INNER JOIN TEMIRWAP019.FAB2SPN.dbo.WP_RECORD WP ");
//qryLotInfo.Append("ON WO.WO_LOT_NO = WP.WP_LOT_NO AND WO.InTime = (SELECT MAX(InTime) FROM TEMIRWAP019.FAB2SPN.dbo.WO_RECORD WHERE WO_LOT_NO = @LotNumber) ");
//qryLotInfo.Append("LEFT JOIN TEMIRWAP019.FAB2SPN.dbo.MP_RECORD MP ");
//qryLotInfo.Append("ON WP.WP_PART_NUMBER = MP.MP_PART_NUMBER ");
//qryLotInfo.Append("WHERE WO_LOT_NO = @LotNumber ");
qryLotInfo.Append("SELECT DISTINCT ");
qryLotInfo.Append("WP_LOT_NO, WP_CURRENT_QTY, WP.WP_PART_NUMBER, MP_DESCRIPTION, WP_PROCESS, WP_CURRENT_LOCATION, WP_OPER_NO, WP_STATUS ");
@ -350,17 +554,22 @@ public class MiscDMO {
qryLotInfo.Append("ON WP.WP_PART_NUMBER = MP.MP_PART_NUMBER ");
qryLotInfo.Append("WHERE WP_LOT_NO = @LotNumber ");
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
var tempLotNumber = "";
if (lot.LotNumber.IndexOf('/') >= 0) {
if (lot.LotNumber.IndexOf('/') >= 0)
{
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
} else
}
else
tempLotNumber = lot.LotNumber;
lot.LotNumber = tempLotNumber;
lot.LotNumber = tempLotNumber;
List<dynamic> lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
foreach (dynamic lotInfoColumn in lotInfoRow) {
var lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
foreach (dynamic lotInfoColumn in lotInfoRow)
{
lot.WIPPartNumber = lotInfoColumn.WP_PART_NUMBER;
lot.WaferQty = lotInfoColumn.WP_CURRENT_QTY;
lot.PartDescription = lotInfoColumn.MP_DESCRIPTION;
@ -372,45 +581,64 @@ public class MiscDMO {
}
public static string GetEmail(int? userID) {
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
public static string GetEmail(int? userID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
var email = db.Query<string>("GetEmail", parameters, commandType: CommandType.StoredProcedure).Single();
return email;
}
public static List<string> Get8DEmailListForClosureNotification(int issueID) {
/// <summary>
///
/// </summary>
/// <param name="issueID"></param>
/// <returns></returns>
public static List<string> Get8DEmailListForClosureNotification(int issueID)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@DocID", issueID);
List<string> emailList = db.Query<string>("_8DGetEmailListClosureNotification", parameters, commandType: CommandType.StoredProcedure).ToList();
var emailList = db.Query<string>("_8DGetEmailListClosureNotification", parameters, commandType: CommandType.StoredProcedure).ToList();
return emailList;
}
public static CredentialsStorage GetCredentialsInfo(string serverName, string credentialType) // TODO - need to use an enum for the credentialType
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@ServerName", serverName);
parameters.Add("@CredentialType", credentialType);
var data = db.Query<CredentialsStorage>("GetCredentialsInfo", param: parameters, commandType: CommandType.StoredProcedure).Single();
return data;
}
public List<ApproveListModel> GetApprovalReminderList() {
public List<ApproveListModel> GetApprovalReminderList()
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
List<ApproveListModel> approvals = db.Query<ApproveListModel>("GetApprovalForNotifcation", null, commandType: CommandType.StoredProcedure).ToList();
var approvals = db.Query<ApproveListModel>("GetApprovalForNotifcation", null, commandType: CommandType.StoredProcedure).ToList();
return approvals;
}
public void UpdateApprovalNotifyDate(int approvalId) {
public void UpdateApprovalNotifyDate(int approvalId)
{
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@ApprovalId", approvalId);
db.Query<CredentialsStorage>("UpdateApprovalLastNotifyDate", param: parameters, commandType: CommandType.StoredProcedure).Single();
//return data;
}
//================================================================== End of Class
}
}

View File

@ -1,54 +1,63 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using Dapper;
using Fab2ApprovalSystem.Misc;
using System.Web;
using Fab2ApprovalSystem.Models;
using Dapper;
using System.Transactions;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public class PartsRequestDMO
{
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public class PartsRequestDMO {
WorkflowDMO wfDMO = new WorkflowDMO();
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public IEnumerable<PartsRequestList> GetPartsRequestList() {
List<PartsRequestList> r = db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
public IEnumerable<PartsRequestList> GetPartsRequestList()
{
var r = this.db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
return r;
}
public void Insert(PartsRequest pr) {
DynamicParameters parameters = new();
public void Insert(PartsRequest pr)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", value: pr.PRNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
parameters.Add("@OriginatorID", pr.OriginatorID);
db.Execute("PartsRequestInsert", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestInsert", parameters, commandType: CommandType.StoredProcedure);
pr.PRNumber = parameters.Get<int>("@PRNumber");
}
public void Update(PartsRequest pr) {
DynamicParameters parameters = new();
public void Update(PartsRequest pr)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", pr.PRNumber);
parameters.Add("@Title", pr.Title);
parameters.Add("@RequestorID", pr.RequestorID);
parameters.Add("@TechLeadID", pr.TechLeadID);
parameters.Add("@Description", pr.Description);
db.Execute("PartsRequestUpdate", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestUpdate", parameters, commandType: CommandType.StoredProcedure);
}
public PartsRequest Get(int PRNumber) {
DynamicParameters parameters = new();
public PartsRequest Get(int PRNumber)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", value: PRNumber, dbType: DbType.Int32);
return db.Query<PartsRequest>("PartsRequestGet", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
return this.db.Query<PartsRequest>("PartsRequestGet", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
}
public IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber) {
List<PartsRequestAttachmentList> attachments = db.Query<PartsRequestAttachmentList>(
public IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber)
{
var attachments = this.db.Query<PartsRequestAttachmentList>(
"SELECT AttachmentID, PRNumber, FileName, A.UserID, UploadDate, U.FirstName + ' ' + U.LastName AS FullName " +
"FROM PartsRequestAttachment A " +
"INNER JOIN Users U ON U.UserID = A.UserID " +
@ -57,56 +66,64 @@ public class PartsRequestDMO {
return attachments;
}
public void InsertAttachment(PartsRequestAttachment attach) {
DynamicParameters parameters = new();
public void InsertAttachment(PartsRequestAttachment attach)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", attach.PRNumber);
parameters.Add("@UserID", attach.UserID);
parameters.Add("@FileName", attach.FileName);
db.Execute("PartsRequestInsertAttachment", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestInsertAttachment", parameters, commandType: CommandType.StoredProcedure);
}
public string GetFileName(string attachmentID) {
DynamicParameters parameters = new();
public string GetFileName(string attachmentID)
{
var parameters = new DynamicParameters();
parameters.Add("@AttachmentID", attachmentID);
var fileName = db.Query<string>("PartsRequestGetAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
var fileName = this.db.Query<string>("PartsRequestGetAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
return fileName;
}
public void DeleteAttachment(int attachmentID) {
DynamicParameters parameters = new();
public void DeleteAttachment(int attachmentID)
{
var parameters = new DynamicParameters();
parameters.Add("@AttachmentID", attachmentID);
db.Execute("PartsRequestDeleteAttachment", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestDeleteAttachment", parameters, commandType: CommandType.StoredProcedure);
}
public void Submit(int prNumber, int userID) {
DynamicParameters parameters = new();
public void Submit(int prNumber, int userID)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", prNumber);
parameters.Add("@UserID", userID);
db.Execute("PartsRequestSubmitForApproval", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestSubmitForApproval", parameters, commandType: CommandType.StoredProcedure );
}
public IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber) {
DynamicParameters parameters = new();
public IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber)
{
var parameters = new DynamicParameters();
parameters.Add("@PRNumber", prNumber);
List<ApprovalLogHistory> approverList = db.Query<ApprovalLogHistory>("PartsRequestGetApprovalLogHistory", parameters, commandType: CommandType.StoredProcedure).ToList();
var approverList = this.db.Query<ApprovalLogHistory>("PartsRequestGetApprovalLogHistory", parameters, commandType: CommandType.StoredProcedure).ToList();
return approverList;
}
public IEnumerable<MyPartsRequestList> GetMyPartsRequests(int userID) {
DynamicParameters parameters = new();
public IEnumerable<MyPartsRequestList> GetMyPartsRequests(int userID)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
IEnumerable<MyPartsRequestList> r = db.Query<MyPartsRequestList>("PartsRequestGetListByUser", parameters, commandType: CommandType.StoredProcedure);
var r = this.db.Query<MyPartsRequestList>("PartsRequestGetListByUser", parameters, commandType: CommandType.StoredProcedure);
return r.ToList();
}
public void DeleteDocument(int prNumber, int userid) {
DynamicParameters parameters = new();
public void DeleteDocument(int prNumber, int userid)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userid);
parameters.Add("@PRNumber", prNumber);
db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
}
}
}

View File

@ -1,19 +1,29 @@
using System.Configuration;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using Dapper;
using System.Text;
using Dapper;
namespace Fab2ApprovalSystem.DMO
{
public class SAM_DMO
{
private IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["SAMDBConnectionString"].ConnectionString);
namespace Fab2ApprovalSystem.DMO;
public class SAM_DMO {
private readonly IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["SAMDBConnectionString"].ConnectionString);
public int HasITARAccess(string userID)
{
StringBuilder query = new StringBuilder("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
//query.Append("WHERE UserID = @UserID AND AND EmployeeStatus = 'Active'");
return this.db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
public int HasITARAccess(string userID) {
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
return db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
}
}
}

View File

@ -1,147 +1,123 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using System.Text;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
public class TrainingDMO {
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
#if !NET8
namespace Fab2ApprovalSystem.DMO
{
public class TrainingDMO
{
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
#endif
public int Create(int issueId) {
DynamicParameters parameters = new();
public int Create(int issueId)
{
var parameters = new DynamicParameters();
parameters = new DynamicParameters();
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
parameters.Add("@ECNNumber", issueId);
db.Execute("InsertTrainingItem", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("InsertTrainingItem", parameters, commandType: CommandType.StoredProcedure);
int trainingId = parameters.Get<int>("@TrainingId");
return trainingId;
}
public int CreateAssignment(int trainingId, int userId)
{
var parameters = new DynamicParameters();
public int CreateAssignment(int trainingId, int userId) {
DynamicParameters parameters = new();
parameters = new DynamicParameters();
//parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
parameters.Add("@TrainingID", trainingId);
parameters.Add("@UserID", userId);
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
db.Execute("InsertTrainingAssignment", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("InsertTrainingAssignment", parameters, commandType: CommandType.StoredProcedure);
int assignmentId = parameters.Get<int>("@AssignmentID");
return assignmentId;
}
public IEnumerable<Training> GetAllTrainings() {
#if !NET8
public IEnumerable<Training> GetAllTrainings()
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
IEnumerable<Training> allTrainings = (from a in db.Trainings select a).ToList();
return allTrainings;
#else
throw new NotImplementedException();
#endif
}
public Training GetTraining(int trainingId) {
#if !NET8
public Training GetTraining(int trainingId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
Training trainingRecord = new Training();
trainingRecord = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
return trainingRecord;
#else
throw new NotImplementedException();
#endif
}
public TrainingAssignment GetAssignment(int assignmentId) {
#if !NET8
public TrainingAssignment GetAssignment(int assignmentId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
TrainingAssignment assignmentRecord = (from a in db.TrainingAssignments where a.ID == assignmentId select a).FirstOrDefault();
return assignmentRecord;
#else
throw new NotImplementedException();
#endif
}
public int GetTrainingId(int issueId) {
#if !NET8
public int GetTrainingId(int issueId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
int ECNId = issueId;
int trainingId = (from a in db.Trainings where a.ECN == ECNId select a.TrainingID).FirstOrDefault();
return trainingId;
#else
throw new NotImplementedException();
#endif
}
public List<int> GetTrainees(int groupId) {
#if !NET8
public List<int> GetTrainees(int groupId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var users = (from a in db.TrainingGroupMembers where a.TrainingGroupID == groupId select a.UserID).ToList();
return users;
#else
throw new NotImplementedException();
#endif
}
public bool isUserTrainingMember(int groupId, int userId) {
#if !NET8
public bool isUserTrainingMember(int groupId, int userId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var users = (from a in db.TrainingGroupMembers where a.TrainingGroupID == groupId && a.UserID == userId select a).FirstOrDefault();
if (users == null) {
if (users == null)
{
return false;
} else {
}
else
{
return true;
}
#else
throw new NotImplementedException();
#endif
}
public List<TrainingGroup> GetTrainingGroups() {
#if !NET8
}
public List<TrainingGroup> GetTrainingGroups()
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
return (from a in db.TrainingGroups select a).ToList();
#else
throw new NotImplementedException();
#endif
}
public TrainingGroup GetTrainingGroupByID(int groupId) {
#if !NET8
public TrainingGroup GetTrainingGroupByID(int groupId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
TrainingGroup groups = (from a in db.TrainingGroups where a.TrainingGroupID == groupId select a).FirstOrDefault();
return groups;
#else
throw new NotImplementedException();
#endif
}
public List<int> GetECNAssignedTrainingGroups(int ECNNumber) {
#if !NET8
public List<int> GetECNAssignedTrainingGroups(int ECNNumber)
{
List<int> trainingGroups = (from a in FabApprovalDB.ECNTrainingBies where a.ECNNumber == ECNNumber select a.AcknowledgementTrainingByID).ToList();
return trainingGroups;
#else
throw new NotImplementedException();
#endif
}
public void AddTrainingGroupToECN(int ECNNumber, int groupId) {
#if !NET8
public void AddTrainingGroupToECN(int ECNNumber, int groupId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
//ecnTraining.AcknowledgementTrainingByID = groupId;
//ecnTraining.ECNNumber = ECNNumber;
var parameters = new DynamicParameters();
parameters.Add("@ECNNumber", ECNNumber);
@ -149,372 +125,332 @@ public class TrainingDMO {
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
#else
throw new NotImplementedException();
#endif
}
public void SetTrainingFlag(int ECNNumber) {
#if !NET8
//db.ECNTrainingBies.Add(ecnTraining);
}
public void SetTrainingFlag(int ECNNumber)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
//ecnTraining.AcknowledgementTrainingByID = groupId;
//ecnTraining.ECNNumber = ECNNumber;
var parameters = new DynamicParameters();
parameters.Add("@ECNNumber", ECNNumber);
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
#else
throw new NotImplementedException();
#endif
}
public List<TrainingAssignment> GetAllTrainingAssignments(int TrainingID) {
#if !NET8
//db.ECNTrainingBies.Add(ecnTraining);
}
public List<TrainingAssignment> GetAllTrainingAssignments(int TrainingID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
RefreshTrainingData(TrainingID, TrainingData);
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
return TrainingData.ToList();
#else
throw new NotImplementedException();
#endif
}
public List<TrainingAssignment> GetTrainingAssignments(int TrainingID) {
#if !NET8
public List<TrainingAssignment> GetTrainingAssignments(int TrainingID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.Deleted != true select a;
RefreshTrainingData(TrainingID, TrainingData);
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
return TrainingData.ToList();
#else
throw new NotImplementedException();
#endif
}
public List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID) {
#if !NET8
public List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.UserID == userID select a;
return TrainingData.ToList();
#else
throw new NotImplementedException();
#endif
}
public List<TrainingDocAck> GetAssignedDocs(int trainingAssignmentId) {
#if !NET8
public List<TrainingDocAck> GetAssignedDocs(int trainingAssignmentId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var docs = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentId && a.Deleted != true select a).ToList();
return docs;
#else
throw new NotImplementedException();
#endif
}
public void AcknowledgeDocument(int trainingDocAckID)
{
var parameters = new DynamicParameters();
public void AcknowledgeDocument(int trainingDocAckID) {
DynamicParameters parameters = new();
parameters = new DynamicParameters();
parameters.Add("@TrainingDocAckID", trainingDocAckID);
//parameters.Add("@AttachmentID", attachmentID);
this.db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
}
public void UpdateAssignmentStatus(int trainingAssignmentID) {
#if !NET8
public void UpdateAssignmentStatus(int trainingAssignmentID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var RecordToUpdate = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a).SingleOrDefault();
if (RecordToUpdate.status != true) {
if(RecordToUpdate.status != true)
{
RecordToUpdate.DateCompleted = DateTime.Now;
RecordToUpdate.status = true;
try {
try
{
db.SaveChanges();
} catch (InvalidOperationException e) {
}
catch (InvalidOperationException e)
{
string exception = e.ToString();
Console.WriteLine(e);
}
}
#else
throw new NotImplementedException();
#endif
}
public int GetTrainingIdByAssignment(int trainingAssignmentID) {
#if !NET8
}
public int GetTrainingIdByAssignment(int trainingAssignmentID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
int trainingID = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a.TrainingID).SingleOrDefault();
return trainingID;
#else
throw new NotImplementedException();
#endif
}
public void UpdateTrainingStatus(int trainingId) {
#if !NET8
public void UpdateTrainingStatus(int trainingId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).SingleOrDefault();
if (training != null) {
if (training != null)
{
training.CompletedDate = DateTime.Now;
training.Status = true;
try {
try
{
db.SaveChanges();
} catch (InvalidOperationException e) {
}
catch (InvalidOperationException e)
{
string exception = e.ToString();
Console.WriteLine(e);
}
}
#else
throw new NotImplementedException();
#endif
}
public void reOpenTraining(int trainingId) {
#if !NET8
public void reOpenTraining(int trainingId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).SingleOrDefault();
if (training != null) {
if (training != null)
{
training.CompletedDate = null;
training.Status = false;
try {
try
{
db.SaveChanges();
} catch (InvalidOperationException e) {
}
catch (InvalidOperationException e)
{
string exception = e.ToString();
Console.WriteLine(e);
}
}
#else
throw new NotImplementedException();
#endif
}
public bool CheckTrainingStatus(int trainingAssignmentID) {
#if !NET8
public bool CheckTrainingStatus(int trainingAssignmentID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
bool isFinished = true;
int trainingID = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a.TrainingID).SingleOrDefault();
var trainingAssignments = from a in db.TrainingAssignments where a.TrainingID == trainingID && a.Deleted != true select a;
foreach (var training in trainingAssignments) {
if (training.status == false) {
foreach (var training in trainingAssignments)
{
if (training.status == false)
{
isFinished = false;
}
}
return isFinished;
#else
throw new NotImplementedException();
#endif
}
public bool CheckTrainingAssignmentStatus(int trainingAssignmentID) {
#if !NET8
public bool CheckTrainingAssignmentStatus(int trainingAssignmentID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
bool isFinished = true;
// TrainingDocAck docsAssigned = null;
//TrainingDocAck docsAssigned = null;
var docsAssigned = from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentID && a.Deleted != true select a;
foreach (var doc in docsAssigned) {
if (doc.Reviewed == false) {
foreach (var doc in docsAssigned)
{
if (doc.Reviewed == false)
{
isFinished = false;
}
}
return isFinished;
#else
throw new NotImplementedException();
#endif
}
public bool IsUserAssigned(int userId, int trainingId) {
#if !NET8
public bool IsUserAssigned(int userId, int trainingId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
bool userHasAssignment = false;
var assignments = (from a in db.TrainingAssignments where a.TrainingID == trainingId && a.UserID == userId && a.Deleted != true select a).ToList();
if (assignments.Count() > 0) {
if(assignments.Count() > 0)
{
userHasAssignment = true;
}
return userHasAssignment;
#else
throw new NotImplementedException();
#endif
}
public List<Training> GetTrainings() {
#if !NET8
public List<Training> GetTrainings()
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var trainings = from a in db.Trainings select a;
return trainings.ToList();
#else
throw new NotImplementedException();
#endif
}
public List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID) {
#if !NET8
public List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var trainingAssignments = from a in db.TrainingAssignments where a.UserID == userID && a.Deleted != true select a;
return trainingAssignments.ToList();
#else
throw new NotImplementedException();
#endif
}
public void DeleteTrainingAssignment(int trainingAssignmentId) {
#if !NET8
public void DeleteTrainingAssignment(int trainingAssignmentId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var trainingAssignments = from a in db.TrainingAssignments where a.ID == trainingAssignmentId select a;
foreach (var item in trainingAssignments) {
foreach (var item in trainingAssignments)
{
item.Deleted = true;
item.DeletedDate = DateTime.Now;
}
try {
try
{
db.SaveChanges();
} catch (InvalidOperationException e) {
}
catch (InvalidOperationException e)
{
string exception = e.ToString();
Console.WriteLine(e);
}
#else
throw new NotImplementedException();
#endif
}
public void DeleteTrainingDocAck(int trainingAssignmentId) {
#if !NET8
public void DeleteTrainingDocAck(int trainingAssignmentId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var trainingDocAcks = from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentId select a;
foreach (var item in trainingDocAcks) {
foreach (var item in trainingDocAcks)
{
item.Deleted = true;
item.DeletedDate = DateTime.Now;
}
try {
try
{
db.SaveChanges();
} catch (InvalidOperationException e) {
}
catch (InvalidOperationException e)
{
string exception = e.ToString();
Console.WriteLine(e);
}
#else
throw new NotImplementedException();
#endif
}
public void DeleteTraining(int trainingId) {
#if !NET8
public void DeleteTraining(int trainingId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
if (training != null) {
if (training != null)
{
training.Deleted = true;
training.DeletedDate = DateTime.Now;
}
List<TrainingAssignment> trainingAssignments = (from a in db.TrainingAssignments where a.TrainingID == trainingId select a).ToList();
db.SaveChanges();
foreach (TrainingAssignment trainingAssignment in trainingAssignments) {
foreach (TrainingAssignment trainingAssignment in trainingAssignments)
{
DeleteTrainingAssignment(trainingAssignment.ID);
DeleteTrainingDocAck(trainingAssignment.ID);
}
#else
throw new NotImplementedException();
#endif
//db.SaveChanges();
}
public void DeleteAssignmentByUserId(int userId) {
#if !NET8
}
public void DeleteAssignmentByUserId(int userId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
var userAssignments = (from a in db.TrainingAssignments where a.UserID == userId select a).ToList();
foreach (var item in userAssignments) {
// get document assignments
foreach (var item in userAssignments)
{
//get document assignments
var docAssignments = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == item.TrainingID select a).ToList();
// delete each docAssignment
foreach (var docAssignment in docAssignments) {
//delete each docAssignment
foreach (var docAssignment in docAssignments)
{
DeleteTrainingDocAck(docAssignment.ID);
}
DeleteTrainingAssignment(item.ID);
}
#else
throw new NotImplementedException();
#endif
}
public bool CheckValidDocAck(int docAckId) {
#if !NET8
public bool CheckValidDocAck(int docAckId)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
TrainingDocAck ack = (from a in db.TrainingDocAcks where a.ID == docAckId select a).FirstOrDefault();
// TODO Check the user is valid
//TODO Check the user is valid
// Check that the assignment exists
if (ack != null) {
// Check that the assignment isn't deleted
if (ack.Deleted == true) {
//Check that the assignment exists
if (ack != null)
{
//Check that the assignment isn't deleted
if (ack.Deleted == true)
{
return false;
}
// Check that the assignment isn't completed
else if (ack.Reviewed == true) {
//Check that the assignment isn't completed
else if (ack.Reviewed == true)
{
return false;
} else {
}
else
{
return true;
}
} else {
}
else
{
return false;
}
#else
throw new NotImplementedException();
#endif
}
public List<Training> GetAllOpenTrainings() {
#if !NET8
}
public List<Training> GetAllOpenTrainings()
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
List<Training> openTrainings = (from a in db.Trainings where a.Status != true && a.Deleted != true select a).ToList();
return openTrainings;
#else
throw new NotImplementedException();
#endif
}
public List<TrainingAssignment> GetOpenAssignmentsByTrainingID(int trainingID) {
#if !NET8
public List<TrainingAssignment> GetOpenAssignmentsByTrainingID(int trainingID)
{
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
List<TrainingAssignment> openAssignments = (from a in FabApprovalDB.TrainingAssignments where a.TrainingID == trainingID && a.status != true && a.Deleted != true select a).ToList();
return openAssignments;
#else
throw new NotImplementedException();
#endif
}
private void RefreshTrainingData(int TrainingID, IQueryable<TrainingAssignment> TrainingData) {
bool assignmentIsIncomplete = false;
UserAccountDMO userAccountDMO = new();
foreach (TrainingAssignment assignment in TrainingData) {
LoginModel userModel = userAccountDMO.GetUserByID(assignment.UserID);
if (!userModel.IsActive)
UpdateAssignmentStatus(assignment.ID);
if (assignment.Deleted != true && (assignment.DateCompleted is null || assignment.DateCompleted > DateTime.Now))
assignmentIsIncomplete = true;
}
if (!assignmentIsIncomplete)
UpdateTrainingStatus(TrainingID);
}
}

View File

@ -1,80 +1,134 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Web;
using Dapper;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
using System.Text;
using Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.DMO;
namespace Fab2ApprovalSystem.DMO
{
public class UserAccountDMO
{
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public class UserAccountDMO {
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
public IEnumerable<LoginModel> GetAllUsers() {
StringBuilder sql = new();
//public List<LoginModel> GetUser(string loginID)
//{
// StringBuilder sql = new StringBuilder();
// sql.Append("SELECT * FROM Users WHERE LoginID = '" + loginID + "'");
// return this.db.Query<LoginModel>(sql.ToString()).ToList();
//}
public IEnumerable<LoginModel> GetAllUsers()
{
StringBuilder sql = new StringBuilder();
//sql.Append("SELECT U.FirstName + ' ' + U.LastName AS FullName, U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName, U.* ");
//sql.Append("FROM Users U LEFT JOIN Users U1 ");
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
//sql.Append("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users ORDER BY FirstName ");
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
sql.Append("ORDER BY FirstName ");
return db.Query<LoginModel>(sql.ToString()).ToList();
return this.db.Query<LoginModel>(sql.ToString()).ToList();
}
public IEnumerable<LoginModel> GetAllActiveUsers()
{
StringBuilder sql = new StringBuilder();
//sql.Append("SELECT U.FirstName + ' ' + U.LastName AS FullName, U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName, U.* ");
//sql.Append("FROM Users U LEFT JOIN Users U1 ");
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
public IEnumerable<LoginModel> GetAllActiveUsers() {
StringBuilder sql = new();
//sql.Append("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users ORDER BY FirstName ");
sql.Append(" SELECT U.FirstName + ' ' + U.LastName AS FullName, U.* , U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName ");
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
sql.Append("WHERE U.IsActive = 1 ");
sql.Append("ORDER BY FirstName ");
return db.Query<LoginModel>(sql.ToString()).ToList();
return this.db.Query<LoginModel>(sql.ToString()).ToList();
}
public LoginModel GetUser(string loginID) =>
db.Query<LoginModel>("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE LoginID = @loginID AND IsActive = 1 ", new { loginID = loginID }).Take(1).SingleOrDefault();
public LoginModel GetUserByID(int userID) {
return db.Query<LoginModel>(
public LoginModel GetUser(string loginID)
{
//StringBuilder sql = new StringBuilder();
//sql.Append("SELECT * FROM Users WHERE LoginID = '" + loginID + "'");
//return this.db.Query<LoginModel>(sql.ToString()).SingleOrDefault();
return this.db.Query<LoginModel>("SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE LoginID = @loginID AND IsActive = 1 ", new { loginID = loginID }).Take(1).SingleOrDefault();
}
public LoginModel GetUserByID(int userID)
{
return this.db.Query<LoginModel>(
"SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE UserID = @UserID ",
new { UserID = userID }).Take(1).SingleOrDefault();
}
public string GetUserEmailByID(int userID) {
return db.Query<string>(
public string GetUserEmailByID(string userID)
{
return this.db.Query<string>(
"SELECT Email FROM Users WHERE UserID = @UserID ",
new { UserID = userID }).Take(1).SingleOrDefault();
}
internal void UpdateUser(LoginModel model) {
/// <summary>
///
/// </summary>
/// <param name="model"></param>
internal void UpdateUser(LoginModel model)
{
string sql;
sql = "UPDATE Users SET LoginID = @LoginID, FirstName = @FirstName, LastName = @LastName, Email = @Email, IsActive = @IsActive, IsAdmin = @IsAdmin WHERE UserID = @UserID";
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@UserID", model.UserID);
parameters.Add("@LoginID", model.LoginID);
parameters.Add("@FirstName", model.FirstName);
parameters.Add("@LastName", model.LastName);
parameters.Add("@LastName", model.LastName );
parameters.Add("@Email", model.Email);
parameters.Add("@IsAdmin", model.IsAdmin);
parameters.Add("@IsActive", model.IsActive);
db.Execute(sql, parameters);
this.db.Execute(sql, parameters);
}
internal void DeleteUser(LoginModel model) {
/// <summary>
///
/// </summary>
/// <param name="model"></param>
internal void DeleteUser(LoginModel model)
{
string sql;
//sql = "DELETE Users WHERE UserID = @UserID";
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
DynamicParameters parameters = new();
var parameters = new DynamicParameters();
parameters.Add("@UserID", model.UserID);
db.Execute(sql, parameters);
this.db.Execute(sql, parameters);
}
internal void InsertUser(LoginModel model) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="model"></param>
internal void InsertUser(LoginModel model)
{
//string sql;
//sql = "INSERT Users (LoginID, FirstName, LastName, IsAdmin) VALUES (@LoginID, @FirstName, @LastName, @IsAdmin )";
var parameters = new DynamicParameters();
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
parameters.Add("@LoginID", model.LoginID);
parameters.Add("@FirstName", model.FirstName);
@ -82,24 +136,39 @@ public class UserAccountDMO {
parameters.Add("@Email", model.Email);
parameters.Add("@IsAdmin", model.IsAdmin);
db.Execute("InsertUsers", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("InsertUsers", parameters, commandType: CommandType.StoredProcedure);
int userid = parameters.Get<int>("@UserID");
model.UserID = userid;
}
internal void UpdateInsertITARAccess(string userID, string hasITARAccess) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <param name="hasITARAccess"></param>
internal void UpdateInsertITARAccess(string userID, string hasITARAccess)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
parameters.Add("@HasITARAccess", hasITARAccess);
db.Execute("ITARAccessUpdateInsert", parameters, commandType: CommandType.StoredProcedure);
this.db.Execute("ITARAccessUpdateInsert", parameters, commandType: CommandType.StoredProcedure);
}
internal bool GetITARAccess(int userID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
internal bool GetITARAccess(int userID)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
var results = db.Query<string>(
var results = this.db.Query<string>(
"SELECT HasITARAccess FROM SAMUsers, Users WHERE Users.UserID = @UserID AND SAMUsers.UserID = Users.LoginID",
parameters, commandType: CommandType.Text);
if ((results != null) && (results.Count() > 0) && (results.First() == "1"))
@ -108,11 +177,17 @@ public class UserAccountDMO {
return false;
}
internal bool GetEC_AD_Users(string userID) {
DynamicParameters parameters = new();
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <returns></returns>
internal bool GetEC_AD_Users(string userID)
{
var parameters = new DynamicParameters();
parameters.Add("@UserID", userID);
var results = db.Query<string>(
var results = this.db.Query<string>(
"SELECT UserID FROM EC_AD_Users WHERE UserID = @UserID",
parameters, commandType: CommandType.Text);
if ((results != null) && (results.Count() > 0))
@ -121,13 +196,17 @@ public class UserAccountDMO {
return false;
}
internal void ProcessOoO() {
DynamicParameters parameters = new();
db.Execute("ProcesOOOEnableStatus", commandType: CommandType.StoredProcedure);
}
internal void ProcessOoO()
{
var parameters = new DynamicParameters();
this.db.Execute("ProcesOOOEnableStatus", commandType: CommandType.StoredProcedure);
internal void ExpireOoO() {
DynamicParameters parameters = new();
db.Execute("ProcesOOOExpiration", commandType: CommandType.StoredProcedure);
}
internal void ExpireOoO()
{
var parameters = new DynamicParameters();
this.db.Execute("ProcesOOOExpiration", commandType: CommandType.StoredProcedure);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -2,12 +2,10 @@
*****Please DO NOT reply to this email*****
<br/><br/>
{3}# {0} has been Cancelled. Please remove posted TECN from point of use. The cancellation date is {4}
Please review comments below and ensure process has been returned to normal.
Please review the cancelled 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/>

View File

@ -1,17 +0,0 @@
<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 comments below and ensure process has been returned to normal.
<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>

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,24 @@
using Fab2ApprovalSystem.Misc;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using System.Web.Security;
using System.Configuration;
using Fab2ApprovalSystem.DMO;
using System.Web.Http;
using Fab2ApprovalSystem.JobSchedules;
using Fab2ApprovalSystem.Misc;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem;
public class MvcApplication : System.Web.HttpApplication {
protected void Application_Start() {
namespace Fab2ApprovalSystem
{
public class MvcApplication : System.Web.HttpApplication
{
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
GlobalConfiguration.Configure(WebApiConfig.Register);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
@ -41,6 +40,8 @@ public class MvcApplication : System.Web.HttpApplication {
GlobalVars.WSR_URL = ConfigurationManager.AppSettings["WSR_URL"].ToString();
GlobalVars.CA_BlankFormsLocation = ConfigurationManager.AppSettings["CA_BlankFormsLocation"].ToString();
//GlobalVars.AttachmentUrl = connectionstring.ToUpper().Contains("TEST") ? @"http://" + DevAttachmentUrl + "/" : @"http://" + ProdAttachmentUrl + "/"; ;
#if (!DEBUG)
OOOTrainingReportJobSchedule.Start();
@ -56,73 +57,109 @@ public class MvcApplication : System.Web.HttpApplication {
GlobalVars.hostURL = @"https://" + DevWebSiteUrl;
#endif
GlobalVars.DBConnection = GlobalVars.DB_CONNECTION_STRING.ToUpper().Contains("TEST") ? "TEST" : GlobalVars.DB_CONNECTION_STRING.ToUpper().Contains("QUALITY") ? "QUALITY" : "PROD";
GlobalVars.AppSettings = Models.AppSettings.LoadConfigurationManager();
}
protected void Application_EndRequest() {
//void Application_BeginRequest(Object source, EventArgs e)
//{
// HttpApplication app = (HttpApplication)source;
// HttpContext context = app.Context;
// GlobalVars.hostURL = context.Request.Url.AbsoluteUri;
// // Attempt to peform first request initialization
//}
protected void Application_EndRequest()
{
var context = new HttpContextWrapper(Context);
// Do a direct 401 unauthorized
if (Context.Response.StatusCode == 301 && context.Request.IsAjaxRequest()) {
//Do a direct 401 unautorized
if (Context.Response.StatusCode == 301 && context.Request.IsAjaxRequest())
{
Context.Response.Clear();
Context.Response.StatusCode = 401;
} else if (FormsAuthentication.IsEnabled && context.Response.StatusCode == 302
&& context.Request.IsAjaxRequest()) {
}
else if (FormsAuthentication.IsEnabled && context.Response.StatusCode == 302
&& context.Request.IsAjaxRequest())
{
context.Response.Clear();
context.Response.StatusCode = 401;
}
}
protected void Session_Start(object sender, EventArgs e) {
Session[GlobalVars.ECN_VIEW_OPTION] = "Pending Approvals";
protected void Session_Start(object sender, EventArgs e)
{
Session[GlobalVars.ECN_VIEW_OPTION] = "Pending Approvals"; ;
}
protected void Session_End(object sender, EventArgs e) {
// FormsAuthentication.SignOut();
try {
protected void Session_End(object sender, EventArgs e)
{
//FormsAuthentication.SignOut();
try
{
Session[GlobalVars.SESSION_USERNAME] = "";
Session[GlobalVars.SESSION_USERID] = "";
Session[GlobalVars.IS_ADMIN] = null;
} catch (Exception ex) {
Functions.WriteEvent(null, @User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
Session[GlobalVars.IS_ADMIN] = "";
//LotTravelerDMO LotTravDMO = new LotTravelerDMO();
//LotTravDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], -1);
}
catch(Exception ex)
{
Functions.WriteEvent(@User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
}
}
// This code is to allow hyperlinks from Office products to load the site without always forcing the user to log in
// It makes the browser reload the page so that the session cookies are sent properly
private static string MSUserAgentsRegex = @"[^\w](Word|Excel|PowerPoint|ms-office)([^\w]|\z)";
protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e) {
if (System.Text.RegularExpressions.Regex.IsMatch(Request.UserAgent, MSUserAgentsRegex)) {
protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(Request.UserAgent, MSUserAgentsRegex))
{
Response.Write("<html><head><meta http-equiv='refresh' content='0'/></head><body></body></html>");
Response.End();
}
}
void Application_Error(object sender, EventArgs e) {
void Application_Error(object sender, EventArgs e)
{
var ex = Server.GetLastError();
var exString = "Caught unhandled exception:\r\n";
exString += String.Format("User: {0}\r\n", @User.Identity.Name);
Exception x = ex;
while (x != null) {
while (x != null)
{
exString += x.ToString();
exString += "=====\r\n";
x = x.InnerException;
}
try {
//Misc.Functions.WriteEvent(exString, System.Diagnostics.EventLogEntryType.Error);
try
{
if (exString.Length > 500)
exString = exString.Substring(0, 500);
EventLogDMO.Add(new Fab2ApprovalSystem.Models.WinEventLog() {
EventLogDMO.Add(new Fab2ApprovalSystem.Models.WinEventLog()
{
UserID = @User.Identity.Name,
OperationType = "Error",
Comments = exString
});
} catch (Exception ex2) {
Misc.Functions.WriteEvent(null, "Failed to write error to event log in database: " + ex2.ToString(), System.Diagnostics.EventLogEntryType.Error);
}
catch (Exception ex2)
{
Misc.Functions.WriteEvent("Failed to write error to event log in database: " + ex2.ToString(), System.Diagnostics.EventLogEntryType.Error);
}
}
}
}

View File

@ -1,13 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Fab2ApprovalSystem.Workers;
using Quartz;
using Quartz.Impl;
using Quartz;
namespace Fab2ApprovalSystem.JobSchedules;
public class OOOTrainingReportJobSchedule {
public static void Start() {
namespace Fab2ApprovalSystem.JobSchedules
{
public class OOOTrainingReportJobSchedule
{
public static void Start()
{
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
IScheduler scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();
@ -25,4 +29,5 @@ public class OOOTrainingReportJobSchedule {
scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger);
}
}
}

View File

@ -8,33 +8,38 @@ using Fab2ApprovalSystem.Utilities;
using Quartz;
namespace Fab2ApprovalSystem.Workers;
namespace Fab2ApprovalSystem.Workers
{
public class OOOTrainingReportJob:IJob
{
UserAccountDMO userDMO = new UserAccountDMO();
AdminDMO adminDMO = new AdminDMO();
TrainingDMO trainingDMO = new TrainingDMO();
ECN_DMO ecnDMO = new ECN_DMO();
public EmailUtilities emailer = new EmailUtilities();
public class OOOTrainingReportJob : IJob {
private readonly UserAccountDMO userDMO = new();
private readonly AdminDMO adminDMO = new();
private readonly TrainingDMO trainingDMO = new();
private readonly ECN_DMO ecnDMO = new();
async Task IJob.Execute(IJobExecutionContext context) {
async Task IJob.Execute(IJobExecutionContext context)
{
await Task.Run(() => {
string emailBody = "<h1>Mesa Approval Open Training Assignments Report - OOO</h1> <br />";
emailBody += "<p>The following contains open training assignments in the Mesa Approval system for out of office users.";
emailBody += " Please ensure they complete their training assignments promptly upon their return.</p><br />";
emailBody += "<style>table,th,td{border: 1px solid black;}</style>";
// Get all users set up to receive the training report email.
//Get all users set up to receive the training report email.
List<TrainingReportUser> trainingReportUsers = adminDMO.GetTrainingReportUsers();
List<string> emailList = new();
foreach (TrainingReportUser user in trainingReportUsers) {
List<string> emailList = new List<string>();
foreach (var user in trainingReportUsers)
{
string userEmail = userDMO.GetUserByID(user.UserId).Email;
emailList.Add(userEmail);
}
// emailList.Add("Chase.Tucker@infineon.com");
// Get a list of open trainings
//emailList.Add("Chase.Tucker@infineon.com");
//Get a list of open trainings
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
foreach (Training training in openTrainings) {
foreach (Training training in openTrainings)
{
string trainingSection = "";
int trainingSectionUserCount = 0;
string ecnTitle = ecnDMO.GetECN(training.ECN).Title;
@ -43,8 +48,11 @@ public class OOOTrainingReportJob : IJob {
trainingSection += "<table>";
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
foreach (TrainingAssignment assignment in openAssignments) {
if (userDMO.GetUserByID(assignment.UserID).OOO) {
foreach (TrainingAssignment assignment in openAssignments)
{
if (userDMO.GetUserByID(assignment.UserID).OOO)
{
trainingSectionUserCount++;
DateTime? assignmentDate = assignment.DateAssigned;
@ -57,12 +65,12 @@ public class OOOTrainingReportJob : IJob {
}
}
trainingSection += "</table>";
if (trainingSectionUserCount > 0)
emailBody += trainingSection;
if (trainingSectionUserCount > 0) emailBody += trainingSection;
}
string recipientEmail = "";
List<string> ccRecipients = emailList;
EmailUtilities.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Open Training Report - OOO", emailBody);
emailer.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Mesa Approval Open Training Report - OOO", emailBody, "Open Training Report - OOO");
});
}
}
}

View File

@ -1,88 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class AuditHelper {
public static List<string> GetFileNameAndDocument(AppSettings appSettings, AuditDMO auditDMO, string fileGuid, int auditNo) {
List<string> results = new();
string fileName = auditDMO.GetAuditReportAttachmentFileName(fileGuid);
string fileExtension = fileName.Substring(fileName.LastIndexOf("."), fileName.Length - fileName.LastIndexOf("."));
string ecnFolderPath = appSettings.AttachmentFolder + "Audit\\" + auditNo.ToString();
string sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
string FDir_AppData = appSettings.AttachmentFolder;
if (!sDocument.StartsWith(FDir_AppData)) {
sDocument = string.Empty;
}
results.Add(fileName);
results.Add(sDocument);
return results;
}
public static void AuditReportAttachSave(AppSettings appSettings, AuditDMO auditDMO, int auditNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"Audit\" + auditNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
AuditReportAttachment attach = new() {
AuditNo = auditNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId
};
auditDMO.InsertAuditReportAttachment(attach);
}
public static void SaveAndInsert(AppSettings appSettings, AuditDMO auditDMO, int caFindingsID, int auditNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"Audit\" + auditNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"Audit\" + auditNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
AuditReportAttachment attach = new() {
CAFindingsID = caFindingsID,
AuditNo = auditNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId
};
auditDMO.InsertAuditReportAttachment(attach);
}
}

View File

@ -1,96 +0,0 @@
using System;
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class ChangeControlHelper {
public static void AttachSaveCC(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CCAttachment attach = new() {
ID = attachID,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId
};
changeControlDMO.UpdateCCAttachmentDocument(attach);
}
public static void AttachSaveMeeting(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CCMeetingAttachment attach = new() {
ID = attachID,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId
};
changeControlDMO.UpdateMeetingAttachmentDocument(attach);
}
public static void AttachSaveActionItem(AppSettings appSettings, ChangeControlDMO changeControlDMO, int planNumber, int attachID, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"ChangeControl\" + planNumber;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"ChangeControl\" + planNumber + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CCMeetingActionItemAll attach = new() {
ID = attachID,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId
};
changeControlDMO.UpdateActionItemAttachment(attach);
}
}

View File

@ -1,464 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class CorrectiveActionHelper {
public static void ProcessCARDueDates(AppSettings appSettings, CAD3D5D7Due dueCA, CorrectiveAction ca, LoginModel user) {
string[] emailparams = new string[7];
string emailTemplate = "D3D5D7Due.txt";
string senderName = "CorrectiveAction";
string subject = "Corrective Action " + dueCA.ItemDue + " " + dueCA.ExpiryType + " - " + Functions.ReturnCANoStringFormat(dueCA.CANo);
emailparams[0] = Functions.ReturnCANoStringFormat(dueCA.CANo);
emailparams[1] = dueCA.CANo.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = dueCA.ExpiryType;
emailparams[4] = dueCA.ItemDue;
if (ca.D3DueDate != null) {
emailparams[5] = ca.D3DueDate is null ? string.Empty : ca.D3DueDate.Value.ToString();
} else {
emailparams[5] = "N/A";
}
if (ca.D5D7DueDate != null) {
emailparams[6] = ca.D5D7DueDate is null ? string.Empty : ca.D5D7DueDate.Value.ToString();
} else {
emailparams[6] = "N/A";
}
EmailNotification en = new(appSettings, subject);
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, user.Email, "jonathan.ouellette@infineon.com", subject, emailparams);
}
public static void NotifyUsersDSectionApproved(AppSettings appSettings, int issueID, string dSection, string userEmail) {
string senderName = "CorrectiveAction";
string emailTemplate = "CorrectiveActionSectionApproved.txt";
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = dSection;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void NotifyForD5D6D7Validation(AppSettings appSettings, int issueID, string dSection, string userEmail) {
string senderName = "CorrectiveAction";
string emailTemplate = "CorrectiveActionSectionApproved.txt";
string subject = "Corrective Action Section Approval - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = dSection;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void NotifySectionRejection(AppSettings appSettings, int issueID, int loggedInUserId, string section, string comment, LoginModel recipient, LoginModel loggedInUser) {
string senderName = "CorrectiveAction";
string recipientEmail = recipient.Email;
string emailTemplate = "CorrectiveActionSectionRejection.txt";
string subject = "Corrective Action Rejection - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[6];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = section;
emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName;
emailparams[5] = comment;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams);
}
public static void NotifySectionRejection(AppSettings appSettings, int issueID, string section, string comment, LoginModel recipient, LoginModel loggedInUser) {
string senderName = "CorrectiveAction";
string recipientEmail = recipient.Email;
string emailTemplate = "CorrectiveActionSectionRejection.txt";
string subject = "Corrective Action Rejection - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[6];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = section;
emailparams[4] = loggedInUser.FirstName + " " + loggedInUser.LastName;
emailparams[5] = comment;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, recipientEmail, null, subject, emailparams);
}
public static string NotifyCompletionOf8D(AppSettings appSettings, int issueID, DateTime? followUpDate) {
string emailSentList = "";
string senderName = "CorrectiveAction";
string emailTemplate = "CorrectiveActionCompleted.txt";
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
string subject = "Corrective Action Completion - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
foreach (string email in emailIst) {
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = GlobalVars.hostURL;
emailparams[2] = issueID.ToString();
emailparams[3] = followUpDate is null ? string.Empty : followUpDate.Value.ToString();
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyClosureOf8D(AppSettings appSettings, int issueID) {
string emailSentList = "";
string senderName = "CorrectiveAction";
string emailTemplate = "CorrectiveActionClosed.txt";
List<string> emailIst = MiscDMO.Get8DEmailListForClosureNotification(issueID);
string subject = "Corrective Action Follow Up Closure - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
foreach (string email in emailIst) {
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = GlobalVars.hostURL;
emailparams[2] = issueID.ToString();
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyActionItemCompletion(AppSettings appSettings, int issueID, DateTime? dueDate, int? recipientId, string template) {
string emailSentList = "";
string emailTemplate = template;
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string email = MiscDMO.GetEmail(recipientId);
string subject = "8D Action Item Completion - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
emailparams[3] = GlobalVars.hostURL;
emailparams[4] = issueID.ToString();
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
return email;
}
public static string NotifyActionItemOwner(AppSettings appSettings, int issueID, DateTime? dueDate, int? responsibleOwnerID, string template) {
string emailSentList = "";
string emailTemplate = template;
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string email = MiscDMO.GetEmail(responsibleOwnerID);
string subject = "Action Item in " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
emailparams[3] = GlobalVars.hostURL;
emailparams[4] = issueID.ToString();
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
return email;
}
public static void NotifyAssignee(AppSettings appSettings, int issueID, string template, DateTime? D3DueDate, DateTime? D5D7DueDate, string email) {
string emailSentList = "";
string emailTemplate = template;
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "CAR Assigned - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[6];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = issueID.ToString();
emailparams[4] = D3DueDate is not null ? D3DueDate.Value.ToString() : "N/A";
emailparams[5] = D5D7DueDate is not null ? D5D7DueDate.Value.ToString() : "N/A";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
}
public static void NotifyRequestor(AppSettings appSettings, int issueID, DateTime? dueDate, string template, string email) {
string emailSentList = "";
string emailTemplate = template;
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "Corrective Action Assignment - " + Functions.ReturnCANoStringFormat(issueID);
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = dueDate is null ? string.Empty : dueDate.Value.ToString();
emailparams[2] = Functions.DocumentTypeMapper(GlobalVars.DocumentType.CorrectiveAction);
emailparams[3] = GlobalVars.hostURL;
emailparams[4] = issueID.ToString();
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, email, null, subject, emailparams);
emailSentList += email + ",";
}
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string emailSentList, string emailArray) {
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string emailTemplate = "CorrectiveActionAssigned.txt";
string subject = "Corrective Action Assignment - Final Approval";
string[] emailIst = emailArray.Split(new char[] { '~' });
foreach (string email in emailIst) {
if (email.Length > 0) {
subject = "Corrective Action Assignment";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
}
return emailSentList;
}
public static string NotifyApprovers(AppSettings appSettings, int issueID, List<string> emailIst) {
string emailSentList = "";
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "Corrective Action Assignment";
string emailTemplate = "CorrectiveActionAssigned.txt";
foreach (string email in emailIst) {
subject = "Corrective Action Assignment - Final Approval";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static void NotifySectionApprover(AppSettings appSettings, int issueID, string section, string userEmail) {
string senderName = "CorrectiveAction";
string subject = "Corrective Action Assignment";
string emailTemplate = "CorrectiveActionSectionAssignee.txt";
subject = "Corrective Action Assignment - Section Approval";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = section;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static string NotifyRejectionToAssignee(AppSettings appSettings, int issueID, string comments, string username, List<string> emailIst) {
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "Corrective Action Rejection";
string emailTemplate = "CorrectiveActionReject.txt";
foreach (string email in emailIst) {
subject = "Corrective Action Rejection";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = username;
emailparams[4] = comments;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
return userEmail;
}
public static void ReAssignApproval(AppSettings appSettings, int issueID, string email) {
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "Corrective Action Re-Assignment";
string emailTemplate = "CorrectiveActionReAssigned.txt";
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string email) {
string userEmail = string.Empty;
string senderName = "CorrectiveAction";
string subject = "Corrective Action Re-Assignment";
string emailTemplate = "CorrectiveActionReAssigned.txt";
subject = "Corrective Action Re-Assignment" + " - Email would be sent to " + email;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = Functions.ReturnCANoStringFormat(issueID);
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void AttachSave(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int caNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CA_Attachment attach = new() {
CANo = caNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId,
Section = Functions.CASectionMapper(GlobalVars.CASection.Main)
};
correctiveActionDMO.InsertCAAttachment(attach);
}
public static void D4FilesAttachSave(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int caNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CA_Attachment attach = new() {
CANo = caNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId,
Section = Functions.CASectionMapper(GlobalVars.CASection.D4)
};
correctiveActionDMO.InsertCAAttachment(attach);
}
public static void SaveD7PA_Attachemnt(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int d7PAID, int caNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CA_Attachment attach = new() {
D7PAID = d7PAID,
CANo = caNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId,
Section = Functions.CASectionMapper(GlobalVars.CASection.D7)
};
correctiveActionDMO.InsertCAAttachment(attach);
}
public static void SaveD5D6CA_Attachemnt(AppSettings appSettings, CorrectiveActionDMO correctiveActionDMO, int d5d6CAID, int caNo, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var ccPhysicalPath = appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo;
di = new DirectoryInfo(ccPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"CorrectiveAction\" + caNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
CA_Attachment attach = new() {
D5D6CAID = d5d6CAID,
CANo = caNo,
FileGUID = guid,
FileName = fileName,
UploadedByID = userId,
Section = Functions.CASectionMapper(GlobalVars.CASection.D5)
};
correctiveActionDMO.InsertCAAttachment(attach);
}
}

View File

@ -1,32 +1,39 @@
using System.Collections.Generic;
using Fab2ApprovalSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class DemoHelper {
public static List<string> GetCountries() {
namespace Fab2ApprovalSystem.Misc
{
public class DemoHelper
{
public static List<string> GetCountries()
{
return new List<string>
{
"USA", "England", "Belguim", "France", "Italy"
};
}
public List<TestModel> ListOfModels = new();
public List<TestModel> ListOfModels = new List<TestModel>();
private static readonly DemoHelper m_dHelper = new();
public static DemoHelper Instance {
private static DemoHelper m_dHelper = new DemoHelper();
public static DemoHelper Instance
{
get { return m_dHelper; }
}
private DemoHelper() {
TestModel A1 = new();
private DemoHelper()
{
TestModel A1 = new TestModel();
A1.Name = "Eran";
A1.Countries = new List<string>();
A1.Countries.Add("England");
A1.Countries.Add("Belguim");
ListOfModels.Add(A1);
}
}
}

View File

@ -1,3 +1,168 @@
namespace Fab2ApprovalSystem.Misc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class Documentum { }
//using DFClib.DfException;
//using DFCLib.DfId;
//using DFCLib.IDfId;
//using DFCLib.IDfList;
//using DFCLib.IDfLoginInfo;
//using DFCLib.IDfClient;
//using DFCLib.IDfDocument;
//using DFCLib.IDfSession;
//using DFCLib.IDfSessionManager;
//using DFCLib.DfClientX;
//using DFCLib.IDfClientX;
//using DFCLib.IDfFile;
//using DFCLib.IDfImportNode;
//using DFCLib.IDfImportOperation;
namespace Fab2ApprovalSystem.Misc
{
public class Documentum
{
//public static void Process(string m_fileName)
//{
// String username = "rkotian1";
// String password = "";
// String repoName = "globaldocudms";
// String filename = m_fileName; // for example {"C:\\devprog\\ECN12345.zip"};
// String destFldrId = "0c00359980061536";
// try
// {
// DFCLib.IDfSessionManager sessMgr = createSessionManager();
// addIdentity(sessMgr, username, password, repoName);
// importFiles(sessMgr, repoName, filename, destFldrId);
// }
// catch (Exception ex)
// {
// //string s = ex.InnerException.ToString();
// }
//}
///**
// * Imports a single file in the repository
// *
// */
//private static void importFiles(DFCLib.IDfSessionManager sessMgr, String repoName, String filename, String destFldrId)
//{
// DFCLib.IDfSession sess = null;
// try
// {
// DFCLib.IDfClientX clientX = new DFCLib.DfClientX();
// DFCLib.IDfImportOperation impOper = clientX.getImportOperation();
// //DFCLib.IDfId destId = new DfId(destFldrId);
// DFCLib.IDfId destId = clientX.getId(destFldrId);
// //This will import all files to a single destination.
// //To import each file to a different destination
// //set call this method on the import node.
// //impOper.setDestinationFolderId(destId);
// DFCLib.IDfFile localFile = clientX.getFile(filename);
// DFCLib.IDfImportNode impNode = (DFCLib.IDfImportNode)impOper.add(localFile);
// //You can set different destination ids here for each import node
// //This way files get imported to different destinations.
// impNode.setDestinationFolderId(destId);
// //set custom object type. If not called dm_document is used.
// impNode.setDocbaseObjectType("dp_text");
// int randomName = ((int)(new Random().Next(int.MinValue, int.MaxValue) * 100));
// //set custom object name.
// impNode.setNewObjectName(localFile.getName() + "" + randomName.ToString());
// //The import operation determines the file format.
// //It is also possible to explicitly set the format.
// //impNode.setFormat("");
// sess = sessMgr.getSession(repoName);
// impOper.setSession(sess);
// if (impOper.execute())
// {
// Console.WriteLine("Import Operation Succeeded");
// DFCLib.IDfList newObjLst = impOper.getNewObjects();
// for (int i = 0; i < newObjLst.getCount(); i++)
// {
// DFCLib.IDfDocument newObj = (DFCLib.IDfDocument)newObjLst.get(i);
// //you can set any custom/standard attr values on the document now
// //newObj.setString("my_attr","someValue");
// //newObj.save();
// Console.WriteLine("Created Object: " + newObj.getObjectId());
// }
// }
// else
// {
// Console.WriteLine("Import Operation Failed");
// DFCLib.IDfList errList = impOper.getErrors();
// for (int i = 0; i < errList.getCount(); i++)
// {
// DFCLib.IDfOperationError err = (DFCLib.IDfOperationError)errList.get(i);
// Console.WriteLine(err.getMessage());
// }
// }
// }
// finally
// {
// if (sess != null)
// {
// sessMgr.release(sess);
// }
// }
//}
///**
// * Creates a new session manager instance. The session manager does not have
// * any identities associated with it.
// * @return a new session manager object.
//*/
//private static DFCLib.IDfSessionManager createSessionManager()
//{
// DFCLib.IDfClientX clientX = new DFCLib.DfClientX();
// DFCLib.IDfClient localClient = clientX.getLocalClient();
// DFCLib.IDfSessionManager sessMgr = localClient.newSessionManager();
// return sessMgr;
//}
///**
// * Adds a new identity to the session manager.
// *
// */
//private static void addIdentity(DFCLib.IDfSessionManager sm, String username,
// String password, String repoName)
//{
// DFCLib.IDfClientX clientX = new DFCLib.DfClientX();
// DFCLib.IDfLoginInfo li = clientX.getLoginInfo();
// li.setUser(username);
// li.setPassword(password);
// // check if session manager already has an identity.
// // if yes, remove it.
// if (sm.hasIdentity(repoName))
// {
// sm.clearIdentity(repoName);
// }
// sm.setIdentity(repoName, li);
//}
}
}

View File

@ -1,528 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
using Fab2ApprovalSystem.ViewModels;
namespace Fab2ApprovalSystem.Misc;
public class ECNHelper {
private const string ECN_PREFIX = "ECN_";
private const string TECN_PREFIX = "TECN_";
private const string ETECN_PREFIX = "ETECN_";
public static bool IsITAR(ECN ecn) {
if (ecn.IsRH && !ecn.IsAU && !ecn.IsIndustrial && !ecn.IsMA) {
return true;
} else
return false;
}
public static string NotifyEmergencyTECNApproval(AppSettings appSettings, int ecnNumber, DateTime? expDate, ECN ecn) {
string emailSentList = "";
string senderName = "E-TECN";
string userEmail = string.Empty;
string subject = "E-TECN Approved";
string emailTemplate = "ETECNApproved.txt";
List<string> emailIst = MiscDMO.GetEmergencyTECNApprovalNotifyList(ecnNumber).Distinct().ToList();
string ecnFolderPath = appSettings.AttachmentFolder + "E-TECNZipped\\" + ETECN_PREFIX + ecnNumber.ToString() + ".zip";
subject = "E-TECN Approved notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "E-TECN";
emailparams[4] = expDate is null ? string.Empty : expDate.Value.ToString();
if (IsITAR(ecn))
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
else
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
return emailSentList;
}
public static string NotifyApproversForCancellation(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, ECN ecn) {
string emailSentList = "";
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "TECNCancellationApproval.txt";
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
string subject = ecnTypeString + " Cancellation Approval Required - " + ecnNumber + " for " + ecn.Title + ", Cancellation initiated on :" + ecn.CancellationDate;
foreach (string email in emailIst) {
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyApproversForRecall(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, string recallComments, ECN ecn) {
string emailSentList = "";
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
emailIst.Add("Jeanne.McIntyre@infineon.com");
emailIst.Add("Jonathan.Ouellette@infineon.com");
string emailTemplate = "ECNRecallApproval.txt";
string userEmail = string.Empty;
string subject = ecnTypeString + " Recalled - " + ecnNumber + " for " + ecn.Title + ", Recall initiated on :" + DateTime.Now.ToString();
string senderName = ecnTypeString;
foreach (string email in emailIst) {
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
emailparams[4] = recallComments;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyApproversForExpiration(AppSettings appSettings, int ecnNumber, byte currentStep, int documentType, string ecnTypeString, ECN ecn) {
string emailSentList = "";
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "TECNExpirationApproval.txt";
List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
string subject = " TECN Expiration Approval Reqquired - " + ecnTypeString + "# " + ecnNumber + " for " + ecn.Title + ", Expired:" + ecn.ExpirationDate;
foreach (string email in emailIst) {
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
#if (DEBUG)
userEmail = GlobalVars.SENDER_EMAIL;
#endif
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyTECNCancellation(AppSettings appSettings, UserAccountDMO userDMO, int ecnNumber, string ecnFolderPath, string comments, ECN ecn, List<int> notificationUserList) {
string emailSentList = "";
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
foreach (int userId in notificationUserList) {
string email = userDMO.GetUserEmailByID(userId);
if (email != null && !emailIst.Contains(email))
emailIst.Add(email);
}
string subject;
string emailTemplate;
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);
string[] emailparams = new string[6];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "TECN";
emailparams[4] = DateTime.Now.ToString();
emailparams[5] = comments;
#if (DEBUG)
userEmail = GlobalVars.SENDER_EMAIL;
#endif
if (IsITAR(ecn))
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
else
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
return emailSentList;
}
public static string NotifyTECNAutoCancellation(AppSettings appSettings, int ecnNumber, int tecnNumber, List<string> attachments, ECN ecn) {
string emailSentList = "";
string senderName = "ECN";
string subject = string.Empty;
string userEmail = string.Empty;
string emailTemplate = "TECNAutoCancelled.txt";
List<string> emailIst = MiscDMO.GetTECNCancelledApprovalNotifyList(ecnNumber).Distinct().ToList();
subject = "TECN Conversion and Cancellation Notice - " + tecnNumber + " for " + ecn.Title + ", Converted on:" + DateTime.Now;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[6];
emailparams[0] = tecnNumber.ToString();
emailparams[1] = tecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "TECN";
emailparams[4] = DateTime.Now.ToString();
emailparams[5] = ecnNumber.ToString();
#if (DEBUG)
userEmail = GlobalVars.SENDER_EMAIL;
#endif
if (IsITAR(ecn))
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
else
en.SendNotificationEmailWithAttachments(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, attachments, emailparams);
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
return emailSentList;
}
public static string NotifyTECNExpiration(AppSettings appSettings, int ecnNumber, string ecnFolderPath, ECN ecn) {
string emailSentList = "";
string senderName = "ECN";
string userEmail = string.Empty;
string emailTemplate = "TECNExpired.txt";
List<string> emailIst = MiscDMO.GetEmergencyTECNApprovalNotifyList(ecnNumber).Distinct().ToList();
string subject = "TECN Expiration Approved Notice - " + ecnNumber + " for " + ecn.Title + ", Expired:" + ecn.ExpirationDate;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "TECN";
emailparams[4] = ecn.ExpirationDate.Value.ToShortDateString();
if (IsITAR(ecn))
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
else
en.SendNotificationEmailWithAttachment(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, ecnFolderPath, emailparams);
emailSentList = string.Join(", ", emailIst.Distinct().ToArray());
return emailSentList;
}
public static void ReAssignApproval(AppSettings appSettings, int issueID, string ecnTypeString, string email, ECN ecn) {
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNReAssigned.txt";
string subject = ecnTypeString + " Re-Assignment";
subject = ecnTypeString + " Re-Assignment" + " - Email would be sent to " + email + " for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static string AddEECNApproval(AppSettings appSettings, int ecnNumber, string emailSentList, string emailArray, ECN ecn) {
string senderName = "E-TECN";
string userEmail = string.Empty;
string subject = "E-TECN Assignment";
string emailTemplate = "ECNAssigned.txt";
string[] emailIst = emailArray.Split(new char[] { '~' });
foreach (string email in emailIst) {
if (email.Length > 0) {
subject = "E-TECN Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "E-TECN";
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
}
return emailSentList;
}
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string ecnTypeString, string emailSentList, string emailArray, ECN ecn) {
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNAssigned.txt";
string subject = ecnTypeString + " Assignment";
string[] emailIst = emailArray.Split(new char[] { '~' });
foreach (string email in emailIst) {
if (email.Length > 0) {
subject = ecnTypeString + "Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
}
return emailSentList;
}
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string ecnTypeString, string email, ECN ecn) {
string subject;
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNReAssigned.txt";
subject = ecnTypeString + " Re-Assignment" + " - ECN #" + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static string NotifyTECNExtensionRejectionToOrginator(AppSettings appSettings, int issueID, string ecnTypeString, List<string> emailIst, ECN ecn, string username) {
string userEmail = string.Empty;
string senderName = ecnTypeString;
string subject = ecnTypeString + " Rejection";
string emailTemplate = "TECNExtensionReject.txt";
foreach (string email in emailIst) {
subject = ecnTypeString + " Extension Rejection notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = username;
emailparams[4] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
return userEmail;
}
public static string NotifyRejectionToOrginator(AppSettings appSettings, int issueID, string ecnTypeString, string comments, List<string> emailIst, ECN ecn, string username) {
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNReject.txt";
string subject = ecnTypeString + " Rejection";
foreach (string email in emailIst) {
subject = ecnTypeString + " Rejection notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[6];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = username;
emailparams[4] = ecnTypeString;
emailparams[5] = comments;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
return userEmail;
}
public static string NotifyApprovers(AppSettings appSettings, int ecnNumber, string ecnTypeString, string emailSentList, ECN ecn, List<string> emailIst) {
string subject = string.Empty;
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNAssigned.txt";
subject = ecnTypeString + " Assignment notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
foreach (string email in emailIst) {
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string NotifyAdmin(AppSettings appSettings, int ecnNumber, string ecnTypeString, ECN ecn, int id) {
string emailSentList;
string subject = string.Empty;
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "ECNApproved.txt";
string ecnCreatedByEmail = MiscDMO.GetEmail(id);
subject = ecnTypeString + " Approval notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = ecnCreatedByEmail;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList = ecnCreatedByEmail;
return emailSentList;
}
public static string NotifySubmitter(AppSettings appSettings, int ecnNumber, string ecnTypeString, ECN ecn) {
string emailSentList;
string subject = string.Empty;
string userEmail = string.Empty;
string senderName = ecnTypeString;
int ecnCreatedById = ecn.OriginatorID;
string emailTemplate = "ECNApproved.txt";
string ecnCreatedByEmail = MiscDMO.GetEmail(ecnCreatedById);
subject = ecnTypeString + " Approval notice for Number " + ecn.ECNNumber + ", - " + ecn.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ecnNumber.ToString();
emailparams[1] = ecnNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = ecnCreatedByEmail;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList = ecnCreatedByEmail;
return emailSentList;
}
public static bool CreateZip(AppSettings appSettings, ECNPdf ecn, string UserId) {
try {
string sourceDirectory = appSettings.AttachmentFolder + "ECN\\" + ecn.ECNNumber.ToString() + "\\";
string outputFullFilePath = "";
string outputFileName;
if (ecn.IsTECN) {
if (ecn.ExtensionDate != null)
outputFileName = TECN_PREFIX + ecn.ECNNumber.ToString() + "_Extension.zip";
else
outputFileName = TECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
outputFullFilePath = appSettings.AttachmentFolder + "\\ECNZipped\\" + outputFileName;
} else if (ecn.IsEmergencyTECN) // Transfer it to different folder , coz documentum does not need to have a Workflow Item created for Emergency TECN
{
outputFileName = ETECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
outputFullFilePath = appSettings.AttachmentFolder + "\\E-TECNZipped\\" + outputFileName;
} else {
outputFileName = ECN_PREFIX + ecn.ECNNumber.ToString() + ".zip";
outputFullFilePath = appSettings.AttachmentFolder + "\\ECNZipped\\" + outputFileName;
}
Zipper zip = new();
zip.CreateZip(outputFullFilePath, sourceDirectory);
} catch (Exception ex) {
EventLogDMO.Add(new WinEventLog() { IssueID = ecn.ECNNumber, UserID = UserId, DocumentType = ecn.IsECN ? "ECN" : (ecn.IsEmergencyTECN ? "E-TECN" : "TECN"), OperationType = "Error", Comments = ex.Message });
return false;
}
return true;
}
public static string AddEECNApproval(AppSettings appSettings, string userId, WorkflowDMO wfDMO, int ecnNumber, out byte step, string engUserIDs, string OpUserIDs, ECN ecn) {
string emailSentList = "";
step = 1;
string emailArray = "";
try {
emailArray = wfDMO.AddEECNApproval(ecnNumber, step, (int)GlobalVars.DocumentType.EECN, engUserIDs, OpUserIDs);
} catch (Exception e) {
string detailedException = "";
try {
detailedException = e.InnerException.ToString();
} catch {
detailedException = e.Message;
}
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + ecnNumber.ToString() + " Step:" + step + " " + " Userid:" + engUserIDs + " - " + OpUserIDs + " - " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(appSettings, userId + "\r\n AddEECNApproval\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = ecnNumber, UserID = userId, DocumentType = "E-TECN ", OperationType = "Error", Comments = "AddEECNApproval - " + exceptionString });
throw new Exception(e.Message);
}
emailSentList = AddEECNApproval(appSettings, ecnNumber, emailSentList, emailArray, ecn);
return emailSentList;
}
public static string AttachSave(AppSettings appSettings, ECN_DMO ecnDMO, int ecnNumber, string returnString, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
string ecnFolderPath = appSettings.AttachmentFolder + "ECN\\" + ecnNumber.ToString();
DirectoryInfo di = new(ecnFolderPath);
if (!di.Exists)
try {
di.Create();
} catch {
returnString = "Error creating ECN directory.";
}
if (returnString == "") {
var physicalPath = Path.Combine(ecnFolderPath, fileName);
if (!File.Exists(physicalPath)) {
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
ECNAttachment attach = new() {
ECNNumber = ecnNumber,
FileName = fileName,
UserID = userId,
};
if (File.Exists(physicalPath)) {
ecnDMO.InsertECNAttachment(attach);
} else {
returnString = "File was not uploaded to server.";
}
} else {
returnString = "Cannot have duplicate file names.";
}
}
return returnString;
}
}

View File

@ -1,53 +1,23 @@
#pragma warning disable CS8019
using System;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Net.Mail;
using System.Web;
#pragma warning restore CS8019
namespace Fab2ApprovalSystem.Misc;
public class EmailNotification {
namespace Fab2ApprovalSystem.Misc {
public class EmailNotification {
#region Variabls
protected string _subject = null;
protected string _TemplatesPath = null;
private readonly Models.AppSettings _AppSettings;
#endregion
public EmailNotification(Models.AppSettings appSettings) =>
_AppSettings = appSettings;
public EmailNotification(Models.AppSettings appSettings, string EmailHeaderSubject) {
_AppSettings = appSettings;
_subject = EmailHeaderSubject;
_TemplatesPath = appSettings.EmailTemplatesPath;
}
/// <summary>
/// The Constructor Function
/// </summary>
/// <param name="EmailHeaderSubject">Email Header Subject</param>
/// <param name="TemplatesPath">Emails Files Templates</param>
public EmailNotification(Models.AppSettings appSettings, string EmailHeaderSubject, string TemplatesPath) {
_AppSettings = appSettings;
_subject = EmailHeaderSubject;
_TemplatesPath = TemplatesPath;
}
public EmailNotification(Models.AppSettings appSettings, string subject, string templatesPath, string emailSubject) :
this(appSettings, subject, templatesPath) =>
EmailSubject = emailSubject;
/// <summary>
/// Email subject
/// </summary>
public string EmailSubject {
set => _subject = value;
set { _subject = value; }
}
/// <summary>
@ -58,19 +28,18 @@ public class EmailNotification {
protected string ReadEmailFile(string FileName) {
string retVal = null;
try {
//setting the file name path
string path = _TemplatesPath + FileName;
#if !NET8
FileInfo TheFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(path));
// check if the file exists in the location.
//check if the file exists in the location.
if (!TheFile.Exists)
throw new Exception("Could Not Find the file : " + FileName + " in the location " + _TemplatesPath); // throw an exception here.
// start reading the file. i have used Encoding 1256 to support arabic text also.
//start reading the file. i have used Encoding 1256 to support arabic text also.
StreamReader sr = new StreamReader(System.Web.HttpContext.Current.Server.MapPath(@path), System.Text.Encoding.GetEncoding(1256));
retVal = sr.ReadToEnd(); // getting the entire text from the file.
sr.Close();
#endif
} catch (Exception ex) {
throw new Exception("Error Reading File." + ex.Message);
}
@ -89,24 +58,26 @@ public class EmailNotification {
#pragma warning disable IDE0060 // Remove unused parameter
protected void SendEmail(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
//msg.From = new MailAddress(SenderEmail, SenderName);
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
msg.Sender = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
// adding the Recepient Email ID
msg.To.Add(Recep);
//msg.To.Add("Jonathan.Ouellette@infineon.com");
// add CC email ids if supplied.
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new("mailrelay-internal.infineon.com");
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient("mailrelay-internal.infineon.com");
// sending the message.
try {
@ -118,9 +89,19 @@ public class EmailNotification {
}
#pragma warning restore IDE0060 // Remove unused parameter
/// <summary>
///
/// </summary>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="Recep"></param>
/// <param name="cc"></param>
/// <param name="email_title"></param>
/// <param name="email_body"></param>
/// <param name="attachmentPath"></param>
protected void SendEmailWithAttachment(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body, string attachmentPath) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
@ -133,26 +114,36 @@ public class EmailNotification {
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
msg.Attachments.Add(new Attachment(attachmentPath));
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new();
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient();
#if(!DEBUG)
// sending the message.
SmtpMail.Send(msg);
#endif
}
/// <summary>
///
/// </summary>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientList"></param>
/// <param name="cc"></param>
/// <param name="email_title"></param>
/// <param name="email_body"></param>
#pragma warning disable IDE0060 // Remove unused parameter
protected void SendEmail(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
//msg.From = new MailAddress(SenderEmail, SenderName);
msg.From = new MailAddress("MesaFabApproval@infineon.com", "Mesa Fab Approval");
// adding the Recepient Email ID
foreach (string recepient in RecepientList) {
@ -163,12 +154,12 @@ public class EmailNotification {
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new();
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient();
// sending the message.
try {
@ -180,9 +171,19 @@ public class EmailNotification {
}
#pragma warning restore IDE0060 // Remove unused parameter
/// <summary>
///
/// </summary>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientList"></param>
/// <param name="cc"></param>
/// <param name="email_title"></param>
/// <param name="email_body"></param>
/// <param name="attachmentPath"></param>
protected void SendEmailWithAttachment(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body, string attachmentPath) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
@ -198,21 +199,31 @@ public class EmailNotification {
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
msg.Attachments.Add(new Attachment(attachmentPath));
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new();
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient();
// sending the message.
SmtpMail.Send(msg);
}
/// <summary>
///
/// </summary>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="Recep"></param>
/// <param name="cc"></param>
/// <param name="email_title"></param>
/// <param name="email_body"></param>
/// <param name="attachments"></param>
protected void SendEmailWithAttachments(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body, List<string> attachments) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
@ -225,24 +236,34 @@ public class EmailNotification {
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
foreach (string attachment in attachments) {
msg.Attachments.Add(new Attachment(attachment));
}
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new();
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient();
#if(!DEBUG)
// sending the message.
SmtpMail.Send(msg);
#endif
}
/// <summary>
///
/// </summary>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientList"></param>
/// <param name="cc"></param>
/// <param name="email_title"></param>
/// <param name="email_body"></param>
/// <param name="attachments"></param>
protected void SendEmailWithAttachments(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body, List<string> attachments) {
// creating email message
MailMessage msg = new();
MailMessage msg = new MailMessage();
msg.IsBodyHtml = true;// email body will allow html elements
// setting the Sender Email ID
@ -258,7 +279,7 @@ public class EmailNotification {
if (!string.IsNullOrEmpty(cc))
msg.CC.Add(cc);
// setting email subject and body
//setting email subject and body
msg.Subject = email_title;
msg.Body = email_body;
@ -266,13 +287,28 @@ public class EmailNotification {
msg.Attachments.Add(new Attachment(attachment));
}
// create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new();
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
SmtpClient SmtpMail = new SmtpClient();
// sending the message.
SmtpMail.Send(msg);
}
public EmailNotification() {
}
/// <summary>
/// The Constructor Function
/// </summary>
/// <param name="EmailHeaderSubject">Email Header Subject</param>
/// <param name="TemplatesPath">Emails Files Templates</param>
public EmailNotification(string EmailHeaderSubject, string TemplatesPath) {
_subject = EmailHeaderSubject;
_TemplatesPath = TemplatesPath;
}
/// <summary>
/// This function will send the email notification by reading the email template and substitute the arguments
/// </summary>
@ -287,16 +323,16 @@ public class EmailNotification {
public string SendNotificationEmail(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
SendEmail(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? Subject + " for: " + RecepientEmail : _subject), retVal);
} else {
@ -305,7 +341,7 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
@ -314,20 +350,28 @@ public class EmailNotification {
/// <summary>
/// This function will send the email notification by reading the email template and substitute the arguments along with the attachments
/// </summary>
/// <param name="EmailTemplateFile"></param>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientEmail"></param>
/// <param name="CC"></param>
/// <param name="Subject"></param>
/// <param name="attachmentPath"></param>
/// <param name="Args"></param>
/// <returns></returns>
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
SendEmailWithAttachment(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? " TESTING ONLY -IGNORE : " + Subject + RecepientEmail : _subject), retVal, attachmentPath);
} else {
@ -336,25 +380,37 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
}
/// <summary>
///
/// </summary>
/// <param name="EmailTemplateFile"></param>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientEmail"></param>
/// <param name="CC"></param>
/// <param name="Subject"></param>
/// <param name="attachmentPath"></param>
/// <param name="Args"></param>
/// <returns></returns>
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
foreach (string email in RecepientEmail) {
Subject += email + ";";
@ -368,7 +424,7 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
@ -377,16 +433,16 @@ public class EmailNotification {
public string SendNotificationEmailWithAttachments(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, List<string> attachments, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
SendEmailWithAttachments(SenderEmail, SenderName, GetTestRecipientsList(), CC, (!string.IsNullOrEmpty(Subject) ? " TESTING ONLY -IGNORE : " + Subject + RecepientEmail : _subject), retVal, attachments);
} else {
@ -395,25 +451,37 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
}
/// <summary>
///
/// </summary>
/// <param name="EmailTemplateFile"></param>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientEmail"></param>
/// <param name="CC"></param>
/// <param name="Subject"></param>
/// <param name="attachmentPath"></param>
/// <param name="Args"></param>
/// <returns></returns>
public string SendNotificationEmailWithAttachments(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, List<string> attachments, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
foreach (string email in RecepientEmail) {
Subject += email + ";";
@ -427,25 +495,36 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
}
/// <summary>
///
/// </summary>
/// <param name="EmailTemplateFile"></param>
/// <param name="SenderEmail"></param>
/// <param name="SenderName"></param>
/// <param name="RecepientEmail"></param>
/// <param name="CC"></param>
/// <param name="Subject"></param>
/// <param name="Args"></param>
/// <returns></returns>
public string SendNotificationEmail(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, params string[] Args) {
string retVal = null;
// reading the file
//reading the file
string FileContents = ReadEmailFile(EmailTemplateFile);
string emailBody = FileContents;
// setting formatting the string
//setting formatting the string
retVal = string.Format(emailBody, Args);
try {
// check if we are in debug mode or not. to send email
//check if we are in debug mode or not. to send email
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
foreach (string email in RecepientEmail) {
Subject += email + ";";
@ -458,20 +537,27 @@ public class EmailNotification {
#endif
}
} catch (Exception ex) {
throw;
throw ex;
}
return retVal;
}
/// <summary>
///
/// </summary>
/// <param name="subject"></param>
/// <param name="body"></param>
/// <param name="importance"></param>
public void SendNotificationEmailToAdmin(string subject, string body, MailPriority importance) {
try {
SmtpClient client = new(_AppSettings.SMTPServer);
MailMessage msg = new();
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
string toList = _AppSettings.AdminNotificationRecepient;
msg.From = new MailAddress(_AppSettings.NotificationSender);
SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["SMTP Server"]);
MailMessage msg = new MailMessage();
string toList = ConfigurationManager.AppSettings["Admin Notification Recepient"];
msg.From = new MailAddress(ConfigurationManager.AppSettings["Notification Sender"]); ;
string[] recipients = toList.Split(',');
foreach (string recipient in recipients)
msg.To.Add(new MailAddress(recipient.Trim()));
@ -482,18 +568,20 @@ public class EmailNotification {
msg.Subject = subject;
msg.Body = temp;
msg.Priority = importance;
//#if(!DEBUG)
client.Send(msg);
//#endif
} catch (Exception ex) {
throw;
throw ex;
}
}
public List<string> GetTestRecipientsList() {
List<string> r = new();
List<string> r = new List<string>();
try {
string emails = _AppSettings.TestEmailRecipients;
string emails = ConfigurationManager.AppSettings["Test Email Recipients"];
foreach (string s in emails.Split(';', ',')) {
if (!string.IsNullOrWhiteSpace(s))
if (!String.IsNullOrWhiteSpace(s))
r.Add(s);
}
} catch {
@ -501,4 +589,5 @@ public class EmailNotification {
}
return r;
}
}
}

View File

@ -1,67 +1,82 @@
#if NET8
using ExcelDataReader;
#else
using Excel;
#endif
using Excel;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Misc;
public class ExcelData {
private readonly string _Path;
public ExcelData(string path) {
_Path = path;
namespace Fab2ApprovalSystem.Misc
{
public class ExcelData
{
string _path;
public ExcelData(string path)
{
_path = path;
}
public IExcelDataReader getExcelReader() {
FileStream stream = File.Open(_Path, FileMode.Open, FileAccess.Read);
public IExcelDataReader getExcelReader()
{
// ExcelDataReader works with the binary Excel file, so it needs a FileStream
// to get started. This is how we avoid dependencies on ACE or Interop:
FileStream stream = File.Open(_path, FileMode.Open, FileAccess.Read);
// We return the interface, so that
IExcelDataReader reader = null;
try {
if (_Path.EndsWith(".xls")) {
try
{
if (_path.EndsWith(".xls"))
{
reader = ExcelReaderFactory.CreateBinaryReader(stream);
}
if (_Path.EndsWith(".xlsx")) {
if (_path.EndsWith(".xlsx"))
{
reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
}
return reader;
} catch (Exception) {
}
catch (Exception)
{
throw;
}
}
public class ExcelLotInfo {
public string? LotNo { get; set; }
public string? LotDispo { get; set; }
public class ExcelLotInfo
{
public string LotNo { get; set; }
public string LotDispo { get; set; }
}
public IEnumerable<ExcelLotInfo> ReadData() {
List<ExcelLotInfo> r = new();
ExcelData excelData = new(_Path);
List<DataRow> lots = excelData.getData().ToList();
/// <summary>
///
/// </summary>
/// <returns></returns>
public IEnumerable<ExcelLotInfo> ReadData()
{
var r = new List<ExcelLotInfo>();
var excelData = new ExcelData(_path);
var lots = excelData.getData().ToList();
int lotDispoColumnIndex = -1;
foreach (DataColumn col in lots[0].Table.Columns) {
if (col.ColumnName.ToLower().Contains("dispo")) {
foreach (DataColumn col in lots[0].Table.Columns)
{
if (col.ColumnName.ToLower().Contains("dispo"))
{
lotDispoColumnIndex = col.Ordinal;
break;
}
}
foreach (DataRow row in lots) {
foreach (var row in lots)
{
string temValue = row[0].ToString();
if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10) {
r.Add(new ExcelLotInfo() {
if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10 )
{
r.Add(new ExcelLotInfo()
{
LotNo = row[0].ToString(),
LotDispo = (lotDispoColumnIndex >= 0 ? row[lotDispoColumnIndex].ToString() : "")
});
@ -71,16 +86,25 @@ public class ExcelData {
return r;
}
public IEnumerable<string> ReadQDBFlagData() {
List<string> s = new();
ExcelData excelData = new(_Path);
IEnumerable<DataRow> lotNos = excelData.getData();
foreach (DataRow row in lotNos) {
public IEnumerable<string> ReadQDBFlagData()
{
List<string> s = new List<string>();
// We return the interface, so that
var excelData = new ExcelData(_path);
//var albums = excelData.getData("Sheet1");
var lotNos = excelData.getData();
foreach (var row in lotNos)
{
string temValue = row[0].ToString();
if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9) {
if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO") {
if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9)
{
if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO")
{
throw new Exception("Invalid data in the file");
} else {
}
else
{
s.Add(row[0].ToString() + "~" + row[1] + "~" + row[2]);
}
}
@ -89,21 +113,32 @@ public class ExcelData {
return s;
}
#if NET8
//public IEnumerable<DataRow> getData(string sheet, bool firstRowIsColumnNames = true)
//{
// var reader = this.getExcelReader();
// reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
// var workSheet = reader.AsDataSet().Tables[sheet];
// var rows = from DataRow a in workSheet.Rows select a;
// return rows;
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) =>
throw new NotImplementedException();
//}
#else
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) {
IExcelDataReader reader = getExcelReader();
/// <summary>
///
/// </summary>
/// <param name="firstRowIsColumnNames"></param>
/// <returns></returns>
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true)
{
var reader = this.getExcelReader();
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
var workSheet = reader.AsDataSet().Tables[0];
var rows = from DataRow a in workSheet.Rows select a;
return rows;
}
#endif
}
}

View File

@ -1,45 +1,59 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc
{
class FTPWrapper
{
string m_OutputFile;
string m_DestinationFileName;
//Functions functions = new Functions();
public FTPWrapper(string outputFile, string destinationFileName)
{
m_OutputFile = outputFile;
m_DestinationFileName = destinationFileName;
namespace Fab2ApprovalSystem.Misc;
internal class FTPWrapper {
private readonly string _OutputFile;
private readonly string _DestinationFileName;
private readonly AppSettings _AppSettings;
public FTPWrapper(AppSettings appSettings, string outputFile, string destinationFileName) {
_OutputFile = outputFile;
_AppSettings = appSettings;
_DestinationFileName = destinationFileName;
}
public void FTPToSPN() {
FTP ftpLib = new();
/// <summary>
///
/// </summary>
public void FTPToSPN()
{
FTP ftpLib = new FTP();
// Connect to the FTP server
try {
ftpLib.Connect(_AppSettings.FTPServer, _AppSettings.FTPUser, _AppSettings.FTPPassword);
} catch (Exception ec) {
Functions.WriteEvent(_AppSettings, "Listener - ProcessFile(): FTP Connection Error " + _OutputFile + " - " + ec.Source +
//Connect to the FTP server
try
{
ftpLib.Connect(Functions.FTPServer(), Functions.FTPUser(), Functions.FTPPassword());
}
catch (Exception ec)
{
Functions.WriteEvent("Listener - ProcessFile(): FTP Connection Error " + m_OutputFile + " - " + ec.Source +
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
}
// Upload the file
try {
//Upload the file
try
{
int pct = 0;
ftpLib.OpenUpload(_OutputFile, _DestinationFileName);
ftpLib.OpenUpload(m_OutputFile, m_DestinationFileName);
while (ftpLib.DoUpload() > 0)
pct = (int)((ftpLib.BytesTotal * 100) / ftpLib.FileSize);
Functions.WriteEvent(_AppSettings, _OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
} catch (Exception eu) {
Functions.WriteEvent(_AppSettings, "MRB - FTPToSPN(): FTP Upload Error " + _OutputFile + " - " + eu.Source +
Functions.WriteEvent(m_OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
}
catch (Exception eu)
{
Functions.WriteEvent("MRB - FTPToSPN(): FTP Upload Error " + m_OutputFile + " - " + eu.Source +
": " + eu.Message, System.Diagnostics.EventLogEntryType.Error);
throw new Exception(eu.Source + ": " + eu.Message);
}
}
}
}

View File

@ -1,64 +1,95 @@
#pragma warning disable CS8019
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Diagnostics;
using System.Linq;
using System.Web;
#if !NET8
using System.Web.Security;
#endif
using System.IO;
using System.Net.Mail;
using System.DirectoryServices;
using System.DirectoryServices.AccountManagement;
#pragma warning restore CS8019
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public static class Functions {
namespace Fab2ApprovalSystem.Misc {
public static class Functions {
/// <summary>
/// Writes to the Application Event Log and sends an email notification if appropriate
/// </summary>
public static void WriteEvent(AppSettings? appSettings, string logtext, EventLogEntryType eventType) {
#if !NET8
EmailNotification? en = appSettings is null ? null : new EmailNotification(appSettings);
#endif
EventLog ev = new("Application");
/// <param name="logtext"></param>
/// <param name="eventType"></param>
public static void WriteEvent(string logtext, System.Diagnostics.EventLogEntryType eventType) {
//#if(!DEBUG)
EmailNotification en = new EmailNotification();
EventLog ev = new EventLog("Application");
ev.Source = "Fab Approval System";
try {
// Write to the Event Log
//Write to the Event Log
ev.WriteEntry(logtext, eventType);
// Send an email notification if appropriate
// Don't attempt to send an email if the error is pertaining to an email problem
////Send an email notification if appropriate
////Don't attempt to send an email if the error is pertaining to an email problem
if (!logtext.Contains("SendEmailNotification()")) {
// Only send email notifications for Error and Warning level events
#if !NET8
if (appSettings is not null && eventType == System.Diagnostics.EventLogEntryType.Error)
//Only send email notifications for Error and Warning level events
if (eventType == System.Diagnostics.EventLogEntryType.Error)
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
#endif
//else if (eventType == System.Diagnostics.EventLogEntryType.Warning)
// SendEmailNotification(ErrorRecipient(), ev.Source + " Warning Event Logged", logtext, NORMAL_PRI);
}
} catch {
//throw;
} finally {
ev = null;
}
}
public static void CopyAttachments(AppSettings appSettings, int oldECNNumber, int newECNNumber) {
// The Name of the Upload component is "files"
string oldFolderPath = appSettings.AttachmentFolder + "ECN\\" + oldECNNumber.ToString();
string newFolderPath = appSettings.AttachmentFolder + "ECN\\" + newECNNumber.ToString();
/// <summary>
/// Returns the FTP Server Name
/// </summary>
/// <returns></returns>
public static string FTPServer() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["FTP Server"];
}
DirectoryInfo newdi = new(newFolderPath);
/// <summary>
/// Returns the FTP User Name
/// </summary>
/// <returns></returns>
public static string FTPUser() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["FTP User"];
}
/// <summary>
/// Returns the FTP Password
/// </summary>
/// <returns></returns>
public static string FTPPassword() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["FTP Password"];
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string GetAttachmentFolder() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["AttachmentFolder"];
}
/// <summary>
///
/// </summary>
/// <param name="oldECNNumber"></param>
/// <param name="newECNNumber"></param>
public static void CopyAttachments(int oldECNNumber, int newECNNumber) {
// The Name of the Upload component is "files"
string oldFolderPath = Functions.GetAttachmentFolder() + "ECN\\" + oldECNNumber.ToString();
string newFolderPath = Functions.GetAttachmentFolder() + "ECN\\" + newECNNumber.ToString();
DirectoryInfo newdi = new DirectoryInfo(newFolderPath);
if (!newdi.Exists)
newdi.Create();
@ -66,15 +97,23 @@ public static class Functions {
FileInfo[] existingFiles = new DirectoryInfo(oldFolderPath).GetFiles();
foreach (FileInfo file in existingFiles) {
if (!file.Name.Contains("ECNApprovalLog_" + oldECNNumber.ToString()) && !file.Name.Contains("ECNForm_" + oldECNNumber.ToString()))
//var fileName = Path.GetFileName(file.FullName);
file.CopyTo(Path.Combine(newFolderPath, file.Name));
}
}
public static bool NA_ADAuthenticate(AppSettings appSettings, string userID, string pwd) {
string naContainer = appSettings.NAContainer;
string naDomain = appSettings.NADomain;
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static bool NA_ADAuthenticate(string userID, string pwd) {
string naContainer = ConfigurationManager.AppSettings["NAContainer"];
string naDomain = ConfigurationManager.AppSettings["NADomain"];
try {
PrincipalContext contextUser = new(ContextType.Domain,
PrincipalContext contextUser = new PrincipalContext(ContextType.Domain,
naDomain,
naContainer,
ContextOptions.Negotiate, userID, pwd);
@ -89,11 +128,18 @@ public static class Functions {
}
}
public static bool IFX_ADAuthenticate(AppSettings appSettings, string userID, string pwd) {
string container = appSettings.IFXContainer;
string domain = appSettings.IFXDomain;
/// <summary>
///
/// </summary>
/// <param name="userID"></param>
/// <param name="pwd"></param>
/// <returns></returns>
public static bool IFX_ADAuthenticate(string userID, string pwd) {
string container = ConfigurationManager.AppSettings["IFXContainer"];
string domain = ConfigurationManager.AppSettings["IFXDomain"];
try {
PrincipalContext contextUser = new(ContextType.Domain,
PrincipalContext contextUser = new PrincipalContext(ContextType.Domain,
domain,
container,
ContextOptions.Negotiate, userID, pwd);
@ -108,6 +154,25 @@ public static class Functions {
}
}
public static string FTPSPNBatch() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["FTPSPNBatchFileName"];
}
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string FTPSPNBatch_Test() {
ConfigurationManager.RefreshSection("appSettings");
return ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"];
}
/// <summary>
///
/// </summary>
/// <param name="casection"></param>
/// <returns></returns>
public static string CASectionMapper(GlobalVars.CASection casection) {
switch (casection) {
case GlobalVars.CASection.Main:
@ -169,7 +234,8 @@ public static class Functions {
/// <summary>
/// Converts the CA No to the C00000 format
/// </summary>
/// <param name="caNo"></param>
/// <returns></returns>
public static string ReturnCANoStringFormat(int caNo) {
string caNoString = "";
if (caNo == 0)
@ -189,6 +255,7 @@ public static class Functions {
public static string ReturnPartsRequestNoStringFormat(int PRNumber) {
if (PRNumber == 0)
return "";
return string.Format("PR{0:000000}", PRNumber);
return String.Format("PR{0:000000}", PRNumber);
}
}
}

View File

@ -1,16 +1,14 @@
using Fab2ApprovalSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Misc;
#if !NET8
public class GlobalVars {
namespace Fab2ApprovalSystem.Misc
{
public class GlobalVars
{
public int USER_ID;
#else
public static class GlobalVars {
public static int USER_ID = 0;
#endif
public const string SESSION_USERNAME = "UserName";
public const string ApplicationName = "LotDisposition";
public const string SESSION_USERID = "UserID";
@ -20,10 +18,6 @@ public static class GlobalVars {
public const string OOO = "OOO";
public const string SUCCESS = "Success";
public const string CAN_CREATE_PARTS_REQUEST = "CanCreatePartsRequest";
public const string LOT_NO = "LotNo";
public const string LOCATION = "Location";
public static AppSettings? AppSettings = null;
public static bool USER_ISADMIN = false;
public static bool IS_INFINEON_DOMAIN = false;
@ -35,10 +29,23 @@ public static class GlobalVars {
public static string NDriveURL = "";
public static string WSR_URL = "";
public static string CA_BlankFormsLocation = "";
public static string SENDER_EMAIL = "MesaFabApproval@infineon.com";
public static string MesaTemplateFiles = "D:\\WebSites\\FabApprovalAttachments\\Template5Why";
public enum LotStatusOption {
//public static string DevWebSiteUrl = "";
//public static string ProdWebSiteUrl = "";
//public static string DevAttachmentUrl = "";
//public static string ProdAttachmentUrl = "";
public static string LOT_NO = "LotNo";
public static string LOCATION = "Location";
public static string SENDER_EMAIL = "MesaFabApproval@infineon.com";
//public static List<UserProfileDTO> UserProfileDTO { get; set; }
public enum LotStatusOption
{
Release = 1,
Scrap,
NotAvailable,
@ -49,29 +56,33 @@ public static class GlobalVars {
}
public enum ApprovalOption {
public enum ApprovalOption
{
Pending = 0,
Approved = 1,
Denied = 2,
Waiting = 3, // waiting on other approver to approve first
Skipped = 4, // set to this state if the original approval is no longer needed.
ReAssigned = 5, // set to this state if current approver got reassigned
Terminated = 6, // future use
Waiting = 3, //waiting on other approver to approve first
Skipped = 4, //set to this state if the original approval is no longer needed.
ReAssigned = 5, //set to this state if current approver got reassigned
Terminated = 6, //future use
Closed = 7,
Recalled = 8
}
public enum WorkFLowStepNumber {
public enum WorkFLowStepNumber
{
Step1 = 1,
Step2,
Step3
}
public enum DocumentType {
public enum DocumentType
{
LotDisposition = 1,
MRB = 2,
ECN = 3,
MRB=2,
ECN=3,
EECN = 4,
TECNCancelledExpired = 5,
LotTraveler = 6,
@ -82,20 +93,26 @@ public static class GlobalVars {
CorrectiveActionSection = 12
}
public enum TECNExpirationCancellation {
public enum TECNExpirationCancellation
{
Cancellation = 1,
Expiration = 2
}
public enum Colors { None = 0, Red = 1, Green = 2, Blue = 4 };
public enum NotificationType {
public enum NotificationType
{
WorkRequest = 1,
LotTraveler = 2
}
public enum CASection {
Main, D1, D2, D3, D4, D5, D6, D7, D8, CF
public enum CASection
{
Main, D1, D2, D3, D4, D5,D6, D7, D8, CF
}
}
}

View File

@ -1,67 +0,0 @@
using System;
using System.Collections.Generic;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class HomeHelper {
public static void NotifyApprover(AppSettings appSettings, string toEmail, string title, int issueId, string docType) {
string emailSentList = "";
string senderName = docType;
string subject = string.Empty;
string userEmail = string.Empty;
string emailTemplate = "ApprovalReminders.txt";
subject = docType + " Approval Reminder: " + title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = docType;
emailparams[1] = title;
emailparams[2] = issueId.ToString();
userEmail = toEmail;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, "jonathan.ouellette@infineon.com", subject, emailparams);
}
public static void NotifyDelegation(AppSettings appSettings, DateTime startDate, DateTime endDate, LoginModel delegateFrom, LoginModel delegateTo, List<string> emailList) {
string userEmail = string.Empty;
string senderName = "Mesa Approval";
string emailTemplate = "DelegationOn.txt";
string subject = "Mesa Approval Delegation Notification";
foreach (string email in emailList) {
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = delegateFrom.FullName;
emailparams[1] = delegateTo.FullName;
emailparams[2] = startDate.ToString("yyyy-MM-dd");
emailparams[3] = endDate.ToString("yyyy-MM-dd");
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
}
public static void DelegateDocumentApproval(AppSettings appSettings, int issueID, string ecnTypeString, string title, string email) {
string subject;
string userEmail = string.Empty;
string senderName = ecnTypeString;
string emailTemplate = "DelegateApproval.txt";
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = ecnTypeString;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
}

View File

@ -1,165 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class LotDispositionHelper {
public static string NotifyRejectionToOrginator(AppSettings appSettings, int issueID, string username, List<string> emailIst) {
string userEmail = string.Empty;
string senderName = "LotDisposition";
string subject = "Lot Disposition Rejection";
string emailTemplate = "LotDispositionReject.txt";
foreach (string email in emailIst) {
subject = "Lot Disposition Rejection";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = username;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
return userEmail;
}
public static string NotifyApprovers(AppSettings appSettings, int issueID, List<string> emailIst) {
string emailSentList = "";
string userEmail = string.Empty;
string senderName = "LotDisposition";
string subject = "Lot Disposition Assignment";
string emailTemplate = "LotDispositionAssigned.txt";
foreach (string email in emailIst) {
subject = "Lot Disposition Assignment";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string AddAdditionalApproval(AppSettings appSettings, int issueID, string emailSentList, string emailArray) {
string userEmail = string.Empty;
string senderName = "LotDisposition";
string subject = "Lot Disposition Assignment";
string emailTemplate = "LotDispositionAssigned.txt";
string[] emailIst = emailArray.Split(new char[] { '~' });
foreach (string email in emailIst) {
if (email.Length > 0) {
subject = "Lot Disposition Assignment";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
}
return emailSentList;
}
public static void ReAssignApproverByAdmin(AppSettings appSettings, int issueID, string email) {
string userEmail = string.Empty;
string senderName = "LotDisposition";
string subject = "Lot Disposition Re-Assignment";
string emailTemplate = "LotDispositionReAssigned.txt";
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void ReAssignApproval(AppSettings appSettings, int issueID, string email) {
string userEmail = string.Empty;
string senderName = "LotDisposition";
string subject = "Lot Disposition Re-Assignment";
string emailTemplate = "LotDispositionReAssigned.txt";
subject = "Lot Disposition Re-Assignment" + " - Email would be sent to " + email;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[3];
emailparams[0] = issueID.ToString();
emailparams[1] = issueID.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void AttachSave(AppSettings appSettings, LotDispositionDMO lotDispositionDMO, int issueID, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
string fileName = Path.GetFileName(fullFileName);
string physicalPath = Path.Combine(appSettings.AttachmentFolder + "LotDisposition", fileName);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
Attachment attach = new() {
IssueID = issueID,
FileName = fileName,
UserID = userId,
};
lotDispositionDMO.InsertLotDispositionAttachment(attach);
}
public static string ExcelLotOpen(LotDispositionDMO lotDispositionDMO, int issueID, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
string physicalPath;
string fileExtension = Path.GetExtension(fullFileName);
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
ExcelData x = new (physicalPath);
IEnumerable<ExcelData.ExcelLotInfo> lotNumbers = x.ReadData();
foreach (ExcelData.ExcelLotInfo lotInfo in lotNumbers) {
Lot l = new();
l.LotNumber = lotInfo.LotNo ?? string.Empty;
l.IssueID = issueID;
if (l.LotStatusOptionID == 0)
l.LotStatusOption.LotStatusOptionID = (int)GlobalVars.LotStatusOption.Release;
lotDispositionDMO.InsertLot(l, true);
}
FileInfo f = new(physicalPath);
if (f.Exists)
f.Delete();
return physicalPath;
}
}

View File

@ -1,7 +1,12 @@
namespace Fab2ApprovalSystem.Misc;
public class LotNoTemplate {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Misc
{
public class LotNoTemplate
{
public string LotNo { get; set; }
}
}

View File

@ -1,469 +0,0 @@
using System;
using System.Collections.Generic;
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class LotTravelerHelper {
public static string NotifyRejectionToOrginator(AppSettings appSettings, string userId, int workRequestID, string username, List<string> emailIst, LTWorkRequest ltWR) {
string userEmail = string.Empty;
string senderName = "Work Request";
string subject = "Work Request Rejection";
string emailTemplate = "WorkRequestReject.txt";
foreach (string email in emailIst) {
subject = "Work Request Rejection notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = username;
emailparams[4] = "Work Request";
userEmail = email;
try {
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Notify Rejection:" + email });
}
}
return userEmail;
}
public static string NotifyApprovers(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
string senderName = "";
string userEmail = string.Empty;
string subject = "Work Request Assignment";
string emailTemplate = "WorkRequestAssigned.txt";
foreach (string email in emailIst) {
subject = "Work Request Assignment notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
#if (DEBUG)
userEmail = "rkotian1@irf.com";
#endif
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Notify Approvers:" + email });
}
}
return emailSentList;
}
public static string NotifyApprovalOfWorkRequest(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
string senderName = "";
string userEmail = string.Empty;
string subject = "Work Request Approval";
string emailTemplate = "WorkRequestApproval.txt";
foreach (string email in emailIst) {
subject = "Work Request Approval notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
#if (DEBUG)
userEmail = "rkotian1@irf.com";
#endif
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Approval Notification:" + email });
}
}
return emailSentList;
}
public static string NotifyfWorkRequestRevisionChange(AppSettings appSettings, string userId, int workRequestID, string emailSentList, LTWorkRequest ltWR, List<string> emailIst) {
string senderName = "";
string userEmail = string.Empty;
string subject = "Work Request Revision Change";
string emailTemplate = "WorkRequestRevisionChange.txt";
foreach (string email in emailIst) {
subject = "Work Request Revision Change notice for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
#if (DEBUG)
userEmail = "rkotian1@irf.com";
#endif
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "WR Revision Change Notification:" + email });
}
}
return emailSentList;
}
public static string NotifyLotTravelerRevisionChange(AppSettings appSettings, string userId, string emailSentList, LTLotTravelerHeaderViewModel data, List<string> emailIst) {
string senderName = "";
string userEmail = string.Empty;
string subject = "Lot Traveler Revision Change";
string emailTemplate = "LotTravelerRevisionChange.txt";
foreach (string email in emailIst) {
subject = "Lot Traveler Revision for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = data.SWRNumber.ToString();
emailparams[1] = data.LTWorkRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = data.LotNumber;
userEmail = email;
#if (DEBUG)
userEmail = "rkotian1@irf.com";
#endif
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Revision Notification:" + email });
}
}
return emailSentList;
}
public static string NotifyLotTravelerCreation(AppSettings appSettings, string userId, string emailSentList, LTLotTravelerHeaderViewModel data, List<string> emailIst) {
string senderName = "";
string userEmail = string.Empty;
string subject = "Lot Traveler Revision Change";
string emailTemplate = "LotTravelerCreation.txt";
foreach (string email in emailIst) {
subject = "Lot Traveler created for SWR# " + data.SWRNumber + ", Lot# " + data.LotNumber + " - " + data.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = data.SWRNumber.ToString();
emailparams[1] = data.LTWorkRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = data.LotNumber;
userEmail = email;
#if (DEBUG)
userEmail = "rkotian1@irf.com";
#endif
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = data.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Lot Traveler Creation Email Notification:" + email });
}
}
return emailSentList;
}
public static void ReAssignApproval(AppSettings appSettings, string userId, int workRequestID, string email, LTWorkRequest ltWR) {
string userEmail = string.Empty;
string senderName = "Work Request";
string subject = "Work Request Re-Assignment";
string emailTemplate = "WorkRequestReAssigned.txt";
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
try {
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approval Notification:" + email });
}
}
public static string AddAdditionalApproval(AppSettings appSettings, string userId, int workRequestID, string emailSentList, string emailArray, LTWorkRequest ltWR) {
string userEmail = string.Empty;
string senderName = "Work Request";
string subject = "Work Request Assignment";
string emailTemplate = "WorkRequestAssigned.txt";
string[] emailIst = emailArray.Split(new char[] { '~' });
foreach (string email in emailIst) {
if (email.Length > 0) {
subject = "Work Request Assignment notice for Number " + workRequestID + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
try {
emailSentList += email + ",";
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "Addtional Approver Notification:" + email });
}
}
}
return emailSentList;
}
public static void ReAssignApproverByAdmin(AppSettings appSettings, string userId, int workRequestID, string email, LTWorkRequest ltWR) {
string subject;
string userEmail = string.Empty;
string senderName = "Work Request";
string emailTemplate = "WorkRequestReAssigned.txt";
subject = "Work Request Re-Assignment" + " - Email would be sent to " + email + " for Number " + ltWR.SWRNumber + ", - " + ltWR.Title;
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[4];
emailparams[0] = ltWR.SWRNumber.ToString();
emailparams[1] = workRequestID.ToString(); // goes into the link
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Work Request";
userEmail = email;
try {
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
} catch {
EventLogDMO.Add(new WinEventLog() { IssueID = ltWR.SWRNumber, UserID = userId, DocumentType = "Lot Traveler", OperationType = "Error", Comments = "ReAssign Approver Notification:" + email });
}
}
public static void HoldStepAttachSave(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int holdStepID, int swrNo, string docType, string comments, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
// TODO
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWRPhysicalPath);
if (!di.Exists)
di.Create();
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWR_RevPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
LTWorkRequestAttachment attach = new() {
FileGUID = guid,
LTHoldStepID = holdStepID,
FileName = fileName,
UploadedByID = userId,
DocType = docType,
Comments = comments
};
lotTravelerDMO.InsertLotHoldStepAttachment(attach);
}
public static void HoldStepAttachSaveRev(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int holdStepID, int swrNo, string docType, string comments, bool newRevision, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
// TODO
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWRPhysicalPath);
if (!di.Exists)
di.Create();
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWR_RevPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
LTWorkRequestAttachment attach = new() {
FileGUID = guid,
LTHoldStepID = holdStepID,
FileName = fileName,
UploadedByID = userId,
DocType = docType,
Comments = comments
};
if (newRevision)
lotTravelerDMO.InsertLotHoldStepAttachmentRevision(attach);
else
lotTravelerDMO.InsertLotHoldStepAttachment(attach);
}
public static void AttachSaveWorkRequestRevision(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int workRequestID, int swrNo, string docType, string attachComments, bool newRevision, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
// TODO
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWRPhysicalPath);
if (!di.Exists)
di.Create();
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWR_RevPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
LTWorkRequestAttachment attach = new() {
WorkRequestID = workRequestID,
FileGUID = guid,
LTHoldStepID = -1,
FileName = fileName,
UploadedByID = userId,
DocType = docType,
Comments = attachComments
};
// InsertWorkRequestAttachment(attach);
if (newRevision)
lotTravelerDMO.InsertWorkRequestAttachmentRevision(attach);
else
lotTravelerDMO.InsertWorkRequestAttachment(attach);
}
public static void AttachSaveWorkRequest(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int workRequestID, int swrNo, string comments, string docType, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
// TODO
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWRPhysicalPath);
if (!di.Exists)
di.Create();
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWR_RevPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
LTWorkRequestAttachment attach = new() {
WorkRequestID = workRequestID,
FileGUID = guid,
LTHoldStepID = -1,
FileName = fileName,
UploadedByID = userId,
DocType = docType,
Comments = comments
};
lotTravelerDMO.InsertWorkRequestAttachment(attach);
}
public static void LotTravHoldStepAttachSaveRev(AppSettings appSettings, LotTravelerDMO lotTravelerDMO, int ltHoldStepID, int swrNo, string docType, int prevLotTravRevID, int newLotTravRevID, bool newRevision, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
// TODO
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
DirectoryInfo di;
var SWRPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWRPhysicalPath);
if (!di.Exists)
di.Create();
var SWR_RevPhysicalPath = appSettings.AttachmentFolder + @"LotTraveler\" + swrNo;
di = new DirectoryInfo(SWR_RevPhysicalPath);
if (!di.Exists)
di.Create();
var guid = Guid.NewGuid().ToString();
var physicalPath = Path.Combine(appSettings.AttachmentFolder + @"LotTraveler\" + swrNo + @"\", guid + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
LTLotTravAttachment attach = new() {
FileGUID = guid,
LTLotTravHoldStepID = ltHoldStepID,
LotTravelerRevisionID = newLotTravRevID,
FileName = fileName,
UploadedByID = userId,
DocType = docType
};
if (newRevision) {
try {
lotTravelerDMO.InsertLotTravLotHoldStepAttachmentRevision(attach);
} catch {
// roll back the revision creation
lotTravelerDMO.RestoreLotTravToPrevRevision(prevLotTravRevID, newLotTravRevID);
throw new Exception("There was a problem while creating the revision, Please logout and log back and then retry. \n If the problem persist please contact the Site Administrator");
}
} else
lotTravelerDMO.InsertLotTravLotHoldStepAttachment(attach);
}
}

View File

@ -1,314 +0,0 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class MRBHelper {
public static string NotifyApprovers(AppSettings appSettings, int mrbNumber, List<string> emailIst) {
string emailSentList = "";
string emailTemplate = "MRBAssigned.txt";
string userEmail = string.Empty;
string subject = "MRB Assignment";
string senderName = "MRB";
foreach (string email in emailIst) {
subject = "MRB Assignment";
EmailNotification en = new(appSettings, subject, emailTemplate);
string[] emailparams = new string[3];
emailparams[0] = mrbNumber.ToString();
emailparams[1] = mrbNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
userEmail = email;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
emailSentList += email + ",";
}
return emailSentList;
}
public static string ImportRemoveQDBFlag(AppSettings appSettings, MRB_DMO mrbDMO, string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
IEnumerable<string> lotDataList = null;
var guid = Guid.NewGuid().ToString();
var fileExtension = Path.GetExtension(fullFileName);
physicalPath = Path.Combine(appSettings.LotTempPipeLine, guid + "." + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
ExcelData x = new(physicalPath);
lotDataList = x.ReadQDBFlagData();
foreach (string lotData in lotDataList) {
mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation);
}
FileInfo f = new(physicalPath);
if (f.Exists)
f.Delete();
// Send the data to SPN
if (SendQDBFlagToSPN(appSettings, mrbDMO, guid, userIdentityName, a, b, c))
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
else {
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
return "Problems while uploading to SPN";
}
return string.Empty;
}
public static bool BatchFTP(AppSettings appSettings, string sourceFile, string destFile, string ftpLogDirectory, string userIdentityName, string a, string b, string c) {
FileInfo sourcefile = new(sourceFile);
try {
ProcessStartInfo psiFab1 = new();
Process procFab1 = new();
StringBuilder sb = new();
if (GlobalVars.DBConnection.ToUpper() == "TEST" || GlobalVars.DBConnection.ToUpper() == "QUALITY") {
psiFab1.FileName = a;
} else {
psiFab1.FileName = b;
}
psiFab1.Arguments = sourcefile.FullName + " " + destFile;
psiFab1.RedirectStandardOutput = true;
psiFab1.UseShellExecute = false;
psiFab1.WorkingDirectory = c;
procFab1.StartInfo = psiFab1;
procFab1.OutputDataReceived += (sender, args) => sb.AppendLine(args.Data);
;
procFab1.Start();
procFab1.BeginOutputReadLine();
procFab1.WaitForExit(4000);
File.WriteAllText(Path.Combine(ftpLogDirectory, sourcefile.Name + ".txt"), sb.ToString());
return true;
} catch (Exception e) {
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
return false;
}
}
public static bool SendQDBFlagToSPN(AppSettings appSettings, MRB_DMO mrbDMO, string guid, string userIdentityName, string a, string b, string c) {
StringBuilder output = new();
try {
IEnumerable<string> data = mrbDMO.GetMRB_QDB_HoldFlags(guid);
foreach (string tempData in data) {
output.Append(tempData.Trim() + Environment.NewLine);
}
try {
if (output.Length > 0) {
DateTime dt = DateTime.Now;
string newsourceFileName = "S" + dt.Day.ToString("00") + dt.Month.ToString("00") + dt.Year.ToString("00") + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
string newDestFileName = "S" + dt.Hour.ToString("00") + dt.Minute.ToString("00") + dt.Second.ToString("00") + ".mrb";
string outputFile = appSettings.HoldFlagDirectory + newsourceFileName;
File.WriteAllText(outputFile, output.ToString());
#if (DEBUG)
Thread.Sleep(1000);
#endif
try {
if (BatchFTP(appSettings, outputFile, newDestFileName, appSettings.SPNMRBHoldFlagFTPLogDirectory, userIdentityName, a, b, c)) {
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
} else {
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
}
} catch (Exception e) {
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " FTPToSPN(): FTP Upload Error " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
return false;
}
}
return true;
} catch (Exception e) {
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "MRB =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
return false;
}
} catch (Exception e) {
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "GUID =" + guid.ToString() + " SPN Hold Flag(SendToSPN) " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
Functions.WriteEvent(appSettings, userIdentityName + "\r\n Approve\r\n" + e.Message.ToString(), EventLogEntryType.Error);
EventLogDMO.Add(new WinEventLog() { IssueID = -1, UserID = userIdentityName, DocumentType = "MRB", OperationType = "Error", Comments = exceptionString });
return false;
}
}
public static string ImportAddQDBFlag(AppSettings appSettings, MRB_DMO mrbDMO, string operation, out string physicalPath, string userIdentityName, string a, string b, string c, string fullFileName, Stream stream) {
IEnumerable<string> lotDataList = null;
var guid = Guid.NewGuid().ToString();
var fileExtension = Path.GetExtension(fullFileName);
physicalPath = Path.Combine(appSettings.LotTempPipeLine, guid + "." + fileExtension);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
ExcelData x = new(physicalPath);
lotDataList = x.ReadQDBFlagData();
foreach (string lotData in lotDataList) {
mrbDMO.InsertMRB_QDB_HoldFlag(guid, lotData, operation);
}
FileInfo f = new(physicalPath);
if (f.Exists)
f.Delete();
if (SendQDBFlagToSPN(appSettings, mrbDMO, guid, userIdentityName, a, b, c))
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, true);
else {
mrbDMO.UpdateMRB_QDB_HoldFlag(guid, false);
return "Problems while uploading to SPN";
}
return string.Empty;
}
public static void AttachSave(AppSettings appSettings, MRB_DMO mrbDMO, int mrbNumber, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
string physicalFileName;
string physicalPath;
// Check to see if this filename is in use
var attachments = mrbDMO.GetMRBAttachments(mrbNumber);
if (attachments.Count() > 0) {
if (attachments.Count(a => string.Equals(a.FileName, fileName, StringComparison.OrdinalIgnoreCase)) > 0) {
// This filename is used on this MRB
// So we want to delete those records so the new record replaces them
foreach (var a in attachments) {
mrbDMO.DeleteMRBAttachment(a.AttachmentID);
physicalFileName = a.Path;
if (string.IsNullOrEmpty(physicalFileName))
physicalFileName = a.FileName;
physicalPath = Path.Combine(appSettings.AttachmentFolder + "MRB", physicalFileName);
if (File.Exists(physicalPath))
File.Delete(physicalPath);
}
}
}
physicalFileName = mrbNumber.ToString() + "_" + Guid.NewGuid().ToString() + Path.GetExtension(fileName);
physicalPath = Path.Combine(appSettings.AttachmentFolder + "MRB", physicalFileName);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
MRBAttachment attach = new() {
MRBNumber = mrbNumber,
FileName = fileName,
Path = physicalFileName,
#if (DEBUG)
UserID = 114,
#endif
#if (!DEBUG)
UserID = userId,
#endif
};
mrbDMO.InsertMRBAttachment(attach);
}
public static string ExcelLotOpen(MRB_DMO mrbDMO, int mrbNumber, StringBuilder warnings, IEnumerable<Disposition> dispos, string userIdentityName, string lotTempPipeLine, string fullFileName, Stream stream) {
var fileName = Path.GetFileName(fullFileName);
var fileExtension = Path.GetExtension(fullFileName);
string fName = userIdentityName + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString();
string physicalPath = Path.Combine(lotTempPipeLine, fName + "." + fileExtension);
IEnumerable<ExcelData.ExcelLotInfo> lotNumbers;
try {
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
ExcelData x = new(physicalPath);
lotNumbers = x.ReadData();
} catch (Exception ex) {
throw new Exception(string.Format("Invalid file format for {0}: {1}", fileName, ex.Message));
}
// Get Tool, Issue Start and End Date
MRB mrbInfo = mrbDMO.GetToolIssueStartEndDateData(mrbNumber, null);
foreach (var lotInfo in lotNumbers) {
if (lotInfo.LotDispo.Length == 1) {
if (dispos.Count(d => d.DispositionType.Trim().ToUpper() == lotInfo.LotDispo.Trim().ToUpper()) == 0) {
throw new Exception(string.Format("Invalid lot disposition {0} for lot no {1}",
lotInfo.LotDispo, lotInfo.LotNo));
}
}
}
// RJK - 12/17
// Only find the child Splits when a Tool or a list of Tools is provided
if (!mrbInfo.ToolCSV.ToUpper().Equals("NA")) {
foreach (var lotInfo in lotNumbers) {
bool existingLotUpdated;
Lot l = new();
l.LotNumber = lotInfo.LotNo ?? string.Empty;
if (lotInfo.LotDispo.Length == 1) {
l.DispoType = lotInfo.LotDispo[0];
}
l.MRBNumber = mrbNumber;
mrbDMO.InsertLot(l, true, out existingLotUpdated);
// cannot do the check below , because what if the parent lot had splits after the prior lot split analysis
if (!mrbDMO.InsertLotSplitsAffectedByIncident(mrbNumber, l.LotNumber, mrbInfo.ToolCSV, mrbInfo.IssueStartDate, mrbInfo.IssueEndDate)) {
warnings.AppendFormat("Lot number {0} is not affected by these tools and issue start/end time.\n Uploaded without Lot Genealogy tracing", l.LotNumber);
}
}
// Not required - Will be using each lot's Insert Date time stamp,
// as lot could be added using search functionality
// UpdateLastLotSplitAnalysisTime(mrbNumber);
} else {
// RJK - 12/17
// Only find the child Splits when a Tool or a list of Tools is provided
foreach (var lotInfo in lotNumbers) {
bool existingLotUpdated;
Lot l = new();
l.LotNumber = lotInfo.LotNo ?? string.Empty;
if (lotInfo.LotDispo.Length == 1) {
l.DispoType = lotInfo.LotDispo[0];
}
l.MRBNumber = mrbNumber;
// do not insert any new lots when importing from excel
mrbDMO.InsertLot(l, true, out existingLotUpdated);
}
}
FileInfo f = new(physicalPath);
if (f.Exists)
f.Delete();
return physicalPath;
}
}

View File

@ -1,49 +0,0 @@
using System.IO;
using Fab2ApprovalSystem.DMO;
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class PartsRequestHelper {
public static void SendEmailNotification(AppSettings appSettings, string username, string subject, int prNumber, string toEmail, string emailTemplate) {
string senderName = "Parts Request";
EmailNotification en = new(appSettings, subject);
string[] emailparams = new string[5];
emailparams[0] = prNumber.ToString();
emailparams[1] = prNumber.ToString();
emailparams[2] = GlobalVars.hostURL;
emailparams[3] = "Parts Request";
emailparams[4] = username;
string userEmail = toEmail;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
public static void AttachSave(AppSettings appSettings, PartsRequestDMO partsRequestDMO, int prNumber, int userId, string fullFileName, Stream stream) {
// Some browsers send file names with full path.
// We are only interested in the file name.
var fileName = Path.GetFileName(fullFileName);
string prFolderPath = appSettings.AttachmentFolder + "PartsRequest\\" + prNumber.ToString();
DirectoryInfo di = new(prFolderPath);
if (!di.Exists)
di.Create();
var physicalPath = Path.Combine(prFolderPath, fileName);
using (FileStream fileStream = new(physicalPath, FileMode.Create, FileAccess.Write)) {
stream.CopyTo(fileStream);
}
PartsRequestAttachment attach = new() {
PRNumber = prNumber,
FileName = fileName,
UserID = userId,
};
partsRequestDMO.InsertAttachment(attach);
}
}

View File

@ -1,22 +1,26 @@
#if !NET8
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Fab2ApprovalSystem.Misc {
public class SessionExpireFilterAttribute : ActionFilterAttribute {
public override void OnActionExecuting(ActionExecutingContext filterContext) {
namespace Fab2ApprovalSystem.Misc
{
public class SessionExpireFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
HttpSessionStateBase session = filterContext.HttpContext.Session;
HttpContext ctx = HttpContext.Current;
// check if session is supported
if (session[GlobalVars.SESSION_USERNAME] == null) {
if (session[GlobalVars.SESSION_USERNAME] == null)
{
// check if a new session id was generated
// this will force MVC to use the standard login redirect, enabling ReturnURL functionality
@ -28,9 +32,8 @@ namespace Fab2ApprovalSystem.Misc {
base.OnActionExecuting(filterContext);
}
}
}
#endif

View File

@ -1,26 +0,0 @@
using Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Misc;
public class TrainingHelper {
public static void NotifyTrainee(AppSettings appSettings, int userId, int assignmentId, int ecnId, string title, string recipient) {
string emailSentList = "";
string subject = string.Empty;
string userEmail = string.Empty;
string senderName = "ECN Training";
string emailTemplate = "ECNTrainingAssigned.txt";
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
EmailNotification en = new(appSettings, subject);
userEmail = recipient;
string[] emailparams = new string[4];
emailparams[0] = assignmentId.ToString();
emailparams[1] = ecnId.ToString();
emailparams[2] = GlobalVars.hostURL;
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
}
}

View File

@ -1,14 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Misc;
namespace Fab2ApprovalSystem.Misc
{
//public class UserProfileDTO
//{
// public int SysUserId { get; set; }
// public string UserName { get; set; }
// public string FullName { get; set; }
//}
public static class CollectionExtensions {
public static IEnumerable<T> SetValue<T>(this IEnumerable<T> items, Action<T> updateMethod) {
foreach (T item in items) {
public static class CollectionExtensions
{
public static IEnumerable<T> SetValue<T>(this IEnumerable<T> items, Action<T> updateMethod)
{
foreach (T item in items)
{
updateMethod(item);
}
return items;
}
}
}

View File

@ -1,24 +1,36 @@
using System.IO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
using System.IO;
namespace Fab2ApprovalSystem.Misc;
public class Zipper {
namespace Fab2ApprovalSystem.Misc
{
/// <summary>
///
/// </summary>
public class Zipper
{
/// <summary>
/// Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
/// </summary>
/// <param name="outPathname"></param>
/// <param name="folderName"></param>
public void CreateZip(string outPathname, string folderName) {
// TODO Try and Catch block
Directory.CreateDirectory(Path.GetDirectoryName(outPathname));
FileStream fsOut = File.Create(outPathname);
ZipOutputStream zipStream = new(fsOut);
ZipOutputStream zipStream = new ZipOutputStream(fsOut);
zipStream.SetLevel(3); // 0-9, 9 being the highest level of compression
zipStream.SetLevel(3); //0-9, 9 being the highest level of compression
//zipStream.Password = password; // optional. Null is the same as not setting. Required if using AES.
// This setting will strip the leading part of the folder path in the entries, to
// make the entries relative to the starting folder.
@ -34,17 +46,22 @@ public class Zipper {
/// <summary>
/// Recurses down the folder structure
/// </summary>
private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset) {
/// <param name="path"></param>
/// <param name="zipStream"></param>
/// <param name="folderOffset"></param>
private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)
{
// TODO Try and Catch block
string[] files = Directory.GetFiles(path);
foreach (string filename in files) {
FileInfo fi = new(filename);
foreach (string filename in files)
{
FileInfo fi = new FileInfo(filename);
string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
ZipEntry newEntry = new(entryName);
ZipEntry newEntry = new ZipEntry(entryName);
newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity
// Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
@ -63,15 +80,20 @@ public class Zipper {
// Zip the file in buffered chunks
// the "using" will close the stream even if an exception occurs
byte[] buffer = new byte[4096];
using (FileStream streamReader = File.OpenRead(filename)) {
using (FileStream streamReader = File.OpenRead(filename))
{
StreamUtils.Copy(streamReader, zipStream, buffer);
}
zipStream.CloseEntry();
}
string[] folders = Directory.GetDirectories(path);
foreach (string folder in folders) {
foreach (string folder in folders)
{
CompressFolder(folder, zipStream, folderOffset);
}
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,10 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Fab2ApprovalSystem.Models;
public class LoginModel {
namespace Fab2ApprovalSystem.Models
{
public class LoginModel
{
[Key]
public int UserID { get; set; }
@ -11,37 +12,107 @@ public class LoginModel {
[Display(Name = "Login ID")]
public string LoginID { get; set; }
//[Required]
[DataType(DataType.Password)]
[Display(Name = "Password")]
public string Password { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string FullName { get; set; }
public bool IsAdmin { get; set; }
public bool IsManager { get; set; }
public bool IsActive { get; set; }
public DateTime? LastLogin { get; set; }
public bool OOO { get; set; }
public DateTime? OOOStartDate { get; set; }
public DateTime? OOOExpirationDate { get; set; }
public int DelegatedTo { get; set; }
public string Email { get; set; }
[Display(Name = "Delegated To")]
[Display(Name="Delegated To")]
public string DelegatedToFullName { get; set; }
[Display(Name = "OOO Action")]
public virtual string OOOStatusWithUserID {
get {
public virtual string OOOStatusWithUserID
{
get
{
return UserID.ToString() + "~" + (OOO ? "1" : "0") + "~" + FullName;
}
}
}
public class UserProfile {
}
public class UserProfile
{
public int UserId { get; set; }
public string FullName { get; set; }
}
//public class ExternalLoginConfirmationViewModel
//{
// [Required]
// [Display(Name = "User name")]
// public string UserName { get; set; }
//}
//public class ManageUserViewModel
//{
// [Required]
// [DataType(DataType.Password)]
// [Display(Name = "Current password")]
// public string OldPassword { get; set; }
// [Required]
// [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
// [DataType(DataType.Password)]
// [Display(Name = "New password")]
// public string NewPassword { get; set; }
// [DataType(DataType.Password)]
// [Display(Name = "Confirm new password")]
// [Compare("NewPassword", ErrorMessage = "The new password and confirmation password do not match.")]
// public string ConfirmPassword { get; set; }
//}
//public class LoginViewModel
//{
// [Required]
// [Display(Name = "User name")]
// public string UserName { get; set; }
// [Required]
// [DataType(DataType.Password)]
// [Display(Name = "Password")]
// public string Password { get; set; }
// [Display(Name = "Remember me?")]
// public bool RememberMe { get; set; }
//}
//public class RegisterViewModel
//{
// [Required]
// [Display(Name = "User name")]
// public string UserName { get; set; }
// [Required]
// [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
// [DataType(DataType.Password)]
// [Display(Name = "Password")]
// public string Password { get; set; }
// [DataType(DataType.Password)]
// [Display(Name = "Confirm password")]
// [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
// public string ConfirmPassword { get; set; }
//}
}

View File

@ -1,42 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Models;
namespace Fab2ApprovalSystem.Models
{
//public class DocumentType
//{
//}
public class WorkFlow {
public class WorkFlow
{
}
}
public class Role {
public class Role
{
public int RoleID { get; set; }
public string RoleName { get; set; }
public List<SubRole> SubRoles { get; set; }
public Role() => SubRoles = new List<SubRole>();
}
public Role()
{
SubRoles = new List<SubRole>();
}
public class WorkFlowSteps {
}
}
public class SubRole {
public class WorkFlowSteps
{
}
public class SubRole
{
public int SubRoleID { get; set; }
public string SubRoleCategoryItem { get; set; }
public int RoleID { get; set; }
public bool Inactive { get; set; }
}
}
public class UserSubRole {
public class UserSubRole
{
}
public class ParentChildModel {
}
public class ParentChildModel
{
public int id { get; set; }
public int parentid { get; set; }
public string text { get; set; }
public string value { get; set; }
public List<ParentChildModel> Children = new();
public List<ParentChildModel> Children = new List<ParentChildModel>();
}
//public class TrainingGroup
//{
// public int TrainingGroupID { get; set; }
// public string TrainingGroupName { get; set; }
//}
}

View File

@ -1,11 +1,16 @@
namespace Fab2ApprovalSystem.Models;
public class AllUserModel {
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Models
{
public class AllUserModel
{
public string UserName { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string DisplayName { get; set; }
}
}

View File

@ -1,275 +0,0 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
namespace Fab2ApprovalSystem.Models;
public class AppSettings {
public AppSettings(string adminNotificationRecepient,
string apiBaseUrl,
string attachmentFolder,
string? attachmentUrl,
string caBlankFormsLocation,
string? company,
string dBConnection,
string dbConnectionString,
string emailTemplatesPath,
string ftpPassword,
string ftpSPNBatchFileName,
string ftpSPNBatchFileName_Test,
string ftpServer,
string ftpUser,
string holdFlagDirectory,
string hostURL,
string ifxContainer,
string ifxDomain,
bool isInfineonDomain,
string lotTempPipeLine,
string mesaTemplateFiles,
string nDriveURL,
string naContainer,
string naDomain,
string notificationSender,
string senderEmail,
string? smtpServer,
string spnMRBHoldFlagDirectory,
string spnMRBHoldFlagFTPLogDirectory,
string ssrSFolder,
string ssrSBindingsByConfiguration,
string ssrSBaseURL,
string ssrSDomain,
string ssrSUsername,
string ssrSPassword,
string testEmailRecipients,
string urls,
int userId,
bool userIsAdmin,
string wasmClientUrl,
string wsr_URL,
string? workingDirectoryName) {
AdminNotificationRecepient = adminNotificationRecepient;
ApiBaseUrl = apiBaseUrl;
AttachmentFolder = attachmentFolder;
AttachmentUrl = attachmentUrl;
CABlankFormsLocation = caBlankFormsLocation;
Company = company;
DBConnection = dBConnection;
DBConnectionString = dbConnectionString;
EmailTemplatesPath = emailTemplatesPath;
FTPPassword = ftpPassword;
FTPSPNBatchFileName = ftpSPNBatchFileName;
FTPSPNBatchFileName_Test = ftpSPNBatchFileName_Test;
FTPServer = ftpServer;
FTPUser = ftpUser;
HoldFlagDirectory = holdFlagDirectory;
HostURL = hostURL;
IFXContainer = ifxContainer;
IFXDomain = ifxDomain;
IsInfineonDomain = isInfineonDomain;
LotTempPipeLine = lotTempPipeLine;
MesaTemplateFiles = mesaTemplateFiles;
NDriveURL = nDriveURL;
NAContainer = naContainer;
NADomain = naDomain;
NotificationSender = notificationSender;
SenderEmail = senderEmail;
SMTPServer = smtpServer;
SPNMRBHoldFlagDirectory = spnMRBHoldFlagDirectory;
SPNMRBHoldFlagFTPLogDirectory = spnMRBHoldFlagFTPLogDirectory;
TestEmailRecipients = testEmailRecipients;
SSRSFolder = ssrSFolder;
SSRSBindingsByConfiguration = ssrSBindingsByConfiguration;
SSRSBaseURL = ssrSBaseURL;
SSRSDomain = ssrSDomain;
SSRSUsername = ssrSUsername;
SSRSPassword = ssrSPassword;
URLs = urls;
UserId = userId;
UserIsAdmin = userIsAdmin;
WSR_URL = wsr_URL;
WasmClientUrl = wasmClientUrl;
WorkingDirectoryName = workingDirectoryName;
}
public string AdminNotificationRecepient { get; }
public string ApiBaseUrl { get; }
public string AttachmentFolder { get; }
public string? AttachmentUrl { get; }
public string CABlankFormsLocation { get; }
public string? Company { get; }
public string DBConnection { get; }
public string DBConnectionString { get; }
public string EmailTemplatesPath { get; }
public string FTPPassword { get; }
public string FTPSPNBatchFileName { get; }
public string FTPSPNBatchFileName_Test { get; }
public string FTPServer { get; }
public string FTPUser { get; }
public string HoldFlagDirectory { get; }
public string HostURL { get; }
public string IFXContainer { get; }
public string IFXDomain { get; }
public bool IsInfineonDomain { get; }
public string LotTempPipeLine { get; }
public string MesaTemplateFiles { get; }
public string NAContainer { get; }
public string NADomain { get; }
public string NDriveURL { get; }
public string NotificationSender { get; }
public string SenderEmail { get; }
public string? SMTPServer { get; }
public string SPNMRBHoldFlagDirectory { get; }
public string SPNMRBHoldFlagFTPLogDirectory { get; }
public string SSRSFolder { get; }
public string SSRSBindingsByConfiguration { get; }
public string SSRSBaseURL { get; }
public string SSRSDomain { get; }
public string SSRSUsername { get; }
public string SSRSPassword { get; }
public string TestEmailRecipients { get; }
public string URLs { get; }
public int UserId { get; }
public bool UserIsAdmin { get; }
public string WasmClientUrl { get; }
public string WSR_URL { get; }
public string? WorkingDirectoryName { get; }
#if NET8
public static AppSettings Get(Microsoft.Extensions.Configuration.IConfigurationRoot configurationRoot) {
AppSettings? result;
try {
#pragma warning disable IL3050, IL2026
result = Microsoft.Extensions.Configuration.ConfigurationBinder.Get<AppSettings>(configurationRoot) ?? throw new Exception();
#pragma warning restore IL3050, IL2026
} catch (Exception) {
List<string> paths = [];
foreach (Microsoft.Extensions.Configuration.IConfigurationProvider configurationProvider in configurationRoot.Providers) {
if (configurationProvider is not Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider jsonConfigurationProvider)
continue;
if (jsonConfigurationProvider.Source.FileProvider is not Microsoft.Extensions.FileProviders.PhysicalFileProvider physicalFileProvider)
continue;
paths.Add(physicalFileProvider.Root);
}
throw new NotSupportedException($"Not found!{Environment.NewLine}{string.Join(Environment.NewLine, paths.Distinct())}");
}
return result;
}
#endif
internal static AppSettings LoadConfigurationManager() {
AppSettings result;
try {
int userId = 0;
string adminNotificationRecepient = ConfigurationManager.AppSettings["Admin Notification Recepient"] ??
throw new ArgumentNullException("Admin Notification Recepient environment variable not found");
string attachmentFolder = ConfigurationManager.AppSettings["AttachmentFolder"] ??
throw new ArgumentNullException("AttachmentFolder environment variable not found");
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"] ??
throw new ArgumentNullException("EmailTemplatesPath environment variable not found");
string ftpPassword = ConfigurationManager.AppSettings["FTP Password"] ??
throw new ArgumentNullException("FTP Password environment variable not found");
string ftpServer = ConfigurationManager.AppSettings["FTP Server"] ??
throw new ArgumentNullException("FTP Server environment variable not found");
string ftpSPNBatchFileName = ConfigurationManager.AppSettings["FTPSPNBatchFileName"] ??
throw new ArgumentNullException("FTPSPNBatchFileName environment variable not found");
string ftpSPNBatchFileName_Test = ConfigurationManager.AppSettings["FTPSPNBatchFileName_Test"] ??
throw new ArgumentNullException("FTPSPNBatchFileName_Test environment variable not found");
string ftpUser = ConfigurationManager.AppSettings["FTP User"] ??
throw new ArgumentNullException("FTP User environment variable not found");
string holdFlagDirectory = ConfigurationManager.AppSettings["HoldFlagDirectory"] ??
throw new ArgumentNullException("HoldFlagDirectory environment variable not found");
string ifxContainer = ConfigurationManager.AppSettings["IFXContainer"] ??
throw new ArgumentNullException("IFXContainer environment variable not found");
string ifxDomain = ConfigurationManager.AppSettings["IFXDomain"] ??
throw new ArgumentNullException("IFXDomain environment variable not found");
string lotTempPipeLine = ConfigurationManager.AppSettings["LotTempPipeLine"] ??
throw new ArgumentNullException("LotTempPipeLine environment variable not found");
string naContainer = ConfigurationManager.AppSettings["NAContainer"] ??
throw new ArgumentNullException("NAContainer environment variable not found");
string naDomain = ConfigurationManager.AppSettings["NADomain"] ??
throw new ArgumentNullException("NADomain environment variable not found");
string notificationSender = ConfigurationManager.AppSettings["Notification Sender"] ??
throw new ArgumentNullException("Notification Sender environment variable not found");
string spnMRBHoldFlagDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagDirectory"] ??
throw new ArgumentNullException("SPNMRBHoldFlagDirectory environment variable not found");
string spnMRBHoldFlagFTPLogDirectory = ConfigurationManager.AppSettings["SPNMRBHoldFlagFTPLogDirectory"] ??
throw new ArgumentNullException("SPNMRBHoldFlagFTPLogDirectory environment variable not found");
string ssrSFolder = ConfigurationManager.AppSettings["SSRSFolder"] ??
throw new ArgumentNullException("SSRSFolder environment variable not found");
string ssrSBindingsByConfiguration = ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"] ??
throw new ArgumentNullException("SSRSBindingsByConfiguration environment variable not found");
string ssrSBaseURL = ConfigurationManager.AppSettings["SSRSBaseURL"] ??
throw new ArgumentNullException("SSRSBaseURL environment variable not found");
string ssrSDomain = ConfigurationManager.AppSettings["SSRSDomain"] ??
throw new ArgumentNullException("SSRSDomain environment variable not found");
string ssrSUsername = ConfigurationManager.AppSettings["SSRSUsername"] ??
throw new ArgumentNullException("SSRSUsername environment variable not found");
string ssrSPassword = ConfigurationManager.AppSettings["SSRSPassword"] ??
throw new ArgumentNullException("SSRSPassword environment variable not found");
string testEmailRecipients = ConfigurationManager.AppSettings["Test Email Recipients"] ??
throw new ArgumentNullException("Test Email Recipients environment variable not found");
string apiBaseUrl = Environment.GetEnvironmentVariable("FabApprovalApiBaseUrl") ??
throw new ArgumentNullException("FabApprovalApiBaseUrl environment variable not found");
string? attachmentUrl = ConfigurationManager.AppSettings["AttachmentUrl"]?.ToString();
string? company = ConfigurationManager.AppSettings["Company"]?.ToString();
string? smtpServer = ConfigurationManager.AppSettings["SMTP Server"]?.ToString();
string? urls = ConfigurationManager.AppSettings["URLs"]?.ToString();
string? workingDirectoryName = ConfigurationManager.AppSettings["WorkingDirectoryName"]?.ToString();
string wasmClientUrl = Environment.GetEnvironmentVariable("FabApprovalWasmClientUrl") ??
"https://localhost:7255";
result = new(adminNotificationRecepient: adminNotificationRecepient,
apiBaseUrl: apiBaseUrl,
attachmentFolder: attachmentFolder,
attachmentUrl: attachmentUrl,
caBlankFormsLocation: Misc.GlobalVars.CA_BlankFormsLocation,
company: company,
dBConnection: Misc.GlobalVars.DBConnection,
dbConnectionString: Misc.GlobalVars.DB_CONNECTION_STRING,
emailTemplatesPath: emailTemplatesPath,
ftpPassword: ftpPassword,
ftpServer: ftpServer,
ftpSPNBatchFileName: ftpSPNBatchFileName,
ftpSPNBatchFileName_Test: ftpSPNBatchFileName_Test,
ftpUser: ftpUser,
holdFlagDirectory: holdFlagDirectory,
hostURL: Misc.GlobalVars.hostURL,
ifxContainer: ifxContainer,
ifxDomain: ifxDomain,
isInfineonDomain: Misc.GlobalVars.IS_INFINEON_DOMAIN,
lotTempPipeLine: lotTempPipeLine,
mesaTemplateFiles: Misc.GlobalVars.MesaTemplateFiles,
naContainer: naContainer,
naDomain: naDomain,
nDriveURL: Misc.GlobalVars.NDriveURL,
notificationSender: notificationSender,
senderEmail: Misc.GlobalVars.SENDER_EMAIL,
smtpServer: smtpServer,
spnMRBHoldFlagDirectory: spnMRBHoldFlagDirectory,
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
testEmailRecipients: testEmailRecipients,
ssrSFolder: ssrSFolder,
ssrSBindingsByConfiguration: ssrSBindingsByConfiguration,
ssrSBaseURL: ssrSBaseURL,
ssrSDomain: ssrSDomain,
ssrSUsername: ssrSUsername,
ssrSPassword: ssrSPassword,
urls: urls,
userId: userId,
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
wasmClientUrl: wasmClientUrl,
wsr_URL: Misc.GlobalVars.WSR_URL,
workingDirectoryName: workingDirectoryName);
return result;
} catch (Exception ex) {
Misc.Functions.WriteEvent(null, "LoadConfigurationManager - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
throw;
}
}
}

View File

@ -1,6 +1,12 @@
namespace Fab2ApprovalSystem.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
public class ApprovalLog {
namespace Fab2ApprovalSystem.Models
{
public class ApprovalLog
{
public int ApprovalLogID;
public int IssueID;
@ -10,4 +16,5 @@ public class ApprovalLog {
public string OperationLog;
public int DocumentTypeID;
}
}

View File

@ -1,15 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
namespace Fab2ApprovalSystem.Models;
public class ApprovalLogHistory {
namespace Fab2ApprovalSystem.Models
{
public class ApprovalLogHistory
{
public int ApprovalLogID { get; set; }
public string FullName { get; set; }
public string Operation { get; set; }
public string SubRole { get; set; }
//[Display(Name = "Operation Time")]
public DateTime OperationTime { get; set; }
public string Comments { get; set; }
}
}

View File

@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Fab2ApprovalSystem.Models;
public class ApproveListModel {
namespace Fab2ApprovalSystem.Models
{
public class ApproveListModel
{
public int ApprovalKey { get; set; }
public int IssueID { get; set; }
public string AssignedName { get; set; }
@ -15,4 +18,5 @@ public class ApproveListModel {
public string DocType { get; set; }
public string Title { get; set; }
}
}

View File

@ -1,21 +0,0 @@
using System.Collections.Generic;
namespace Fab2ApprovalSystem.Models;
public class AuditEdit {
public Audit Audit { get; set; }
public IEnumerable<AuditedArea> AuditAreaList { get; set; }
public List<string> AuditeeNames { get; set; }
public List<AuditFindingCategory> AuditFindingCategoryList { get; set; }
public IEnumerable<Auditor> AuditorList { get; set; }
public IEnumerable<AuditType> AuditTypeList { get; set; }
public IEnumerable<CANoList> CANoList { get; set; }
public string Is8DQA { get; set; }
public bool IsAdmin { get; set; }
public bool IsSubmitter { get; set; }
public List<AllUserModel> MesaUsers { get; set; }
public IEnumerable<CAUserList> UserList { get; set; }
public bool RedirectToAction { get; set; }
}

View File

@ -1,9 +1,7 @@
namespace Fab2ApprovalSystem.Models;
public class AuthAttempt {
namespace Fab2ApprovalSystem.Models {
public class AuthAttempt {
public string LoginID { get; set; }
public string Password { get; set; } = "";
public AuthTokens AuthTokens { get; set; }
}
}

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