Tasks 184281, 184799, 184800, 184801 and 184802
Align .editorconfig files Move Controller logic to DMO classes GlobalVars.AppSettings = Models.AppSettings.GetFromConfigurationManager(); Question EditorConfig Project level editorconfig Format White Spaces AppSetting when EnvironmentVariable not set Corrective Actions Tests Schedule Actions Tests DMO Tests Controller Tests Get ready to use VSCode IDE
This commit is contained in:
parent
538b1f817e
commit
b1c6903c1c
380
Fab2ApprovalMKLink/.editorconfig
Normal file
380
Fab2ApprovalMKLink/.editorconfig
Normal file
@ -0,0 +1,380 @@
|
|||||||
|
[*.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_inferred_anonymous_type_member_names = false:warning # Question
|
||||||
|
dotnet_style_prefer_is_null_check_over_reference_equality_method = false # Question
|
1
Fab2ApprovalMKLink/.vscode/format-report.json
vendored
Normal file
1
Fab2ApprovalMKLink/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
33
Fab2ApprovalMKLink/.vscode/launch.json
vendored
Normal file
33
Fab2ApprovalMKLink/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{
|
||||||
|
// 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}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
37
Fab2ApprovalMKLink/.vscode/mklink.md
vendored
Normal file
37
Fab2ApprovalMKLink/.vscode/mklink.md
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# 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"
|
||||||
|
```
|
424
Fab2ApprovalMKLink/.vscode/settings.json
vendored
Normal file
424
Fab2ApprovalMKLink/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,424 @@
|
|||||||
|
{
|
||||||
|
"[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"
|
||||||
|
]
|
||||||
|
}
|
109
Fab2ApprovalMKLink/.vscode/tasks.json
vendored
Normal file
109
Fab2ApprovalMKLink/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
51
Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj
Normal file
51
Fab2ApprovalMKLink/Fab2ApprovalMKLink.csproj
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
<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>
|
||||||
|
<PackageReference Include="Dapper.Contrib" Version="2.0.78" />
|
||||||
|
<PackageReference Include="Dapper" Version="2.1.44" />
|
||||||
|
<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>
|
77
Fab2ApprovalMKLink/Program.cs
Normal file
77
Fab2ApprovalMKLink/Program.cs
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
380
Fab2ApprovalSystem/.editorconfig
Normal file
380
Fab2ApprovalSystem/.editorconfig
Normal file
@ -0,0 +1,380 @@
|
|||||||
|
[*.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
|
1
Fab2ApprovalSystem/.vscode/format-report.json
vendored
Normal file
1
Fab2ApprovalSystem/.vscode/format-report.json
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
30
Fab2ApprovalSystem/.vscode/launch.json
vendored
Normal file
30
Fab2ApprovalSystem/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
// 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}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
424
Fab2ApprovalSystem/.vscode/settings.json
vendored
Normal file
424
Fab2ApprovalSystem/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,424 @@
|
|||||||
|
{
|
||||||
|
"[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"
|
||||||
|
]
|
||||||
|
}
|
20
Fab2ApprovalSystem/.vscode/tasks.json
vendored
Normal file
20
Fab2ApprovalSystem/.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
31
Fab2ApprovalSystem/App_Start/.editorconfig
Normal file
31
Fab2ApprovalSystem/App_Start/.editorconfig
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
#### .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
|
@ -1,13 +1,11 @@
|
|||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Optimization;
|
using System.Web.Optimization;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem
|
namespace Fab2ApprovalSystem;
|
||||||
{
|
|
||||||
public class BundleConfig
|
public class BundleConfig {
|
||||||
{
|
|
||||||
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
|
// 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(
|
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
|
||||||
"~/Scripts/jquery-{version}.js",
|
"~/Scripts/jquery-{version}.js",
|
||||||
"~/Scripts/jquery-ui-{version}.js")
|
"~/Scripts/jquery-ui-{version}.js")
|
||||||
@ -30,7 +28,6 @@ namespace Fab2ApprovalSystem
|
|||||||
"~/Scripts/respond.min.js",
|
"~/Scripts/respond.min.js",
|
||||||
"~/Scripts/common.js"));
|
"~/Scripts/common.js"));
|
||||||
|
|
||||||
|
|
||||||
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
|
bundles.Add(new ScriptBundle("~/bundles/kendo").Include(
|
||||||
"~/Scripts/kendo/kendo.all.min.js",
|
"~/Scripts/kendo/kendo.all.min.js",
|
||||||
"~/Scripts/kendo/kendo.aspnetmvc.min.js"));
|
"~/Scripts/kendo/kendo.aspnetmvc.min.js"));
|
||||||
@ -45,7 +42,6 @@ namespace Fab2ApprovalSystem
|
|||||||
"~/Scripts/jqwidgets/styles/jqx.arctic.css",
|
"~/Scripts/jqwidgets/styles/jqx.arctic.css",
|
||||||
"~/Scripts/jqwidgets/styles/jqx.energyblue.css"));
|
"~/Scripts/jqwidgets/styles/jqx.energyblue.css"));
|
||||||
|
|
||||||
|
|
||||||
bundles.Add(new ScriptBundle("~/Content/jqw/jq").Include(
|
bundles.Add(new ScriptBundle("~/Content/jqw/jq").Include(
|
||||||
"~/Scripts/jqwidgets/jqxcore.js",
|
"~/Scripts/jqwidgets/jqxcore.js",
|
||||||
"~/Scripts/jqwidgets/jqxdata.js",
|
"~/Scripts/jqwidgets/jqxdata.js",
|
||||||
@ -55,12 +51,8 @@ namespace Fab2ApprovalSystem
|
|||||||
"~/Scripts/jqwidgets/jqxpanel.js",
|
"~/Scripts/jqwidgets/jqxpanel.js",
|
||||||
"~/Scripts/jqwidgets/jqxtree.js"));
|
"~/Scripts/jqwidgets/jqxtree.js"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.min.css",
|
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/bootstrap.min.css",
|
||||||
"~/Content/site.css",
|
"~/Content/site.css",
|
||||||
"~/Content/jquery-ui.css"));
|
"~/Content/jquery-ui.css"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem
|
namespace Fab2ApprovalSystem;
|
||||||
{
|
|
||||||
public class FilterConfig
|
public class FilterConfig {
|
||||||
{
|
public static void RegisterGlobalFilters(GlobalFilterCollection filters) {
|
||||||
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
|
|
||||||
{
|
|
||||||
filters.Add(new HandleErrorAttribute());
|
filters.Add(new HandleErrorAttribute());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -6,12 +6,10 @@ using System.Web.Http;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem
|
namespace Fab2ApprovalSystem;
|
||||||
{
|
|
||||||
public class RouteConfig
|
public class RouteConfig {
|
||||||
{
|
public static void RegisterRoutes(RouteCollection routes) {
|
||||||
public static void RegisterRoutes(RouteCollection routes)
|
|
||||||
{
|
|
||||||
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
|
||||||
|
|
||||||
routes.MapRoute(
|
routes.MapRoute(
|
||||||
@ -29,4 +27,3 @@ namespace Fab2ApprovalSystem
|
|||||||
//);
|
//);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
using Microsoft.AspNet.Identity;
|
using Microsoft.AspNet.Identity;
|
||||||
using Microsoft.Owin;
|
using Microsoft.Owin;
|
||||||
using Microsoft.Owin.Security.Cookies;
|
using Microsoft.Owin.Security.Cookies;
|
||||||
|
|
||||||
using Owin;
|
using Owin;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem
|
namespace Fab2ApprovalSystem;
|
||||||
{
|
|
||||||
public partial class Startup
|
public partial class Startup {
|
||||||
{
|
|
||||||
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
|
// 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
|
// 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,
|
AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
|
||||||
LoginPath = new PathString("/Account/Login")
|
LoginPath = new PathString("/Account/Login")
|
||||||
});
|
});
|
||||||
@ -35,4 +33,3 @@ namespace Fab2ApprovalSystem
|
|||||||
//app.UseGoogleAuthentication();
|
//app.UseGoogleAuthentication();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem {
|
namespace Fab2ApprovalSystem;
|
||||||
public static class WebApiConfig
|
|
||||||
{
|
public static class WebApiConfig {
|
||||||
public static void Register(HttpConfiguration config)
|
public static void Register(HttpConfiguration config) {
|
||||||
{
|
|
||||||
config.MapHttpAttributeRoutes();
|
config.MapHttpAttributeRoutes();
|
||||||
|
|
||||||
config.Routes.MapHttpRoute(
|
config.Routes.MapHttpRoute(
|
||||||
@ -14,4 +13,3 @@ namespace Fab2ApprovalSystem {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
31
Fab2ApprovalSystem/Controllers/.editorconfig
Normal file
31
Fab2ApprovalSystem/Controllers/.editorconfig
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
|
||||||
|
#### .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
|
@ -1,23 +1,27 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Net;
|
||||||
|
using System.Net.Http;
|
||||||
using System.Security.Claims;
|
using System.Security.Claims;
|
||||||
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
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;
|
||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
using Microsoft.Owin.Security;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using System.Web.Security;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
|
||||||
using Microsoft.AspNet.Identity.Owin;
|
using Microsoft.AspNet.Identity.Owin;
|
||||||
using System.Net.Http;
|
using Microsoft.Owin.Security;
|
||||||
using Newtonsoft.Json;
|
|
||||||
using System.Text;
|
using Newtonsoft.Json;
|
||||||
using System.Net;
|
|
||||||
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers {
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
public class AccountController : Controller {
|
public class AccountController : Controller {
|
||||||
private string _apiBaseUrl;
|
private string _apiBaseUrl;
|
||||||
@ -44,6 +48,20 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SetSessionParameters(LoginResult loginResult, LoginModel user) {
|
||||||
|
Session["JWT"] = loginResult.AuthTokens.JwtToken;
|
||||||
|
Session["RefreshToken"] = loginResult.AuthTokens.RefreshToken;
|
||||||
|
|
||||||
|
Session[GlobalVars.SESSION_USERID] = user.UserID;
|
||||||
|
Session[GlobalVars.SESSION_USERNAME] = user.FullName;
|
||||||
|
Session[GlobalVars.IS_ADMIN] = user.IsAdmin;
|
||||||
|
Session[GlobalVars.IS_MANAGER] = user.IsManager;
|
||||||
|
Session[GlobalVars.OOO] = user.OOO;
|
||||||
|
Session[GlobalVars.CAN_CREATE_PARTS_REQUEST] = user.IsAdmin || PartsRequestController.CanCreatePartsRequest(user.UserID);
|
||||||
|
|
||||||
|
FormsAuthentication.SetAuthCookie(user.LoginID, true);
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ValidateAntiForgeryToken]
|
[ValidateAntiForgeryToken]
|
||||||
@ -54,25 +72,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
HttpClient httpClient = HttpClientFactory.Create();
|
HttpClient httpClient = HttpClientFactory.Create();
|
||||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||||
|
|
||||||
AuthAttempt authAttempt = new AuthAttempt() {
|
LoginResult loginResult = await AccountDMO.LoginAsync(httpClient, model);
|
||||||
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)
|
#if (DEBUG)
|
||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
@ -88,7 +88,8 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
} else {
|
} else {
|
||||||
isLoginValid = loginResult.IsAuthenticated;
|
isLoginValid = loginResult.IsAuthenticated;
|
||||||
if (isLoginValid) isIFX = true;
|
if (isLoginValid)
|
||||||
|
isIFX = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,17 +99,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
LoginModel user = userDMO.GetUser(model.LoginID);
|
LoginModel user = userDMO.GetUser(model.LoginID);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Session["JWT"] = loginResult.AuthTokens.JwtToken;
|
SetSessionParameters(loginResult, user);
|
||||||
Session["RefreshToken"] = loginResult.AuthTokens.RefreshToken;
|
|
||||||
|
|
||||||
Session[GlobalVars.SESSION_USERID] = user.UserID;
|
|
||||||
Session[GlobalVars.SESSION_USERNAME] = user.FullName;
|
|
||||||
Session[GlobalVars.IS_ADMIN] = user.IsAdmin;
|
|
||||||
Session[GlobalVars.IS_MANAGER] = user.IsManager;
|
|
||||||
Session[GlobalVars.OOO] = user.OOO;
|
|
||||||
Session[GlobalVars.CAN_CREATE_PARTS_REQUEST] = user.IsAdmin || PartsRequestController.CanCreatePartsRequest(user.UserID);
|
|
||||||
|
|
||||||
FormsAuthentication.SetAuthCookie(user.LoginID, true);
|
|
||||||
|
|
||||||
return RedirectToLocal(returnUrl);
|
return RedirectToLocal(returnUrl);
|
||||||
} else {
|
} else {
|
||||||
@ -118,14 +109,13 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
ModelState.AddModelError("", "The user name or password provided is incorrect.");
|
ModelState.AddModelError("", "The user name or password provided is incorrect.");
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Functions.WriteEvent(@User.Identity.Name + " " + ex.InnerException, System.Diagnostics.EventLogEntryType.Error);
|
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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = 99999, UserID = @User.Identity.Name, DocumentType = "Login", OperationType = "Error", Comments = "Reject - " + ex.Message });
|
||||||
ModelState.AddModelError("", ex.Message);
|
ModelState.AddModelError("", ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return View(model);
|
return View(model);
|
||||||
// If we got this far, something failed, redisplay form
|
// If we got this far, something failed, redisplay form
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -137,20 +127,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
HttpClient httpClient = HttpClientFactory.Create();
|
HttpClient httpClient = HttpClientFactory.Create();
|
||||||
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
httpClient.BaseAddress = new Uri(_apiBaseUrl);
|
||||||
|
|
||||||
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, "auth/refresh");
|
LoginResult loginResult = await AccountDMO.ExternalAuthSetupAsync(httpClient, authAttempt);
|
||||||
|
|
||||||
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)
|
#if (DEBUG)
|
||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
@ -166,7 +143,8 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
isLoginValid = true;
|
isLoginValid = true;
|
||||||
} else {
|
} else {
|
||||||
isLoginValid = loginResult.IsAuthenticated;
|
isLoginValid = loginResult.IsAuthenticated;
|
||||||
if (isLoginValid) isIFX = true;
|
if (isLoginValid)
|
||||||
|
isIFX = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,17 +154,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
LoginModel user = userDMO.GetUser(authAttempt.LoginID);
|
LoginModel user = userDMO.GetUser(authAttempt.LoginID);
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
Session["JWT"] = loginResult.AuthTokens.JwtToken;
|
SetSessionParameters(loginResult, user);
|
||||||
Session["RefreshToken"] = loginResult.AuthTokens.RefreshToken;
|
|
||||||
|
|
||||||
Session[GlobalVars.SESSION_USERID] = user.UserID;
|
|
||||||
Session[GlobalVars.SESSION_USERNAME] = user.FullName;
|
|
||||||
Session[GlobalVars.IS_ADMIN] = user.IsAdmin;
|
|
||||||
Session[GlobalVars.IS_MANAGER] = user.IsManager;
|
|
||||||
Session[GlobalVars.OOO] = user.OOO;
|
|
||||||
Session[GlobalVars.CAN_CREATE_PARTS_REQUEST] = user.IsAdmin || PartsRequestController.CanCreatePartsRequest(user.UserID);
|
|
||||||
|
|
||||||
FormsAuthentication.SetAuthCookie(user.LoginID, true);
|
|
||||||
|
|
||||||
return new HttpResponseMessage(HttpStatusCode.OK);
|
return new HttpResponseMessage(HttpStatusCode.OK);
|
||||||
} else {
|
} else {
|
||||||
@ -200,7 +168,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
|
return new HttpResponseMessage(HttpStatusCode.Unauthorized);
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Functions.WriteEvent(@User.Identity.Name + " " + ex.InnerException, System.Diagnostics.EventLogEntryType.Error);
|
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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = 99999, UserID = @User.Identity.Name, DocumentType = "Login", OperationType = "Error", Comments = "Reject - " + ex.Message });
|
||||||
ModelState.AddModelError("", ex.Message);
|
ModelState.AddModelError("", ex.Message);
|
||||||
|
|
||||||
@ -364,4 +332,3 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,178 +1,100 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
{
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class AdminController : Controller
|
public class AdminController : Controller {
|
||||||
{
|
|
||||||
// GET: /Admin/
|
// GET: /Admin/
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
LotDispositionDMO ldDMO;
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
/// <summary>
|
public AdminController(AppSettings appSettings) {
|
||||||
///
|
_AppSettings = appSettings;
|
||||||
/// </summary>
|
ldDMO = new LotDispositionDMO(appSettings);
|
||||||
/// <returns></returns>
|
}
|
||||||
public ActionResult Index()
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
public ActionResult Index() {
|
||||||
{
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
var model = userDMO.GetAllUsers();
|
var model = userDMO.GetAllUsers();
|
||||||
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
|
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult AssignRoles() {
|
||||||
///
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult AssignRoles()
|
|
||||||
{
|
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
|
||||||
{
|
|
||||||
ViewBag.ToplevelNode = GetRoles_SubRolesList();
|
ViewBag.ToplevelNode = GetRoles_SubRolesList();
|
||||||
return View();
|
return View();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("Not Autthorized");
|
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();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllActiveUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// For the Administration of the Users
|
/// For the Administration of the Users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request"></param>
|
public ActionResult GetGridUserList([DataSourceRequest] DataSourceRequest request) {
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult GetGridUserList([DataSourceRequest] DataSourceRequest request)
|
|
||||||
{
|
|
||||||
return Json(userDMO.GetAllUsers().ToDataSourceResult(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);
|
IEnumerable<LoginModel> userlist = adminDMO.GetAllUsersBySubRole(subRole);
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public JsonResult AllSubRoles(string showInactiveRoles = "") {
|
||||||
///
|
List<ParentChildModel> newRoles = adminDMO.GetAllSubRoles(showInactiveRoles);
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public JsonResult AllSubRoles(string showInactiveRoles = "")
|
|
||||||
{
|
|
||||||
List<Role> roles = adminDMO.GetSubRoles();
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
return Json(newRoles, JsonRequestBehavior.AllowGet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetSubRoleListByUserId([DataSourceRequest] DataSourceRequest request, string userId)
|
public ActionResult GetSubRoleListByUserId([DataSourceRequest] DataSourceRequest request, string userId) {
|
||||||
{
|
|
||||||
int userIdInt = Convert.ToInt32(userId);
|
int userIdInt = Convert.ToInt32(userId);
|
||||||
|
|
||||||
return Json(adminDMO.GetUserSubRoles(userIdInt).ToDataSourceResult(request));
|
return Json(adminDMO.GetUserSubRoles(userIdInt).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
|
///OBSOLETE FUNCTION BELOW FOR THE KENDO TREEVIEW
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList() {
|
||||||
private IEnumerable<TreeViewItemModel> GetRoles_SubRolesList()
|
|
||||||
{
|
|
||||||
|
|
||||||
List<Role> roles = adminDMO.GetSubRoles();
|
List<Role> roles = adminDMO.GetSubRoles();
|
||||||
|
|
||||||
|
|
||||||
List<TreeViewItemModel> ToplevelNode = new List<TreeViewItemModel>();
|
List<TreeViewItemModel> ToplevelNode = new List<TreeViewItemModel>();
|
||||||
List<TreeViewItemModel> parentList = new List<TreeViewItemModel>();
|
List<TreeViewItemModel> parentList = new List<TreeViewItemModel>();
|
||||||
List<TreeViewItemModel> childList = new List<TreeViewItemModel>();
|
List<TreeViewItemModel> childList = new List<TreeViewItemModel>();
|
||||||
|
|
||||||
|
|
||||||
TreeViewItemModel parent = new TreeViewItemModel();
|
TreeViewItemModel parent = new TreeViewItemModel();
|
||||||
TreeViewItemModel child = new TreeViewItemModel();
|
TreeViewItemModel child = new TreeViewItemModel();
|
||||||
|
|
||||||
|
foreach (Role r in roles) {
|
||||||
foreach (Role r in roles)
|
|
||||||
{
|
|
||||||
parent = new TreeViewItemModel();
|
parent = new TreeViewItemModel();
|
||||||
parent.HasChildren = true;
|
parent.HasChildren = true;
|
||||||
parent.Text = r.RoleName;
|
parent.Text = r.RoleName;
|
||||||
parent.Id = r.RoleID.ToString();
|
parent.Id = r.RoleID.ToString();
|
||||||
|
|
||||||
|
foreach (SubRole sr in r.SubRoles) {
|
||||||
foreach (SubRole sr in r.SubRoles)
|
|
||||||
{
|
|
||||||
child = new TreeViewItemModel();
|
child = new TreeViewItemModel();
|
||||||
child.Text = sr.SubRoleCategoryItem;
|
child.Text = sr.SubRoleCategoryItem;
|
||||||
child.Id = sr.SubRoleID.ToString();
|
child.Id = sr.SubRoleID.ToString();
|
||||||
@ -183,468 +105,221 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
ToplevelNode.Add(parent);
|
ToplevelNode.Add(parent);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return ToplevelNode;
|
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);
|
adminDMO.AddUserRoles(subRole, users);
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
public ActionResult ReplaceUserRoles(int subRole, string users)
|
|
||||||
{
|
public ActionResult ReplaceUserRoles(int subRole, string users) {
|
||||||
adminDMO.AddUserRoles(subRole, users);
|
adminDMO.AddUserRoles(subRole, users);
|
||||||
return Content("Success");
|
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);
|
adminDMO.DeleteUserRoles(subRole, users);
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Details/5
|
// GET: /Workflow/Details/5
|
||||||
public ActionResult Details(int id)
|
public ActionResult Details(int id) {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// GET: /Workflow/Create
|
// GET: /Workflow/Create
|
||||||
public ActionResult Create()
|
public ActionResult Create() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// POST: /Workflow/Create
|
// POST: /Workflow/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create(FormCollection collection)
|
public ActionResult Create(FormCollection collection) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO: Add insert logic here
|
// TODO: Add insert logic here
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[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));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult UpdateUser([DataSourceRequest] DataSourceRequest request, LoginModel model)
|
public ActionResult UpdateUser([DataSourceRequest] DataSourceRequest request, LoginModel model) {
|
||||||
{
|
if (model != null && ModelState.IsValid) {
|
||||||
if (model != null && ModelState.IsValid)
|
|
||||||
{
|
|
||||||
userDMO.UpdateUser(model);
|
userDMO.UpdateUser(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult DeleteUser(string userId) {
|
||||||
///// <summary>
|
LoginModel loginModel = userDMO.GetUserByID(Convert.ToInt32(userId));
|
||||||
/////
|
adminDMO.DeleteUser(userDMO, trainingDMO, loginModel);
|
||||||
///// </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");
|
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
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
{
|
public ActionResult InsertUser([DataSourceRequest] DataSourceRequest request, LoginModel model) {
|
||||||
if (model != null && ModelState.IsValid)
|
try {
|
||||||
{
|
if (model != null && ModelState.IsValid) {
|
||||||
userDMO.InsertUser(model);
|
userDMO.InsertUser(model);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// TODO
|
// TODO
|
||||||
throw new Exception(ex.Message);
|
throw new Exception(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(new[] { model }.ToDataSourceResult(request, ModelState));
|
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);
|
int returnValue = MiscDMO.EnableOOOStatus(oooUserID, delegatedTo, startDate, endDate);
|
||||||
if (returnValue == 3) // the delegator is already a delegator to someone else
|
if (returnValue == 3) // the delegator is already a delegator to someone else
|
||||||
{
|
{
|
||||||
return Content("3");
|
return Content("3");
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("");
|
return Content("");
|
||||||
|
|
||||||
// TODO - Send an email to the OOO person and to the Delegated person
|
// TODO - Send an email to the OOO person and to the Delegated person
|
||||||
//return View();
|
//return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ExpireOOOStatus(int oooUserID) {
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="oooUserID"></param>
|
|
||||||
public void ExpireOOOStatus(int oooUserID)
|
|
||||||
{
|
|
||||||
MiscDMO.ExpireOOOStatus(oooUserID);
|
MiscDMO.ExpireOOOStatus(oooUserID);
|
||||||
// TODO - Does it need to send an email
|
// TODO - Does it need to send an email
|
||||||
}
|
}
|
||||||
public ActionResult ManageTrainingGroups()
|
|
||||||
{
|
public ActionResult ManageTrainingGroups() {
|
||||||
//List<TrainingGroup> allGroups = GetTrainingGroups();
|
//List<TrainingGroup> allGroups = GetTrainingGroups();
|
||||||
//return View(allGroups);
|
//return View(allGroups);
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
{
|
|
||||||
ViewBag.AllGroups = GetTrainingGroups();
|
ViewBag.AllGroups = GetTrainingGroups();
|
||||||
return View();
|
return View();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
public void RefreshGroups()
|
|
||||||
{
|
public void RefreshGroups() {
|
||||||
ViewBag.AllGroups = GetTrainingGroups();
|
ViewBag.AllGroups = GetTrainingGroups();
|
||||||
}
|
}
|
||||||
public ActionResult TrainingGroups()
|
|
||||||
{
|
public ActionResult TrainingGroups() {
|
||||||
List<TrainingGroup> trainingGroups = adminDMO.GetTrainingGroups();
|
List<TrainingGroup> trainingGroups = adminDMO.GetTrainingGroups();
|
||||||
return PartialView(trainingGroups);
|
return PartialView(trainingGroups);
|
||||||
}
|
}
|
||||||
public List<TrainingGroup> GetTrainingGroups()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public List<TrainingGroup> GetTrainingGroups() {
|
||||||
List<TrainingGroup> TrainingGroups = adminDMO.GetTrainingGroups();
|
List<TrainingGroup> TrainingGroups = adminDMO.GetTrainingGroups();
|
||||||
|
|
||||||
|
|
||||||
//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;
|
return TrainingGroups;
|
||||||
|
|
||||||
}
|
}
|
||||||
public ActionResult GetTaskListByUser([DataSourceRequest]DataSourceRequest request, string userId)
|
|
||||||
{
|
public ActionResult GetTaskListByUser([DataSourceRequest] DataSourceRequest request, string userId) {
|
||||||
IEnumerable<IssuesViewModel> data = ldDMO.GetTaskList(Convert.ToInt32(userId));
|
IEnumerable<IssuesViewModel> data = ldDMO.GetTaskList(Convert.ToInt32(userId));
|
||||||
data = from a in data where a.PendingApprovers != null select a;
|
data = from a in data where a.PendingApprovers != null select a;
|
||||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
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));
|
IEnumerable<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems(Convert.ToInt32(userId));
|
||||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
public ActionResult AddNewTrainingGroup(string groupName)
|
|
||||||
{
|
public ActionResult AddNewTrainingGroup(string groupName) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
adminDMO.AddNewTrainingGroup(groupName);
|
adminDMO.AddNewTrainingGroup(groupName);
|
||||||
return Json(new { test = "Succesfully saved" });
|
return Json(new { test = "Succesfully saved" });
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return Content("Unable to Save Group", "application/json");
|
return Content("Unable to Save Group", "application/json");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public ActionResult DeleteTrainingGroup(int groupID)
|
|
||||||
{
|
public ActionResult DeleteTrainingGroup(int groupID) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
adminDMO.DeleteTrainingGroup(groupID);
|
adminDMO.DeleteTrainingGroup(groupID);
|
||||||
return Json(new { response = "Successfully Deleted" });
|
return Json(new { response = "Successfully Deleted" });
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return Json(new { response = "Unsuccessfully Deleted" });
|
return Json(new { response = "Unsuccessfully Deleted" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ActionResult ViewTrainingGroup(int TrainingGroupID)
|
|
||||||
{
|
public ActionResult ViewTrainingGroup(int TrainingGroupID) {
|
||||||
ViewBag.GroupID = TrainingGroupID;
|
ViewBag.GroupID = TrainingGroupID;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
public ActionResult TrainingGroupPartial(int TrainingGroupID)
|
|
||||||
{
|
public ActionResult TrainingGroupPartial(int TrainingGroupID) {
|
||||||
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
||||||
ViewBag.TrainingGroupId = TrainingGroupID;
|
ViewBag.TrainingGroupId = TrainingGroupID;
|
||||||
List<TrainingGroupMember> trainingGroupMembers = adminDMO.GetTrainingGroupMembers(TrainingGroupID);
|
List<TrainingGroupMember> trainingGroupMembers = adminDMO.GetTrainingGroupMembers(TrainingGroupID);
|
||||||
return PartialView(trainingGroupMembers);
|
return PartialView(trainingGroupMembers);
|
||||||
}
|
}
|
||||||
public ActionResult AddToGroup(int userId, int groupId)
|
|
||||||
{
|
public ActionResult AddToGroup(int userId, int groupId) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
adminDMO.AddUserToGroup(userId, groupId);
|
adminDMO.AddUserToGroup(userId, groupId);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch(Exception e)
|
|
||||||
{
|
|
||||||
return Json(new { test = e.Message });
|
return Json(new { test = e.Message });
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(new { test = "Succesfully saved" });
|
return Json(new { test = "Succesfully saved" });
|
||||||
}
|
}
|
||||||
public ActionResult DeleteFromGroup(int userId, int groupId)
|
|
||||||
{
|
public ActionResult DeleteFromGroup(int userId, int groupId) {
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
adminDMO.DeleteFromGroup(userId, groupId);
|
adminDMO.DeleteFromGroup(userId, groupId);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return Json(new { test = e.Message });
|
return Json(new { test = e.Message });
|
||||||
}
|
}
|
||||||
|
|
||||||
return Json(new { test = "Succesfully removed" });
|
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();
|
return View();
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
public ActionResult TrainingReportConfig()
|
|
||||||
{
|
public ActionResult TrainingReportConfig() {
|
||||||
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
||||||
List<TrainingReportUser> currentTrainingReportUsersIds = adminDMO.GetTrainingReportUsers();
|
List<TrainingReportUser> currentTrainingReportUsersIds = adminDMO.GetTrainingReportUsers();
|
||||||
List<LoginModel> currentTrainingReportUsers = new List<LoginModel>();
|
List<LoginModel> currentTrainingReportUsers = new List<LoginModel>();
|
||||||
|
|
||||||
foreach (TrainingReportUser id in currentTrainingReportUsersIds)
|
foreach (TrainingReportUser id in currentTrainingReportUsersIds) {
|
||||||
{
|
|
||||||
currentTrainingReportUsers.Add(userDMO.GetUserByID(id.UserId));
|
currentTrainingReportUsers.Add(userDMO.GetUserByID(id.UserId));
|
||||||
}
|
}
|
||||||
ViewBag.CurrentReportUsers = currentTrainingReportUsers;
|
ViewBag.CurrentReportUsers = currentTrainingReportUsers;
|
||||||
return PartialView();
|
return PartialView();
|
||||||
}
|
}
|
||||||
public ActionResult TECNNotificationConfig()
|
|
||||||
{
|
public ActionResult TECNNotificationConfig() {
|
||||||
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
ViewBag.AllUsers = userDMO.GetAllActiveUsers();
|
||||||
List<TECNNotificationsUser> currentTECNNotificationUsersIds = adminDMO.GetTECNNotificationUsers();
|
List<TECNNotificationsUser> currentTECNNotificationUsersIds = adminDMO.GetTECNNotificationUsers();
|
||||||
List<LoginModel> currentTECNNotificationUsers = new List<LoginModel>();
|
List<LoginModel> currentTECNNotificationUsers = new List<LoginModel>();
|
||||||
|
|
||||||
foreach (TECNNotificationsUser id in currentTECNNotificationUsersIds)
|
foreach (TECNNotificationsUser id in currentTECNNotificationUsersIds) {
|
||||||
{
|
|
||||||
currentTECNNotificationUsers.Add(userDMO.GetUserByID(id.UserId));
|
currentTECNNotificationUsers.Add(userDMO.GetUserByID(id.UserId));
|
||||||
}
|
}
|
||||||
ViewBag.CurrentReportUsers = currentTECNNotificationUsers;
|
ViewBag.CurrentReportUsers = currentTECNNotificationUsers;
|
||||||
return PartialView();
|
return PartialView();
|
||||||
}
|
}
|
||||||
public ActionResult AddToTrainingReport(int userId)
|
|
||||||
{
|
public ActionResult AddToTrainingReport(int userId) {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
{
|
|
||||||
//Check to make sure user is not apart of the group already
|
//Check to make sure user is not apart of the group already
|
||||||
bool userExists = false;
|
bool userExists = false;
|
||||||
//bool userValid = true;
|
//bool userValid = true;
|
||||||
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
|
List<TrainingReportUser> existingUsers = adminDMO.GetTrainingReportUsers();
|
||||||
foreach (var item in existingUsers)
|
foreach (var item in existingUsers) {
|
||||||
{
|
if (item.UserId == userId) {
|
||||||
if (item.UserId == userId)
|
|
||||||
{
|
|
||||||
userExists = true;
|
userExists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -652,33 +327,25 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
var validUser = userDMO.GetUserByID(userId);
|
var validUser = userDMO.GetUserByID(userId);
|
||||||
|
|
||||||
//Add to group
|
//Add to group
|
||||||
if (!userExists && validUser != null)
|
if (!userExists && validUser != null) {
|
||||||
{
|
|
||||||
adminDMO.TrainingReportAddUser(userId);
|
adminDMO.TrainingReportAddUser(userId);
|
||||||
return Json("Success Added");
|
return Json("Success Added");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("User either doesn't exist OR is already added");
|
return Content("User either doesn't exist OR is already added");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ActionResult AddToTECNNotification(int userId)
|
|
||||||
{
|
public ActionResult AddToTECNNotification(int userId) {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
{
|
|
||||||
//Check to make sure user is not apart of the group already
|
//Check to make sure user is not apart of the group already
|
||||||
bool userExists = false;
|
bool userExists = false;
|
||||||
//bool userValid = true;
|
//bool userValid = true;
|
||||||
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
|
List<TECNNotificationsUser> existingUsers = adminDMO.GetTECNNotificationUsers();
|
||||||
foreach (var item in existingUsers)
|
foreach (var item in existingUsers) {
|
||||||
{
|
if (item.UserId == userId) {
|
||||||
if (item.UserId == userId)
|
|
||||||
{
|
|
||||||
userExists = true;
|
userExists = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -686,73 +353,47 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
var validUser = userDMO.GetUserByID(userId);
|
var validUser = userDMO.GetUserByID(userId);
|
||||||
|
|
||||||
//Add to group
|
//Add to group
|
||||||
if (!userExists && validUser != null)
|
if (!userExists && validUser != null) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
adminDMO.TECNExpirationAddUser(userId);
|
adminDMO.TECNExpirationAddUser(userId);
|
||||||
}
|
} catch (Exception e) {
|
||||||
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string exception = e.Message;
|
string exception = e.Message;
|
||||||
return Content(exception);
|
return Content(exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Json("Success Added");
|
return Json("Success Added");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("User either doesn't exist OR is already added");
|
return Content("User either doesn't exist OR is already added");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ActionResult DeleteFromTrainingReport(int userId)
|
|
||||||
{
|
public ActionResult DeleteFromTrainingReport(int userId) {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
adminDMO.TrainingReportDeleteUser(userId);
|
adminDMO.TrainingReportDeleteUser(userId);
|
||||||
return Content("Successfully Deleted");
|
return Content("Successfully Deleted");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return Content("Error while trying to delete");
|
return Content("Error while trying to delete");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public ActionResult DeleteFromTECNNotification(int userId)
|
|
||||||
{
|
public ActionResult DeleteFromTECNNotification(int userId) {
|
||||||
if ((bool)Session[GlobalVars.IS_ADMIN])
|
if ((bool)Session[GlobalVars.IS_ADMIN]) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
adminDMO.TECNExpirationDeleteUser(userId);
|
adminDMO.TECNExpirationDeleteUser(userId);
|
||||||
return Content("Successfully Deleted");
|
return Content("Successfully Deleted");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return Content("Error while trying to delete");
|
return Content("Error while trying to delete");
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,215 +1,124 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Kendo.Mvc.UI;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
using System.IO;
|
using Fab2ApprovalSystem.Models;
|
||||||
using System.Configuration;
|
|
||||||
using Fab2ApprovalSystem.Utilities;
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
using Kendo.Mvc.Extensions;
|
||||||
{
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class AuditController : Controller
|
public class AuditController : Controller {
|
||||||
{
|
|
||||||
AuditDMO auditDMO = new AuditDMO();
|
AuditDMO auditDMO;
|
||||||
CorrectiveActionDMO caDMO = new CorrectiveActionDMO();
|
CorrectiveActionDMO caDMO;
|
||||||
UserUtilities adUsers = new UserUtilities();
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
|
public AuditController(AppSettings appSettings) {
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
auditDMO = new AuditDMO(appSettings);
|
||||||
|
caDMO = new CorrectiveActionDMO(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
// GET: Audit
|
// GET: Audit
|
||||||
public ActionResult Index()
|
public ActionResult Index() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult Create() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult Create()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
Audit audit = new Audit();
|
Audit audit = new Audit();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
// TODO: Add insert logic here
|
// TODO: Add insert logic here
|
||||||
|
|
||||||
|
|
||||||
audit.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
audit.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
auditDMO.InsertAudit(audit);
|
auditDMO.InsertAudit(audit);
|
||||||
return RedirectToAction("Edit", new { issueID = audit.AuditNo });
|
return RedirectToAction("Edit", new { issueID = audit.AuditNo });
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
detailedException = e.InnerException.ToString();
|
detailedException = e.InnerException.ToString();
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
detailedException = e.Message;
|
detailedException = e.Message;
|
||||||
}
|
}
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(@User.Identity.Name + "\r\n SubmitDocument - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = audit.AuditNo, UserID = @User.Identity.Name, DocumentType = "Audit", OperationType = "Error", Comments = "SubmitDocument - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
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;
|
int isITARCompliant = 1;
|
||||||
Audit audit = new Audit();
|
Audit audit = new Audit();
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
bool isAdmin = (bool)Session[GlobalVars.IS_ADMIN];
|
||||||
List<int> userList = auditDMO.Get8DQA();
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
ViewBag.MesaUsers = adUsers.GetMesaUsers();
|
AuditEdit auditEdit = auditDMO.GetAuditEdit(issueID, audit, isAdmin, userId);
|
||||||
int QAs = userList.Find(delegate(int al) { return al == (int)Session[GlobalVars.SESSION_USERID]; });
|
if (auditEdit.RedirectToAction)
|
||||||
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 });
|
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
|
||||||
}
|
ViewBag.AuditAreaList = auditEdit.AuditAreaList;
|
||||||
if (ViewBag.IsAdmin == false && ViewBag.IsSubmitter == false)
|
ViewBag.AuditeeNames = auditEdit.AuditeeNames;
|
||||||
{
|
ViewBag.AuditFindingCategoryList = auditEdit.AuditFindingCategoryList;
|
||||||
return RedirectToAction("ReadOnlyAudit", new { auditNo = audit.AuditNo });
|
ViewBag.AuditorList = auditEdit.AuditorList;
|
||||||
}
|
ViewBag.AuditTypeList = auditEdit.AuditTypeList;
|
||||||
else
|
ViewBag.CANoList = auditEdit.CANoList;
|
||||||
{
|
ViewBag.Is8DQA = auditEdit.Is8DQA;
|
||||||
ViewBag.UserList = auditDMO.GetUserList();
|
ViewBag.IsAdmin = auditEdit.IsAdmin;
|
||||||
ViewBag.AuditTypeList = auditDMO.GetAuditTypeList();
|
ViewBag.IsSubmitter = auditEdit.IsSubmitter;
|
||||||
//ViewBag.AuditStandardList = auditDMO.GetAuditStandardList();
|
ViewBag.MesaUsers = auditEdit.MesaUsers;
|
||||||
ViewBag.AuditorList = auditDMO.GetAuditorList();
|
ViewBag.UserList = auditEdit.UserList;
|
||||||
ViewBag.AuditAreaList = auditDMO.GetAuditAreaList();
|
} catch (Exception e) {
|
||||||
ViewBag.AuditFindingCategoryList = auditDMO.GetAuditFindingCategories();
|
|
||||||
ViewBag.CANoList = auditDMO.GetCorrectiveActionNoList();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
detailedException = e.InnerException.ToString();
|
detailedException = e.InnerException.ToString();
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
detailedException = e.Message;
|
detailedException = e.Message;
|
||||||
}
|
}
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + audit.AuditNo.ToString() + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(@User.Identity.Name + "\r\n Edit - Audit\r\n" + audit.AuditNo.ToString() + "\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = audit.AuditNo, UserID = @User.Identity.Name, DocumentType = "Audit", OperationType = "Error", Comments = "Edit - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return View(audit);
|
return View(audit);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Edit(Audit model)
|
public ActionResult Edit(Audit model) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
|
|
||||||
var data = model;
|
var data = model;
|
||||||
auditDMO.UpdateAudit(model, (int)Session[GlobalVars.SESSION_USERID]);
|
auditDMO.UpdateAudit(model, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return Content(ex.Message);
|
return Content(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("Successfully Saved");
|
return Content("Successfully Saved");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult CheckCAStatus(int auditNo) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult CheckCAStatus(int auditNo)
|
|
||||||
{
|
|
||||||
int dataCount = -1;
|
int dataCount = -1;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
dataCount = auditDMO.GetOpenCACountByAuditNo(auditNo);
|
dataCount = auditDMO.GetOpenCACountByAuditNo(auditNo);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content(dataCount.ToString());
|
return Content(dataCount.ToString());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult ReadOnlyAudit(int auditNo) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult ReadOnlyAudit(int auditNo)
|
|
||||||
{
|
|
||||||
Audit audit = new Audit();
|
Audit audit = new Audit();
|
||||||
audit = auditDMO.GetAuditItemReadOnly(auditNo, (int)Session[GlobalVars.SESSION_USERID]);
|
audit = auditDMO.GetAuditItemReadOnly(auditNo, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
@ -218,255 +127,107 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
ViewBag.AuditAreaList = auditDMO.GetAuditAreaList();
|
ViewBag.AuditAreaList = auditDMO.GetAuditAreaList();
|
||||||
ViewBag.AuditFindingCategoryList = auditDMO.GetAuditFindingCategories();
|
ViewBag.AuditFindingCategoryList = auditDMO.GetAuditFindingCategories();
|
||||||
|
|
||||||
|
|
||||||
return View(audit);
|
return View(audit);
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
public ActionResult AuditReportAttachSave(IEnumerable<HttpPostedFileBase> AuditReportFiles, int auditNo) {
|
||||||
/// </summary>
|
try {
|
||||||
/// <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"
|
// The Name of the Upload component is "files"
|
||||||
if (AuditReportFiles != null)
|
if (AuditReportFiles != null) {
|
||||||
{
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in AuditReportFiles)
|
foreach (var file in AuditReportFiles) {
|
||||||
{
|
auditDMO.AuditReportAttachSave(auditNo, userId, file.FileName, file.InputStream);
|
||||||
// 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;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult AuditReportAttachment_Read([DataSourceRequest] DataSourceRequest request, int auditNo) {
|
||||||
///
|
|
||||||
/// </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));
|
return Json(auditDMO.GetAuditReportAttachments(auditNo).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="attachID"></param>
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void DeleteAuditReportAttachment(int attachID)
|
public void DeleteAuditReportAttachment(int attachID) {
|
||||||
{
|
|
||||||
auditDMO.DeleteAuditReportAttachment(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("."));
|
public FileResult DownloadAuditReportAttachment(string fileGuid, int auditNo) {
|
||||||
|
try {
|
||||||
string ecnFolderPath = Functions.GetAttachmentFolder() + "Audit\\" + auditNo.ToString();
|
string fileName, sDocument;
|
||||||
var sDocument = Path.Combine(ecnFolderPath, fileGuid + fileExtension);
|
List<string> results = auditDMO.GetFileNameAndDocument(fileGuid, auditNo);
|
||||||
|
fileName = results[0];
|
||||||
var FDir_AppData = Functions.GetAttachmentFolder();
|
sDocument = results[1];
|
||||||
if (!sDocument.StartsWith(FDir_AppData))
|
if (string.IsNullOrEmpty(sDocument)) {
|
||||||
{
|
|
||||||
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
||||||
// and block requests outside like "../web.config"
|
// and block requests outside like "../web.config"
|
||||||
throw new HttpException(403, "Forbidden");
|
throw new HttpException(403, "Forbidden");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!System.IO.File.Exists(sDocument))
|
if (!System.IO.File.Exists(sDocument)) {
|
||||||
{
|
|
||||||
return null;
|
return null;
|
||||||
//throw new Exception("File not found");
|
//throw new Exception("File not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
return File(sDocument, System.Net.Mime.MediaTypeNames.Application.Octet, fileName);
|
||||||
}
|
} catch {
|
||||||
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// TODO - proces the error
|
// TODO - proces the error
|
||||||
throw;
|
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));
|
return Json(auditDMO.GetAuditFindingsList(auditNo).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult InsertAuditFindingsItem(AuditFindings data) {
|
||||||
/// <summary>
|
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0) {
|
||||||
///
|
|
||||||
/// </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.");
|
throw new ArgumentException("You must select add a CA for a Major or Minor finding.");
|
||||||
}
|
} else {
|
||||||
else
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
{
|
Audit audit = auditDMO.InsertAndGetAudit(caDMO, data, userId);
|
||||||
|
|
||||||
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);
|
return Json(audit, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult UpdateAuditFindingsItem(AuditFindings data) {
|
||||||
/// <summary>
|
if ((data.FindingType == "Major" || data.FindingType == "Minor") && data.CANo == 0) {
|
||||||
///
|
|
||||||
/// </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.");
|
throw new ArgumentException("You must select add a CA for a Major or Minor finding.");
|
||||||
}
|
} else {
|
||||||
else
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
{
|
Audit audit = auditDMO.UpdateAndGetAudit(caDMO, data, userId);
|
||||||
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);
|
return Json(audit, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult DeleteAuditFindingsItem(int auditFindingsID) {
|
||||||
public ActionResult DeleteAuditFindingsItem(int auditFindingsID)
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
{
|
Audit audit = auditDMO.DeleteAndGetAudit(auditFindingsID, userId);
|
||||||
var af = auditDMO.GetAuditFindingsByID(auditFindingsID);
|
|
||||||
auditDMO.DeleteAuditFindingsItem(auditFindingsID);
|
|
||||||
var audit = auditDMO.GetAuditItem(af.AuditNo, (int)Session[GlobalVars.SESSION_USERID]);
|
|
||||||
return Json(audit, JsonRequestBehavior.AllowGet);
|
return Json(audit, JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void ReleaseLockOnDocument(int issueID) {
|
||||||
///
|
try {
|
||||||
/// </summary>
|
|
||||||
/// <param name="issueID"></param>
|
|
||||||
public void ReleaseLockOnDocument(int issueID)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
auditDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], issueID);
|
auditDMO.ReleaseLockOnDocument((int)Session[GlobalVars.SESSION_USERID], issueID);
|
||||||
}
|
} catch (Exception e) {
|
||||||
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);
|
||||||
try
|
} catch { }
|
||||||
{
|
|
||||||
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);
|
auditDMO.ReleaseLockOnDocument(-1, issueID);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// CA Findings ======================================================================================================================
|
// CA Findings ======================================================================================================================
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult InsertCAFindingsItem(CAFindings data) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult InsertCAFindingsItem(CAFindings data)
|
|
||||||
{
|
|
||||||
auditDMO.InsertCAFindings(data);
|
auditDMO.InsertCAFindings(data);
|
||||||
if (data.ResponsibilityOwnerID != null)
|
if (data.ResponsibilityOwnerID != null) {
|
||||||
{
|
|
||||||
// send an email notification
|
// send an email notification
|
||||||
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
|
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
|
||||||
}
|
}
|
||||||
@ -474,196 +235,76 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult UpdateCAFindingsItem(CAFindings data) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult UpdateCAFindingsItem(CAFindings data)
|
|
||||||
{
|
|
||||||
auditDMO.UpdateCAFindings(data);
|
auditDMO.UpdateCAFindings(data);
|
||||||
if (data.ResponsibilityOwnerID != data.CurrentResponsibilityOwnerID)
|
if (data.ResponsibilityOwnerID != data.CurrentResponsibilityOwnerID) {
|
||||||
{
|
|
||||||
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
|
NotifyActionItemOwner(data.AuditNo, data.ECD, data.ResponsibilityOwnerID);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetCAFindingsList([DataSourceRequest] DataSourceRequest request, int auditNo) {
|
||||||
///
|
|
||||||
/// </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));
|
return Json(auditDMO.GetCAFindingsList(auditNo).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetCAFindingsItemAttachments([DataSourceRequest] DataSourceRequest request, int caFindingsID) {
|
||||||
///
|
|
||||||
/// </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));
|
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();
|
var model = new CAFindings();
|
||||||
model = auditDMO.GetCAFindingsItem(caFindingsID);
|
model = auditDMO.GetCAFindingsItem(caFindingsID);
|
||||||
|
|
||||||
return PartialView("_CAFindingsAttachment", model);
|
return PartialView("_CAFindingsAttachment", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="caFindingsID"></param>
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void DeleteCAFindingsItem(int caFindingsID)
|
public void DeleteCAFindingsItem(int caFindingsID) {
|
||||||
{
|
|
||||||
auditDMO.DeleteCAFindingsItem(caFindingsID);
|
auditDMO.DeleteCAFindingsItem(caFindingsID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult SaveCAFindings_Attachemnt(IEnumerable<HttpPostedFileBase> CAFindings_Attachemnt, int caFindingsID, int auditNo) {
|
||||||
///
|
try {
|
||||||
/// </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"
|
// The Name of the Upload component is "files"
|
||||||
if (CAFindings_Attachemnt != null)
|
if (CAFindings_Attachemnt != null) {
|
||||||
{
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in CAFindings_Attachemnt)
|
foreach (var file in CAFindings_Attachemnt) {
|
||||||
{
|
auditDMO.SaveAndInsert(caFindingsID, auditNo, userId, file.FileName, file.InputStream);
|
||||||
// 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;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID) {
|
||||||
|
try {
|
||||||
|
string emailTemplatesPath = ConfigurationManager.AppSettings["EmailTemplatesPath"];
|
||||||
|
string email = auditDMO.NotifyActionItemOwner(issueID, dueDate, responsibleOwnerID, emailTemplatesPath);
|
||||||
|
|
||||||
/// <summary>
|
try {
|
||||||
///
|
|
||||||
/// </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 });
|
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 { }
|
} catch (Exception e) {
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
detailedException = e.InnerException.ToString();
|
detailedException = e.InnerException.ToString();
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
detailedException = e.Message;
|
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();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " 5s/CAFindings:" + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(@User.Identity.Name + "\r\n 5s/CAFindings - NotifyActionItemOwner\r\n" + detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "Corrective Action", OperationType = "Error", Comments = "5s/CAFindings Notification - " + exceptionString });
|
||||||
//throw e;
|
//throw e;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public ActionResult IsCAAssignedToAudit(int caNo, int auditNo) {
|
||||||
public ActionResult IsCAAssignedToAudit(int caNo, int auditNo)
|
|
||||||
{
|
|
||||||
return Content(auditDMO.IsCAAssignedToAudit(caNo, auditNo).ToString());
|
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
@ -1,10 +1,3 @@
|
|||||||
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
@ -12,351 +5,207 @@ using System.Linq;
|
|||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
using Fab2ApprovalSystem.DMO;
|
||||||
{
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
public class HomeController : Controller
|
public class HomeController : Controller {
|
||||||
{
|
|
||||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
MRB_DMO mrbDMO;
|
||||||
MRB_DMO mrbDMO = new MRB_DMO();
|
PartsRequestDMO prDMO;
|
||||||
|
LotDispositionDMO ldDMO;
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
PartsRequestDMO prDMO = new PartsRequestDMO();
|
|
||||||
UserUtilities userDMO = new UserUtilities();
|
UserUtilities userDMO = new UserUtilities();
|
||||||
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
UserAccountDMO originalUserDMO = new UserAccountDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
MiscDMO miscDMO = new MiscDMO();
|
MiscDMO miscDMO = new MiscDMO();
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
|
public HomeController(AppSettings appSettings) {
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
ldDMO = new LotDispositionDMO(appSettings);
|
||||||
|
mrbDMO = new MRB_DMO(appSettings);
|
||||||
|
prDMO = new PartsRequestDMO(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult Index(string tabName) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tabName"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult Index(string tabName)
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult MyTasks() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult MyTasks()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult AllDocuments() {
|
||||||
public ActionResult AllDocuments()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult SpecialWorkRequestList() {
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult SpecialWorkRequestList()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult MRBList() {
|
||||||
public ActionResult MRBList()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult ECNList()
|
public ActionResult ECNList() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
public ActionResult TrainingList()
|
public ActionResult TrainingList() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult LotDispositionList()
|
public ActionResult LotDispositionList() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult AuditList() {
|
||||||
public ActionResult AuditList()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult CorrectiveActionList()
|
public ActionResult CorrectiveActionList() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult ECN_TECN(string viewOption) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="viewOption"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult ECN_TECN(string viewOption)
|
|
||||||
{
|
|
||||||
ViewBag.ViewOption = viewOption;
|
ViewBag.ViewOption = viewOption;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult ChangeControlList() {
|
||||||
|
|
||||||
public ActionResult ChangeControlList()
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
public ActionResult GetTaskList([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||||
/// </summary>
|
try {
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult GetTaskList([DataSourceRequest]DataSourceRequest request, string tabName)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
List<IssuesViewModel> data = ldDMO.GetTaskList((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
List<IssuesViewModel> data = ldDMO.GetTaskList((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
||||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// TODO record the error
|
// TODO record the error
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetMyOpenActionItems([DataSourceRequest]DataSourceRequest request, string tabName)
|
public ActionResult GetMyOpenActionItems([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
List<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
List<OpenActionItemViewModel> data = ldDMO.GetMyOpenActionItems((int)Session[GlobalVars.SESSION_USERID]).Distinct().ToList();
|
||||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// TODO record the error
|
// TODO record the error
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult GetDocuments([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||||
|
|
||||||
|
|
||||||
public ActionResult GetDocuments([DataSourceRequest]DataSourceRequest request, string tabName)
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
//IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositions();
|
//IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositions();
|
||||||
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
|
IEnumerable<IssuesViewModel> data = ldDMO.GetDocuments();
|
||||||
return Json(data.ToDataSourceResult(request));
|
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();
|
IEnumerable<IssuesViewModel> data = ldDMO.GetWorkRequests();
|
||||||
return Json(data.ToDataSourceResult(request));
|
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()));
|
IEnumerable<ChangeControlList> data = ldDMO.GetChangeControls(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetAuditList([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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()));
|
IEnumerable<AuditList> data = ldDMO.GetAuditList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetCorrectiveActionList([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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()));
|
IEnumerable<CorrectiveAction> data = ldDMO.GetCorrectiveActionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetMRBList([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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()));
|
IEnumerable<IssuesViewModel> data = ldDMO.GetMRBList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
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()));
|
IEnumerable<IssuesViewModel> data = ldDMO.GetLotDispositionList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetECNList([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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()));
|
IEnumerable<IssuesViewModel> data = ldDMO.GetECNList(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
public ActionResult GetTrainingList([DataSourceRequest]DataSourceRequest request)
|
public ActionResult GetTrainingList([DataSourceRequest] DataSourceRequest request) {
|
||||||
{
|
|
||||||
|
|
||||||
IEnumerable<Training> data = trainingDMO.GetAllTrainings();
|
IEnumerable<Training> data = trainingDMO.GetAllTrainings();
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult MyECNsTECNs(string dataType) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dataType"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult MyECNsTECNs(string dataType)
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = dataType;
|
ViewBag.ActiveTabName = dataType;
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetECN_TECNsPendingApproval([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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()));
|
IEnumerable<IssuesViewModel> data = ecnDMO.GetECN_TECNPendingApprovals(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
ViewBag.ViewOption = "Pending Approvals";
|
ViewBag.ViewOption = "Pending Approvals";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||||
return Json(data.ToDataSourceResult(request));
|
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);
|
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiredTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||||
ViewBag.ViewOption = "Expired TECNs";
|
ViewBag.ViewOption = "Expired TECNs";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
|
|
||||||
}
|
}
|
||||||
public ActionResult GetAllTECNs([DataSourceRequest]DataSourceRequest request)
|
public ActionResult GetAllTECNs([DataSourceRequest] DataSourceRequest request) {
|
||||||
{
|
|
||||||
|
|
||||||
IEnumerable<IssuesViewModel> data = ecnDMO.GetAllTECNs();
|
IEnumerable<IssuesViewModel> data = ecnDMO.GetAllTECNs();
|
||||||
ViewBag.ViewOption = "All TECNs";
|
ViewBag.ViewOption = "All TECNs";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult GetMyConvertedTECNsToECNs([DataSourceRequest] DataSourceRequest request) {
|
||||||
///
|
|
||||||
/// </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);
|
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyConvertedTECNsToECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||||
ViewBag.ViewOption = "Converted TECNs";
|
ViewBag.ViewOption = "Converted TECNs";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||||
return Json(data.ToDataSourceResult(request));
|
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);
|
IEnumerable<IssuesViewModel> data = ecnDMO.GetMyExpiringTECNs(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), 7);
|
||||||
ViewBag.ViewOption = "Expiring TECNs";
|
ViewBag.ViewOption = "Expiring TECNs";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
Session[GlobalVars.ECN_VIEW_OPTION] = ViewBag.ViewOption;
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult GetLotList([DataSourceRequest] DataSourceRequest request, int workRequestID) {
|
||||||
|
LotTravelerDMO LotTravDMO = new LotTravelerDMO(_AppSettings);
|
||||||
/// <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));
|
return Json(LotTravDMO.GetLotListBasedOnSWRNumber(workRequestID).ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
|
|
||||||
public ActionResult SetOOOStatus(int delegatedTo, DateTime startDate, DateTime endDate, string tab)
|
public ActionResult SetOOOStatus(int delegatedTo, DateTime startDate, DateTime endDate, string tab) {
|
||||||
{
|
if (Session[GlobalVars.SESSION_USERID] != null) {
|
||||||
|
|
||||||
if (Session[GlobalVars.SESSION_USERID] != null)
|
|
||||||
{
|
|
||||||
int returnValue = MiscDMO.EnableOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), delegatedTo, startDate, endDate);
|
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
|
if (returnValue == 3) // the delegator is already a delegator to someone else
|
||||||
{
|
{
|
||||||
@ -371,32 +220,15 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return Content("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ExpireOOOStatus(string tab) {
|
||||||
/// <summary>
|
if (Session[GlobalVars.SESSION_USERID] != null) {
|
||||||
///
|
|
||||||
/// </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()));
|
MiscDMO.ExpireOOOStatus(int.Parse(Session[GlobalVars.SESSION_USERID].ToString()));
|
||||||
Session[GlobalVars.OOO] = false;
|
Session[GlobalVars.OOO] = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="issue"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult DeleteItem([DataSourceRequest] DataSourceRequest request, IssuesViewModel issue)
|
public ActionResult DeleteItem([DataSourceRequest] DataSourceRequest request, IssuesViewModel issue) {
|
||||||
{
|
|
||||||
|
|
||||||
GlobalVars.DocumentType dType;
|
GlobalVars.DocumentType dType;
|
||||||
Enum.TryParse(issue.DocumentType, out dType);
|
Enum.TryParse(issue.DocumentType, out dType);
|
||||||
if (dType == GlobalVars.DocumentType.MRB)
|
if (dType == GlobalVars.DocumentType.MRB)
|
||||||
@ -408,67 +240,42 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
else if (dType == GlobalVars.DocumentType.CorrectiveAction)
|
else if (dType == GlobalVars.DocumentType.CorrectiveAction)
|
||||||
ldDMO.DeleteCADocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
|
ldDMO.DeleteCADocument(issue.IssueID, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
|
||||||
|
|
||||||
|
|
||||||
return Json(new[] { issue }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { issue }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="request"></param>
|
|
||||||
/// <param name="ca"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[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");
|
ldDMO.DeleteCADocument(ca.CANo, int.Parse(Session[GlobalVars.SESSION_USERID].ToString()), "Corrective Action");
|
||||||
|
|
||||||
|
|
||||||
return Json(new[] { ca }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { ca }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult About() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult About()
|
|
||||||
{
|
|
||||||
ViewBag.Message = "Your application description page.";
|
ViewBag.Message = "Your application description page.";
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult Contact() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult Contact()
|
|
||||||
{
|
|
||||||
ViewBag.Message = "Your contact page.";
|
ViewBag.Message = "Your contact page.";
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region testing purpose
|
#region testing purpose
|
||||||
public ActionResult Edit()
|
public ActionResult Edit() {
|
||||||
{
|
|
||||||
|
|
||||||
return View(DemoHelper.Instance.ListOfModels[0]);
|
return View(DemoHelper.Instance.ListOfModels[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Edit(TestModel editTest)
|
public ActionResult Edit(TestModel editTest) {
|
||||||
{
|
|
||||||
DemoHelper.Instance.ListOfModels[0] = editTest;
|
DemoHelper.Instance.ListOfModels[0] = editTest;
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Test()
|
public static void Test() {
|
||||||
{
|
|
||||||
|
|
||||||
string[] colorStrings = { "0", "2", "8", "blue", "Blue", "Yellow", "Red, Green" };
|
string[] colorStrings = { "0", "2", "8", "blue", "Blue", "Yellow", "Red, Green" };
|
||||||
foreach (string colorString in colorStrings)
|
foreach (string colorString in colorStrings) {
|
||||||
{
|
|
||||||
GlobalVars.Colors colorValue;
|
GlobalVars.Colors colorValue;
|
||||||
if (Enum.TryParse(colorString, true, out colorValue))
|
if (Enum.TryParse(colorString, true, out colorValue))
|
||||||
if (Enum.IsDefined(typeof(GlobalVars.Colors), colorValue) | colorValue.ToString().Contains(","))
|
if (Enum.IsDefined(typeof(GlobalVars.Colors), colorValue) | colorValue.ToString().Contains(","))
|
||||||
@ -482,28 +289,15 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
public void DelegateDocumentApproval(int issueID, int delegateTo, string ecnTypeString, string title) {
|
||||||
///
|
|
||||||
/// </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 = "";
|
var email = "";
|
||||||
int delegateFrom = (int)Session[GlobalVars.SESSION_USERID];
|
int delegateFrom = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
email = wfDMO.DelegateDocumentApproval(issueID, delegateFrom, delegateTo);
|
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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Delegation", Comments = "Delegated from - " + delegateFrom + " to " + delegateTo });
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
string exceptionString = e.Message.ToString().Trim().Length > 500 ? "Issue=" + issueID.ToString() + " " + e.Message.ToString().Substring(0, 250) : e.Message.ToString();
|
||||||
Functions.WriteEvent(@User.Identity.Name + "\r\n DelegateApproval\r\n" + e.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, @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 });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = " + ecnTypeString + ", OperationType = "Error", Comments = "DelegateApproval - " + exceptionString });
|
||||||
throw new Exception(e.Message);
|
throw new Exception(e.Message);
|
||||||
}
|
}
|
||||||
@ -513,8 +307,9 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
string subject;
|
string subject;
|
||||||
string senderName = ecnTypeString;
|
string senderName = ecnTypeString;
|
||||||
|
|
||||||
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title; ;
|
subject = ecnTypeString + " Delegation" + " - Email would be sent to " + email + " for Number " + issueID + ", - " + title;
|
||||||
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
;
|
||||||
|
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
string[] emailparams = new string[4];
|
string[] emailparams = new string[4];
|
||||||
emailparams[0] = issueID.ToString();
|
emailparams[0] = issueID.ToString();
|
||||||
emailparams[1] = issueID.ToString();
|
emailparams[1] = issueID.ToString();
|
||||||
@ -524,134 +319,80 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
userEmail = email;
|
userEmail = email;
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Delegated to Approver: " + email });
|
||||||
}
|
} catch { }
|
||||||
catch { }
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public JsonResult GetAllUsersList() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public JsonResult GetAllUsersList()
|
|
||||||
{
|
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult SaveAllDocumentsFilter(string data) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult SaveAllDocumentsFilter(string data)
|
|
||||||
{
|
|
||||||
Session["AllDocumentsFilterData"] = data;
|
Session["AllDocumentsFilterData"] = data;
|
||||||
return new EmptyResult();
|
return new EmptyResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult LoadAllDocumentsFilter() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult LoadAllDocumentsFilter()
|
|
||||||
{
|
|
||||||
return Json(Session["AllDocumentsFilterData"], JsonRequestBehavior.AllowGet);
|
return Json(Session["AllDocumentsFilterData"], JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult SaveSWRFilter(string data) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult SaveSWRFilter(string data)
|
|
||||||
{
|
|
||||||
Session["SWRFilterData"] = data;
|
Session["SWRFilterData"] = data;
|
||||||
return new EmptyResult();
|
return new EmptyResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult LoadSWRFilter() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult LoadSWRFilter()
|
|
||||||
{
|
|
||||||
return Json(Session["SWRFilterData"], JsonRequestBehavior.AllowGet);
|
return Json(Session["SWRFilterData"], JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult SavePCRBFilter(string data) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult SavePCRBFilter(string data)
|
|
||||||
{
|
|
||||||
Session["PCRBFilterData"] = data;
|
Session["PCRBFilterData"] = data;
|
||||||
return new EmptyResult();
|
return new EmptyResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public ActionResult LoadPCRBFilter() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult LoadPCRBFilter()
|
|
||||||
{
|
|
||||||
return Json(Session["PCRBFilterData"], JsonRequestBehavior.AllowGet);
|
return Json(Session["PCRBFilterData"], JsonRequestBehavior.AllowGet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult PartsRequestList()
|
public ActionResult PartsRequestList() {
|
||||||
{
|
|
||||||
ViewBag.CanDeletePR = Session[GlobalVars.CAN_CREATE_PARTS_REQUEST];
|
ViewBag.CanDeletePR = Session[GlobalVars.CAN_CREATE_PARTS_REQUEST];
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetPartsRequestList([DataSourceRequest]DataSourceRequest request)
|
public ActionResult GetPartsRequestList([DataSourceRequest] DataSourceRequest request) {
|
||||||
{
|
|
||||||
IEnumerable<PartsRequestList> data = prDMO.GetPartsRequestList();
|
IEnumerable<PartsRequestList> data = prDMO.GetPartsRequestList();
|
||||||
return Json(data.ToDataSourceResult(request));
|
return Json(data.ToDataSourceResult(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetMyPartsRequestsList([DataSourceRequest]DataSourceRequest request, string tabName)
|
public ActionResult GetMyPartsRequestsList([DataSourceRequest] DataSourceRequest request, string tabName) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
ViewBag.ActiveTabName = tabName;
|
ViewBag.ActiveTabName = tabName;
|
||||||
var data = prDMO.GetMyPartsRequests((int)Session[GlobalVars.SESSION_USERID]);
|
var data = prDMO.GetMyPartsRequests((int)Session[GlobalVars.SESSION_USERID]);
|
||||||
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
return Json(data.ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// TODO record the error
|
// TODO record the error
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[AcceptVerbs(HttpVerbs.Post)]
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
public ActionResult DeletePR([DataSourceRequest] DataSourceRequest request, MyPartsRequestList pr)
|
public ActionResult DeletePR([DataSourceRequest] DataSourceRequest request, MyPartsRequestList pr) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
if (Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
|
if (Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
|
||||||
throw new Exception("Permission denied");
|
throw new Exception("Permission denied");
|
||||||
|
|
||||||
prDMO.DeleteDocument(pr.PRNumber, (int)Session[GlobalVars.SESSION_USERID]);
|
prDMO.DeleteDocument(pr.PRNumber, (int)Session[GlobalVars.SESSION_USERID]);
|
||||||
return Json(new[] { pr }.ToDataSourceResult(request, ModelState));
|
return Json(new[] { pr }.ToDataSourceResult(request, ModelState));
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message);
|
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 delegateFrom = originalUserDMO.GetUserByID((int)Session[GlobalVars.SESSION_USERID]);
|
||||||
LoginModel delegateTo = originalUserDMO.GetUserByID(delegatedUser);
|
LoginModel delegateTo = originalUserDMO.GetUserByID(delegatedUser);
|
||||||
List<string> emailList = new List<string>();
|
List<string> emailList = new List<string>();
|
||||||
@ -663,9 +404,8 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
string subject = "Mesa Approval Delegation Notification";
|
string subject = "Mesa Approval Delegation Notification";
|
||||||
string senderName = "Mesa Approval";
|
string senderName = "Mesa Approval";
|
||||||
|
|
||||||
foreach (string email in emailList)
|
foreach (string email in emailList) {
|
||||||
{
|
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
|
||||||
string[] emailparams = new string[5];
|
string[] emailparams = new string[5];
|
||||||
emailparams[0] = delegateFrom.FullName;
|
emailparams[0] = delegateFrom.FullName;
|
||||||
emailparams[1] = delegateTo.FullName;
|
emailparams[1] = delegateTo.FullName;
|
||||||
@ -679,62 +419,38 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
|
|
||||||
//EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Rejection: " + userEmail });
|
//EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = ecnTypeString, OperationType = "Email", Comments = "Rejection: " + userEmail });
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
catch { }
|
public bool ProcessOoO() {
|
||||||
|
|
||||||
}
|
try {
|
||||||
public bool ProcessOoO()
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
userDMO.ProcessOoO();
|
userDMO.ProcessOoO();
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool ExpireOoO()
|
public bool ExpireOoO() {
|
||||||
{
|
try {
|
||||||
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
userDMO.ExpireOoO();
|
userDMO.ExpireOoO();
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public bool ApprovalsReminderNotifications()
|
public bool ApprovalsReminderNotifications() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
//Get list of approvals
|
//Get list of approvals
|
||||||
List<ApproveListModel> approveList = miscDMO.GetApprovalReminderList();
|
List<ApproveListModel> approveList = miscDMO.GetApprovalReminderList();
|
||||||
|
|
||||||
foreach (var item in approveList)
|
foreach (var item in approveList) {
|
||||||
{
|
try {
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
NotifyApprover(item.AssignedEmail, item.Title, item.IssueID, item.DocType);
|
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 });
|
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.
|
||||||
@ -742,17 +458,12 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
// List<ApproveListModel> approveList = miscDMO.
|
// List<ApproveListModel> approveList = miscDMO.
|
||||||
return true;
|
return true;
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void NotifyApprover(string toEmail, string title, int issueId, string docType)
|
public void NotifyApprover(string toEmail, string title, int issueId, string docType) {
|
||||||
{
|
try {
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
//List<string> emailIst = ldDMO.GetApproverEmailList(@issueID, currentStep).Distinct().ToList();
|
||||||
//List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
//List<string> emailIst = MiscDMO.GetApproverEmailListByDocument(@ecnNumber, currentStep, documentType).Distinct().ToList();
|
||||||
@ -765,7 +476,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
|
|
||||||
subject = docType + " Approval Reminder: " + title;
|
subject = docType + " Approval Reminder: " + title;
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
string[] emailparams = new string[4];
|
string[] emailparams = new string[4];
|
||||||
emailparams[0] = docType;
|
emailparams[0] = docType;
|
||||||
emailparams[1] = title;
|
emailparams[1] = title;
|
||||||
@ -781,39 +492,27 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
//en.SendNotificationEmail(emailTemplate, SenderEmail, senderName, userEmail, null, subject, emailparams);
|
//en.SendNotificationEmail(emailTemplate, SenderEmail, senderName, userEmail, null, subject, emailparams);
|
||||||
//emailSentList = ecnCreatedByEmail;
|
//emailSentList = ecnCreatedByEmail;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||||
}
|
} catch { }
|
||||||
catch { }
|
|
||||||
|
|
||||||
//EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
//EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
//string[] emailparams = new string[4];
|
//string[] emailparams = new string[4];
|
||||||
//emailparams[0] = issueID.ToString();
|
//emailparams[0] = issueID.ToString();
|
||||||
//emailparams[1] = issueID.ToString();
|
//emailparams[1] = issueID.ToString();
|
||||||
//emailparams[2] = GlobalVars.hostURL;
|
//emailparams[2] = GlobalVars.hostURL;
|
||||||
//emailparams[3] =Session[GlobalVars.SESSION_USERNAME].ToString();
|
//emailparams[3] =Session[GlobalVars.SESSION_USERNAME].ToString();
|
||||||
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
//en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, emailIst, null, subject, emailparams);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
string detailedException = "";
|
string detailedException = "";
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
detailedException = e.InnerException.ToString();
|
detailedException = e.InnerException.ToString();
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
detailedException = e.Message;
|
detailedException = e.Message;
|
||||||
}
|
}
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
EventLogDMO.Add(new WinEventLog() { IssueID = issueId, UserID = @User.Identity.Name, DocumentType = docType, OperationType = "Email", Comments = "Approval reminders" });
|
||||||
throw e;
|
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
@ -1,37 +1,36 @@
|
|||||||
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Fab2ApprovalSystem.DMO;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
{
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class ManagerController : Controller
|
public class ManagerController : Controller {
|
||||||
{
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
LotDispositionDMO ldDMO = new LotDispositionDMO();
|
LotDispositionDMO ldDMO;
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
/// <summary>
|
public ManagerController(AppSettings appSettings) {
|
||||||
///
|
_AppSettings = appSettings;
|
||||||
/// </summary>
|
ldDMO = new LotDispositionDMO(appSettings);
|
||||||
/// <returns></returns>
|
}
|
||||||
public ActionResult Index()
|
|
||||||
{
|
|
||||||
|
|
||||||
if ((bool)Session[GlobalVars.IS_MANAGER])
|
public ActionResult Index() {
|
||||||
{
|
if ((bool)Session[GlobalVars.IS_MANAGER]) {
|
||||||
var model = userDMO.GetAllUsers();
|
var model = userDMO.GetAllUsers();
|
||||||
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
|
ViewBag.AllActiveUsers = userDMO.GetAllActiveUsers();
|
||||||
return View(model);
|
return View(model);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
return Content("Not Autthorized");
|
return Content("Not Autthorized");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,48 +1,49 @@
|
|||||||
using System;
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Kendo.Mvc.UI;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
{
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class PartsRequestController : Controller
|
public class PartsRequestController : Controller {
|
||||||
{
|
|
||||||
PartsRequestDMO prDMO = new PartsRequestDMO();
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
|
||||||
|
|
||||||
const int WorkflowNumber = 1;
|
const int WorkflowNumber = 1;
|
||||||
|
PartsRequestDMO prDMO;
|
||||||
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
|
WorkflowDMO wfDMO = new WorkflowDMO();
|
||||||
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
public PartsRequestController()
|
public PartsRequestController(AppSettings appSettings) {
|
||||||
{
|
_AppSettings = appSettings;
|
||||||
ViewBag.ShowReAssignApprovers = false;
|
ViewBag.ShowReAssignApprovers = false;
|
||||||
|
prDMO = new PartsRequestDMO(appSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ActionResult HandleValidationError(string msg)
|
protected ActionResult HandleValidationError(string msg) {
|
||||||
{
|
|
||||||
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
Response.StatusCode = (int)System.Net.HttpStatusCode.BadRequest;
|
||||||
return Json(new { result = "Invalid", detail = msg });
|
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);
|
HandleException(issueID, ex, additionalKeys);
|
||||||
|
|
||||||
Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
|
Response.StatusCode = (int)System.Net.HttpStatusCode.InternalServerError;
|
||||||
return Json(new { result = "Error", issueID = issueID, detail = ex.Message });
|
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 st = new System.Diagnostics.StackTrace();
|
||||||
var sf = st.GetFrame(1);
|
var sf = st.GetFrame(1);
|
||||||
|
|
||||||
@ -60,59 +61,44 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
additionalKeys);
|
additionalKeys);
|
||||||
|
|
||||||
Exception x = ex;
|
Exception x = ex;
|
||||||
while (x != null)
|
while (x != null) {
|
||||||
{
|
|
||||||
detailedException += x.ToString();
|
detailedException += x.ToString();
|
||||||
detailedException += "\r\n=====\r\n";
|
detailedException += "\r\n=====\r\n";
|
||||||
x = x.InnerException;
|
x = x.InnerException;
|
||||||
}
|
}
|
||||||
|
|
||||||
Functions.WriteEvent(detailedException, System.Diagnostics.EventLogEntryType.Error);
|
Functions.WriteEvent(_AppSettings, detailedException, System.Diagnostics.EventLogEntryType.Error);
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog()
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
{
|
|
||||||
IssueID = issueID,
|
IssueID = issueID,
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
DocumentType = controller,
|
DocumentType = controller,
|
||||||
OperationType = "Error",
|
OperationType = "Error",
|
||||||
Comments = detailedException
|
Comments = detailedException
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GET: PartsRequest
|
// GET: PartsRequest
|
||||||
public ActionResult Index()
|
public ActionResult Index() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Edit(int issueID)
|
public ActionResult Edit(int issueID) {
|
||||||
{
|
|
||||||
var pr = new PartsRequest();
|
var pr = new PartsRequest();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
pr = prDMO.Get(issueID);
|
pr = prDMO.Get(issueID);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null) {
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document does not exist";
|
ViewBag.ErrorDescription = "Document does not exist";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
} else if (pr.CurrentStep < 0) {
|
||||||
else if (pr.CurrentStep < 0)
|
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document is deleted";
|
ViewBag.ErrorDescription = "Document is deleted";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
} else if (pr.CurrentStep >= 1) {
|
||||||
else if (pr.CurrentStep >= 1)
|
|
||||||
{
|
|
||||||
return RedirectToAction("EditApproval", new { issueID = issueID });
|
return RedirectToAction("EditApproval", new { issueID = issueID });
|
||||||
}
|
} else {
|
||||||
else
|
if (pr.OriginatorID != (int)Session[GlobalVars.SESSION_USERID]) {
|
||||||
{
|
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false) {
|
||||||
if (pr.OriginatorID != (int)Session[GlobalVars.SESSION_USERID])
|
|
||||||
{
|
|
||||||
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false)
|
|
||||||
{
|
|
||||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -120,60 +106,47 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
ViewBag.UserList = userDMO.GetAllUsers();
|
ViewBag.UserList = userDMO.GetAllUsers();
|
||||||
return View(pr);
|
return View(pr);
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
HandleException(issueID, e);
|
HandleException(issueID, e);
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Edit(PartsRequest pr)
|
public ActionResult Edit(PartsRequest pr) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
var pr_srv = prDMO.Get(pr.PRNumber);
|
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");
|
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");
|
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");
|
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Parts Request is not editable");
|
||||||
}
|
}
|
||||||
|
|
||||||
prDMO.Update(pr);
|
prDMO.Update(pr);
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(pr.PRNumber, e);
|
return HandleAPIException(pr.PRNumber, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult EditApproval(int issueID)
|
public ActionResult EditApproval(int issueID) {
|
||||||
{
|
|
||||||
var pr = new PartsRequest();
|
var pr = new PartsRequest();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
|
|
||||||
pr = prDMO.Get(issueID);
|
pr = prDMO.Get(issueID);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null) {
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document does not exist";
|
ViewBag.ErrorDescription = "Document does not exist";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
if (pr.CurrentStep < 0)
|
if (pr.CurrentStep < 0) {
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document is deleted";
|
ViewBag.ErrorDescription = "Document is deleted";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
@ -183,12 +156,9 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
var userList = MiscDMO.GetPendingApproversListByDocument(issueID, Convert.ToByte(pr.CurrentStep), (int)GlobalVars.DocumentType.PartsRequest);
|
var userList = MiscDMO.GetPendingApproversListByDocument(issueID, Convert.ToByte(pr.CurrentStep), (int)GlobalVars.DocumentType.PartsRequest);
|
||||||
ViewBag.IsApprover = (userList.Count(u => u.UserID == myUserID) > 0);
|
ViewBag.IsApprover = (userList.Count(u => u.UserID == myUserID) > 0);
|
||||||
|
|
||||||
if (ViewBag.IsApprover == false)
|
if (ViewBag.IsApprover == false) {
|
||||||
{
|
if (pr.OriginatorID != myUserID) {
|
||||||
if (pr.OriginatorID != myUserID)
|
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false) {
|
||||||
{
|
|
||||||
if (Convert.ToBoolean(Session[GlobalVars.IS_ADMIN]) == false)
|
|
||||||
{
|
|
||||||
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
return RedirectToAction("ReadOnly", new { issueID = issueID });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -201,30 +171,24 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
ViewBag.ShowAddApprovers = ViewBag.IsAdmin || ViewBag.IsApprover || ViewBag.IsOriginator;
|
ViewBag.ShowAddApprovers = ViewBag.IsAdmin || ViewBag.IsApprover || ViewBag.IsOriginator;
|
||||||
ViewBag.UserList = userDMO.GetAllUsers();
|
ViewBag.UserList = userDMO.GetAllUsers();
|
||||||
return View(pr);
|
return View(pr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
HandleException(issueID, e);
|
HandleException(issueID, e);
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult ReadOnly(int issueID)
|
public ActionResult ReadOnly(int issueID) {
|
||||||
{
|
|
||||||
var pr = new PartsRequest();
|
var pr = new PartsRequest();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
|
|
||||||
pr = prDMO.Get(issueID);
|
pr = prDMO.Get(issueID);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null) {
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document does not exist";
|
ViewBag.ErrorDescription = "Document does not exist";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
if (pr.CurrentStep < 0)
|
if (pr.CurrentStep < 0) {
|
||||||
{
|
|
||||||
ViewBag.ErrorDescription = "Document is deleted";
|
ViewBag.ErrorDescription = "Document is deleted";
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
@ -233,19 +197,15 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
ViewBag.IsOriginator = (pr.OriginatorID == myUserID);
|
ViewBag.IsOriginator = (pr.OriginatorID == myUserID);
|
||||||
ViewBag.UserList = userDMO.GetAllUsers();
|
ViewBag.UserList = userDMO.GetAllUsers();
|
||||||
return View(pr);
|
return View(pr);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
HandleException(issueID, e);
|
HandleException(issueID, e);
|
||||||
return View("Error");
|
return View("Error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Create()
|
public ActionResult Create() {
|
||||||
{
|
|
||||||
var pr = new PartsRequest();
|
var pr = new PartsRequest();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
pr.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
pr.OriginatorID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
|
|
||||||
if (!CanCreatePartsRequest(pr.OriginatorID) && Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
|
if (!CanCreatePartsRequest(pr.OriginatorID) && Convert.ToBoolean(Session[GlobalVars.CAN_CREATE_PARTS_REQUEST]) == false)
|
||||||
@ -254,25 +214,19 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
prDMO.Insert(pr);
|
prDMO.Insert(pr);
|
||||||
|
|
||||||
return RedirectToAction("Edit", new { issueID = pr.PRNumber });
|
return RedirectToAction("Edit", new { issueID = pr.PRNumber });
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(pr.PRNumber, e);
|
return HandleAPIException(pr.PRNumber, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool CanCreatePartsRequest(int userID)
|
public static bool CanCreatePartsRequest(int userID) {
|
||||||
{
|
|
||||||
var adminDMO = new AdminDMO();
|
var adminDMO = new AdminDMO();
|
||||||
var role = adminDMO.GetSubRoles().Where(r => string.Equals(r.RoleName, "Parts Request", StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
|
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));
|
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);
|
var users = adminDMO.GetAllUsersBySubRole(subrole.SubRoleID);
|
||||||
if (users.Count(u => u.UserID == userID) > 0)
|
if (users.Count(u => u.UserID == userID) > 0) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,62 +234,35 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Attachment_Read([DataSourceRequest]DataSourceRequest request, int prNumber)
|
public ActionResult Attachment_Read([DataSourceRequest] DataSourceRequest request, int prNumber) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return Json(prDMO.GetAttachments(prNumber).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
return Json(prDMO.GetAttachments(prNumber).ToDataSourceResult(request), JsonRequestBehavior.AllowGet);
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
return HandleAPIException(prNumber, ex);
|
return HandleAPIException(prNumber, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[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"
|
// The Name of the Upload component is "files"
|
||||||
if (files != null)
|
if (files != null) {
|
||||||
{
|
int userId = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
foreach (var file in files)
|
foreach (var file in files) {
|
||||||
{
|
prDMO.AttachSave(prNumber, userId, file.FileName, file.InputStream);
|
||||||
// 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("");
|
return Content("");
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileResult DownloadFile(string attachmentID, string prNumber)
|
public FileResult DownloadFile(string attachmentID, string prNumber) {
|
||||||
{
|
|
||||||
string fileName = prDMO.GetFileName(attachmentID);
|
string fileName = prDMO.GetFileName(attachmentID);
|
||||||
|
|
||||||
string folderPath = Functions.GetAttachmentFolder() + "PartsRequest\\" + prNumber.ToString();
|
string folderPath = _AppSettings.AttachmentFolder + "PartsRequest\\" + prNumber.ToString();
|
||||||
var sDocument = System.IO.Path.Combine(folderPath, fileName);
|
var sDocument = System.IO.Path.Combine(folderPath, fileName);
|
||||||
|
|
||||||
var FDir_AppData = Functions.GetAttachmentFolder();
|
var FDir_AppData = _AppSettings.AttachmentFolder;
|
||||||
if (!sDocument.StartsWith(FDir_AppData))
|
if (!sDocument.StartsWith(FDir_AppData)) {
|
||||||
{
|
|
||||||
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
// Ensure that we are serving file only inside the Fab2ApprovalAttachments folder
|
||||||
// and block requests outside like "../web.config"
|
// and block requests outside like "../web.config"
|
||||||
throw new HttpException(403, "Forbidden");
|
throw new HttpException(403, "Forbidden");
|
||||||
@ -348,33 +275,25 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult DeleteAttachment(int attachmentID, string fileName, int prNumber)
|
public ActionResult DeleteAttachment(int attachmentID, string fileName, int prNumber) {
|
||||||
{
|
try {
|
||||||
try
|
if (ModelState.IsValid) {
|
||||||
{
|
|
||||||
if (ModelState.IsValid)
|
|
||||||
{
|
|
||||||
prDMO.DeleteAttachment(attachmentID);
|
prDMO.DeleteAttachment(attachmentID);
|
||||||
var physicalPath = System.IO.Path.Combine(Functions.GetAttachmentFolder() + @"PartsRequest\" + prNumber.ToString(), fileName);
|
var physicalPath = System.IO.Path.Combine(_AppSettings.AttachmentFolder + @"PartsRequest\" + prNumber.ToString(), fileName);
|
||||||
|
|
||||||
if (System.IO.File.Exists(physicalPath))
|
if (System.IO.File.Exists(physicalPath)) {
|
||||||
{
|
|
||||||
System.IO.File.Delete(physicalPath);
|
System.IO.File.Delete(physicalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Content("");
|
return Content("");
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(prNumber, e, "AttachmentID=" + attachmentID.ToString());
|
return HandleAPIException(prNumber, e, "AttachmentID=" + attachmentID.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Submit(int prNumber)
|
public ActionResult Submit(int prNumber) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
|
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
@ -393,90 +312,67 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
|
|
||||||
var approvers = MiscDMO.GetApprovalsByDocument(prNumber, (int)GlobalVars.DocumentType.PartsRequest);
|
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
|
// Auto-Approve if the user is an approver for workflow step 1
|
||||||
var c = Approve(prNumber, 1, "Auto-Approve");
|
var c = Approve(prNumber, 1, "Auto-Approve");
|
||||||
if (c != null && c is ContentResult)
|
if (c != null && c is ContentResult) {
|
||||||
{
|
|
||||||
var result = ((ContentResult)c).Content;
|
var result = ((ContentResult)c).Content;
|
||||||
if (!String.Equals(result, "OK"))
|
if (!String.Equals(result, "OK"))
|
||||||
throw new Exception(result);
|
throw new Exception(result);
|
||||||
}
|
}
|
||||||
if (c != null && c is JsonResult)
|
if (c != null && c is JsonResult)
|
||||||
return c;
|
return c;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
// Do step 1 notification
|
// Do step 1 notification
|
||||||
NotifyApprovers(prNumber, 1);
|
NotifyApprovers(prNumber, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Request.IsAjaxRequest())
|
if (Request.IsAjaxRequest()) {
|
||||||
{
|
|
||||||
return Content("Redirect");
|
return Content("Redirect");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return Content("Invalid");
|
return Content("Invalid");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(prNumber, e);
|
return HandleAPIException(prNumber, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetApproversList([DataSourceRequest]DataSourceRequest request, int issueID, byte step)
|
public ActionResult GetApproversList([DataSourceRequest] DataSourceRequest request, int issueID, byte step) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
return Json(MiscDMO.GetApproversListByDocument(issueID, step, (int)GlobalVars.DocumentType.PartsRequest).ToDataSourceResult(request));
|
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());
|
return HandleAPIException(issueID, e, "Step=" + step.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetAllUsersList()
|
public ActionResult GetAllUsersList() {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
IEnumerable<LoginModel> userlist = userDMO.GetAllUsers();
|
||||||
return Json(userlist, JsonRequestBehavior.AllowGet);
|
return Json(userlist, JsonRequestBehavior.AllowGet);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(0, e);
|
return HandleAPIException(0, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult ReAssignApproval(int issueID, int fromUserID, int userIDs, byte step)
|
public ActionResult ReAssignApproval(int issueID, int fromUserID, int userIDs, byte step) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
String email = wfDMO.ReAssignApproval(
|
String email = wfDMO.ReAssignApproval(
|
||||||
issueID, fromUserID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
|
issueID, fromUserID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
|
||||||
|
|
||||||
NotifyReAssignment(issueID, email);
|
NotifyReAssignment(issueID, email);
|
||||||
|
|
||||||
return Content("OK");
|
return Content("OK");
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(issueID, e);
|
return HandleAPIException(issueID, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Approve(int prNumber, byte currentStep, string comments)
|
public ActionResult Approve(int prNumber, byte currentStep, string comments) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
bool lastStep = false;
|
bool lastStep = false;
|
||||||
bool lastApproverInCurrentStep = false;
|
bool lastApproverInCurrentStep = false;
|
||||||
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
int myUserID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
@ -486,18 +382,20 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
if (pr == null)
|
if (pr == null)
|
||||||
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Document does not exist");
|
return new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Document does not exist");
|
||||||
|
|
||||||
while (true)
|
while (true) {
|
||||||
{
|
|
||||||
|
|
||||||
lastApproverInCurrentStep = wfDMO.Approve(
|
lastApproverInCurrentStep = wfDMO.Approve(
|
||||||
prNumber, currentStep, comments, out lastStep,
|
_AppSettings,
|
||||||
|
prNumber,
|
||||||
|
currentStep,
|
||||||
|
comments,
|
||||||
|
out lastStep,
|
||||||
(int)Session[GlobalVars.SESSION_USERID],
|
(int)Session[GlobalVars.SESSION_USERID],
|
||||||
(int)GlobalVars.DocumentType.PartsRequest,
|
(int)GlobalVars.DocumentType.PartsRequest,
|
||||||
WorkflowNumber);
|
WorkflowNumber);
|
||||||
|
|
||||||
if (!lastApproverInCurrentStep) break;
|
if (!lastApproverInCurrentStep)
|
||||||
if (lastStep)
|
break;
|
||||||
{
|
if (lastStep) {
|
||||||
NotifyCompletion(prNumber);
|
NotifyCompletion(prNumber);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -509,27 +407,22 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return Content("No approvers found for next step, contact support!");
|
return Content("No approvers found for next step, contact support!");
|
||||||
|
|
||||||
// only continue with approving if the next step has me as an approver also
|
// 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);
|
NotifyApprovers(prNumber, currentStep);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("OK");
|
return Content("OK");
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(prNumber, e);
|
return HandleAPIException(prNumber, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void SendEmailNotification(String subject, int prNumber, string toEmail, string emailTemplate)
|
protected void SendEmailNotification(string subject, int prNumber, string toEmail, string emailTemplate) {
|
||||||
{
|
|
||||||
|
|
||||||
string senderName = "Parts Request";
|
string senderName = "Parts Request";
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(subject, System.Configuration.ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
EmailNotification en = new EmailNotification(_AppSettings, subject, System.Configuration.ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
string[] emailparams = new string[5];
|
string[] emailparams = new string[5];
|
||||||
emailparams[0] = prNumber.ToString();
|
emailparams[0] = prNumber.ToString();
|
||||||
emailparams[1] = prNumber.ToString();
|
emailparams[1] = prNumber.ToString();
|
||||||
@ -539,11 +432,9 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
String userEmail = toEmail;
|
String userEmail = toEmail;
|
||||||
|
|
||||||
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
en.SendNotificationEmail(emailTemplate, GlobalVars.SENDER_EMAIL, senderName, userEmail, null, subject, emailparams);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void NotifyReAssignment(int prNumber, string email)
|
protected void NotifyReAssignment(int prNumber, string email) {
|
||||||
{
|
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null)
|
||||||
@ -555,8 +446,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
toEmail: email,
|
toEmail: email,
|
||||||
emailTemplate: "PRReAssigned.txt");
|
emailTemplate: "PRReAssigned.txt");
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog()
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
{
|
|
||||||
IssueID = prNumber,
|
IssueID = prNumber,
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
DocumentType = "PR",
|
DocumentType = "PR",
|
||||||
@ -565,24 +455,21 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void NotifyCompletion(int prNumber)
|
protected void NotifyCompletion(int prNumber) {
|
||||||
{
|
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var u = userDMO.GetUserByID(pr.RequestorID);
|
var u = userDMO.GetUserByID(pr.RequestorID);
|
||||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email)))
|
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||||
{
|
|
||||||
SendEmailNotification(
|
SendEmailNotification(
|
||||||
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Completion notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: u.Email,
|
toEmail: u.Email,
|
||||||
emailTemplate: "PRCompleted.txt");
|
emailTemplate: "PRCompleted.txt");
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog()
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
{
|
|
||||||
IssueID = prNumber,
|
IssueID = prNumber,
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
DocumentType = "PR",
|
DocumentType = "PR",
|
||||||
@ -592,24 +479,21 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void NotifyRejection(int prNumber)
|
public void NotifyRejection(int prNumber) {
|
||||||
{
|
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var u = userDMO.GetUserByID(pr.OriginatorID);
|
var u = userDMO.GetUserByID(pr.OriginatorID);
|
||||||
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email)))
|
if ((u != null) && (!String.IsNullOrWhiteSpace(u.Email))) {
|
||||||
{
|
|
||||||
SendEmailNotification(
|
SendEmailNotification(
|
||||||
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Rejection notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: u.Email,
|
toEmail: u.Email,
|
||||||
emailTemplate: "PRReject.txt");
|
emailTemplate: "PRReject.txt");
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog()
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
{
|
|
||||||
IssueID = prNumber,
|
IssueID = prNumber,
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
DocumentType = "PR",
|
DocumentType = "PR",
|
||||||
@ -619,10 +503,8 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void NotifyApprovers(int prNumber, byte step)
|
protected void NotifyApprovers(int prNumber, byte step) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
|
|
||||||
var pr = prDMO.Get(prNumber);
|
var pr = prDMO.Get(prNumber);
|
||||||
@ -633,68 +515,55 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
List<string> emailList = MiscDMO.GetApproverEmailListByDocument(
|
List<string> emailList = MiscDMO.GetApproverEmailListByDocument(
|
||||||
prNumber, step, (int)GlobalVars.DocumentType.PartsRequest).Distinct().ToList();
|
prNumber, step, (int)GlobalVars.DocumentType.PartsRequest).Distinct().ToList();
|
||||||
|
|
||||||
foreach (string email in emailList)
|
foreach (string email in emailList) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
SendEmailNotification(
|
SendEmailNotification(
|
||||||
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
subject: String.Format("Parts Request Assignment notice for # {0} - {1}", pr.PRNumber, pr.Title),
|
||||||
prNumber: prNumber,
|
prNumber: prNumber,
|
||||||
toEmail: email,
|
toEmail: email,
|
||||||
emailTemplate: "PRAssigned.txt");
|
emailTemplate: "PRAssigned.txt");
|
||||||
}
|
} catch (Exception ex) {
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
HandleException(prNumber, ex, "email=" + email);
|
HandleException(prNumber, ex, "email=" + email);
|
||||||
}
|
}
|
||||||
|
|
||||||
emailSentList += email + ",";
|
emailSentList += email + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
EventLogDMO.Add(new WinEventLog() {
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
IssueID = prNumber, UserID = @User.Identity.Name, DocumentType = "PR", OperationType = "Email",
|
IssueID = prNumber,
|
||||||
Comments = "Approvers for Step " + step.ToString() + ":" + emailSentList });
|
UserID = @User.Identity.Name,
|
||||||
}
|
DocumentType = "PR",
|
||||||
catch { }
|
OperationType = "Email",
|
||||||
}
|
Comments = "Approvers for Step " + step.ToString() + ":" + emailSentList
|
||||||
catch (Exception e)
|
});
|
||||||
{
|
} catch { }
|
||||||
|
} catch (Exception e) {
|
||||||
HandleException(prNumber, e, "Step=" + step.ToString());
|
HandleException(prNumber, e, "Step=" + step.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Reject(int prNumber, byte currentStep, string comments)
|
public ActionResult Reject(int prNumber, byte currentStep, string comments) {
|
||||||
{
|
try {
|
||||||
try
|
if (Session[GlobalVars.SESSION_USERID] != null) {
|
||||||
{
|
|
||||||
if (Session[GlobalVars.SESSION_USERID] != null)
|
|
||||||
{
|
|
||||||
wfDMO.Reject(prNumber, currentStep, comments, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.PartsRequest);
|
wfDMO.Reject(prNumber, currentStep, comments, (int)Session[GlobalVars.SESSION_USERID], (int)GlobalVars.DocumentType.PartsRequest);
|
||||||
NotifyRejection(prNumber);
|
NotifyRejection(prNumber);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
Response.Redirect("~/Account/Login");
|
Response.Redirect("~/Account/Login");
|
||||||
}
|
}
|
||||||
|
|
||||||
return Content("OK");
|
return Content("OK");
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
return HandleAPIException(prNumber, 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);
|
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);
|
var pr = prDMO.Get(prNumber);
|
||||||
|
|
||||||
if (pr == null)
|
if (pr == null)
|
||||||
@ -706,8 +575,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
toEmail: email,
|
toEmail: email,
|
||||||
emailTemplate: "PRAssigned.txt");
|
emailTemplate: "PRAssigned.txt");
|
||||||
|
|
||||||
EventLogDMO.Add(new WinEventLog()
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
{
|
|
||||||
IssueID = prNumber,
|
IssueID = prNumber,
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
DocumentType = "PR",
|
DocumentType = "PR",
|
||||||
@ -717,37 +585,33 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void AddAdditionalApproval(int issueID, byte step, string userIDs)
|
public void AddAdditionalApproval(int issueID, byte step, string userIDs) {
|
||||||
{
|
|
||||||
var emailArray = "";
|
var emailArray = "";
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
emailArray = wfDMO.AddAdditionalApproval(issueID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
|
emailArray = wfDMO.AddAdditionalApproval(issueID, userIDs, step, (int)GlobalVars.DocumentType.PartsRequest);
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
HandleAPIException(issueID, e);
|
HandleAPIException(issueID, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
string[] emaiList = emailArray.Split(new char[] { '~' });
|
string[] emaiList = emailArray.Split(new char[] { '~' });
|
||||||
foreach (string email in emaiList)
|
foreach (string email in emaiList) {
|
||||||
{
|
if (email.Length > 0) {
|
||||||
if (email.Length > 0)
|
|
||||||
{
|
|
||||||
NotifyAssignment(issueID, email);
|
NotifyAssignment(issueID, email);
|
||||||
emailSentList += email + ",";
|
emailSentList += email + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
EventLogDMO.Add(new WinEventLog() {
|
||||||
EventLogDMO.Add(new WinEventLog() { IssueID = issueID, UserID = @User.Identity.Name, DocumentType = "PR",
|
IssueID = issueID,
|
||||||
OperationType = "Email", Comments = "Additional Approver: " + emailSentList });
|
UserID = @User.Identity.Name,
|
||||||
}
|
DocumentType = "PR",
|
||||||
catch { }
|
OperationType = "Email",
|
||||||
|
Comments = "Additional Approver: " + emailSentList
|
||||||
|
});
|
||||||
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,32 +1,29 @@
|
|||||||
using System;
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
|
||||||
{
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class ReportsController : Controller
|
public class ReportsController : Controller {
|
||||||
{
|
|
||||||
public const String specialNullString = "~NULL~";
|
public const String specialNullString = "~NULL~";
|
||||||
|
|
||||||
// GET: Export
|
// GET: Export
|
||||||
public ActionResult Index()
|
public ActionResult Index() {
|
||||||
{
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
ViewBag.HasITARAccess = userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]);
|
ViewBag.HasITARAccess = userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]);
|
||||||
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult Report(String id, String docType = "")
|
public ActionResult Report(String id, String docType = "") {
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(id))
|
if (String.IsNullOrEmpty(id))
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
|
|
||||||
@ -34,12 +31,10 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
if (!userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]))
|
if (!userDMO.GetITARAccess((int)Session[GlobalVars.SESSION_USERID]))
|
||||||
return View("UnAuthorizedAccess");
|
return View("UnAuthorizedAccess");
|
||||||
|
|
||||||
var m = new ReportViewModel();
|
var m = new ReportViewModel<System.Web.Mvc.SelectListItem>();
|
||||||
var reports = GetReportList(docType);
|
var reports = GetReportList(docType);
|
||||||
foreach (var report in reports)
|
foreach (var report in reports) {
|
||||||
{
|
if (String.Equals(report.ReportID, id, StringComparison.OrdinalIgnoreCase)) {
|
||||||
if (String.Equals(report.ReportID, id, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
m.ReportID = report.ReportID;
|
m.ReportID = report.ReportID;
|
||||||
m.ReportName = report.Name;
|
m.ReportName = report.Name;
|
||||||
m.Description = report.Description;
|
m.Description = report.Description;
|
||||||
@ -47,9 +42,8 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
|
|
||||||
var c = SetupSSRSHelperClient();
|
var c = SetupSSRSHelperClient();
|
||||||
|
|
||||||
m.Parameters = c.GetReportParameters(report.FullPath).Select(parm =>
|
m.Parameters = c.GetReportParameters(report.FullPath).Select(parm => {
|
||||||
{
|
var r = new ReportParameterViewModel<System.Web.Mvc.SelectListItem>();
|
||||||
var r = new ReportParameterViewModel();
|
|
||||||
r.Visible = (parm.PromptUser.HasValue == false || parm.PromptUser == true) && !String.IsNullOrEmpty(parm.Prompt);
|
r.Visible = (parm.PromptUser.HasValue == false || parm.PromptUser == true) && !String.IsNullOrEmpty(parm.Prompt);
|
||||||
r.Prompt = parm.Prompt;
|
r.Prompt = parm.Prompt;
|
||||||
r.Name = parm.Name;
|
r.Name = parm.Name;
|
||||||
@ -65,11 +59,9 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
r.ControlType = ParameterControlTypes.Textbox;
|
r.ControlType = ParameterControlTypes.Textbox;
|
||||||
|
|
||||||
r.SelectList = null;
|
r.SelectList = null;
|
||||||
if (parm.ValidValues != null)
|
if (parm.ValidValues != null) {
|
||||||
{
|
|
||||||
r.SelectList = parm.ValidValues.Select(vv => {
|
r.SelectList = parm.ValidValues.Select(vv => {
|
||||||
return new SelectListItem()
|
return new SelectListItem() {
|
||||||
{
|
|
||||||
Text = vv.Value,
|
Text = vv.Value,
|
||||||
Value = (vv.Key == null ? specialNullString : vv.Key),
|
Value = (vv.Key == null ? specialNullString : vv.Key),
|
||||||
Selected = (parm.DefaultValues != null && parm.DefaultValues.Contains(vv.Key))
|
Selected = (parm.DefaultValues != null && parm.DefaultValues.Contains(vv.Key))
|
||||||
@ -90,8 +82,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return View(m);
|
return View(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
public SSRSHelper.SSRSClient SetupSSRSHelperClient()
|
public SSRSHelper.SSRSClient SetupSSRSHelperClient() {
|
||||||
{
|
|
||||||
var useCfgForBindings = false;
|
var useCfgForBindings = false;
|
||||||
if (String.Equals(System.Configuration.ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"], "true", StringComparison.OrdinalIgnoreCase))
|
if (String.Equals(System.Configuration.ConfigurationManager.AppSettings["SSRSBindingsByConfiguration"], "true", StringComparison.OrdinalIgnoreCase))
|
||||||
useCfgForBindings = true;
|
useCfgForBindings = true;
|
||||||
@ -107,8 +98,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType)
|
private IEnumerable<SSRSHelper.ReportInfo> GetReportList(String docType) {
|
||||||
{
|
|
||||||
String folderName = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSFolder"]);
|
String folderName = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["SSRSFolder"]);
|
||||||
if (folderName.EndsWith("/"))
|
if (folderName.EndsWith("/"))
|
||||||
folderName = folderName.TrimEnd('/');
|
folderName = folderName.TrimEnd('/');
|
||||||
@ -119,13 +109,12 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
return c.ListReports(folderName);
|
return c.ListReports(folderName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult GetReports(String docType)
|
public ActionResult GetReports(String docType) {
|
||||||
{
|
|
||||||
var reports = GetReportList(docType);
|
var reports = GetReportList(docType);
|
||||||
|
|
||||||
return Json(new { Data =
|
return Json(new {
|
||||||
reports.Select(r => new ReportViewModel()
|
Data =
|
||||||
{
|
reports.Select(r => new ReportViewModel<System.Web.Mvc.SelectListItem>() {
|
||||||
ReportName = r.Name ?? "",
|
ReportName = r.Name ?? "",
|
||||||
Description = r.Description ?? "",
|
Description = r.Description ?? "",
|
||||||
ReportID = r.ReportID ?? "",
|
ReportID = r.ReportID ?? "",
|
||||||
@ -136,8 +125,7 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult ExportReport(String DocType, String ReportID)
|
public ActionResult ExportReport(String DocType, String ReportID) {
|
||||||
{
|
|
||||||
var c = SetupSSRSHelperClient();
|
var c = SetupSSRSHelperClient();
|
||||||
var reports = GetReportList(DocType);
|
var reports = GetReportList(DocType);
|
||||||
|
|
||||||
@ -152,17 +140,12 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
parms.Add("UserID", Convert.ToString(Session[GlobalVars.SESSION_USERID]));
|
parms.Add("UserID", Convert.ToString(Session[GlobalVars.SESSION_USERID]));
|
||||||
parms.Add("BaseURL", GlobalVars.hostURL);
|
parms.Add("BaseURL", GlobalVars.hostURL);
|
||||||
|
|
||||||
foreach (var rp in reportParms)
|
foreach (var rp in reportParms) {
|
||||||
{
|
if (rp.MultiValue.HasValue && rp.MultiValue.Value) {
|
||||||
if (rp.MultiValue.HasValue && rp.MultiValue.Value)
|
foreach (String v in Request.Params.GetValues("parm_" + rp.Name)) {
|
||||||
{
|
|
||||||
foreach (String v in Request.Params.GetValues("parm_" + rp.Name))
|
|
||||||
{
|
|
||||||
parms.Add(rp.Name, v);
|
parms.Add(rp.Name, v);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
String value = null;
|
String value = null;
|
||||||
|
|
||||||
if (Request.Params.AllKeys.Contains("parm_" + rp.Name))
|
if (Request.Params.AllKeys.Contains("parm_" + rp.Name))
|
||||||
@ -174,10 +157,8 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
if ((rp.AllowBlank.HasValue == false || rp.AllowBlank.Value == false) && value == "")
|
if ((rp.AllowBlank.HasValue == false || rp.AllowBlank.Value == false) && value == "")
|
||||||
value = null;
|
value = null;
|
||||||
|
|
||||||
if (value == null)
|
if (value == null) {
|
||||||
{
|
if (rp.Nullable.HasValue == false || rp.Nullable.Value == false) {
|
||||||
if (rp.Nullable.HasValue == false || rp.Nullable.Value == false)
|
|
||||||
{
|
|
||||||
if (rp.DefaultValues != null && rp.DefaultValues.Length > 0)
|
if (rp.DefaultValues != null && rp.DefaultValues.Length > 0)
|
||||||
value = rp.DefaultValues[0];
|
value = rp.DefaultValues[0];
|
||||||
if (value == null)
|
if (value == null)
|
||||||
@ -190,25 +171,18 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
var b = c.ExportReport(report.FullPath, @User.Identity.Name, parms, "EXCELOPENXML");
|
var b = c.ExportReport(report.FullPath, @User.Identity.Name, parms, "EXCELOPENXML");
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
var b2 = c.FreezeExcelHeaders(b);
|
var b2 = c.FreezeExcelHeaders(b);
|
||||||
return File(b2, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
|
return File(b2, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
return File(b, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
|
return File(b, "application/octet-stream", MakeFilename(report.Name) + ".xlsx");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String MakeFilename(String reportName)
|
protected String MakeFilename(String reportName) {
|
||||||
{
|
|
||||||
String r = "";
|
String r = "";
|
||||||
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
var invalidChars = System.IO.Path.GetInvalidFileNameChars();
|
||||||
foreach (char c in reportName)
|
foreach (char c in reportName) {
|
||||||
{
|
|
||||||
if (invalidChars.Contains(c))
|
if (invalidChars.Contains(c))
|
||||||
r += '_';
|
r += '_';
|
||||||
else
|
else
|
||||||
@ -218,4 +192,3 @@ namespace Fab2ApprovalSystem.Controllers
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,31 +1,34 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
|
using Fab2ApprovalSystem.Misc;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
using Fab2ApprovalSystem.Utilities;
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using System.Configuration;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers {
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[SessionExpireFilter]
|
[SessionExpireFilter]
|
||||||
public class TrainingController : Controller {
|
public class TrainingController : Controller {
|
||||||
|
|
||||||
UserAccountDMO userDMO = new UserAccountDMO();
|
UserAccountDMO userDMO = new UserAccountDMO();
|
||||||
AdminDMO adminDMO = new AdminDMO();
|
AdminDMO adminDMO = new AdminDMO();
|
||||||
TrainingDMO trainingDMO = new TrainingDMO();
|
TrainingDMO trainingDMO = new TrainingDMO();
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
public EmailUtilities emailer = new EmailUtilities();
|
private readonly AppSettings _AppSettings;
|
||||||
|
|
||||||
// GET: Training
|
// GET: Training
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public int Create(int ecnId, List<int> groupIds)
|
|
||||||
public int Create(int ecnId) {
|
public int Create(int ecnId) {
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
|
|
||||||
@ -176,7 +179,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
|
public void NotifyTrainee(int userId, int assignmentId, int ecnId, string title) {
|
||||||
try {
|
try {
|
||||||
string emailSentList = "";
|
string emailSentList = "";
|
||||||
string recipient = userDMO.GetUserEmailByID(userId.ToString());
|
string recipient = userDMO.GetUserEmailByID(userId);
|
||||||
|
|
||||||
string emailTemplate = "ECNTrainingAssigned.txt";
|
string emailTemplate = "ECNTrainingAssigned.txt";
|
||||||
string userEmail = string.Empty;
|
string userEmail = string.Empty;
|
||||||
@ -185,7 +188,7 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
|
|
||||||
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
|
subject = "ECN# " + ecnId + " - Training Assignment Notice - " + title;
|
||||||
|
|
||||||
EmailNotification en = new EmailNotification(subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
EmailNotification en = new EmailNotification(_AppSettings, subject, ConfigurationManager.AppSettings["EmailTemplatesPath"]);
|
||||||
userEmail = recipient;
|
userEmail = recipient;
|
||||||
string[] emailparams = new string[4];
|
string[] emailparams = new string[4];
|
||||||
emailparams[0] = assignmentId.ToString();
|
emailparams[0] = assignmentId.ToString();
|
||||||
@ -343,12 +346,10 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
trainingAssignments = groupFilteredTraining;
|
trainingAssignments = groupFilteredTraining;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (statusFilter != "" && statusFilter != null) {
|
if (statusFilter != "" && statusFilter != null) {
|
||||||
List<TrainingAssignment> filteredTraining = new List<TrainingAssignment>();
|
List<TrainingAssignment> filteredTraining = new List<TrainingAssignment>();
|
||||||
switch (statusFilter) {
|
switch (statusFilter) {
|
||||||
|
|
||||||
case "1":
|
case "1":
|
||||||
//Completed
|
//Completed
|
||||||
filteredTraining = (from a in trainingAssignments where a.status == true && a.Deleted != true select a).ToList();
|
filteredTraining = (from a in trainingAssignments where a.status == true && a.Deleted != true select a).ToList();
|
||||||
@ -390,8 +391,6 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method to return all the training assignments for a specified user
|
/// Method to return all the training assignments for a specified user
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult ViewMyTrainingAssignments() {
|
public ActionResult ViewMyTrainingAssignments() {
|
||||||
int userID = (int)Session[GlobalVars.SESSION_USERID];
|
int userID = (int)Session[GlobalVars.SESSION_USERID];
|
||||||
List<TrainingAssignment> assignments = trainingDMO.GetTrainingAssignmentsByUserID(userID);
|
List<TrainingAssignment> assignments = trainingDMO.GetTrainingAssignmentsByUserID(userID);
|
||||||
@ -417,8 +416,6 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Method to return all assigned documents for a specified training assignment
|
/// Method to return all assigned documents for a specified training assignment
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="assignmentID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public ActionResult ViewMyTrainingAssignment(int assignmentID, int ECNNumber) {
|
public ActionResult ViewMyTrainingAssignment(int assignmentID, int ECNNumber) {
|
||||||
ViewBag.ECNNumber = ECNNumber;
|
ViewBag.ECNNumber = ECNNumber;
|
||||||
ViewBag.AssignmentID = assignmentID;
|
ViewBag.AssignmentID = assignmentID;
|
||||||
@ -563,7 +560,6 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
|
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
|
||||||
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
|
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
|
||||||
foreach (TrainingAssignment assignment in openAssignments) {
|
foreach (TrainingAssignment assignment in openAssignments) {
|
||||||
|
|
||||||
if (!userDMO.GetUserByID(assignment.UserID).OOO) {
|
if (!userDMO.GetUserByID(assignment.UserID).OOO) {
|
||||||
trainingSectionUserCount++;
|
trainingSectionUserCount++;
|
||||||
|
|
||||||
@ -581,11 +577,12 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
trainingSection += "</table>";
|
trainingSection += "</table>";
|
||||||
if (trainingSectionUserCount > 0) emailBody += trainingSection;
|
if (trainingSectionUserCount > 0)
|
||||||
|
emailBody += trainingSection;
|
||||||
}
|
}
|
||||||
string recipientEmail = "";
|
string recipientEmail = "";
|
||||||
List<string> ccRecipients = emailList;
|
List<string> ccRecipients = emailList;
|
||||||
emailer.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Mesa Approval Daily Open Training Report", emailBody, "Daily Open Training Report");
|
EmailUtilities.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Daily Open Training Report", emailBody);
|
||||||
isSuccess = true;
|
isSuccess = true;
|
||||||
} catch {
|
} catch {
|
||||||
isSuccess = false;
|
isSuccess = false;
|
||||||
@ -593,4 +590,3 @@ namespace Fab2ApprovalSystem.Controllers {
|
|||||||
return isSuccess;
|
return isSuccess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -5,87 +5,69 @@ using System.Net;
|
|||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Web.Http;
|
using System.Web.Http;
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
{
|
|
||||||
|
|
||||||
public class WebAPIController : ApiController
|
public class WebAPIController : ApiController {
|
||||||
{
|
|
||||||
public TrainingController trainingFunctions = new TrainingController();
|
public TrainingController trainingFunctions = new TrainingController();
|
||||||
public CorrectiveActionController carFunctions = new CorrectiveActionController();
|
public CorrectiveActionController carFunctions;
|
||||||
public AccountController accountFunctions = new AccountController();
|
public AccountController accountFunctions = new AccountController();
|
||||||
public HomeController homeFunctions = new HomeController();
|
public HomeController homeFunctions;
|
||||||
public string Get()
|
private readonly AppSettings _AppSettings;
|
||||||
{
|
|
||||||
|
public WebAPIController(AppSettings appSettings) {
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
carFunctions = new CorrectiveActionController(appSettings);
|
||||||
|
homeFunctions = new HomeController(appSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Get() {
|
||||||
return "Welcome To Web API";
|
return "Welcome To Web API";
|
||||||
}
|
}
|
||||||
public List<string> Get(int Id)
|
public List<string> Get(int Id) {
|
||||||
{
|
|
||||||
return new List<string> {
|
return new List<string> {
|
||||||
"Data1",
|
"Data1",
|
||||||
"Data2"
|
"Data2"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Post()
|
public void Post() {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponseMessage Post(HttpRequestMessage request, string action)
|
public HttpResponseMessage Post(HttpRequestMessage request, string action) {
|
||||||
{
|
switch (action) {
|
||||||
|
|
||||||
switch (action)
|
|
||||||
{
|
|
||||||
case "TrainingReport":
|
case "TrainingReport":
|
||||||
if (trainingFunctions.RunTrainingReport())
|
if (trainingFunctions.RunTrainingReport()) {
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.OK);
|
return request.CreateResponse(HttpStatusCode.OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
case "CARDueDates":
|
case "CARDueDates":
|
||||||
if (carFunctions.ProcessCARDueDates())
|
if (carFunctions.ProcessCARDueDates()) {
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.OK);
|
return request.CreateResponse(HttpStatusCode.OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
case "ProcessOoO":
|
case "ProcessOoO":
|
||||||
if (homeFunctions.ProcessOoO())
|
if (homeFunctions.ProcessOoO()) {
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.OK);
|
return request.CreateResponse(HttpStatusCode.OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
case "ExpireOoO":
|
case "ExpireOoO":
|
||||||
if (homeFunctions.ExpireOoO())
|
if (homeFunctions.ExpireOoO()) {
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.OK);
|
return request.CreateResponse(HttpStatusCode.OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
case "ApprovalReminders":
|
case "ApprovalReminders":
|
||||||
if (homeFunctions.ApprovalsReminderNotifications())
|
if (homeFunctions.ApprovalsReminderNotifications()) {
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.OK);
|
return request.CreateResponse(HttpStatusCode.OK);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
return request.CreateResponse(HttpStatusCode.InternalServerError);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
return request.CreateResponse(HttpStatusCode.InternalServerError, "Action Not Found");
|
return request.CreateResponse(HttpStatusCode.InternalServerError, "Action Not Found");
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,99 +1,81 @@
|
|||||||
using Fab2ApprovalSystem.DMO;
|
using Fab2ApprovalSystem.DMO;
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
using Kendo.Mvc.Extensions;
|
||||||
using Kendo.Mvc.UI;
|
using Kendo.Mvc.UI;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Kendo.Mvc.Extensions;
|
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Controllers;
|
||||||
|
|
||||||
|
public class WorkflowController : Controller {
|
||||||
namespace Fab2ApprovalSystem.Controllers
|
|
||||||
{
|
|
||||||
public class WorkflowController : Controller
|
|
||||||
{
|
|
||||||
//
|
//
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /Workflow/Details/5
|
// GET: /Workflow/Details/5
|
||||||
public ActionResult Details(int id)
|
public ActionResult Details(int id) {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /Workflow/Create
|
// GET: /Workflow/Create
|
||||||
public ActionResult Create()
|
public ActionResult Create() {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// POST: /Workflow/Create
|
// POST: /Workflow/Create
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Create(FormCollection collection)
|
public ActionResult Create(FormCollection collection) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO: Add insert logic here
|
// TODO: Add insert logic here
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /Workflow/Edit/5
|
// GET: /Workflow/Edit/5
|
||||||
public ActionResult Edit(int id)
|
public ActionResult Edit(int id) {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// POST: /Workflow/Edit/5
|
// POST: /Workflow/Edit/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Edit(int id, FormCollection collection)
|
public ActionResult Edit(int id, FormCollection collection) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO: Add update logic here
|
// TODO: Add update logic here
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// GET: /Workflow/Delete/5
|
// GET: /Workflow/Delete/5
|
||||||
public ActionResult Delete(int id)
|
public ActionResult Delete(int id) {
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// POST: /Workflow/Delete/5
|
// POST: /Workflow/Delete/5
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Delete(int id, FormCollection collection)
|
public ActionResult Delete(int id, FormCollection collection) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
// TODO: Add delete logic here
|
// TODO: Add delete logic here
|
||||||
|
|
||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
59
Fab2ApprovalSystem/DMO/AccountDMO.cs
Normal file
59
Fab2ApprovalSystem/DMO/AccountDMO.cs
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,29 +1,62 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Dapper;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using Dapper;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
public class AdminDMO
|
public class AdminDMO {
|
||||||
{
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
#if !NET8
|
||||||
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
|
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
|
||||||
|
#endif
|
||||||
|
|
||||||
/// <summary>
|
public List<ParentChildModel> GetAllSubRoles(string showInactiveRoles = "") {
|
||||||
///
|
List<ParentChildModel> results = new();
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
List<Role> roles = GetSubRoles();
|
||||||
public List<Role> GetSubRoles()
|
|
||||||
{
|
ParentChildModel child;
|
||||||
StringBuilder sql = new StringBuilder();
|
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") == false)
|
||||||
|
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();
|
||||||
sql.Append(
|
sql.Append(
|
||||||
"SELECT R.RoleID, R.RoleName, SubRoleID, SubRoleCategoryItem, SR.RoleID, SR.Inactive " +
|
"SELECT R.RoleID, R.RoleName, SubRoleID, SubRoleCategoryItem, SR.RoleID, SR.Inactive " +
|
||||||
"FROM vSubRoles SR " +
|
"FROM vSubRoles SR " +
|
||||||
@ -31,13 +64,11 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
"ORDER BY R.RoleID, SubRoleCategoryItem ");
|
"ORDER BY R.RoleID, SubRoleCategoryItem ");
|
||||||
|
|
||||||
db.Open();
|
db.Open();
|
||||||
var lookup = new Dictionary<int, Role>();
|
Dictionary<int, Role> lookup = new();
|
||||||
List<Role> data = this.db.Query<Role, SubRole, Role>(sql.ToString(),
|
List<Role> data = db.Query<Role, SubRole, Role>(sql.ToString(),
|
||||||
(parent, child) =>
|
(parent, child) => {
|
||||||
{
|
|
||||||
Role role;
|
Role role;
|
||||||
if (!lookup.TryGetValue(parent.RoleID, out role))
|
if (!lookup.TryGetValue(parent.RoleID, out role)) {
|
||||||
{
|
|
||||||
lookup.Add(parent.RoleID, role = parent);
|
lookup.Add(parent.RoleID, role = parent);
|
||||||
}
|
}
|
||||||
//if (role.RoleID == null)
|
//if (role.RoleID == null)
|
||||||
@ -47,141 +78,111 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
},
|
},
|
||||||
splitOn: "SubRoleID").Distinct().ToList();
|
splitOn: "SubRoleID").Distinct().ToList();
|
||||||
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
///
|
||||||
/// </summary>
|
public List<UserSubRoles> GetUserSubRoles(int userId) {
|
||||||
/// /// <param name="userId"></param>
|
DynamicParameters parameters = new();
|
||||||
/// <returns></returns>
|
|
||||||
public List<UserSubRoles> GetUserSubRoles(int userId)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserId", userId);
|
parameters.Add("@UserId", userId);
|
||||||
var userSubRoleList = this.db.Query<UserSubRoles>("GetSubRolesByUserId", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<UserSubRoles> userSubRoleList = db.Query<UserSubRoles>("GetSubRolesByUserId", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return userSubRoleList;
|
return userSubRoleList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<LoginModel> GetAllUsersBySubRole(int subRole) {
|
||||||
/// <summary>
|
StringBuilder sql = new();
|
||||||
///
|
|
||||||
/// </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("SELECT FirstName + ' ' + LastName AS FullName , LoginID, FirstName, LastName, U.UserID, SubRoleID ");
|
||||||
sql.Append("FROM UserSubRole UR ");
|
sql.Append("FROM UserSubRole UR ");
|
||||||
sql.Append("INNER JOIN Users U ON UR.UserID = U.UserID ");
|
sql.Append("INNER JOIN Users U ON UR.UserID = U.UserID ");
|
||||||
sql.Append("WHERE UR.SubRoleID = " + subRole.ToString() + " ");
|
sql.Append("WHERE UR.SubRoleID = " + subRole.ToString() + " ");
|
||||||
sql.Append("ORDER BY FirstName");
|
sql.Append("ORDER BY FirstName");
|
||||||
|
|
||||||
return this.db.Query<LoginModel>(sql.ToString()).ToList();
|
return 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 sql;
|
||||||
|
|
||||||
string[] arrayOfUsers = userids.Split(new char[] { '~' });
|
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 + " )";
|
sql = "INSERT INTO UserSubRole (UserID, SubRoleID) VALUES (" + arrayOfUsers[i] + ", " + subRole + " )";
|
||||||
this.db.Execute(sql);
|
db.Execute(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteUserFromAllTrainingGroups(int userId)
|
public void DeleteUserFromAllTrainingGroups(int userId) {
|
||||||
{
|
|
||||||
string sql = "DELETE FROM TrainingGroupMembers WHERE UserId = " + userId;
|
string sql = "DELETE FROM TrainingGroupMembers WHERE UserId = " + userId;
|
||||||
|
|
||||||
|
db.Open();
|
||||||
this.db.Open();
|
db.Execute(sql);
|
||||||
this.db.Execute(sql);
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
public void DeleteUserRoles(int subRole, string userids) {
|
||||||
/// </summary>
|
|
||||||
/// <param name="subRole"></param>
|
|
||||||
/// <param name="userids"></param>
|
|
||||||
public void DeleteUserRoles(int subRole, string userids)
|
|
||||||
{
|
|
||||||
string sql;
|
string sql;
|
||||||
|
|
||||||
string[] arrayOfUsers = userids.Split(new char[] { '~' });
|
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;
|
sql = "DELETE FROM UserSubRole WHERE UserID = " + arrayOfUsers[i] + " AND SubRoleID = " + subRole;
|
||||||
this.db.Execute(sql);
|
db.Execute(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public List<TrainingReportUser> GetTrainingReportUsers()
|
#if !NET8
|
||||||
{
|
public List<TrainingReportUser> GetTrainingReportUsers() {
|
||||||
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
|
List<TrainingReportUser> CurrentReportUsers = (from a in FabApprovalDB.TrainingReportUsers select a).ToList();
|
||||||
return CurrentReportUsers;
|
return CurrentReportUsers;
|
||||||
}
|
}
|
||||||
public List<TECNNotificationsUser> GetTECNNotificationUsers()
|
#else
|
||||||
{
|
public List<TrainingReportUser> GetTrainingReportUsers() => throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
|
#if !NET8
|
||||||
|
public List<TECNNotificationsUser> GetTECNNotificationUsers() {
|
||||||
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
|
List<TECNNotificationsUser> currentTECNNotificationUsers = (from a in FabApprovalDB.TECNNotificationsUsers select a).ToList();
|
||||||
return currentTECNNotificationUsers;
|
return currentTECNNotificationUsers;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void TrainingReportAddUser(int userId)
|
public void TrainingReportAddUser(int userId) {
|
||||||
{
|
|
||||||
string sql = "INSERT INTO TrainingReportUsers (UserId) " + "VALUES ('" + userId + "') ";
|
string sql = "INSERT INTO TrainingReportUsers (UserId) " + "VALUES ('" + userId + "') ";
|
||||||
|
|
||||||
|
db.Open();
|
||||||
this.db.Open();
|
db.Execute(sql);
|
||||||
this.db.Execute(sql);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
public void TECNExpirationAddUser(int userId)
|
|
||||||
{
|
public void TECNExpirationAddUser(int userId) {
|
||||||
string sql = "INSERT INTO TECNNotificationsUsers (UserId) " + "VALUES ('" + userId + "') ";
|
string sql = "INSERT INTO TECNNotificationsUsers (UserId) " + "VALUES ('" + userId + "') ";
|
||||||
|
|
||||||
this.db.Open();
|
db.Open();
|
||||||
this.db.Execute(sql);
|
db.Execute(sql);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
public void TrainingReportDeleteUser(int userId)
|
|
||||||
{
|
public void TrainingReportDeleteUser(int userId) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
this.db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("DeleteUserFromTrainingReport", parameters, commandType: CommandType.StoredProcedure);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
public void TECNExpirationDeleteUser(int userId)
|
|
||||||
{
|
public void TECNExpirationDeleteUser(int userId) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
this.db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("DeleteUserFromTECNReport", parameters, commandType: CommandType.StoredProcedure);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
public List<TrainingGroup> GetTrainingGroups()
|
#if !NET8
|
||||||
{
|
public List<TrainingGroup> GetTrainingGroups() {
|
||||||
//StringBuilder sql = new StringBuilder();
|
//StringBuilder sql = new StringBuilder();
|
||||||
//sql.Append(
|
//sql.Append(
|
||||||
// "SELECT 'TrainingGroupID', TrainingGroupName " +
|
// "SELECT 'TrainingGroupID', TrainingGroupName " +
|
||||||
@ -197,67 +198,55 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
|
|
||||||
return GroupsToReturn;
|
return GroupsToReturn;
|
||||||
}
|
}
|
||||||
public void AddNewTrainingGroup(string groupName)
|
|
||||||
{
|
public void AddNewTrainingGroup(string groupName) {
|
||||||
TrainingGroup existing = null;
|
TrainingGroup existing = null;
|
||||||
//Check to see that the group name doesn't exist.
|
//Check to see that the group name doesn't exist.
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
|
existing = (from a in FabApprovalDB.TrainingGroups where a.TrainingGroupName == groupName select a).FirstOrDefault();
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
// string test = "";
|
// string test = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (existing == null)
|
if (existing == null) {
|
||||||
{
|
|
||||||
//string sql = new StringBuilder();
|
//string sql = new StringBuilder();
|
||||||
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
|
string sql = "INSERT INTO TrainingGroups (TrainingGroupName) " + "VALUES ('" + groupName + "') ";
|
||||||
|
|
||||||
|
|
||||||
this.db.Open();
|
this.db.Open();
|
||||||
this.db.Execute(sql);
|
this.db.Execute(sql);
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public void DeleteTrainingGroup(int groupID)
|
public void DeleteTrainingGroup(int groupID) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
string sql = "DELETE FROM TrainingGroups WHERE TrainingGroupID = " + groupID;
|
string sql = "DELETE FROM TrainingGroups WHERE TrainingGroupID = " + groupID;
|
||||||
this.db.Open();
|
db.Open();
|
||||||
this.db.Execute(sql);
|
db.Execute(sql);
|
||||||
|
|
||||||
sql = "DELETE FROM TrainingGroupMembers WHERE TrainingGroupID = " + groupID;
|
sql = "DELETE FROM TrainingGroupMembers WHERE TrainingGroupID = " + groupID;
|
||||||
this.db.Execute(sql);
|
db.Execute(sql);
|
||||||
return;
|
return;
|
||||||
}
|
} catch {
|
||||||
catch
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID)
|
#if !NET8
|
||||||
{
|
public List<TrainingGroupMember> GetTrainingGroupMembers(int GroupID) {
|
||||||
return (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == GroupID select a).ToList();
|
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();
|
UserAccountDMO userDB = new UserAccountDMO();
|
||||||
string userFullName = userDB.GetUserByID(userId).FullName;
|
string userFullName = userDB.GetUserByID(userId).FullName;
|
||||||
|
|
||||||
TrainingGroupMember existing = null;
|
TrainingGroupMember existing = null;
|
||||||
|
|
||||||
existing = (from a in FabApprovalDB.TrainingGroupMembers where a.TrainingGroupID == groupId && a.UserID == userId select a).FirstOrDefault();
|
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();
|
var parameters = new DynamicParameters();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
@ -266,9 +255,7 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@UserFullName", userFullName);
|
parameters.Add("@UserFullName", userFullName);
|
||||||
|
|
||||||
this.db.Execute("AddUserToTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
|
this.db.Execute("AddUserToTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new Exception("The user already exists in this training group.");
|
throw new Exception("The user already exists in this training group.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,17 +282,55 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
// return;
|
// return;
|
||||||
|
|
||||||
}
|
}
|
||||||
public void DeleteFromGroup(int userId, int groupId)
|
#endif
|
||||||
{
|
public void DeleteFromGroup(int userId, int groupId) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@GroupID", groupId);
|
parameters.Add("@GroupID", groupId);
|
||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
|
|
||||||
this.db.Execute("DeleteUserFromTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("DeleteUserFromTrainingGroup", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
return;
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,24 +1,19 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Configuration;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
public static class ApprovalLogDMO
|
|
||||||
{
|
|
||||||
|
|
||||||
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
public static class ApprovalLogDMO {
|
||||||
|
|
||||||
public static void Add(ApprovalLog appLog)
|
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
public static void Add(ApprovalLog appLog) {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@IssueID", appLog.IssueID);
|
parameters.Add("@IssueID", appLog.IssueID);
|
||||||
parameters.Add("@UserID", appLog.UserID);
|
parameters.Add("@UserID", appLog.UserID);
|
||||||
parameters.Add("@OperationType", appLog.OperationType);
|
parameters.Add("@OperationType", appLog.OperationType);
|
||||||
@ -27,7 +22,5 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@DocumentTypeID", appLog.DocumentTypeID);
|
parameters.Add("@DocumentTypeID", appLog.DocumentTypeID);
|
||||||
|
|
||||||
db.Execute("InsertApprovalLogByDocument", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("InsertApprovalLogByDocument", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,89 +1,77 @@
|
|||||||
using Dapper;
|
using Dapper;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Models;
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
using System.Data.Linq;
|
using System.Data.Linq;
|
||||||
|
#endif
|
||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using System.Transactions;
|
using System.Transactions;
|
||||||
using System.Web;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Utilities;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
using System.IO;
|
||||||
{
|
|
||||||
public class AuditDMO
|
|
||||||
{
|
|
||||||
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
|
||||||
|
|
||||||
/// <summary>
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
///
|
|
||||||
/// </summary>
|
public class AuditDMO {
|
||||||
/// <param name="audit"></param>
|
|
||||||
/// <returns></returns>
|
private readonly AppSettings _AppSettings;
|
||||||
public Audit InsertAudit(Audit audit)
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
public AuditDMO(AppSettings appSettings) =>
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
|
||||||
|
public Audit InsertAudit(Audit audit) {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@AuditNo", value: audit.AuditNo, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@OriginatorID", audit.OriginatorID);
|
parameters.Add("@OriginatorID", audit.OriginatorID);
|
||||||
|
|
||||||
this.db.Execute("_8DInsertAuditItem", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertAuditItem", parameters, commandType: CommandType.StoredProcedure);
|
||||||
audit.AuditNo = parameters.Get<int>("@AuditNo");
|
audit.AuditNo = parameters.Get<int>("@AuditNo");
|
||||||
|
|
||||||
return audit;
|
return audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Audit GetAuditItem(int auditNo, int userID) {
|
||||||
///
|
Audit audit = new();
|
||||||
/// </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;
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditNo", value: auditNo);
|
parameters.Add("@AuditNo", value: auditNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
|
|
||||||
|
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
|
|
||||||
using (var multipleResultItems = this.db.QueryMultiple("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure))
|
|
||||||
{
|
|
||||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||||
|
|
||||||
var auditors = multipleResultItems.Read<int>().ToList();
|
List<int> auditors = multipleResultItems.Read<int>().ToList();
|
||||||
|
|
||||||
|
if (audit != null && auditors != null) {
|
||||||
if (audit != null && auditors != null)
|
|
||||||
{
|
|
||||||
if (auditors.Count > 0)
|
if (auditors.Count > 0)
|
||||||
audit.AuditorIDs.AddRange(auditors);
|
audit.AuditorIDs.AddRange(auditors);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditorTypes = multipleResultItems.Read<int>().ToList();
|
List<int> auditorTypes = multipleResultItems.Read<int>().ToList();
|
||||||
if (audit != null && auditorTypes != null)
|
if (audit != null && auditorTypes != null) {
|
||||||
{
|
|
||||||
if (auditorTypes.Count > 0)
|
if (auditorTypes.Count > 0)
|
||||||
audit.AuditTypeIDs.AddRange(auditorTypes);
|
audit.AuditTypeIDs.AddRange(auditorTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditorAreas = multipleResultItems.Read<int>().ToList();
|
List<int> auditorAreas = multipleResultItems.Read<int>().ToList();
|
||||||
if (audit != null && auditorAreas != null)
|
if (audit != null && auditorAreas != null) {
|
||||||
{
|
|
||||||
if (auditorAreas.Count > 0)
|
if (auditorAreas.Count > 0)
|
||||||
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
||||||
}
|
}
|
||||||
@ -100,50 +88,36 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return audit;
|
return audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public Audit GetAuditItemReadOnly(int auditNo, int userID) {
|
||||||
///
|
Audit audit = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public Audit GetAuditItemReadOnly(int auditNo, int userID)
|
|
||||||
{
|
|
||||||
Audit audit = new Audit();
|
|
||||||
|
|
||||||
//isITAR = 2;
|
//isITAR = 2;
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditNo", value: auditNo);
|
parameters.Add("@AuditNo", value: auditNo);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
//parameters.Add("@IsITAR", value: isITAR, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
//audit = this.db.Query<Audit>("_8DGetAuditItem", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
|
|
||||||
|
using (var multipleResultItems = db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure)) {
|
||||||
|
|
||||||
using (var multipleResultItems = this.db.QueryMultiple("_8DGetAuditItemReadOnly", parameters, commandType: CommandType.StoredProcedure))
|
|
||||||
{
|
|
||||||
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
audit = multipleResultItems.Read<Audit>().SingleOrDefault();
|
||||||
|
|
||||||
var auditors = multipleResultItems.Read<int>().ToList();
|
List<int> auditors = multipleResultItems.Read<int>().ToList();
|
||||||
|
|
||||||
|
if (audit != null && auditors != null) {
|
||||||
if (audit != null && auditors != null)
|
|
||||||
{
|
|
||||||
if (auditors.Count > 0)
|
if (auditors.Count > 0)
|
||||||
audit.AuditorIDs.AddRange(auditors);
|
audit.AuditorIDs.AddRange(auditors);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditorTypes = multipleResultItems.Read<int>().ToList();
|
List<int> auditorTypes = multipleResultItems.Read<int>().ToList();
|
||||||
if (audit != null && auditorTypes != null)
|
if (audit != null && auditorTypes != null) {
|
||||||
{
|
|
||||||
if (auditorTypes.Count > 0)
|
if (auditorTypes.Count > 0)
|
||||||
audit.AuditTypeIDs.AddRange(auditorTypes);
|
audit.AuditTypeIDs.AddRange(auditorTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
var auditorAreas = multipleResultItems.Read<int>().ToList();
|
List<int> auditorAreas = multipleResultItems.Read<int>().ToList();
|
||||||
if (audit != null && auditorAreas != null)
|
if (audit != null && auditorAreas != null) {
|
||||||
{
|
|
||||||
if (auditorAreas.Count > 0)
|
if (auditorAreas.Count > 0)
|
||||||
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
audit.AuditedAreaIDs.AddRange(auditorAreas);
|
||||||
}
|
}
|
||||||
@ -152,73 +126,42 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return audit;
|
return audit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<AuditType> GetAuditTypeList() {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
/// <summary>
|
List<AuditType> auditTypeList = db.Query<AuditType>("_8DGetAuditTypeList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
///
|
|
||||||
/// </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;
|
return auditTypeList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<C_8DAuditedStandard> GetAuditStandardList()
|
#if !NET8
|
||||||
{
|
public IEnumerable<C_8DAuditedStandard> GetAuditStandardList() {
|
||||||
|
|
||||||
FabApprovalSystemEntitiesAll db = new FabApprovalSystemEntitiesAll();
|
FabApprovalSystemEntitiesAll db = new FabApprovalSystemEntitiesAll();
|
||||||
|
|
||||||
var auditStandardList = from a in db.C_8DAuditedStandard select a;
|
var auditStandardList = from a in db.C_8DAuditedStandard select a;
|
||||||
|
|
||||||
return auditStandardList;
|
return auditStandardList;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
#endif
|
||||||
///
|
public IEnumerable<Auditor> GetAuditorList() {
|
||||||
/// </summary>
|
DynamicParameters parameters = new();
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<Auditor> GetAuditorList()
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
|
|
||||||
|
List<Auditor> auditorList = db.Query<Auditor>("_8DGetAuditorList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
var auditorList = this.db.Query<Auditor>("_8DGetAuditorList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
return auditorList;
|
return auditorList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<AuditedArea> GetAuditAreaList() {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
/// <summary>
|
List<AuditedArea> auditAreaList = db.Query<AuditedArea>("_8DGetAuditAreaList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
///
|
|
||||||
/// </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;
|
return auditAreaList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateAudit(Audit audit, int userID) {
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="audit"></param>
|
|
||||||
public void UpdateAudit(Audit audit, int userID)
|
|
||||||
{
|
|
||||||
int result = 0;
|
int result = 0;
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
using(var transaction = new TransactionScope())
|
using (TransactionScope transaction = new()) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
parameters.Add("AuditNo", audit.AuditNo);
|
parameters.Add("AuditNo", audit.AuditNo);
|
||||||
parameters.Add("Title", audit.AuditTitle);
|
parameters.Add("Title", audit.AuditTitle);
|
||||||
//parameters.Add("AuditTypeID", audit.AuditTypeID);
|
//parameters.Add("AuditTypeID", audit.AuditTypeID);
|
||||||
@ -227,65 +170,50 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("AuditScore", audit.AuditScore);
|
parameters.Add("AuditScore", audit.AuditScore);
|
||||||
//parameters.Add("AuditedAreaID", audit.AuditedAreaID);
|
//parameters.Add("AuditedAreaID", audit.AuditedAreaID);
|
||||||
parameters.Add("Auditees", audit.Auditees);
|
parameters.Add("Auditees", audit.Auditees);
|
||||||
this.db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DUpdateAudit", param: parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
this.db.Execute("_8DDeleteAuditors", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteAuditors", parameters, commandType: CommandType.StoredProcedure);
|
||||||
List<int> auditors = audit.AuditorIDs;
|
List<int> auditors = audit.AuditorIDs;
|
||||||
if (auditors != null)
|
if (auditors != null) {
|
||||||
{
|
foreach (int auditorID in auditors) {
|
||||||
foreach (int auditorID in auditors)
|
|
||||||
{
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
parameters.Add("@AuditorID", auditorID);
|
parameters.Add("@AuditorID", auditorID);
|
||||||
this.db.Execute("_8DInsertAuditor", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertAuditor", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
this.db.Execute("_8DDeleteAuditTypes", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteAuditTypes", parameters, commandType: CommandType.StoredProcedure);
|
||||||
List<int> auditTypes = audit.AuditTypeIDs;
|
List<int> auditTypes = audit.AuditTypeIDs;
|
||||||
if (auditTypes != null)
|
if (auditTypes != null) {
|
||||||
{
|
foreach (int auditTypeID in auditTypes) {
|
||||||
foreach (int auditTypeID in auditTypes)
|
|
||||||
{
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
parameters.Add("@AuditTypeID", auditTypeID);
|
parameters.Add("@AuditTypeID", auditTypeID);
|
||||||
this.db.Execute("_8DInsertAuditType", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertAuditType", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
this.db.Execute("_8DDeleteAuditedAreas", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteAuditedAreas", parameters, commandType: CommandType.StoredProcedure);
|
||||||
List<int> auditedAreas = audit.AuditedAreaIDs;
|
List<int> auditedAreas = audit.AuditedAreaIDs;
|
||||||
if (auditedAreas != null)
|
if (auditedAreas != null) {
|
||||||
{
|
foreach (int auditedAreaID in auditedAreas) {
|
||||||
foreach (int auditedAreaID in auditedAreas)
|
|
||||||
{
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@AuditNo", audit.AuditNo);
|
parameters.Add("@AuditNo", audit.AuditNo);
|
||||||
parameters.Add("@AuditedAreaID", auditedAreaID);
|
parameters.Add("@AuditedAreaID", auditedAreaID);
|
||||||
this.db.Execute("_8DInsertAuditedArea", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertAuditedArea", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transaction.Complete();
|
transaction.Complete();
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
transaction.Dispose();
|
transaction.Dispose();
|
||||||
throw new Exception(ex.Message + " " + ex.InnerException);
|
throw new Exception(ex.Message + " " + ex.InnerException);
|
||||||
}
|
}
|
||||||
@ -317,125 +245,73 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
//this.db.Execute("_8DUpdateAuditScore", parameters, commandType: CommandType.StoredProcedure);
|
//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);
|
parameters.Add("@AuditNo", auditNo);
|
||||||
var data = this.db.Query<AuditReportAttachment>("_8DGetAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<AuditReportAttachment> data = db.Query<AuditReportAttachment>("_8DGetAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<AuditReportAttachment> GetCAFindingsItemAttachments(int caFindingsID)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@CAFindingsID", caFindingsID);
|
parameters.Add("@CAFindingsID", caFindingsID);
|
||||||
var data = this.db.Query<AuditReportAttachment>("_8DGetCAFindingsItemAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<AuditReportAttachment> data = db.Query<AuditReportAttachment>("_8DGetCAFindingsItemAttachments", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public IEnumerable<CAUserList> GetUserList() {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
List<CAUserList> userList = db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<CAUserList> GetUserList()
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
var userList = this.db.Query<CAUserList>("_8DGetUserList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AuditFindings GetAuditFindingsByID(int auditFindingsID)
|
public AuditFindings GetAuditFindingsByID(int auditFindingsID) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditFindingsID", auditFindingsID);
|
parameters.Add("@AuditFindingsID", auditFindingsID);
|
||||||
var data = this.db.Query<AuditFindings>("SELECT * FROM _8DAuditFinding WHERE ID = @AuditFindingsID", parameters).SingleOrDefault();
|
var data = db.Query<AuditFindings>("SELECT * FROM _8DAuditFinding WHERE ID = @AuditFindingsID", parameters).SingleOrDefault();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
public IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID)
|
|
||||||
{
|
public IEnumerable<int> GetAuditFindingCategoryIdsByFindingId(int auditFindingsID) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditFindingID", auditFindingsID);
|
parameters.Add("@AuditFindingID", auditFindingsID);
|
||||||
var data = this.db.Query<int>("SELECT CategoryID FROM _8DAuditFindingCategoryByAuditFinding WHERE AuditFindingID = @AuditFindingID", parameters).ToList();
|
List<int> data = db.Query<int>("SELECT CategoryID FROM _8DAuditFindingCategoryByAuditFinding WHERE AuditFindingID = @AuditFindingID", parameters).ToList();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///
|
public IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo) {
|
||||||
/// </summary>
|
DynamicParameters parameters = new();
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<AuditFindings> GetAuditFindingsList(int auditNo)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", auditNo);
|
parameters.Add("@AuditNo", auditNo);
|
||||||
var data = this.db.Query<AuditFindings>("_8DGetAuditFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<AuditFindings> data = db.Query<AuditFindings>("_8DGetAuditFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return data;
|
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);
|
parameters.Add("@AttachmentID", attachmentID);
|
||||||
this.db.Execute("_8DDeleteAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteAuditReportAttachments", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InsertAuditReportAttachment(AuditReportAttachment attach) {
|
||||||
/// <summary>
|
DynamicParameters parameters = new();
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="attach"></param>
|
|
||||||
public void InsertAuditReportAttachment(AuditReportAttachment attach)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", attach.AuditNo);
|
parameters.Add("@AuditNo", attach.AuditNo);
|
||||||
parameters.Add("@CAFindingsID", attach.CAFindingsID);
|
parameters.Add("@CAFindingsID", attach.CAFindingsID);
|
||||||
parameters.Add("@UploadedByID", attach.UploadedByID);
|
parameters.Add("@UploadedByID", attach.UploadedByID);
|
||||||
parameters.Add("@FileName", attach.FileName);
|
parameters.Add("@FileName", attach.FileName);
|
||||||
parameters.Add("@FileGUID", attach.FileGUID);
|
parameters.Add("@FileGUID", attach.FileGUID);
|
||||||
|
|
||||||
this.db.Execute("_8DInsertAuditReportAttachment", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertAuditReportAttachment", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal string GetAuditReportAttachmentFileName(string fileGUID) {
|
||||||
/// <summary>
|
DynamicParameters parameters = new();
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="fileGUID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal string GetAuditReportAttachmentFileName(string fileGUID)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@FileGUID", fileGUID);
|
parameters.Add("@FileGUID", fileGUID);
|
||||||
var fileName = this.db.Query<string>("_8DGetAuditReportAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
|
var fileName = db.Query<string>("_8DGetAuditReportAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void InsertAuditFindingsItem(AuditFindings data) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
internal void InsertAuditFindingsItem(AuditFindings data)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", data.AuditNo);
|
parameters.Add("@AuditNo", data.AuditNo);
|
||||||
parameters.Add("@Findings", data.Findings);
|
parameters.Add("@Findings", data.Findings);
|
||||||
parameters.Add("@ViolatedClause", data.ViolatedClause);
|
parameters.Add("@ViolatedClause", data.ViolatedClause);
|
||||||
@ -444,18 +320,11 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@CANo", data.CANo);
|
parameters.Add("@CANo", data.CANo);
|
||||||
parameters.Add("@Title", data.Title);
|
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) {
|
||||||
/// <summary>
|
DynamicParameters parameters = new();
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="data"></param>
|
|
||||||
internal void UpdateAuditFindingsItem(AuditFindings data)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditFindingsID", data.ID);
|
parameters.Add("@AuditFindingsID", data.ID);
|
||||||
parameters.Add("@Findings", data.Findings);
|
parameters.Add("@Findings", data.Findings);
|
||||||
parameters.Add("@ViolatedClause", data.ViolatedClause);
|
parameters.Add("@ViolatedClause", data.ViolatedClause);
|
||||||
@ -464,104 +333,53 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@CANo", data.CANo);
|
parameters.Add("@CANo", data.CANo);
|
||||||
parameters.Add("@Title", data.Title);
|
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) {
|
||||||
/// <summary>
|
DynamicParameters parameters = new();
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditFindingsID"></param>
|
|
||||||
internal void DeleteAuditFindingsItem(int auditFindingsID )
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditFindingsID", auditFindingsID);
|
parameters.Add("@AuditFindingsID", auditFindingsID);
|
||||||
|
|
||||||
this.db.Execute("_8DDeleteAuditFinding", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteAuditFinding", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal List<AuditFindingCategory> GetAuditFindingCategories() {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
return db.Query<AuditFindingCategory>("_8DGetAuditFindingCategories", commandType: CommandType.StoredProcedure).ToList();
|
||||||
/// <returns></returns>
|
|
||||||
internal List<AuditFindingCategory> GetAuditFindingCategories()
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
return this.db.Query<AuditFindingCategory>("_8DGetAuditFindingCategories", commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void ReleaseLockOnDocument(int userID, int issueID) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </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("@AuditNo", issueID);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
this.db.Execute("_8DReleaseLockOnAuditDocuments", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DReleaseLockOnAuditDocuments", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public IEnumerable<CANoList> GetCorrectiveActionNoList() {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
List<CANoList> dataList = db.Query<CANoList>("_8DGetCorrectiveActionNoList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<CANoList> GetCorrectiveActionNoList()
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
var dataList = this.db.Query<CANoList>("_8DGetCorrectiveActionNoList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
return dataList;
|
return dataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public List<int> Get8DQA() {
|
||||||
///
|
List<int> users = new();
|
||||||
/// </summary>
|
DynamicParameters parameters = new();
|
||||||
/// <param name="subRoleCategoryID"></param>
|
users = db.Query<int>("_8DGet8DQA", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
/// <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;
|
return users;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetOpenCACountByAuditNo(int auditNo) {
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="auditNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int GetOpenCACountByAuditNo(int auditNo)
|
|
||||||
{
|
|
||||||
|
|
||||||
int rowCount = 0;
|
int rowCount = 0;
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@AuditNo", auditNo);
|
parameters.Add("@AuditNo", auditNo);
|
||||||
rowCount = this.db.Query<int>("_8DGetOpenCACountByAuditNo", parameters, commandType: CommandType.StoredProcedure).Single();
|
rowCount = db.Query<int>("_8DGetOpenCACountByAuditNo", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return rowCount;
|
return rowCount;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// CA Findings ====================================================================================================================================
|
// CA Findings ====================================================================================================================================
|
||||||
|
|
||||||
|
public void InsertCAFindings(CAFindings model) {
|
||||||
/// <summary>
|
DynamicParameters parameters = new();
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void InsertCAFindings(CAFindings model)
|
|
||||||
{
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", model.AuditNo);
|
parameters.Add("@AuditNo", model.AuditNo);
|
||||||
parameters.Add("@CAFinding", model.CAFinding);
|
parameters.Add("@CAFinding", model.CAFinding);
|
||||||
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
|
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
|
||||||
@ -570,18 +388,11 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@ECD", model.ECD);
|
parameters.Add("@ECD", model.ECD);
|
||||||
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
||||||
|
|
||||||
this.db.Execute("_8DInsertCAFindings", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DInsertCAFindings", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void UpdateCAFindings(CAFindings model) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
public void UpdateCAFindings(CAFindings model)
|
|
||||||
{
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@CAFindingsID", model.ID);
|
parameters.Add("@CAFindingsID", model.ID);
|
||||||
parameters.Add("@CAFinding", model.CAFinding);
|
parameters.Add("@CAFinding", model.CAFinding);
|
||||||
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
|
parameters.Add("@CorrectiveAction", model.CorrectiveAction);
|
||||||
@ -590,70 +401,235 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@ECD", model.ECD);
|
parameters.Add("@ECD", model.ECD);
|
||||||
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
parameters.Add("@ImplementedDate", model.ImplementedDate);
|
||||||
|
|
||||||
this.db.Execute("_8DUpdateCAFindings", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DUpdateCAFindings", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public void DeleteCAFindingsItem(int caFindingsID) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="caFindingsID"></param>
|
|
||||||
public void DeleteCAFindingsItem(int caFindingsID)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@CAFindingsID", caFindingsID);
|
parameters.Add("@CAFindingsID", caFindingsID);
|
||||||
|
|
||||||
this.db.Execute("_8DDeleteCAFindingsItem", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DDeleteCAFindingsItem", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public CAFindings GetCAFindingsItem(int caFindingsID) {
|
||||||
///
|
CAFindings model = new();
|
||||||
/// </summary>
|
DynamicParameters parameters = new();
|
||||||
/// <param name="caFindingsID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public CAFindings GetCAFindingsItem(int caFindingsID)
|
|
||||||
{
|
|
||||||
var model = new CAFindings();
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@CAFindingsID", caFindingsID);
|
parameters.Add("@CAFindingsID", caFindingsID);
|
||||||
var data = this.db.Query<CAFindings>("_8DGetCAFindings", parameters, commandType: CommandType.StoredProcedure).Single();
|
var data = db.Query<CAFindings>("_8DGetCAFindings", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public IEnumerable<CAFindings> GetCAFindingsList(int auditNo) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="caNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public IEnumerable<CAFindings> GetCAFindingsList(int auditNo)
|
|
||||||
{
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AuditNo", auditNo);
|
parameters.Add("@AuditNo", auditNo);
|
||||||
var dataList = this.db.Query<CAFindings>("_8DGetCAFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<CAFindings> dataList = db.Query<CAFindings>("_8DGetCAFindingsList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return dataList;
|
return dataList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public int IsCAAssignedToAudit(int CANo, int auditNo) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="CANo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public int IsCAAssignedToAudit(int CANo, int auditNo)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
int returnValue = 1;
|
int returnValue = 1;
|
||||||
parameters.Add("@CANo", CANo);
|
parameters.Add("@CANo", CANo);
|
||||||
parameters.Add("@AuditNo", auditNo);
|
parameters.Add("@AuditNo", auditNo);
|
||||||
parameters.Add("@IsCAAssignedToAudit", returnValue, direction: ParameterDirection.Output);
|
parameters.Add("@IsCAAssignedToAudit", returnValue, direction: ParameterDirection.Output);
|
||||||
|
|
||||||
this.db.Execute("_8DIsCAAssignedtoAudit", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("_8DIsCAAssignedtoAudit", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
returnValue = parameters.Get<int>("IsCAAssignedToAudit");
|
returnValue = parameters.Get<int>("IsCAAssignedToAudit");
|
||||||
return returnValue;
|
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";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
audit = GetAuditItem(issueID, userId);
|
||||||
|
//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 != true) {
|
||||||
|
result.IsAdmin = false;
|
||||||
|
} else {
|
||||||
|
result.IsAdmin = true;
|
||||||
|
}
|
||||||
|
if ((audit.RecordLockIndicator && audit.RecordLockedBy != userId)
|
||||||
|
|| audit.AuditStatus != 0) //open
|
||||||
|
{
|
||||||
|
result.RedirectToAction = true;
|
||||||
|
}
|
||||||
|
if (result.IsAdmin == false && result.IsSubmitter == false) {
|
||||||
|
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 List<string> GetFileNameAndDocument(string fileGuid, int auditNo) {
|
||||||
|
List<string> results = new();
|
||||||
|
string fileName = 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 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 void AuditReportAttachSave(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);
|
||||||
|
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
||||||
|
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
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
//ccDMO.InsertCCAttachment(attach);
|
||||||
|
InsertAuditReportAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SaveAndInsert(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);
|
||||||
|
//var physicalPath = Path.Combine(Server.MapPath("~/UserUploads"), fileName);
|
||||||
|
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
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
InsertAuditReportAttachment(attach);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string NotifyActionItemOwner(int issueID, DateTime? dueDate, int? responsibleOwnerID, string emailTemplatesPath) {
|
||||||
|
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(_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
@ -1,31 +1,18 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Configuration;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public static class ECNTypeChangeLogDMO
|
|
||||||
{
|
|
||||||
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
|
||||||
|
|
||||||
/// <summary>
|
public static class ECNTypeChangeLogDMO {
|
||||||
///
|
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
/// </summary>
|
|
||||||
/// <param name="changeLog"></param>
|
|
||||||
public static void Add(ECNTypeChangeLog changeLog)
|
|
||||||
{
|
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
public static void Add(ECNTypeChangeLog changeLog) {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", changeLog.ECNNumber);
|
parameters.Add("@ECNNumber", changeLog.ECNNumber);
|
||||||
parameters.Add("@UserID", changeLog.UserID);
|
parameters.Add("@UserID", changeLog.UserID);
|
||||||
parameters.Add("@ECNTypeFrom", changeLog.ECNTypeFrom);
|
parameters.Add("@ECNTypeFrom", changeLog.ECNTypeFrom);
|
||||||
@ -35,7 +22,3 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,41 +1,18 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Web;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Transactions;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
|
||||||
using System.Reflection;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
|
|
||||||
public static class EventLogDMO
|
public static class EventLogDMO {
|
||||||
{
|
private static readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
private static IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
|
||||||
|
|
||||||
//public static void Add(WinEventLog eventLog)
|
public static void Add(WinEventLog eventLog) {
|
||||||
//{
|
DynamicParameters parameters = new();
|
||||||
// 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("@IssueID", eventLog.IssueID);
|
||||||
parameters.Add("@UserID", eventLog.UserID);
|
parameters.Add("@UserID", eventLog.UserID);
|
||||||
parameters.Add("@DocumentType", eventLog.DocumentType);
|
parameters.Add("@DocumentType", eventLog.DocumentType);
|
||||||
@ -43,9 +20,6 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@Comments", eventLog.Comments);
|
parameters.Add("@Comments", eventLog.Comments);
|
||||||
|
|
||||||
db.Execute("InsertEventLogByDocument", parameters, commandType: CommandType.StoredProcedure);
|
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
@ -1,61 +1,48 @@
|
|||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using Dapper;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Configuration;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using Dapper;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
public class MiscDMO
|
|
||||||
{
|
|
||||||
|
|
||||||
/// <summary>
|
public class MiscDMO {
|
||||||
///
|
|
||||||
/// </summary>
|
public static IEnumerable<Lot> SearchLots(string searchText, string searchBy) {
|
||||||
/// <param name="searchText"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static IEnumerable<Lot> SearchLots(string searchText, string searchBy)
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
IEnumerable<Lot> lotList;
|
IEnumerable<Lot> lotList;
|
||||||
|
|
||||||
string sql = "";
|
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)
|
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 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 + "%' ";
|
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";
|
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();
|
lotList = db.Query<Lot>(sql).ToList();
|
||||||
db.Close();
|
db.Close();
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
if (searchBy == GlobalVars.LOT_NO)
|
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 + "%' ";
|
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";
|
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();
|
lotList = db.Query<Lot>(sql).ToList();
|
||||||
db.Close();
|
db.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return lotList;
|
return lotList;
|
||||||
}
|
}
|
||||||
public static IEnumerable<int> GetUserIDsBySubRoleID(int subRoleID)
|
|
||||||
{
|
public static IEnumerable<int> GetUserIDsBySubRoleID(int subRoleID) {
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
IEnumerable<int> userList;
|
IEnumerable<int> userList;
|
||||||
|
|
||||||
@ -66,38 +53,23 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return userList;
|
return userList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static IEnumerable<Lot> SearchLTLots(string searchText, string searchBy) {
|
||||||
///
|
|
||||||
/// </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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
string sql = "";
|
string sql = "";
|
||||||
|
|
||||||
|
|
||||||
if (searchBy == GlobalVars.LOT_NO)
|
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() + "%' ";
|
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() + "'";
|
sql = "SELECT DISTINCT WP_LOT_NO AS LotNumber FROM vFAB2SPN_WP_RECORD WP WHERE WP_CURRENT_LOCATION = '" + searchText.Trim() + "'";
|
||||||
}
|
}
|
||||||
var lotList = db.Query<Lot>(sql).ToList();
|
List<Lot> lotList = db.Query<Lot>(sql).ToList();
|
||||||
db.Close();
|
db.Close();
|
||||||
return lotList;
|
return lotList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static IEnumerable<WIPPart> SearchLTParts(string searchText) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="searchText"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static IEnumerable<WIPPart> SearchLTParts(string searchText)
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new();
|
||||||
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
|
sql.Append("SELECT PartNumber + '~' + SiliconPart + '~' + ProcessFlow + '~' + PartDescription AS WIPPartData ");
|
||||||
sql.Append("FROM vWIPPartData WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber");
|
sql.Append("FROM vWIPPartData WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber");
|
||||||
|
|
||||||
@ -108,37 +80,28 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
//sql.Append("INNER JOIN TEMIRWAP019.Fab2SPN.dbo.MP_RECORD P ON W.TO_PART = P.MP_PART_NUMBER ");
|
//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 ");
|
//sql.Append("WHERE PartNumber LIKE '%" + searchText + "%' ORDER BY PartNumber ");
|
||||||
|
|
||||||
|
List<WIPPart> parList = db.Query<WIPPart>(sql.ToString()).ToList();
|
||||||
var parList = db.Query<WIPPart>(sql.ToString()).ToList();
|
|
||||||
db.Close();
|
db.Close();
|
||||||
return parList;
|
return parList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static void GetLotInformation(Lot lot) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lot"></param>
|
|
||||||
public static void GetLotInformation(Lot lot)
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
StringBuilder qryLotInfo = new StringBuilder();
|
StringBuilder qryLotInfo = new();
|
||||||
qryLotInfo.Append("SELECT WP_STATUS , WP_LOT_NO, WP_PART_NUMBER, MP_PRODUCT_FAMILY, MP_DESCRIPTION, ");
|
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("WP_CURRENT_QTY, WP_CURRENT_LOCATION, DieLotNumber, DiePartNo, DieCount, MP_QUALITY_CODE FROM SPNLot ");
|
||||||
qryLotInfo.Append("WHERE WP_Lot_No = @LotNumber ");
|
qryLotInfo.Append("WHERE WP_Lot_No = @LotNumber ");
|
||||||
|
|
||||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
||||||
var tempLotNumber = "";
|
var tempLotNumber = "";
|
||||||
if (lot.LotNumber.IndexOf('/') >= 0)
|
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||||
{
|
|
||||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
tempLotNumber = lot.LotNumber;
|
tempLotNumber = lot.LotNumber;
|
||||||
|
|
||||||
lot.LotNumber = tempLotNumber;
|
lot.LotNumber = tempLotNumber;
|
||||||
var lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
|
List<dynamic> lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
|
||||||
foreach (dynamic lotInfoColumn in lotInfoRow)
|
foreach (dynamic lotInfoColumn in lotInfoRow) {
|
||||||
{
|
|
||||||
lot.LotNumber = lotInfoColumn.WP_LOT_NO;
|
lot.LotNumber = lotInfoColumn.WP_LOT_NO;
|
||||||
if (lot.DieLotNumber == null || lot.DieLotNumber == "")
|
if (lot.DieLotNumber == null || lot.DieLotNumber == "")
|
||||||
lot.DieLotNumber = lotInfoColumn.DieLotNumber;
|
lot.DieLotNumber = lotInfoColumn.DieLotNumber;
|
||||||
@ -146,8 +109,7 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
if (lotInfoColumn.WP_PART_NUMBER != null)
|
if (lotInfoColumn.WP_PART_NUMBER != null)
|
||||||
lot.WipPartNo = lotInfoColumn.WP_PART_NUMBER.Trim();
|
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
|
// 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.
|
// 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.
|
// There is a duplication.
|
||||||
@ -158,36 +120,26 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
lot.Location = lotInfoColumn.WP_CURRENT_LOCATION;
|
lot.Location = lotInfoColumn.WP_CURRENT_LOCATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lotInfoColumn.MP_DESCRIPTION != null) {
|
||||||
if (lotInfoColumn.MP_DESCRIPTION != null)
|
|
||||||
{
|
|
||||||
lot.Description = lotInfoColumn.MP_DESCRIPTION;
|
lot.Description = lotInfoColumn.MP_DESCRIPTION;
|
||||||
if (lot.Description.Length > 0)
|
if (lot.Description.Length > 0) {
|
||||||
{
|
|
||||||
string[] temp = lot.Description.Split(new char[] { ',' });
|
string[] temp = lot.Description.Split(new char[] { ',' });
|
||||||
if (temp.Length > 0)
|
if (temp.Length > 0) {
|
||||||
{
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
lot.ProductFamily = temp[0];
|
lot.ProductFamily = temp[0];
|
||||||
}
|
} catch { } // ignore the error
|
||||||
catch { } // ignore the error
|
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
//lot.Gen = double.Parse(temp[2].Substring(1, temp[2].Length - 1));
|
//lot.Gen = double.Parse(temp[2].Substring(1, temp[2].Length - 1));
|
||||||
if (lot.Description.StartsWith("MA,"))
|
if (lot.Description.StartsWith("MA,"))
|
||||||
lot.Gen = temp[2];
|
lot.Gen = temp[2];
|
||||||
else
|
else
|
||||||
lot.Gen = temp[2].Substring(1, temp[2].Length - 1);
|
lot.Gen = temp[2].Substring(1, temp[2].Length - 1);
|
||||||
}
|
} catch { }// ignore the error
|
||||||
catch { }// ignore the error
|
try {
|
||||||
try
|
|
||||||
{
|
|
||||||
//lot.Hexsize = double.Parse(temp[6]);
|
//lot.Hexsize = double.Parse(temp[6]);
|
||||||
lot.Hexsize = temp[6];
|
lot.Hexsize = temp[6];
|
||||||
}
|
} catch { }// ignore the error
|
||||||
catch { }// ignore the error
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -196,30 +148,24 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
if (lotInfoColumn.WP_STATUS != null)
|
if (lotInfoColumn.WP_STATUS != null)
|
||||||
lot.Status = lotInfoColumn.WP_STATUS;
|
lot.Status = lotInfoColumn.WP_STATUS;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (lotInfoColumn.DiePartNo != null)
|
if (lotInfoColumn.DiePartNo != null)
|
||||||
lot.DiePartNo = lotInfoColumn.DiePartNo.Trim();
|
lot.DiePartNo = lotInfoColumn.DiePartNo.Trim();
|
||||||
|
|
||||||
if (lotInfoColumn.WP_CURRENT_QTY != null)
|
if (lotInfoColumn.WP_CURRENT_QTY != null)
|
||||||
lot.WaferCount = lotInfoColumn.WP_CURRENT_QTY;
|
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.Clear();
|
||||||
qryLotInfo.Append("SELECT DiePartNo, SourceFAB, Diameter, Silicon, Gen, Layers,HexSize,Voltage,Channel, Type AS ProductFamily, ");
|
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 ");
|
qryLotInfo.Append("WaferCost, DieCost FROM StdCost WHERE WIPWaferNo = @WIPPartNo OR DiePartNo = @DiePartNo ");
|
||||||
var moreLotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { WIPPartNo = lot.WipPartNo, DiePartNo = lot.DiePartNo }).ToList();
|
List<dynamic> 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)
|
if (lotInfoColumn.DieCount != null && lotInfoColumn.DieCount != 0)
|
||||||
lot.DieCount = int.Parse(lotInfoColumn.DieCount.ToString());
|
lot.DieCount = int.Parse(lotInfoColumn.DieCount.ToString());
|
||||||
lot.DieCost = double.Parse(moreLotInfoColumn.DieCost.ToString());
|
lot.DieCost = double.Parse(moreLotInfoColumn.DieCost.ToString());
|
||||||
lot.WaferCost = double.Parse(moreLotInfoColumn.WaferCost.ToString());
|
lot.WaferCost = double.Parse(moreLotInfoColumn.WaferCost.ToString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (moreLotInfoColumn.Channel != null)
|
if (moreLotInfoColumn.Channel != null)
|
||||||
lot.Channel = moreLotInfoColumn.Channel;
|
lot.Channel = moreLotInfoColumn.Channel;
|
||||||
|
|
||||||
@ -229,7 +175,6 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
if (moreLotInfoColumn.Voltage != null)
|
if (moreLotInfoColumn.Voltage != null)
|
||||||
lot.Voltage = moreLotInfoColumn.Voltage;
|
lot.Voltage = moreLotInfoColumn.Voltage;
|
||||||
|
|
||||||
|
|
||||||
if (lot.DieCount > 0)
|
if (lot.DieCount > 0)
|
||||||
lot.TotalCost = Math.Round(lot.DieCount * lot.DieCost, 2);
|
lot.TotalCost = Math.Round(lot.DieCount * lot.DieCost, 2);
|
||||||
else if (lot.WaferCount > 0)
|
else if (lot.WaferCount > 0)
|
||||||
@ -249,19 +194,15 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
|
|
||||||
db.Close();
|
db.Close();
|
||||||
//return lotStatusOption;
|
//return lotStatusOption;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// /
|
/// /
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
public static IEnumerable<UserProfile> GetUserList() {
|
||||||
public static IEnumerable<UserProfile> GetUserList()
|
|
||||||
{
|
|
||||||
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new();
|
||||||
sql.Append("SELECT FirstName + ' ' + LastName AS FullName, U.UserID AS UserId ");
|
sql.Append("SELECT FirstName + ' ' + LastName AS FullName, U.UserID AS UserId ");
|
||||||
sql.Append("FROM Users U ");
|
sql.Append("FROM Users U ");
|
||||||
sql.Append("ORDER BY FirstName");
|
sql.Append("ORDER BY FirstName");
|
||||||
@ -269,56 +210,32 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return db.Query<UserProfile>(sql.ToString()).ToList();
|
return db.Query<UserProfile>(sql.ToString()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static List<string> GetApproverEmailListByDocument(int issueID, byte step, int documentType) {
|
||||||
///
|
|
||||||
/// </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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@DocumentTypeID", documentType);
|
parameters.Add("@DocumentTypeID", documentType);
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
parameters.Add("@Step", step);
|
parameters.Add("@Step", step);
|
||||||
var emailList = db.Query<string>("GetApproverEmailListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> emailList = db.Query<string>("GetApproverEmailListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return emailList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@DocumentTypeID", documentType);
|
parameters.Add("@DocumentTypeID", documentType);
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
parameters.Add("@Step", step);
|
parameters.Add("@Step", step);
|
||||||
var approverList = db.Query<ApproversListViewModel>("GetApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<ApproversListViewModel> approverList = db.Query<ApproversListViewModel>("GetApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approverList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@DocumentTypeID", documentType);
|
parameters.Add("@DocumentTypeID", documentType);
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
var approvalList = db.Query<ApprovalModel>(
|
var approvalList = db.Query<ApprovalModel>(
|
||||||
@ -329,149 +246,81 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// NOT IN USE YET
|
/// NOT IN USE YET
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="issueID"></param>
|
|
||||||
/// <param name="currentStep"></param>
|
public static IEnumerable<LoginModel> GetApprovedApproversListByDocument(int issueID, int currentStep, int documentType) {
|
||||||
/// <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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
return db.Query<LoginModel>("GetApprovedApproversListByDocument", new { @DocumentTypeID = documentType, @IssueID = issueID, @Step = currentStep }, commandType: CommandType.StoredProcedure).ToList();
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@DocumentTypeID", documentType);
|
parameters.Add("@DocumentTypeID", documentType);
|
||||||
parameters.Add("@IssueID", issueID);
|
parameters.Add("@IssueID", issueID);
|
||||||
parameters.Add("@Step", step);
|
parameters.Add("@Step", step);
|
||||||
var approverList = db.Query<ApproversListViewModel>("GetPendingApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<ApproversListViewModel> approverList = db.Query<ApproversListViewModel>("GetPendingApproversListByDocument", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approverList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", ecnNumber);
|
parameters.Add("@ECNNumber", ecnNumber);
|
||||||
var approverList = db.Query<string>("ECNGetETECNApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> approverList = db.Query<string>("ECNGetETECNApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approverList;
|
return approverList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static List<string> GetTECNCancelledApprovalNotifyList(int ecnNumber) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="ecnNumber"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static List<string> GetTECNCancelledApprovalNotifyList(int ecnNumber)
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ECNNumber", ecnNumber);
|
parameters.Add("@ECNNumber", ecnNumber);
|
||||||
var approverList = db.Query<string>("ECN_TECNCancelledApprovalNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> approverList = db.Query<string>("ECN_TECNCancelledApprovalNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approverList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@WorkRequestID", workRequestID);
|
parameters.Add("@WorkRequestID", workRequestID);
|
||||||
var notifyList = db.Query<string>("LTFabGroupApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> notifyList = db.Query<string>("LTFabGroupApprovalNotificationList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return notifyList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@NotificationType", notificationType);
|
parameters.Add("@NotificationType", notificationType);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
parameters.Add("@WorkRequestID", workRequestID);
|
parameters.Add("@WorkRequestID", workRequestID);
|
||||||
var notifyList = db.Query<string>("LTGetWorkRequestRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> notifyList = db.Query<string>("LTGetWorkRequestRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return notifyList;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@NotificationType", notificationType);
|
parameters.Add("@NotificationType", notificationType);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
parameters.Add("@WorkRequestID", workRequestID);
|
parameters.Add("@WorkRequestID", workRequestID);
|
||||||
var notifyList = db.Query<string>("LTGetWorkRequestApprovedNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> notifyList = db.Query<string>("LTGetWorkRequestApprovedNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return notifyList;
|
return notifyList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static List<string> GetLotTravelerCreationAndRevisionNotifyList(int ltLotID, int workRequestID, int userID) {
|
||||||
///
|
|
||||||
/// </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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@LotID", ltLotID);
|
parameters.Add("@LotID", ltLotID);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
parameters.Add("@WorkRequestID", workRequestID);
|
parameters.Add("@WorkRequestID", workRequestID);
|
||||||
var notifyList = db.Query<string>("LTGetLotTravelerCreationAndRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> notifyList = db.Query<string>("LTGetLotTravelerCreationAndRevisionNotifyList", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return notifyList;
|
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;
|
int returnValue = 0;
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@OOOUserID", oooUserID);
|
parameters.Add("@OOOUserID", oooUserID);
|
||||||
parameters.Add("@DelegatedTo", delegatedTo);
|
parameters.Add("@DelegatedTo", delegatedTo);
|
||||||
parameters.Add("@OOOStartDate", startDate);
|
parameters.Add("@OOOStartDate", startDate);
|
||||||
@ -483,61 +332,32 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
returnValue = parameters.Get<int>("@ReturnValue");
|
returnValue = parameters.Get<int>("@ReturnValue");
|
||||||
|
|
||||||
return 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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@OOOUserID", oooUserID);
|
parameters.Add("@OOOUserID", oooUserID);
|
||||||
var approverList = db.Execute("ExpireOOOStatus", parameters, commandType: CommandType.StoredProcedure);
|
var approverList = db.Execute("ExpireOOOStatus", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static List<Department> GetDepartments() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static List<Department> GetDepartments()
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var departments = db.Query<Department>("GetDepartments", null, commandType: CommandType.StoredProcedure).ToList();
|
List<Department> departments = db.Query<Department>("GetDepartments", null, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return departments;
|
return departments;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static List<AffectedModule> GetModules() {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static List<AffectedModule> GetModules()
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var modules = db.Query<AffectedModule>("GetModules", null, commandType: CommandType.StoredProcedure).ToList();
|
List<AffectedModule> modules = db.Query<AffectedModule>("GetModules", null, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return modules;
|
return modules;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static void GetLTLotInformation(LTLot lot) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="lot"></param>
|
|
||||||
public static void GetLTLotInformation(LTLot lot)
|
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
StringBuilder qryLotInfo = new StringBuilder();
|
StringBuilder qryLotInfo = new();
|
||||||
//qryLotInfo.Append("SELECT DISTINCT ");
|
//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("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("FROM TEMIRWAP019.FAB2SPN.dbo.WO_RECORD WO ");
|
||||||
@ -557,19 +377,16 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
//var tempLotNumber = lot.LotNumber.Substring(0, 9);
|
||||||
|
|
||||||
var tempLotNumber = "";
|
var tempLotNumber = "";
|
||||||
if (lot.LotNumber.IndexOf('/') >= 0)
|
if (lot.LotNumber.IndexOf('/') >= 0) {
|
||||||
{
|
|
||||||
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
tempLotNumber = lot.LotNumber.Substring(0, lot.LotNumber.IndexOf('/'));
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
tempLotNumber = lot.LotNumber;
|
tempLotNumber = lot.LotNumber;
|
||||||
|
|
||||||
lot.LotNumber = tempLotNumber;
|
lot.LotNumber = tempLotNumber;
|
||||||
|
|
||||||
lot.LotNumber = tempLotNumber;
|
lot.LotNumber = tempLotNumber;
|
||||||
var lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
|
List<dynamic> lotInfoRow = db.Query<dynamic>(qryLotInfo.ToString(), new { LotNumber = tempLotNumber }).ToList();
|
||||||
foreach (dynamic lotInfoColumn in lotInfoRow)
|
foreach (dynamic lotInfoColumn in lotInfoRow) {
|
||||||
{
|
|
||||||
lot.WIPPartNumber = lotInfoColumn.WP_PART_NUMBER;
|
lot.WIPPartNumber = lotInfoColumn.WP_PART_NUMBER;
|
||||||
lot.WaferQty = lotInfoColumn.WP_CURRENT_QTY;
|
lot.WaferQty = lotInfoColumn.WP_CURRENT_QTY;
|
||||||
lot.PartDescription = lotInfoColumn.MP_DESCRIPTION;
|
lot.PartDescription = lotInfoColumn.MP_DESCRIPTION;
|
||||||
@ -581,64 +398,46 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
var email = db.Query<string>("GetEmail", parameters, commandType: CommandType.StoredProcedure).Single();
|
var email = db.Query<string>("GetEmail", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return email;
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
|
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters.Add("@DocID", issueID);
|
parameters.Add("@DocID", issueID);
|
||||||
var emailList = db.Query<string>("_8DGetEmailListClosureNotification", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<string> emailList = db.Query<string>("_8DGetEmailListClosureNotification", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return emailList;
|
return emailList;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CredentialsStorage GetCredentialsInfo(string serverName, string credentialType) // TODO - need to use an enum for the credentialType
|
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);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ServerName", serverName);
|
parameters.Add("@ServerName", serverName);
|
||||||
parameters.Add("@CredentialType", credentialType);
|
parameters.Add("@CredentialType", credentialType);
|
||||||
var data = db.Query<CredentialsStorage>("GetCredentialsInfo", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
var data = db.Query<CredentialsStorage>("GetCredentialsInfo", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ApproveListModel> GetApprovalReminderList()
|
public List<ApproveListModel> GetApprovalReminderList() {
|
||||||
{
|
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var approvals = db.Query<ApproveListModel>("GetApprovalForNotifcation", null, commandType: CommandType.StoredProcedure).ToList();
|
List<ApproveListModel> approvals = db.Query<ApproveListModel>("GetApprovalForNotifcation", null, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approvals;
|
return approvals;
|
||||||
}
|
}
|
||||||
public void UpdateApprovalNotifyDate(int approvalId)
|
|
||||||
{
|
public void UpdateApprovalNotifyDate(int approvalId) {
|
||||||
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@ApprovalId", approvalId);
|
parameters.Add("@ApprovalId", approvalId);
|
||||||
db.Query<CredentialsStorage>("UpdateApprovalLastNotifyDate", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
db.Query<CredentialsStorage>("UpdateApprovalLastNotifyDate", param: parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
//return data;
|
//return data;
|
||||||
}
|
}
|
||||||
//================================================================== End of Class
|
//================================================================== End of Class
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,63 +1,59 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using System.Transactions;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
public class PartsRequestDMO
|
|
||||||
{
|
|
||||||
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
|
||||||
|
|
||||||
WorkflowDMO wfDMO = new WorkflowDMO();
|
public class PartsRequestDMO {
|
||||||
|
|
||||||
public IEnumerable<PartsRequestList> GetPartsRequestList()
|
private readonly AppSettings _AppSettings;
|
||||||
{
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
var r = this.db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
|
|
||||||
|
public PartsRequestDMO(AppSettings appSettings) =>
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
|
||||||
|
public IEnumerable<PartsRequestList> GetPartsRequestList() {
|
||||||
|
List<PartsRequestList> r = db.Query<PartsRequestList>("PartsRequestGetList", commandType: CommandType.StoredProcedure).ToList();
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Insert(PartsRequest pr)
|
public void Insert(PartsRequest pr) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", value: pr.PRNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@PRNumber", value: pr.PRNumber, dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@OriginatorID", pr.OriginatorID);
|
parameters.Add("@OriginatorID", pr.OriginatorID);
|
||||||
|
|
||||||
this.db.Execute("PartsRequestInsert", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestInsert", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
pr.PRNumber = parameters.Get<int>("@PRNumber");
|
pr.PRNumber = parameters.Get<int>("@PRNumber");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(PartsRequest pr)
|
public void Update(PartsRequest pr) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", pr.PRNumber);
|
parameters.Add("@PRNumber", pr.PRNumber);
|
||||||
parameters.Add("@Title", pr.Title);
|
parameters.Add("@Title", pr.Title);
|
||||||
parameters.Add("@RequestorID", pr.RequestorID);
|
parameters.Add("@RequestorID", pr.RequestorID);
|
||||||
parameters.Add("@TechLeadID", pr.TechLeadID);
|
parameters.Add("@TechLeadID", pr.TechLeadID);
|
||||||
parameters.Add("@Description", pr.Description);
|
parameters.Add("@Description", pr.Description);
|
||||||
|
|
||||||
this.db.Execute("PartsRequestUpdate", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestUpdate", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public PartsRequest Get(int PRNumber)
|
public PartsRequest Get(int PRNumber) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", value: PRNumber, dbType: DbType.Int32);
|
parameters.Add("@PRNumber", value: PRNumber, dbType: DbType.Int32);
|
||||||
|
|
||||||
return this.db.Query<PartsRequest>("PartsRequestGet", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
|
return db.Query<PartsRequest>("PartsRequestGet", parameters, commandType: CommandType.StoredProcedure).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber)
|
public IEnumerable<PartsRequestAttachmentList> GetAttachments(int prNumber) {
|
||||||
{
|
List<PartsRequestAttachmentList> attachments = db.Query<PartsRequestAttachmentList>(
|
||||||
var attachments = this.db.Query<PartsRequestAttachmentList>(
|
|
||||||
"SELECT AttachmentID, PRNumber, FileName, A.UserID, UploadDate, U.FirstName + ' ' + U.LastName AS FullName " +
|
"SELECT AttachmentID, PRNumber, FileName, A.UserID, UploadDate, U.FirstName + ' ' + U.LastName AS FullName " +
|
||||||
"FROM PartsRequestAttachment A " +
|
"FROM PartsRequestAttachment A " +
|
||||||
"INNER JOIN Users U ON U.UserID = A.UserID " +
|
"INNER JOIN Users U ON U.UserID = A.UserID " +
|
||||||
@ -66,64 +62,80 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return attachments;
|
return attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void InsertAttachment(PartsRequestAttachment attach)
|
public void InsertAttachment(PartsRequestAttachment attach) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", attach.PRNumber);
|
parameters.Add("@PRNumber", attach.PRNumber);
|
||||||
parameters.Add("@UserID", attach.UserID);
|
parameters.Add("@UserID", attach.UserID);
|
||||||
parameters.Add("@FileName", attach.FileName);
|
parameters.Add("@FileName", attach.FileName);
|
||||||
|
|
||||||
this.db.Execute("PartsRequestInsertAttachment", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestInsertAttachment", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFileName(string attachmentID)
|
public string GetFileName(string attachmentID) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AttachmentID", attachmentID);
|
parameters.Add("@AttachmentID", attachmentID);
|
||||||
var fileName = this.db.Query<string>("PartsRequestGetAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
|
var fileName = db.Query<string>("PartsRequestGetAttachmentFileName", parameters, commandType: CommandType.StoredProcedure).Single();
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteAttachment(int attachmentID)
|
public void DeleteAttachment(int attachmentID) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@AttachmentID", attachmentID);
|
parameters.Add("@AttachmentID", attachmentID);
|
||||||
this.db.Execute("PartsRequestDeleteAttachment", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestDeleteAttachment", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Submit(int prNumber, int userID)
|
public void Submit(int prNumber, int userID) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", prNumber);
|
parameters.Add("@PRNumber", prNumber);
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
this.db.Execute("PartsRequestSubmitForApproval", parameters, commandType: CommandType.StoredProcedure );
|
db.Execute("PartsRequestSubmitForApproval", parameters, commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber)
|
public IEnumerable<ApprovalLogHistory> GetApprovalLogHistory(int prNumber) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@PRNumber", prNumber);
|
parameters.Add("@PRNumber", prNumber);
|
||||||
var approverList = this.db.Query<ApprovalLogHistory>("PartsRequestGetApprovalLogHistory", parameters, commandType: CommandType.StoredProcedure).ToList();
|
List<ApprovalLogHistory> approverList = db.Query<ApprovalLogHistory>("PartsRequestGetApprovalLogHistory", parameters, commandType: CommandType.StoredProcedure).ToList();
|
||||||
return approverList;
|
return approverList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<MyPartsRequestList> GetMyPartsRequests(int userID)
|
public IEnumerable<MyPartsRequestList> GetMyPartsRequests(int userID) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
|
|
||||||
var r = this.db.Query<MyPartsRequestList>("PartsRequestGetListByUser", parameters, commandType: CommandType.StoredProcedure);
|
IEnumerable<MyPartsRequestList> r = db.Query<MyPartsRequestList>("PartsRequestGetListByUser", parameters, commandType: CommandType.StoredProcedure);
|
||||||
return r.ToList();
|
return r.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteDocument(int prNumber, int userid)
|
public void DeleteDocument(int prNumber, int userid) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userid);
|
parameters.Add("@UserID", userid);
|
||||||
parameters.Add("@PRNumber", prNumber);
|
parameters.Add("@PRNumber", prNumber);
|
||||||
|
|
||||||
this.db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("PartsRequestDelete", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AttachSave(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,
|
||||||
|
};
|
||||||
|
InsertAttachment(attach);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,29 +1,20 @@
|
|||||||
using System;
|
using System.Configuration;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Dapper;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
using Dapper;
|
||||||
{
|
|
||||||
public class SAM_DMO
|
|
||||||
{
|
|
||||||
private IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["SAMDBConnectionString"].ConnectionString);
|
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
|
|
||||||
public int HasITARAccess(string userID)
|
public class SAM_DMO {
|
||||||
{
|
private readonly IDbConnection db = new SqlConnection(ConfigurationManager.ConnectionStrings["SAMDBConnectionString"].ConnectionString);
|
||||||
|
|
||||||
StringBuilder query = new StringBuilder("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
|
public int HasITARAccess(string userID) {
|
||||||
|
StringBuilder query = new("SELECT COUNT(*) FROM dbo.fnIsUserITARCompliant(@UserID) ");
|
||||||
//query.Append("WHERE UserID = @UserID AND AND EmployeeStatus = 'Active'");
|
//query.Append("WHERE UserID = @UserID AND AND EmployeeStatus = 'Active'");
|
||||||
return this.db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
|
return db.Query<int>(query.ToString(), new { UserID = userID }).SingleOrDefault();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,38 +1,37 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Dapper;
|
using Dapper;
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using System.Text;
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.DMO
|
namespace Fab2ApprovalSystem.DMO;
|
||||||
{
|
|
||||||
public class TrainingDMO
|
public class TrainingDMO {
|
||||||
{
|
private readonly IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
||||||
private IDbConnection db = new SqlConnection(GlobalVars.DB_CONNECTION_STRING);
|
#if !NET8
|
||||||
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
|
private static FabApprovalTrainingEntities FabApprovalDB = new FabApprovalTrainingEntities();
|
||||||
|
#endif
|
||||||
|
|
||||||
public int Create(int issueId)
|
public int Create(int issueId) {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@ECNNumber", issueId);
|
parameters.Add("@ECNNumber", issueId);
|
||||||
|
|
||||||
this.db.Execute("InsertTrainingItem", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("InsertTrainingItem", parameters, commandType: CommandType.StoredProcedure);
|
||||||
int trainingId = parameters.Get<int>("@TrainingId");
|
int trainingId = parameters.Get<int>("@TrainingId");
|
||||||
|
|
||||||
return trainingId;
|
return trainingId;
|
||||||
}
|
}
|
||||||
public int CreateAssignment(int trainingId, int userId)
|
|
||||||
{
|
public int CreateAssignment(int trainingId, int userId) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
//parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
//parameters.Add("@TrainingId", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
@ -40,80 +39,113 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@UserID", userId);
|
parameters.Add("@UserID", userId);
|
||||||
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@AssignmentID", dbType: DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
|
|
||||||
this.db.Execute("InsertTrainingAssignment", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("InsertTrainingAssignment", parameters, commandType: CommandType.StoredProcedure);
|
||||||
int assignmentId = parameters.Get<int>("@AssignmentID");
|
int assignmentId = parameters.Get<int>("@AssignmentID");
|
||||||
|
|
||||||
return assignmentId;
|
return assignmentId;
|
||||||
}
|
}
|
||||||
public IEnumerable<Training> GetAllTrainings()
|
|
||||||
{
|
public IEnumerable<Training> GetAllTrainings() {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
IEnumerable<Training> allTrainings = (from a in db.Trainings select a).ToList();
|
IEnumerable<Training> allTrainings = (from a in db.Trainings select a).ToList();
|
||||||
|
|
||||||
return allTrainings;
|
return allTrainings;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public Training GetTraining(int trainingId)
|
|
||||||
{
|
public Training GetTraining(int trainingId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
Training trainingRecord = new Training();
|
Training trainingRecord = new Training();
|
||||||
trainingRecord = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
|
trainingRecord = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
|
||||||
return trainingRecord;
|
return trainingRecord;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public TrainingAssignment GetAssignment(int assignmentId)
|
|
||||||
{
|
public TrainingAssignment GetAssignment(int assignmentId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
TrainingAssignment assignmentRecord = (from a in db.TrainingAssignments where a.ID == assignmentId select a).FirstOrDefault();
|
TrainingAssignment assignmentRecord = (from a in db.TrainingAssignments where a.ID == assignmentId select a).FirstOrDefault();
|
||||||
return assignmentRecord;
|
return assignmentRecord;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public int GetTrainingId(int issueId)
|
|
||||||
{
|
public int GetTrainingId(int issueId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
int ECNId = issueId;
|
int ECNId = issueId;
|
||||||
int trainingId = (from a in db.Trainings where a.ECN == ECNId select a.TrainingID).FirstOrDefault();
|
int trainingId = (from a in db.Trainings where a.ECN == ECNId select a.TrainingID).FirstOrDefault();
|
||||||
|
|
||||||
return trainingId;
|
return trainingId;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<int> GetTrainees(int groupId)
|
|
||||||
{
|
public List<int> GetTrainees(int groupId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var users = (from a in db.TrainingGroupMembers where a.TrainingGroupID == groupId select a.UserID).ToList();
|
var users = (from a in db.TrainingGroupMembers where a.TrainingGroupID == groupId select a.UserID).ToList();
|
||||||
|
|
||||||
return users;
|
return users;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public bool isUserTrainingMember(int groupId, int userId)
|
|
||||||
{
|
public bool isUserTrainingMember(int groupId, int userId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var users = (from a in db.TrainingGroupMembers where a.TrainingGroupID == groupId && a.UserID == userId select a).FirstOrDefault();
|
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;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingGroup> GetTrainingGroups()
|
|
||||||
{
|
public List<TrainingGroup> GetTrainingGroups() {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
return (from a in db.TrainingGroups select a).ToList();
|
return (from a in db.TrainingGroups select a).ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public TrainingGroup GetTrainingGroupByID(int groupId)
|
|
||||||
{
|
public TrainingGroup GetTrainingGroupByID(int groupId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
TrainingGroup groups = (from a in db.TrainingGroups where a.TrainingGroupID == groupId select a).FirstOrDefault();
|
TrainingGroup groups = (from a in db.TrainingGroups where a.TrainingGroupID == groupId select a).FirstOrDefault();
|
||||||
return groups;
|
return groups;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<int> GetECNAssignedTrainingGroups(int ECNNumber)
|
|
||||||
{
|
public List<int> GetECNAssignedTrainingGroups(int ECNNumber) {
|
||||||
|
#if !NET8
|
||||||
List<int> trainingGroups = (from a in FabApprovalDB.ECNTrainingBies where a.ECNNumber == ECNNumber select a.AcknowledgementTrainingByID).ToList();
|
List<int> trainingGroups = (from a in FabApprovalDB.ECNTrainingBies where a.ECNNumber == ECNNumber select a.AcknowledgementTrainingByID).ToList();
|
||||||
|
|
||||||
return trainingGroups;
|
return trainingGroups;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void AddTrainingGroupToECN(int ECNNumber, int groupId)
|
|
||||||
{
|
public void AddTrainingGroupToECN(int ECNNumber, int groupId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
||||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
||||||
@ -125,14 +157,14 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
|
|
||||||
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
|
this.db.Execute("ECNInsertTrainingBy", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//db.ECNTrainingBies.Add(ecnTraining);
|
//db.ECNTrainingBies.Add(ecnTraining);
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void SetTrainingFlag(int ECNNumber)
|
|
||||||
{
|
public void SetTrainingFlag(int ECNNumber) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
//ECNTrainingBy ecnTraining = new ECNTrainingBy();
|
||||||
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
//ecnTraining.AcknowledgementTrainingByID = groupId;
|
||||||
@ -143,14 +175,14 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
|
|
||||||
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
|
this.db.Execute("ECNSetTrainingFlag", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//db.ECNTrainingBies.Add(ecnTraining);
|
//db.ECNTrainingBies.Add(ecnTraining);
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingAssignment> GetAllTrainingAssignments(int TrainingID)
|
|
||||||
{
|
public List<TrainingAssignment> GetAllTrainingAssignments(int TrainingID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||||
|
|
||||||
@ -159,9 +191,13 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||||
|
|
||||||
return TrainingData.ToList();
|
return TrainingData.ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingAssignment> GetTrainingAssignments(int TrainingID)
|
|
||||||
{
|
public List<TrainingAssignment> GetTrainingAssignments(int TrainingID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.Deleted != true select a;
|
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.Deleted != true select a;
|
||||||
|
|
||||||
@ -170,304 +206,328 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID select a;
|
||||||
|
|
||||||
return TrainingData.ToList();
|
return TrainingData.ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID)
|
|
||||||
{
|
public List<TrainingAssignment> GetTrainingAssignmentsByUser(int TrainingID, int userID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.UserID == userID select a;
|
var TrainingData = from a in db.TrainingAssignments where a.TrainingID == TrainingID && a.UserID == userID select a;
|
||||||
|
|
||||||
return TrainingData.ToList();
|
return TrainingData.ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingDocAck> GetAssignedDocs(int trainingAssignmentId)
|
|
||||||
{
|
public List<TrainingDocAck> GetAssignedDocs(int trainingAssignmentId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var docs = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentId && a.Deleted != true select a).ToList();
|
var docs = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentId && a.Deleted != true select a).ToList();
|
||||||
|
|
||||||
return docs;
|
return docs;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void AcknowledgeDocument(int trainingDocAckID)
|
|
||||||
{
|
public void AcknowledgeDocument(int trainingDocAckID) {
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
|
|
||||||
parameters = new DynamicParameters();
|
parameters = new DynamicParameters();
|
||||||
parameters.Add("@TrainingDocAckID", trainingDocAckID);
|
parameters.Add("@TrainingDocAckID", trainingDocAckID);
|
||||||
//parameters.Add("@AttachmentID", attachmentID);
|
//parameters.Add("@AttachmentID", attachmentID);
|
||||||
|
|
||||||
this.db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("TrainingAcknowledgeDocument", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void UpdateAssignmentStatus(int trainingAssignmentID)
|
|
||||||
{
|
public void UpdateAssignmentStatus(int trainingAssignmentID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var RecordToUpdate = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a).SingleOrDefault();
|
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.DateCompleted = DateTime.Now;
|
||||||
RecordToUpdate.status = true;
|
RecordToUpdate.status = true;
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
} catch (InvalidOperationException e) {
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
string exception = e.ToString();
|
string exception = e.ToString();
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public int GetTrainingIdByAssignment(int trainingAssignmentID)
|
|
||||||
{
|
public int GetTrainingIdByAssignment(int trainingAssignmentID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
int trainingID = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a.TrainingID).SingleOrDefault();
|
int trainingID = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a.TrainingID).SingleOrDefault();
|
||||||
|
|
||||||
return trainingID;
|
return trainingID;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void UpdateTrainingStatus(int trainingId)
|
|
||||||
{
|
public void UpdateTrainingStatus(int trainingId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).SingleOrDefault();
|
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.CompletedDate = DateTime.Now;
|
||||||
training.Status = true;
|
training.Status = true;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
} catch (InvalidOperationException e) {
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
string exception = e.ToString();
|
string exception = e.ToString();
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void reOpenTraining(int trainingId)
|
|
||||||
{
|
public void reOpenTraining(int trainingId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).SingleOrDefault();
|
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).SingleOrDefault();
|
||||||
|
|
||||||
if (training != null)
|
if (training != null) {
|
||||||
{
|
|
||||||
training.CompletedDate = null;
|
training.CompletedDate = null;
|
||||||
training.Status = false;
|
training.Status = false;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
} catch (InvalidOperationException e) {
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
string exception = e.ToString();
|
string exception = e.ToString();
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckTrainingStatus(int trainingAssignmentID)
|
public bool CheckTrainingStatus(int trainingAssignmentID) {
|
||||||
{
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
bool isFinished = true;
|
bool isFinished = true;
|
||||||
int trainingID = (from a in db.TrainingAssignments where a.ID == trainingAssignmentID select a.TrainingID).SingleOrDefault();
|
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;
|
var trainingAssignments = from a in db.TrainingAssignments where a.TrainingID == trainingID && a.Deleted != true select a;
|
||||||
|
|
||||||
foreach (var training in trainingAssignments)
|
foreach (var training in trainingAssignments) {
|
||||||
{
|
if (training.status == false) {
|
||||||
if (training.status == false)
|
|
||||||
{
|
|
||||||
isFinished = false;
|
isFinished = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return isFinished;
|
return isFinished;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CheckTrainingAssignmentStatus(int trainingAssignmentID)
|
public bool CheckTrainingAssignmentStatus(int trainingAssignmentID) {
|
||||||
{
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
bool isFinished = true;
|
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;
|
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;
|
isFinished = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return isFinished;
|
return isFinished;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public bool IsUserAssigned(int userId, int trainingId)
|
|
||||||
{
|
public bool IsUserAssigned(int userId, int trainingId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
bool userHasAssignment = false;
|
bool userHasAssignment = false;
|
||||||
|
|
||||||
var assignments = (from a in db.TrainingAssignments where a.TrainingID == trainingId && a.UserID == userId && a.Deleted != true select a).ToList();
|
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;
|
userHasAssignment = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return userHasAssignment;
|
return userHasAssignment;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<Training> GetTrainings()
|
|
||||||
{
|
public List<Training> GetTrainings() {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var trainings = from a in db.Trainings select a;
|
var trainings = from a in db.Trainings select a;
|
||||||
|
|
||||||
return trainings.ToList();
|
return trainings.ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID)
|
|
||||||
{
|
public List<TrainingAssignment> GetTrainingAssignmentsByUserID(int userID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var trainingAssignments = from a in db.TrainingAssignments where a.UserID == userID && a.Deleted != true select a;
|
var trainingAssignments = from a in db.TrainingAssignments where a.UserID == userID && a.Deleted != true select a;
|
||||||
|
|
||||||
return trainingAssignments.ToList();
|
return trainingAssignments.ToList();
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeleteTrainingAssignment(int trainingAssignmentId)
|
public void DeleteTrainingAssignment(int trainingAssignmentId) {
|
||||||
{
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var trainingAssignments = from a in db.TrainingAssignments where a.ID == trainingAssignmentId select a;
|
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.Deleted = true;
|
||||||
item.DeletedDate = DateTime.Now;
|
item.DeletedDate = DateTime.Now;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
} catch (InvalidOperationException e) {
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
string exception = e.ToString();
|
string exception = e.ToString();
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void DeleteTrainingDocAck(int trainingAssignmentId)
|
|
||||||
{
|
public void DeleteTrainingDocAck(int trainingAssignmentId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
var trainingDocAcks = from a in db.TrainingDocAcks where a.TrainingAssignmentID == trainingAssignmentId select a;
|
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.Deleted = true;
|
||||||
item.DeletedDate = DateTime.Now;
|
item.DeletedDate = DateTime.Now;
|
||||||
}
|
}
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
}
|
} catch (InvalidOperationException e) {
|
||||||
catch (InvalidOperationException e)
|
|
||||||
{
|
|
||||||
string exception = e.ToString();
|
string exception = e.ToString();
|
||||||
Console.WriteLine(e);
|
Console.WriteLine(e);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void DeleteTraining(int trainingId)
|
|
||||||
{
|
public void DeleteTraining(int trainingId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
|
Training training = (from a in db.Trainings where a.TrainingID == trainingId select a).FirstOrDefault();
|
||||||
|
|
||||||
if (training != null)
|
if (training != null) {
|
||||||
{
|
|
||||||
training.Deleted = true;
|
training.Deleted = true;
|
||||||
training.DeletedDate = DateTime.Now;
|
training.DeletedDate = DateTime.Now;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<TrainingAssignment> trainingAssignments = (from a in db.TrainingAssignments where a.TrainingID == trainingId select a).ToList();
|
List<TrainingAssignment> trainingAssignments = (from a in db.TrainingAssignments where a.TrainingID == trainingId select a).ToList();
|
||||||
db.SaveChanges();
|
db.SaveChanges();
|
||||||
foreach (TrainingAssignment trainingAssignment in trainingAssignments)
|
foreach (TrainingAssignment trainingAssignment in trainingAssignments) {
|
||||||
{
|
|
||||||
DeleteTrainingAssignment(trainingAssignment.ID);
|
DeleteTrainingAssignment(trainingAssignment.ID);
|
||||||
DeleteTrainingDocAck(trainingAssignment.ID);
|
DeleteTrainingDocAck(trainingAssignment.ID);
|
||||||
//db.SaveChanges();
|
//db.SaveChanges();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public void DeleteAssignmentByUserId(int userId)
|
|
||||||
{
|
public void DeleteAssignmentByUserId(int userId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
|
|
||||||
var userAssignments = (from a in db.TrainingAssignments where a.UserID == userId select a).ToList();
|
var userAssignments = (from a in db.TrainingAssignments where a.UserID == userId select a).ToList();
|
||||||
|
|
||||||
foreach (var item in userAssignments)
|
foreach (var item in userAssignments) {
|
||||||
{
|
|
||||||
//get document assignments
|
//get document assignments
|
||||||
var docAssignments = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == item.TrainingID select a).ToList();
|
var docAssignments = (from a in db.TrainingDocAcks where a.TrainingAssignmentID == item.TrainingID select a).ToList();
|
||||||
//delete each docAssignment
|
//delete each docAssignment
|
||||||
foreach (var docAssignment in docAssignments)
|
foreach (var docAssignment in docAssignments) {
|
||||||
{
|
|
||||||
DeleteTrainingDocAck(docAssignment.ID);
|
DeleteTrainingDocAck(docAssignment.ID);
|
||||||
}
|
}
|
||||||
DeleteTrainingAssignment(item.ID);
|
DeleteTrainingAssignment(item.ID);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public bool CheckValidDocAck(int docAckId)
|
|
||||||
{
|
public bool CheckValidDocAck(int docAckId) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
TrainingDocAck ack = (from a in db.TrainingDocAcks where a.ID == docAckId select a).FirstOrDefault();
|
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
|
//Check that the assignment exists
|
||||||
if (ack != null)
|
if (ack != null) {
|
||||||
{
|
|
||||||
//Check that the assignment isn't deleted
|
//Check that the assignment isn't deleted
|
||||||
if (ack.Deleted == true)
|
if (ack.Deleted == true) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//Check that the assignment isn't completed
|
//Check that the assignment isn't completed
|
||||||
else if (ack.Reviewed == true)
|
else if (ack.Reviewed == true) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<Training> GetAllOpenTrainings()
|
|
||||||
{
|
public List<Training> GetAllOpenTrainings() {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
||||||
List<Training> openTrainings = (from a in db.Trainings where a.Status != true && a.Deleted != true select a).ToList();
|
List<Training> openTrainings = (from a in db.Trainings where a.Status != true && a.Deleted != true select a).ToList();
|
||||||
return openTrainings;
|
return openTrainings;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
public List<TrainingAssignment> GetOpenAssignmentsByTrainingID(int trainingID)
|
|
||||||
{
|
public List<TrainingAssignment> GetOpenAssignmentsByTrainingID(int trainingID) {
|
||||||
|
#if !NET8
|
||||||
FabApprovalTrainingEntities db = new FabApprovalTrainingEntities();
|
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();
|
List<TrainingAssignment> openAssignments = (from a in FabApprovalDB.TrainingAssignments where a.TrainingID == trainingID && a.status != true && a.Deleted != true select a).ToList();
|
||||||
return openAssignments;
|
return openAssignments;
|
||||||
|
#else
|
||||||
|
throw new NotImplementedException();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshTrainingData(int TrainingID, IQueryable<TrainingAssignment> TrainingData)
|
private void RefreshTrainingData(int TrainingID, IQueryable<TrainingAssignment> TrainingData) {
|
||||||
{
|
|
||||||
bool assignmentIsIncomplete = false;
|
bool assignmentIsIncomplete = false;
|
||||||
UserAccountDMO userAccountDMO = new UserAccountDMO();
|
UserAccountDMO userAccountDMO = new();
|
||||||
foreach (TrainingAssignment assignment in TrainingData)
|
foreach (TrainingAssignment assignment in TrainingData) {
|
||||||
{
|
|
||||||
LoginModel userModel = userAccountDMO.GetUserByID(assignment.UserID);
|
LoginModel userModel = userAccountDMO.GetUserByID(assignment.UserID);
|
||||||
if (!userModel.IsActive) UpdateAssignmentStatus(assignment.ID);
|
if (!userModel.IsActive)
|
||||||
|
UpdateAssignmentStatus(assignment.ID);
|
||||||
if (assignment.Deleted != true && (assignment.DateCompleted is null || assignment.DateCompleted > DateTime.Now))
|
if (assignment.Deleted != true && (assignment.DateCompleted is null || assignment.DateCompleted > DateTime.Now))
|
||||||
assignmentIsIncomplete = true;
|
assignmentIsIncomplete = true;
|
||||||
}
|
}
|
||||||
@ -476,4 +536,3 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
UpdateTrainingStatus(TrainingID);
|
UpdateTrainingStatus(TrainingID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,33 +1,22 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Data.SqlClient;
|
using System.Data.SqlClient;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Dapper;
|
|
||||||
using Fab2ApprovalSystem.Models;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
|
using Dapper;
|
||||||
|
|
||||||
using Fab2ApprovalSystem.Misc;
|
using Fab2ApprovalSystem.Misc;
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
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 List<LoginModel> GetUser(string loginID)
|
public IEnumerable<LoginModel> GetAllUsers() {
|
||||||
//{
|
StringBuilder sql = new();
|
||||||
// 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("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("FROM Users U LEFT JOIN Users U1 ");
|
||||||
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
||||||
@ -37,11 +26,11 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
sql.Append("FROM Users U LEFT JOIN Users U1 ON U.DelegatedTo = U1.UserID ");
|
||||||
sql.Append("ORDER BY FirstName ");
|
sql.Append("ORDER BY FirstName ");
|
||||||
|
|
||||||
return this.db.Query<LoginModel>(sql.ToString()).ToList();
|
return db.Query<LoginModel>(sql.ToString()).ToList();
|
||||||
}
|
}
|
||||||
public IEnumerable<LoginModel> GetAllActiveUsers()
|
|
||||||
{
|
public IEnumerable<LoginModel> GetAllActiveUsers() {
|
||||||
StringBuilder sql = new StringBuilder();
|
StringBuilder sql = new();
|
||||||
//sql.Append("SELECT U.FirstName + ' ' + U.LastName AS FullName, U1.FirstName + ' ' + U1.LastName AS DelegatedToFullName, U.* ");
|
//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("FROM Users U LEFT JOIN Users U1 ");
|
||||||
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
//sql.Append("ON U.UserID = U1.DelegatedTo ORDER BY FirstName ");
|
||||||
@ -52,47 +41,31 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
sql.Append("WHERE U.IsActive = 1 ");
|
sql.Append("WHERE U.IsActive = 1 ");
|
||||||
sql.Append("ORDER BY FirstName ");
|
sql.Append("ORDER BY FirstName ");
|
||||||
|
|
||||||
return this.db.Query<LoginModel>(sql.ToString()).ToList();
|
return db.Query<LoginModel>(sql.ToString()).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoginModel GetUser(string loginID) =>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LoginModel GetUser(string loginID)
|
|
||||||
{
|
|
||||||
//StringBuilder sql = new StringBuilder();
|
//StringBuilder sql = new StringBuilder();
|
||||||
//sql.Append("SELECT * FROM Users WHERE LoginID = '" + loginID + "'");
|
//sql.Append("SELECT * FROM Users WHERE LoginID = '" + loginID + "'");
|
||||||
|
|
||||||
//return this.db.Query<LoginModel>(sql.ToString()).SingleOrDefault();
|
//return this.db.Query<LoginModel>(sql.ToString()).SingleOrDefault();
|
||||||
|
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 LoginID = @loginID AND IsActive = 1 ", new { loginID = loginID }).Take(1).SingleOrDefault();
|
return db.Query<LoginModel>(
|
||||||
}
|
|
||||||
|
|
||||||
public LoginModel GetUserByID(int userID)
|
|
||||||
{
|
|
||||||
return this.db.Query<LoginModel>(
|
|
||||||
"SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE UserID = @UserID ",
|
"SELECT FirstName + ' ' + LastName AS FullName, * FROM Users WHERE UserID = @UserID ",
|
||||||
new { UserID = userID }).Take(1).SingleOrDefault();
|
new { UserID = userID }).Take(1).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetUserEmailByID(string userID)
|
public string GetUserEmailByID(int userID) {
|
||||||
{
|
return db.Query<string>(
|
||||||
return this.db.Query<string>(
|
|
||||||
"SELECT Email FROM Users WHERE UserID = @UserID ",
|
"SELECT Email FROM Users WHERE UserID = @UserID ",
|
||||||
new { UserID = userID }).Take(1).SingleOrDefault();
|
new { UserID = userID }).Take(1).SingleOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void UpdateUser(LoginModel model) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
internal void UpdateUser(LoginModel model)
|
|
||||||
{
|
|
||||||
string sql;
|
string sql;
|
||||||
sql = "UPDATE Users SET LoginID = @LoginID, FirstName = @FirstName, LastName = @LastName, Email = @Email, IsActive = @IsActive, IsAdmin = @IsAdmin WHERE UserID = @UserID";
|
sql = "UPDATE Users SET LoginID = @LoginID, FirstName = @FirstName, LastName = @LastName, Email = @Email, IsActive = @IsActive, IsAdmin = @IsAdmin WHERE UserID = @UserID";
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", model.UserID);
|
parameters.Add("@UserID", model.UserID);
|
||||||
parameters.Add("@LoginID", model.LoginID);
|
parameters.Add("@LoginID", model.LoginID);
|
||||||
parameters.Add("@FirstName", model.FirstName);
|
parameters.Add("@FirstName", model.FirstName);
|
||||||
@ -101,34 +74,23 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@IsAdmin", model.IsAdmin);
|
parameters.Add("@IsAdmin", model.IsAdmin);
|
||||||
parameters.Add("@IsActive", model.IsActive);
|
parameters.Add("@IsActive", model.IsActive);
|
||||||
|
|
||||||
this.db.Execute(sql, parameters);
|
db.Execute(sql, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void DeleteUser(LoginModel model) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
internal void DeleteUser(LoginModel model)
|
|
||||||
{
|
|
||||||
string sql;
|
string sql;
|
||||||
//sql = "DELETE Users WHERE UserID = @UserID";
|
//sql = "DELETE Users WHERE UserID = @UserID";
|
||||||
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
|
sql = "UPDATE Users SET IsActive = 0 WHERE UserID = @UserID";
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", model.UserID);
|
parameters.Add("@UserID", model.UserID);
|
||||||
|
|
||||||
this.db.Execute(sql, parameters);
|
db.Execute(sql, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void InsertUser(LoginModel model) {
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="model"></param>
|
|
||||||
internal void InsertUser(LoginModel model)
|
|
||||||
{
|
|
||||||
//string sql;
|
//string sql;
|
||||||
//sql = "INSERT Users (LoginID, FirstName, LastName, IsAdmin) VALUES (@LoginID, @FirstName, @LastName, @IsAdmin )";
|
//sql = "INSERT Users (LoginID, FirstName, LastName, IsAdmin) VALUES (@LoginID, @FirstName, @LastName, @IsAdmin )";
|
||||||
var parameters = new DynamicParameters();
|
DynamicParameters parameters = new();
|
||||||
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
parameters.Add("@UserID", model.UserID, DbType.Int32, direction: ParameterDirection.InputOutput);
|
||||||
parameters.Add("@LoginID", model.LoginID);
|
parameters.Add("@LoginID", model.LoginID);
|
||||||
parameters.Add("@FirstName", model.FirstName);
|
parameters.Add("@FirstName", model.FirstName);
|
||||||
@ -136,39 +98,24 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
parameters.Add("@Email", model.Email);
|
parameters.Add("@Email", model.Email);
|
||||||
parameters.Add("@IsAdmin", model.IsAdmin);
|
parameters.Add("@IsAdmin", model.IsAdmin);
|
||||||
|
|
||||||
this.db.Execute("InsertUsers", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("InsertUsers", parameters, commandType: CommandType.StoredProcedure);
|
||||||
int userid = parameters.Get<int>("@UserID");
|
int userid = parameters.Get<int>("@UserID");
|
||||||
model.UserID = userid;
|
model.UserID = userid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal void UpdateInsertITARAccess(string userID, string hasITARAccess) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </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("@UserID", userID);
|
||||||
parameters.Add("@HasITARAccess", hasITARAccess);
|
parameters.Add("@HasITARAccess", hasITARAccess);
|
||||||
|
|
||||||
this.db.Execute("ITARAccessUpdateInsert", parameters, commandType: CommandType.StoredProcedure);
|
db.Execute("ITARAccessUpdateInsert", parameters, commandType: CommandType.StoredProcedure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal bool GetITARAccess(int userID) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal bool GetITARAccess(int userID)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
|
|
||||||
var results = this.db.Query<string>(
|
var results = db.Query<string>(
|
||||||
"SELECT HasITARAccess FROM SAMUsers, Users WHERE Users.UserID = @UserID AND SAMUsers.UserID = Users.LoginID",
|
"SELECT HasITARAccess FROM SAMUsers, Users WHERE Users.UserID = @UserID AND SAMUsers.UserID = Users.LoginID",
|
||||||
parameters, commandType: CommandType.Text);
|
parameters, commandType: CommandType.Text);
|
||||||
if ((results != null) && (results.Count() > 0) && (results.First() == "1"))
|
if ((results != null) && (results.Count() > 0) && (results.First() == "1"))
|
||||||
@ -177,17 +124,11 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
internal bool GetEC_AD_Users(string userID) {
|
||||||
///
|
DynamicParameters parameters = new();
|
||||||
/// </summary>
|
|
||||||
/// <param name="userID"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
internal bool GetEC_AD_Users(string userID)
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
parameters.Add("@UserID", userID);
|
parameters.Add("@UserID", userID);
|
||||||
|
|
||||||
var results = this.db.Query<string>(
|
var results = db.Query<string>(
|
||||||
"SELECT UserID FROM EC_AD_Users WHERE UserID = @UserID",
|
"SELECT UserID FROM EC_AD_Users WHERE UserID = @UserID",
|
||||||
parameters, commandType: CommandType.Text);
|
parameters, commandType: CommandType.Text);
|
||||||
if ((results != null) && (results.Count() > 0))
|
if ((results != null) && (results.Count() > 0))
|
||||||
@ -196,17 +137,13 @@ namespace Fab2ApprovalSystem.DMO
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ProcessOoO()
|
internal void ProcessOoO() {
|
||||||
{
|
DynamicParameters parameters = new();
|
||||||
var parameters = new DynamicParameters();
|
db.Execute("ProcesOOOEnableStatus", commandType: CommandType.StoredProcedure);
|
||||||
this.db.Execute("ProcesOOOEnableStatus", commandType: CommandType.StoredProcedure);
|
}
|
||||||
|
|
||||||
}
|
|
||||||
internal void ExpireOoO()
|
|
||||||
{
|
|
||||||
var parameters = new DynamicParameters();
|
|
||||||
this.db.Execute("ProcesOOOExpiration", commandType: CommandType.StoredProcedure);
|
|
||||||
|
|
||||||
}
|
internal void ExpireOoO() {
|
||||||
|
DynamicParameters parameters = new();
|
||||||
|
db.Execute("ProcesOOOExpiration", commandType: CommandType.StoredProcedure);
|
||||||
}
|
}
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,24 +1,25 @@
|
|||||||
using Fab2ApprovalSystem.Misc;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Hosting;
|
using System.Web.Hosting;
|
||||||
|
using System.Web.Http;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Optimization;
|
using System.Web.Optimization;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
using System.Configuration;
|
|
||||||
using Fab2ApprovalSystem.DMO;
|
|
||||||
using System.Web.Http;
|
|
||||||
using Fab2ApprovalSystem.JobSchedules;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem
|
using Fab2ApprovalSystem.DMO;
|
||||||
{
|
using Fab2ApprovalSystem.JobSchedules;
|
||||||
public class MvcApplication : System.Web.HttpApplication
|
using Fab2ApprovalSystem.Misc;
|
||||||
{
|
using Fab2ApprovalSystem.Models;
|
||||||
protected void Application_Start()
|
|
||||||
{
|
namespace Fab2ApprovalSystem;
|
||||||
|
|
||||||
|
public class MvcApplication : System.Web.HttpApplication {
|
||||||
|
|
||||||
|
protected void Application_Start() {
|
||||||
AreaRegistration.RegisterAllAreas();
|
AreaRegistration.RegisterAllAreas();
|
||||||
GlobalConfiguration.Configure(WebApiConfig.Register);
|
GlobalConfiguration.Configure(WebApiConfig.Register);
|
||||||
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
|
||||||
@ -40,8 +41,6 @@ namespace Fab2ApprovalSystem
|
|||||||
GlobalVars.WSR_URL = ConfigurationManager.AppSettings["WSR_URL"].ToString();
|
GlobalVars.WSR_URL = ConfigurationManager.AppSettings["WSR_URL"].ToString();
|
||||||
GlobalVars.CA_BlankFormsLocation = ConfigurationManager.AppSettings["CA_BlankFormsLocation"].ToString();
|
GlobalVars.CA_BlankFormsLocation = ConfigurationManager.AppSettings["CA_BlankFormsLocation"].ToString();
|
||||||
|
|
||||||
//GlobalVars.AttachmentUrl = connectionstring.ToUpper().Contains("TEST") ? @"http://" + DevAttachmentUrl + "/" : @"http://" + ProdAttachmentUrl + "/"; ;
|
|
||||||
|
|
||||||
#if (!DEBUG)
|
#if (!DEBUG)
|
||||||
OOOTrainingReportJobSchedule.Start();
|
OOOTrainingReportJobSchedule.Start();
|
||||||
|
|
||||||
@ -57,109 +56,73 @@ namespace Fab2ApprovalSystem
|
|||||||
GlobalVars.hostURL = @"https://" + DevWebSiteUrl;
|
GlobalVars.hostURL = @"https://" + DevWebSiteUrl;
|
||||||
#endif
|
#endif
|
||||||
GlobalVars.DBConnection = GlobalVars.DB_CONNECTION_STRING.ToUpper().Contains("TEST") ? "TEST" : GlobalVars.DB_CONNECTION_STRING.ToUpper().Contains("QUALITY") ? "QUALITY" : "PROD";
|
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);
|
var context = new HttpContextWrapper(Context);
|
||||||
|
|
||||||
//Do a direct 401 unautorized
|
//Do a direct 401 unauthorized
|
||||||
if (Context.Response.StatusCode == 301 && context.Request.IsAjaxRequest())
|
if (Context.Response.StatusCode == 301 && context.Request.IsAjaxRequest()) {
|
||||||
{
|
|
||||||
Context.Response.Clear();
|
Context.Response.Clear();
|
||||||
Context.Response.StatusCode = 401;
|
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.Clear();
|
||||||
context.Response.StatusCode = 401;
|
context.Response.StatusCode = 401;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Session_Start(object sender, EventArgs e)
|
protected void Session_Start(object sender, EventArgs e) {
|
||||||
{
|
Session[GlobalVars.ECN_VIEW_OPTION] = "Pending Approvals";
|
||||||
Session[GlobalVars.ECN_VIEW_OPTION] = "Pending Approvals"; ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Session_End(object sender, EventArgs e)
|
protected void Session_End(object sender, EventArgs e) {
|
||||||
{
|
|
||||||
//FormsAuthentication.SignOut();
|
//FormsAuthentication.SignOut();
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
Session[GlobalVars.SESSION_USERNAME] = "";
|
Session[GlobalVars.SESSION_USERNAME] = "";
|
||||||
Session[GlobalVars.SESSION_USERID] = "";
|
Session[GlobalVars.SESSION_USERID] = "";
|
||||||
Session[GlobalVars.IS_ADMIN] = "";
|
Session[GlobalVars.IS_ADMIN] = "";
|
||||||
|
} catch (Exception ex) {
|
||||||
//LotTravelerDMO LotTravDMO = new LotTravelerDMO();
|
Functions.WriteEvent(null, @User.Identity.Name + "\r\n Session Closed - \r\n" + ex.Message.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
//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
|
// 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
|
// 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)";
|
private static string MSUserAgentsRegex = @"[^\w](Word|Excel|PowerPoint|ms-office)([^\w]|\z)";
|
||||||
protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e)
|
protected void Application_OnPostAuthenticateRequest(object sender, EventArgs e) {
|
||||||
{
|
if (System.Text.RegularExpressions.Regex.IsMatch(Request.UserAgent, MSUserAgentsRegex)) {
|
||||||
if (System.Text.RegularExpressions.Regex.IsMatch(Request.UserAgent, MSUserAgentsRegex))
|
|
||||||
{
|
|
||||||
Response.Write("<html><head><meta http-equiv='refresh' content='0'/></head><body></body></html>");
|
Response.Write("<html><head><meta http-equiv='refresh' content='0'/></head><body></body></html>");
|
||||||
Response.End();
|
Response.End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application_Error(object sender, EventArgs e)
|
void Application_Error(object sender, EventArgs e) {
|
||||||
{
|
|
||||||
var ex = Server.GetLastError();
|
var ex = Server.GetLastError();
|
||||||
|
|
||||||
var exString = "Caught unhandled exception:\r\n";
|
var exString = "Caught unhandled exception:\r\n";
|
||||||
exString += String.Format("User: {0}\r\n", @User.Identity.Name);
|
exString += String.Format("User: {0}\r\n", @User.Identity.Name);
|
||||||
Exception x = ex;
|
Exception x = ex;
|
||||||
while (x != null)
|
while (x != null) {
|
||||||
{
|
|
||||||
exString += x.ToString();
|
exString += x.ToString();
|
||||||
exString += "=====\r\n";
|
exString += "=====\r\n";
|
||||||
x = x.InnerException;
|
x = x.InnerException;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Misc.Functions.WriteEvent(exString, System.Diagnostics.EventLogEntryType.Error);
|
try {
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (exString.Length > 500)
|
if (exString.Length > 500)
|
||||||
exString = exString.Substring(0, 500);
|
exString = exString.Substring(0, 500);
|
||||||
|
|
||||||
EventLogDMO.Add(new Fab2ApprovalSystem.Models.WinEventLog()
|
EventLogDMO.Add(new Fab2ApprovalSystem.Models.WinEventLog() {
|
||||||
{
|
|
||||||
UserID = @User.Identity.Name,
|
UserID = @User.Identity.Name,
|
||||||
OperationType = "Error",
|
OperationType = "Error",
|
||||||
Comments = exString
|
Comments = exString
|
||||||
});
|
});
|
||||||
}
|
} catch (Exception ex2) {
|
||||||
catch (Exception ex2)
|
Misc.Functions.WriteEvent(null, "Failed to write error to event log in database: " + ex2.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
||||||
{
|
|
||||||
Misc.Functions.WriteEvent("Failed to write error to event log in database: " + ex2.ToString(), System.Diagnostics.EventLogEntryType.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,17 +1,13 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using Fab2ApprovalSystem.Workers;
|
using Fab2ApprovalSystem.Workers;
|
||||||
using Quartz.Impl;
|
|
||||||
using Quartz;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.JobSchedules
|
using Quartz;
|
||||||
{
|
using Quartz.Impl;
|
||||||
public class OOOTrainingReportJobSchedule
|
|
||||||
{
|
namespace Fab2ApprovalSystem.JobSchedules;
|
||||||
public static void Start()
|
|
||||||
{
|
public class OOOTrainingReportJobSchedule {
|
||||||
|
|
||||||
|
public static void Start() {
|
||||||
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
|
ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
|
||||||
|
|
||||||
IScheduler scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();
|
IScheduler scheduler = schedulerFactory.GetScheduler().GetAwaiter().GetResult();
|
||||||
@ -30,4 +26,3 @@ namespace Fab2ApprovalSystem.JobSchedules
|
|||||||
scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger);
|
scheduler.ScheduleJob(oooTrainingReportJob, oooTrainingReportTrigger);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -8,29 +8,25 @@ using Fab2ApprovalSystem.Utilities;
|
|||||||
|
|
||||||
using Quartz;
|
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();
|
|
||||||
|
|
||||||
async Task IJob.Execute(IJobExecutionContext context)
|
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) {
|
||||||
await Task.Run(() => {
|
await Task.Run(() => {
|
||||||
|
|
||||||
string emailBody = "<h1>Mesa Approval Open Training Assignments Report - OOO</h1> <br />";
|
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 += "<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 += " Please ensure they complete their training assignments promptly upon their return.</p><br />";
|
||||||
emailBody += "<style>table,th,td{border: 1px solid black;}</style>";
|
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<TrainingReportUser> trainingReportUsers = adminDMO.GetTrainingReportUsers();
|
||||||
List<string> emailList = new List<string>();
|
List<string> emailList = new();
|
||||||
foreach (var user in trainingReportUsers)
|
foreach (TrainingReportUser user in trainingReportUsers) {
|
||||||
{
|
|
||||||
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
string userEmail = userDMO.GetUserByID(user.UserId).Email;
|
||||||
emailList.Add(userEmail);
|
emailList.Add(userEmail);
|
||||||
}
|
}
|
||||||
@ -38,8 +34,7 @@ namespace Fab2ApprovalSystem.Workers
|
|||||||
//Get a list of open trainings
|
//Get a list of open trainings
|
||||||
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
List<Training> openTrainings = trainingDMO.GetAllOpenTrainings();
|
||||||
|
|
||||||
foreach (Training training in openTrainings)
|
foreach (Training training in openTrainings) {
|
||||||
{
|
|
||||||
string trainingSection = "";
|
string trainingSection = "";
|
||||||
int trainingSectionUserCount = 0;
|
int trainingSectionUserCount = 0;
|
||||||
string ecnTitle = ecnDMO.GetECN(training.ECN).Title;
|
string ecnTitle = ecnDMO.GetECN(training.ECN).Title;
|
||||||
@ -48,11 +43,8 @@ namespace Fab2ApprovalSystem.Workers
|
|||||||
trainingSection += "<table>";
|
trainingSection += "<table>";
|
||||||
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
|
trainingSection += "<tr><th>Name</th><th>Date Assigned</th></tr>";
|
||||||
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
|
List<TrainingAssignment> openAssignments = trainingDMO.GetOpenAssignmentsByTrainingID(training.TrainingID);
|
||||||
foreach (TrainingAssignment assignment in openAssignments)
|
foreach (TrainingAssignment assignment in openAssignments) {
|
||||||
{
|
if (userDMO.GetUserByID(assignment.UserID).OOO) {
|
||||||
|
|
||||||
if (userDMO.GetUserByID(assignment.UserID).OOO)
|
|
||||||
{
|
|
||||||
trainingSectionUserCount++;
|
trainingSectionUserCount++;
|
||||||
|
|
||||||
DateTime? assignmentDate = assignment.DateAssigned;
|
DateTime? assignmentDate = assignment.DateAssigned;
|
||||||
@ -65,12 +57,12 @@ namespace Fab2ApprovalSystem.Workers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
trainingSection += "</table>";
|
trainingSection += "</table>";
|
||||||
if (trainingSectionUserCount > 0) emailBody += trainingSection;
|
if (trainingSectionUserCount > 0)
|
||||||
|
emailBody += trainingSection;
|
||||||
}
|
}
|
||||||
string recipientEmail = "";
|
string recipientEmail = "";
|
||||||
List<string> ccRecipients = emailList;
|
List<string> ccRecipients = emailList;
|
||||||
emailer.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Mesa Approval Open Training Report - OOO", emailBody, "Open Training Report - OOO");
|
EmailUtilities.SendNotification("MesaFabApproval@infineon.com", ccRecipients, "Open Training Report - OOO", emailBody);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,39 +1,32 @@
|
|||||||
using Fab2ApprovalSystem.Models;
|
using System.Collections.Generic;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
using Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class DemoHelper
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
{
|
|
||||||
public static List<string> GetCountries()
|
public class DemoHelper {
|
||||||
{
|
|
||||||
|
public static List<string> GetCountries() {
|
||||||
return new List<string>
|
return new List<string>
|
||||||
{
|
{
|
||||||
"USA", "England", "Belguim", "France", "Italy"
|
"USA", "England", "Belguim", "France", "Italy"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<TestModel> ListOfModels = new List<TestModel>();
|
public List<TestModel> ListOfModels = new();
|
||||||
|
|
||||||
private static DemoHelper m_dHelper = new DemoHelper();
|
private static readonly DemoHelper m_dHelper = new();
|
||||||
public static DemoHelper Instance
|
public static DemoHelper Instance {
|
||||||
{
|
|
||||||
get { return m_dHelper; }
|
get { return m_dHelper; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private DemoHelper()
|
private DemoHelper() {
|
||||||
{
|
TestModel A1 = new();
|
||||||
TestModel A1 = new TestModel();
|
|
||||||
A1.Name = "Eran";
|
A1.Name = "Eran";
|
||||||
A1.Countries = new List<string>();
|
A1.Countries = new List<string>();
|
||||||
A1.Countries.Add("England");
|
A1.Countries.Add("England");
|
||||||
A1.Countries.Add("Belguim");
|
A1.Countries.Add("Belguim");
|
||||||
ListOfModels.Add(A1);
|
ListOfModels.Add(A1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,168 +1,3 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
//using DFClib.DfException;
|
public class Documentum { }
|
||||||
//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);
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +1,47 @@
|
|||||||
using System;
|
#pragma warning disable CS8019
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc {
|
#pragma warning restore CS8019
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
public class EmailNotification {
|
public class EmailNotification {
|
||||||
|
|
||||||
#region Variabls
|
#region Variabls
|
||||||
protected string _subject = null;
|
protected string _subject = null;
|
||||||
protected string _TemplatesPath = null;
|
protected string _TemplatesPath = null;
|
||||||
|
private readonly Models.AppSettings _AppSettings;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public EmailNotification(Models.AppSettings appSettings) =>
|
||||||
|
_AppSettings = appSettings;
|
||||||
|
|
||||||
|
/// <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>
|
/// <summary>
|
||||||
/// Email subject
|
/// Email subject
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string EmailSubject {
|
public string EmailSubject {
|
||||||
set { _subject = value; }
|
set => _subject = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -30,6 +54,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
try {
|
try {
|
||||||
//setting the file name path
|
//setting the file name path
|
||||||
string path = _TemplatesPath + FileName;
|
string path = _TemplatesPath + FileName;
|
||||||
|
#if !NET8
|
||||||
FileInfo TheFile = new FileInfo(System.Web.HttpContext.Current.Server.MapPath(path));
|
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.
|
||||||
@ -40,6 +65,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
StreamReader sr = new StreamReader(System.Web.HttpContext.Current.Server.MapPath(@path), System.Text.Encoding.GetEncoding(1256));
|
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.
|
retVal = sr.ReadToEnd(); // getting the entire text from the file.
|
||||||
sr.Close();
|
sr.Close();
|
||||||
|
#endif
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new Exception("Error Reading File." + ex.Message);
|
throw new Exception("Error Reading File." + ex.Message);
|
||||||
}
|
}
|
||||||
@ -58,7 +84,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#pragma warning disable IDE0060 // Remove unused parameter
|
#pragma warning disable IDE0060 // Remove unused parameter
|
||||||
protected void SendEmail(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body) {
|
protected void SendEmail(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -77,7 +103,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
msg.Body = email_body;
|
msg.Body = email_body;
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//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");
|
SmtpClient SmtpMail = new("mailrelay-internal.infineon.com");
|
||||||
|
|
||||||
// sending the message.
|
// sending the message.
|
||||||
try {
|
try {
|
||||||
@ -89,19 +115,9 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#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) {
|
protected void SendEmailWithAttachment(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body, string attachmentPath) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -120,26 +136,17 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
msg.Attachments.Add(new Attachment(attachmentPath));
|
msg.Attachments.Add(new Attachment(attachmentPath));
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||||
SmtpClient SmtpMail = new SmtpClient();
|
SmtpClient SmtpMail = new();
|
||||||
#if(!DEBUG)
|
#if(!DEBUG)
|
||||||
// sending the message.
|
// sending the message.
|
||||||
SmtpMail.Send(msg);
|
SmtpMail.Send(msg);
|
||||||
#endif
|
#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
|
#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) {
|
protected void SendEmail(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -159,7 +166,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
msg.Body = email_body;
|
msg.Body = email_body;
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||||
SmtpClient SmtpMail = new SmtpClient();
|
SmtpClient SmtpMail = new();
|
||||||
|
|
||||||
// sending the message.
|
// sending the message.
|
||||||
try {
|
try {
|
||||||
@ -171,19 +178,9 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
#pragma warning restore IDE0060 // Remove unused parameter
|
#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) {
|
protected void SendEmailWithAttachment(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body, string attachmentPath) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -205,25 +202,15 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
msg.Attachments.Add(new Attachment(attachmentPath));
|
msg.Attachments.Add(new Attachment(attachmentPath));
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||||
SmtpClient SmtpMail = new SmtpClient();
|
SmtpClient SmtpMail = new();
|
||||||
|
|
||||||
// sending the message.
|
// sending the message.
|
||||||
SmtpMail.Send(msg);
|
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) {
|
protected void SendEmailWithAttachments(string SenderEmail, string SenderName, string Recep, string cc, string email_title, string email_body, List<string> attachments) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -244,26 +231,16 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||||
SmtpClient SmtpMail = new SmtpClient();
|
SmtpClient SmtpMail = new();
|
||||||
#if(!DEBUG)
|
#if(!DEBUG)
|
||||||
// sending the message.
|
// sending the message.
|
||||||
SmtpMail.Send(msg);
|
SmtpMail.Send(msg);
|
||||||
#endif
|
#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) {
|
protected void SendEmailWithAttachments(string SenderEmail, string SenderName, List<string> RecepientList, string cc, string email_title, string email_body, List<string> attachments) {
|
||||||
// creating email message
|
// creating email message
|
||||||
MailMessage msg = new MailMessage();
|
MailMessage msg = new();
|
||||||
msg.IsBodyHtml = true;// email body will allow html elements
|
msg.IsBodyHtml = true;// email body will allow html elements
|
||||||
|
|
||||||
// setting the Sender Email ID
|
// setting the Sender Email ID
|
||||||
@ -288,27 +265,12 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
//create a Smtp Mail which will automatically get the smtp server details from web.config mailSettings section
|
||||||
SmtpClient SmtpMail = new SmtpClient();
|
SmtpClient SmtpMail = new();
|
||||||
|
|
||||||
// sending the message.
|
// sending the message.
|
||||||
SmtpMail.Send(msg);
|
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>
|
/// <summary>
|
||||||
/// This function will send the email notification by reading the email template and substitute the arguments
|
/// This function will send the email notification by reading the email template and substitute the arguments
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -341,7 +303,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -350,15 +312,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This function will send the email notification by reading the email template and substitute the arguments along with the attachments
|
/// This function will send the email notification by reading the email template and substitute the arguments along with the attachments
|
||||||
/// </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, string RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
|
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, string RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
|
||||||
string retVal = null;
|
string retVal = null;
|
||||||
|
|
||||||
@ -380,24 +334,12 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
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) {
|
public string SendNotificationEmailWithAttachment(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, string attachmentPath, params string[] Args) {
|
||||||
string retVal = null;
|
string retVal = null;
|
||||||
|
|
||||||
@ -424,7 +366,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
return retVal;
|
||||||
@ -451,24 +393,12 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
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) {
|
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;
|
string retVal = null;
|
||||||
|
|
||||||
@ -495,23 +425,12 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
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) {
|
public string SendNotificationEmail(string EmailTemplateFile, string SenderEmail, string SenderName, List<string> RecepientEmail, string CC, string Subject, params string[] Args) {
|
||||||
string retVal = null;
|
string retVal = null;
|
||||||
|
|
||||||
@ -537,27 +456,20 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
return retVal;
|
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) {
|
public void SendNotificationEmailToAdmin(string subject, string body, MailPriority importance) {
|
||||||
try {
|
try {
|
||||||
System.Configuration.ConfigurationManager.RefreshSection("appSettings");
|
SmtpClient client = new(_AppSettings.SMTPServer);
|
||||||
|
MailMessage msg = new();
|
||||||
|
|
||||||
SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["SMTP Server"]);
|
string toList = _AppSettings.AdminNotificationRecepient;
|
||||||
MailMessage msg = new MailMessage();
|
msg.From = new MailAddress(_AppSettings.NotificationSender);
|
||||||
|
|
||||||
string toList = ConfigurationManager.AppSettings["Admin Notification Recepient"];
|
|
||||||
msg.From = new MailAddress(ConfigurationManager.AppSettings["Notification Sender"]); ;
|
|
||||||
string[] recipients = toList.Split(',');
|
string[] recipients = toList.Split(',');
|
||||||
foreach (string recipient in recipients)
|
foreach (string recipient in recipients)
|
||||||
msg.To.Add(new MailAddress(recipient.Trim()));
|
msg.To.Add(new MailAddress(recipient.Trim()));
|
||||||
@ -572,16 +484,16 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
client.Send(msg);
|
client.Send(msg);
|
||||||
//#endif
|
//#endif
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> GetTestRecipientsList() {
|
public List<string> GetTestRecipientsList() {
|
||||||
List<string> r = new List<string>();
|
List<string> r = new();
|
||||||
try {
|
try {
|
||||||
string emails = ConfigurationManager.AppSettings["Test Email Recipients"];
|
string emails = _AppSettings.TestEmailRecipients;
|
||||||
foreach (string s in emails.Split(';', ',')) {
|
foreach (string s in emails.Split(';', ',')) {
|
||||||
if (!String.IsNullOrWhiteSpace(s))
|
if (!string.IsNullOrWhiteSpace(s))
|
||||||
r.Add(s);
|
r.Add(s);
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
@ -590,4 +502,3 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
using Excel;
|
#if !NET8
|
||||||
|
|
||||||
|
using Excel;
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@ -6,18 +9,15 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
namespace Fab2ApprovalSystem.Misc {
|
||||||
{
|
|
||||||
public class ExcelData
|
public class ExcelData {
|
||||||
{
|
|
||||||
string _path;
|
string _path;
|
||||||
public ExcelData(string path)
|
public ExcelData(string path) {
|
||||||
{
|
|
||||||
_path = path;
|
_path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IExcelDataReader getExcelReader()
|
public IExcelDataReader getExcelReader() {
|
||||||
{
|
|
||||||
// ExcelDataReader works with the binary Excel file, so it needs a FileStream
|
// 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:
|
// to get started. This is how we avoid dependencies on ACE or Interop:
|
||||||
|
|
||||||
@ -25,27 +25,21 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
// We return the interface, so that
|
// We return the interface, so that
|
||||||
IExcelDataReader reader = null;
|
IExcelDataReader reader = null;
|
||||||
|
|
||||||
try
|
try {
|
||||||
{
|
if (_path.EndsWith(".xls")) {
|
||||||
if (_path.EndsWith(".xls"))
|
|
||||||
{
|
|
||||||
reader = ExcelReaderFactory.CreateBinaryReader(stream);
|
reader = ExcelReaderFactory.CreateBinaryReader(stream);
|
||||||
}
|
}
|
||||||
if (_path.EndsWith(".xlsx"))
|
if (_path.EndsWith(".xlsx")) {
|
||||||
{
|
|
||||||
reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
|
reader = ExcelReaderFactory.CreateOpenXmlReader(stream);
|
||||||
}
|
}
|
||||||
return reader;
|
return reader;
|
||||||
}
|
} catch (Exception) {
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExcelLotInfo
|
public class ExcelLotInfo {
|
||||||
{
|
|
||||||
public string LotNo { get; set; }
|
public string LotNo { get; set; }
|
||||||
public string LotDispo { get; set; }
|
public string LotDispo { get; set; }
|
||||||
}
|
}
|
||||||
@ -54,29 +48,23 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IEnumerable<ExcelLotInfo> ReadData()
|
public IEnumerable<ExcelLotInfo> ReadData() {
|
||||||
{
|
|
||||||
var r = new List<ExcelLotInfo>();
|
var r = new List<ExcelLotInfo>();
|
||||||
var excelData = new ExcelData(_path);
|
var excelData = new ExcelData(_path);
|
||||||
var lots = excelData.getData().ToList();
|
var lots = excelData.getData().ToList();
|
||||||
|
|
||||||
int lotDispoColumnIndex = -1;
|
int lotDispoColumnIndex = -1;
|
||||||
foreach (DataColumn col in lots[0].Table.Columns)
|
foreach (DataColumn col in lots[0].Table.Columns) {
|
||||||
{
|
if (col.ColumnName.ToLower().Contains("dispo")) {
|
||||||
if (col.ColumnName.ToLower().Contains("dispo"))
|
|
||||||
{
|
|
||||||
lotDispoColumnIndex = col.Ordinal;
|
lotDispoColumnIndex = col.Ordinal;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var row in lots)
|
foreach (var row in lots) {
|
||||||
{
|
|
||||||
string temValue = row[0].ToString();
|
string temValue = row[0].ToString();
|
||||||
if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10 )
|
if (temValue.Trim().Length > 0 && temValue.Trim().Length <= 10) {
|
||||||
{
|
r.Add(new ExcelLotInfo() {
|
||||||
r.Add(new ExcelLotInfo()
|
|
||||||
{
|
|
||||||
LotNo = row[0].ToString(),
|
LotNo = row[0].ToString(),
|
||||||
LotDispo = (lotDispoColumnIndex >= 0 ? row[lotDispoColumnIndex].ToString() : "")
|
LotDispo = (lotDispoColumnIndex >= 0 ? row[lotDispoColumnIndex].ToString() : "")
|
||||||
});
|
});
|
||||||
@ -86,25 +74,18 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> ReadQDBFlagData() {
|
||||||
public IEnumerable<string> ReadQDBFlagData()
|
|
||||||
{
|
|
||||||
List<string> s = new List<string>();
|
List<string> s = new List<string>();
|
||||||
// We return the interface, so that
|
// We return the interface, so that
|
||||||
var excelData = new ExcelData(_path);
|
var excelData = new ExcelData(_path);
|
||||||
//var albums = excelData.getData("Sheet1");
|
//var albums = excelData.getData("Sheet1");
|
||||||
var lotNos = excelData.getData();
|
var lotNos = excelData.getData();
|
||||||
foreach (var row in lotNos)
|
foreach (var row in lotNos) {
|
||||||
{
|
|
||||||
string temValue = row[0].ToString();
|
string temValue = row[0].ToString();
|
||||||
if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9)
|
if (temValue.Trim().Length > 0 && temValue.Trim().Length == 9) {
|
||||||
{
|
if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO") {
|
||||||
if (row[2].ToString().ToUpper() != "YES" && row[2].ToString().ToUpper() != "NO")
|
|
||||||
{
|
|
||||||
throw new Exception("Invalid data in the file");
|
throw new Exception("Invalid data in the file");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
s.Add(row[0].ToString() + "~" + row[1] + "~" + row[2]);
|
s.Add(row[0].ToString() + "~" + row[1] + "~" + row[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,23 +94,12 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
//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;
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="firstRowIsColumnNames"></param>
|
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true)
|
public IEnumerable<DataRow> getData(bool firstRowIsColumnNames = true) {
|
||||||
{
|
|
||||||
var reader = this.getExcelReader();
|
var reader = this.getExcelReader();
|
||||||
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
|
reader.IsFirstRowAsColumnNames = firstRowIsColumnNames;
|
||||||
var workSheet = reader.AsDataSet().Tables[0];
|
var workSheet = reader.AsDataSet().Tables[0];
|
||||||
@ -138,7 +108,7 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,59 +1,48 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
using Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void FTPToSPN()
|
public void FTPToSPN() {
|
||||||
{
|
FTP ftpLib = new();
|
||||||
FTP ftpLib = new FTP();
|
|
||||||
|
|
||||||
//Connect to the FTP server
|
//Connect to the FTP server
|
||||||
try
|
try {
|
||||||
{
|
ftpLib.Connect(_AppSettings.FTPServer, _AppSettings.FTPUser, _AppSettings.FTPPassword);
|
||||||
ftpLib.Connect(Functions.FTPServer(), Functions.FTPUser(), Functions.FTPPassword());
|
} catch (Exception ec) {
|
||||||
}
|
Functions.WriteEvent(_AppSettings, "Listener - ProcessFile(): FTP Connection Error " + _OutputFile + " - " + ec.Source +
|
||||||
catch (Exception ec)
|
|
||||||
{
|
|
||||||
Functions.WriteEvent("Listener - ProcessFile(): FTP Connection Error " + m_OutputFile + " - " + ec.Source +
|
|
||||||
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
|
": " + ec.Message, System.Diagnostics.EventLogEntryType.Error);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Upload the file
|
//Upload the file
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
int pct = 0;
|
int pct = 0;
|
||||||
ftpLib.OpenUpload(m_OutputFile, m_DestinationFileName);
|
ftpLib.OpenUpload(_OutputFile, _DestinationFileName);
|
||||||
while (ftpLib.DoUpload() > 0)
|
while (ftpLib.DoUpload() > 0)
|
||||||
pct = (int)((ftpLib.BytesTotal * 100) / ftpLib.FileSize);
|
pct = (int)((ftpLib.BytesTotal * 100) / ftpLib.FileSize);
|
||||||
Functions.WriteEvent(m_OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
|
Functions.WriteEvent(_AppSettings, _OutputFile + " was sucessfully FTPed to SPN.", System.Diagnostics.EventLogEntryType.Information);
|
||||||
}
|
} catch (Exception eu) {
|
||||||
catch (Exception eu)
|
Functions.WriteEvent(_AppSettings, "MRB - FTPToSPN(): FTP Upload Error " + _OutputFile + " - " + eu.Source +
|
||||||
{
|
|
||||||
Functions.WriteEvent("MRB - FTPToSPN(): FTP Upload Error " + m_OutputFile + " - " + eu.Source +
|
|
||||||
": " + eu.Message, System.Diagnostics.EventLogEntryType.Error);
|
": " + eu.Message, System.Diagnostics.EventLogEntryType.Error);
|
||||||
throw new Exception(eu.Source + ": " + eu.Message);
|
throw new Exception(eu.Source + ": " + eu.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,26 +1,38 @@
|
|||||||
|
#pragma warning disable CS8019
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
using System.Web.Security;
|
using System.Web.Security;
|
||||||
|
#endif
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Mail;
|
using System.Net.Mail;
|
||||||
using System.DirectoryServices;
|
using System.DirectoryServices;
|
||||||
using System.DirectoryServices.AccountManagement;
|
using System.DirectoryServices.AccountManagement;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc {
|
#pragma warning restore CS8019
|
||||||
|
|
||||||
|
using Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
|
|
||||||
public static class Functions {
|
public static class Functions {
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes to the Application Event Log and sends an email notification if appropriate
|
/// Writes to the Application Event Log and sends an email notification if appropriate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="logtext"></param>
|
|
||||||
/// <param name="eventType"></param>
|
public static void WriteEvent(AppSettings? appSettings, string logtext, EventLogEntryType eventType) {
|
||||||
public static void WriteEvent(string logtext, System.Diagnostics.EventLogEntryType eventType) {
|
|
||||||
//#if(!DEBUG)
|
//#if(!DEBUG)
|
||||||
EmailNotification en = new EmailNotification();
|
#if !NET8
|
||||||
EventLog ev = new EventLog("Application");
|
EmailNotification? en = appSettings is null ? null : new EmailNotification(appSettings);
|
||||||
|
#endif
|
||||||
|
EventLog ev = new("Application");
|
||||||
ev.Source = "Fab Approval System";
|
ev.Source = "Fab Approval System";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -31,8 +43,10 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
////Don't attempt to send an email if the error is pertaining to an email problem
|
////Don't attempt to send an email if the error is pertaining to an email problem
|
||||||
if (!logtext.Contains("SendEmailNotification()")) {
|
if (!logtext.Contains("SendEmailNotification()")) {
|
||||||
//Only send email notifications for Error and Warning level events
|
//Only send email notifications for Error and Warning level events
|
||||||
if (eventType == System.Diagnostics.EventLogEntryType.Error)
|
#if !NET8
|
||||||
|
if (appSettings is not null && eventType == System.Diagnostics.EventLogEntryType.Error)
|
||||||
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
|
en.SendNotificationEmailToAdmin(ev.Source + " - Error Notification", logtext, MailPriority.High);
|
||||||
|
#endif
|
||||||
//else if (eventType == System.Diagnostics.EventLogEntryType.Warning)
|
//else if (eventType == System.Diagnostics.EventLogEntryType.Warning)
|
||||||
// SendEmailNotification(ErrorRecipient(), ev.Source + " Warning Event Logged", logtext, NORMAL_PRI);
|
// SendEmailNotification(ErrorRecipient(), ev.Source + " Warning Event Logged", logtext, NORMAL_PRI);
|
||||||
}
|
}
|
||||||
@ -43,53 +57,12 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static void CopyAttachments(AppSettings appSettings, int oldECNNumber, int newECNNumber) {
|
||||||
/// Returns the FTP Server Name
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string FTPServer() {
|
|
||||||
ConfigurationManager.RefreshSection("appSettings");
|
|
||||||
return ConfigurationManager.AppSettings["FTP Server"];
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <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"
|
// The Name of the Upload component is "files"
|
||||||
string oldFolderPath = Functions.GetAttachmentFolder() + "ECN\\" + oldECNNumber.ToString();
|
string oldFolderPath = appSettings.AttachmentFolder + "ECN\\" + oldECNNumber.ToString();
|
||||||
string newFolderPath = Functions.GetAttachmentFolder() + "ECN\\" + newECNNumber.ToString();
|
string newFolderPath = appSettings.AttachmentFolder + "ECN\\" + newECNNumber.ToString();
|
||||||
|
|
||||||
DirectoryInfo newdi = new DirectoryInfo(newFolderPath);
|
DirectoryInfo newdi = new(newFolderPath);
|
||||||
|
|
||||||
if (!newdi.Exists)
|
if (!newdi.Exists)
|
||||||
newdi.Create();
|
newdi.Create();
|
||||||
@ -102,18 +75,11 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static bool NA_ADAuthenticate(AppSettings appSettings, string userID, string pwd) {
|
||||||
///
|
string naContainer = appSettings.NAContainer;
|
||||||
/// </summary>
|
string naDomain = appSettings.NADomain;
|
||||||
/// <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 {
|
try {
|
||||||
PrincipalContext contextUser = new PrincipalContext(ContextType.Domain,
|
PrincipalContext contextUser = new(ContextType.Domain,
|
||||||
naDomain,
|
naDomain,
|
||||||
naContainer,
|
naContainer,
|
||||||
ContextOptions.Negotiate, userID, pwd);
|
ContextOptions.Negotiate, userID, pwd);
|
||||||
@ -128,18 +94,11 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public static bool IFX_ADAuthenticate(AppSettings appSettings, string userID, string pwd) {
|
||||||
///
|
string container = appSettings.IFXContainer;
|
||||||
/// </summary>
|
string domain = appSettings.IFXDomain;
|
||||||
/// <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 {
|
try {
|
||||||
PrincipalContext contextUser = new PrincipalContext(ContextType.Domain,
|
PrincipalContext contextUser = new(ContextType.Domain,
|
||||||
domain,
|
domain,
|
||||||
container,
|
container,
|
||||||
ContextOptions.Negotiate, userID, pwd);
|
ContextOptions.Negotiate, userID, pwd);
|
||||||
@ -154,25 +113,6 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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) {
|
public static string CASectionMapper(GlobalVars.CASection casection) {
|
||||||
switch (casection) {
|
switch (casection) {
|
||||||
case GlobalVars.CASection.Main:
|
case GlobalVars.CASection.Main:
|
||||||
@ -234,8 +174,7 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts the CA No to the C00000 format
|
/// Converts the CA No to the C00000 format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="caNo"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static string ReturnCANoStringFormat(int caNo) {
|
public static string ReturnCANoStringFormat(int caNo) {
|
||||||
string caNoString = "";
|
string caNoString = "";
|
||||||
if (caNo == 0)
|
if (caNo == 0)
|
||||||
@ -255,7 +194,6 @@ namespace Fab2ApprovalSystem.Misc {
|
|||||||
public static string ReturnPartsRequestNoStringFormat(int PRNumber) {
|
public static string ReturnPartsRequestNoStringFormat(int PRNumber) {
|
||||||
if (PRNumber == 0)
|
if (PRNumber == 0)
|
||||||
return "";
|
return "";
|
||||||
return String.Format("PR{0:000000}", PRNumber);
|
return string.Format("PR{0:000000}", PRNumber);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,14 +1,16 @@
|
|||||||
using System;
|
using Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
{
|
|
||||||
public class GlobalVars
|
#if !NET8
|
||||||
{
|
public class GlobalVars {
|
||||||
|
|
||||||
public int USER_ID;
|
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 SESSION_USERNAME = "UserName";
|
||||||
public const string ApplicationName = "LotDisposition";
|
public const string ApplicationName = "LotDisposition";
|
||||||
public const string SESSION_USERID = "UserID";
|
public const string SESSION_USERID = "UserID";
|
||||||
@ -18,6 +20,10 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
public const string OOO = "OOO";
|
public const string OOO = "OOO";
|
||||||
public const string SUCCESS = "Success";
|
public const string SUCCESS = "Success";
|
||||||
public const string CAN_CREATE_PARTS_REQUEST = "CanCreatePartsRequest";
|
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 USER_ISADMIN = false;
|
||||||
public static bool IS_INFINEON_DOMAIN = false;
|
public static bool IS_INFINEON_DOMAIN = false;
|
||||||
@ -29,23 +35,10 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
public static string NDriveURL = "";
|
public static string NDriveURL = "";
|
||||||
public static string WSR_URL = "";
|
public static string WSR_URL = "";
|
||||||
public static string CA_BlankFormsLocation = "";
|
public static string CA_BlankFormsLocation = "";
|
||||||
|
public static string SENDER_EMAIL = "MesaFabApproval@infineon.com";
|
||||||
public static string MesaTemplateFiles = "D:\\WebSites\\FabApprovalAttachments\\Template5Why";
|
public static string MesaTemplateFiles = "D:\\WebSites\\FabApprovalAttachments\\Template5Why";
|
||||||
|
|
||||||
//public static string DevWebSiteUrl = "";
|
public enum LotStatusOption {
|
||||||
//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,
|
Release = 1,
|
||||||
Scrap,
|
Scrap,
|
||||||
NotAvailable,
|
NotAvailable,
|
||||||
@ -56,9 +49,7 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum ApprovalOption {
|
||||||
public enum ApprovalOption
|
|
||||||
{
|
|
||||||
Pending = 0,
|
Pending = 0,
|
||||||
Approved = 1,
|
Approved = 1,
|
||||||
Denied = 2,
|
Denied = 2,
|
||||||
@ -71,15 +62,13 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum WorkFLowStepNumber
|
public enum WorkFLowStepNumber {
|
||||||
{
|
|
||||||
Step1 = 1,
|
Step1 = 1,
|
||||||
Step2,
|
Step2,
|
||||||
Step3
|
Step3
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum DocumentType
|
public enum DocumentType {
|
||||||
{
|
|
||||||
LotDisposition = 1,
|
LotDisposition = 1,
|
||||||
MRB = 2,
|
MRB = 2,
|
||||||
ECN = 3,
|
ECN = 3,
|
||||||
@ -93,26 +82,20 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
CorrectiveActionSection = 12
|
CorrectiveActionSection = 12
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum TECNExpirationCancellation
|
public enum TECNExpirationCancellation {
|
||||||
{
|
|
||||||
Cancellation = 1,
|
Cancellation = 1,
|
||||||
Expiration = 2
|
Expiration = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum Colors { None = 0, Red = 1, Green = 2, Blue = 4 };
|
public enum Colors { None = 0, Red = 1, Green = 2, Blue = 4 };
|
||||||
|
|
||||||
|
public enum NotificationType {
|
||||||
public enum NotificationType
|
|
||||||
{
|
|
||||||
WorkRequest = 1,
|
WorkRequest = 1,
|
||||||
LotTraveler = 2
|
LotTraveler = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum CASection
|
public enum CASection {
|
||||||
{
|
|
||||||
Main, D1, D2, D3, D4, D5, D6, D7, D8, CF
|
Main, D1, D2, D3, D4, D5, D6, D7, D8, CF
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,7 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
public class LotNoTemplate {
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
|
||||||
{
|
|
||||||
public class LotNoTemplate
|
|
||||||
{
|
|
||||||
public string LotNo { get; set; }
|
public string LotNo { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,26 +1,22 @@
|
|||||||
using System;
|
#if !NET8
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Misc {
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
public class SessionExpireFilterAttribute : ActionFilterAttribute {
|
||||||
{
|
public override void OnActionExecuting(ActionExecutingContext filterContext) {
|
||||||
public class SessionExpireFilterAttribute : ActionFilterAttribute
|
|
||||||
{
|
|
||||||
public override void OnActionExecuting(ActionExecutingContext filterContext)
|
|
||||||
{
|
|
||||||
HttpSessionStateBase session = filterContext.HttpContext.Session;
|
HttpSessionStateBase session = filterContext.HttpContext.Session;
|
||||||
HttpContext ctx = HttpContext.Current;
|
HttpContext ctx = HttpContext.Current;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// check if session is supported
|
// 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
|
// check if a new session id was generated
|
||||||
|
|
||||||
// this will force MVC to use the standard login redirect, enabling ReturnURL functionality
|
// this will force MVC to use the standard login redirect, enabling ReturnURL functionality
|
||||||
@ -32,8 +28,9 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
base.OnActionExecuting(filterContext);
|
base.OnActionExecuting(filterContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,27 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
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 class CollectionExtensions {
|
||||||
{
|
|
||||||
public static IEnumerable<T> SetValue<T>(this IEnumerable<T> items, Action<T> updateMethod)
|
public static IEnumerable<T> SetValue<T>(this IEnumerable<T> items, Action<T> updateMethod) {
|
||||||
{
|
foreach (T item in items) {
|
||||||
foreach (T item in items)
|
|
||||||
{
|
|
||||||
updateMethod(item);
|
updateMethod(item);
|
||||||
}
|
}
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,32 +1,22 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using ICSharpCode.SharpZipLib.Core;
|
|
||||||
using ICSharpCode.SharpZipLib.Zip;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
|
using ICSharpCode.SharpZipLib.Core;
|
||||||
|
using ICSharpCode.SharpZipLib.Zip;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Misc
|
namespace Fab2ApprovalSystem.Misc;
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Zipper
|
|
||||||
{
|
|
||||||
|
|
||||||
|
public class Zipper {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
|
/// Compresses the files in the nominated folder, and creates a zip file on disk named as outPathname.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="outPathname"></param>
|
|
||||||
/// <param name="folderName"></param>
|
|
||||||
public void CreateZip(string outPathname, string folderName) {
|
public void CreateZip(string outPathname, string folderName) {
|
||||||
// TODO Try and Catch block
|
// TODO Try and Catch block
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(outPathname));
|
Directory.CreateDirectory(Path.GetDirectoryName(outPathname));
|
||||||
|
|
||||||
FileStream fsOut = File.Create(outPathname);
|
FileStream fsOut = File.Create(outPathname);
|
||||||
ZipOutputStream zipStream = new ZipOutputStream(fsOut);
|
ZipOutputStream zipStream = new(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
|
||||||
|
|
||||||
@ -46,22 +36,17 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Recurses down the folder structure
|
/// Recurses down the folder structure
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <param name="zipStream"></param>
|
private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset) {
|
||||||
/// <param name="folderOffset"></param>
|
|
||||||
private void CompressFolder(string path, ZipOutputStream zipStream, int folderOffset)
|
|
||||||
{
|
|
||||||
// TODO Try and Catch block
|
// TODO Try and Catch block
|
||||||
string[] files = Directory.GetFiles(path);
|
string[] files = Directory.GetFiles(path);
|
||||||
|
|
||||||
foreach (string filename in files)
|
foreach (string filename in files) {
|
||||||
{
|
FileInfo fi = new(filename);
|
||||||
|
|
||||||
FileInfo fi = new FileInfo(filename);
|
|
||||||
|
|
||||||
string entryName = filename.Substring(folderOffset); // Makes the name in zip based on the folder
|
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
|
entryName = ZipEntry.CleanName(entryName); // Removes drive from name and fixes slash direction
|
||||||
ZipEntry newEntry = new ZipEntry(entryName);
|
ZipEntry newEntry = new(entryName);
|
||||||
newEntry.DateTime = fi.LastWriteTime; // Note the zip format stores 2 second granularity
|
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.
|
// Specifying the AESKeySize triggers AES encryption. Allowable values are 0 (off), 128 or 256.
|
||||||
@ -80,20 +65,15 @@ namespace Fab2ApprovalSystem.Misc
|
|||||||
// Zip the file in buffered chunks
|
// Zip the file in buffered chunks
|
||||||
// the "using" will close the stream even if an exception occurs
|
// the "using" will close the stream even if an exception occurs
|
||||||
byte[] buffer = new byte[4096];
|
byte[] buffer = new byte[4096];
|
||||||
using (FileStream streamReader = File.OpenRead(filename))
|
using (FileStream streamReader = File.OpenRead(filename)) {
|
||||||
{
|
|
||||||
StreamUtils.Copy(streamReader, zipStream, buffer);
|
StreamUtils.Copy(streamReader, zipStream, buffer);
|
||||||
}
|
}
|
||||||
zipStream.CloseEntry();
|
zipStream.CloseEntry();
|
||||||
}
|
}
|
||||||
string[] folders = Directory.GetDirectories(path);
|
string[] folders = Directory.GetDirectories(path);
|
||||||
foreach (string folder in folders)
|
foreach (string folder in folders) {
|
||||||
{
|
|
||||||
CompressFolder(folder, zipStream, folderOffset);
|
CompressFolder(folder, zipStream, folderOffset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
File diff suppressed because it is too large
Load Diff
@ -1,10 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class LoginModel
|
public class LoginModel {
|
||||||
{
|
|
||||||
[Key]
|
[Key]
|
||||||
public int UserID { get; set; }
|
public int UserID { get; set; }
|
||||||
|
|
||||||
@ -16,103 +15,34 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
[DataType(DataType.Password)]
|
[DataType(DataType.Password)]
|
||||||
[Display(Name = "Password")]
|
[Display(Name = "Password")]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
|
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
|
|
||||||
public bool IsAdmin { get; set; }
|
public bool IsAdmin { get; set; }
|
||||||
public bool IsManager { get; set; }
|
public bool IsManager { get; set; }
|
||||||
public bool IsActive { get; set; }
|
public bool IsActive { get; set; }
|
||||||
public DateTime? LastLogin { get; set; }
|
public DateTime? LastLogin { get; set; }
|
||||||
|
|
||||||
public bool OOO { get; set; }
|
public bool OOO { get; set; }
|
||||||
|
|
||||||
public DateTime? OOOStartDate { get; set; }
|
public DateTime? OOOStartDate { get; set; }
|
||||||
public DateTime? OOOExpirationDate { get; set; }
|
public DateTime? OOOExpirationDate { get; set; }
|
||||||
|
|
||||||
public int DelegatedTo { get; set; }
|
public int DelegatedTo { get; set; }
|
||||||
|
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Delegated To")]
|
[Display(Name = "Delegated To")]
|
||||||
public string DelegatedToFullName { get; set; }
|
public string DelegatedToFullName { get; set; }
|
||||||
|
|
||||||
[Display(Name = "OOO Action")]
|
[Display(Name = "OOO Action")]
|
||||||
public virtual string OOOStatusWithUserID
|
public virtual string OOOStatusWithUserID {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return UserID.ToString() + "~" + (OOO ? "1" : "0") + "~" + FullName;
|
return UserID.ToString() + "~" + (OOO ? "1" : "0") + "~" + FullName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class UserProfile
|
public class UserProfile {
|
||||||
{
|
|
||||||
public int UserId { get; set; }
|
public int UserId { get; set; }
|
||||||
public string FullName { 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; }
|
|
||||||
//}
|
|
||||||
}
|
}
|
@ -1,73 +1,42 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
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 int RoleID { get; set; }
|
||||||
public string RoleName { get; set; }
|
public string RoleName { get; set; }
|
||||||
public List<SubRole> SubRoles { 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 WorkFlowSteps {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SubRole {
|
||||||
|
|
||||||
|
|
||||||
public class SubRole
|
|
||||||
{
|
|
||||||
public int SubRoleID { get; set; }
|
public int SubRoleID { get; set; }
|
||||||
public string SubRoleCategoryItem { get; set; }
|
public string SubRoleCategoryItem { get; set; }
|
||||||
public int RoleID { get; set; }
|
public int RoleID { get; set; }
|
||||||
public bool Inactive { get; set; }
|
public bool Inactive { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class UserSubRole
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ParentChildModel
|
public class UserSubRole {
|
||||||
{
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ParentChildModel {
|
||||||
|
|
||||||
public int id { get; set; }
|
public int id { get; set; }
|
||||||
public int parentid { get; set; }
|
public int parentid { get; set; }
|
||||||
public string text { get; set; }
|
public string text { get; set; }
|
||||||
public string value { 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; }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
public class AllUserModel {
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
|
||||||
{
|
|
||||||
public class AllUserModel
|
|
||||||
{
|
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string FirstName { get; set; }
|
public string FirstName { get; set; }
|
||||||
public string LastName { get; set; }
|
public string LastName { get; set; }
|
||||||
public string Email { get; set; }
|
public string Email { get; set; }
|
||||||
public string DisplayName { get; set; }
|
public string DisplayName { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
189
Fab2ApprovalSystem/Models/AppSettings.cs
Normal file
189
Fab2ApprovalSystem/Models/AppSettings.cs
Normal file
@ -0,0 +1,189 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
|
public class AppSettings {
|
||||||
|
|
||||||
|
internal AppSettings(string adminNotificationRecepient,
|
||||||
|
string? apiBaseUrl,
|
||||||
|
string attachmentFolder,
|
||||||
|
string? attachmentUrl,
|
||||||
|
string caBlankFormsLocation,
|
||||||
|
string? company,
|
||||||
|
string dBConnection,
|
||||||
|
string dbConnectionString,
|
||||||
|
string ftpPassword,
|
||||||
|
string ftpServer,
|
||||||
|
string ftpUser,
|
||||||
|
string holdFlagDirectory,
|
||||||
|
string hostURL,
|
||||||
|
string ifxContainer,
|
||||||
|
string ifxDomain,
|
||||||
|
bool isInfineonDomain,
|
||||||
|
string lotTempPipeLine,
|
||||||
|
string mesaTemplateFiles,
|
||||||
|
string naContainer,
|
||||||
|
string naDomain,
|
||||||
|
string nDriveURL,
|
||||||
|
string notificationSender,
|
||||||
|
string senderEmail,
|
||||||
|
string? smtpServer,
|
||||||
|
string spnMRBHoldFlagFTPLogDirectory,
|
||||||
|
string testEmailRecipients,
|
||||||
|
string urls,
|
||||||
|
int userId,
|
||||||
|
bool userIsAdmin,
|
||||||
|
string wsrURL,
|
||||||
|
string? workingDirectoryName) {
|
||||||
|
AdminNotificationRecepient = adminNotificationRecepient;
|
||||||
|
ApiBaseUrl = apiBaseUrl;
|
||||||
|
AttachmentFolder = attachmentFolder;
|
||||||
|
AttachmentUrl = attachmentUrl;
|
||||||
|
CABlankFormsLocation = caBlankFormsLocation;
|
||||||
|
Company = company;
|
||||||
|
DBConnection = dBConnection;
|
||||||
|
DBConnectionString = dbConnectionString;
|
||||||
|
FTPPassword = ftpPassword;
|
||||||
|
FTPServer = ftpServer;
|
||||||
|
FTPUser = ftpUser;
|
||||||
|
HoldFlagDirectory = holdFlagDirectory;
|
||||||
|
HostURL = hostURL;
|
||||||
|
IFXContainer = ifxContainer;
|
||||||
|
IFXDomain = ifxDomain;
|
||||||
|
IsInfineonDomain = isInfineonDomain;
|
||||||
|
LotTempPipeLine = lotTempPipeLine;
|
||||||
|
MesaTemplateFiles = mesaTemplateFiles;
|
||||||
|
NAContainer = naContainer;
|
||||||
|
NADomain = naDomain;
|
||||||
|
NDriveURL = nDriveURL;
|
||||||
|
NotificationSender = notificationSender;
|
||||||
|
SenderEmail = senderEmail;
|
||||||
|
SMTPServer = smtpServer;
|
||||||
|
SPNMRBHoldFlagFTPLogDirectory = spnMRBHoldFlagFTPLogDirectory;
|
||||||
|
TestEmailRecipients = testEmailRecipients;
|
||||||
|
URLs = urls;
|
||||||
|
UserId = userId;
|
||||||
|
UserIsAdmin = userIsAdmin;
|
||||||
|
WSR_URL = wsrURL;
|
||||||
|
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 FTPPassword { 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 SPNMRBHoldFlagFTPLogDirectory { get; }
|
||||||
|
public string TestEmailRecipients { get; }
|
||||||
|
public string URLs { get; }
|
||||||
|
public int UserId { get; }
|
||||||
|
public bool UserIsAdmin { 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;
|
||||||
|
int userId = 0;
|
||||||
|
string adminNotificationRecepient = ConfigurationManager.ConnectionStrings["Admin Notification Recepient"].ToString();
|
||||||
|
string attachmentFolder = ConfigurationManager.ConnectionStrings["AttachmentFolder"].ToString();
|
||||||
|
string ftpPassword = ConfigurationManager.ConnectionStrings["FTP Password"].ToString();
|
||||||
|
string ftpServer = ConfigurationManager.ConnectionStrings["FTP Server"].ToString();
|
||||||
|
string ftpUser = ConfigurationManager.ConnectionStrings["FTP User"].ToString();
|
||||||
|
string holdFlagDirectory = ConfigurationManager.ConnectionStrings["HoldFlagDirectory"].ToString();
|
||||||
|
string ifxContainer = ConfigurationManager.ConnectionStrings["IFXContainer"].ToString();
|
||||||
|
string ifxDomain = ConfigurationManager.ConnectionStrings["IFXDomain"].ToString();
|
||||||
|
string lotTempPipeLine = ConfigurationManager.ConnectionStrings["LotTempPipeLine"].ToString();
|
||||||
|
string naContainer = ConfigurationManager.ConnectionStrings["NAContainer"].ToString();
|
||||||
|
string naDomain = ConfigurationManager.ConnectionStrings["NADomain"].ToString();
|
||||||
|
string notificationSender = ConfigurationManager.ConnectionStrings["Notification Sender"].ToString();
|
||||||
|
string spnMRBHoldFlagFTPLogDirectory = ConfigurationManager.ConnectionStrings["SPNMRBHoldFlagFTPLogDirectory"].ToString();
|
||||||
|
string testEmailRecipients = ConfigurationManager.ConnectionStrings["Test Email Recipients"].ToString();
|
||||||
|
string? apiBaseUrl = ConfigurationManager.ConnectionStrings["FabApprovalApiBaseUrl"]?.ToString();
|
||||||
|
string? attachmentUrl = ConfigurationManager.ConnectionStrings["AttachmentUrl"]?.ToString();
|
||||||
|
string? company = ConfigurationManager.ConnectionStrings["Company"]?.ToString();
|
||||||
|
string? smtpServer = ConfigurationManager.ConnectionStrings["SMTP Server"]?.ToString();
|
||||||
|
string? urls = ConfigurationManager.ConnectionStrings["URLs"]?.ToString();
|
||||||
|
string? workingDirectoryName = ConfigurationManager.ConnectionStrings["WorkingDirectoryName"]?.ToString();
|
||||||
|
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,
|
||||||
|
ftpPassword: ftpPassword,
|
||||||
|
ftpServer: ftpServer,
|
||||||
|
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,
|
||||||
|
spnMRBHoldFlagFTPLogDirectory: spnMRBHoldFlagFTPLogDirectory,
|
||||||
|
testEmailRecipients: testEmailRecipients,
|
||||||
|
urls: urls,
|
||||||
|
userId: userId,
|
||||||
|
userIsAdmin: Misc.GlobalVars.USER_ISADMIN,
|
||||||
|
wsrURL: Misc.GlobalVars.WSR_URL,
|
||||||
|
workingDirectoryName: workingDirectoryName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,6 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
public class ApprovalLog {
|
||||||
{
|
|
||||||
public class ApprovalLog
|
|
||||||
{
|
|
||||||
|
|
||||||
public int ApprovalLogID;
|
public int ApprovalLogID;
|
||||||
public int IssueID;
|
public int IssueID;
|
||||||
@ -17,4 +11,3 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int DocumentTypeID;
|
public int DocumentTypeID;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,13 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class ApprovalLogHistory
|
public class ApprovalLogHistory {
|
||||||
{
|
|
||||||
public int ApprovalLogID { get; set; }
|
public int ApprovalLogID { get; set; }
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
@ -18,4 +14,3 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class ApproveListModel
|
public class ApproveListModel {
|
||||||
{
|
|
||||||
public int ApprovalKey { get; set; }
|
public int ApprovalKey { get; set; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
public string AssignedName { get; set; }
|
public string AssignedName { get; set; }
|
||||||
@ -19,4 +16,3 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
21
Fab2ApprovalSystem/Models/AuditModels.cs
Normal file
21
Fab2ApprovalSystem/Models/AuditModels.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
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; }
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,9 @@
|
|||||||
namespace Fab2ApprovalSystem.Models {
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
public class AuthAttempt {
|
public class AuthAttempt {
|
||||||
|
|
||||||
public string LoginID { get; set; }
|
public string LoginID { get; set; }
|
||||||
public string Password { get; set; } = "";
|
public string Password { get; set; } = "";
|
||||||
public AuthTokens AuthTokens { get; set; }
|
public AuthTokens AuthTokens { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,6 +1,8 @@
|
|||||||
namespace Fab2ApprovalSystem.Models {
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
public class AuthTokens {
|
public class AuthTokens {
|
||||||
|
|
||||||
public string JwtToken { get; set; }
|
public string JwtToken { get; set; }
|
||||||
public string RefreshToken { get; set; }
|
public string RefreshToken { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
/// <summary>
|
public class CCChangeControl {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCChangeControl
|
|
||||||
{
|
|
||||||
public int PlanNumber { get; set; }
|
public int PlanNumber { get; set; }
|
||||||
public int OwnerID { get; set; }
|
public int OwnerID { get; set; }
|
||||||
public byte CurrentStep { get; set; }
|
public byte CurrentStep { get; set; }
|
||||||
@ -18,7 +13,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
public DateTime? ClosedDate { get; set; }
|
public DateTime? ClosedDate { get; set; }
|
||||||
|
|
||||||
public int ChangeLevel { get; set; }
|
public int ChangeLevel { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public int IsITAR { get; set; }
|
public int IsITAR { get; set; }
|
||||||
@ -42,12 +36,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CCAttachment {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCAttachment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -61,77 +51,56 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CCGeneration {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCGeneration
|
|
||||||
{
|
|
||||||
public int GenerationID { get; set; }
|
public int GenerationID { get; set; }
|
||||||
public string Generation { get; set; }
|
public string Generation { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CCLogistics {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCLogistics
|
|
||||||
{
|
|
||||||
public int LogisticsID { get; set; }
|
public int LogisticsID { get; set; }
|
||||||
public string Logistics { get; set; }
|
public string Logistics { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CCProcess {
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCProcess
|
|
||||||
{
|
|
||||||
public int ProcessID { get; set; }
|
public int ProcessID { get; set; }
|
||||||
public string Process { get; set; }
|
public string Process { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CCPartNumber {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
//public class CCToolType
|
|
||||||
//{
|
|
||||||
// public int ToolTypeID { get; set; }
|
|
||||||
// public string ToolType { get; set; }
|
|
||||||
//}
|
|
||||||
|
|
||||||
public class CCPartNumber
|
|
||||||
{
|
|
||||||
public string PartNumberID { get; set; }
|
public string PartNumberID { get; set; }
|
||||||
public string PartNumber { get; set; }
|
public string PartNumber { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#region Meeting
|
#region Meeting
|
||||||
|
|
||||||
/// <summary>
|
public class CCMeeting {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCMeeting
|
|
||||||
{
|
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public List<string> PCRValueIDs { get; set; }
|
public List<string> PCRValueIDs { get; set; }
|
||||||
public string PCRValueIDsDisplay { get
|
public string PCRValueIDsDisplay {
|
||||||
{
|
get {
|
||||||
if(PCRValueIDs.Count < 1)
|
if (PCRValueIDs.Count < 1) {
|
||||||
{
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return string.Join(",", PCRValueIDs);
|
return string.Join(",", PCRValueIDs);
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int PlanNumber { get; set; }
|
public int PlanNumber { get; set; }
|
||||||
public byte CurrentStep { get; set; }
|
public byte CurrentStep { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public int? ChangeLevel
|
public int? ChangeLevel {
|
||||||
{
|
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string PCRB { get; set; }
|
public string PCRB { get; set; }
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
public DateTime? MeetingDate { get; set; }
|
public DateTime? MeetingDate { get; set; }
|
||||||
@ -150,29 +119,24 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime LastUpdateDate { get; set; }
|
public DateTime LastUpdateDate { get; set; }
|
||||||
public string RecordLockByName { get; set; }
|
public string RecordLockByName { get; set; }
|
||||||
public bool PCRBClosed { get; set; }
|
public bool PCRBClosed { get; set; }
|
||||||
|
public CCMeeting() =>
|
||||||
|
|
||||||
public CCMeeting()
|
|
||||||
{
|
|
||||||
PCRValueIDs = new List<string>();
|
PCRValueIDs = new List<string>();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CCPCRB
|
public class CCPCRB {
|
||||||
{
|
|
||||||
public int PCRBID { get; set; }
|
public int PCRBID { get; set; }
|
||||||
public int PlanNumber { get; set; }
|
public int PlanNumber { get; set; }
|
||||||
public string PCRB { get; set; }
|
public string PCRB { get; set; }
|
||||||
public DateTime Date { get; set; }
|
public DateTime Date { get; set; }
|
||||||
public int Decision { get; set; }
|
public int Decision { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CCMeetingAttendee {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCMeetingAttendee
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string AttendeeName { get; set; }
|
public string AttendeeName { get; set; }
|
||||||
@ -181,8 +145,9 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int AttendeeID { get; set; }
|
public int AttendeeID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class CCPCRBAttendee
|
|
||||||
{
|
public class CCPCRBAttendee {
|
||||||
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int PCRBID { get; set; }
|
public int PCRBID { get; set; }
|
||||||
public string AttendeeName { get; set; }
|
public string AttendeeName { get; set; }
|
||||||
@ -195,8 +160,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// /
|
/// /
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CCMeetingAttachment
|
public class CCMeetingAttachment {
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -205,34 +170,27 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime UploadDateTime { get; set; }
|
public DateTime UploadDateTime { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CCDecisionSummary {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCDecisionSummary
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string DecisionNotes { get; set; }
|
public string DecisionNotes { get; set; }
|
||||||
public string ECNLinks { get; set; }
|
public string ECNLinks { get; set; }
|
||||||
public string LotDispoLinks { get; set; }
|
public string LotDispoLinks { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CCDecisionSummaryLink {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCDecisionSummaryLink
|
|
||||||
{
|
|
||||||
public string Link { get; set; }
|
public string Link { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CCMeetingActionItem {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCMeetingActionItem
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string ActionItemName { get; set; }
|
public string ActionItemName { get; set; }
|
||||||
@ -241,10 +199,10 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? DueDate { get; set; }
|
public DateTime? DueDate { get; set; }
|
||||||
public string ResponsibleID { get; set; }
|
public string ResponsibleID { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class CCPCRBActionItem
|
|
||||||
{
|
public class CCPCRBActionItem {
|
||||||
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int PCRBID { get; set; }
|
public int PCRBID { get; set; }
|
||||||
public string ActionItemName { get; set; }
|
public string ActionItemName { get; set; }
|
||||||
@ -254,11 +212,10 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string ResponsibleID { get; set; }
|
public string ResponsibleID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
public class CCPCRBActionItemAll
|
|
||||||
{
|
public class CCPCRBActionItemAll {
|
||||||
[Key]
|
[Key]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string ActionItemName { get; set; }
|
public string ActionItemName { get; set; }
|
||||||
public string ResponsiblePerson { get; set; }
|
public string ResponsiblePerson { get; set; }
|
||||||
@ -275,18 +232,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string UploadedByName { get; set; }
|
public string UploadedByName { get; set; }
|
||||||
public DateTime UploadDateTime { get; set; }
|
public DateTime UploadDateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CCMeetingActionItemAll {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CCMeetingActionItemAll
|
|
||||||
{
|
|
||||||
[Key]
|
[Key]
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string ActionItemName { get; set; }
|
public string ActionItemName { get; set; }
|
||||||
public string ResponsiblePerson { get; set; }
|
public string ResponsiblePerson { get; set; }
|
||||||
@ -303,53 +253,48 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string UploadedByName { get; set; }
|
public string UploadedByName { get; set; }
|
||||||
public DateTime UploadDateTime { get; set; }
|
public DateTime UploadDateTime { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class MeetingList {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class MeetingList
|
|
||||||
{
|
|
||||||
public int MeetingID { get; set; }
|
public int MeetingID { get; set; }
|
||||||
public string MeetingInfo { get; set; }
|
public string MeetingInfo { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MeetingDecisionSummaryList {
|
||||||
|
|
||||||
public class MeetingDecisionSummaryList
|
|
||||||
{
|
|
||||||
public string PCRB { get; set; }
|
public string PCRB { get; set; }
|
||||||
public DateTime? MeetingDate { get; set; }
|
public DateTime? MeetingDate { get; set; }
|
||||||
public string DecisionNotes { get; set; }
|
public string DecisionNotes { get; set; }
|
||||||
public string ECNLinks { get; set; }
|
public string ECNLinks { get; set; }
|
||||||
public string LotDispoLinks { get; set; }
|
public string LotDispoLinks { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class UserList {
|
||||||
|
|
||||||
public class UserList
|
|
||||||
{
|
|
||||||
public int AttendeeID { set; get; }
|
public int AttendeeID { set; get; }
|
||||||
public string AttendeeName { get; set; }
|
public string AttendeeName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ActionItemResponsible
|
public class ActionItemResponsible {
|
||||||
{
|
|
||||||
public string ResponsibleID { set; get; }
|
public string ResponsibleID { set; get; }
|
||||||
public string ResponsibleName { get; set; }
|
public string ResponsibleName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class SiteList {
|
||||||
|
|
||||||
public class SiteList
|
|
||||||
{
|
|
||||||
public string SiteID { set; get; }
|
public string SiteID { set; get; }
|
||||||
public string SiteName { get; set; }
|
public string SiteName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ChangeControlList {
|
||||||
|
|
||||||
|
|
||||||
public class ChangeControlList
|
|
||||||
{
|
|
||||||
public string IssueID { get; set; }
|
public string IssueID { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string MesaIdTitle { get; set; }
|
public string MesaIdTitle { get; set; }
|
||||||
@ -363,14 +308,14 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string Processes { get; set; }
|
public string Processes { get; set; }
|
||||||
public string ToolTypes { get; set; }
|
public string ToolTypes { get; set; }
|
||||||
public string ActionItemResponsibility { get; set; }
|
public string ActionItemResponsibility { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PCRValue
|
public class PCRValue {
|
||||||
{
|
|
||||||
public string PCRValueID { set; get; }
|
public string PCRValueID { set; get; }
|
||||||
public string PCRValueName { get; set; }
|
public string PCRValueName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -1,28 +1,35 @@
|
|||||||
using System;
|
#pragma warning disable CS8019
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web;
|
|
||||||
using Fab2ApprovalSystem.ViewModels;
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
#endif
|
||||||
|
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
#pragma warning restore CS8019
|
||||||
{
|
|
||||||
public class CredentialsStorage
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
|
public class CredentialsStorage {
|
||||||
|
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Lot
|
public class Lot {
|
||||||
{
|
|
||||||
public int LotID { get; set; }
|
public int LotID { get; set; }
|
||||||
[Display(Name = "Wafer Lot#")]
|
[Display(Name = "Wafer Lot#")]
|
||||||
public string LotNumber { get; set; }
|
public string LotNumber { get; set; }
|
||||||
// public string ParentLotNumber { set; get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
|
||||||
public string ParentLotNumber { set; get; }
|
public string ParentLotNumber { set; get; }
|
||||||
|
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
public string MRBDispoType { get; set; }
|
public string MRBDispoType { get; set; }
|
||||||
public bool GoodToSubmit { get; set; }
|
public bool GoodToSubmit { get; set; }
|
||||||
@ -58,7 +65,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
[UIHint("LotStatusOptionTemplate")]
|
[UIHint("LotStatusOptionTemplate")]
|
||||||
[Display(Name = "Lot Status")]
|
[Display(Name = "Lot Status")]
|
||||||
public LotStatusOptionViewModel LotStatusOption { get; set; }
|
public LotStatusOptionViewModel LotStatusOption { get; set; }
|
||||||
|
|
||||||
public ScrapLot ScrapLotWafer { get; set; }
|
public ScrapLot ScrapLotWafer { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Lot Dispos")]
|
[Display(Name = "Lot Dispos")]
|
||||||
@ -72,9 +78,7 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
[Display(Name = "MRBs")]
|
[Display(Name = "MRBs")]
|
||||||
public string MRBsLinkedToLot { get; set; }
|
public string MRBsLinkedToLot { get; set; }
|
||||||
|
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
public int OpenIssueWithExistingLots { get; set; }
|
public int OpenIssueWithExistingLots { get; set; }
|
||||||
public string QualityCode { get; set; }
|
public string QualityCode { get; set; }
|
||||||
|
|
||||||
@ -86,23 +90,19 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string SPNTransmitMsg { get; set; }
|
public string SPNTransmitMsg { get; set; }
|
||||||
[Display(Name = "MRBs")]
|
[Display(Name = "MRBs")]
|
||||||
public string OtherMRBs { get; set; }
|
public string OtherMRBs { get; set; }
|
||||||
|
public Lot() {
|
||||||
public Lot()
|
|
||||||
{
|
|
||||||
LotStatusOption = new LotStatusOptionViewModel();
|
LotStatusOption = new LotStatusOptionViewModel();
|
||||||
ScrapLotWafer = new ScrapLot();
|
ScrapLotWafer = new ScrapLot();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsDirty { get; set; }
|
public bool IsDirty { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MRBHoldFlagReport
|
public class MRBHoldFlagReport {
|
||||||
{
|
|
||||||
public string LotNo { get; set; }
|
public string LotNo { get; set; }
|
||||||
public string TransactionType { get; set; }
|
public string TransactionType { get; set; }
|
||||||
|
|
||||||
public string PartNo { get; set; }
|
public string PartNo { get; set; }
|
||||||
public string CurrentLocation { get; set; }
|
public string CurrentLocation { get; set; }
|
||||||
public string CurrentOperation { get; set; }
|
public string CurrentOperation { get; set; }
|
||||||
@ -112,30 +112,23 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string OperStatus { get; set; }
|
public string OperStatus { get; set; }
|
||||||
public string Successful { get; set; }
|
public string Successful { get; set; }
|
||||||
public string Comment { get; set; }
|
public string Comment { get; set; }
|
||||||
|
|
||||||
public string PriorMRBHoldLocation { get; set; }
|
public string PriorMRBHoldLocation { get; set; }
|
||||||
public string PriorMRBHoldOperation { get; set; }
|
public string PriorMRBHoldOperation { get; set; }
|
||||||
public string PriorMRB_DispoType { get; set; }
|
public string PriorMRB_DispoType { get; set; }
|
||||||
|
|
||||||
public string CurrentMRBHoldLocation { get; set; }
|
public string CurrentMRBHoldLocation { get; set; }
|
||||||
public string CurrentMRBHoldOperation { get; set; }
|
public string CurrentMRBHoldOperation { get; set; }
|
||||||
public string CurrentMRB_DispoType { get; set; }
|
public string CurrentMRB_DispoType { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public string MRB_DispoType { get; set; }
|
public string MRB_DispoType { get; set; }
|
||||||
public DateTime TransactionDateTime { get; set; }
|
public DateTime TransactionDateTime { get; set; }
|
||||||
public string MRBLocation { get; set; }
|
public string MRBLocation { get; set; }
|
||||||
public string MRBOperation { get; set; }
|
public string MRBOperation { get; set; }
|
||||||
|
|
||||||
public bool Reprocess { get; set; }
|
public bool Reprocess { get; set; }
|
||||||
|
|
||||||
public bool HasErrors { get; set; }
|
public bool HasErrors { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MRBLotsTobeSentToSPN
|
public class MRBLotsTobeSentToSPN {
|
||||||
{
|
|
||||||
public string LotNumber { get; set; }
|
public string LotNumber { get; set; }
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
public char? DispoType { get; set; }
|
public char? DispoType { get; set; }
|
||||||
@ -146,73 +139,64 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !NET8
|
||||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
|
||||||
public class CustomDispoTypeValidationAttribute : ValidationAttribute, IClientValidatable
|
public class CustomDispoTypeValidationAttribute : ValidationAttribute, IClientValidatable {
|
||||||
{
|
public override bool IsValid(object value) {
|
||||||
public override bool IsValid(object value)
|
|
||||||
{
|
|
||||||
char tem = (char)value;
|
char tem = (char)value;
|
||||||
var productName = tem.ToString();
|
var productName = tem.ToString();
|
||||||
if (!string.IsNullOrEmpty(productName))
|
if (!string.IsNullOrEmpty(productName)) {
|
||||||
{
|
|
||||||
return Regex.IsMatch(productName, "^[A,B,C,D]");
|
return Regex.IsMatch(productName, "^[A,B,C,D]");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context)
|
public IEnumerable<ModelClientValidationRule> GetClientValidationRules(ModelMetadata metadata, ControllerContext context) {
|
||||||
{
|
yield return new ModelClientValidationRule {
|
||||||
yield return new ModelClientValidationRule
|
|
||||||
{
|
|
||||||
ErrorMessage = ErrorMessage,
|
ErrorMessage = ErrorMessage,
|
||||||
ValidationType = "dispotypevalidation"
|
ValidationType = "dispotypevalidation"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public class Department {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Department
|
|
||||||
{
|
|
||||||
//public int LotDispoDepartmentID { get; set; }
|
|
||||||
//public int IssueID { get; set; }
|
|
||||||
public int DepartmentID { get; set; }
|
public int DepartmentID { get; set; }
|
||||||
public string DepartmentName { get; set; }
|
public string DepartmentName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class AffectedModule {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class AffectedModule
|
|
||||||
{
|
|
||||||
public int ModuleID { get; set; }
|
public int ModuleID { get; set; }
|
||||||
public string ModuleName { get; set; }
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WIPPart
|
public class WIPPart {
|
||||||
{
|
|
||||||
public string WIPPartData { get; set; }
|
public string WIPPartData { get; set; }
|
||||||
public string PartNumber { get; set; }
|
public string PartNumber { get; set; }
|
||||||
public string SiliconPartNumber { get; set; }
|
public string SiliconPartNumber { get; set; }
|
||||||
public string ProcessFlow { get; set; }
|
public string ProcessFlow { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ProductFamilies
|
public class ProductFamilies {
|
||||||
{
|
|
||||||
public int ProductFamilyID { get; set; }
|
public int ProductFamilyID { get; set; }
|
||||||
public string ProductFamily { get; set; }
|
public string ProductFamily { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LotSplitAnalysisResult
|
public class LotSplitAnalysisResult {
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string ParentLotNo { get; set; }
|
public string ParentLotNo { get; set; }
|
||||||
public string LotNo { get; set; }
|
public string LotNo { get; set; }
|
||||||
public DateTime ActionTime { get; set; }
|
public DateTime ActionTime { get; set; }
|
||||||
public string ActionType { get; set; }
|
public string ActionType { get; set; }
|
||||||
public bool? IsAffected { get; set; }
|
public bool? IsAffected { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,39 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class ECN :System.Object
|
public class ECN : object {
|
||||||
{
|
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public int ECNNumber { get; set; }
|
public int ECNNumber { get; set; }
|
||||||
|
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
public DateTime IssueDate { get; set; }
|
public DateTime IssueDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
public DateTime? SubmitedDate { get; set; }
|
public DateTime? SubmitedDate { get; set; }
|
||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
public DateTime? CloseDate { get; set; }
|
public DateTime? CloseDate { get; set; }
|
||||||
|
|
||||||
public int OriginatorID { get; set; }
|
public int OriginatorID { get; set; }
|
||||||
public string OriginatorName { get; set; }
|
public string OriginatorName { get; set; }
|
||||||
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
||||||
// in order to get the selected items from the control
|
// in order to get the selected items from the control
|
||||||
public List<int> DepartmentIDs { get; set; }
|
public List<int> DepartmentIDs { get; set; }
|
||||||
|
|
||||||
public List<int> ModuleIDs { get; set; }
|
public List<int> ModuleIDs { get; set; }
|
||||||
public List<int> AreaIDs { get; set; }
|
public List<int> AreaIDs { get; set; }
|
||||||
public List<int> TechnologyIDs { get; set; }
|
public List<int> TechnologyIDs { get; set; }
|
||||||
public List<int> AcknowledgementByIDs { get; set; }
|
public List<int> AcknowledgementByIDs { get; set; }
|
||||||
public List<int> TrainingByIDs { get; set; }
|
public List<int> TrainingByIDs { get; set; }
|
||||||
|
|
||||||
public bool IsECN { get; set; }
|
public bool IsECN { get; set; }
|
||||||
public bool IsTECN { get; set; }
|
public bool IsTECN { get; set; }
|
||||||
public bool IsEmergencyTECN { get; set; }
|
public bool IsEmergencyTECN { get; set; }
|
||||||
@ -47,7 +41,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
|
||||||
public DateTime? CancellationDate { get; set; }
|
public DateTime? CancellationDate { get; set; }
|
||||||
|
|
||||||
public bool AcknowledgementRequired { get; set; }
|
public bool AcknowledgementRequired { get; set; }
|
||||||
public bool TrainingRequired { get; set; }
|
public bool TrainingRequired { get; set; }
|
||||||
public int? AreaID { get; set; }
|
public int? AreaID { get; set; }
|
||||||
@ -78,7 +71,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public byte CurrentStep { get; set; }
|
public byte CurrentStep { get; set; }
|
||||||
public bool TECNExtensionState { get; set; }
|
public bool TECNExtensionState { get; set; }
|
||||||
public bool Cancelled { get; set; }
|
public bool Cancelled { get; set; }
|
||||||
|
|
||||||
public bool CancellationApproved { get; set; }
|
public bool CancellationApproved { get; set; }
|
||||||
public bool CancellationInProgress { get; set; }
|
public bool CancellationInProgress { get; set; }
|
||||||
public DateTime? CancellationApprovalDate { get; set; }
|
public DateTime? CancellationApprovalDate { get; set; }
|
||||||
@ -101,19 +93,15 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int LastUpdatedBy { get; set; }
|
public int LastUpdatedBy { get; set; }
|
||||||
public DateTime? LastUpdateDate { get; set; }
|
public DateTime? LastUpdateDate { get; set; }
|
||||||
public DateTime LastUpdateTimeStamp { get; set; }
|
public DateTime LastUpdateTimeStamp { get; set; }
|
||||||
|
|
||||||
public int? CategoryID { get; set; }
|
public int? CategoryID { get; set; }
|
||||||
|
|
||||||
public bool FIChangeRequired { get; set; }
|
public bool FIChangeRequired { get; set; }
|
||||||
public string NumberOfLotsAffected { get; set; }
|
public string NumberOfLotsAffected { get; set; }
|
||||||
public bool? RecipeChange { get; set; }
|
public bool? RecipeChange { get; set; }
|
||||||
public List<int> ProductFamilyIDs { get; set; }
|
public List<int> ProductFamilyIDs { get; set; }
|
||||||
|
|
||||||
public bool Deleted { get; set; }
|
public bool Deleted { get; set; }
|
||||||
public bool IsDocEC { get; set; }
|
public bool IsDocEC { get; set; }
|
||||||
public bool MetrologyChangeRequired { get; set; }
|
public bool MetrologyChangeRequired { get; set; }
|
||||||
public ECN()
|
public ECN() {
|
||||||
{
|
|
||||||
DepartmentIDs = new List<int>();
|
DepartmentIDs = new List<int>();
|
||||||
ModuleIDs = new List<int>();
|
ModuleIDs = new List<int>();
|
||||||
AreaIDs = new List<int>();
|
AreaIDs = new List<int>();
|
||||||
@ -123,20 +111,15 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
ProductFamilyIDs = new List<int>();
|
ProductFamilyIDs = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool Equals(object obj) {
|
||||||
|
|
||||||
public override bool Equals(System.Object obj)
|
|
||||||
{
|
|
||||||
// If parameter is null return false.
|
// If parameter is null return false.
|
||||||
if (obj == null)
|
if (obj == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If parameter cannot be cast to Point return false.
|
// If parameter cannot be cast to Point return false.
|
||||||
ECN p = obj as ECN;
|
ECN p = obj as ECN;
|
||||||
if ((System.Object)p == null)
|
if (p == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,26 +127,15 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public bool Equals(ECN p) {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="p"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool Equals(ECN p)
|
|
||||||
{
|
|
||||||
// If parameter is null return false:
|
// If parameter is null return false:
|
||||||
if ((object)p == null)
|
if (p == null) {
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (PropertyInfo pi in p.GetType().GetProperties()) {
|
||||||
foreach (PropertyInfo pi in p.GetType().GetProperties())
|
foreach (PropertyInfo px in GetType().GetProperties()) {
|
||||||
{
|
if (pi.Name.ToLower() == px.Name.ToLower()) {
|
||||||
foreach(PropertyInfo px in this.GetType().GetProperties())
|
|
||||||
{
|
|
||||||
if (pi.Name.ToLower() == px.Name.ToLower())
|
|
||||||
{
|
|
||||||
if (pi.GetValue(p).Equals(px.GetValue(this)))
|
if (pi.GetValue(p).Equals(px.GetValue(this)))
|
||||||
break;
|
break;
|
||||||
else
|
else
|
||||||
@ -176,36 +148,33 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
return false;
|
return false;
|
||||||
// Return true if the fields match:
|
// Return true if the fields match:
|
||||||
//return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
//return (IsECN == p.IsECN) && (IsEmergencyTECN == p.IsEmergencyTECN);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ECNAffectedDeparmtent {
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public class ECNAffectedDeparmtent
|
|
||||||
{
|
|
||||||
//public int LotDispoDepartmentID { get; set; }
|
|
||||||
//public int IssueID { get; set; }
|
|
||||||
public int DepartmentID { get; set; }
|
public int DepartmentID { get; set; }
|
||||||
public string DepartmentName { get; set; }
|
public string DepartmentName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNAffectedModule
|
public class ECNAffectedModule {
|
||||||
{
|
|
||||||
public int ModuleID { get; set; }
|
public int ModuleID { get; set; }
|
||||||
public string ModuleName { get; set; }
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNCategory
|
public class ECNCategory {
|
||||||
{
|
|
||||||
public int CategoryID { get; set; }
|
public int CategoryID { get; set; }
|
||||||
public string CategoryName { get; set; }
|
public string CategoryName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNAttachment
|
public class ECNAttachment {
|
||||||
{
|
|
||||||
public int AttachmentID { set; get; }
|
public int AttachmentID { set; get; }
|
||||||
public int ECNNumber { get; set; }
|
public int ECNNumber { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -217,23 +186,23 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNArea
|
public class ECNArea {
|
||||||
{
|
|
||||||
public int AreaID { set; get; }
|
public int AreaID { set; get; }
|
||||||
public string Area { get; set; }
|
public string Area { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ECNTechnology
|
public class ECNTechnology {
|
||||||
{
|
|
||||||
public int TechnologyID { get; set; }
|
public int TechnologyID { get; set; }
|
||||||
public string Technology { get; set; }
|
public string Technology { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ECNAcknowledgementTrainingBy {
|
||||||
|
|
||||||
public class ECNAcknowledgementTrainingBy
|
|
||||||
{
|
|
||||||
public int AcknowledgementTrainingByID { get; set; }
|
public int AcknowledgementTrainingByID { get; set; }
|
||||||
public string AcknowledgementTrainingBy { get; set; }
|
public string AcknowledgementTrainingBy { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,17 +1,10 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
public class ECNTypeChangeLog {
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
|
||||||
{
|
|
||||||
public class ECNTypeChangeLog
|
|
||||||
{
|
|
||||||
public int ECNNumber;
|
public int ECNNumber;
|
||||||
public int UserID;
|
public int UserID;
|
||||||
public string ECNTypeFrom;
|
public string ECNTypeFrom;
|
||||||
public string ECNTypeTo;
|
public string ECNTypeTo;
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class AuditList
|
public class AuditList {
|
||||||
{
|
|
||||||
public string AuditNo { get; set; }
|
public string AuditNo { get; set; }
|
||||||
public string AuditTitle { get; set; }
|
public string AuditTitle { get; set; }
|
||||||
public string AuditType { get; set; }
|
public string AuditType { get; set; }
|
||||||
@ -20,22 +18,19 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string CorrectiveActions { get; set; }
|
public string CorrectiveActions { get; set; }
|
||||||
public string AuditScore { get; set; }
|
public string AuditScore { get; set; }
|
||||||
public string AuditStatus { get; set; }
|
public string AuditStatus { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Audit {
|
||||||
|
|
||||||
public class Audit
|
|
||||||
{
|
|
||||||
public int AuditNo { set; get; }
|
public int AuditNo { set; get; }
|
||||||
public int OriginatorID { get; set; }
|
public int OriginatorID { get; set; }
|
||||||
public string OriginatorName { get; set; }
|
public string OriginatorName { get; set; }
|
||||||
public string AuditTitle { get; set; }
|
public string AuditTitle { get; set; }
|
||||||
//public int AuditTypeID { get; set; }
|
|
||||||
public int AuditScore { get; set; }
|
public int AuditScore { get; set; }
|
||||||
public DateTime? AuditDate { get; set; }
|
public DateTime? AuditDate { get; set; }
|
||||||
//public int Auditors { get; set; } // List of Auditors
|
|
||||||
public string AuditFindingCategories { get; set; }
|
public string AuditFindingCategories { get; set; }
|
||||||
public int AuditStatus { get; set; }
|
public int AuditStatus { get; set; }
|
||||||
//public int AuditedAreaID { get; set; }
|
|
||||||
public string NoOfMajorNonConformities { get; set; }
|
public string NoOfMajorNonConformities { get; set; }
|
||||||
public string NoOfMinorNonConformities { get; set; }
|
public string NoOfMinorNonConformities { get; set; }
|
||||||
public string NoOf5SFindings { get; set; }
|
public string NoOf5SFindings { get; set; }
|
||||||
@ -51,46 +46,46 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime RecordLockedDate { get; set; }
|
public DateTime RecordLockedDate { get; set; }
|
||||||
public DateTime LastUpdateDate { get; set; }
|
public DateTime LastUpdateDate { get; set; }
|
||||||
public CAFindings CAFindings { get; set; }
|
public CAFindings CAFindings { get; set; }
|
||||||
public Audit()
|
public Audit() {
|
||||||
{
|
|
||||||
AuditorIDs = new List<int>();
|
AuditorIDs = new List<int>();
|
||||||
AuditTypeIDs = new List<int>();
|
AuditTypeIDs = new List<int>();
|
||||||
AuditedAreaIDs = new List<int>();
|
AuditedAreaIDs = new List<int>();
|
||||||
CAFindings = new CAFindings();
|
CAFindings = new CAFindings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class Auditees
|
|
||||||
{
|
public class Auditees {
|
||||||
string UserName { get; set; }
|
private string UserName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class AuditType
|
public class AuditType {
|
||||||
{
|
|
||||||
public int AuditTypeID { get; set; }
|
public int AuditTypeID { get; set; }
|
||||||
public string AuditTypeName { get; set; }
|
public string AuditTypeName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Auditor
|
public class Auditor {
|
||||||
{
|
|
||||||
public int AuditorID { get; set; }
|
public int AuditorID { get; set; }
|
||||||
public string AuditorName { get; set; }
|
public string AuditorName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
||||||
public class AuditedArea
|
public class AuditedArea {
|
||||||
{
|
|
||||||
public int AuditedAreaID { get; set; }
|
public int AuditedAreaID { get; set; }
|
||||||
public string AuditedAreaName { get; set; }
|
public string AuditedAreaName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class AuditFindings {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class AuditFindings
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int AuditNo { get; set; }
|
public int AuditNo { get; set; }
|
||||||
public string Findings { get; set; }
|
public string Findings { get; set; }
|
||||||
@ -108,18 +103,15 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class AuditFindingCategory {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class AuditFindingCategory
|
|
||||||
{
|
|
||||||
public int AuditFindingCategoryID { get; set; }
|
public int AuditFindingCategoryID { get; set; }
|
||||||
public string AuditFindingCategoryName { get; set; }
|
public string AuditFindingCategoryName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class AuditReportAttachment {
|
||||||
|
|
||||||
public class AuditReportAttachment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -134,13 +126,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CorrectiveAction {
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CorrectiveAction
|
|
||||||
{
|
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public string CANoDisp { get; set; }
|
public string CANoDisp { get; set; }
|
||||||
public int AuditNo { get; set; }
|
public int AuditNo { get; set; }
|
||||||
@ -244,56 +231,40 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? NextDueDate { get; set; }
|
public DateTime? NextDueDate { get; set; }
|
||||||
public DateTime? FollowUpDate { get; set; }
|
public DateTime? FollowUpDate { get; set; }
|
||||||
public bool CASubmitted { get; set; }
|
public bool CASubmitted { get; set; }
|
||||||
|
|
||||||
public DateTime? ClosedDate { get; set; }
|
public DateTime? ClosedDate { get; set; }
|
||||||
|
public CorrectiveAction() {
|
||||||
public CorrectiveAction()
|
|
||||||
{
|
|
||||||
TeamMemberIDs = new List<int>();
|
TeamMemberIDs = new List<int>();
|
||||||
ModuleIDs = new List<int>();
|
ModuleIDs = new List<int>();
|
||||||
RiskAssessmentAreaIDs = new List<int>();
|
RiskAssessmentAreaIDs = new List<int>();
|
||||||
D5D6CorrectivetAction = new D5D6CorrectivetAction();
|
D5D6CorrectivetAction = new D5D6CorrectivetAction();
|
||||||
D7PreventiveAction = new D7PreventiveAction();
|
D7PreventiveAction = new D7PreventiveAction();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CASource {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CASource
|
|
||||||
{
|
|
||||||
public int CASourceID { get; set; }
|
public int CASourceID { get; set; }
|
||||||
public string CASourceName { get; set; }
|
public string CASourceName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CAUserList {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CAUserList
|
|
||||||
{
|
|
||||||
public int UserID { get; set; }
|
public int UserID { get; set; }
|
||||||
public string UserName { get; set; }
|
public string UserName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CAModule {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CAModule
|
|
||||||
{
|
|
||||||
public int ModuleID { get; set; }
|
public int ModuleID { get; set; }
|
||||||
public string ModuleName { get; set; }
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class CA_Attachment {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CA_Attachment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -309,14 +280,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int? D5D6CAID { get; set; }
|
public int? D5D6CAID { get; set; }
|
||||||
public int? D7PAID { get; set; }
|
public int? D7PAID { get; set; }
|
||||||
public int? CAFindingsID { get; set; }
|
public int? CAFindingsID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class D3ContainmentAction {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class D3ContainmentAction
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public string Section { get; set; }
|
public string Section { get; set; }
|
||||||
@ -330,25 +298,17 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? ImplementedDate { get; set; }
|
public DateTime? ImplementedDate { get; set; }
|
||||||
public DateTime AssignedDate { get; set; }
|
public DateTime AssignedDate { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RiskAssessmentArea {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class RiskAssessmentArea
|
|
||||||
{
|
|
||||||
public int RiskAssessmentAreaID { get; set; }
|
public int RiskAssessmentAreaID { get; set; }
|
||||||
public string RiskAssessmentAreaName { get; set; }
|
public string RiskAssessmentAreaName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class D5D6CorrectivetAction {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class D5D6CorrectivetAction
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public string CorrectiveAction { get; set; }
|
public string CorrectiveAction { get; set; }
|
||||||
@ -367,30 +327,21 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public CA_Attachment CA_Attachment { get; set; }
|
public CA_Attachment CA_Attachment { get; set; }
|
||||||
public DateTime AssignedDate { get; set; }
|
public DateTime AssignedDate { get; set; }
|
||||||
public bool Approved { get; set; }
|
public bool Approved { get; set; }
|
||||||
|
public D5D6CorrectivetAction() =>
|
||||||
public D5D6CorrectivetAction()
|
|
||||||
{
|
|
||||||
CA_Attachment = new CA_Attachment();
|
CA_Attachment = new CA_Attachment();
|
||||||
}
|
|
||||||
public string ActionType { get; set; }
|
public string ActionType { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class D5D6Improvement {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class D5D6Improvement
|
|
||||||
{
|
|
||||||
public int D5D6ImprovementID { get; set; }
|
public int D5D6ImprovementID { get; set; }
|
||||||
public string D5D6ImprovementName { get; set; }
|
public string D5D6ImprovementName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class D7PreventiveAction {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class D7PreventiveAction
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public string PreventiveAction { get; set; }
|
public string PreventiveAction { get; set; }
|
||||||
@ -404,16 +355,13 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? ImplementedDate { get; set; }
|
public DateTime? ImplementedDate { get; set; }
|
||||||
public CA_Attachment CA_Attachment { get; set; }
|
public CA_Attachment CA_Attachment { get; set; }
|
||||||
public DateTime AssignedDate { get; set; }
|
public DateTime AssignedDate { get; set; }
|
||||||
|
public D7PreventiveAction() =>
|
||||||
public D7PreventiveAction()
|
|
||||||
{
|
|
||||||
CA_Attachment = new CA_Attachment();
|
CA_Attachment = new CA_Attachment();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CAFindings
|
public class CAFindings {
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int AuditNo { get; set; }
|
public int AuditNo { get; set; }
|
||||||
public string CAFinding { get; set; }
|
public string CAFinding { get; set; }
|
||||||
@ -427,38 +375,34 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? ImplementedDate { get; set; }
|
public DateTime? ImplementedDate { get; set; }
|
||||||
public AuditReportAttachment Audit_Attachment { get; set; }
|
public AuditReportAttachment Audit_Attachment { get; set; }
|
||||||
public DateTime AssignedDate { get; set; }
|
public DateTime AssignedDate { get; set; }
|
||||||
|
public CAFindings() =>
|
||||||
public CAFindings()
|
|
||||||
{
|
|
||||||
Audit_Attachment = new AuditReportAttachment();
|
Audit_Attachment = new AuditReportAttachment();
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public class CASectionApproval
|
|
||||||
{
|
public class CASectionApproval {
|
||||||
|
|
||||||
public string DSection { get; set; }
|
public string DSection { get; set; }
|
||||||
public string Fullname { get; set; }
|
public string Fullname { get; set; }
|
||||||
public string ApprovalStatus { get; set; }
|
public string ApprovalStatus { get; set; }
|
||||||
public DateTime? DateAssigned { get; set; }
|
public DateTime? DateAssigned { get; set; }
|
||||||
public DateTime? DateCompleted { get; set; }
|
public DateTime? DateCompleted { get; set; }
|
||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class CANoList {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class CANoList
|
|
||||||
{
|
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public string CANoDisp { get; set; }
|
public string CANoDisp { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class CAD3D5D7Due
|
public class CAD3D5D7Due {
|
||||||
{
|
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
public DateTime DueDate { get; set; }
|
public DateTime DueDate { get; set; }
|
||||||
public string ItemDue { get; set; }
|
public string ItemDue { get; set; }
|
||||||
public string ExpiryType { get; set; }
|
public string ExpiryType { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,3 +1,5 @@
|
|||||||
|
#if !NET8
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated from a template.
|
// This code was generated from a template.
|
||||||
@ -36,3 +38,5 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public virtual DbSet<C_8DAuditedStandardByAudit> C_8DAuditedStandardByAudit { get; set; }
|
public virtual DbSet<C_8DAuditedStandardByAudit> C_8DAuditedStandardByAudit { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,17 +1,17 @@
|
|||||||
using Microsoft.AspNet.Identity.EntityFramework;
|
#if !NET8
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
using Microsoft.AspNet.Identity.EntityFramework;
|
||||||
{
|
|
||||||
|
namespace Fab2ApprovalSystem.Models {
|
||||||
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
|
// You can add profile data for the user by adding more properties to your ApplicationUser class, please visit http://go.microsoft.com/fwlink/?LinkID=317594 to learn more.
|
||||||
public class ApplicationUser : IdentityUser
|
public class ApplicationUser : IdentityUser {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ApplicationDbContext : IdentityDbContext<ApplicationUser>
|
public class ApplicationDbContext : IdentityDbContext<ApplicationUser> {
|
||||||
{
|
|
||||||
public ApplicationDbContext()
|
public ApplicationDbContext()
|
||||||
: base("DefaultConnection")
|
: base("DefaultConnection") {
|
||||||
{
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,6 +1,8 @@
|
|||||||
namespace Fab2ApprovalSystem.Models {
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
public class LoginResult {
|
public class LoginResult {
|
||||||
|
|
||||||
public bool IsAuthenticated { get; set; }
|
public bool IsAuthenticated { get; set; }
|
||||||
public AuthTokens AuthTokens { get; set; }
|
public AuthTokens AuthTokens { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,20 +1,17 @@
|
|||||||
using Fab2ApprovalSystem.ViewModels;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
#if !NET8
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Script.Serialization;
|
using System.Web.Script.Serialization;
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class LotDisposition
|
public class LotDisposition {
|
||||||
{
|
|
||||||
//[Editable(false)]
|
//[Editable(false)]
|
||||||
[Display(Name = "Issue Number")]
|
[Display(Name = "Issue Number")]
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
@ -41,11 +38,9 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
// important!!make sure the id of the control matches the name of the field in the model it is being binded to,
|
||||||
// in order to get the selected items from the control
|
// in order to get the selected items from the control
|
||||||
public List<int> DepartmentIDs { get; set; }
|
public List<int> DepartmentIDs { get; set; }
|
||||||
|
|
||||||
public List<Attachment> Attachments { get; set; }
|
public List<Attachment> Attachments { get; set; }
|
||||||
public List<Approval> Approvals { get; set; }
|
public List<Approval> Approvals { get; set; }
|
||||||
public List<ScrapLot> ScrapLots { get; set; }
|
public List<ScrapLot> ScrapLots { get; set; }
|
||||||
|
|
||||||
public int CANo { get; set; }
|
public int CANo { get; set; }
|
||||||
[Display(Name = "MRB Required")]
|
[Display(Name = "MRB Required")]
|
||||||
public bool MRBRequired { get; set; }
|
public bool MRBRequired { get; set; }
|
||||||
@ -53,19 +48,13 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
[Display(Name = "Dispositon By OCAP")]
|
[Display(Name = "Dispositon By OCAP")]
|
||||||
public bool DispositionByOCAP { get; set; }
|
public bool DispositionByOCAP { get; set; }
|
||||||
|
|
||||||
public bool RecordLockIndicator { get; set; }
|
public bool RecordLockIndicator { get; set; }
|
||||||
public int RecordLockedBy { get; set; }
|
public int RecordLockedBy { get; set; }
|
||||||
public string RecordLockByName { get; set; }
|
public string RecordLockByName { get; set; }
|
||||||
public DateTime? RecordLockedDate { get; set; }
|
public DateTime? RecordLockedDate { get; set; }
|
||||||
public int LastUpdatedBy { get; set; }
|
public int LastUpdatedBy { get; set; }
|
||||||
public DateTime? LastUpdateDate { get; set; }
|
public DateTime? LastUpdateDate { get; set; }
|
||||||
|
public LotDisposition() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public LotDisposition()
|
|
||||||
{
|
|
||||||
DepartmentIDs = new List<int>();
|
DepartmentIDs = new List<int>();
|
||||||
Lot = new Lot();
|
Lot = new Lot();
|
||||||
DocumentAttachment = new Attachment();
|
DocumentAttachment = new Attachment();
|
||||||
@ -77,68 +66,17 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
CurrentStep = 0;
|
CurrentStep = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public class Lot
|
public class LotDispoDepartment {
|
||||||
//{
|
|
||||||
// public int LotID { get; set; }
|
|
||||||
// [Display(Name = "Wafer Lot#")]
|
|
||||||
// public string LotNumber { get; set; }
|
|
||||||
// public string ParentLotNumber { get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
|
||||||
|
|
||||||
// public int MRBNumber { get; set; }
|
|
||||||
// public int IssueID { get; set; }
|
|
||||||
// public string DieLotNumber { get; set; }
|
|
||||||
// public string Description { get; set; }
|
|
||||||
// [Display(Name="New PN#")]
|
|
||||||
// public string NewPartNo { get; set; }
|
|
||||||
// [Display(Name = "WIP PN#")]
|
|
||||||
// public string WipPartNo { get; set; }
|
|
||||||
// [Display(Name = "Die PN#")]
|
|
||||||
// public string DiePartNo { get; set; }
|
|
||||||
// [Display(Name="Family")]
|
|
||||||
// public string ProductFamily { get; set; }
|
|
||||||
// public double Gen { get; set; }
|
|
||||||
// public string Channel { get; set; }
|
|
||||||
// public double Hexsize { get; set; }
|
|
||||||
// public double Voltage { get; set; }
|
|
||||||
// public int WaferCount { get; set; }
|
|
||||||
// public int ReleaseCount { get; set; }
|
|
||||||
// public int ScrapCount { get; set; }
|
|
||||||
// public int DieCount { get; set; }
|
|
||||||
// public string Location { get; set; }
|
|
||||||
// public double TotalCost { get; set; }
|
|
||||||
// public int LotStatusOptionID { get; set; }
|
|
||||||
// public string LotStatusOptionName { get; set; }
|
|
||||||
// public double WaferCost { get; set; }
|
|
||||||
// public double DieCost { get; set; }
|
|
||||||
|
|
||||||
// [UIHint("LotStatusOptionTemplate")]
|
|
||||||
// [Display(Name="Lot Status")]
|
|
||||||
// public LotStatusOptionViewModel LotStatusOption { get; set; }
|
|
||||||
|
|
||||||
// public ScrapLot ScrapLotWafer { get; set; }
|
|
||||||
|
|
||||||
|
|
||||||
// public Lot()
|
|
||||||
// {
|
|
||||||
// LotStatusOption = new LotStatusOptionViewModel();
|
|
||||||
// ScrapLotWafer = new ScrapLot();
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
public class LotDispoDepartment
|
|
||||||
{
|
|
||||||
//public int LotDispoDepartmentID { get; set; }
|
|
||||||
//public int IssueID { get; set; }
|
|
||||||
public int DepartmentID { get; set; }
|
public int DepartmentID { get; set; }
|
||||||
public string DepartmentName { get; set; }
|
public string DepartmentName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Attachment
|
public class Attachment {
|
||||||
{
|
|
||||||
public int AttachmentID { set; get; }
|
public int AttachmentID { set; get; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -150,12 +88,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Approval {
|
||||||
|
|
||||||
public class Approval
|
|
||||||
{
|
|
||||||
public int ApprovalID { get; set; }
|
public int ApprovalID { get; set; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
string StateName { get; set; }
|
private string StateName { get; set; }
|
||||||
public int UserID { get; set; }
|
public int UserID { get; set; }
|
||||||
public int SubRoleID { get; set; }
|
public int SubRoleID { get; set; }
|
||||||
public int ItemStatus { get; set; }
|
public int ItemStatus { get; set; }
|
||||||
@ -165,12 +102,10 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? RoleAssignedDate { get; set; }
|
public DateTime? RoleAssignedDate { get; set; }
|
||||||
public DateTime? CompleteDateTime { get; set; }
|
public DateTime? CompleteDateTime { get; set; }
|
||||||
public string UserComments { get; set; }
|
public string UserComments { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ScrapLot {
|
||||||
public class ScrapLot
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public string LotNo { get; set; }
|
public string LotNo { get; set; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
@ -181,7 +116,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
// extra field ( a viewmodel can be created)
|
// extra field ( a viewmodel can be created)
|
||||||
public int WaferCount { get; set; }
|
public int WaferCount { get; set; }
|
||||||
|
|
||||||
public byte Lot1State { get; set; }
|
public byte Lot1State { get; set; }
|
||||||
public byte Lot2State { get; set; }
|
public byte Lot2State { get; set; }
|
||||||
public byte Lot3State { get; set; }
|
public byte Lot3State { get; set; }
|
||||||
@ -235,40 +169,29 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class Users {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Users
|
|
||||||
{
|
|
||||||
public int OriginatorID { get; set; }
|
public int OriginatorID { get; set; }
|
||||||
public string Originatorname { get; set; }
|
public string Originatorname { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class Responsibility {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Responsibility
|
|
||||||
{
|
|
||||||
public int ResponsibilityID { get; set; }
|
public int ResponsibilityID { get; set; }
|
||||||
public string ResponsibilityName { get; set; }
|
public string ResponsibilityName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ResponsibilityIssue {
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class ResponsibilityIssue
|
|
||||||
{
|
|
||||||
public int ResponsibilityIssueID { get; set; }
|
public int ResponsibilityIssueID { get; set; }
|
||||||
public string Issue { get; set; }
|
public string Issue { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class Comments {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class Comments
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int IssueID { get; set; }
|
public int IssueID { get; set; }
|
||||||
public string CommentedBy { get; set; }
|
public string CommentedBy { get; set; }
|
||||||
@ -277,5 +200,3 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime TimeStamp { get; set; }
|
public DateTime TimeStamp { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
@ -1,17 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class LTWorkRequest
|
public class LTWorkRequest {
|
||||||
{
|
|
||||||
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int SWRNumber { get; set; }
|
public int SWRNumber { get; set; }
|
||||||
@ -61,32 +58,24 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string VerbComment { get; set; }
|
public string VerbComment { get; set; }
|
||||||
public int? RecordSiliconLotInSPNTapeTagTotrav { get; set; }
|
public int? RecordSiliconLotInSPNTapeTagTotrav { get; set; }
|
||||||
public string SiliconLotNoCassette1 { get; set; }
|
public string SiliconLotNoCassette1 { get; set; }
|
||||||
|
|
||||||
public bool SiliconOnHand { get; set; }
|
public bool SiliconOnHand { get; set; }
|
||||||
public DateTime? SiliconExpectedDueDate { get; set; }
|
public DateTime? SiliconExpectedDueDate { get; set; }
|
||||||
public string SiliconComments { get; set; }
|
public string SiliconComments { get; set; }
|
||||||
|
|
||||||
public bool ReticleOnHand { get; set; }
|
public bool ReticleOnHand { get; set; }
|
||||||
public DateTime? ReticleExpectedDueDate { get; set; }
|
public DateTime? ReticleExpectedDueDate { get; set; }
|
||||||
public string ReticleComments { get; set; }
|
public string ReticleComments { get; set; }
|
||||||
|
|
||||||
public bool SPNTransferOnHand { get; set; }
|
public bool SPNTransferOnHand { get; set; }
|
||||||
public DateTime? SPNTransferExpectedDueDate { get; set; }
|
public DateTime? SPNTransferExpectedDueDate { get; set; }
|
||||||
public string SPNTransferComments { get; set; }
|
public string SPNTransferComments { get; set; }
|
||||||
|
|
||||||
public bool ProbeCardOnHand { get; set; }
|
public bool ProbeCardOnHand { get; set; }
|
||||||
public DateTime? ProbeCardExpectedDueDate { get; set; }
|
public DateTime? ProbeCardExpectedDueDate { get; set; }
|
||||||
public string ProbeCardComments { get; set; }
|
public string ProbeCardComments { get; set; }
|
||||||
|
|
||||||
public bool ProbeRecipeOnHand { get; set; }
|
public bool ProbeRecipeOnHand { get; set; }
|
||||||
public DateTime? ProbeRecipeExpectedDueDate { get; set; }
|
public DateTime? ProbeRecipeExpectedDueDate { get; set; }
|
||||||
public string ProbeRecipeComments { get; set; }
|
public string ProbeRecipeComments { get; set; }
|
||||||
|
|
||||||
public bool ProcessChangeDetailsOnHand { get; set; }
|
public bool ProcessChangeDetailsOnHand { get; set; }
|
||||||
public DateTime? ProcessChangeDetailsDueDate { get; set; }
|
public DateTime? ProcessChangeDetailsDueDate { get; set; }
|
||||||
|
|
||||||
public string LotStartCheckListComments { get; set; }
|
public string LotStartCheckListComments { get; set; }
|
||||||
|
|
||||||
public LTHoldStep LTHoldStep { get; set; }
|
public LTHoldStep LTHoldStep { get; set; }
|
||||||
public LTWorkRequestAttachment WorkRequestAttachment { get; set; }
|
public LTWorkRequestAttachment WorkRequestAttachment { get; set; }
|
||||||
public int LotCount { get; set; }
|
public int LotCount { get; set; }
|
||||||
@ -99,17 +88,14 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public LTMaterial LTMaterial { get; set; }
|
public LTMaterial LTMaterial { get; set; }
|
||||||
public int PreviousWorkRequestID { get; set; }
|
public int PreviousWorkRequestID { get; set; }
|
||||||
public int WorkFlowNumber { get; set; }
|
public int WorkFlowNumber { get; set; }
|
||||||
public string ApprovalStatus
|
public string ApprovalStatus {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return Status == 1 ? "Approved" : "Pending";
|
return Status == 1 ? "Approved" : "Pending";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public LTWorkRequest()
|
public LTWorkRequest() {
|
||||||
{
|
|
||||||
DepartmentIDs = new List<int>();
|
DepartmentIDs = new List<int>();
|
||||||
ModuleIDs = new List<int>();
|
ModuleIDs = new List<int>();
|
||||||
LTHoldStep = new LTHoldStep();
|
LTHoldStep = new LTHoldStep();
|
||||||
@ -118,9 +104,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LTMaterial {
|
||||||
|
|
||||||
public class LTMaterial
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
[Display(Name = "WIP Part #")]
|
[Display(Name = "WIP Part #")]
|
||||||
public string WIPPartNumber { get; set; }
|
public string WIPPartNumber { get; set; }
|
||||||
@ -134,72 +119,41 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTAffectedDepartment {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTAffectedDepartment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int DepartmentID { get; set; }
|
public int DepartmentID { get; set; }
|
||||||
public int LTWorkRequestID { get; set; }
|
public int LTWorkRequestID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTAffectedModule {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTAffectedModule
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int ModuleID { get; set; }
|
public int ModuleID { get; set; }
|
||||||
public int LTWorkRequestID { get; set; }
|
public int LTWorkRequestID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTLotStartCheckList {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
//public class LTMaterial
|
|
||||||
//{
|
|
||||||
// public int ID { get; set; }
|
|
||||||
// public string WIPPartNumber { get; set; }
|
|
||||||
// public string Description { get; set; }
|
|
||||||
// public string EPISiliconPartNumber { get; set; }
|
|
||||||
// public int Quantity { get; set; }
|
|
||||||
// public string Supplier { get; set; }
|
|
||||||
// public int LTWorkRequestID { get; set; }
|
|
||||||
|
|
||||||
// public LTMaterial()
|
|
||||||
// {
|
|
||||||
// Description = "";
|
|
||||||
// }
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLotStartCheckList
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string Item { get; set; }
|
public string Item { get; set; }
|
||||||
public bool OnHand { get; set; }
|
public bool OnHand { get; set; }
|
||||||
public DateTime? ExpectedDueDate { get; set; }
|
public DateTime? ExpectedDueDate { get; set; }
|
||||||
public int LTWorkRequestID { get; set; }
|
public int LTWorkRequestID { get; set; }
|
||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTHoldStep {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTHoldStep
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string BaseFlow { get; set; }
|
public string BaseFlow { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
|
|
||||||
[Display(Name = "Seq")]
|
[Display(Name = "Seq")]
|
||||||
public string OperSequence { get; set; }
|
public string OperSequence { get; set; }
|
||||||
|
|
||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
public string OperationDescription { get; set; }
|
public string OperationDescription { get; set; }
|
||||||
public string ChangeInstructions { get; set; }
|
public string ChangeInstructions { get; set; }
|
||||||
@ -211,17 +165,13 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int SWRNumber { get; set; }
|
public int SWRNumber { get; set; }
|
||||||
public int currentStep { get; set; }
|
public int currentStep { get; set; }
|
||||||
public int PreviousHoldStepID { get; set; }
|
public int PreviousHoldStepID { get; set; }
|
||||||
public LTHoldStep()
|
public LTHoldStep() =>
|
||||||
{
|
|
||||||
LTWorkRequestAttachment = new LTWorkRequestAttachment();
|
LTWorkRequestAttachment = new LTWorkRequestAttachment();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTWorkRequestAttachment {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTWorkRequestAttachment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -236,13 +186,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int SWRNumber { get; set; }
|
public int SWRNumber { get; set; }
|
||||||
public string FileExtension { get; set; }
|
public string FileExtension { get; set; }
|
||||||
public int PreviousWorkRequestAttachmentID { get; set; }
|
public int PreviousWorkRequestAttachmentID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTLotTravelerHeaderViewModel {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLotTravelerHeaderViewModel
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int SWRNumber { get; set; }
|
public int SWRNumber { get; set; }
|
||||||
public string LotNumber { get; set; }
|
public string LotNumber { get; set; }
|
||||||
@ -256,12 +204,9 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public DateTime? LastUpdate { get; set; }
|
public DateTime? LastUpdate { get; set; }
|
||||||
public string LastUpdatedBy { get; set; }
|
public string LastUpdatedBy { get; set; }
|
||||||
public string PurposeOfRequest { get; set; }
|
public string PurposeOfRequest { get; set; }
|
||||||
//public int Quantity { get; set; }
|
|
||||||
//public bool TravelerAttachedToLot { get; set; }
|
|
||||||
public int LotTravCurrentRevision { get; set; }
|
public int LotTravCurrentRevision { get; set; }
|
||||||
public LTLotTravelerHoldSteps LTLotTravelerHoldStep { get; set; }
|
public LTLotTravelerHoldSteps LTLotTravelerHoldStep { get; set; }
|
||||||
public bool IsCurrentRevision { get; set; }
|
public bool IsCurrentRevision { get; set; }
|
||||||
//public string Comments { get; set; }
|
|
||||||
public int LTWorkRequestID { get; set; }
|
public int LTWorkRequestID { get; set; }
|
||||||
public int LotTravRevID { get; set; }
|
public int LotTravRevID { get; set; }
|
||||||
public bool RecordLockIndicator { get; set; }
|
public bool RecordLockIndicator { get; set; }
|
||||||
@ -273,27 +218,19 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string TravelerClosedBy { get; set; }
|
public string TravelerClosedBy { get; set; }
|
||||||
public string TravelerClosedReason { get; set; }
|
public string TravelerClosedReason { get; set; }
|
||||||
public int WorkReqRevision { get; set; }
|
public int WorkReqRevision { get; set; }
|
||||||
|
public string TravelerStatus {
|
||||||
public string TravelerStatus
|
get {
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return TravelerClosedDate == null ? "Open" : "Closed";
|
return TravelerClosedDate == null ? "Open" : "Closed";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LTLotTravelerHeaderViewModel() =>
|
||||||
public LTLotTravelerHeaderViewModel()
|
|
||||||
{
|
|
||||||
LTLotTravelerHoldStep = new LTLotTravelerHoldSteps();
|
LTLotTravelerHoldStep = new LTLotTravelerHoldSteps();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTLot {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLot
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int WorkRequestID { get; set; }
|
public int WorkRequestID { get; set; }
|
||||||
public string LotNumber { get; set; }
|
public string LotNumber { get; set; }
|
||||||
@ -314,27 +251,18 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string TravelerStatus { get; set; }
|
public string TravelerStatus { get; set; }
|
||||||
public bool TravelerClosed { get; set; }
|
public bool TravelerClosed { get; set; }
|
||||||
public DateTime? TravelerClosedDate { get; set; }
|
public DateTime? TravelerClosedDate { get; set; }
|
||||||
//public int RecordLockIndicator { get; set; }
|
|
||||||
//public int RecordLockedBy { get; set; }
|
|
||||||
//public DateTime? RecordLockedDateTime { get; set; }
|
|
||||||
//public bool IsCurrentRevision { get; set;}
|
|
||||||
//public int Revision { get; set; }
|
|
||||||
[Display(Name = "")]
|
[Display(Name = "")]
|
||||||
public string ButtonAttrib
|
public string ButtonAttrib {
|
||||||
{
|
get {
|
||||||
get
|
|
||||||
{
|
|
||||||
return (IsTravelerGenerated ? "True" : "False") + "~" + ID + "~" + WorkRequestID + "~" + LotStatus + "~" + TravelerStatus;
|
return (IsTravelerGenerated ? "True" : "False") + "~" + ID + "~" + WorkRequestID + "~" + LotStatus + "~" + TravelerStatus;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTLotTravelerRevisionAttrib {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLotTravelerRevisionAttrib
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int LTLotID { get; set; }
|
public int LTLotID { get; set; }
|
||||||
public int RevisionNumber { get; set; }
|
public int RevisionNumber { get; set; }
|
||||||
@ -346,20 +274,14 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int TravelerLastUpdatedBy { get; set; }
|
public int TravelerLastUpdatedBy { get; set; }
|
||||||
public DateTime? TraverlerLastUpdatedDatetime { get; set; }
|
public DateTime? TraverlerLastUpdatedDatetime { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class LTLotTravlerHistory {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LTLotTravlerHistory
|
public class LTLotTravelerHoldSteps {
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLotTravelerHoldSteps
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
@ -385,13 +307,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int SWRNumber { get; set; }
|
public int SWRNumber { get; set; }
|
||||||
public int LTLotID { get; set; }
|
public int LTLotID { get; set; }
|
||||||
public int WorkRequestID { get; set; }
|
public int WorkRequestID { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
public class LTLotTravAttachment {
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public class LTLotTravAttachment
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string FileGUID { get; set; }
|
public string FileGUID { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -403,20 +323,17 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int UploadedByID { get; set; }
|
public int UploadedByID { get; set; }
|
||||||
public string UploadedByName { get; set; }
|
public string UploadedByName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BaseFlowLocation
|
public class BaseFlowLocation {
|
||||||
{
|
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BaseFlowOperations
|
public class BaseFlowOperations {
|
||||||
{
|
|
||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
public string OperationDesc { get; set; }
|
public string OperationDesc { get; set; }
|
||||||
public string OperCode { get; set; }
|
public string OperCode { get; set; }
|
||||||
@ -424,40 +341,41 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BaseFlowLocationOperation
|
public class BaseFlowLocationOperation {
|
||||||
{
|
|
||||||
public string BaseFlow { get; set; }
|
public string BaseFlow { get; set; }
|
||||||
public string Location { get; set; }
|
public string Location { get; set; }
|
||||||
public string Operation { get; set; }
|
public string Operation { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PartNumberAttrib
|
public class PartNumberAttrib {
|
||||||
{
|
|
||||||
public string PartNumber { get; set; }
|
public string PartNumber { get; set; }
|
||||||
public string SiliconAndDesc { get; set; }
|
public string SiliconAndDesc { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Revision
|
public class Revision {
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public int RevisionNumber { get; set; }
|
public int RevisionNumber { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class LotWithTraveler {
|
||||||
|
|
||||||
public class LotWithTraveler
|
|
||||||
{
|
|
||||||
public int LotID { get; set; }
|
public int LotID { get; set; }
|
||||||
public string LotNumber { get; set; }
|
public string LotNumber { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RevisionHistory {
|
||||||
|
|
||||||
public class RevisionHistory
|
|
||||||
{
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
public string RevisionedBy { get; set; }
|
public string RevisionedBy { get; set; }
|
||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
public DateTime RevisionCreateDate { get; set; }
|
public DateTime RevisionCreateDate { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,18 +1,16 @@
|
|||||||
using Fab2ApprovalSystem.ViewModels;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
using Fab2ApprovalSystem.ViewModels;
|
||||||
{
|
|
||||||
|
namespace Fab2ApprovalSystem.Models;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class MRB
|
public class MRB {
|
||||||
{
|
|
||||||
|
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
@ -41,12 +39,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public List<int> ModuleIDs { get; set; }
|
public List<int> ModuleIDs { get; set; }
|
||||||
public List<int> DispositionIDs { get; set; }
|
public List<int> DispositionIDs { get; set; }
|
||||||
public List<int> RiskAssessmentIDs { get; set; }
|
public List<int> RiskAssessmentIDs { get; set; }
|
||||||
|
|
||||||
//public List<PartGroup> PartGroups { get; set; }
|
|
||||||
//public List<Module> Modules { get; set; }
|
|
||||||
//public List<Disposition> Dispositions { get; set; }
|
|
||||||
//public List<RiskAssessment> RiskAssessments { get; set; }
|
|
||||||
|
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public string OwnerApprover { get; set; }
|
public string OwnerApprover { get; set; }
|
||||||
public string MfgEngineeringAppover { get; set; }
|
public string MfgEngineeringAppover { get; set; }
|
||||||
@ -54,17 +46,13 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string PEApprover { get; set; }
|
public string PEApprover { get; set; }
|
||||||
public string OtherApprovers { get; set; }
|
public string OtherApprovers { get; set; }
|
||||||
public string QualityApprovers { get; set; }
|
public string QualityApprovers { get; set; }
|
||||||
//public string Details { get; set; }
|
|
||||||
public byte CurrentStep { get; set; }
|
public byte CurrentStep { get; set; }
|
||||||
public string DetailsFolder { get; set; }
|
public string DetailsFolder { get; set; }
|
||||||
public bool CustomerImpacted { get; set; }
|
public bool CustomerImpacted { get; set; }
|
||||||
public int WorkFlowNumber { get; set; }
|
public int WorkFlowNumber { get; set; }
|
||||||
|
|
||||||
public string ApprovalStatusString {
|
public string ApprovalStatusString {
|
||||||
get
|
get {
|
||||||
{
|
switch (ApprovalStatus) {
|
||||||
switch (ApprovalStatus)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
return "PENDING";
|
return "PENDING";
|
||||||
case 1:
|
case 1:
|
||||||
@ -78,79 +66,37 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MRB()
|
public MRB() {
|
||||||
{
|
|
||||||
PartGroupIDs = new List<int>();
|
PartGroupIDs = new List<int>();
|
||||||
ModuleIDs = new List<int>();
|
ModuleIDs = new List<int>();
|
||||||
DispositionIDs = new List<int>();
|
DispositionIDs = new List<int>();
|
||||||
RiskAssessmentIDs = new List<int>();
|
RiskAssessmentIDs = new List<int>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//public class zMRBLot
|
public class PartGroup {
|
||||||
//{
|
|
||||||
// public int LotID { get; set; }
|
|
||||||
// [Display(Name = "Wafer Lot#")]
|
|
||||||
// public string LotNumber { get; set; }
|
|
||||||
// public string ParentLotNumber { get { return LotNumber.Length >= 7 ? LotNumber.Substring(0, 7) : LotNumber; } }
|
|
||||||
|
|
||||||
// public int MRBNumber { get; set; }
|
|
||||||
// public string DieLotNumber { get; set; }
|
|
||||||
// public string Description { get; set; }
|
|
||||||
// [Display(Name = "New PN#")]
|
|
||||||
// public string NewPartNo { get; set; }
|
|
||||||
// [Display(Name = "WIP PN#")]
|
|
||||||
// public string WipPartNo { get; set; }
|
|
||||||
// [Display(Name = "Die PN#")]
|
|
||||||
// public string DiePartNo { get; set; }
|
|
||||||
// [Display(Name = "Family")]
|
|
||||||
// public string ProductFamily { get; set; }
|
|
||||||
// public double Gen { get; set; }
|
|
||||||
// public string Channel { get; set; }
|
|
||||||
// public double Hexsize { get; set; }
|
|
||||||
// public double Voltage { get; set; }
|
|
||||||
// public int WaferCount { get; set; }
|
|
||||||
// public int ReleaseCount { get; set; }
|
|
||||||
// public int ScrapCount { get; set; }
|
|
||||||
// public int DieCount { get; set; }
|
|
||||||
// public string Location { get; set; }
|
|
||||||
// public double TotalCost { get; set; }
|
|
||||||
// public string LotStatusOptionName { get; set; }
|
|
||||||
// public double WaferCost { get; set; }
|
|
||||||
// public double DieCost { get; set; }
|
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
public class PartGroup
|
|
||||||
{
|
|
||||||
public int PartGroupID { get; set; }
|
public int PartGroupID { get; set; }
|
||||||
public string PartGroupName { get; set; }
|
public string PartGroupName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Module
|
public class Module {
|
||||||
{
|
|
||||||
public int ModuleID { get; set; }
|
public int ModuleID { get; set; }
|
||||||
//public int MRBNumber { get; set; }
|
|
||||||
public string ModuleName { get; set; }
|
public string ModuleName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class RiskAssessment {
|
||||||
public class RiskAssessment
|
|
||||||
{
|
|
||||||
|
|
||||||
public int RiskAssessmentID { get; set; }
|
public int RiskAssessmentID { get; set; }
|
||||||
//public int MRBNumber { get; set; }
|
|
||||||
public string RiskAssessmentName { get; set; }
|
public string RiskAssessmentName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Disposition {
|
||||||
public class Disposition
|
|
||||||
{
|
|
||||||
|
|
||||||
public int DispositionID { get; set; }
|
public int DispositionID { get; set; }
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
@ -162,19 +108,15 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
//Duplicated as the CloseToQDBOptionID is being used in the dropdown in the Grid kept the old code
|
//Duplicated as the CloseToQDBOptionID is being used in the dropdown in the Grid kept the old code
|
||||||
public int CloseToQDBOption_ID { get; set; }
|
public int CloseToQDBOption_ID { get; set; }
|
||||||
//public string CloseToQDBOption { get; set; }
|
|
||||||
|
|
||||||
[UIHint("CloseToQDBTemplate")]
|
[UIHint("CloseToQDBTemplate")]
|
||||||
[Display(Name = "Close To QDB(Yes/No)")]
|
[Display(Name = "Close To QDB(Yes/No)")]
|
||||||
public CloseToQDBOptionViewModel CloseToQDBOption { get; set; }
|
public CloseToQDBOptionViewModel CloseToQDBOption { get; set; }
|
||||||
|
|
||||||
[Display(Name = "MRB Flag to SPN")]
|
[Display(Name = "MRB Flag to SPN")]
|
||||||
public string CloseToQDBOptionString
|
public string CloseToQDBOptionString {
|
||||||
{
|
get {
|
||||||
get
|
switch (CloseToQDBOption_ID) {
|
||||||
{
|
|
||||||
switch (CloseToQDBOption_ID)
|
|
||||||
{
|
|
||||||
case 0:
|
case 0:
|
||||||
return "No";
|
return "No";
|
||||||
case 1:
|
case 1:
|
||||||
@ -187,9 +129,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MRBAttachment {
|
||||||
|
|
||||||
public class MRBAttachment
|
|
||||||
{
|
|
||||||
public int AttachmentID { set; get; }
|
public int AttachmentID { set; get; }
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
@ -201,9 +142,8 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class ContainmentActionObj {
|
||||||
|
|
||||||
public class ContainmentActionObj
|
|
||||||
{
|
|
||||||
public int ContainmentActionID { get; set; }
|
public int ContainmentActionID { get; set; }
|
||||||
public int MRBNumber { get; set; }
|
public int MRBNumber { get; set; }
|
||||||
public string ContainmentAction { get; set; }
|
public string ContainmentAction { get; set; }
|
||||||
@ -216,11 +156,12 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
|
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
public DateTime? ImplementedDate { get; set; }
|
public DateTime? ImplementedDate { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SPN_MRB
|
public class SPN_MRB {
|
||||||
{
|
|
||||||
public int MRBNumber;
|
public int MRBNumber;
|
||||||
public char? DispoType;
|
public char? DispoType;
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,58 +1,50 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class PartsRequest
|
public class PartsRequest {
|
||||||
{
|
|
||||||
public int PRNumber { get; set; }
|
public int PRNumber { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
|
|
||||||
public DateTime CreateDate { get; set; }
|
public DateTime CreateDate { get; set; }
|
||||||
public DateTime? SubmitDate { get; set; }
|
public DateTime? SubmitDate { get; set; }
|
||||||
public DateTime? CloseDate { get; set; }
|
public DateTime? CloseDate { get; set; }
|
||||||
|
|
||||||
public int OriginatorID { get; set; }
|
public int OriginatorID { get; set; }
|
||||||
public int RequestorID { get; set; }
|
public int RequestorID { get; set; }
|
||||||
public int TechLeadID { get; set; }
|
public int TechLeadID { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
public DateTime? LastUpdateDate { get; set; }
|
public DateTime? LastUpdateDate { get; set; }
|
||||||
|
|
||||||
public int CurrentStep { get; set; }
|
public int CurrentStep { get; set; }
|
||||||
|
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class PartsRequestAttachment
|
public class PartsRequestAttachment {
|
||||||
{
|
|
||||||
public int AttachmentID { set; get; }
|
|
||||||
public int PRNumber { get; set; }
|
|
||||||
public string FileName { get; set; }
|
|
||||||
public int UserID { get; set; }
|
|
||||||
public string UploadDate { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
[Serializable]
|
|
||||||
public class PartsRequestAttachmentList
|
|
||||||
{
|
|
||||||
public int AttachmentID { set; get; }
|
public int AttachmentID { set; get; }
|
||||||
public int PRNumber { get; set; }
|
public int PRNumber { get; set; }
|
||||||
public string FileName { get; set; }
|
public string FileName { get; set; }
|
||||||
public int UserID { get; set; }
|
public int UserID { get; set; }
|
||||||
public string UploadDate { get; set; }
|
public string UploadDate { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class PartsRequestAttachmentList {
|
||||||
|
|
||||||
|
public int AttachmentID { set; get; }
|
||||||
|
public int PRNumber { get; set; }
|
||||||
|
public string FileName { get; set; }
|
||||||
|
public int UserID { get; set; }
|
||||||
|
public string UploadDate { get; set; }
|
||||||
public string FullName { get; set; }
|
public string FullName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PartsRequestList
|
public class PartsRequestList {
|
||||||
{
|
|
||||||
public int PRNumber { get; set; }
|
public int PRNumber { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public DateTime CreateDate { get; set; }
|
public DateTime CreateDate { get; set; }
|
||||||
@ -64,10 +56,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
public string PendingApprovers { get; set; }
|
public string PendingApprovers { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MyPartsRequestList
|
public class MyPartsRequestList {
|
||||||
{
|
|
||||||
public int PRNumber { get; set; }
|
public int PRNumber { get; set; }
|
||||||
public string Title { get; set; }
|
public string Title { get; set; }
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
@ -80,6 +73,5 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string Status { get; set; }
|
public string Status { get; set; }
|
||||||
public string PendingApprovers { get; set; }
|
public string PendingApprovers { get; set; }
|
||||||
public string WorkFlowStepName { get; set; }
|
public string WorkFlowStepName { get; set; }
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,25 +1,19 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class ProductViewModel
|
public class ProductViewModel {
|
||||||
{
|
|
||||||
[ScaffoldColumn(false)]
|
[ScaffoldColumn(false)]
|
||||||
public int ProductID
|
public int ProductID {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
[DisplayName("Product name")]
|
[DisplayName("Product name")]
|
||||||
public string ProductName
|
public string ProductName {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
@ -28,8 +22,7 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
[DisplayName("Unit price")]
|
[DisplayName("Unit price")]
|
||||||
[DataType(DataType.Currency)]
|
[DataType(DataType.Currency)]
|
||||||
[Range(0, int.MaxValue)]
|
[Range(0, int.MaxValue)]
|
||||||
public decimal UnitPrice
|
public decimal UnitPrice {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
@ -38,31 +31,26 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
[DisplayName("Units in stock")]
|
[DisplayName("Units in stock")]
|
||||||
[DataType("Integer")]
|
[DataType("Integer")]
|
||||||
[Range(0, int.MaxValue)]
|
[Range(0, int.MaxValue)]
|
||||||
public int UnitsInStock
|
public int UnitsInStock {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Discontinued
|
public bool Discontinued {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DisplayName("Last supply")]
|
[DisplayName("Last supply")]
|
||||||
[DataType(DataType.Date)]
|
[DataType(DataType.Date)]
|
||||||
public DateTime LastSupply
|
public DateTime LastSupply {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DataType("Integer")]
|
[DataType("Integer")]
|
||||||
public int UnitsOnOrder
|
public int UnitsOnOrder {
|
||||||
{
|
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -1,15 +1,10 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Web;
|
|
||||||
|
public class TestModel {
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
|
||||||
{
|
|
||||||
public class TestModel
|
|
||||||
{
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
public List<string> Countries { get; set; }
|
public List<string> Countries { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
@ -28,7 +28,6 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
||||||
ECN_DMO ecnDMO = new ECN_DMO();
|
ECN_DMO ecnDMO = new ECN_DMO();
|
||||||
string ECNTitle = ecnDMO.GetECN(ECN).Title;
|
string ECNTitle = ecnDMO.GetECN(ECN).Title;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#if !NET8
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// This code was generated from a template.
|
// This code was generated from a template.
|
||||||
@ -42,3 +44,5 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public virtual DbSet<TECNNotificationsUser> TECNNotificationsUsers { get; set; }
|
public virtual DbSet<TECNNotificationsUser> TECNNotificationsUsers { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
@ -1,14 +1,9 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
public class UserSubRoles {
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
|
||||||
{
|
|
||||||
public class UserSubRoles
|
|
||||||
{
|
|
||||||
public int SubRoleID { get; set; }
|
public int SubRoleID { get; set; }
|
||||||
public string RoleName { get; set; }
|
public string RoleName { get; set; }
|
||||||
public string SubRoleName { get; set; }
|
public string SubRoleName { get; set; }
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,13 +1,6 @@
|
|||||||
using System;
|
namespace Fab2ApprovalSystem.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
public class WinEventLog {
|
||||||
{
|
|
||||||
public class WinEventLog
|
|
||||||
{
|
|
||||||
//[Key]
|
//[Key]
|
||||||
|
|
||||||
public int SysDocumentID { get; set; }
|
public int SysDocumentID { get; set; }
|
||||||
@ -17,6 +10,4 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public string OperationType { get; set; }
|
public string OperationType { get; set; }
|
||||||
public string Comments { get; set; }
|
public string Comments { get; set; }
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.Models
|
namespace Fab2ApprovalSystem.Models;
|
||||||
{
|
|
||||||
public class ApprovalModel
|
public class ApprovalModel {
|
||||||
{
|
|
||||||
public int ApprovalID { get; set; }
|
public int ApprovalID { get; set; }
|
||||||
public int? IssueID { get; set; }
|
public int? IssueID { get; set; }
|
||||||
public string RoleName { get; set; } // nullable
|
public string RoleName { get; set; } // nullable
|
||||||
@ -25,10 +22,11 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public int DocumentTypeID { get; set; }
|
public int DocumentTypeID { get; set; }
|
||||||
public bool DisplayDeniedDocument { get; set; }
|
public bool DisplayDeniedDocument { get; set; }
|
||||||
public bool Delegated { get; set; }
|
public bool Delegated { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WorkflowSteps
|
public class WorkflowSteps {
|
||||||
{
|
|
||||||
public int WorkflowStepID { get; set; }
|
public int WorkflowStepID { get; set; }
|
||||||
public int WorkflowID { get; set; }
|
public int WorkflowID { get; set; }
|
||||||
public int WorkflowStepNumber { get; set; }
|
public int WorkflowStepNumber { get; set; }
|
||||||
@ -37,7 +35,5 @@ namespace Fab2ApprovalSystem.Models
|
|||||||
public bool RulesApply { get; set; }
|
public bool RulesApply { get; set; }
|
||||||
public int ApprovalType { get; set; }
|
public int ApprovalType { get; set; }
|
||||||
public bool? AllowReject { get; set; }
|
public bool? AllowReject { get; set; }
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
// --------------------------------------------------------------------------------------------------------------------
|
#if !NET8
|
||||||
|
|
||||||
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
// <copyright file="BinaryContentResult.cs" company="SemanticArchitecture">
|
// <copyright file="BinaryContentResult.cs" company="SemanticArchitecture">
|
||||||
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
// http://www.SemanticArchitecture.net pkalkie@gmail.com
|
||||||
// </copyright>
|
// </copyright>
|
||||||
@ -7,8 +9,7 @@
|
|||||||
// </summary>
|
// </summary>
|
||||||
// --------------------------------------------------------------------------------------------------------------------
|
// --------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Fab2ApprovalSystem.PdfGenerator
|
namespace Fab2ApprovalSystem.PdfGenerator {
|
||||||
{
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
@ -16,29 +17,27 @@ namespace Fab2ApprovalSystem.PdfGenerator
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// An ActionResult used to send binary data to the browser.
|
/// An ActionResult used to send binary data to the browser.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class BinaryContentResult : ActionResult
|
public class BinaryContentResult : ActionResult {
|
||||||
{
|
|
||||||
private readonly string contentType;
|
private readonly string contentType;
|
||||||
private readonly byte[] contentBytes;
|
private readonly byte[] contentBytes;
|
||||||
|
|
||||||
public BinaryContentResult(byte[] contentBytes, string contentType)
|
public BinaryContentResult(byte[] contentBytes, string contentType) {
|
||||||
{
|
|
||||||
this.contentBytes = contentBytes;
|
this.contentBytes = contentBytes;
|
||||||
this.contentType = contentType;
|
this.contentType = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ExecuteResult(ControllerContext context)
|
public override void ExecuteResult(ControllerContext context) {
|
||||||
{
|
|
||||||
var response = context.HttpContext.Response;
|
var response = context.HttpContext.Response;
|
||||||
response.Clear();
|
response.Clear();
|
||||||
response.Cache.SetCacheability(HttpCacheability.Public);
|
response.Cache.SetCacheability(HttpCacheability.Public);
|
||||||
response.ContentType = this.contentType;
|
response.ContentType = this.contentType;
|
||||||
|
|
||||||
using (var stream = new MemoryStream(this.contentBytes))
|
using (var stream = new MemoryStream(this.contentBytes)) {
|
||||||
{
|
|
||||||
stream.WriteTo(response.OutputStream);
|
stream.WriteTo(response.OutputStream);
|
||||||
stream.Flush();
|
stream.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user