WIP: Filters
This commit is contained in:
parent
42b1ca72a6
commit
10565fb1da
@ -131,6 +131,8 @@
|
|||||||
<Compile Include="Parameters.vb" />
|
<Compile Include="Parameters.vb" />
|
||||||
<Compile Include="Patterns.vb" />
|
<Compile Include="Patterns.vb" />
|
||||||
<Compile Include="Report\ReportGenerator.vb" />
|
<Compile Include="Report\ReportGenerator.vb" />
|
||||||
|
<Compile Include="Templates\FilterConfig.vb" />
|
||||||
|
<Compile Include="Templates\FilterConfigItem.vb" />
|
||||||
<Compile Include="Templates\GeneralConfig.vb" />
|
<Compile Include="Templates\GeneralConfig.vb" />
|
||||||
<Compile Include="Templates\MandatorConfig.vb" />
|
<Compile Include="Templates\MandatorConfig.vb" />
|
||||||
<Compile Include="Templates\MandatorConfigItem.vb" />
|
<Compile Include="Templates\MandatorConfigItem.vb" />
|
||||||
|
|||||||
5
MultiTool.Common/Templates/FilterConfig.vb
Normal file
5
MultiTool.Common/Templates/FilterConfig.vb
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Namespace Templates
|
||||||
|
Public Class FilterConfig
|
||||||
|
Public Property Items As New List(Of FilterConfigItem)
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
8
MultiTool.Common/Templates/FilterConfigItem.vb
Normal file
8
MultiTool.Common/Templates/FilterConfigItem.vb
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
Namespace Templates
|
||||||
|
Public Class FilterConfigItem
|
||||||
|
Public Property Guid As Integer
|
||||||
|
Public Property SQLCommand As String
|
||||||
|
Public Property TableId As Integer
|
||||||
|
Public Property ColumnName As String
|
||||||
|
End Class
|
||||||
|
End Namespace
|
||||||
@ -10,11 +10,14 @@ Namespace Templates
|
|||||||
Private ReadOnly ns As XNamespace = "http://www.w3.org/2001/XMLSchema"
|
Private ReadOnly ns As XNamespace = "http://www.w3.org/2001/XMLSchema"
|
||||||
|
|
||||||
Public Property TemplateList As List(Of Template)
|
Public Property TemplateList As List(Of Template)
|
||||||
|
|
||||||
Public Property TemplateConfiguration As New TemplateConfig
|
Public Property TemplateConfiguration As New TemplateConfig
|
||||||
Public Property MappingConfiguration As New MappingConfig
|
Public Property MappingConfiguration As New MappingConfig
|
||||||
Public Property MandatorConfiguration As New MandatorConfig
|
Public Property MandatorConfiguration As New MandatorConfig
|
||||||
Public Property GeneralConfiguration As New GeneralConfig
|
Public Property GeneralConfiguration As New GeneralConfig
|
||||||
|
Public Property FilterConfiguration As New FilterConfig
|
||||||
|
|
||||||
|
Private Const SQL_TBMT_FILTERS = "SELECT * FROM [DD_ECM].[dbo].[TBMT_FILTERS]"
|
||||||
Private Const SQL_VWMT_ITEMS = "SELECT * FROM [DD_ECM].[dbo].[VWMT_ITEMS]"
|
Private Const SQL_VWMT_ITEMS = "SELECT * FROM [DD_ECM].[dbo].[VWMT_ITEMS]"
|
||||||
Private Const SQL_VWMT_MAPPING = "SELECT * FROM [DD_ECM].[dbo].[VWMT_MAPPING]"
|
Private Const SQL_VWMT_MAPPING = "SELECT * FROM [DD_ECM].[dbo].[VWMT_MAPPING]"
|
||||||
Private Const SQL_TBMT_MANDATORS = "SELECT * FROM [DD_ECM].[dbo].[TBMT_MANDATORS] ORDER BY ORDER_KEY"
|
Private Const SQL_TBMT_MANDATORS = "SELECT * FROM [DD_ECM].[dbo].[TBMT_MANDATORS] ORDER BY ORDER_KEY"
|
||||||
@ -25,6 +28,32 @@ Namespace Templates
|
|||||||
MyBase.New(pLogConfig, pMSSQL)
|
MyBase.New(pLogConfig, pMSSQL)
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Public Async Function LoadFilterConfiguration() As Task(Of Boolean)
|
||||||
|
Try
|
||||||
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBMT_FILTERS)
|
||||||
|
Dim oFilters As New List(Of FilterConfigItem)
|
||||||
|
|
||||||
|
For Each oRow As DataRow In oTable.Rows
|
||||||
|
Dim oFilter As New FilterConfigItem With {
|
||||||
|
.Guid = oRow.Item("GUID"),
|
||||||
|
.SQLCommand = oRow.ItemEx("SQL_COMMAND", String.Empty),
|
||||||
|
.TableId = oRow.ItemEx("TABLE_ID", 0),
|
||||||
|
.ColumnName = oRow.ItemEx("COLUMN_NAME", String.Empty)
|
||||||
|
}
|
||||||
|
|
||||||
|
oFilters.Add(oFilter)
|
||||||
|
Next
|
||||||
|
|
||||||
|
FilterConfiguration.Items = oFilters
|
||||||
|
|
||||||
|
Return True
|
||||||
|
Catch ex As Exception
|
||||||
|
Logger.Error(ex)
|
||||||
|
Return False
|
||||||
|
|
||||||
|
End Try
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Async Function LoadTemplates() As Task(Of Boolean)
|
Public Async Function LoadTemplates() As Task(Of Boolean)
|
||||||
Try
|
Try
|
||||||
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBMT_TEMPLATES)
|
Dim oTable As DataTable = Await Database.GetDatatableAsync(SQL_TBMT_TEMPLATES)
|
||||||
|
|||||||
@ -414,6 +414,23 @@ Namespace Winline
|
|||||||
oResponseBody = oXml
|
oResponseBody = oXml
|
||||||
Return oResponseBody
|
Return oResponseBody
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
|
Private Function ApplyItemFiltersForExport(pDocument As Entities.ExportDocument, pTemplate As Template, pMandator As Mandator, oResponseBody As String) As String
|
||||||
|
Dim oDoc As New XmlDocument()
|
||||||
|
oDoc.LoadXml(oResponseBody)
|
||||||
|
|
||||||
|
'TODO: Load filters and apply
|
||||||
|
|
||||||
|
Dim oArray As Byte()
|
||||||
|
Using oStream As New IO.MemoryStream
|
||||||
|
oDoc.Save(oStream)
|
||||||
|
oArray = oStream.ToArray()
|
||||||
|
End Using
|
||||||
|
|
||||||
|
Dim oXml = Text.Encoding.UTF8.GetString(oArray)
|
||||||
|
oResponseBody = oXml
|
||||||
|
Return oResponseBody
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -9,6 +9,7 @@ Namespace My
|
|||||||
Friend Property MappingConfiguration As MappingConfig
|
Friend Property MappingConfiguration As MappingConfig
|
||||||
Friend Property MandatorConfiguration As MandatorConfig
|
Friend Property MandatorConfiguration As MandatorConfig
|
||||||
Friend Property GeneralConfiguration As GeneralConfig
|
Friend Property GeneralConfiguration As GeneralConfig
|
||||||
|
Friend Property FilterConfiguration As FilterConfig
|
||||||
Friend Property Winline As WinlineData
|
Friend Property Winline As WinlineData
|
||||||
End Module
|
End Module
|
||||||
End Namespace
|
End Namespace
|
||||||
|
|||||||
@ -114,12 +114,14 @@ Public Class frmMain
|
|||||||
Await TemplateLoader.LoadGeneralConfiguration()
|
Await TemplateLoader.LoadGeneralConfiguration()
|
||||||
Await TemplateLoader.LoadMappingConfiguration()
|
Await TemplateLoader.LoadMappingConfiguration()
|
||||||
Await TemplateLoader.LoadMandatorConfiguration()
|
Await TemplateLoader.LoadMandatorConfiguration()
|
||||||
|
Await TemplateLoader.LoadFilterConfiguration()
|
||||||
|
|
||||||
' Save Schema data in 'My' Namespace
|
' Save Schema data in 'My' Namespace
|
||||||
My.MappingConfiguration = TemplateLoader.MappingConfiguration
|
My.MappingConfiguration = TemplateLoader.MappingConfiguration
|
||||||
My.TemplateConfiguration = TemplateLoader.TemplateConfiguration
|
My.TemplateConfiguration = TemplateLoader.TemplateConfiguration
|
||||||
My.MandatorConfiguration = TemplateLoader.MandatorConfiguration
|
My.MandatorConfiguration = TemplateLoader.MandatorConfiguration
|
||||||
My.GeneralConfiguration = TemplateLoader.GeneralConfiguration
|
My.GeneralConfiguration = TemplateLoader.GeneralConfiguration
|
||||||
|
My.FilterConfiguration = TemplateLoader.FilterConfiguration
|
||||||
|
|
||||||
Dim oBindingSource = New BindingList(Of Template)
|
Dim oBindingSource = New BindingList(Of Template)
|
||||||
For Each oTemplate As Template In TemplateLoader.TemplateList
|
For Each oTemplate As Template In TemplateLoader.TemplateList
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user