text stringlengths 43 2.01M |
|---|
Imports DevExpress.DevAV.DevAVDbDataModel
Imports DevExpress.DevAV.ViewModels
Imports DevExpress.Spreadsheet
Imports DevExpress.Xpf.Spreadsheet
Imports DevExpress.XtraRichEdit
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Data
Imports System.Windows.Documents
Imports System.Windows.Input
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports System.Windows.Navigation
Imports System.Windows.Shapes
Imports DevExpress.DevAV.Reports.Spreadsheet
Namespace DevExpress.DevAV.Views
''' <summary>
''' Interaction logic for InvoiceEditorView.xaml
''' </summary>
Partial Public Class OrderView
Inherits UserControl
Public Sub New()
InitializeComponent()
End Sub
End Class
Public Class CellTemplateSelector
Inherits DataTemplateSelector
Public Property AddOrderItemTemplate() As DataTemplate
Public Property DeleteOrderItemTemplate() As DataTemplate
Public Overrides Function SelectTemplate(ByVal item As Object, ByVal container As DependencyObject) As DataTemplate
Dim cell = DirectCast(item, CellData).Cell
If IsInvoiceWorksheet(cell) AndAlso IsRangeForAddCommand(cell, GetInvoiceItems(cell)) Then
Return AddOrderItemTemplate
End If
If IsInvoiceWorksheet(cell) AndAlso IsRangeForDeleteCommand(cell, GetInvoiceItems(cell)) Then
Return DeleteOrderItemTemplate
End If
Return MyBase.SelectTemplate(item, container)
End Function
Private Function IsRangeForDeleteCommand(ByVal cell As Cell, ByVal invoiceItems As DefinedName) As Boolean
Return invoiceItems IsNot Nothing AndAlso invoiceItems.Range IsNot Nothing AndAlso cell.ColumnIndex = 10 AndAlso invoiceItems.Range.RowCount > 1 AndAlso cell.RowIndex >= invoiceItems.Range.TopRowIndex AndAlso cell.RowIndex <= invoiceItems.Range.BottomRowIndex
End Function
Private Function IsRangeForAddCommand(ByVal cell As Cell, ByVal invoiceItems As DefinedName) As Boolean
Return cell.ColumnIndex = 6 AndAlso cell.RowIndex = (If(invoiceItems Is Nothing OrElse invoiceItems.Range Is Nothing, 21, invoiceItems.Range.BottomRowIndex + 1))
End Function
Private Function GetInvoiceItems(ByVal cell As Cell) As DefinedName
Return cell.Worksheet.DefinedNames.GetDefinedName("InvoiceItems")
End Function
Private Function IsInvoiceWorksheet(ByVal cell As Cell) As Boolean
Return cell.Worksheet.Name = CellsHelper.InvoiceWorksheetName
End Function
End Class
End Namespace
|
Sub VBA_Challenge_IR_StockStats():
'Define variables
Dim ticker As String
Dim number_tickers As Integer
Dim opening_price As Double
Dim closing_price As Double
Dim yearly_change As Double
Dim percentage_change As Double
Dim total_volume As Double
Dim greatest_increase as Double
Dim greatest_increase_ticker as String
Dim greatest_drecrease as Double
Dim greatest_decrease_ticker as String
Dim greatest_volume as Double
Dim greates_volume_ticker as String
'last row of each worksheet
Dim lastRow As Long
'Loop trough all the stocks
For Each ws In Worksheets
ws.Activate
'Find the last row
lastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
'Set variables at 0
ticker = ""
number_tickers = 0
opening_price = 0
yearly_change = 0
percentage_change = 0
total_volume = 0
'Add print table
ws.Range("I1").Value = "Ticker"
ws.Range("J1").Value = "Yearly Change"
ws.Range("K1").Value = "Percent Change"
ws.Range("L1").Value = "Total Stock Volume"
'To skip first line (headers)
For i = 2 To lastRow
'Get ticker value
ticker = Cells(i, 1).Value
'Get year opening for ticker
If opening_price = 0 Then
opening_price = Cells(i, 3).Value
End If
'Add up the total stock volume
total_volume = total_volume + Cells(i, 7).Value
'For when we get to a different ticker
If Cells(i + 1, 1).Value <> ticker Then
number_tickers = number_tickers + 1
Cells(number_tickers + 1, 9) = ticker
'Get closing price
closing_price = Cells(i, 6)
'Get yearly change
yearly_change = closing_price - opening_price
'Print yearly change
Cells(number_tickers + 1, 10).Value = yearly_change
'Color conditions
If yearly_change > 0 Then
Cells(number_tickers + 1, 10).Interior.ColorIndex = 4
ElseIf yearly_change < 0 Then
Cells(number_tickers + 1, 10).Interior.ColorIndex = 3
Else
Cells(number_tickers + 1, 10).Interior.ColorIndex = 6
End If
'Calculate percent change
If opening_price = 0 Then
percentage_change = 0
Else
percentage_change = (yearly_change / opening_price)
End If
'Format the percent_change value as a percent.
Cells(number_tickers + 1, 11).Value = Format(percentage_change, "Percent")
'Set opening price back to 0 as soon as get a different ticker
opening_price = 0
'Print total volume
Cells(number_tickers + 1, 12).Value = total_volume
'Set total volume back to 0 as soon as we get a different ticker
total_volume = 0
End If
Next i
'BONUS
Range("O2").Value = "Greatest % Increase"
Range("O3").Value = "Greatest % Decrease"
Range("O4").Value = "Greatest Total Volume"
Range("P1").Value = "Ticker"
Range("Q1").Value = "Value"
lastRowState = ws.Cells(Rows.Count, "I").End(xlUp).Row
'Initialize variables at first values
greatest_increase = Cells(2, 11).Value
greatest_increase_ticker = Cells(2, 9).Value
greatest_decrease = Cells(2, 11).Value
greatest_decrease_ticker = Cells(2, 9).Value
greatest_volume = Cells(2, 12).Value
greatest_volume_ticker = Cells(2, 9).Value
'Loop for bonus
For i = 2 To lastRowState
'Find ticker with greatest increase
If Cells(i, 11).Value > greatest_increase Then
greatest_increase = Cells(i, 11).Value
greatest_increase_ticker = Cells(i, 9).Value
End If
'Find ticker with the greatest decrease
If Cells(i, 11).Value < greatest_decrease Then
greatest_decrease = Cells(i, 11).Value
greatest_decrease_ticker = Cells(i, 9).Value
End If
'Find the ticker with the greatest stock volume.
If Cells(i, 12).Value > greatest_volume Then
greatest_volume = Cells(i, 12).Value
greatest_volume_ticker = Cells(i, 9).Value
End If
Next i
'PRINT BONUS TABLE
Range("P2").Value = Format(greatest_increase_ticker, "Percent")
Range("Q2").Value = Format(greatest_increase, "Percent")
Range("P3").Value = Format(greatest_decrease_ticker, "Percent")
Range("Q3").Value = Format(greatest_decrease, "Percent")
Range("P4").Value = greatest_volume_ticker
Range("Q4").Value = greatest_volume
Next ws
End Sub
|
Public Class frmFichaIncidencia
Const mc_strNombre_Modulo As String = "frmFichaIncidencia"
'Incidencia
Private m_objIncidencia As clsIncidencia
Enum ActualForm
Detalles
Historial
Presupuesto
End Enum
Public Function blnCargarIncidencia(Optional ByVal dtrIncidencia As DataGridViewRow = Nothing, Optional ByVal lngId As Long = -1) As Boolean
Const strNombre_Funcion As String = "frmIncidencia_Load"
Dim blnError As Boolean
Dim blnResultado As Boolean
Try
'En caso de ser necesario se limpiara el formulario
If Not dtrIncidencia Is Nothing Then
m_objIncidencia = New clsIncidencia(dtrIncidencia)
Else
If lngId > 0 Then
m_objIncidencia = New clsIncidencia(, lngId)
Else
m_objIncidencia = New clsIncidencia
End If
End If
blnResultado = frmDetallesIncidencia.blnCargarDetalles(m_objIncidencia)
If blnResultado Then
blnResultado = frmHistorialActuacion.blnCargarHistorial(m_objIncidencia)
If blnResultado Then
blnResultado = frmPresupuesto.blnCargarPresupuesto(m_objIncidencia)
End If
End If
If m_objIncidencia.Id = 0 Then
'Nueva incidencia
'Se añade una linea al historico para que quede constancia de la apertura
frmHistorialActuacion.NuevoEvento(1, "Apertura de la incidencia")
Else
'Editar incidencia
End If
Catch ex As Exception
blnError = True
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
Finally
If blnError Then
blnResultado = False
End If
blnCargarIncidencia = blnResultado
End Try
End Function
Private Sub frmIncidencia_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const strNombre_Funcion As String = "frmIncidencia_Load"
Try
HabilitarClienteLineas(ActualForm.Detalles)
frmDetallesIncidencia.MdiParent = Me
frmDetallesIncidencia.Show()
frmDetallesIncidencia.WindowState = FormWindowState.Minimized
frmDetallesIncidencia.WindowState = FormWindowState.Maximized
btnDetalles.Checked = True
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub btnDetalles_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDetalles.Click
Const strNombre_Funcion As String = "btnDetalles_Click"
Try
If btnDetalles.Checked = False Then
If frmHistorialActuacion.Visible Then
frmHistorialActuacion.Hide()
btnHistorial.Checked = False
End If
If frmPresupuesto.Visible Then
frmPresupuesto.Hide()
btnPresupuesto.Checked = False
End If
HabilitarClienteLineas(ActualForm.Detalles)
frmDetallesIncidencia.MdiParent = Me
frmDetallesIncidencia.Show()
frmDetallesIncidencia.WindowState = FormWindowState.Minimized
frmDetallesIncidencia.WindowState = FormWindowState.Maximized
btnDetalles.Checked = True
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub btnHistorial_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHistorial.Click
Const strNombre_Funcion As String = "btnHistorial_Click"
Try
If btnHistorial.Checked = False Then
If frmDetallesIncidencia.Visible Then
frmDetallesIncidencia.Hide()
btnDetalles.Checked = False
End If
If frmPresupuesto.Visible Then
frmPresupuesto.Hide()
btnPresupuesto.Checked = False
End If
HabilitarClienteLineas(ActualForm.Historial)
frmHistorialActuacion.MdiParent = Me
frmHistorialActuacion.Show()
frmHistorialActuacion.WindowState = FormWindowState.Minimized
frmHistorialActuacion.WindowState = FormWindowState.Maximized
btnHistorial.Checked = True
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub btnPresupuesto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPresupuesto.Click
Const strNombre_Funcion As String = "btnPresupuesto_Click"
Try
If btnPresupuesto.Checked = False Then
If frmDetallesIncidencia.Visible Then
frmDetallesIncidencia.Hide()
btnDetalles.Checked = False
End If
If frmHistorialActuacion.Visible Then
frmHistorialActuacion.Hide()
btnHistorial.Checked = False
End If
HabilitarClienteLineas(ActualForm.Presupuesto)
frmPresupuesto.MdiParent = Me
frmPresupuesto.Show()
frmPresupuesto.WindowState = FormWindowState.Minimized
frmPresupuesto.WindowState = FormWindowState.Maximized
btnPresupuesto.Checked = True
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub HabilitarClienteLineas(ByVal evlFormulario As ActualForm)
Const strNombre_Funcion As String = "HabilitarClienteLineas"
Try
Select Case evlFormulario
Case ActualForm.Detalles
tspLin1.Items(0).Enabled = False
tspLin2.Items(0).Enabled = False
tspLin2.Items(1).Enabled = False
tspLin2.Items(2).Enabled = False
tspCli1.Items(0).Enabled = True
If frmDetallesIncidencia.ObtenerCliente <> 0 Then
tspCli2.Items(0).Enabled = True
Else
tspCli2.Items(0).Enabled = False
End If
tspCli2.Items(1).Enabled = True
Case ActualForm.Historial
tspLin1.Items(0).Enabled = True
tspLin2.Items(0).Enabled = True
tspLin2.Items(1).Enabled = True
tspLin2.Items(2).Enabled = True
tspCli1.Items(0).Enabled = False
tspCli2.Items(0).Enabled = False
tspCli2.Items(1).Enabled = False
Case ActualForm.Presupuesto
tspLin1.Items(0).Enabled = True
tspLin2.Items(0).Enabled = True
tspLin2.Items(1).Enabled = False
tspLin2.Items(2).Enabled = True
tspCli1.Items(0).Enabled = False
tspCli2.Items(0).Enabled = False
tspCli2.Items(1).Enabled = False
End Select
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Friend WriteOnly Property Presupuesto As String
Set(ByVal value As String)
lblPresupuesto.Text = value
End Set
End Property
Private Sub Mantenimiento_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGuardar.Click, btnGuardarySeguir.Click, btnImprimir.Click
Const strNombre_Funcion As String = "Mantenimiento_Click"
Dim objBoton As ToolStripButton
Try
objBoton = sender
Select Case objBoton.Name
Case btnGuardar.Name
GuardarIncidencia(True, False)
Case btnGuardarySeguir.Name
GuardarIncidencia(False, False)
Case btnImprimir.Name
'Imprimir la incidencia en la impresora de tickets
If MsgBox("La incidencia debe guardarse antes de imprimir ¿Desea guardar la incidencia ahora?", _
MsgBoxStyle.Question + MsgBoxStyle.OkCancel, "Faltan datos") = vbOK Then
GuardarIncidencia(False, True)
If frmImprimirIncidencia.CargarFormulario(m_objIncidencia.Id, gv_lngTipoImpresoIncidencia) Then
frmImprimirIncidencia.ShowDialog()
Else
MsgBox("Ha ocurrido un error al cargar la impresion", MsgBoxStyle.Critical, "Imprimir incidencia")
End If
End If
End Select
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub GuardarIncidencia(ByVal blnCerrar As Boolean, ByVal blnDesdeImprimir As Boolean)
Const strNombre_Funcion As String = "GuardarIncidencia"
Dim objIncidencia As New clsIncidencia
Dim lngEstado As Long
Dim strResolucion As String
Try
If frmDetallesIncidencia.GuardarIncidencia(objIncidencia) Then
If objIncidencia.Estado >= 3 And objIncidencia.Resolucion = "" Then
MsgBox("El campo Resolucion no puede estar vacio si la incidencia se guarda como terminada, avisado, cerrada o En garantia", _
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Faltan datos")
ElseIf objIncidencia.IdCliente = 0 Then
MsgBox("Debe seleccionar un cliente o crear uno nuevo", _
MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Faltan datos")
Else
lngEstado = m_objIncidencia.Estado
strResolucion = m_objIncidencia.Resolucion
If lngEstado <> objIncidencia.Estado Then
'Crear evento de cambio de estado
frmHistorialActuacion.NuevoEvento(objIncidencia.Estado, "La incidencia pasa al estado: " & ObtenerEstado(objIncidencia.Estado))
End If
If Not String.Equals(strResolucion, objIncidencia.Resolucion) Then
'Crear evento de cambio de resolucion
frmHistorialActuacion.NuevoEvento(objIncidencia.Estado, "La resolucion de la incidencia es: " & objIncidencia.Resolucion)
End If
objIncidencia.Historial = frmHistorialActuacion.GuardarHistorial()
objIncidencia.Presupuesto = frmPresupuesto.GuardarPresupuesto()
If Inci_GuardarIncidencia(objIncidencia) Then
m_objIncidencia = objIncidencia
frmDetallesIncidencia.blnCargarDetalles(m_objIncidencia)
If Not blnDesdeImprimir Then
MsgBox("Se ha guardado la incidencia", _
MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "Salvado de datos")
End If
If blnCerrar Then
frmDetallesIncidencia.Close()
frmHistorialActuacion.Close()
frmPresupuesto.Close()
Me.Close()
End If
Else
MsgBox("Error al guardar la incidencia", _
MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Salvado de datos")
End If
End If
Else
MsgBox("Error al recuperar los datos de la incidencia para su guardado", _
MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "Salvado de datos")
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub Cliente_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBuscar.Click, btnVerCliente.Click, btnNuevoCliente.Click
Const strNombre_Funcion As String = "Cliente_Click"
Dim objBoton As ToolStripButton
Dim objCliente As clsCliente
Try
objBoton = sender
Select Case objBoton.Name
Case btnBuscar.Name
blnBuscarCliente
Case btnVerCliente.Name
objCliente = New clsCliente(, frmDetallesIncidencia.ObtenerCliente)
If frmFichaCliente.blnCargarCliente(objCliente) Then
frmFichaCliente.ShowDialog()
objCliente = frmFichaCliente.Cliente
frmDetallesIncidencia.AnadirCliente = objCliente
End If
Case btnNuevoCliente.Name
objCliente = New clsCliente
If frmFichaCliente.blnCargarCliente(objCliente) Then
frmFichaCliente.ShowDialog()
objCliente = frmFichaCliente.Cliente
frmDetallesIncidencia.AnadirCliente = objCliente
End If
End Select
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Public Function blnBuscarCliente(Optional ByVal lngIdCLiente As Long = 0) As Boolean
Const strNombre_Funcion As String = "Cliente_Click"
Dim blnError As Boolean
Dim objCliente As clsCliente
Try
If lngIdCLiente > 0 Then
objCliente = New clsCliente(, lngIdCLiente)
If Not objCliente Is Nothing Then
If objCliente.Id > 0 Then
frmDetallesIncidencia.AnadirCliente = objCliente
HabilitarClienteLineas(ActualForm.Detalles)
End If
End If
Else
frmBusquedaClientes.ShowDialog()
objCliente = frmBusquedaClientes.Cliente
If Not objCliente Is Nothing Then
If objCliente.Id > 0 Then
frmDetallesIncidencia.AnadirCliente = objCliente
HabilitarClienteLineas(ActualForm.Detalles)
End If
End If
End If
Catch ex As Exception
blnError = True
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
Finally
blnBuscarCliente = not blnError
End Try
End Function
Private Sub Lineas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNueva.Click, btnDuplicar.Click, btnModificar.Click, btnEliminar.Click
Const strNombre_Funcion As String = "Lineas_Click"
Dim objBoton As ToolStripButton
Try
objBoton = sender
If frmHistorialActuacion.Visible Then
Select Case objBoton.Name
Case btnNueva.Name
frmHistorialActuacion.NuevaLinea()
Case btnDuplicar.Name
frmHistorialActuacion.DuplicarLinea()
Case btnModificar.Name
frmHistorialActuacion.ModificarLinea()
Case btnEliminar.Name
frmHistorialActuacion.EliminarLinea()
End Select
ElseIf frmPresupuesto.Visible Then
Select Case objBoton.Name
Case btnNueva.Name
frmPresupuesto.NuevaLinea()
Case btnDuplicar.Name
frmPresupuesto.DuplicarLinea()
Case btnEliminar.Name
frmHistorialActuacion.EliminarLinea()
End Select
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Private Sub frmIncidencia_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
Const strNombre_Funcion As String = "frmIncidencia_FormClosing"
Dim objForm As Windows.Forms.Form
Try
For Each objForm In Me.MdiChildren
objForm.Close()
Next
btnDetalles.Checked = False
btnPresupuesto.Checked = False
btnHistorial.Checked = False
tspLin1.Items(0).Enabled = True
tspLin2.Items(0).Enabled = True
tspLin2.Items(1).Enabled = True
tspLin2.Items(2).Enabled = True
tspCli1.Items(0).Enabled = True
tspCli2.Items(0).Enabled = True
tspCli2.Items(1).Enabled = True
lblEstado.Text = ""
lblPresupuesto.Text = Format(0, "0.00 €")
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
End Class |
Imports System.Xml
Public MustInherit Class PurchaseReader
Implements IPurchaseReader
Private m_source As String = Nothing
Private m_title As String = Nothing
Private m_images As List(Of Image)
Private m_endOfValidity As DateTime? = Nothing
Private m_currentCost As Single? = Nothing
Private m_comments As String
Public MustOverride Function GetBaseUrl() As String Implements IPurchaseReader.GetBaseUrl
Public MustOverride Function GetSiteName() As String Implements IPurchaseReader.GetSiteName
Protected MustOverride Function ExtractTitle(ByVal source As HtmlDocument) As String
Protected MustOverride Function ExtractImages(ByVal source As HtmlDocument) As List(Of Image)
Protected MustOverride Function ExtractEndOfValidity(ByVal source As HtmlDocument) As DateTime?
Protected MustOverride Function ExtractCurrentCost(ByVal source As HtmlDocument) As Single?
Protected MustOverride Function ExtractComments(ByVal source As HtmlDocument) As String
Public Sub ReadSource(source As String) Implements IPurchaseReader.ReadSource
m_source = source
If Not String.IsNullOrEmpty(source) Then
Dim doc As HtmlDocument = GetDocument(source)
m_title = ExtractTitle(doc)
If String.IsNullOrEmpty(m_title) Then
m_title = "Sans titre"
End If
m_images = ExtractImages(doc)
If m_images Is Nothing Then
m_images = New List(Of Image)
End If
m_endOfValidity = ExtractEndOfValidity(doc)
m_currentCost = ExtractCurrentCost(doc)
m_comments = ExtractComments(doc)
End If
End Sub
Private Function GetDocument(source As String) As HtmlDocument
Dim browser = New WebBrowser()
browser.ScriptErrorsSuppressed = True
browser.DocumentText = source
browser.Document.OpenNew(True)
browser.Document.Write(source)
browser.Refresh()
Return browser.Document
End Function
Public Function GetImages() As List(Of Image) Implements IPurchaseReader.GetImages
Dim images As New List(Of Image)
For Each img As Image In m_images
images.Add(img.Clone())
Next
Return images
End Function
Public Function GetTitle() As String Implements IPurchaseReader.GetTitle
Return m_title
End Function
Public Function GetEndOfValidity() As DateTime? Implements IPurchaseReader.GetEndOfValidity
Return m_endOfValidity
End Function
Public Function GetCurrentCost() As Single? Implements IPurchaseReader.GetCurrentCost
Return m_currentCost
End Function
Public Function GetComments() As String Implements IPurchaseReader.GetComments
Return m_comments
End Function
End Class
|
'===============================================================================
' Microsoft Caching Application Block for .NET
' http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag/html/CachingBlock.asp
'
' Delegates.vb
' This class has all the delegates required for the caching operations.
'
'===============================================================================
' Copyright (C) 2003 Microsoft Corporation
' All rights reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
' OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
' LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR
' FITNESS FOR A PARTICULAR PURPOSE.
'===============================================================================
' <summary>
' Represents the method that will handle the dependency change event.
' </summary>
Public Delegate Sub ItemDependencyChangeEventHandler ( _
ByVal sender As Object, _
ByVal e As CacheEventArgs)
' <summary>
' Represents the method that will be invoked when a item is removed.
' </summary>
Public Delegate Sub CacheItemRemovedCallback (ByVal key As String, _
ByVal cause As CacheItemRemoveCause)
' <summary>
' Represents the method that will handle the addition of item metadata.
' </summary>
Delegate Sub AddDataHandler (ByVal key As String, ByVal expirations() _
As ICacheItemExpiration, ByVal priority As CacheItemPriority, _
ByVal onRemoveCallback As CacheItemRemovedCallback)
' <summary>
' Represents the method that will handle the flushing of all the items.
' </summary>
Delegate Sub FlushHandler()
' <summary>
' Represents the method that will handle the retrieval of the cache item.
' </summary>
Delegate Function GetHandler (ByVal key As String) As CacheItem
' <summary>
' Represents the method that will handle the time when the item
' is last used.
' </summary>
Delegate Sub NotifyHandler (ByVal key As String)
' <summary>
' Represents the method that will handle the removal of the item
' metadata.
' </summary>
Delegate Sub RemoveDataHandler (ByVal key As String)
' <summary>
' Represents the method that will handle the updation of item metadata.
' </summary>
Delegate Sub UpdateHandler (ByVal key As String, ByVal expirations() _
As ICacheItemExpiration, ByVal priority As CacheItemPriority)
|
Imports System.Collections.Specialized
Imports System.Configuration
Imports System.Resources
Imports System.Xml
Imports System.Globalization
Imports System.Security
#Region "Configuration Class Definitions"
#Region "Enum Definitions"
''' -----------------------------------------------------------------------------
''' <summary>
''' Enum containing the mode options for the exceptionManagement tag.
''' </summary>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Enum ExceptionManagementMode
' The ExceptionManager should not process exceptions.
[Off]
' The ExceptionManager should process exceptions. This is the default.
[On]
End Enum
'ExceptionManagementMode
''' -----------------------------------------------------------------------------
''' <summary>
''' Enum containing the mode options for the publisher tag.
''' </summary>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Enum PublisherMode
' The ExceptionManager should not call the publisher.
[Off]
' The ExceptionManager should call the publisher. This is the default.
[On]
End Enum
'PublisherMode
''' -----------------------------------------------------------------------------
''' <summary>
''' Enum containing the format options for the publisher tag.
''' </summary>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Enum PublisherFormat
' The ExceptionManager should call the Interfaces.IExceptionPublisher interface of the publisher.
' This is the default.
Exception
' The ExceptionManager should call the Interfaces.IExceptionXmlPublisher interface of the publisher.
Xml
End Enum
'PublisherFormat
#End Region
#Region "Class Definitions"
''' -----------------------------------------------------------------------------
''' Project : Core.ExceptionManagement
''' Class : ExceptionManagement.ExceptionManagementSettings
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' Class that defines the exception management settings in the config file.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class ExceptionManagementSettings
Private m_mode As ExceptionManagementMode = ExceptionManagementMode.On
Private m_publishers As New ArrayList()
''' -----------------------------------------------------------------------------
''' <summary>
''' Specifies the whether the exceptionManagement settings are "on" or "off".
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property Mode() As ExceptionManagementMode
Get
Return m_mode
End Get
Set (ByVal Value As ExceptionManagementMode)
m_mode = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' An ArrayList containing all of the PublisherSettings listed in the config file.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property Publishers() As ArrayList
Get
Return m_publishers
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Adds a PublisherSettings to the arraylist of publishers.
''' </summary>
''' <param name="publisher"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub AddPublisher (ByVal publisher As PublisherSettings)
Publishers.Add (publisher)
End Sub
'AddPublisher
End Class
'ExceptionManagementSettings
''' -----------------------------------------------------------------------------
''' Project : Core.ExceptionManagement
''' Class : ExceptionManagement.PublisherSettings
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' Class that defines the publisher settings within the exception management settings in the config file.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class PublisherSettings
Private m_mode As PublisherMode = PublisherMode.On
Private m_exceptionFormat As PublisherFormat = PublisherFormat.Exception
Private m_assemblyName As String
Private m_typeName As String
Private m_includeTypes As TypeFilter
Private m_excludeTypes As TypeFilter
Private m_otherAttributes As New NameValueCollection()
''' -----------------------------------------------------------------------------
''' <summary>
''' Specifies the whether the exceptionManagement settings are "on" or "off".
''' </summary>
''' <value></value>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property Mode() As PublisherMode
Get
Return m_mode
End Get
Set (ByVal Value As PublisherMode)
m_mode = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Specifies the whether the publisher supports the Interfaces.IExceptionXmlPublisher interface (value is set to "xml") or the publisher supports the Interfaces.IExceptionPublisher interface (value is either left off or set to "exception").
''' </summary>
''' <value></value>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property ExceptionFormat() As PublisherFormat
Get
Return m_exceptionFormat
End Get
Set (ByVal Value As PublisherFormat)
m_exceptionFormat = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' The assembly name of the publisher component that will be used to invoke the object.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property AssemblyName() As String
Get
Return m_assemblyName
End Get
Set (ByVal Value As String)
m_assemblyName = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' The type name of the publisher component that will be used to invoke the object.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property TypeName() As String
Get
Return m_typeName
End Get
Set (ByVal Value As String)
m_typeName = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' A semicolon delimited list of all exception types that the publisher will be invoked for.
''' </summary>
''' <value></value>
''' <remarks>A "*" can be used to specify all types and is the default value if this is left off.
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property IncludeTypes() As TypeFilter
Get
Return m_includeTypes
End Get
Set (ByVal Value As TypeFilter)
m_includeTypes = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' A semicolon delimited list of all exception types that the publisher will not be invoked for.
''' </summary>
''' <value></value>
''' <remarks>A "*" can be used to specify all types. The default is to exclude no types.
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property ExcludeTypes() As TypeFilter
Get
Return m_excludeTypes
End Get
Set (ByVal Value As TypeFilter)
m_excludeTypes = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Determines whether the exception type is to be filtered out based on the includes and exclude.
''' </summary>
''' <param name="exceptionType"></param>
''' <returns>True is the exception type is to be filtered out, false if it is not filtered out.</returns>
''' <remarks>exceptionType - The Type of the exception to check for filtering.
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Function IsExceptionFiltered (ByVal exceptionType As Type) As Boolean
' If no types are excluded then the exception type is not filtered.
If m_excludeTypes Is Nothing Then
Return False
End If
' If the Type is in the Exclude Filter
If (MatchesFilter (exceptionType, ExcludeTypes)) Then
' If the Type is in the Include Filter
If (MatchesFilter (exceptionType, IncludeTypes)) Then
'The Type is not filtered out because it was explicitly Included.
Return False
'If the Type is not in the Include Filter
Else
'The Type is filtered because it was Excluded and did not match the Include Filter.
Return True
End If
'Otherwise it is not Filtered.
Else
' The Type is not filtered out because it did not match the Exclude Filter.
Return False
End If
End Function
'IsExceptionFiltered
''' -----------------------------------------------------------------------------
''' <summary>
''' Determines if a type is contained the supplied filter.
''' </summary>
''' <param name="TypeToCompare"></param>
''' <param name="Filter"></param>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Private Function MatchesFilter (ByVal TypeToCompare As Type, ByVal Filter As TypeFilter) As Boolean
Dim m_typeInfo As TypeInfo
Dim i As Short
'If no filter is provided type does not match the filter.
If Filter Is Nothing Then Return False
'If all types are accepted in the filter (using the "*") return true.
If Filter.AcceptAllTypes Then Return True
For i = 0 To Filter.Types.Count - 1
m_typeInfo = CType (Filter.Types (i), TypeInfo)
'If the Type matches this type in the Filter, then return true.
If m_typeInfo.ClassType.Equals (TypeToCompare.GetType) Then Return True
'If the filter type includes SubClasses of itself (it had a "+" before the type in the
'configuration file) AND the Type is a SubClass of the filter type, then return true.
If m_typeInfo.IncludeSubClasses = True AndAlso m_typeInfo.ClassType.IsAssignableFrom (TypeToCompare) Then _
Return True
Next
'If no matches are found return false
Return False
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' A collection of any other attributes included within the publisher tag in the config file.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property OtherAttributes() As NameValueCollection
Get
Return m_otherAttributes
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Allows name/value pairs to be added to the Other Attributes collection.
''' </summary>
''' <param name="name"></param>
''' <param name="value"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub AddOtherAttributes (ByVal name As String, ByVal value As String)
OtherAttributes.Add (name, value)
End Sub
'AddOtherAttributes
End Class
'PublisherSettings
''' -----------------------------------------------------------------------------
''' Project : Core.ExceptionManagement
''' Class : ExceptionManagement.TypeFilter
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' TypeFilter class stores contents of the Include and Exclude filters provided in the configuration file
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class TypeFilter
Private m_acceptAllTypes As Boolean = False
Private m_types As ArrayList = New ArrayList()
'Indicates if all types should be accepted for a filter
Public Property AcceptAllTypes() As Boolean
Get
Return m_acceptAllTypes
End Get
Set (ByVal Value As Boolean)
m_acceptAllTypes = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Collection of types for the filter
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public ReadOnly Property Types() As ArrayList
Get
Return m_types
End Get
End Property
End Class
''' -----------------------------------------------------------------------------
''' Project : Core.ExceptionManagement
''' Class : ExceptionManagement.TypeInfo
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' TypeInfo class contains information about each type within a TypeFilter
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class TypeInfo
Private m_classType As Type
Private m_includeSubClasses As Boolean = False
''' -----------------------------------------------------------------------------
''' <summary>
''' Indicates if subclasses are to be included with the type specified in the Include and Exclude filters.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property IncludeSubClasses() As Boolean
Get
Return m_includeSubClasses
End Get
Set (ByVal Value As Boolean)
m_includeSubClasses = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' The Type class representing the type specified in the Include and Exclude filters
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Property ClassType() As Type
Get
Return m_classType
End Get
Set (ByVal Value As Type)
m_classType = Value
End Set
End Property
End Class
#End Region
#End Region
#Region "ExceptionManagerSectionHandler"
''' -----------------------------------------------------------------------------
''' Project : Core.ExceptionManagement
''' Class : ExceptionManagement.ExceptionManagerSectionHandler
'''
''' -----------------------------------------------------------------------------
''' <summary>
''' The Configuration Section Handler for the "exceptionManagement" section of the config file.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Class ExceptionManagerSectionHandler
Implements IConfigurationSectionHandler
#Region "Constructors"
''' -----------------------------------------------------------------------------
''' <summary>
''' The constructor for the ExceptionManagerSectionHandler to initialize the resource file.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Sub New()
' Load Resource File for localized text.
m_resourceManager = _
New ResourceManager (Me.GetType().Namespace + ".ExceptionManagerText", Me.GetType().Assembly)
End Sub
'New
#End Region
#Region "Declare Variables"
' Member variables.
Private Shared EXCEPTION_TYPE_DELIMITER As Char = Convert.ToChar (";")
'
Private EXCEPTIONMANAGEMENT_MODE As String = "mode"
Private PUBLISHER_NODENAME As String = "publisher"
Private PUBLISHER_MODE As String = "mode"
Private PUBLISHER_ASSEMBLY As String = "assembly"
Private PUBLISHER_TYPE As String = "type"
Private PUBLISHER_EXCEPTIONFORMAT As String = "exceptionFormat"
Private PUBLISHER_INCLUDETYPES As String = "include"
Private PUBLISHER_EXCLUDETYPES As String = "exclude"
Private m_resourceManager As ResourceManager
#End Region
''' -----------------------------------------------------------------------------
''' <summary>
''' Builds the ExceptionManagementSettings and PublisherSettings structures based on the configuration file.
''' </summary>
''' <param name="parent"></param>
''' <param name="configContext"></param>
''' <param name="section"></param>
''' <returns>The ExceptionManagementSettings struct built from the configuration settings. </returns>
''' <remarks>parent - Composed from the configuration settings in a corresponding parent configuration section.<br/>
''' configContext - Provides access to the virtual path for which the configuration section handler computes configuration values. Normally this parameter is reserved and is null. <br/>
''' section - The XML node that contains the configuration information to be handled. section provides direct access to the XML contents of the configuration section.
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Public Overridable Function Create (ByVal parent As Object, ByVal configContext As Object, ByVal section As XmlNode) _
As Object Implements IConfigurationSectionHandler.Create
'Dim settings As New ExceptionManagementSettings()
'Dim currentAttribute As XmlNode
'Dim nodeAttributes As XmlAttributeCollection = section.Attributes
Dim publisherSettings As PublisherSettings
Dim node As XmlNode
Dim i As Integer
Dim j As Integer
Try
Dim settings As New ExceptionManagementSettings
' Exit if there are no configuration settings.
If section Is Nothing Then
Return settings
End If
Dim currentAttribute As XmlNode
Dim nodeAttributes As XmlAttributeCollection = section.Attributes
' Get the mode attribute.
currentAttribute = nodeAttributes.RemoveNamedItem (EXCEPTIONMANAGEMENT_MODE)
If _
Not (currentAttribute Is Nothing) AndAlso _
currentAttribute.Value.ToUpper (CultureInfo.InvariantCulture) = "OFF" Then
settings.Mode = ExceptionManagementMode.Off
End If
' Loop through the publisher components and load them into the ExceptionManagementSettings.
For Each node In section.ChildNodes
If node.Name = PUBLISHER_NODENAME Then
' Initialize a new PublisherSettings.
publisherSettings = New PublisherSettings
' Get a collection of all the attributes.
nodeAttributes = node.Attributes
' Remove the mode attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_MODE)
If _
Not (currentAttribute Is Nothing) AndAlso _
currentAttribute.Value.ToUpper (CultureInfo.InvariantCulture) = "OFF" Then
publisherSettings.Mode = PublisherMode.Off
End If
' Remove the assembly attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_ASSEMBLY)
If Not (currentAttribute Is Nothing) Then
publisherSettings.AssemblyName = currentAttribute.Value
End If
' Remove the type attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_TYPE)
If Not (currentAttribute Is Nothing) Then
publisherSettings.TypeName = currentAttribute.Value
End If
' Remove the exceptionFormat attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_EXCEPTIONFORMAT)
If _
Not (currentAttribute Is Nothing) AndAlso _
currentAttribute.Value.ToUpper (CultureInfo.InvariantCulture) = "XML" Then
publisherSettings.ExceptionFormat = PublisherFormat.Xml
End If
' Remove the include attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_INCLUDETYPES)
If Not (currentAttribute Is Nothing) Then
publisherSettings.IncludeTypes = _
LoadTypeFilter (currentAttribute.Value.Split (EXCEPTION_TYPE_DELIMITER))
End If
' Remove the exclude attribute from the node and set its value in PublisherSettings.
currentAttribute = nodeAttributes.RemoveNamedItem (PUBLISHER_EXCLUDETYPES)
If Not (currentAttribute Is Nothing) Then
publisherSettings.ExcludeTypes = _
LoadTypeFilter (currentAttribute.Value.Split (EXCEPTION_TYPE_DELIMITER))
End If
' Loop through any other attributes and load them into OtherAttributes.
j = nodeAttributes.Count - 1
For i = 0 To j '
publisherSettings.AddOtherAttributes (nodeAttributes.Item (i).Name, _
nodeAttributes.Item (i).Value)
Next i
' Add the PublisherSettings to the publishers collection.
settings.Publishers.Add (publisherSettings)
End If
Next node
' Remove extra allocated space of the ArrayList of Publishers.
settings.Publishers.TrimToSize()
' Return the ExceptionManagementSettings loaded with the values from the config file.
Return settings
Catch exc As Exception
Throw _
New SecurityException ( _
ConfigurationManager.GetSection ( _
m_resourceManager.GetString ( _
"RES_ExceptionLoadingConfiguration")))
End Try
End Function
'Create
''' -----------------------------------------------------------------------------
''' <summary>
''' Creates TypeFilter with type information from the string array of type names.
''' </summary>
''' <param name="rawFilter"></param>
''' <returns>TypeFilter object containing type information.</returns>
''' <remarks>rawFilter - String array containing names of types to be included in the filter.
''' </remarks>
''' <history>
''' [patrick] 2005/01/04 Created
''' </history>
''' -----------------------------------------------------------------------------
Private Function LoadTypeFilter (ByVal rawFilter As String()) As TypeFilter
' Initialize filter
Dim m_typeFilter As TypeFilter = New TypeFilter
' Verify information was passed in
If Not rawFilter Is Nothing Then
Dim m_exceptionTypeInfo As TypeInfo
Dim i As Short
'Loop through the string array
For i = 0 To rawFilter.GetLength (0) - 1
' If the wildcard character "*" exists set the TypeFilter to accept all types.
If rawFilter (i) = "*" Then
m_typeFilter.AcceptAllTypes = True
Else
Try
If rawFilter (i).Length > 0 Then
'Create the TypeInfo class
m_exceptionTypeInfo = New TypeInfo
'If the string starts with a "+"
If rawFilter (i).Trim().StartsWith ("+") Then
'Set the TypeInfo class to include subclasses
m_exceptionTypeInfo.IncludeSubClasses = True
'Get the Type class from the filter privided.
m_exceptionTypeInfo.ClassType = _
Type.GetType (rawFilter (i).Trim().TrimStart (Convert.ToChar ("+")), True)
Else
' Set the TypeInfo class not to include subclasses
m_exceptionTypeInfo.IncludeSubClasses = False
' Get the Type class from the filter privided.
m_exceptionTypeInfo.ClassType = Type.GetType (rawFilter (i).Trim(), True)
End If
' Add the TypeInfo class to the TypeFilter
m_typeFilter.Types.Add (m_exceptionTypeInfo)
End If
Catch e As TypeLoadException
' If the Type could not be created throw a configuration exception.
ExceptionManager.PublishInternalException ( _
ConfigurationManager.GetSection ( _
m_resourceManager. _
GetString ( _
"RES_EXCEPTION_LOADING_CONFIGURATION")), _
Nothing)
End Try
End If
Next
End If
Return m_typeFilter
End Function
'LoadTypeFilter
End Class
'ExceptionManagerSectionHandler
#End Region |
Imports System.Data.SqlClient
Imports System.Text
Namespace DataObjects.TableObjects
''' <summary>
''' Provides the functionality to manage data from the table tbl_creditcard_type_control based on business functionality
''' </summary>
<Serializable()> _
Public Class tbl_creditcard_type_control
Inherits DBObjectBase
#Region "Class Level Fields"
''' <summary>
''' Instance of DESettings
''' </summary>
Private _settings As New DESettings
''' <summary>
''' Class Name which is used in cache key construction
''' </summary>
Const CACHEKEY_CLASSNAME As String = "tbl_creditcard_type_control"
#End Region
#Region "Constructors"
Sub New()
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="tbl_creditcard_type_control" /> class.
''' </summary>
''' <param name="settings">The DESettings instance</param>
Sub New(ByVal settings As DESettings)
_settings = settings
End Sub
#End Region
#Region "Public Methods"
''' <summary>
''' Returns a list of installments, if only 1 installment is given this is the maximum number of installments and the user may enter anything upto that max
''' </summary>
''' <param name="cardNumber">The first 6 digits of the card number</param>
''' <param name="cacheing">An optional boolean value to represent caching, default true</param>
''' <param name="cacheTimeMinutes">An optional cache time value, default 30 minss</param>
''' <returns>List of installments</returns>
''' <remarks></remarks>
Public Function GetInstallmentsByCard(ByVal cardNumber As String, Optional ByVal cacheing As Boolean = True, Optional ByVal cacheTimeMinutes As Integer = 30) As List(Of Integer)
Dim installments As New List(Of Integer)
Dim outputDataTable As New DataTable
Dim cacheKeyPrefix As String = GetCacheKeyPrefix(CACHEKEY_CLASSNAME, "GetInstallmentsByCard")
Dim talentSqlAccessDetail As New TalentDataAccess
Dim err As New ErrorObj
Try
If cardNumber.Length > 6 Then cardNumber = cardNumber.Substring(0, 6)
talentSqlAccessDetail.Settings = _settings
talentSqlAccessDetail.Settings.Cacheing = cacheing
talentSqlAccessDetail.Settings.CacheTimeMinutes = cacheTimeMinutes
talentSqlAccessDetail.CommandElements.CommandExecutionType = CommandExecution.ExecuteDataSet
talentSqlAccessDetail.CommandElements.CommandParameter.Add(ConstructParameter("@CardNumber", cardNumber))
Dim sqlStatement As New StringBuilder
sqlStatement.Append("SELECT CARD_CODE, MAX_INSTALLMENTS, INSTALLMENTS_LIST FROM [tbl_creditcard_type_control] ")
sqlStatement.Append("WHERE @CardNumber >= CARD_FROM_RANGE ")
sqlStatement.Append("AND @CardNumber <= CARD_TO_RANGE ")
sqlStatement.Append("ORDER BY CARD_FROM_RANGE DESC")
talentSqlAccessDetail.Settings.CacheStringExtension = cacheKeyPrefix & cardNumber
talentSqlAccessDetail.CommandElements.CommandText = sqlStatement.ToString()
err = talentSqlAccessDetail.SQLAccess()
If (Not (err.HasError)) And (Not (talentSqlAccessDetail.ResultDataSet Is Nothing)) Then
If talentSqlAccessDetail.ResultDataSet.Tables(0).Rows.Count > 0 Then
outputDataTable = talentSqlAccessDetail.ResultDataSet.Tables(0)
installments = getInstallmentsValue(outputDataTable)
End If
End If
Catch ex As Exception
Throw
Finally
talentSqlAccessDetail = Nothing
End Try
Return installments
End Function
#End Region
#Region "Private Functions"
''' <summary>
''' Get the installments value list by the datatable of results
''' </summary>
''' <param name="outputDataTable">The data table of results</param>
''' <returns>Installments list array</returns>
''' <remarks></remarks>
Private Function getInstallmentsValue(ByRef outputDataTable As DataTable) As List(Of Integer)
Dim installments As New List(Of Integer)
Dim maxInstallments As String = Utilities.CheckForDBNull_String(outputDataTable.Rows(0)("MAX_INSTALLMENTS"))
Dim installmentsList As String = Utilities.CheckForDBNull_String(outputDataTable.Rows(0)("INSTALLMENTS_LIST"))
If String.IsNullOrEmpty(installmentsList) Then
If Not String.IsNullOrEmpty(maxInstallments) Then
Dim maxInstallmentsInt As Integer = 0
If Integer.TryParse(maxInstallments, maxInstallmentsInt) Then installments.Add(maxInstallmentsInt)
End If
Else
Dim tempArray() As String = installmentsList.Split(",")
For Each item As String In tempArray
Dim intItem As Integer = 0
If Integer.TryParse(item, intItem) Then installments.Add(intItem)
Next
End If
Return installments
End Function
#End Region
End Class
End Namespace |
''' <summary>
''' Allegmeine Eigenschaften eines Himmelskörpers werden aus einem HimmelskoerperTab- Entioty in
''' einer flachen Struktur präsentiert.
''' </summary>
''' <remarks></remarks>
Public Class SternePlanetenMondeView
Inherits mko.VB.Db.BaseEntityView(Of VB.DB.EntityFramework.HimmelskoerperTab)
Public Sub New()
MyBase.New()
End Sub
''' <summary>
''' Konstruktor. Nimmt das HimmelskoerperTab- Entity, das alle Daten für die Eigenschaften bereitstellt,
''' entgegen
''' </summary>
''' <param name="Entity"></param>
''' <remarks></remarks>
Public Sub New(Entity As VB.DB.EntityFramework.HimmelskoerperTab)
MyBase.New(Entity)
End Sub
''' <summary>
''' Lisfert die Schlüssel des zugrundeliegenden HimmelskoerperTab- Entities
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Overrides ReadOnly Property Keys As Object()
Get
Return New Object() {Entity.ID}
End Get
End Property
''' <summary>
''' Typ- Name des Himmelskoerpers (aus Tabelle HimmelskoerperTypenTab)
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Typ As String
Get
Return Entity.HimmelskoerperTypenTab.Name
End Get
Set(value As String)
End Set
End Property
''' <summary>
''' Name des Himmeslkoerpers
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Name As String
Get
Return Entity.Name
End Get
Set(value As String)
SetProperty(value, Sub(v, e) e.Name = v)
End Set
End Property
Const ErdmasseInKg As Double = 5.974E+24
''' <summary>
''' Gewicht des Himmelskoerpers in einer sinnvollen Masseangaben
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Masse As Double
Get
If New String() {"Planet"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmassen
Return Entity.Masse_in_kg / mko.Newton.Mass.MassOfEarth.Value
ElseIf New String() {"Stern", "Galaxie"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Sonnenmassen
Return Entity.Masse_in_kg / mko.Newton.Mass.MassOfSun.Value
ElseIf New String() {"Mond", "Asteroid"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmondmassen
Return Entity.Masse_in_kg / mko.Newton.Mass.MassOfEarthMoon.Value
ElseIf "Komet" = Entity.HimmelskoerperTypenTab.Name Then
' Umrechnen in Bodenseemassen
Return Entity.Masse_in_kg / mko.Newton.Mass.GesamtmasseBodenseewasser.Value
Else
Return Entity.Masse_in_kg
End If
End Get
Set(value As Double)
' Setzen der Eigenschaft als Lambda- Ausdruck aufzeichnen
SetProperty(value, Sub(v, e)
If New String() {"Planet"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmassen
e.Masse_in_kg = v * mko.Newton.Mass.MassOfEarth.Value
ElseIf New String() {"Stern", "Galaxie"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Sonnenmassen
e.Masse_in_kg = v * mko.Newton.Mass.MassOfSun.Value
ElseIf New String() {"Mond", "Asteroid"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmondmassen
e.Masse_in_kg = v * mko.Newton.Mass.MassOfEarthMoon.Value
ElseIf "Komet" = Entity.HimmelskoerperTypenTab.Name Then
' Umrechnen in Bodenseemassen
e.Masse_in_kg = v * mko.Newton.Mass.GesamtmasseBodenseewasser.Value
Else
e.Masse_in_kg = v
End If
End Sub)
End Set
End Property
Public ReadOnly Property MasseEinheit As String
Get
If New String() {"Planet"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmassen
Return "Erdmassen"
ElseIf New String() {"Stern", "Galaxie"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Sonnenmassen
Return "Sonnenmassen"
ElseIf New String() {"Mond", "Asteroid"}.Any(Function(r) r = Entity.HimmelskoerperTypenTab.Name) Then
' Umrechnen in Erdmondmassen
Return "Mondmassen"
ElseIf "Komet" = Entity.HimmelskoerperTypenTab.Name Then
' Umrechnen in Bodenseemassen
Return "Bodenseewassermassen"
Else
Return "kg"
End If
End Get
End Property
''' <summary>
''' Abstand zum Zentralkoerper, d en dieser Himmelskörper umkreist
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property AbstandZentralkoerper As Double
Get
If Not Entity.Umlaufbahn Is Nothing Then
Return Entity.Umlaufbahn.Laenge_grosse_Halbachse_in_km
Else
Return 0
End If
End Get
End Property
End Class
|
Imports Microsoft.VisualBasic
Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
'************************************************************************
'
' <warning>
' DO NOT PUT CUSTOM CODE IN THIS FILE, INSTEAD PUT THE CODE INTO
' TaskLoader.Custom.vb THIS WILL ALLOW US TO MAKE CHANGES TO THIS FILE
' IN THE FUTURE WITHOUT AFFECTING YOUR CUSTOM CODE.
' </warning>
'
'************************************************************************
Partial Public Class TaskLoader
Public Shared Sub Load()
' Plugins
Try
'' Set Seed for Order Number Generator
'Try
' BVSoftware.Bvc5.Core.Orders.OrderNumberGenerator.LoadSeed()
'Catch ex As Exception
' BVSoftware.Bvc5.Core.EventLog.LogEvent(ex)
'End Try
'run any custom loading code (in Taskloader.Custom.vb)
CustomLoad()
' Load Plugins for Workflows
BVSoftware.Bvc5.Core.BusinessRules.AvailableTasks.ProductTasks = TaskLoader.LoadProductTasks()
BVSoftware.Bvc5.Core.BusinessRules.AvailableTasks.OrderTasks = TaskLoader.LoadOrderTasks()
BVSoftware.Bvc5.Core.BusinessRules.AvailableTasks.ShippingTasks = TaskLoader.LoadShippingTasks()
' Load Processors for Workflows
BVSoftware.Bvc5.Core.BusinessRules.AvailableProcessors.OrderTaskProcessors = TaskLoader.LoadOrderTaskProcessors()
' Load Payment Methods
BVSoftware.Bvc5.Core.Payment.AvailablePayments.Methods = TaskLoader.LoadPaymentMethods
' Load Credit Card Gateways
BVSoftware.Bvc5.Core.Payment.AvailableGateways.Gateways = TaskLoader.LoadCreditCardGateways
' Load Shipping Providers
BVSoftware.Bvc5.Core.Shipping.AvailableProviders.Providers = TaskLoader.LoadShippingProviders
' Load Dimension Calculator
BVSoftware.BVC5.Core.Shipping.ShippingGroup.AvailableDimensionCalculators = TaskLoader.LoadPackageDimensionCalculators()
' Load Custom Url Rewriting Rules
BVSoftware.Bvc5.Core.Utilities.UrlRewritingRule.AvailableRules = TaskLoader.LoadUrlRewritingRules()
' Load Feeds
FeedEngine.AvailableFeeds.Feeds = TaskLoader.LoadFeeds()
' Load Import/Exports
ImportExport.AvailableImportExports.Imports = TaskLoader.LoadImports()
ImportExport.AvailableImportExports.Exports = TaskLoader.LoadExports()
' Load Current Sales
BVSoftware.BVC5.Core.Marketing.SalesManager.LoadCurrentSales()
Catch ex As Exception
BVSoftware.Bvc5.Core.EventLog.LogEvent(ex)
End Try
End Sub
Public Shared Function LoadProductTasks() As Collection(Of BusinessRules.ProductTask)
Dim result As New Collection(Of BusinessRules.ProductTask)
LoadCustomProductTasks(result)
result.Add(New BusinessRules.ProductTasks.AppendManufacturerName)
result.Add(New BusinessRules.ProductTasks.ApplyPriceGroups)
result.Add(New BusinessRules.ProductTasks.ApplySales)
result.Add(New BusinessRules.ProductTasks.CheckForPriceBelowCost)
result.Add(New BusinessRules.ProductTasks.FailPipeline)
result.Add(New BusinessRules.ProductTasks.InitializeProductPrice)
result.Add(New BusinessRules.ProductTasks.OverridePriceWithText)
Return result
End Function
Public Shared Function LoadOrderTasks() As Collection(Of BusinessRules.OrderTask)
Dim result As New Collection(Of BusinessRules.OrderTask)
LoadCustomOrderTasks(result)
result.Add(New BusinessRules.OrderTasks.ApplyOffersGreatestDiscount)
result.Add(New BusinessRules.OrderTasks.ApplyOffersStackedDiscounts)
result.Add(New BusinessRules.OrderTasks.ApplyProductShippingModifiers)
result.Add(New BusinessRules.OrderTasks.ApplyMinimumOrderAmount)
result.Add(New BusinessRules.OrderTasks.ApplyHandling)
result.Add(New BusinessRules.OrderTasks.ApplyTaxes)
result.Add(New BusinessRules.OrderTasks.ApplyVolumePricing)
result.Add(New BusinessRules.OrderTasks.AssignOrderNumber)
result.Add(New BusinessRules.OrderTasks.AssignOrderToUser)
result.Add(New BusinessRules.OrderTasks.AvalaraCommitTaxes)
result.Add(New BusinessRules.OrderTasks.AvalaraCancelTaxesWhenPaymentRemoved)
result.Add(New BusinessRules.OrderTasks.AvalaraResubmitTaxes)
result.Add(New BusinessRules.OrderTasks.ChangeOrderStatusWhenPaymentRemoved)
result.Add(New BusinessRules.OrderTasks.ChangeOrderStatusWhenShipmentRemoved)
result.Add(New BusinessRules.OrderTasks.CompleteCreditCards)
result.Add(New BusinessRules.OrderTasks.DebitGiftCertificates)
result.Add(New BusinessRules.OrderTasks.DebitLoyaltyPoints)
result.Add(New BusinessRules.OrderTasks.EmailOrder)
result.Add(New BusinessRules.OrderTasks.EmailShippingInfo)
result.Add(New BusinessRules.OrderTasks.IssueGiftCertificates)
result.Add(New BusinessRules.OrderTasks.LocalFraudCheck)
result.Add(New BusinessRules.OrderTasks.LogMessage)
result.Add(New BusinessRules.OrderTasks.MakePlacedOrder)
result.Add(New BusinessRules.OrderTasks.MarkCompletedWhenShippedAndPaid)
result.Add(New BusinessRules.OrderTasks.MakeOrderAddressUsersCurrentAddress)
result.Add(New BusinessRules.OrderTasks.ReceiveCreditCards)
result.Add(New BusinessRules.OrderTasks.ReceivePaypalExpressPayments)
result.Add(New BusinessRules.OrderTasks.RequireLoginBeforeCheckout)
result.Add(New BusinessRules.OrderTasks.RunAllDropShipWorkflows)
result.Add(New BusinessRules.OrderTasks.RunShippingCompleteWorkFlow)
result.Add(New BusinessRules.OrderTasks.SendRMAEmail)
result.Add(New BusinessRules.OrderTasks.StartPaypalExpressCheckout)
result.Add(New BusinessRules.OrderTasks.TestCreateErrors)
result.Add(New BusinessRules.OrderTasks.RunWorkFlowIfPaid)
result.Add(New BusinessRules.OrderTasks.UpdateLineItemsForSave)
result.Add(New BusinessRules.OrderTasks.UpdateLoyaltyPoints)
result.Add(New BusinessRules.OrderTasks.UpdateOrder)
result.Add(New BusinessRules.OrderTasks.CredExCheckCredit)
result.Add(New BusinessRules.OrderTasks.CredExStart)
Return result
End Function
Public Shared Function LoadShippingTasks() As Collection(Of BusinessRules.ShippingTask)
Dim result As New Collection(Of BusinessRules.ShippingTask)
LoadCustomShippingTasks(result)
result.Add(New BusinessRules.ShippingTasks.ApplyShippingDiscounts)
result.Add(New BusinessRules.ShippingTasks.ApplyProductShippingModifiers)
Return result
End Function
Public Shared Function LoadOrderTaskProcessors() As Collection(Of ProcessorComponentPair)
Dim result As New Collection(Of ProcessorComponentPair)
LoadCustomOrderTaskProcessors(result)
result.Add(New ProcessorComponentPair("Order Total", GetType(Marketing.OrderTotalOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Product(s)", GetType(Marketing.ProductsOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Shipping", GetType(Marketing.ShippingOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Free Shipping", GetType(Marketing.FreeShippingOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Buy One Get One", GetType(Marketing.BuyOneGetOneOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Buy X Get Y", GetType(Marketing.BuyXGetYOfferTaskProcessor)))
result.Add(New ProcessorComponentPair("Free Shipping Excluding Categories", GetType(Marketing.Offers.FreeShippingByCategory)))
result.Add(New ProcessorComponentPair("Buy X get Y By Category", GetType(Marketing.Offers.BuyXGetYByCategory)))
result.Add(New ProcessorComponentPair("Free Promo Item", GetType(Marketing.Offers.FreePromoItem)))
result.Add(New ProcessorComponentPair("Free Promo Item by Amount", GetType(Marketing.Offers.FreePromoItemByAmount)))
result.Add(New ProcessorComponentPair("Free Shipping on Products", GetType(Marketing.Offers.FreeShippingProducts)))
result.Add(New ProcessorComponentPair("Products By Category", GetType(Marketing.Offers.ProductsByCategory)))
result.Add(New ProcessorComponentPair("Product(s) Fixed Price", GetType(Marketing.Offers.ProductsFixedPrice)))
Return result
End Function
Public Shared Function LoadPaymentMethods() As Collection(Of Payment.PaymentMethod)
Dim result As New Collection(Of Payment.PaymentMethod)
LoadCustomPaymentMethods(result)
result.Add(New Payment.Method.CreditCard)
result.Add(New Payment.Method.PurchaseOrder)
result.Add(New Payment.Method.Check)
result.Add(New Payment.Method.Cash)
result.Add(New Payment.Method.Telephone)
result.Add(New Payment.Method.CashOnDelivery)
result.Add(New Payment.Method.GiftCertificate)
result.Add(New Payment.Method.PaypalExpress)
result.Add(New Payment.Method.Offline)
result.Add(New Payment.Method.CredEx)
result.Add(New Payment.Method.LoyaltyPoints)
Return result
End Function
Public Shared Function LoadCreditCardGateways() As Collection(Of Payment.CreditCardGateway)
Dim result As New Collection(Of Payment.CreditCardGateway)
LoadCustomCreditCardGateways(result)
result.Add(New BVSoftware.BVC5.Payment.AuthorizeNet.AuthorizeNetProvider)
result.Add(New BVSoftware.Bvc5.Payment.ACHDirect.ACHDirectProvider)
result.Add(New Payment.Gateways.BVTestGateway)
result.Add(New Payment.Gateways.ManualGateway)
result.Add(New BVSoftware.Bvc5.Payment.EcLinx3DSI)
result.Add(New BVSoftware.Bvc5.Payment.BankOfAmerica)
result.Add(New BVSoftware.Bvc5.Payment.ConcordEFSNet)
result.Add(New BVSoftware.Bvc5.Payment.CyberSource)
result.Add(New BVSoftware.Bvc5.Payment.ECHOnline)
result.Add(New BVSoftware.Bvc5.Payment.ECX)
result.Add(New BVSoftware.Bvc5.Payment.eProcessing)
result.Add(New BVSoftware.Bvc5.Payment.FastTransact)
result.Add(New BVSoftware.Bvc5.Payment.FirstDataGlobalGateway)
result.Add(New BVSoftware.Bvc5.Payment.GoRealTime)
result.Add(New BVSoftware.Bvc5.Payment.iBill)
result.Add(New BVSoftware.Bvc5.Payment.Innovative)
result.Add(New BVSoftware.Bvc5.Payment.Intellipay)
result.Add(New BVSoftware.Bvc5.Payment.iTransact)
result.Add(New BVSoftware.Bvc5.Payment.LinkPointAPI)
result.Add(New BVSoftware.Bvc5.Payment.MerchantAnywhere)
result.Add(New BVSoftware.Bvc5.Payment.Moneris)
result.Add(New BVSoftware.Bvc5.Payment.MPCS)
result.Add(New BVSoftware.Bvc5.Payment.NetBilling)
result.Add(New BVSoftware.Bvc5.Payment.NetworkMerchants)
result.Add(New BVSoftware.Bvc5.Payment.NovaViaKlix)
result.Add(New BVSoftware.Bvc5.Payment.PayFlowLink)
result.Add(New BVSoftware.Bvc5.Payment.PayFlowPro)
result.Add(New BVSoftware.Bvc5.Payment.PayFuse)
result.Add(New BVSoftware.Bvc5.Payment.PaymentechOrbital)
result.Add(New BVSoftware.Bvc5.Payment.PaypalProGateway)
result.Add(New BVSoftware.Bvc5.Payment.PlanetPayment)
result.Add(New BVSoftware.Bvc5.Payment.PlugnPay)
result.Add(New BVSoftware.Bvc5.Payment.PRIGate)
result.Add(New BVSoftware.Bvc5.Payment.Protx)
result.Add(New BVSoftware.BVC5.Payment.PsiGateXML)
result.Add(New BVSoftware.BVC5.Payment.QBMS)
result.Add(New BVSoftware.Bvc5.Payment.RTWare)
result.Add(New BVSoftware.Bvc5.Payment.SkipJack)
result.Add(New BVSoftware.Bvc5.Payment.TrustCommerce)
result.Add(New BVSoftware.Bvc5.Payment.USAePay)
result.Add(New BVSoftware.Bvc5.Payment.WorldPay)
Return result
End Function
Public Shared Function LoadShippingProviders() As Collection(Of Shipping.ShippingProvider)
Dim result As New Collection(Of Shipping.ShippingProvider)
LoadCustomShippingProviders(result)
'result.Add(New BVSoftware.Bvc5.Core.Shipping.Provider.NullProvider)
result.Add(New BVSoftware.Bvc5.Core.Shipping.Provider.ByItemCount)
result.Add(New BVSoftware.BVC5.Core.Shipping.Provider.ByOrderTotal)
result.Add(New BVSoftware.BVC5.Core.Shipping.Provider.ByOrderTotalMixed)
result.Add(New BVSoftware.Bvc5.Core.Shipping.Provider.ByWeight)
result.Add(New BVSoftware.Bvc5.Core.Shipping.Provider.PerItem)
result.Add(New BVSoftware.Bvc5.Core.Shipping.Provider.PerOrder)
result.Add(New BVSoftware.Bvc5.Shipping.FedEx.FedExProvider)
result.Add(New BVSoftware.Bvc5.Shipping.Ups.UpsProvider)
result.Add(New BVSoftware.Bvc5.Shipping.USPostal.USPostalProvider)
result.Add(New BVSoftware.Bvc5.Shipping.DHL.DHLProvider)
result.Add(New StructuredSolutions.Bvc5.Shipping.Providers.WrapperProvider())
result.Add(New StructuredSolutions.Bvc5.Shipping.Providers.PackageRuleProvider())
result.Add(New StructuredSolutions.Bvc5.Shipping.Providers.OrderRuleProvider())
Return result
End Function
Public Shared Function LoadPackageDimensionCalculators() As Collection(Of Shipping.DimensionCalculator)
Dim result As New Collection(Of Shipping.DimensionCalculator)
LoadCustomPackageDimensionCalculators(result)
'result.Add(New Shipping.DefaultDimensionCalculator())
result.Add(New StructuredSolutions.Bvc5.Shipping.ExtendedDimensionalCalculator())
result.Add(New StructuredSolutions.Bvc5.Shipping.ExtendedBoxingDimensionCalculator())
'result.Add(New Shipping.BoxingDimensionCalculator())
Return result
End Function
Public Shared Function LoadUrlRewritingRules() As Collection(Of Utilities.UrlRewritingRule)
Dim result As New Collection(Of Utilities.UrlRewritingRule)()
LoadCustomUrlRewritingRules(result)
result.Add(New PreventUrlPrefixConflicts())
Return result
End Function
Public Shared Function LoadFeeds() As Collection(Of FeedEngine.BaseFeed)
Dim result As New Collection(Of FeedEngine.BaseFeed)()
LoadCustomFeeds(result)
' Product feeds
result.Add(New FeedEngine.Products.BingShopping())
result.Add(New FeedEngine.Products.ChannelAdvisor())
result.Add(New FeedEngine.Products.CommissionJunction())
result.Add(New FeedEngine.Products.GoogleShopping())
result.Add(New FeedEngine.Products.PriceGrabber())
result.Add(New FeedEngine.Products.TheFind())
' Transaction feeds
'result.Add(New FeedEngine.Transactions.GoogleTrustedStoresCancellation())
'result.Add(New FeedEngine.Transactions.GoogleTrustedStoresShipment())
result.Add(New FeedEngine.Transactions.THub())
' Sitemap feeds
result.Add(New FeedEngine.Sitemaps.GoogleSitemap())
Return result
End Function
Public Shared Function LoadExports() As Collection(Of ImportExport.BaseExport)
Dim result As New Collection(Of ImportExport.BaseExport)()
LoadCustomExports(result)
result.Add(New ImportExport.CatalogData.CategoryExport())
result.Add(New ImportExport.CatalogData.ProductExport())
result.Add(New ImportExport.CatalogData.ProductCategoryExport())
result.Add(New ImportExport.CatalogData.ProductInventoryExport())
result.Add(New ImportExport.ContactsData.AffiliateExport())
result.Add(New ImportExport.ContactsData.ManufacturerExport())
result.Add(New ImportExport.ContactsData.VendorExport())
result.Add(New ImportExport.ContentData.CustomPageExport())
result.Add(New ImportExport.ContentData.CustomUrlExport())
result.Add(New ImportExport.ContentData.UrlRedirectExport())
result.Add(New ImportExport.MembershipData.UserAccountExport())
result.Add(New ImportExport.OrdersData.OrderExport())
Return result
End Function
Public Shared Function LoadImports() As Collection(Of ImportExport.BaseImport)
Dim result As New Collection(Of ImportExport.BaseImport)()
LoadCustomImports(result)
result.Add(New ImportExport.CatalogData.CategoryImport())
result.Add(New ImportExport.CatalogData.ProductImport())
result.Add(New ImportExport.CatalogData.ProductCategoryImport())
result.Add(New ImportExport.CatalogData.ProductInventoryImport())
result.Add(New ImportExport.ContactsData.AffiliateImport())
result.Add(New ImportExport.ContactsData.ManufacturerImport())
result.Add(New ImportExport.ContactsData.VendorImport())
result.Add(New ImportExport.ContentData.CustomPageImport())
result.Add(New ImportExport.ContentData.CustomUrlImport())
result.Add(New ImportExport.ContentData.UrlRedirectImport())
Return result
End Function
Public Shared Function Brand() As BVSoftware.Commerce.Branding.IBVBranding
Return New BVSoftware.Commerce.Branding.Default()
End Function
End Class |
#Region "Microsoft.VisualBasic::800ab5cbb71708c2b559c25c3fe69932, mzkit\src\mzmath\TargetedMetabolomics\MRM\Data\Extensions.vb"
' Author:
'
' xieguigang (gg.xie@bionovogene.com, BioNovoGene Co., LTD.)
'
' Copyright (c) 2018 gg.xie@bionovogene.com, BioNovoGene Co., LTD.
'
'
' MIT License
'
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
' /********************************************************************************/
' Summaries:
' Code Statistics:
' Total Lines: 109
' Code Lines: 80
' Comment Lines: 14
' Blank Lines: 15
' File Size: 5.07 KB
' Module Extensions
'
' Function: GetAllFeatures, (+2 Overloads) MRMSelector, PopulatePeaks
'
'
' /********************************************************************************/
#End Region
Imports System.Runtime.CompilerServices
Imports BioNovoGene.Analytical.MassSpectrometry.Assembly.MarkupData.mzML
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Chromatogram
Imports BioNovoGene.Analytical.MassSpectrometry.Math.LinearQuantitative
Imports BioNovoGene.Analytical.MassSpectrometry.Math.LinearQuantitative.Linear
Imports BioNovoGene.Analytical.MassSpectrometry.Math.MRM.Models
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Ms1
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.Linq
Imports Microsoft.VisualBasic.Math
Imports Microsoft.VisualBasic.Math.Scripting
Imports chromatogramTicks = BioNovoGene.Analytical.MassSpectrometry.Assembly.MarkupData.mzML.chromatogram
Namespace MRM.Data
<HideModuleName>
Public Module Extensions
''' <summary>
''' enumerate all of the ion pair features in the given mzML file list.
''' </summary>
''' <param name="files"></param>
''' <returns></returns>
<Extension>
Public Function GetAllFeatures(files As IEnumerable(Of String)) As IonPair()
Dim ions As IonPair() = files _
.Select(AddressOf mzML.LoadChromatogramList) _
.IteratesALL _
.Where(Function(chr) Not chr.id Like NotMRMSelectors) _
.Select(Function(chr)
Return New IonPair With {
.precursor = chr.precursor.MRMTargetMz,
.product = chr.product.MRMTargetMz
}
End Function) _
.GroupBy(Function(ion)
Return $"{ion.precursor.ToString("F1")}-{ion.product.ToString("F1")}"
End Function) _
.Select(Function(ion) ion.First) _
.ToArray
Return ions
End Function
<Extension>
Public Function PopulatePeaks(ionPairs As IonPair(), raw$, tolerance As Tolerance, Optional baselineQuantile# = 0.65) As (ion As IsomerismIonPairs, peak As ROIPeak)()
Dim args As MRMArguments = MRMArguments.GetDefaultArguments
args.tolerance = tolerance
args.baselineQuantile = baselineQuantile
Dim ionData = LoadChromatogramList(path:=raw) _
.MRMSelector(IonPair.GetIsomerism(ionPairs, tolerance), tolerance) _
.Where(Function(ion) Not ion.chromatogram Is Nothing) _
.Select(Function(ion)
Dim mrm As ROIPeak = MRMIonExtract.GetTargetROIPeak(ion.ion.target, ion.chromatogram, args)
Return (ion.ion, mrm)
End Function) _
.ToArray
Return ionData
End Function
''' <summary>
''' BPC, TIC, etc
''' </summary>
ReadOnly NotMRMSelectors As Index(Of String) = {"BPC", "TIC"}
''' <summary>
''' MRM ion selector based on the precursor ion m/z and the product ion m/z value.
''' </summary>
''' <param name="chromatograms"></param>
''' <param name="ionPairs"></param>
''' <returns>Nothing for ion not found</returns>
<Extension>
Public Function MRMSelector(chromatograms As IEnumerable(Of chromatogramTicks),
ionPairs As IEnumerable(Of IsomerismIonPairs),
tolerance As Tolerance) As IEnumerable(Of (ion As IsomerismIonPairs, chromatogram As chromatogramTicks))
With chromatograms.ToArray
Return ionPairs _
.Select(Function(ion)
Dim chromatogram =
.Where(Function(c)
Return (Not c.id Like NotMRMSelectors) AndAlso ion.target.Assert(c, tolerance)
End Function) _
.FirstOrDefault
If chromatogram Is Nothing Then
Call $"missing {ion.ToString}, please consider check your ion pair data or increase the m/z tolerance value...".Warning
End If
Return (ion, chromatogram)
End Function)
End With
End Function
<MethodImpl(MethodImplOptions.AggressiveInlining)>
<Extension>
Public Function MRMSelector(chromatograms As IEnumerable(Of chromatogramTicks), ion As IonPair, tolerance As Tolerance) As chromatogramTicks
Return chromatograms _
.Where(Function(c)
Return (Not c.id Like NotMRMSelectors) AndAlso ion.Assert(c, tolerance)
End Function) _
.FirstOrDefault
End Function
End Module
End Namespace
|
Module Geral
Public vggNomesColunas As New NomesColunas
Public vggListaPrefixos As New List(Of String)
Public Sub Inicializar()
Try
'preencher lista de prefixos
With vggListaPrefixos
.Add("HIDDEN_")
.Add("EDBT_")
.Add("BT_")
.Add("DT_")
.Add("HR_")
.Add("EUR_")
.Add("DEC_")
.Add("PERCENT_")
.Add("EUR3_")
.Add("SEL_")
End With
Catch ex As Exception
Throw New Exception("Erro ao inicializar aplicativo.", ex)
End Try
End Sub
Public Function SqlTypeToVbNet_ToString(ByVal iSqlType As String) As String
Try
Select Case iSqlType.ToUpper.Trim
Case "char".ToUpper.Trim, "varchar".ToUpper.Trim, "text".ToUpper.Trim, "nvarchar".ToUpper.Trim, "ntext".ToUpper.Trim
Return "String"
Case "decimal".ToUpper.Trim, "numeric".ToUpper.Trim, "float".ToUpper.Trim, "money".ToUpper.Trim, "smallmoney".ToUpper.Trim
Return "Decimal"
Case "int".ToUpper.Trim, "bigint".ToUpper.Trim
Return "Long"
Case "smallint".ToUpper.Trim, "tinyint".ToUpper.Trim
Return "Integer"
Case "bit".ToUpper.Trim
Return "Boolean"
Case "datetime".ToUpper.Trim, "smalldatetime".ToUpper.Trim
Return "Datetime"
Case Else
Return "Object"
End Select
Catch ex As Exception
Throw New Exception(ex.Message, ex)
End Try
Return ""
End Function
End Module
|
'------------------------------------------
' MultiCopy.vb (c) 2002 by Charles Petzold
'------------------------------------------
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Windows.Forms
Class MultiCopy
Inherits Form
Const strFormat As String = "MultiCopy.InternalFormat"
Private afValues(,) As Single = {{0.12F, 3.45F, 6.78F, 9.01F}, _
{2.34F, 5.67F, 8.9F, 1.23F}, _
{4.56F, 7.89F, 0.12F, 3.45F}}
Shared Sub Main()
Application.Run(New MultiCopy())
End Sub
Sub New()
Text = "Multi Copy"
Menu = New MainMenu()
' Edit menu
Dim mi As New MenuItem("&Edit")
Menu.MenuItems.Add(mi)
' Edit Copy menu item
mi = New MenuItem("&Copy")
AddHandler mi.Click, AddressOf MenuEditCopyOnClick
mi.Shortcut = Shortcut.CtrlC
Menu.MenuItems(0).MenuItems.Add(mi)
End Sub
Private Sub MenuEditCopyOnClick(ByVal obj As Object, _
ByVal ea As EventArgs)
Dim data As New DataObject()
' Define internal clipboard format.
Dim ms As New MemoryStream()
Dim bw As New BinaryWriter(ms)
Dim iRow, iCol As Integer
bw.Write(afValues.GetLength(0))
bw.Write(afValues.GetLength(1))
For iRow = 0 To afValues.GetUpperBound(0)
For iCol = 0 To afValues.GetUpperBound(1)
bw.Write(afValues(iRow, iCol))
Next iCol
Next iRow
bw.Close()
data.SetData(strFormat, ms)
' Define CSV clipboard format.
ms = New MemoryStream()
Dim sw As New StreamWriter(ms)
For iRow = 0 To afValues.GetUpperBound(0)
For iCol = 0 To afValues.GetUpperBound(1)
sw.Write(afValues(iRow, iCol))
If iCol < afValues.GetUpperBound(1) Then
sw.Write(",")
Else
sw.WriteLine()
End If
Next iCol
Next iRow
sw.Write("\0")
sw.Close()
data.SetData(DataFormats.CommaSeparatedValue, ms)
' Define String clipboard format.
Dim strw As New StringWriter()
For iRow = 0 To afValues.GetUpperBound(0)
For iCol = 0 To afValues.GetUpperBound(1)
strw.Write(afValues(iRow, iCol))
If iCol < afValues.GetLength(1) - 1 Then
strw.Write(vbTab)
Else
strw.WriteLine()
End If
Next iCol
Next iRow
strw.Close()
data.SetData(strw.ToString())
Clipboard.SetDataObject(data, False)
End Sub
End Class
|
Imports Route4MeSDKLibrary.Route4MeSDK.DataTypes
Imports System.Runtime.Serialization
Namespace Route4MeSDK.QueryTypes
''' <summary>
''' Avoidance zone parameters
''' </summary>
<DataContract> _
Public NotInheritable Class AvoidanceZoneParameters
Inherits GenericParameters
''' <summary>
''' Device Id
''' </summary>
<IgnoreDataMember>
<HttpQueryMemberAttribute(Name:="device_id", EmitDefaultValue:=False)>
Public Property DeviceID As String
''' <summary>
''' Territory Id
''' </summary>
<HttpQueryMemberAttribute(Name:="territory_id", EmitDefaultValue:=False)>
Public Property TerritoryId As String
''' <summary>
''' Territory name
''' </summary>
<DataMember(Name:="territory_name")>
Public Property TerritoryName As String
''' <summary>
''' Territory color
''' </summary>
<DataMember(Name:="territory_color")>
Public Property TerritoryColor As String
''' <summary>
''' Member Id
''' </summary>
<DataMember(Name:="member_id")>
Public Property MemberId As String
''' <summary>
''' Territory parameters
''' </summary>
<DataMember(Name:="territory")>
Public Property Territory As Territory
End Class
End Namespace
|
Namespace Entities
Public Class RecertificationCircleValidation
Public ReadOnly Property StartDate As DateTime
Get
Dim result = ExpirationDate.AddMonths(0 - ValidilityMonths)
Return result
End Get
End Property
Public Property ExpirationDate As DateTime
Public Property ValidilityMonths As Integer
End Class
End Namespace |
Imports System.Data
Imports System.IO
Partial Class SB_ReasonCodes
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
lblStatus.Text = ""
If Session("UserType") = 2 Then ' Logged in as CDC User
btnAdd.Visible = False
txtCreateParent.Visible = False
btnCreateParent.Visible = False
lblCreateParent.Visible = False
End If
If (Not IsPostBack) Then
hdnTotalRows.Value = 0
hdnPageIndex.Value = 0
PopulateAddReasonCodes()
PopulateReasonCodes()
PopulateGrid(0, 20)
End If
End Sub
Public Sub PopulateAddReasonCodes()
' Populate ReasonCodes in dropdownlist
Dim objService As Starbucks.StarbucksClient = New Starbucks.StarbucksClient()
Dim objReasons As Starbucks.ResponseReasonList
objReasons = objService.GetAllParentReasons()
dpdnAddReasonCodes.DataSource = objReasons.reasons
dpdnAddReasonCodes.DataValueField = "reasonCode"
dpdnAddReasonCodes.DataTextField = "reasonName"
dpdnAddReasonCodes.DataBind()
End Sub
Public Sub PopulateReasonCodes()
' Populate ReasonCodes in dropdownlist
Dim objService As Starbucks.StarbucksClient = New Starbucks.StarbucksClient()
Dim objReasons As Starbucks.ResponseReasonList
objReasons = objService.GetAllParentReasons()
dpdnReasonCodes.DataSource = objReasons.reasons
dpdnReasonCodes.DataValueField = "reasonCode"
dpdnReasonCodes.DataTextField = "reasonName"
dpdnReasonCodes.DataBind()
End Sub
Public Sub PopulateGrid(ByVal startIndex As Int32, ByVal maxRows As Int32)
' populate grid with child reason codes
Dim objService As New Starbucks.StarbucksClient
Dim objReasons As Starbucks.ResponseReasonWithChildrenList
objReasons = objService.GetChildrenOfParentReason(dpdnReasonCodes.SelectedValue)
Dim ChildReasonList As New Generic.List(Of Starbucks.ReasonChild)
If Not objReasons.reasons Is Nothing Then
For i = 0 To objReasons.reasons.Count - 1
For j = 0 To objReasons.reasons(i).children.Count - 1
ChildReasonList.Add(objReasons.reasons(i).children(j))
Next j
Next i
End If
gvChildReasons.DataSource = ChildReasonList
gvChildReasons.DataBind()
hdnTotalRows.Value = ChildReasonList.Count
End Sub
Protected Sub dpdnReasonCodes_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
PopulateGrid(0, 20)
End Sub
Protected Sub OnRowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackClientHyperlink(gvChildReasons, "Select$" & e.Row.RowIndex)
e.Row.ToolTip = "Click to select this row."
e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='lightgray'")
e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'")
e.Row.Attributes.Add("style", "cursor: default")
End If
End Sub
Protected Sub OnRowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If Session("UserType") = 2 Then
e.Row.Cells(0).Visible = False
End If
End Sub
Protected Sub OnSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
' Display child reason details on row click of GridView
txtChildReasonDetails.Text = vbCrLf & vbCrLf & "Child Reason Name: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(2).Text) _
& vbCrLf & vbCrLf & "Explanation: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(3).Text) _
& vbCrLf & vbCrLf & "Escalation: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(4).Text) _
& vbCrLf & vbCrLf & "Photo Required: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(5).Text) _
& vbCrLf & vbCrLf & "Value Required: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(6).Text) _
& vbCrLf & vbCrLf & "Value Unit Price: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(7).Text) _
& vbCrLf & vbCrLf & "POD Required: " & Server.HtmlDecode(gvChildReasons.SelectedRow.Cells(8).Text)
End Sub
Protected Sub btnRefresh_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
' Page Load
lblStatus.Text = ""
hdnTotalRows.Value = 0
hdnPageIndex.Value = 0
txtCreateParent.Text = String.Empty
txtChildReasonDetails.Text = String.Empty
PopulateAddReasonCodes()
PopulateReasonCodes()
PopulateGrid(0, 20)
End Sub
Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAdd.Click
' Load Popup
lblPopupHeader.Text = "Create Child Reason"
btnCreateChild.Text = "Create"
dpdnAddReasonCodes.Enabled = True
dpdnAddReasonCodes.SelectedValue = dpdnReasonCodes.SelectedValue
txtValueUnitPrice.Text = "0"
Clear()
ModalPopupExtender1.Show()
End Sub
Protected Sub lnkEdit_Click(ByVal sender As Object, ByVal e As EventArgs)
'Edit Grid Row
lblPopupHeader.Text = "Update Child Reason"
btnCreateChild.Text = "Update"
Dim btnsubmit As LinkButton = TryCast(sender, LinkButton)
Dim gRow As GridViewRow = DirectCast(btnsubmit.NamingContainer, GridViewRow)
dpdnAddReasonCodes.Enabled = False
hdnChildReasonId.Value = gvChildReasons.DataKeys(gRow.RowIndex).Value.ToString()
dpdnAddReasonCodes.SelectedValue = dpdnReasonCodes.SelectedValue
txtChildReason.Text = Server.HtmlDecode(gRow.Cells(2).Text.Trim)
txtExplanation.Text = Server.HtmlDecode(gRow.Cells(3).Text.Trim)
dpdnEscalation.SelectedValue = IIf(Server.HtmlDecode(gRow.Cells(4).Text.Trim) = "True", 1, 0)
dpdnPhotoRequired.SelectedValue = IIf(Server.HtmlDecode(gRow.Cells(5).Text.Trim) = "True", 1, 0)
dpdnValueRequired.SelectedValue = IIf(Server.HtmlDecode(gRow.Cells(6).Text.Trim) = "True", 1, 0)
txtValueUnitPrice.Text = Server.HtmlDecode(gRow.Cells(7).Text.Trim)
dpdnPODRequired.SelectedValue = IIf(Server.HtmlDecode(gRow.Cells(8).Text.Trim) = "True", 1, 0)
Me.ModalPopupExtender1.Show()
End Sub
Protected Sub btnCreateParent_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCreateParent.Click
Dim objSvc As New Starbucks.StarbucksClient
Dim objResp As New Starbucks.Response
Dim objReason As New Starbucks.Reason
objReason.reasonName = txtCreateParent.Text.Trim()
objResp = objSvc.CreateReason(objReason)
If (objResp.statusCode <> 0) Then
lblStatus.Text = objResp.statusDescription
Else
lblStatus.Text = "Parent Reason Created Successfully"
End If
PopulateAddReasonCodes()
PopulateReasonCodes()
PopulateGrid(0, 20)
End Sub
Protected Sub btnCreateChild_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCreateChild.Click
Dim objSvc As New Starbucks.StarbucksClient
Dim objResp As New Starbucks.Response
Dim objReasonChildWithParent As New Starbucks.ReasonChildWithParent
Dim objReason As New Starbucks.Reason
objReason.reasonCode = dpdnAddReasonCodes.SelectedValue
objReasonChildWithParent.parentReason = objReason
objReasonChildWithParent.parentReason.reasonCode = dpdnAddReasonCodes.SelectedValue
objReasonChildWithParent.childReasonName = txtChildReason.Text.Trim
objReasonChildWithParent.childReasonExplanation = txtExplanation.Text.Trim
objReasonChildWithParent.escalation = dpdnEscalation.SelectedValue
objReasonChildWithParent.photoRequired = dpdnPhotoRequired.SelectedValue
objReasonChildWithParent.valueRequired = dpdnValueRequired.SelectedValue
objReasonChildWithParent.valueUnitPrice = txtValueUnitPrice.Text.Trim
objReasonChildWithParent.PODRequired = dpdnPODRequired.SelectedValue
If btnCreateChild.Text = "Create" Then
' Create new Child Reason
objResp = objSvc.CreateReasonChild(objReasonChildWithParent)
ElseIf btnCreateChild.Text = "Update" Then
' Update existing Child Reason
objReasonChildWithParent.childReasonCode = hdnChildReasonId.Value
objResp = objSvc.UpdateReasonChild(objReasonChildWithParent)
End If
If (objResp.statusCode <> 0) Then
lblStatus.Text = objResp.statusDescription
Else
If btnCreateChild.Text = "Create" Then
lblStatus.Text = "Child Reason Created Successfully"
Else
lblStatus.Text = "Child Reason Updated Successfully"
End If
End If
PopulateGrid(0, 20)
End Sub
Protected Sub Clear()
dpdnEscalation.SelectedIndex = 0
dpdnPhotoRequired.SelectedIndex = 0
dpdnValueRequired.SelectedIndex = 0
dpdnPODRequired.SelectedIndex = 0
txtChildReason.Text = String.Empty
txtExplanation.Text = String.Empty
End Sub
Protected Sub btnFirst_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnFirst.Click
hdnPageIndex.Value = 0
PopulateGrid(hdnPageIndex.Value, 20)
End Sub
Protected Sub btnLast_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLast.Click
hdnPageIndex.Value = Math.Truncate(hdnTotalRows.Value / 20)
PopulateGrid(hdnPageIndex.Value * 20, hdnTotalRows.Value Mod 20)
End Sub
Protected Sub btnPrevious_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrevious.Click
hdnPageIndex.Value = hdnPageIndex.Value - 1
PopulateGrid(hdnPageIndex.Value * 20, 20)
End Sub
Protected Sub btnNext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNext.Click
hdnPageIndex.Value = hdnPageIndex.Value + 1
PopulateGrid(hdnPageIndex.Value * 20, 20)
End Sub
End Class
|
Imports System.ComponentModel
Public Class PeriodChooser
Inherits DockPanel
Implements INotifyPropertyChanged
#Region "Properties"
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Public SystemChange As Boolean
Private _currentperiod As Byte
Private Week As WeekChooser
Public Property MinPeriod As Byte
Public Property MaxPeriod As Byte
Public Property DisableSelectAll As Boolean
Public Property RelatedWeekObject As Object
Public Property SelectedCount As Byte
Public Property HeldPeriod As Byte
Public Property CurrentPeriod As Byte
Get
Return _currentperiod
End Get
Set(value As Byte)
HeldPeriod = _currentperiod
_currentperiod = value
For Each b As Border In Children
If b.Tag <> "Label" Then
Dim tb As TextBlock = b.Child
If FormatNumber(tb.Text, 0) <> value Then
tb.Foreground = Brushes.LightGray
tb.FontSize = 16
tb.FontWeight = FontWeights.Normal
Else
tb.FontWeight = FontWeights.SemiBold
tb.Foreground = Brushes.Black
tb.FontSize = 24
End If
End If
Next
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(“Period”))
End Set
End Property
#End Region
#Region "Constructor"
Public Sub New(ByRef RelatedWeekObject As WeekChooser, MinP As Byte, MaxP As Byte, CurP As Byte)
Dim ct As Byte
Week = RelatedWeekObject
MinPeriod = MinP
MaxPeriod = MaxP
'// Create chooser label
Dim BorderLabel As New Border With {.BorderBrush = Brushes.Black, .VerticalAlignment = VerticalAlignment.Center,
.Name = "brdLabel", .Tag = "Label"}
Dim TextLabel As New TextBlock With {.Text = " MS Period: ", .TextAlignment = TextAlignment.Center,
.HorizontalAlignment = HorizontalAlignment.Center, .FontSize = 16, .Name = "tbLabel", .Tag = "Label"}
BorderLabel.Child = TextLabel
Children.Add(BorderLabel)
For ct = 1 To 12
Dim brdPeriod As New Border With {.BorderBrush = Brushes.Black, .Width = 32, .VerticalAlignment = VerticalAlignment.Center,
.Name = "brdP" & ct}
Dim tbPeriod As New TextBlock With {.Text = ct, .TextAlignment = TextAlignment.Center, .HorizontalAlignment = HorizontalAlignment.Center,
.FontSize = 16, .Tag = ct, .Name = "tbP" & ct}
If (ct < MinPeriod) Or (ct > MaxPeriod) Then brdPeriod.IsEnabled = False
AddHandler brdPeriod.MouseEnter, AddressOf HoverOverPeriod
AddHandler tbPeriod.MouseEnter, AddressOf HoverOverPeriod
AddHandler brdPeriod.MouseLeave, AddressOf LeavePeriod
AddHandler tbPeriod.MouseLeave, AddressOf LeavePeriod
AddHandler tbPeriod.PreviewMouseDown, AddressOf ChoosePeriod
brdPeriod.Child = tbPeriod
Children.Add(brdPeriod)
Next
CurrentPeriod = CurP
End Sub
#End Region
#Region "Public Methods"
Public Sub Reset()
CurrentPeriod = 0
For Each brd As Border In Children
Dim tb As TextBlock = brd.Child
If brd.Tag <> "Label" Then
tb.Foreground = Brushes.Black
tb.FontSize = 16
tb.FontWeight = FontWeights.SemiBold
End If
Next
End Sub
#End Region
#Region "Private Methods"
Private Sub HoverOverPeriod(sender As Object, e As MouseEventArgs)
Dim tb As TextBlock
If TypeOf (sender) Is TextBlock Then
tb = sender
Else
Dim brd As Border = sender
tb = brd.Child
End If
tb.FontSize = 30
End Sub
Private Sub LeavePeriod(sender As Object, e As MouseEventArgs)
Dim tb As TextBlock
If TypeOf (sender) Is TextBlock Then
tb = sender
Else
Dim brd As Border = sender
tb = brd.Child
End If
If FormatNumber(tb.Tag, 0) <> CurrentPeriod Then
tb.FontSize = 16
Else
tb.FontSize = 24
End If
End Sub
Private Sub ChoosePeriod(sender As Object, e As MouseEventArgs)
Dim tb As TextBlock
If TypeOf (sender) Is TextBlock Then
tb = sender
Else
Dim brd As Border = sender
tb = brd.Child
End If
If (FormatNumber(tb.Tag, 0) <> CurrentPeriod Or DisableSelectAll = False) Then
CurrentPeriod = FormatNumber(tb.Tag, 0)
Else
If CurrentPeriod <> 0 And DisableSelectAll = False Then Reset()
End If
If CurrentPeriod < MaxPeriod Then
Week.MaxWeek = 5
Week.CurrentWeek = 1
Else
Week.MaxWeek = 5
Week.CurrentWeek = 1
End If
Week.EnableWeeks()
End Sub
#End Region
End Class
|
Imports System
Imports System.Diagnostics
Imports System.Reflection
Imports System.Text
Imports System.Text.RegularExpressions
Imports System.Windows
Imports System.Windows.Controls
Namespace DevExpress.Internal
Public Class ExceptionHelper
Shared Sub New()
IsEnabled = True
End Sub
Public Shared Property IsEnabled() As Boolean
Public Shared Sub Initialize()
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf CurrentDomain_UnhandledException
End Sub
Private Shared arguments As UnhandledExceptionEventArgs
Private Shared Sub CurrentDomain_UnhandledException(ByVal sender As Object, ByVal e As UnhandledExceptionEventArgs)
Try
If Debugger.IsAttached OrElse (Not IsEnabled) Then
Return
End If
arguments = e
ShowWindow()
Catch e1 As Exception
End Try
End Sub
Private Shared Sub ShowWindow()
Dim message As String = GetMessage()
Dim window = New Window() With {.Width = 600, .Height = 400, .WindowStyle = WindowStyle.ToolWindow, .ShowActivated = True, .Title = "Unhandled exception"}
Dim grid = New Grid() With {.Margin = New Thickness(5)}
Dim closeButton = New Button() With {.Content = "Close", .Margin = New Thickness(3)}
AddHandler closeButton.Click, AddressOf button_Click
Dim copyButton = New Button() With {.Content = "Copy error", .Margin = New Thickness(3)}
AddHandler copyButton.Click, AddressOf copyButton_Click
Dim stackPanel = New StackPanel() With {.Orientation = Orientation.Horizontal, .HorizontalAlignment = HorizontalAlignment.Center}
System.Windows.Controls.Grid.SetRow(stackPanel, 1)
stackPanel.Children.Add(closeButton)
stackPanel.Children.Add(copyButton)
grid.RowDefinitions.Add(New RowDefinition() With {.Height = New GridLength(1, GridUnitType.Star)})
grid.RowDefinitions.Add(New RowDefinition() With {.Height = GridLength.Auto})
grid.Children.Add(stackPanel)
grid.Children.Add(New TextBox() With {.Text = message, .Margin = New Thickness(5)})
window.Content = grid
window.ShowDialog()
Environment.Exit(1)
End Sub
Private Shared Function GetMessage() As String
Dim ex As Exception = DirectCast(arguments.ExceptionObject, Exception)
Dim result = New StringBuilder()
If System.Reflection.Assembly.GetEntryAssembly() IsNot Nothing Then
result.Append("EntryAssembly: ")
result.Append(System.Reflection.Assembly.GetEntryAssembly().Location)
result.AppendLine()
End If
result.AppendLine("UnhandledException:")
PackException(ex, result)
Return result.ToString()
End Function
Private Shared Sub PackException(ByVal ex As Exception, ByVal stringBuilder As StringBuilder, Optional ByVal index As Integer = 0)
AppendLine(stringBuilder, ex.Message, index)
If Not String.IsNullOrWhiteSpace(ex.StackTrace) Then
AppendLine(stringBuilder, "StackTrace:", index)
AppendLine(stringBuilder, ex.StackTrace, index)
End If
If ex.InnerException IsNot Nothing Then
AppendLine(stringBuilder, "InnerException:", index)
index += 1
PackException(ex.InnerException, stringBuilder, index)
End If
End Sub
Private Shared Sub AppendLine(ByVal stringBuilder As StringBuilder, ByVal text As String, ByVal index As Integer)
Dim tabOffset As New String(ControlChars.Tab, index)
stringBuilder.Append(tabOffset)
Dim regex = New Regex(ControlChars.CrLf & "*\s")
stringBuilder.AppendLine(regex.Replace(text, ControlChars.CrLf & tabOffset))
End Sub
Private Shared Sub copyButton_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Clipboard.SetText(GetMessage())
End Sub
Private Shared Sub button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
Environment.Exit(1)
End Sub
End Class
End Namespace
|
Imports System.Runtime.InteropServices
Imports System.ComponentModel
Public Class TextBoxCBanner
Inherits TextBox
'Private _cueBanner As String ' en principe il faudrait le lire avec une fonction windows mais le code fait planter le programme
<DllImport("USER32.DLL", EntryPoint:="SendMessage")>
Public Shared Function SendMessage(hwnd As IntPtr, msg As UInt32, wParam As IntPtr, <MarshalAs(UnmanagedType.LPWStr)> ByVal lParam As String) As Integer
End Function
Private Property _cueBanner
<Category("Appearance"), Description("Texte grisé qui apparaît quand la boîte est vide"), Browsable(True), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)>
Public Property CueBanner As String
Get
Return _cueBanner
' Get
' 'Dim res As String = Space(510) ' censé réserver de la place pour le texte renvoyé
' 'SendMessage(Me.Handle, &H1502, 0, res) ' &H1502 = EM_GETCUEBANNER
' 'Return res
End Get
Set(value As String)
_cueBanner = value
SendMessage(Me.Handle, &H1501, 0, value) ' &H1501 = EM_SETCUEBANNER
End Set
End Property
End Class
|
Imports System.Data.SqlClient
Imports Cerberus
Public Class ResultadoCocina
Implements InterfaceTablas
Public idError As Integer
Public descripError As String
Public idResultadoCocina As Integer
Public idPeriodo As Integer
Public idEmpleado As Integer
Public nssEmpleado As String
Public idDepartamento As Integer
Public idCocinaAsig As Integer
Public idCocinaReg As Integer
Public costoComida As Decimal
Public descuento As Decimal
Public sansion As Decimal
Public numReg As Integer
Public idEmpresa As Integer
Public idSucursal As Integer
Public creado As DateTime
Public creadoPor As Integer
Public fecha As Date
Private conex As ConexionSQL
Private Ambiente As AmbienteCls
Public Sub New(Ambiente As AmbienteCls)
Me.Ambiente = Ambiente
Me.conex = Ambiente.conex
End Sub
Public Sub seteaDatos(rdr As SqlDataReader) Implements InterfaceTablas.seteaDatos
idResultadoCocina = rdr("idResultadoCocina")
idPeriodo = rdr("idPeriodo")
idEmpleado = rdr("idEmpleado")
nssEmpleado = If(IsDBNull(rdr("nssEmpleado")), Nothing, rdr("nssEmpleado"))
idDepartamento = rdr("idDepartamento")
idCocinaAsig = If(IsDBNull(rdr("idCocinaAsig")), Nothing, rdr("idCocinaAsig"))
idCocinaReg = If(IsDBNull(rdr("idCocinaReg")), Nothing, rdr("idCocinaReg"))
costoComida = If(IsDBNull(rdr("costoComida")), Nothing, rdr("costoComida"))
descuento = If(IsDBNull(rdr("descuento")), Nothing, rdr("descuento"))
sansion = If(IsDBNull(rdr("sansion")), Nothing, rdr("sansion"))
numReg = rdr("numReg")
idEmpresa = rdr("idEmpresa")
idSucursal = rdr("idSucursal")
creado = rdr("creado")
creadoPor = rdr("creadoPor")
fecha = rdr("fecha")
End Sub
Public Function totalPEmplyPeriodo(ByRef numReg As Integer, ByRef totalComidas As Decimal) As Boolean
numReg = 0
totalComidas = 0
conex.numCon = 0
conex.tabla = "ResultadoCocina"
conex.accion = "SELECT"
conex.agregaCampo("*")
conex.condicion = "WHERE idPeriodo=" & idPeriodo & " AND idEmpleado=" & idEmpleado
conex.armarQry()
If conex.ejecutaConsulta() Then
While conex.reader.Read
seteaDatos(conex.reader)
numReg += Me.numReg
totalComidas += numReg * (costoComida - descuento)
End While
conex.reader.Close()
Return True
Else
idError = conex.idError
descripError = conex.descripError
Return False
End If
End Function
Public Function guardar() As Boolean Implements InterfaceTablas.guardar
Throw New NotImplementedException()
End Function
Public Function actualizar() As Boolean Implements InterfaceTablas.actualizar
Throw New NotImplementedException()
End Function
Public Function eliminar() As Boolean Implements InterfaceTablas.eliminar
Throw New NotImplementedException()
End Function
Public Function buscarPID() As Boolean Implements InterfaceTablas.buscarPID
Throw New NotImplementedException()
End Function
Public Function getDetalleMod() As String Implements InterfaceTablas.getDetalleMod
Throw New NotImplementedException()
End Function
Public Function validaDatos(nuevo As Boolean) As Boolean Implements InterfaceTablas.validaDatos
Throw New NotImplementedException()
End Function
Public Function getCreadoPor() As Empleado Implements InterfaceTablas.getCreadoPor
Throw New NotImplementedException()
End Function
Public Function getActualizadoPor() As Empleado Implements InterfaceTablas.getActualizadoPor
Throw New NotImplementedException()
End Function
Public Function getEmpresa() As Empresa Implements InterfaceTablas.getEmpresa
Throw New NotImplementedException()
End Function
Public Function getSucursal() As Sucursal Implements InterfaceTablas.getSucursal
Throw New NotImplementedException()
End Function
Public Function armaQry(accion As String, esInsert As Boolean) As Boolean Implements InterfaceTablas.armaQry
Throw New NotImplementedException()
End Function
End Class
|
Imports Client.Authentication
Imports Client.World
Imports Client.Chat
Namespace UI
Public Interface IGameUI
Property Game() As IGame
Property LogLevel() As LogLevel
Sub Update()
Sub [Exit]()
#Region "Packet handler presenters"
Sub PresentRealmList(realmList As WorldServerList)
Sub PresentCharacterList(characterList As Character())
Sub PresentChatMessage(message As ChatMessage)
#End Region
#Region "UI Output"
Sub Log(message As String, Optional level As LogLevel = LogLevel.Info)
Sub LogLine(message As String, Optional level As LogLevel = LogLevel.Info)
Sub LogException(message As String)
#End Region
#Region "UI Input"
Function ReadLine() As String
Function Read() As Integer
Function ReadKey() As ConsoleKeyInfo
#End Region
End Interface
End Namespace
|
Imports System.Text.RegularExpressions
Namespace Extraction
Public MustInherit Class ComponentResourceProvider
Implements IResourceProvider
Private Shared ReadOnly DoubleQuotation As String = """"
Protected Shared ReadOnly ResourceKeyPropertyName As String = "ResourceKey"
Public MustOverride ReadOnly Property Expression() As Regex
Public MustOverride ReadOnly Property LocalizableProperties() As IEnumerable(Of String)
Public Overridable Function DetermineProviderResourceResult(contents As String) As ProviderResourceResult Implements IResourceProvider.DetermineProviderResourceResult
Dim resources As New List(Of ResourceEntry)()
For Each match As Match In Expression.Matches(contents)
Dim value As String = match.Groups(1).Value
If value.Contains(ResourceKeyPropertyName) Then
Dim resourceKey As String = GetResourceKey(value)
For Each [property] As String In LocalizableProperties
Dim resource As ResourceEntry = GetResource([property], value)
If Not resource.Equals(ResourceEntry.Empty) Then
resources.Add(resource)
End If
Next
End If
Next
Return New ProviderResourceResult(resources)
End Function
Protected Function GetResource(propertyName As String, tag As String) As ResourceEntry
Dim resource As ResourceEntry = ResourceEntry.Empty
Dim propertySpan = GetPropertySpan(propertyName, tag)
If propertySpan.Start <> -1 AndAlso propertySpan.End <> -1 Then
Dim resourceKey As String = GetResourceKey(tag)
resource = New ResourceEntry With {
.Name = $"{resourceKey}.{propertyName}",
.Value = tag.Substring(propertySpan.Start, propertySpan.End)
}
End If
Return resource
End Function
Protected Function GetResourceKey(tag As String) As String
Dim resourceKey As String = Nothing
Dim propertySpan = GetPropertySpan(ResourceKeyPropertyName, tag)
If propertySpan.Start <> -1 AndAlso propertySpan.End <> -1 Then
resourceKey = tag.Substring(propertySpan.Start, propertySpan.End)
End If
Return resourceKey
End Function
Protected Overridable Function GetPropertySpan(propertyName As String, tag As String) As (Start As Integer, [End] As Integer)
Dim propertySpan As (Integer, Integer) = (-1, -1)
Dim propertyText As String = $"{propertyName}="
Dim propertyIndex As Integer = tag.IndexOf(propertyText)
If propertyIndex > -1 Then
Dim propertyStartIndex As Integer = propertyIndex + propertyText.Length + 1
Dim propertyEndIndex As Integer = tag.IndexOf(DoubleQuotation, propertyStartIndex) - propertyStartIndex
propertySpan = (propertyStartIndex, propertyEndIndex)
End If
Return propertySpan
End Function
End Class
End Namespace
|
Imports Microsoft.VisualBasic
Namespace MB.TheBeerHouse.BLL.Store
Public Enum StatusCode As Integer
WaitingForPayment = 1
Confirmed = 2
Verified = 3
End Enum
End Namespace
|
Public Class GradoDificultad
Private selectGradoDificultad As New SqlClient.SqlCommand
Private insertGradoDificultad As New SqlClient.SqlCommand
Private updateGradoDificultad As New SqlClient.SqlCommand
Private deleteGradoDificultad As New SqlClient.SqlCommand
Private adaptadorGradoDificultad As New SqlClient.SqlDataAdapter
Public Sub cargarAdaptador()
'
'adaptadorGradoDificultad
'
Me.adaptadorGradoDificultad.DeleteCommand = Me.deleteGradoDificultad
Me.adaptadorGradoDificultad.InsertCommand = Me.insertGradoDificultad
Me.adaptadorGradoDificultad.SelectCommand = Me.selectGradoDificultad
Me.adaptadorGradoDificultad.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "gradodificultad", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("idgradodificultad", "idgradodificultad"), New System.Data.Common.DataColumnMapping("nombre", "nombre"), New System.Data.Common.DataColumnMapping("descripcion", "descripcion")})})
Me.adaptadorGradoDificultad.UpdateCommand = Me.updateGradoDificultad
'
'SqlSelectCommand1
'
Me.selectGradoDificultad.CommandText = "SELECT idgradodificultad, nombre, descripcion FROM gradodificultad"
Me.selectGradoDificultad.Connection = cnn
'
'SqlInsertCommand1
'
Me.insertGradoDificultad.CommandText = "INSERT INTO gradodificultad(idgradodificultad, nombre, descripcion) VALUES (@idgr" & _
"adodificultad, @nombre, @descripcion); SELECT idgradodificultad, nombre, descrip" & _
"cion FROM gradodificultad WHERE (idgradodificultad = @idgradodificultad)"
Me.insertGradoDificultad.Connection = cnn
Me.insertGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@idgradodificultad", System.Data.SqlDbType.Int, 4, "idgradodificultad"))
Me.insertGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@nombre", System.Data.SqlDbType.VarChar, 20, "nombre"))
Me.insertGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@descripcion", System.Data.SqlDbType.VarChar, 2147483647, "descripcion"))
'
'SqlUpdateCommand1
'
Me.updateGradoDificultad.CommandText = "UPDATE gradodificultad SET idgradodificultad = @idgradodificultad, nombre = @nomb" & _
"re, descripcion = @descripcion WHERE (idgradodificultad = @Original_idgradodific" & _
"ultad) AND (nombre = @Original_nombre OR @Original_nombre IS NULL AND nombre IS " & _
"NULL); SELECT idgradodificultad, nombre, descripcion FROM gradodificultad WHERE " & _
"(idgradodificultad = @idgradodificultad)"
Me.updateGradoDificultad.Connection = cnn
Me.updateGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@idgradodificultad", System.Data.SqlDbType.Int, 4, "idgradodificultad"))
Me.updateGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@nombre", System.Data.SqlDbType.VarChar, 20, "nombre"))
Me.updateGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@descripcion", System.Data.SqlDbType.VarChar, 2147483647, "descripcion"))
Me.updateGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_idgradodificultad", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "idgradodificultad", System.Data.DataRowVersion.Original, Nothing))
Me.updateGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_nombre", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "nombre", System.Data.DataRowVersion.Original, Nothing))
'
'SqlDeleteCommand1
'
Me.deleteGradoDificultad.CommandText = "DELETE FROM gradodificultad WHERE (idgradodificultad = @Original_idgradodificulta" & _
"d) AND (nombre = @Original_nombre OR @Original_nombre IS NULL AND nombre IS NULL" & _
")"
Me.deleteGradoDificultad.Connection = cnn
Me.deleteGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_idgradodificultad", System.Data.SqlDbType.Int, 4, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "idgradodificultad", System.Data.DataRowVersion.Original, Nothing))
Me.deleteGradoDificultad.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Original_nombre", System.Data.SqlDbType.VarChar, 20, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "nombre", System.Data.DataRowVersion.Original, Nothing))
'
'cnn
'
'Me.cnn.ConnectionString = "workstation id=OCTAVO;packet size=4096;integrated security=SSPI;initial catalog=A" & _
'"filar;persist security info=False"
End Sub
Public Sub cargarDatos(ByVal ds As DataSet, ByVal tabla As String)
adaptadorGradoDificultad.Fill(ds, tabla)
End Sub
Public Sub actualizarDatos(ByVal ds As DataSet, ByVal tabla As String)
adaptadorGradoDificultad.Update(ds, tabla)
End Sub
End Class
|
Friend Class clsCSVOutput
' 機能 : レース詳細のListを作成する
' 引き数 : strBuff - JVDデータから取得したレース詳細レコード
' aRaceList - レース詳細リスト
' 返り値 : なし
' 機能説明 : レース詳細レコードの情報を編集し、レース詳細リストに設定する
'
Public Sub RaceInfoMakeList(ByVal strBuff As String, ByRef aRaceList As ArrayList)
Dim bBuff As Byte()
Dim bSize As Long
Dim strRace As String
Dim strRaceInfo() As String
Dim strFromKey As String
Dim strNewKey As String
Try
bSize = 1272
bBuff = New Byte(bSize) {}
bBuff = Str2Byte(strBuff)
' リストの1件目にキー情報を追加する
' <競走識別情報>
strRace = MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & _
MidB2S(bBuff, 20, 2) & _
MidB2S(bBuff, 22, 2) & _
MidB2S(bBuff, 24, 2) & _
MidB2S(bBuff, 26, 2) & ","
' <競走識別情報>
strRace = strRace & MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & "," & _
objCodeConv.GetCodeName("2001", MidB2S(bBuff, 20, 2), "3") & "," & _
MidB2S(bBuff, 22, 2) & "," & _
MidB2S(bBuff, 24, 2) & "," & _
MidB2S(bBuff, 26, 2) & "," & _
objCodeConv.GetCodeName("2002", MidB2S(bBuff, 28, 1), "2") & "," & _
objCodeConv.GetCodeName("2008", MidB2S(bBuff, 622, 1), "1") & "," & _
MidB2S(bBuff, 698, 4) & "," & _
objCodeConv.GetCodeName("2009", MidB2S(bBuff, 706, 2), "2") & "," & _
MidB2S(bBuff, 874, 4) & "," & _
MidB2S(bBuff, 882, 2) & "," & _
Trim(MidB2S(bBuff, 33, 60)) & "," & _
Trim(MidB2S(bBuff, 93, 60)) & "," & _
Trim(MidB2S(bBuff, 153, 60))
'出走頭数をやめて登録頭数を取得するよう修正
'MidB2S(bBuff, 884, 2) & "," & _
' レース情報を判定し、更新があった場合はリストを更新する
For i = 0 To RaceInfo.Count - 1
' 各レース情報から先頭25文字をキーとして取得
strRaceInfo = RaceInfo(i)
strFromKey = strRaceInfo(CommonConstant.Const0) & "," & _
strRaceInfo(CommonConstant.Const1)
strNewKey = Strings.Left(strRace, CommonConstant.Const25)
' 現在レース情報と取得したレース情報のキーを比較する
If strFromKey = strNewKey Then
' レース情報を比較して異なる場合、現在レース情報を更新する
If Join(strRaceInfo, ",") <> strRace Then
RaceInfo.Item(i) = strRace.Split(","c)
Exit For
End If
End If
Next
' レース情報がすでに追加済みかチェック
If Not aRaceList.Contains(strRace) Then
aRaceList.Add(strRace)
End If
bBuff = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : レース詳細のCSVファイルを出力する
' 引き数 : strFileName - ファイル名
' strFilePath - 出力パス
' aRaceList - レース詳細リスト
' 返り値 : なし
' 機能説明 : 指定されたパスにレース詳細のCSVファイルを出力する
'
Public Sub RaceInfoOutput(ByVal strFileName As String, ByVal strFilePath As String, ByVal aRaceList As ArrayList)
Try
Dim i As Integer
Dim strCsvPath As String ' 保存先のCSVファイルパス
Dim strCsvName As String ' 保存先のCSVファイル名
Dim workRaceList As New ArrayList
' 引数fileNameからCSVファイル名を作成
'strCsvName = strFileName
strCsvName = Mid(strFileName, 1, InStr(strFileName, ".") - 1) & CommonConstant.CSV
strCsvPath = strFilePath & "\" & strCsvName
If System.IO.File.Exists(strCsvPath) Then
' ファイルを削除
Kill(strCsvPath)
End If
Dim enc As System.Text.Encoding = System.Text.Encoding.GetEncoding(CommonConstant.EncType)
Dim sr As New System.IO.StreamWriter(strCsvPath, True, enc)
' 取得した全レース詳細をCSVに出力する(20100912修正)
For i = 0 To aRaceList.Count - 1
' <競走識別情報>
sr.Write(aRaceList.Item(i).ToString)
sr.Write(vbCrLf)
Next
'' レース詳細をArrayList<String>に変換する
'For i = 0 To RaceInfo.Count - 1
' strWorkRace = Join(RaceInfo(i), ",")
' workRaceList.Add(strWorkRace)
'Next
'For i = 0 To workRaceList.Count - 1
' ' CSVファイルにレコードが存在するかチェックする
' ' 取得したレース詳細リストにデータが存在する場合はリストに追加しない
' If Not aRaceList.Contains(workRaceList.Item(i)) Then
' ' <競走識別情報>
' sr.Write(workRaceList.Item(i).ToString)
' sr.Write(vbCrLf)
' End If
'Next
'For i = 0 To aRaceList.Count - 1
' ' CSVファイルにレコードが存在するかチェックする
' ' レース詳細リストに取得データが存在する場合はリストに追加しない
' If Not workRaceList.Contains(aRaceList.Item(i)) Then
' ' <競走識別情報>
' sr.Write(aRaceList.Item(i).ToString)
' sr.Write(vbCrLf)
' End If
'Next
''For i = 0 To aRaceList.Count - 1
'' ' CSVファイルにレコードが存在するかチェックする
'' ' レース詳細リストに取得データが存在する場合はリストに追加しない
'' If ((RaceInfo.Count = 0) Or _
'' (Not workRaceList.Contains(aRaceList.Item(i)))) Then
'' '' <競走識別情報>
'' sr.Write(aRaceList.Item(i).ToString)
'' sr.Write(vbCrLf)
'' ' ファイルオープンフラグをFalseにする
'' gFileOpenFlg = False
'' End If
'' '' <競走識別情報>
'' 'sr.Write(aRaceList.Item(i).ToString)
'' 'sr.Write(vbCrLf)
''Next
' 閉じる
sr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : 馬毎レース情報のListを作成する
' 引き数 : strBuff - JVDデータから取得した馬毎レース情報レコード
' aHorseList - 馬毎レース情報リスト
' 返り値 : なし
' 機能説明 : 馬毎レース情報レコードの情報を編集し、馬毎レース情報リストに設定する
'
Public Sub HorseMakeList(ByVal strBuff As String, ByRef aHorseList As ArrayList)
Dim bBuff As Byte()
Dim bSize As Long
Dim strHorse As String ' レース情報
Dim strHorseInfo() As String
Dim strFromKey As String
Dim strNewKey As String
Try
bSize = 2042
bBuff = New Byte(bSize) {}
bBuff = Str2Byte(strBuff)
strHorse = ""
' 馬番が未決定の場合は処理終了
If MidB2S(bBuff, 29, 2) = CommonConstant.No_HorseNo Then
Exit Sub
End If
' リストの1件目にキー情報を追加する
' <競走識別情報>
strHorse = MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & _
MidB2S(bBuff, 20, 2) & _
MidB2S(bBuff, 22, 2) & _
MidB2S(bBuff, 24, 2) & _
MidB2S(bBuff, 26, 2) & ","
' <馬毎レース情報>
strHorse = strHorse & _
MidB2S(bBuff, 29, 2) & "," & _
Trim(MidB2S(bBuff, 41, 36)) & "," & _
Trim(MidB2S(bBuff, 307, 8))
' 馬毎レース情報を判定し、更新があった場合はリストを更新する
For i = 0 To AllHorseInfo.Count - 1
' 各レース情報から先頭19文字をキーとして取得
strHorseInfo = AllHorseInfo(i)
strFromKey = strHorseInfo(CommonConstant.Const0) & "," & _
strHorseInfo(CommonConstant.Const1)
strNewKey = Strings.Left(strHorse, CommonConstant.Const19)
' 現在レース情報と取得したレース情報のキーを比較する
If strFromKey = strNewKey Then
' レース情報を比較して異なる場合、現在レース情報を更新する
If Join(strHorseInfo, ",") <> strHorse Then
AllHorseInfo.Item(i) = strHorse.Split(","c)
Exit For
End If
End If
Next
' レース情報がすでに追加済みかチェック
If Not aHorseList.Contains(strHorse) Then
aHorseList.Add(strHorse)
End If
bBuff = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : オッズ(単複枠)のListを作成する
' 引き数 : strBuff - JVDデータから取得したオッズ(単複枠)レコード
' aOdds1List - オッズ(単複枠)リスト
' 返り値 : なし
' 機能説明 : オッズ(単複枠)レコードの情報を編集し、オッズ(単複枠)リストに設定する
'
Public Sub Odds1MakeList(ByVal strBuff As String, ByRef aOdds1List As ArrayList)
Dim i As Integer
Dim bBuff As Byte()
Dim bSize As Long
Dim bOddsInfo As Byte() ' オッズ詳細情報
Dim strOdds As String ' オッズ情報
Try
bSize = 962
bBuff = New Byte(bSize) {}
bBuff = Str2Byte(strBuff)
strOdds = ""
' リストの1件目にキー情報を追加する
' <競走識別情報>
strOdds = MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & _
MidB2S(bBuff, 20, 2) & _
MidB2S(bBuff, 22, 2) & _
MidB2S(bBuff, 24, 2) & _
MidB2S(bBuff, 26, 2) & ","
' <発表月日時分>
bOddsInfo = MidB2B(bBuff, 28, 8)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 2) & _
MidB2S(bOddsInfo, 3, 2) & _
MidB2S(bOddsInfo, 5, 2) & _
MidB2S(bOddsInfo, 7, 2) & ","
' 馬番(28頭立て)分繰り返す
For i = 0 To 27
' <単勝オッズ>
' 馬番、オッズ
bOddsInfo = MidB2B(bBuff, 44 + (8 * i), 8)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 2) & "," & _
MidB2S(bOddsInfo, 3, 4) & ","
' <複勝オッズ>
' 最低オッズ
bOddsInfo = MidB2B(bBuff, 268 + (12 * i), 12)
strOdds = strOdds & _
MidB2S(bOddsInfo, 3, 4) & ","
Next
' <登録頭数>
strOdds = strOdds & MidB2S(bBuff, 36, 2)
'出走頭数をやめて登録頭数を取得するよう修正
'' <出走頭数>
'strOdds = strOdds & MidB2S(bBuff, 38, 2)
aOdds1List.Add(strOdds)
bBuff = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : オッズ2(馬連)のListを作成する
' 引き数 : strBuff - JVDデータから取得したオッズ2(馬連)レコード
' aOdds2List - オッズ2(馬連)リスト
' 返り値 : なし
' 機能説明 : オッズ2(馬連)レコードの情報を編集し、オッズ2(馬連)リストに設定する
'
Public Sub Odds2MakeList(ByVal strBuff As String, ByRef aOdds2List As ArrayList)
Dim i As Integer
Dim bBuff As Byte()
Dim bSize As Long
Dim bOddsInfo As Byte() ' オッズ詳細情報
Dim strOdds As String ' オッズ情報
Try
bSize = 2042
bBuff = New Byte(bSize) {}
bBuff = Str2Byte(strBuff)
strOdds = ""
' リストの1件目にキー情報を追加する
' <競走識別情報>
strOdds = MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & _
MidB2S(bBuff, 20, 2) & _
MidB2S(bBuff, 22, 2) & _
MidB2S(bBuff, 24, 2) & _
MidB2S(bBuff, 26, 2) & ","
' <発表月日時分>
bOddsInfo = MidB2B(bBuff, 28, 8)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 2) & _
MidB2S(bOddsInfo, 3, 2) & _
MidB2S(bOddsInfo, 5, 2) & _
MidB2S(bOddsInfo, 7, 2) & ","
For i = 0 To 152
' <馬連オッズ>
' 組番、オッズ
bOddsInfo = MidB2B(bBuff, 41 + (13 * i), 13)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 4) & "," & _
MidB2S(bOddsInfo, 5, 6) & ","
Next
aOdds2List.Add(strOdds)
bBuff = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : オッズ4(馬単)のListを作成する
' 引き数 : strBuff - JVDデータから取得したオッズ4(馬単)レコード
' aOdds4List - オッズ4(馬単)リスト
' 返り値 : なし
' 機能説明 : オッズ4(馬単)レコードの情報を編集し、オッズ4(馬単)リストに設定する
'
Public Sub Odds4MakeList(ByVal strBuff As String, ByRef aOdds4List As ArrayList)
Dim i As Integer
Dim bBuff As Byte()
Dim bSize As Long
Dim bOddsInfo As Byte() ' オッズ詳細情報
Dim strOdds As String ' オッズ情報
Try
bSize = 4031
bBuff = New Byte(bSize) {}
bBuff = Str2Byte(strBuff)
strOdds = ""
' リストの1件目にキー情報を追加する
' <競走識別情報>
strOdds = MidB2S(bBuff, 12, 4) & _
MidB2S(bBuff, 16, 4) & _
MidB2S(bBuff, 20, 2) & _
MidB2S(bBuff, 22, 2) & _
MidB2S(bBuff, 24, 2) & _
MidB2S(bBuff, 26, 2) & ","
' <発表月日時分>
bOddsInfo = MidB2B(bBuff, 28, 8)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 2) & _
MidB2S(bOddsInfo, 3, 2) & _
MidB2S(bOddsInfo, 5, 2) & _
MidB2S(bOddsInfo, 7, 2) & ","
For i = 0 To 305
' <馬連オッズ>
bOddsInfo = MidB2B(bBuff, 41 + (13 * i), 13)
strOdds = strOdds & _
MidB2S(bOddsInfo, 1, 4) & "," & _
MidB2S(bOddsInfo, 5, 6) & ","
Next
aOdds4List.Add(strOdds)
bBuff = Nothing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : 馬毎レース情報のCSVファイルを出力する
' 引き数 : strFileName - ファイル名
' strFilePath - 出力パス
' aHorseList - 馬毎レース情報のリスト
' 返り値 : なし
' 機能説明 : 指定されたパスにCSVファイルを出力する
'
Public Sub SeInfoOutput(ByVal strFileName As String, ByVal strFilePath As String, ByVal aHorseList As ArrayList)
Try
Dim i As Integer
Dim strCsvPath As String ' 保存先のCSVファイルパス
Dim strCsvName As String ' 保存先のCSVファイル名
Dim workRaceList As New ArrayList
' 引数fileNameからCSVファイル名を作成
'strCsvName = strFileName
strCsvName = Mid(strFileName, 1, InStr(strFileName, ".") - 1) & CommonConstant.CSV
strCsvPath = strFilePath & "\" & strCsvName
If System.IO.File.Exists(strCsvPath) Then
' ファイルを削除
Kill(strCsvPath)
End If
Dim enc As System.Text.Encoding = System.Text.Encoding.GetEncoding(CommonConstant.EncType)
Dim sr As New System.IO.StreamWriter(strCsvPath, True, enc)
' 取得した全馬毎レース情報をCSVに出力する(20100912修正)
For i = 0 To aHorseList.Count - 1
' <競走識別情報>
sr.Write(aHorseList.Item(i).ToString)
sr.Write(vbCrLf)
Next
'' レース詳細をArrayList<String>に変換する
'For i = 0 To AllHorseInfo.Count - 1
' strWorkRace = Join(AllHorseInfo(i), ",")
' workRaceList.Add(strWorkRace)
'Next
'For i = 0 To workRaceList.Count - 1
' ' CSVファイルにレコードが存在するかチェックする
' ' 取得したレース詳細リストにデータが存在する場合はリストに追加しない
' If Not aHorseList.Contains(workRaceList.Item(i)) Then
' ' <馬毎レース情報>
' sr.Write(workRaceList.Item(i).ToString)
' sr.Write(vbCrLf)
' End If
'Next
'For i = 0 To aHorseList.Count - 1
' ' CSVファイルにレコードが存在するかチェックする
' ' レース詳細リストに取得データが存在する場合はリストに追加しない
' If Not workRaceList.Contains(aHorseList.Item(i)) Then
' ' <馬毎レース情報>
' sr.Write(aHorseList.Item(i).ToString)
' sr.Write(vbCrLf)
' End If
'Next
''For i = 0 To aHorseList.Count - 1
'' ' CSVファイルにレコードが存在するかチェックする
'' ' 馬毎レース情報リストに取得データが存在する場合はリストに追加しない
'' If ((AllHorseInfo.Count = 0) Or _
'' (Not workRaceList.Contains(aHorseList.Item(i)))) Then
'' ' <馬毎レース情報>
'' sr.Write(aHorseList.Item(i).ToString)
'' sr.Write(","c)
'' sr.Write(vbCrLf)
'' End If
'' '' <馬毎レース情報>
'' 'sr.Write(aHorseList.Item(i).ToString)
'' 'sr.Write(","c)
'' 'sr.Write(vbCrLf)
''Next
' 閉じる
sr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
' 機能 : オッズ情報のCSVファイルを出力する
' 引き数 : strFileName - ファイル名
' strFilePath - 出力パス
' aOddsList - オッズ情報のリスト
' strDataKbn - データ区分(1:単複枠、2:馬連、3:馬単)
' 返り値 : なし
' 機能説明 : 指定されたパスにCSVファイルを出力する
'
Public Sub OddsOutput(ByVal strFileName As String, ByVal strFilePath As String, _
ByVal aOddsList As ArrayList, ByVal strDataKbn As String)
Try
Dim i As Integer
Dim strCsvPath As String ' 保存先のCSVファイルパス
Dim strCsvName As String ' 保存先のCSVファイル名
' 引数fileNameからCSVファイル名を作成
strCsvName = strFileName
'strCsvName = Mid(strFileName, 1, InStr(strFileName, ".") - 1) & CommonConstant.CSV
strCsvPath = strFilePath & "\" & strCsvName
Dim enc As System.Text.Encoding = System.Text.Encoding.GetEncoding(CommonConstant.EncType)
Dim sr As New System.IO.StreamWriter(strCsvPath, True, enc)
For i = 0 To aOddsList.Count - 1
' CSVファイルにレコードが存在するかチェックする
' オッズ情報1リストに取得データが存在する場合はリストに追加しない
If (strDataKbn = CommonConstant.TanshouOddsKbn) And _
(TanFukuAllOddsInfo.Count = 0 Or _
Not TanFukuAllOddsInfo.Contains(aOddsList.Item(i))) Then
' <オッズ情報>
sr.Write(aOddsList.Item(i).ToString)
sr.Write(","c)
sr.Write(vbCrLf)
End If
' CSVファイルにレコードが存在するかチェックする
' オッズ情報2リストに取得データが存在する場合はリストに追加しない
If (strDataKbn = CommonConstant.UmarenOddsKbn) And _
(UmarenAllOddsInfo.Count = 0 Or _
Not UmarenAllOddsInfo.Contains(aOddsList.Item(i))) Then
' <オッズ情報>
sr.Write(aOddsList.Item(i).ToString)
sr.Write(","c)
sr.Write(vbCrLf)
End If
' CSVファイルにレコードが存在するかチェックする
' オッズ情報4リストに取得データが存在する場合はリストに追加しない
If (strDataKbn = CommonConstant.UmatanOddsKbn) And _
(UmatanAllOddsInfo.Count = 0 Or _
Not UmatanAllOddsInfo.Contains(aOddsList.Item(i))) Then
' <オッズ情報>
sr.Write(aOddsList.Item(i).ToString)
sr.Write(","c)
sr.Write(vbCrLf)
End If
Next
' 閉じる
sr.Close()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class
|
Option Strict On 'プロジェクトのプロパティでも設定可能
'Imports System.Data.OleDb
'Imports System.Text.RegularExpressions
Public Class cMstCsvLayoutDBIO
Private pConn As OleDb.OleDbConnection
Private pCommand As OleDb.OleDbCommand
Private pDataReader As OleDb.OleDbDataReader
Private pMessageBox As cMessageLib.fMessage
Sub New(ByRef iConn As OleDb.OleDbConnection, ByRef iCommand As OleDb.OleDbCommand, ByRef iDataReader As OleDb.OleDbDataReader)
pConn = iConn
pCommand = iCommand
pDataReader = iDataReader
End Sub
'----------------------------------------------------------------------
' 機能:精算データから該当精算コード以上のレコードを取得する関数
' 引数:ParCsvLayout 取得データセット用バッファ
' KeyCsvLayoutCode 精算コード
' Mode 1:指定精算コードのデータ取得
' 2:指定精算コード以上の入金データ取得
' 戻値:取得レコード数
'----------------------------------------------------------------------
Public Function getCsvLayout(ByRef ParCsvLayout() As cStructureLib.sCsvLayout, _
ByVal KeySoftCode As Integer, _
ByRef Tran As System.Data.OleDb.OleDbTransaction) As Long
Dim i As Integer
Dim StrSelect As String
StrSelect = "SELECT * FROM CSVレイアウトマスタ WHERE ソフトコード = " & KeySoftCode & " ORDER BY No "
Try
'SQL文の設定
pCommand = pConn.CreateCommand
pCommand.Transaction = Tran
pCommand.CommandText = StrSelect
pDataReader = pCommand.ExecuteReader()
i = 0
While pDataReader.Read()
ReDim Preserve ParCsvLayout(CInt(i))
'レコードが取得できた時の処理
'ソフトコード
If IsDBNull(pDataReader("ソフトコード")) = True Then
ParCsvLayout(i).sSoftCode = 0
Else
ParCsvLayout(i).sSoftCode = CInt(pDataReader("ソフトコード"))
End If
'No
If IsDBNull(pDataReader("No")) = True Then
ParCsvLayout(i).sDataClass = 0
Else
ParCsvLayout(i).sDataClass = CInt(pDataReader("No"))
End If
'項目名称
ParCsvLayout(i).sColumnNo = pDataReader("項目名称").ToString
'長さ
If IsDBNull(pDataReader("長さ")) = True Then
ParCsvLayout(i).sColumnName = 0
Else
ParCsvLayout(i).sColumnName = CInt(pDataReader("長さ"))
End If
'型
ParCsvLayout(i).sColumnType = pDataReader("型").ToString
'レコードが取得できた時の処理
i = i + 1
End While
getCsvLayout = i
Catch oExcept As Exception
'例外が発生した時の処理
pMessageBox = New cMessageLib.fMessage(1, "システムエラー(cDataCsvLayoutDBIO.getCsvLayout)", Nothing, Nothing, oExcept.ToString)
pMessageBox.ShowDialog()
pMessageBox.Dispose()
pMessageBox = Nothing
Environment.Exit(1)
Finally
If IsNothing(pDataReader) = False Then
pDataReader.Close()
End If
End Try
End Function
End Class
|
<Command("Percent Fill", "Level |0-100|L Type |1-4| FIll|0-1|", , "30", "5", CommandType.Standard),
TranslateCommand("zh-TW", "百分比入水", "进水水位|0-100|% 水源选择|1-4| 补水选择|0-1|"),
Description("MID=900L,2=COLD+HOT 1=HOT 0=COLD"),
TranslateDescription("zh-TW", "水位=0-100%, 4=进水4 3=进水3 2=进水2 1=进水1")>
Public NotInheritable Class Command10
Inherits MarshalByRefObject
Implements ACCommand
Public Enum S09
Off
WaitStopCirPump
WaitTempSafe
WaitForLevel
WaitLowLevel
WaitStartPump
WaitMiddleLevel
WaitHighLevel
Pause
End Enum
Public StateString As String
Public Wait As New Timer
Public MainTankLevel, Qty As Integer
Public WaterType As Integer
Public CoolFill As Boolean
Public Function Start(ByVal ParamArray param() As Integer) As Boolean Implements ACCommand.Start
With ControlCode
'ToDo 執行此命令時要停止其他命令
.Command01.Cancel() : .Command02.Cancel() : .Command03.Cancel() : .Command04.Cancel() : .Command06.Cancel()
.Command08.Cancel() : .Command09.Cancel() : .Command10.Cancel() : .Command13.Cancel() : .Command15.Cancel()
.Command16.Cancel() : .Command20.Cancel() : .Command24.Cancel() : .Command31.Cancel() : .Command35.Cancel()
.Command36.Cancel() : .Command39.Cancel() : .Command40.Cancel() : .Command41.Cancel() : .Command42.Cancel()
.Command43.Cancel() : .Command44.Cancel() : .Command45.Cancel() : .Command46.Cancel() : .Command47.Cancel()
.Command55.Cancel() : .Command56.Cancel() : .Command66.Cancel() : .Command67.Cancel() : .Command74.Cancel()
.Command75.Cancel() : .Command76.Cancel() : .Command77.Cancel() : .Command78.Cancel()
.Command90.Cancel() : .Command91.Cancel() : .Command92.Cancel() : .Command93.Cancel() : .Command94.Cancel()
.Command95.Cancel() : .Command96.Cancel()
.TemperatureControl.Cancel()
.TempControlFlag = False
'补水关闭
'.WaterType = 0
WaterType = MinMax(param(2), 1, 4) '水源選擇
Qty = MinMax(param(1), 0, 100) '水位選擇
' .MainPumpOn = False 'ControlCode.PumpStopRequest = 1
.FillWater = param(3)
.QTY = Qty
.WaterType = WaterType
Wait.TimeRemaining = 1
State = S09.WaitTempSafe '1*1000 放到 Wait.TimeRemaining
End With
End Function
Public Function Run() As Boolean Implements ACCommand.Run
With ControlCode
Select Case State
Case S09.Off
StateString = ""
Case S09.WaitStopCirPump
StateString = "停止主泵"
If Not Wait.Finished Then Exit Select
.MainPumpOn = False
.FanOn = False
State = S09.WaitTempSafe
Case S09.WaitTempSafe
If .Parent.IsPaused Or Not .IO.SystemAuto Then
Wait.Pause()
StateWas = State
State = S09.Pause
End If
If .IO.MainTemperature >= .Parameters.SetSafetyTemp * 10 Then '實際溫度大於或等於安全溫度 跳"溫度異常"
StateString = "主缸溫度過高,禁止入水"
.Alarms.HighTempNoFill = True
Exit Select
End If
.Alarms.HighTempNoFill = False
State = S09.WaitForLevel
Case S09.WaitForLevel
If .Parent.IsPaused Or Not .IO.SystemAuto Then
Wait.Pause()
StateWas = State
State = S09.Pause
End If
' If Qty = 1 Then
' Dim TotleWater As Integer
'TotleWater = .浴比 * .布重 \ 10
'MainTankLevel = MinMax(TotleWater, 0, .Parameters.MailTankMaxFill) - .DyeWater '干布-化料用水
'ElseIf Qty = 2 Then
'Dim suckwater As Integer
'suckwater = .SuckWater \ 100
'Dim TotleWater As Integer
'TotleWater = .浴比 * .布重 \ 10
'MainTankLevel = MinMax(TotleWater - (.布重 * suckwater), 0, .Parameters.MailTankMaxFill) - .DyeWater '湿布进水公式
'Else
MainTankLevel = Qty
'End If
State = S09.WaitMiddleLevel
Case S09.WaitMiddleLevel
If .Parent.IsPaused Or Not .IO.SystemAuto Then
Wait.Pause()
StateWas = State
State = S09.Pause
End If
StateString = If(.Language = LanguageValue.ZhTW, "主缸进水到: ", "Filling To") & .MainTankLevel & "/" & (MainTankLevel * .Parameters.MailTankMaxFill \ 100) & "L " & .主缸水尺水量 & "/" & Qty & "%"
If Not .MainTankLevel > ((.Parameters.MailTankMaxFill \ 100) * MainTankLevel - .Parameters.CloseFill) Then Exit Select
State = S09.WaitLowLevel
Case S09.WaitLowLevel
StateString = If(.Language = LanguageValue.ZhTW, "等待低水位到达", ",")
If Not .IO.LowLevel Then Exit Select
If .Parameters.启动马达 = 0 Then
State = S09.WaitHighLevel
End If
State = S09.WaitStartPump
Case = S09.WaitStartPump
' If .Parameters.启动马达 = 0 Then
'State = S09.WaitHighLevel
' End If
StateString = If(.Language = LanguageValue.ZhTW, "等待主泵启动", ",")
.MainPumpOn = True
.FanOn = True
.FillPumpSpeed = .Parameters.MainPumpManualSpeed
.FillFanSpeed = .Parameters.FanManualSpeed
.FillSwingSpeed = .Parameters.SwingManualSpeed
If Not .IO.FanPumpFB Then Exit Select
State = S09.WaitHighLevel
Case S09.WaitHighLevel
StateString = If(.Language = LanguageValue.ZhTW, "主缸进水到: ", "Filling To") & ".MainTankLevel " & "/" & MainTankLevel & "%"
If Not .MainTankLevel > ((.Parameters.MailTankMaxFill \ 100) * MainTankLevel - .Parameters.CloseFill) Then Exit Select
State = S09.Off
Case S09.Pause
StateString = If(.Language = LanguageValue.ZhTW, "暂停", "Paused") & " " & TimerString(Wait.TimeRemaining)
If (Not .Parent.IsPaused) And .IO.SystemAuto Then
Wait.Restart()
State = StateWas
StateWas = S09.Off
End If
End Select
End With
End Function
Public Sub Cancel() Implements ACCommand.Cancel
State = S09.Off
CoolFill = False
Wait.Cancel()
End Sub
Public Sub ParametersChanged(ByVal ParamArray param() As Integer) Implements ACCommand.ParametersChanged
WaterType = MinMax(param(2), 1, 4) '水源選擇
Qty = MinMax(param(1), 0, 100) '水位選擇
If Qty = 1 Then
Dim TotleWater As Integer
TotleWater = ControlCode.浴比 * ControlCode.布重 \ 10
MainTankLevel = MinMax(TotleWater, 0, ControlCode.Parameters.MailTankMaxFill) - ControlCode.DyeWater '干布-化料用水
ElseIf Qty = 2 Then
Dim suckwater As Integer
suckwater = ControlCode.SuckWater \ 100
Dim TotleWater As Integer
TotleWater = ControlCode.浴比 * ControlCode.布重 \ 10
MainTankLevel = MinMax(TotleWater - (ControlCode.布重 * suckwater), 0, ControlCode.Parameters.MailTankMaxFill) - ControlCode.DyeWater '湿布进水公式
Else
MainTankLevel = Qty
End If
End Sub
#Region "Standard Definitions"
Private ReadOnly ControlCode As ControlCode
Public Sub New(ByVal controlCode As ControlCode)
Me.ControlCode = controlCode
End Sub
Friend ReadOnly Property IsOn() As Boolean Implements ACCommand.IsOn
Get
Return State <> S09.Off
End Get
End Property
<EditorBrowsable(EditorBrowsableState.Advanced)> Private state_ As S09
Public Property State() As S09
Get
Return state_
End Get
Private Set(ByVal value As S09)
state_ = value
End Set
End Property
<EditorBrowsable(EditorBrowsableState.Advanced)> Private statewas_ As S09
Public Property StateWas() As S09
Get
Return statewas_
End Get
Private Set(ByVal value As S09)
statewas_ = value
End Set
End Property
Public ReadOnly Property IsFill1() As Boolean
Get
Return (WaterType = 1) AndAlso ((State = S09.WaitForLevel) Or (State = S09.WaitMiddleLevel))
End Get
End Property
Public ReadOnly Property IsFill2() As Boolean
Get
Return (WaterType = 2) AndAlso ((State = S09.WaitForLevel) Or (State = S09.WaitMiddleLevel))
End Get
End Property
Public ReadOnly Property IsFill3() As Boolean
Get
Return (WaterType = 3) AndAlso ((State = S09.WaitForLevel) Or (State = S09.WaitMiddleLevel))
End Get
End Property
Public ReadOnly Property IsFill4() As Boolean
Get
Return (WaterType = 4) AndAlso ((State = S09.WaitForLevel) Or (State = S09.WaitMiddleLevel))
End Get
End Property
Public ReadOnly Property IsCoolFill() As Boolean
Get
Return CoolFill AndAlso ((State = S09.WaitForLevel) Or (State = S09.WaitMiddleLevel))
End Get
End Property
#End Region
End Class
#Region "Class Instance"
Partial Public Class ControlCode
Public ReadOnly Command10 As New Command10(Me)
End Class
#End Region
|
Public Class RegistrationBO
Private m_RegistrationID As Long
Private m_AccessRoleID As String
Private m_PermitKey As String
Private m_Contact As ContactDO
Private m_Address As AddressDO
Private m_RegistrationDescription As String
Private m_UserToken As String
Private m_TermsOfUse As Boolean
Private m_ActivationDate As System.Nullable(Of DateTime)
Private m_ExpirationDate As System.Nullable(Of DateTime)
Private m_FirstName As String
Private m_LastName As String
Private m_Title As String
Private m_CompanyName As String
Private m_Phone As String
Private m_Email As String
Private m_ContactType As String
Private m_Address1 As String
Private m_AddressType As String
Private m_City As String
Private m_StateID As String
Private m_Zipcode As String
Public Property RegistrationID() As Long
Get
Return m_RegistrationID
End Get
Set(value As Long)
m_RegistrationID = value
End Set
End Property
Public Property AccessRoleID() As String
Get
Return m_AccessRoleID
End Get
Set(value As String)
m_AccessRoleID = value
End Set
End Property
Public Property PermitKey() As String
Get
Return m_PermitKey
End Get
Set(value As String)
m_PermitKey = value
End Set
End Property
Public Property Contact() As ContactDO
Get
Return m_Contact
End Get
Set(value As ContactDO)
m_Contact = value
End Set
End Property
Public Property Address() As AddressDO
Get
Return m_Address
End Get
Set(value As AddressDO)
m_Address = value
End Set
End Property
Public Property RegistrationDescription() As String
Get
Return m_RegistrationDescription
End Get
Set(value As String)
m_RegistrationDescription = value
End Set
End Property
Public Property UserToken() As String
Get
Return m_UserToken
End Get
Set(value As String)
m_UserToken = value
End Set
End Property
Public Property TermsOfUse() As Boolean
Get
Return m_TermsOfUse
End Get
Set(value As Boolean)
m_TermsOfUse = value
End Set
End Property
Public Property ActivationDate() As System.Nullable(Of DateTime)
Get
Return m_ActivationDate
End Get
Set(value As System.Nullable(Of DateTime))
m_ActivationDate = value
End Set
End Property
Public Property ExpirationDate() As System.Nullable(Of DateTime)
Get
Return m_ExpirationDate
End Get
Set(value As System.Nullable(Of DateTime))
m_ExpirationDate = value
End Set
End Property
Public Property FirstName() As String
Get
Return m_FirstName
End Get
Set(value As String)
m_FirstName = value
End Set
End Property
Public Property LastName() As String
Get
Return m_LastName
End Get
Set(value As String)
m_LastName = value
End Set
End Property
Public Property Title() As String
Get
Return m_Title
End Get
Set(value As String)
m_Title = value
End Set
End Property
Public Property CompanyName() As String
Get
Return m_CompanyName
End Get
Set(value As String)
m_CompanyName = value
End Set
End Property
Public Property Phone() As String
Get
Return m_Phone
End Get
Set(value As String)
m_Phone = Value
End Set
End Property
Public Property Email() As String
Get
Return m_Email
End Get
Set(value As String)
m_Email = value
End Set
End Property
Public Property Address1() As String
Get
Return m_Address1
End Get
Set(value As String)
m_Address1 = value
End Set
End Property
Public Property AddressType() As String
Get
Return m_AddressType
End Get
Set(value As String)
m_AddressType = value
End Set
End Property
Public Property ContactType() As String
Get
Return m_ContactType
End Get
Set(value As String)
m_ContactType = value
End Set
End Property
Public Property City() As String
Get
Return m_City
End Get
Set(value As String)
m_City = value
End Set
End Property
Public Property StateID() As String
Get
Return m_StateID
End Get
Set(value As String)
m_StateID = value
End Set
End Property
Public Property Zipcode() As String
Get
Return m_Zipcode
End Get
Set(value As String)
m_Zipcode = value
End Set
End Property
End Class
|
'Options
Option Explicit On
Option Strict On
Option Infer Off
Public Class clsHelicopter
'Constant
Private Const dblHELICOPTER_ROTATINGBLADE_DELAY As Double = 120
'Declare
Private _frmToPass As Form
Private intFrame As Integer = 0
'Sound
Private _udcRotatingBladeSound As clsSound
'Bitmaps
Private btmImage As Bitmap
Private pntPoint As Point
'Texture index for OpenGL
Private intTextureIndex As Integer
'Timer
Private tmrAnimation As New System.Timers.Timer
Public Sub New(frmToPass As Form, udcRotatingBladeSound As clsSound, Optional blnStartAnimation As Boolean = False)
'Set
_frmToPass = frmToPass
'Set animation
btmImage = gabtmHelicopterMemories(0)
intTextureIndex = 0
'Set
pntPoint = New Point(1439, 0)
'Set sound
_udcRotatingBladeSound = udcRotatingBladeSound
'Start the sound in a loop
_udcRotatingBladeSound.PlaySound(gintSoundVolume, True)
'Set timer
tmrAnimation.AutoReset = True
'Add handlers
AddHandler tmrAnimation.Elapsed, AddressOf ElapsedAnimation
'Start
If blnStartAnimation Then
Start()
End If
End Sub
Private Sub ElapsedAnimation(sender As Object, e As EventArgs)
'Check the frame
Select Case intFrame
Case 0
btmImage = gabtmHelicopterMemories(1)
intTextureIndex = 1
Case 1
btmImage = gabtmHelicopterMemories(2)
intTextureIndex = 2
Case 2
btmImage = gabtmHelicopterMemories(3)
intTextureIndex = 3
Case 3
btmImage = gabtmHelicopterMemories(4)
intTextureIndex = 4
Case 4
btmImage = gabtmHelicopterMemories(0)
intTextureIndex = 0
End Select
'Increase frame
intFrame += 1
'Check frame
If intFrame = 5 Then
intFrame = 0
End If
End Sub
Public Sub Start(Optional dblAnimatingDelay As Double = dblHELICOPTER_ROTATINGBLADE_DELAY)
'Set timer delay
tmrAnimation.Interval = dblHELICOPTER_ROTATINGBLADE_DELAY
'Start the animating thread
tmrAnimation.Enabled = True
End Sub
Public Sub StopAndDisposeTimer()
'Stop and dispose timer variable
gStopAndDisposeTimerVariable(tmrAnimation)
'Remove handlers
RemoveHandler tmrAnimation.Elapsed, AddressOf ElapsedAnimation
End Sub
Public ReadOnly Property Image() As Bitmap
'Return
Get
Return btmImage
End Get
End Property
Public Property Point() As Point
'Return
Get
Return pntPoint
End Get
'Set
Set(value As Point)
pntPoint = value
End Set
End Property
Public ReadOnly Property TextureIndex() As Integer
'Return
Get
Return intTextureIndex
End Get
End Property
End Class |
Public Class BasicProductMomentsStats
Private _mean As Double
Private _SampleVariance As Double
Private _min As Double
Private _max As Double
Private _N As Long
Private _Converged As Boolean = False
Private _ZalphaForConvergence As Double = 1.96039491692543 ' a default value for a 95% CI
Private _ToleranceForConvergence As Double = 0.01 ' a default
''' <summary>
''' Calculates Sum, Mean, Sample Size, and Variance. Can produce these values and Standard of Deviation
''' </summary>
''' <param name="data">an array of data records that get discarded after summary stats are produced</param>
''' <remarks></remarks>
Sub New(ByVal data() As Double)
If data.Length = 0 Then
_mean = 0
_SampleVariance = 0
_min = 0
_max = 0
_N = 0
Else
AddObservations(data)
End If
End Sub
''' <summary>
''' An empty constructor so the user can create a "Running product momments Statistic" utilize "AddObservation" to add a record and update the statistics.
''' </summary>
''' <remarks></remarks>
Sub New()
_mean = 0
_SampleVariance = 0
_min = 0
_max = 0
_N = 0
End Sub
''' <summary>
''' increments the number of records by 1 and updates the sum and sum of squares so that mean and variance can be calculated
''' </summary>
''' <param name="observation"></param>
''' <remarks></remarks>
Public Sub AddObservation(ByVal observation As Double)
'http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
'http://planetmath.org/onepassalgorithmtocomputesamplevariance
If _N = 0 Then
_max = observation
_min = observation
_mean = observation
_SampleVariance = 0
_N = 1
Else
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
Dim newmean As Double = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
End If
TestForConvergence()
End Sub
''' <summary>
''' Loops through the array of records, increments the number of records by 1 and updates
''' the sum and sum of squares so that mean and variance can be calculated
''' </summary>
''' <param name="observations"></param>
''' <remarks></remarks>
Public Sub AddObservations(ByVal observations() As Double)
'http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
'http://planetmath.org/onepassalgorithmtocomputesamplevariance
If _N = 0 Then
_max = observations(0)
_min = observations(0)
_mean = observations(0)
_SampleVariance = 0
_N = 1
For i As Integer = 1 To observations.Length - 1
Dim observation As Double = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
Dim newmean As Double = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
Else
For i As Integer = 0 To observations.Length - 1
Dim observation As Double = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
Dim newmean As Double = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
End If
TestForConvergence()
End Sub
''' <summary>
''' Loops through the array of records, increments the number of records by 1 and updates
''' the sum and sum of squares so that mean and variance can be calculated
''' </summary>
''' <param name="observations"></param>
''' <remarks></remarks>
Public Sub AddObservations(ByVal observations() As Single)
'http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
'http://planetmath.org/onepassalgorithmtocomputesamplevariance
Dim observation As Double
Dim newmean As Double
If _N = 0 Then
_max = observations(0)
_min = observations(0)
_mean = observations(0)
_SampleVariance = 0
_N = 1
For i As Integer = 1 To observations.Length - 1
observation = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
newmean = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
Else
For i As Integer = 0 To observations.Length - 1
observation = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
newmean = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
End If
TestForConvergence()
End Sub
''' <summary>
''' Loops through the list of records, increments the number of records by 1 and updates
''' the sum and sum of squares so that mean and variance can be calculated
''' </summary>
''' <param name="observations"></param>
''' <remarks></remarks>
Public Sub AddObservations(ByVal observations As List(Of Double))
'http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance
'http://planetmath.org/onepassalgorithmtocomputesamplevariance
If _N = 0 Then
_max = observations(0)
_min = observations(0)
_mean = observations(0)
_SampleVariance = 0
_N = 1
For i As Integer = 1 To observations.Count - 1
Dim observation As Double = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
Dim newmean As Double = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
Else
For i As Integer = 0 To observations.Count - 1
Dim observation As Double = observations(i)
If observation > _max Then _max = observation
If observation < _min Then _min = observation
_N += 1
Dim newmean As Double = _mean + ((observation - _mean) / _N)
_SampleVariance = ((((_N - 2) / (_N - 1)) * _SampleVariance) + ((observation - _mean) ^ 2) / _N)
_mean = newmean
Next
End If
TestForConvergence()
End Sub
Private Sub TestForConvergence()
' problems occur when xbar approaches zero.
If _Converged = True Then Exit Sub
If GetSampleSize < 100 Then Exit Sub
Dim var As Double = (_ZalphaForConvergence * GetSampleStDev) / (GetMean * Math.Sqrt(GetSampleSize))
If Math.Abs(var) <= _ToleranceForConvergence Then _Converged = True
End Sub
''' <summary>
''' returns the sum of the records in the dataset
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetSum As Double
Get
Return _mean * _N
End Get
End Property
''' <summary>
''' returns the mean of the records in the dataset
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetMean As Double
Get
Return _mean
End Get
End Property
''' <summary>
''' returns the variance of the dataset (using N)
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetVariance As Double
Get
Return _SampleVariance * ((_N - 1) / _N) 'divide by n due to the single pass algorithm
End Get
End Property
''' <summary>
''' returns the Mean Squared error of the dataset (using N-1)
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetSampleVariance As Double
Get
Return _SampleVariance
End Get
End Property
''' <summary>
''' returns the standard deviation of the dataset (using N-1)
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetSampleStDev As Double
Get
Return GetSampleVariance ^ (1 / 2)
End Get
End Property
''' <summary>
''' returns the sample size of the dataset
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetSampleSize As Long
Get
Return _N
End Get
End Property
''' <summary>
''' returns the minimum of the dataset
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetMin As Double
Get
Return _min
End Get
End Property
''' <summary>
''' returns the maxium of the dataset
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public ReadOnly Property GetMax As Double
Get
Return _Max
End Get
End Property
''' <summary>
''' Sets the tolerance for convergence, this value is used in conjunction with the confidence interval for convergence, see SetConfidenceInterval
''' </summary>
''' <value>a number between 0 and 1, smaller numbers are more stringent, the default value is .01</value>
''' <remarks></remarks>
Public WriteOnly Property SetTolerance As Double
Set(value As Double)
_ToleranceForConvergence = value
End Set
End Property
''' <summary>
''' Sets the confidence interval for convergence. Convergence assumes normal distribution.
''' </summary>
''' <value>a centered confidence interval, this value will be used to derive an upper tail z_alpha value</value>
''' <remarks></remarks>
Public WriteOnly Property SetConfidenceInterval As Double
Set(value As Double)
Dim n As New Normal
_ZalphaForConvergence = n.getDistributedVariable(value + ((1 - value) / 2))
End Set
End Property
Public ReadOnly Property IsConverged As Boolean
Get
Return _Converged
End Get
End Property
End Class
|
Imports System
Imports System.ComponentModel.DataAnnotations
Namespace LayoutControlDemo
Public Class AdvancedGroupedLayoutData
Private Const NameGroup As String = "<Name>"
Private Const TabbedGroup As String = "{Tabs}"
Private Const JobGroup As String = "Job"
Private Const JobGroupPath As String = TabbedGroup & "/" & JobGroup
Private Const ContactGroup As String = "Contact"
Private Const ContactGroupPath As String = TabbedGroup & "/" & ContactGroup
Private Const AddressGroup As String = "Address"
Private Const AddressGroupPath As String = ContactGroupPath & "/" & AddressGroup
Private Const PersonalGroup As String = "Personal-"
<Display(GroupName := AddressGroupPath, ShortName := "")>
Public Property AddressLine1() As String
<Display(GroupName := AddressGroupPath, ShortName := "")>
Public Property AddressLine2() As String
<Display(GroupName := PersonalGroup, Name := "Birth date")>
Public Property BirthDate() As Date
<Display(GroupName := ContactGroupPath, Order := 21)>
Public Property Email() As String
<Display(GroupName := NameGroup, Name := "First name", Order := 0)>
Public Property FirstName() As String
<Display(GroupName := PersonalGroup, Order := 3)>
Public Property Gender() As Gender
<Display(GroupName := JobGroupPath, Order := 1)>
Public Property Group() As String
<Display(GroupName := JobGroupPath, Name := "Hire date")>
Public Property HireDate() As Date
<Display(GroupName := NameGroup, Name := "Last name")>
Public Property LastName() As String
<Display(GroupName := ContactGroupPath, Order := 2), DataType(DataType.PhoneNumber)>
Public Property Phone() As String
<Display(GroupName := JobGroupPath), DataType(DataType.Currency)>
Public Property Salary() As Decimal
<Display(GroupName := JobGroupPath, Order := 11)>
Public Property Title() As String
End Class
End Namespace
|
Public Enum EraserType
StrokeEraser
PointEraser
End Enum
Public Class TabletInterpreter
Private WithEvents Tab As HWTablet
Public pageData As TabletPageData
Private currentStrokeStylusID As PenType = PenType.None
Private currentCursorStylusID As PenType = PenType.None
Public eraserSize As Double = 10.0
Public eraserType As EraserType = blInk.EraserType.StrokeEraser
Public penColor As Color = Color.White
Public Event RequestRedraw()
Public Event DrawComplete() 'finish drawing a line -> undo list updated
Public ReadOnly Property cursorType As PenType
Get
Return currentCursorStylusID
End Get
End Property
Public Sub New(_Tab As HWTablet)
Tab = _Tab
pageData = New TabletPageData(Me)
pageData.tabletAspectRatio = TabletAspectRatio
End Sub
Public ReadOnly Property TabletAspectRatio As Double
Get
Return Tab.TabletSpace.Width / Tab.TabletSpace.Height
End Get
End Property
Public Sub request_Redraw()
RaiseEvent RequestRedraw()
End Sub
Public Sub UndoList_Update()
RaiseEvent DrawComplete()
End Sub
Private Sub Tab_PenDown(position As TabletPoint2D, buttons As Integer, cursorID As PenType) Handles Tab.PenDown
'only create a new stroke if no pen is down, or of the pen that is 'apparently' currently down is
'the same one that the parameter data.Stylus is referring to. (in that second case there was some error
'and we still want to be able to draw.)
If currentStrokeStylusID = PenType.None OrElse cursorID = currentStrokeStylusID Then
Dim modData As TabletPoint2D = mapTabletViewToWorld(position)
currentStrokeStylusID = cursorID
If currentStrokeStylusID = PenType.Pen Then
createStroke(modData)
ElseIf currentCursorStylusID = PenType.Eraser Then
eraserDown(modData, eraserType)
eraserErase(modData, eraserType)
End If
End If
End Sub
Private Sub Tab_PenUp(position As TabletPoint2D, buttons As Integer, cursorID As PenType) Handles Tab.PenUp
'Debug.Print("Pen Up")
If Not currentStrokeStylusID = PenType.None AndAlso currentStrokeStylusID = cursorID Then
Dim modData As TabletPoint2D = mapTabletViewToWorld(position)
If currentStrokeStylusID = PenType.Pen Then
finishStroke(modData)
RaiseEvent DrawComplete()
ElseIf currentCursorStylusID = PenType.Eraser Then
eraserErase(modData, eraserType)
eraserUp(modData, eraserType)
RaiseEvent DrawComplete()
End If
currentStrokeStylusID = PenType.None
RaiseEvent RequestRedraw()
End If
End Sub
Private Sub Tab_PenTap(position As TabletPoint2D, cursorID As PenType) Handles Tab.PenTap
'Debug.Print("Pen Tap")
End Sub
Private Sub Tab_PenLongTap(position As TabletPoint2D, cursorID As PenType) Handles Tab.PenLongTap
'Debug.Print("Pen Long Tap")
End Sub
Private Sub Tab_ButtonDown(position As TabletPoint2D, eventButton As Integer, zDist As Integer, cursorID As PenType) Handles Tab.ButtonDown
'Debug.Print("Button " & eventButton & " Down")
End Sub
Private Sub Tab_ButtonUp(position As TabletPoint2D, eventButton As Integer, zDist As Integer, cursorID As PenType) Handles Tab.ButtonUp
'Debug.Print("Button " & eventButton & " Up")
End Sub
Private Sub Tab_ButtonClick(position As TabletPoint2D, eventButton As Integer, zDist As Integer, cursorID As PenType) Handles Tab.ButtonClick
'Debug.Print("Button " & eventButton & " Click")
End Sub
Private Sub Tab_ButtonLongClick(position As TabletPoint2D, eventButton As Integer, zDist As Integer, cursorID As PenType) Handles Tab.ButtonLongClick
'Debug.Print("Button " & eventButton & " Long Click")
End Sub
Private Sub Tab_PenLeftProximity() Handles Tab.PenLeftProximity
currentCursorStylusID = PenType.None
End Sub
Private Sub Tab_Draw(position As TabletPoint2D, buttons As Integer, cursorID As PenType) Handles Tab.Draw
'Debug.Print("Draw X: " & position.x & " Y: " & position.y & " Pressure: " & position.pressure)
If Not currentStrokeStylusID = PenType.None AndAlso currentStrokeStylusID = cursorID Then
Dim modData As TabletPoint2D = mapTabletViewToWorld(position)
If currentStrokeStylusID = PenType.Pen Then
addToStroke(modData)
ElseIf currentCursorStylusID = PenType.Eraser Then
eraserErase(modData, eraserType)
End If
pageData.cursor = modData
RaiseEvent RequestRedraw()
End If
End Sub
Private Sub Tab_Hover(position As TabletPoint2D, buttons As Integer, zDist As Integer, cursorID As PenType) Handles Tab.Hover
'Debug.Print("Hover X: " & position.x & " Y: " & position.y & " Z: " & zDist)
Dim modData As TabletPoint2D = mapTabletViewToWorld(position)
If currentCursorStylusID = PenType.None OrElse currentCursorStylusID <> cursorID Then
'Stylus has changed
currentCursorStylusID = cursorID
'RaiseEvent InputDeviceChanged(currentCursorStylus, currentCursorTabletProps)
Else
'Stylus has not changed
End If
'If currentStrokeStylusID = PenType.None Then
pageData.cursor = modData
'attachedControl.Invalidate()
RaiseEvent RequestRedraw()
'End If
End Sub
Public Function mapScreenToWorld(ScreenPoint As TabletPoint2D) As TabletPoint2D
Return Drawing2D.mapPointInSpaceToPointInRegion(ScreenPoint, Tab.ScreenSpace, pageData.userViewPoint)
End Function
Public Function mapWorldToScreen(WorldPoint As TabletPoint2D) As TabletPoint2D
Return Drawing2D.mapPointInRegionToPointInSpace(WorldPoint, Tab.ScreenSpace, pageData.userViewPoint)
End Function
Public Function mapWorldSizeToScreenSize(WorldSize As SizeF) As SizeF
Dim p As PointF = Drawing2D.mapPointToSpace(WorldSize.ToPointF, pageData.userViewPoint.Size, Tab.ScreenSpace)
Return New SizeF(p.X, p.Y)
End Function
Public Function mapScreenSizeToWorldSize(ScreenSize As SizeF) As SizeF
Dim p As PointF = Drawing2D.mapPointToSpace(ScreenSize.ToPointF, Tab.ScreenSpace, pageData.userViewPoint.Size)
Return New SizeF(p.X, p.Y)
End Function
Public Function mapTabletViewToWorld(ScreenPoint As TabletPoint2D) As TabletPoint2D
Return Drawing2D.mapPointInSpaceToPointInRegion(ScreenPoint, Tab.ScreenSpace, pageData.tabletViewPoint)
End Function
Public Function mapWorldToTabletView(WorldPoint As TabletPoint2D) As TabletPoint2D
Return Drawing2D.mapPointInRegionToPointInSpace(WorldPoint, Tab.ScreenSpace, pageData.tabletViewPoint)
End Function
Public Function mapWorldSizeToTabletViewSize(WorldSize As SizeF) As SizeF
Dim p As PointF = Drawing2D.mapPointToSpace(WorldSize.ToPointF, pageData.tabletViewPoint.Size, Tab.ScreenSpace)
Return New SizeF(p.X, p.Y)
End Function
Public Function mapTabletViewSizeToWorldSize(WorldSize As SizeF) As SizeF
Dim p As PointF = Drawing2D.mapPointToSpace(WorldSize.ToPointF, Tab.ScreenSpace, pageData.tabletViewPoint.Size)
Return New SizeF(p.X, p.Y)
End Function
Private Function createStroke(modData As TabletPoint2D) As Stroke2D
'creating a new stroke
pageData.strokes.Add(New Stroke2D)
pageData.strokes.Last.color = penColor
pageData.strokes.Last.Add(modData)
Return pageData.strokes.Last
End Function
Private Sub finishStroke(modData As TabletPoint2D)
pageData.strokes.Last.Add(modData)
If Drawing2D.isStrokeClosed(pageData.strokes.Last) Then
Debug.Print("Stroke is closed polygon!")
Dim tmpStroke As Stroke2D = StrokeInterpreter.strokeToShape(pageData.strokes.Last)
'Drawing2D.rectangleToStroke(Drawing2D.findStrokeRange(pageData.strokes.Last))
pageData.strokes.Remove(pageData.strokes.Last)
pageData.strokes.Add(tmpStroke)
End If
'allow to be undone!
pageData.undoQueue.AddStrokes(pageData.strokes.Last)
End Sub
Private Sub addToStroke(modData As TabletPoint2D)
pageData.strokes.Last.Add(modData)
End Sub
Private Sub eraserDown(modData As TabletPoint2D, eraseType As EraserType)
pageData.AtomicDrawingOperation_Begin()
End Sub
Private Sub eraserUp(modData As TabletPoint2D, eraseType As EraserType)
Dim opName As String
If eraseType = EraserType.PointEraser Then : opName = "Erase Points"
ElseIf eraseType = EraserType.StrokeEraser Then : opName = "Erase Strokes"
Else : opName = "Unknown Operation"
End If
pageData.AtomicDrawingOperation_End(opName)
End Sub
Private Sub eraserErase(modData As TabletPoint2D, eraseType As EraserType)
'TODO[ ]: Split into two functions, one for point eraser and one for stroke eraser!
'create a box around the cursor
Dim size As SizeF = mapScreenSizeToWorldSize(New SizeF(eraserSize, eraserSize))
Dim rect As New RectangleF(modData.toPointF, size)
Dim deleteList As New List(Of Stroke2D)
'eraseType = EraserType.StrokeEraser
If eraseType = EraserType.StrokeEraser Then
Dim lines As Integer = pageData.strokes.Count
For i = 0 To lines - 1
'see if any points from any lines lie within that box
If Drawing2D.isPointOnStrokeWithinRegion(pageData.strokes(i), rect) = True Then
deleteList.Add(pageData.strokes(i))
End If
Next
pageData.DeleteStrokes(deleteList)
ElseIf eraseType = EraserType.PointEraser Then
'See if any points from any lines lie within that box
Dim lines As Integer = pageData.strokes.Count
Dim newLines As List(Of Stroke2D) = Nothing
Dim addList As New List(Of Stroke2D)
For i = 0 To lines - 1
If pageData.strokes(i).Count > 1 Then
If Drawing2D.deletePointsOnStrokeWithinRegion(pageData.strokes(i), rect, newLines) = True Then
'add to undo list -> old strokes, new strokes
'deleteList.Add(pageData.strokes(i)) (
If newLines.Count > 0 Then
'add to strokes list
addList.AddRange(newLines.GetRange(0, newLines.Count))
End If
'if the stroke was split then it was replaced by
'one or two new strokes. We need to delete the original stroke
deleteList.Add(pageData.strokes(i))
End If
Else
deleteList.Add(pageData.strokes(i))
End If
Next
pageData.DeleteStrokes(deleteList)
pageData.AddStrokes(addList)
Else
'do nothing...
End If
End Sub
End Class
|
Imports _2Draw
Public Class SelectionHelper
Implements iMouseHandler
Public Event SelectionChanged(ByVal sender As Object, e As EventArgs)
Private _owner As Page
Private _possibleSelect As Type_2D
Private _drawRectPt1 As Point
Private _drawrectpt2 As Point
Public Sub New(owner As Page)
_owner = owner
End Sub
Public Sub ZoomChanged() Implements iMouseHandler.ZoomChanged
'do nothing
End Sub
Private Function GetHittestItem(x As Integer, y As Integer) As Type_2D
Dim ret As Type_2D = Nothing
For i As Integer = 0 To _owner.SelectedLayer.items.Count - 1
Dim itm As Type_2D = _owner.SelectedLayer.items(i)
Dim r As RectangleF = itm.GetRecf()
r.Inflate(0.5, 0.5)
If r.Contains(x, y) AndAlso itm.HitTest(New PointF(x, y), _owner.InverseZoom) Then
ret = itm
Exit For
End If
Next
Return ret
End Function
Public Sub MouseDown(sender As Object, e As DoubleMouseEventArgs) Implements iMouseHandler.MouseDown
If e.Button = MouseButtons.Left Then
_possibleSelect = GetHittestItem(e.X, e.Y)
_drawRectPt1 = New Point(e.X, e.Y)
_drawrectpt2 = _drawRectPt1
_HasMouse = True
End If
End Sub
Public Sub MouseMove(sender As Object, e As DoubleMouseEventArgs) Implements iMouseHandler.MouseMove
If e.Button = MouseButtons.Left Then
_drawrectpt2 = New Point(e.X, e.Y)
End If
End Sub
Public Sub MouseUp(sender As Object, e As DoubleMouseEventArgs) Implements iMouseHandler.MouseUp
Dim r As Rectangle = GetRecFrmPts(_drawRectPt1, _drawrectpt2)
If e.Button = MouseButtons.Left Then
If Not r.Invalid Then
For Each l As Type_2D In _owner.SelectedLayer.items
Dim tr As Rectangle = l.GetRecf.ToRec
If r.Contains(tr) Then
If Not CtrlKey Then
l.Selected = True
Else
l.Selected = Not l.Selected
End If
RaiseEvent SelectionChanged(Me, New EventArgs)
Else
If Not CtrlKey AndAlso l.Selected Then
l.Selected = False
RaiseEvent SelectionChanged(Me, New EventArgs)
End If
End If
Next
ElseIf _possibleSelect IsNot Nothing Then
Dim l As Layer = _owner.SelectedLayer
If CtrlKey Then
_possibleSelect.Selected = Not _possibleSelect.Selected
Else
_possibleSelect.Selected = True
For i As Integer = 0 To l.items.Count - 1
If l.items(i) IsNot _possibleSelect Then l.items(i).Selected = False
Next
End If
RaiseEvent SelectionChanged(Me, New EventArgs)
Else
_owner.SelectedLayer.ClearSelectedItems()
RaiseEvent SelectionChanged(Me, New EventArgs)
End If
End If
_drawRectPt1 = New Point(0, 0)
_drawrectpt2 = New Point(0, 0)
_possibleSelect = Nothing
_HasMouse = False
End Sub
''' <summary>
''' if the rotator has the mouse or not
''' </summary>
''' <returns></returns>
Public ReadOnly Property HasMouse() As Boolean Implements iMouseHandler.HasMouse
Public Sub Draw(g As Graphics) Implements iMouseHandler.Draw
Dim r As Rectangle = GetRecFrmPts(_drawRectPt1, _drawrectpt2)
If r.IsEmpty = False Then
Using p As New Pen(My.Settings.SurfaceHighLight, 1 * _owner.InverseZoom)
p.DashStyle = DashStyle.Dash
g.DrawRectangle(p, r)
End Using
End If
End Sub
Public Sub MouseDoubleClick(sender As Object, e As DoubleMouseEventArgs, ByRef Handled As Boolean) Implements iMouseHandler.MouseDoubleClick
'nothing to do here
Handled = False
End Sub
End Class
|
'---------------------------------------------------------------------------
' Author : Nguyễn Khánh Tùng
' Company : Thiên An ESS
' Created Date : Tuesday, April 22, 2008
'---------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OracleClient
Imports ESS.Machine
Imports ESS.Entity.Entity
Namespace DBManager
Public Class NhomDoiTuong_DAL
#Region "Constructor"
Public Sub New()
End Sub
#End Region
#Region "Function"
Public Function Load_NhomDoiTuong() As DataTable
Try
If gDBType = DatabaseType.SQLServer Then
Return UDB.SelectTableSP("STU_NhomDoiTuong_Load")
Else
Return UDB.SelectTableSP("STU_NhomDoiTuong_Load")
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Load_NhomDoiTuong(ByVal ID_nhom_dt As Integer) As DataTable
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(1) As SqlParameter
para(0) = New SqlParameter("@ID_nhom_dt", ID_nhom_dt)
Return UDB.SelectTableSP("STU_NhomDoiTuong_Load", para)
Else
Dim para(1) As OracleParameter
para(0) = New OracleParameter(":ID_nhom_dt", ID_nhom_dt)
Return UDB.SelectTableSP("STU_NhomDoiTuong_Load", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Insert_NhomDoiTuong(ByVal obj As NhomDoiTuong) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(1) As SqlParameter
para(0) = New SqlParameter("@Ma_nhom", obj.Ma_nhom)
para(1) = New SqlParameter("@Ten_nhom", obj.Ten_nhom)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Insert", para)
Else
Dim para(1) As OracleParameter
para(0) = New OracleParameter(":Ma_nhom", obj.Ma_nhom)
para(1) = New OracleParameter(":Ten_nhom", obj.Ten_nhom)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Insert", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Update_NhomDoiTuong(ByVal obj As NhomDoiTuong, ByVal ID_nhom_dt As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@ID_nhom_dt", ID_nhom_dt)
para(1) = New SqlParameter("@Ma_nhom", obj.Ma_nhom)
para(2) = New SqlParameter("@Ten_nhom", obj.Ten_nhom)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Update", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":ID_nhom_dt", ID_nhom_dt)
para(1) = New OracleParameter(":Ma_nhom", obj.Ma_nhom)
para(2) = New OracleParameter(":Ten_nhom", obj.Ten_nhom)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Update", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Delete_NhomDoiTuong(ByVal ID_nhom_dt As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(1) As SqlParameter
para(0) = New SqlParameter("@ID_nhom_dt", ID_nhom_dt)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Delete", para)
Else
Dim para(1) As OracleParameter
para(0) = New OracleParameter(":ID_nhom_dt", ID_nhom_dt)
Return UDB.ExecuteSP("STU_NhomDoiTuong_Delete", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
End Class
End Namespace
|
Friend Class Observer
Implements IObserver
ReadOnly Property Name() As String Implements IObserver.Name
Get
Return Me._name
End Get
End Property
Private _name As String
Public Sub New(ByVal Name As String)
Me._name = Name
End Sub
Private Sub Notify(ByVal ObservedSubject As ISubject) Implements IObserver.Notify
Console.WriteLine(" {0} was notified for {1}. State changed to {2}.", Me._name, ObservedSubject, DirectCast(ObservedSubject, TargetClass).State)
End Sub
End Class
|
'===============================================================================
' EntitySpaces Studio by EntitySpaces, LLC
' Persistence Layer and Business Objects for Microsoft .NET
' EntitySpaces(TM) is a legal trademark of EntitySpaces, LLC
' http://www.entityspaces.net
'===============================================================================
' EntitySpaces Version : 2012.1.0930.0
' EntitySpaces Driver : SQL
' Date Generated : 9/23/2012 6:16:24 PM
'===============================================================================
Imports System
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Text
Imports System.Xml.Serialization
Imports System.Runtime.Serialization
Imports EntitySpaces.DynamicQuery
Namespace Proxies
<DataContract(Namespace:="http://tempuri.org/", Name:="TerritoriesCollection")> _
<XmlType(TypeName:="TerritoriesCollectionProxyStub")> _
Partial Public Class TerritoriesCollectionProxyStub
Public Sub New()
End Sub
<DataMember(Name:="Collection", EmitDefaultValue:=False)> _
Public Collection As New ObservableCollection (Of TerritoriesProxyStub)
Public Function IsDirty() As Boolean
For Each obj As TerritoriesProxyStub In Collection
If obj.IsDirty() Then
Return True
End If
Next
Return False
End Function
End Class
<DataContract(Namespace:="http://tempuri.org/", Name:="Territories")> _
<XmlType(TypeName:="TerritoriesProxyStub")> _
Partial Public Class TerritoriesProxyStub
Implements System.ComponentModel.INotifyPropertyChanged
Public Sub New()
Me.esRowState = "Added"
End Sub
Public Function IsDirty() As Boolean
Return If(esRowState <> "Unchanged", True, False)
End Function
Public Event PropertyChanged As System.ComponentModel.PropertyChangedEventHandler Implements System.ComponentModel.INotifyPropertyChanged.PropertyChanged
Protected Sub RaisePropertyChanged(ByVal propertyName As String)
Dim propertyChanged As System.ComponentModel.PropertyChangedEventHandler = Me.PropertyChangedEvent
If (Not (propertyChanged) Is Nothing) Then
propertyChanged(Me, New System.ComponentModel.PropertyChangedEventArgs(propertyName))
End If
End Sub
<DataMember(Name:="a0", Order:=1, EmitDefaultValue:=False)> _
Public Property TerritoryID As System.String
Get
Return _TerritoryID
End Get
Set(ByVal value As System.String)
If Not String.Compare(_TerritoryID, value) = 0 Then
_TerritoryID = value
SetDirty("TerritoryID")
RaisePropertyChanged("TerritoryID")
End If
End Set
End Property
Private _TerritoryID As System.String
<DataMember(Name:="a1", Order:=2, EmitDefaultValue:=False)> _
Public Property TerritoryDescription As System.String
Get
Return _TerritoryDescription
End Get
Set(ByVal value As System.String)
If Not String.Compare(_TerritoryDescription, value) = 0 Then
_TerritoryDescription = value
SetDirty("TerritoryDescription")
RaisePropertyChanged("TerritoryDescription")
End If
End Set
End Property
Private _TerritoryDescription As System.String
<DataMember(Name:="a2", Order:=3, EmitDefaultValue:=False)> _
Public Property RegionID As Nullable(Of System.Int32)
Get
Return _RegionID
End Get
Set(ByVal value As Nullable(Of System.Int32))
If Not _RegionID.Equals(value) Then
_RegionID = value
SetDirty("RegionID")
RaisePropertyChanged("RegionID")
End If
End Set
End Property
Private _RegionID As Nullable(Of System.Int32)
<DataMember(Name:="a10000", Order:=10000)> _
Public Property esRowState As String
Get
Return Me._esRowState
End Get
Set
If Not String.Compare(_esRowState, value) = 0 Then
Me._esRowState = value
RaisePropertyChanged("esRowState")
End If
End Set
End Property
Private _esRowState As String = "Unchanged"
<DataMember(Name := "a10001", Order := 10001, EmitDefaultValue := False)> _
Public Property ModifiedColumns() As List(Of String)
Get
If _ModifiedColumns Is Nothing Then
_ModifiedColumns = New List(Of String)()
End If
Return _ModifiedColumns
End Get
Set(ByVal value As List(Of String))
_ModifiedColumns = New List(Of String)(value)
End Set
End Property
Private _ModifiedColumns As List(Of String)
<DataMember(Name := "a10002", Order := 10002, EmitDefaultValue := False)> _
Public Property esExtraColumns() As Dictionary(Of String, Object)
Get
If _ExtraColumns Is Nothing Then
_ExtraColumns = New Dictionary(Of String, Object)()
End If
Return _ExtraColumns
End Get
Set(ByVal value As Dictionary(Of String, Object))
_ExtraColumns = New Dictionary(Of String, Object)(value)
End Set
End Property
Private _ExtraColumns As Dictionary(Of String, Object)
Public Sub MarkAsDeleted()
Me.esRowState = "Deleted"
End Sub
Private Sub SetDirty(ByVal [property] As String)
If Not ModifiedColumns.Contains([property]) Then
ModifiedColumns.Add([property])
End If
If Me.esRowState = "Unchanged" Then
Me.esRowState = "Modified"
End If
End Sub
End Class
<XmlType(TypeName:="TerritoriesQueryProxyStub")> _
<DataContract(Name:="TerritoriesQuery", Namespace:= "http://www.entityspaces.net")> _
Partial Public Class TerritoriesQueryProxyStub
Inherits esDynamicQuerySerializable
Public Sub New()
End Sub
Public Sub New(ByVal joinAlias As String)
MyBase.es.JoinAlias = joinAlias
End Sub
Protected Overrides Function GetQueryName() As String
Return "TerritoriesQuery"
End Function
#Region "Implicit Casts"
Public Shared Widening Operator CType(ByVal query As TerritoriesQueryProxyStub) As String
Return TerritoriesQueryProxyStub.SerializeHelper.ToXml(query)
End Operator
#End Region
Public ReadOnly Property TerritoryID As esQueryItem
Get
Return new esQueryItem(Me, "TerritoryID", esSystemType.String)
End Get
End Property
Public ReadOnly Property TerritoryDescription As esQueryItem
Get
Return new esQueryItem(Me, "TerritoryDescription", esSystemType.String)
End Get
End Property
Public ReadOnly Property RegionID As esQueryItem
Get
Return new esQueryItem(Me, "RegionID", esSystemType.Int32)
End Get
End Property
End Class
End Namespace
|
Imports System
Imports System.IO
Imports Neurotec.Biometrics
Imports Neurotec.Biometrics.Client
Imports Neurotec.Biometrics.Standards
Imports Neurotec.Licensing
Imports Microsoft.VisualBasic
Class Program
Private Shared Function Usage() As Integer
Console.WriteLine("usage: {0} [FCRecord] [NTemplate]", TutorialUtils.GetAssemblyName())
Console.WriteLine(vbTab & "[FCRecord] - input FCRecord")
Console.WriteLine(vbTab & "[NTemplate] - output NTemplate")
Return 1
End Function
Shared Function Main(ByVal args As String()) As Integer
Const components As String = "Biometrics.FaceExtraction,Biometrics.Standards.Faces"
TutorialUtils.PrintTutorialHeader(args)
If args.Length < 2 Then
Return Usage()
End If
Try
If Not NLicense.ObtainComponents("/local", 5000, components) Then
Throw New NotActivatedException(String.Format("Could not obtain licenses for components: {0}", components))
End If
Using biometricClient = New NBiometricClient()
Using subject = New NSubject()
Dim fcRec As FCRecord
' Read FCRecord from file
Dim fcRecordData As Byte() = File.ReadAllBytes(args(0))
' Create FCRecord
fcRec = New FCRecord(fcRecordData, BdifStandard.Iso)
' Read all images from FCRecord
For Each fv As FcrFaceImage In fcRec.FaceImages
Dim face As NFace = New NFace()
face.Image = fv.ToNImage()
subject.Faces.Add(face)
Next
' Set face template size (recommended, for enroll to database, is large) (optional)
biometricClient.FacesTemplateSize = NTemplateSize.Large
' Create template from added face image(s)
Dim status = biometricClient.CreateTemplate(subject)
Console.WriteLine(If(status = NBiometricStatus.Ok, "Template extracted", [String].Format("Extraction failed: {0}", status)))
' Save template to file
If status = NBiometricStatus.Ok Then
File.WriteAllBytes(args(1), subject.GetTemplateBuffer().ToArray())
Console.WriteLine("template saved successfully")
End If
End Using
End Using
Return 0
Catch ex As Exception
Return TutorialUtils.PrintException(ex)
Finally
NLicense.ReleaseComponents(components)
End Try
End Function
End Class
|
Imports Newtonsoft.Json
Imports System.Runtime.Serialization
Namespace Dto
<JsonObject()> _
<DataContract()> _
Public Class ProductDto
Private _id As Integer
Private _name As String
Private _taxBase As Decimal
Private _needsQuantity As Boolean
Private _thumbUrl As String
Private _price As Decimal
Private _authenticationRequired As Boolean
Private _cardRequired As Boolean
Private _cardIncluded As Boolean
Private _securityActionId As Integer
Private _isDefaultCardSellProduct As Boolean
<DataMember(Name:="isDefaultCardSellProduct")> _
Public Property IsDefaultCardSellProduct() As Boolean
Get
Return _isDefaultCardSellProduct
End Get
Set(ByVal value As Boolean)
_isDefaultCardSellProduct = value
End Set
End Property
<DataMember(Name:="securityActionId")> _
Public Property SecurityActionId() As Integer
Get
Return _securityActionId
End Get
Set(ByVal value As Integer)
_securityActionId = value
End Set
End Property
<DataMember(Name:="cardIncluded")> _
Public Property CardIncluded() As Boolean
Get
Return _cardIncluded
End Get
Set(ByVal value As Boolean)
_cardIncluded = value
End Set
End Property
<DataMember(Name:="cardRequired")> _
Public Property CardRequired() As Boolean
Get
Return _CardRequired
End Get
Set(ByVal value As Boolean)
_CardRequired = value
End Set
End Property
<DataMember(Name:="authenticationRequired")> _
<JsonProperty()> _
Public Property AuthenticationRequired() As Boolean
Get
Return _authenticationRequired
End Get
Set(ByVal value As Boolean)
_authenticationRequired = value
End Set
End Property
Public Sub New(ByVal id As Integer, ByVal name As String, ByVal taxBase As Decimal, ByVal needsQuantity As Boolean, ByVal thumbUrl As String, ByVal price As Decimal)
_id = id
_name = name
_taxBase = taxBase
_needsQuantity = needsQuantity
_thumbUrl = thumbUrl
_price = price
End Sub
<DataMember(Name:="taxBase")> _
<JsonProperty()> _
Public Property TaxBase() As Decimal
Get
Return _taxBase
End Get
Set(ByVal value As Decimal)
_taxBase = value
End Set
End Property
<DataMember(Name:="needsQuantity")> _
<JsonPropertyAttribute()> _
Public Property NeedsQuantity() As Boolean
Get
Return _needsQuantity
End Get
Set(ByVal value As Boolean)
_needsQuantity = value
End Set
End Property
<DataMember(Name:="thumbUrl")> _
<JsonPropertyAttribute()> _
Public Property ThumbUrl() As String
Get
Return _thumbUrl
End Get
Set(ByVal value As String)
_thumbUrl = value
End Set
End Property
<DataMember(Name:="price")> _
<JsonPropertyAttribute()> _
Public Property Price() As Decimal
Get
Return _price
End Get
Set(ByVal value As Decimal)
_price = value
End Set
End Property
<DataMember(Name:="name")> _
<JsonPropertyAttribute()> _
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
<DataMember(Name:="id")> _
<JsonPropertyAttribute()> _
Public Property Id() As Integer
Get
Return _id
End Get
Set(ByVal value As Integer)
_id = value
End Set
End Property
End Class
End Namespace |
Imports Windows.Devices.I2C
Public Class VL53L0X_CLASS
Implements IDisposable
Public Structure VL53L0XData
Public DISTANCE As Integer
Public AMBIENT As Integer
Public SIGNAL As Integer
End Structure
Private VL530L0X_SENSOR As I2cDevice
Private Const VL53L0X_ADDR As Byte = &H29
Private Const VL53L0X_IDENTIFICATION_MODEL_ID As Byte = &HC0
Private Const VL53L0X_IDENTIFICATION_REVISION_ID As Byte = &HC2
Private Const VL53L0X_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT As Byte = &H44
Private Const VL53L0X_FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI As Byte = &H71
Public Async Function INITIALIZE_ASYNC(ByVal LONG_RANGE As Boolean, Optional ByVal MCPS_RATE As Decimal = Nothing) As Task
Dim I2C_SETTINGS = New I2cConnectionSettings(VL53L0X_ADDR) With {.BusSpeed = I2cBusSpeed.FastMode}
Dim I2C_CONTROLLER As I2cController = Await I2cController.GetDefaultAsync()
VL530L0X_SENSOR = I2C_CONTROLLER.GetDevice(I2C_SETTINGS)
If LONG_RANGE = True Then
If MCPS_RATE <> Nothing Then
If Not MCPS_RATE < 0 Or Not MCPS_RATE > 511.99 Then
VL530L0X_SENSOR.Write(New Byte() {&H0, &H1})
VL530L0X_SENSOR.Write(New Byte() {VL53L0X_FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT, MCPS_RATE * &H80})
End If
End If
End If
End Function
Public Function READ() As VL53L0XData
VL530L0X_SENSOR.Write(New Byte() {&H0, &H1})
Dim READ_BUFFER As Byte() = New Byte(11) {}
VL530L0X_SENSOR.WriteRead(New Byte() {&H14}, READ_BUFFER)
Dim SENSOR_DATA As VL53L0XData = New VL53L0XData()
With SENSOR_DATA
.DISTANCE = BitConverter.ToInt16(New Byte() {READ_BUFFER(11), READ_BUFFER(10)}, 0)
.AMBIENT = BitConverter.ToInt16(New Byte() {READ_BUFFER(7), READ_BUFFER(6)}, 0)
.SIGNAL = BitConverter.ToInt16(New Byte() {READ_BUFFER(9), READ_BUFFER(8)}, 0)
End With
Return SENSOR_DATA
End Function
Public Function READ_CUSTOM(COMMAND As Byte()) As Byte()
VL530L0X_SENSOR.Write(New Byte() {&H0, &H1})
Dim READ_BUFFER As Byte() = New Byte(24) {}
VL530L0X_SENSOR.WriteRead(COMMAND, READ_BUFFER)
Return READ_BUFFER
End Function
Public Sub Dispose() Implements IDisposable.Dispose
VL530L0X_SENSOR.Dispose()
End Sub
End Class
|
Imports System
Imports System.Data.Entity
Imports System.ComponentModel.DataAnnotations.Schema
Imports System.Linq
Imports System.Data.Common
Public Class PesticidesDB
Inherits BaseContext(Of PesticidesDB)
Public Overridable Property ErrorLogs As DbSet(Of ErrorLog)
Public Overridable Property NOIEntityType As DbSet(Of NOIEntityType)
Public Overridable Property NOIFeeExemptions As DbSet(Of NOIFeeExemption)
Public Overridable Property NOIPesticidePatterns As DbSet(Of NOIPesticidePattern)
Public Overridable Property NOIProgram As DbSet(Of NOIProgram)
Public Overridable Property NOIProgSubmissionType As DbSet(Of NOIProgSubmissionType)
Public Overridable Property NOIProjects As DbSet(Of NOIProject)
Public Overridable Property NOISessionStorage As DbSet(Of NOISessionStorage)
Public Overridable Property NOISubmissions As DbSet(Of NOISubmission)
Public Overridable Property NOISubmissionAcceptedPDF As DbSet(Of NOISubmissionAcceptedPDF)
Public Overridable Property NOISubmissionAP As DbSet(Of NOISubmissionAP)
Public Overridable Property NOISubmissionAPChemicals As DbSet(Of NOISubmissionAPChemicals)
Public Overridable Property NOISubmissionISWAP As DbSet(Of NOISubmissionISWAP)
Public Overridable Property NOISubmissionPersonOrgs As DbSet(Of NOISubmissionPersonOrg)
Public Overridable Property NOISubmissionStatuses As DbSet(Of NOISubmissionStatus)
Public Overridable Property NOISubmissionStatusCodes As DbSet(Of NOISubmissionStatusCode)
Public Overridable Property NOISigningEmailAddresses As DbSet(Of NOISigningEmailAddress)
Public Overridable Property NOISubmissionTypelst As DbSet(Of NOISubmissionTypelst)
Public Overridable Property NOISubmissionDocs As DbSet(Of NOISubmissionDocs)
Public Overridable Property NOISubmissionSearchTable As DbSet(Of NOISubmissionSearchlst)
Public Overridable Property CompanyTypeTable As DbSet(Of CompanyTypelst)
'Public Overridable Property ProjectTypeTable As DbSet(Of ProjectTypelst)
Public Overridable Property StateAbvTable As DbSet(Of StateAbvlst)
Protected Overrides Sub OnModelCreating(ByVal modelBuilder As DbModelBuilder)
modelBuilder.Entity(Of NOISubmissionDocs)() _
.HasRequired(Function(e) e.NOISubmissionDocFile) _
.WithRequiredPrincipal(Function(e) e.NOISubmissionDocs) _
.WillCascadeOnDelete(True)
modelBuilder.Entity(Of NOISubmissionSearchlst)().ToTable("vwNOISubmissionSearchTableAP")
modelBuilder.Configurations.Add(New NOIProjectMapper())
modelBuilder.Configurations.Add(New NOISubmissionForAPMapper())
modelBuilder.Configurations.Add(New NOISubmissionPersonOrgMapper())
modelBuilder.Configurations.Add(New NOISubmissionStatusCodeMapper())
modelBuilder.Configurations.Add(New NOISubmissionStatusMapper())
modelBuilder.Configurations.Add(New NOIProgramMapper())
modelBuilder.Configurations.Add(New NOISubmissionTypeMapper())
modelBuilder.Configurations.Add(New NOISubmissionAPMapper())
modelBuilder.Configurations.Add(New NOISubmissionISWAPMapper())
'modelBuilder.Entity(Of NOIPesticidePattern)() _
' .HasMany(Function(e) e.NOISubmissionAPChemicals) _
' .WithRequired(Function(e) e.NOIPesticidePattern) _
' .HasForeignKey(Function(e) e.PesticidePatternID) _
' .WillCascadeOnDelete(False)
modelBuilder.Properties(Of String)().Configure(Function(config) config.IsUnicode(False))
modelBuilder.Types(Of IEntity).Configure(Function(e) e.Ignore(Function(b) b.EntityState))
modelBuilder.Ignore(Of NOISubmissionSWBMP)()
modelBuilder.Ignore(Of NOISubmissionSWConstruct)()
modelBuilder.Ignore(Of NOISubmissionSW)()
modelBuilder.Ignore(Of NOISubmissionSIC)()
modelBuilder.Ignore(Of NOISubmissionNAICS)()
modelBuilder.Ignore(Of NOISubmissionNE)()
modelBuilder.Ignore(Of NOILoc)()
'modelBuilder.Ignore(Of NOISubmissionDocs)()
MyBase.OnModelCreating(modelBuilder)
End Sub
End Class
|
Imports System.IO
Imports System.Threading
Imports FX3Api
Public Class FX3Test
Private FX3 As FX3Connection
Private ResourcePath As String
Private TestRunner As Thread
Private TestFailed As Boolean
Private Pins As List(Of FX3PinObject)
Dim SN As String
Private CS, MOSI, MISO, SCLK, UART As FX3PinObject
Private Sub FX3Test_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'get executing path and resource path
Me.Text += " v" + Me.ProductVersion
Try
ResourcePath = GetPathToFile("")
FX3 = New FX3Connection(ResourcePath, ResourcePath, ResourcePath)
Catch ex As Exception
MsgBox("Error loading test software! " + ex.Message)
btn_StartTest.Enabled = False
End Try
btn_StopTest.Enabled = False
testStatus.Text = "Waiting"
testStatus.BackColor = Color.LightGoldenrodYellow
testConsole.ScrollBars = ScrollBars.Vertical
End Sub
Private Sub Shutdown() Handles Me.Closed
FX3.Disconnect()
End Sub
Private Function GetPathToFile(Name As String) As String
Dim pathStr As String = System.AppDomain.CurrentDomain.BaseDirectory
pathStr = Path.Combine(pathStr, Name)
Return pathStr
End Function
Private Sub WriteLine(line As String)
testConsole.AppendText(line + Environment.NewLine)
End Sub
Private Sub ClearLog()
testConsole.Text = ""
End Sub
Private Sub TestFinished()
Dim fileName As String
Dim filePath As String
Dim writer As StreamWriter
Dim testPassedStr As String
If TestFailed Then
testPassedStr = "FAILED"
Else
testPassedStr = "PASSED"
End If
btn_StartTest.Enabled = True
btn_StopTest.Enabled = False
Invoke(Sub() WriteLine("Test Run Finish Time: " + DateTime.Now.ToString()))
If Not TestFailed Then
testStatus.Text = "Passing"
'disconnect all boards
FX3.Disconnect()
End If
'save log file to CSV
fileName = "ADIS_FX3_TEST_SN" + SN + "_" + testPassedStr.ToString() + "_" + Now.ToString("s") + ".txt"
fileName = fileName.Replace(":", "-")
Try
If Not Directory.Exists(GetPathToFile("log")) Then Directory.CreateDirectory(GetPathToFile("log"))
filePath = GetPathToFile("log\" + fileName)
writer = New StreamWriter(filePath, FileMode.Create)
writer.WriteLine(testConsole.Text)
writer.Close()
Catch ex As Exception
MsgBox("Log write error! " + ex.Message)
End Try
End Sub
Private Sub btn_StartTest_Click(sender As Object, e As EventArgs) Handles btn_StartTest.Click
btn_StartTest.Enabled = False
btn_StopTest.Enabled = True
ClearLog()
testStatus.Text = "Running"
TestFailed = False
SN = "NONE"
testStatus.BackColor = Color.LightGreen
TestRunner = New Thread(AddressOf TestRunWork)
TestRunner.Start()
End Sub
Private Sub btn_StopTest_Click(sender As Object, e As EventArgs) Handles btn_StopTest.Click
testStatus.Text = "Canceled"
testStatus.BackColor = Color.LightGoldenrodYellow
'set test failed flag to stop test execution process in thread
WriteLine("Test canceled!")
TestFailed = True
End Sub
Private Sub TestRunWork()
Invoke(Sub() WriteLine("Test Run Start Time: " + DateTime.Now.ToString()))
Invoke(Sub() WriteLine("FX3 Resource Path: " + ResourcePath))
WaitForBoard()
LoadFirmware()
InitErrorLog()
RebootTest()
TestForShorts()
PinTest()
Invoke(Sub() TestFinished())
End Sub
Private Sub WaitForBoard()
If TestFailed Then Exit Sub
Invoke(Sub() WriteLine("Scanning for FX3 boards..."))
'bootloader already available
If FX3.AvailableFX3s.Count > 0 Then
Invoke(Sub() WriteLine("FX3 detected already operating in bootloader mode..."))
Exit Sub
End If
If FX3.BusyFX3s.Count > 0 Then
Invoke(Sub() WriteLine("Warning: FX3 running application code detected. Issuing reset..."))
FX3.ResetAllFX3s()
End If
Invoke(Sub() WriteLine("Waiting for bootloader to enumerate (20 second timeout)..."))
FX3.WaitForBoard(20)
End Sub
Private Sub LoadFirmware()
If TestFailed Then Exit Sub
If FX3.AvailableFX3s.Count > 0 Then
Invoke(Sub() WriteLine("FX3 bootloader device found..."))
Else
Invoke(Sub()
WriteLine("ERROR: No FX3 bootloader device found...")
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
Exit Sub
End If
Invoke(Sub() WriteLine("Connecting to FX3 SN" + FX3.AvailableFX3s(0) + "..."))
Try
FX3.Connect(FX3.AvailableFX3s(0))
SN = FX3.ActiveFX3SerialNumber
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
Exit Sub
End Try
Invoke(Sub() WriteLine("Connected! " + FX3.ActiveFX3.ToString()))
'build pin list
FX3.BitBangSpiConfig = New BitBangSpiConfig(True)
Pins = New List(Of FX3PinObject)
Pins.Add(FX3.DIO1)
Pins.Add(FX3.DIO2)
Pins.Add(FX3.DIO3)
Pins.Add(FX3.DIO4)
Pins.Add(FX3.FX3_GPIO1)
Pins.Add(FX3.FX3_GPIO2)
Pins.Add(FX3.FX3_GPIO3)
Pins.Add(FX3.FX3_GPIO4)
Pins.Add(FX3.BitBangSpiConfig.CS)
CS = FX3.BitBangSpiConfig.CS
Pins.Add(FX3.BitBangSpiConfig.SCLK)
SCLK = FX3.BitBangSpiConfig.SCLK
Pins.Add(FX3.BitBangSpiConfig.MISO)
MISO = FX3.BitBangSpiConfig.MISO
Pins.Add(FX3.BitBangSpiConfig.MOSI)
MOSI = FX3.BitBangSpiConfig.MOSI
Pins.Add(FX3.ResetPin)
'uart
UART = New FX3PinObject(48)
Pins.Add(New FX3PinObject(48))
End Sub
Private Sub InitErrorLog()
'skip if failure occurred earlier
If TestFailed Then Exit Sub
'error log count
Dim logCount As UInteger
Invoke(Sub() WriteLine("Initializing FX3 NVM Error Log..."))
Try
FX3.ClearErrorLog()
logCount = FX3.GetErrorLogCount()
If logCount <> 0 Then
Throw New Exception("Error log failed to clear. Count " + logCount.ToString())
End If
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: Log init failed! " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
Exit Sub
End Try
Invoke(Sub() WriteLine("Log successfully initialized..."))
End Sub
Private Sub RebootTest()
'skip if failure occurred earlier
If TestFailed Then Exit Sub
Dim sn As String = FX3.ActiveFX3.SerialNumber
Dim logCount As UInteger
Invoke(Sub() WriteLine("Rebooting FX3..."))
Try
FX3.Disconnect()
FX3.WaitForBoard(20)
FX3.Connect(sn)
logCount = FX3.GetErrorLogCount()
If logCount <> 0 Then
Throw New Exception("Non-zero error log. Count " + logCount.ToString())
End If
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: FX3 reboot failed: " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
Exit Sub
End Try
Invoke(Sub() WriteLine("FX3 successfully rebooted..."))
FX3.BitBangSpiConfig = New BitBangSpiConfig(True)
End Sub
Private Sub TestForShorts()
'skip if failure occurred earlier
If TestFailed Then Exit Sub
TristateGPIO()
'check for stuck high/low
SetAllPinResistors(FX3PinResistorSetting.PullUp)
Invoke(Sub() WriteLine("Checking all pins are logic high..."))
System.Threading.Thread.Sleep(10)
CheckAllPinLevels(1, New FX3PinObject(63), New FX3PinObject(63))
SetAllPinResistors(FX3PinResistorSetting.PullDown)
System.Threading.Thread.Sleep(10)
Invoke(Sub() WriteLine("Checking all pins are logic low..."))
CheckAllPinLevels(0, New FX3PinObject(63), New FX3PinObject(63))
'check pin independence
Invoke(Sub() WriteLine("Testing DIO1 <-> SCLK independence from other GPIO..."))
TestPinIndependence(FX3.DIO1, SCLK)
Invoke(Sub() WriteLine("Testing MOSI <-> MISO independence from other GPIO..."))
TestPinIndependence(MOSI, MISO)
Invoke(Sub() WriteLine("Testing DIO2 <-> CS independence from other GPIO..."))
TestPinIndependence(FX3.DIO2, CS)
Invoke(Sub() WriteLine("Testing DIO3 <-> DIO4 independence from other GPIO..."))
TestPinIndependence(FX3.DIO3, FX3.DIO4)
Invoke(Sub() WriteLine("Testing FX3_GPIO1 <-> FX3_GPIO2 independence from other GPIO..."))
TestPinIndependence(FX3.FX3_GPIO1, FX3.FX3_GPIO2)
Invoke(Sub() WriteLine("Testing FX3_GPIO3 <-> FX3_GPIO4 independence from other GPIO..."))
TestPinIndependence(FX3.FX3_GPIO3, FX3.FX3_GPIO4)
Invoke(Sub() WriteLine("Testing Reset <-> Debug Tx independence from other GPIO..."))
TestPinIndependence(FX3.ResetPin, UART)
End Sub
Private Sub TestPinIndependence(pin1 As FX3PinObject, pin2 As FX3PinObject)
FX3.SetPinResistorSetting(pin1, FX3PinResistorSetting.PullUp)
FX3.SetPinResistorSetting(pin2, FX3PinResistorSetting.PullUp)
CheckPinLevel(pin1, 1)
CheckPinLevel(pin2, 1)
CheckAllPinLevels(0, pin1, pin2)
SetAllPinResistors(FX3PinResistorSetting.PullDown)
Invoke(Sub() WriteLine("Checking all pins are logic low..."))
CheckAllPinLevels(0, New FX3PinObject(63), New FX3PinObject(63))
End Sub
Private Sub PinTest()
'skip if failure occurred earlier
If TestFailed Then Exit Sub
'get pin object references to SPI port pins
FX3.BitBangSpiConfig = New BitBangSpiConfig(True)
'read all pins to tri-state
TristateGPIO()
SetAllPinResistors(FX3PinResistorSetting.None)
If TestFailed Then Exit Sub
Invoke(Sub() WriteLine("Testing DIO1 <-> SCLK..."))
TestPins(FX3.DIO1, SCLK)
Invoke(Sub() WriteLine("Testing MOSI <-> MISO..."))
TestPins(MOSI, MISO)
Invoke(Sub() WriteLine("Testing DIO2 <-> CS..."))
TestPins(FX3.DIO2, CS)
Invoke(Sub() WriteLine("Testing DIO3 <-> DIO4..."))
TestPins(FX3.DIO3, FX3.DIO4)
Invoke(Sub() WriteLine("Testing FX3_GPIO1 <-> FX3_GPIO2..."))
TestPins(FX3.FX3_GPIO1, FX3.FX3_GPIO2)
Invoke(Sub() WriteLine("Testing FX3_GPIO3 <-> FX3_GPIO4..."))
TestPins(FX3.FX3_GPIO3, FX3.FX3_GPIO4)
Invoke(Sub() WriteLine("Testing Reset <-> Debug Tx..."))
TestPins(FX3.ResetPin, UART)
End Sub
Private Sub CheckPinLevel(pin As FX3PinObject, level As UInteger)
Dim val As UInteger
Try
val = FX3.ReadPin(pin)
If val <> level Then Throw New Exception("Invalid read value of GPIO[" + pin.pinConfig.ToString() + "]. Expected " + level.ToString() + " was " + val.ToString())
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
End Try
End Sub
Private Sub TristateGPIO()
'read all pins to tri-state
Invoke(Sub() WriteLine("Tri-stating all FX3 GPIO..."))
Try
For Each pin In Pins
FX3.ReadPin(pin)
Next
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: Unexpected exception during pin read")
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
End Try
End Sub
Private Sub CheckAllPinLevels(level As UInteger, exPin1 As FX3PinObject, exPin2 As FX3PinObject)
Dim expectedVal As UInteger
Try
For Each pin In Pins
'if excluded pin
If (pin.pinConfig = exPin1.pinConfig) Or (pin.pinConfig = exPin2.pinConfig) Then
expectedVal = FX3.ReadPin(pin)
Else
expectedVal = level
End If
CheckPinLevel(pin, expectedVal)
Next
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: Unexpected exception during pin read " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
End Try
End Sub
Private Sub SetAllPinResistors(setting As FX3PinResistorSetting)
Invoke(Sub() WriteLine("Setting all FX3 GPIO resistors to " + [Enum].GetName(GetType(FX3PinResistorSetting), setting) + "..."))
Try
For Each pin In Pins
FX3.SetPinResistorSetting(pin, setting)
Next
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: Unexpected exception during pin resistor configuration " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
TestFailed = True
End Try
End Sub
Private Sub TestPins(pin1 As FX3PinObject, pin2 As FX3PinObject)
Const NUM_PIN_TRIALS As Integer = 8
Dim pinLowTime, pinHighTime As Double
'check if we can do PWM test (timer hardware mux lines up correctly)
Dim pwmTest As Boolean = True
'timer 0 used as FX3 general purpose timer, will except if you try to use
If (pin1.PinNumber Mod 8) = 0 Then pwmTest = False
If (pin2.PinNumber Mod 8) = 0 Then pwmTest = False
'share the same timer
If (pin1.PinNumber Mod 8) = (pin2.PinNumber Mod 8) Then pwmTest = False
Try
Invoke(Sub() WriteLine("Starting pin read/write test..."))
'pin1 drives, pin2 reads
FX3.ReadPin(pin2)
For trial As Integer = 1 To NUM_PIN_TRIALS
FX3.SetPin(pin1, 0)
System.Threading.Thread.Sleep(10)
If FX3.ReadPin(pin2) <> 0 Then
Throw New Exception("Expected logic low, was high")
End If
FX3.SetPin(pin1, 1)
System.Threading.Thread.Sleep(10)
If FX3.ReadPin(pin2) <> 1 Then
Throw New Exception("Expected logic high, was low")
End If
Next
'pin2 drives, pin1 reads
FX3.ReadPin(pin1)
For trial As Integer = 1 To NUM_PIN_TRIALS
FX3.SetPin(pin2, 0)
System.Threading.Thread.Sleep(10)
If FX3.ReadPin(pin1) <> 0 Then
Throw New Exception("Expected logic low, was high")
End If
FX3.SetPin(pin2, 1)
System.Threading.Thread.Sleep(10)
If FX3.ReadPin(pin1) <> 1 Then
Throw New Exception("Expected logic high, was low")
End If
Next
If pwmTest Then
Invoke(Sub() WriteLine("Starting pin clock generation test..."))
FX3.ReadPin(pin1)
FX3.ReadPin(pin2)
'pin measure works on 10MHz timebase. 0.7 duty cycle @1MHz -> 0.7us high, 0.3us low
FX3.StartPWM(1000000, 0.7, pin1)
System.Threading.Thread.Sleep(1)
For trial As Integer = 1 To NUM_PIN_TRIALS
pinLowTime = 1000 * FX3.MeasureBusyPulse({0, 0}, pin2, 0, 100)
pinHighTime = 1000 * FX3.MeasureBusyPulse({0, 0}, pin2, 1, 100)
'off by more than 0.15us
If Math.Abs(0.3 - pinLowTime) > 0.15 Then Throw New Exception("Invalid pin low time, " + pinLowTime.ToString("f2") + "us")
If Math.Abs(0.7 - pinHighTime) > 0.15 Then Throw New Exception("Invalid pin high time, " + pinHighTime.ToString("f2") + "us")
Next
End If
Catch ex As Exception
Invoke(Sub()
WriteLine("ERROR: FX3 GPIO[" + pin1.PinNumber.ToString() + "] <-> FX3 GPIO[" + pin2.PinNumber.ToString() + "] loop back failed! " + ex.Message)
testStatus.Text = "FAILED"
testStatus.BackColor = Color.Red
End Sub)
FX3.StopPWM(pin1)
TestFailed = True
Exit Sub
End Try
'no errors
Invoke(Sub() WriteLine("Pin connections validated..."))
End Sub
End Class
|
Imports System.Data.SqlClient
<Serializable()> _
Public Class DBQueue
Inherits DBAccess
Private Const UPDATE_SITE_ACTIVITY_TOTAL As String = "UpdateSiteActivityTotal"
#Region "TALENTQUEUE"
Protected Overrides Function AccessDataBaseTALENTQUEUE() As ErrorObj
Dim err As New ErrorObj
Try
Select Case _settings.ModuleName
Case Is = UPDATE_SITE_ACTIVITY_TOTAL : err = UpdateSiteActivityTotal()
End Select
Catch sqlEx As SqlException
err.HasError = True
err.ErrorNumber = "TACDBQ-01"
err.ErrorMessage = sqlEx.Message
Catch ex As Exception
err.HasError = True
err.ErrorNumber = "TACDBQ-02"
err.ErrorMessage = ex.Message
End Try
Return err
End Function
#End Region
Private Function UpdateSiteActivityTotal() As ErrorObj
Dim err As New ErrorObj
Try
Dim sqlCmd As New SqlCommand()
sqlCmd.Connection = conTALENTQUEUE
sqlCmd.CommandType = CommandType.StoredProcedure
sqlCmd.CommandText = "usp_Queue_SiteActivityTotal_Update"
ResultDataSet = ExecuteDataSetForSQLDB(sqlCmd)
Catch sqlEx As SqlException
ResultDataSet = Nothing
Throw
Catch ex As Exception
ResultDataSet = Nothing
Throw
End Try
Return err
End Function
End Class
|
#Region "Imports"
Imports System.IO
#End Region
Namespace Generation_4
Public Class File_Structure
' Credit: http://projectpokemon.org/wiki/Pokemon_NDS_Structure
#Region "Unencrypted"
Private _personalityValue As Personality_Value_Object
Private _checksum As UShort 'change to custom object
''' <summary>
''' Personality value(PID) determines shininess, nature, and ability. The PID is also linked with the Individual Values(IVs).
''' </summary>
''' <returns></returns>
Public Property Personality_Value As Personality_Value_Object
Get
Return _personalityValue
End Get
Set(value As Personality_Value_Object)
_personalityValue = value
End Set
End Property
''' <summary>
''' Checksum of all file data.
''' </summary>
''' <returns></returns>
Public Property Checksum As UShort
Get
Return _checksum
End Get
Set(value As UShort)
_checksum = value
End Set
End Property
#End Region
#Region "Encrypted"
Private _blockA As Block_A
Private _blockB As Block_B
Private _blockC As Block_C
Private _blockD As Block_D
Private _partyData As Party_Data
''' <summary>
''' First major data block.
''' </summary>
''' <returns></returns>
Public Property Data_Block_A As Block_A
Get
Return _blockA
End Get
Set(value As Block_A)
_blockA = value
End Set
End Property
''' <summary>
''' Second major data block.
''' </summary>
''' <returns></returns>
Public Property Data_Block_B As Block_B
Get
Return _blockB
End Get
Set(value As Block_B)
_blockB = value
End Set
End Property
''' <summary>
''' Third major data block.
''' </summary>
''' <returns></returns>
Public Property Data_Block_C As Block_C
Get
Return _blockC
End Get
Set(value As Block_C)
_blockC = value
End Set
End Property
''' <summary>
''' Fourth major data block.
''' </summary>
''' <returns></returns>
Public Property Data_Block_D As Block_D
Get
Return _blockD
End Get
Set(value As Block_D)
_blockD = value
End Set
End Property
''' <summary>
''' Data block for all party data.
''' </summary>
''' <returns></returns>
Public Property Party_Data_Block As Party_Data
Get
Return _partyData
End Get
Set(value As Party_Data)
_partyData = value
End Set
End Property
Public Interface IDataBlock
''' <summary>
''' Identifies which block is being created.
''' </summary>
''' <returns></returns>
ReadOnly Property Block_Identifier As String
''' <summary>
''' Returns the data for the block as an array of bytes.
''' </summary>
''' <returns></returns>
Function ToBlock() As Byte()
End Interface
Public Class Block_A
Implements IDataBlock
Private _nationalPokedexID As Index_
Private _heldItem As Items
Private _originalTrainerID As UShort
Private _originalTrainerSecretID As UShort
Private _experience As UInteger
Private _friendship As Byte
Private _ability As Abilities
Private _markings As Markings_Object
Private _originalLanguage As Original_Languages
Private _hpEffortValue As Byte
Private _attackEffortValue As Byte
Private _defenseEffortValue As Byte
Private _speedEffortValue As Byte
Private _specialAttackEffortValue As Byte
Private _specialDefenseEffortValue As Byte
Private _coolContestValue As Byte
Private _beautyContestValue As Byte
Private _cuteContestValue As Byte
Private _smartContestValue As Byte
Private _toughContestValue As Byte
Private _sheenContestValue As Byte
Private _sinnohRibbonSet1 As Sinnoh_Ribbon_Set_1_Object
Private _sinnohRibbonSet2 As Sinnoh_Ribbon_Set_2_Object
Public Property National_Pokedex_ID As Index_
Get
Return _nationalPokedexID
End Get
Set(value As Index_)
_nationalPokedexID = value
End Set
End Property
Public Property Held_Item As Items
Get
Return _heldItem
End Get
Set(value As Items)
_heldItem = value
End Set
End Property
Public Property Original_Trainer_ID As UShort
Get
Return _originalTrainerID
End Get
Set(value As UShort)
_originalTrainerID = value
End Set
End Property
Public Property Original_Trainer_Secret_ID As UShort
Get
Return _originalTrainerSecretID
End Get
Set(value As UShort)
_originalTrainerSecretID = value
End Set
End Property
Public Property Experience As UInteger
Get
Return _experience
End Get
Set(value As UInteger)
_experience = value
End Set
End Property
Public Property Friendship As Byte
Get
Return _friendship
End Get
Set(value As Byte)
_friendship = value
End Set
End Property
Public Property Ability As Abilities
Get
Return _ability
End Get
Set(value As Abilities)
_ability = value
End Set
End Property
Public Property Markings As Markings_Object
Get
Return _markings
End Get
Set(value As Markings_Object)
_markings = value
End Set
End Property
Public Property Original_Language As Original_Languages
Get
Return _originalLanguage
End Get
Set(value As Original_Languages)
_originalLanguage = value
End Set
End Property
Public Property HP_Effort_Value As Byte
Get
Return _hpEffortValue
End Get
Set(value As Byte)
_hpEffortValue = value
End Set
End Property
Public Property Attack_Effort_Value As Byte
Get
Return _attackEffortValue
End Get
Set(value As Byte)
_attackEffortValue = value
End Set
End Property
Public Property Defense_Effort_Value As Byte
Get
Return _defenseEffortValue
End Get
Set(value As Byte)
_defenseEffortValue = value
End Set
End Property
Public Property Speed_Effort_Effort_Value As Byte
Get
Return _speedEffortValue
End Get
Set(value As Byte)
_speedEffortValue = value
End Set
End Property
Public Property Special_Attack_Effort_Value As Byte
Get
Return _specialAttackEffortValue
End Get
Set(value As Byte)
_specialAttackEffortValue = value
End Set
End Property
Public Property Special_Defense_Effort_Value As Byte
Get
Return _specialDefenseEffortValue
End Get
Set(value As Byte)
_specialDefenseEffortValue = value
End Set
End Property
Public Property Cool_Contest_Value As Byte
Get
Return _coolContestValue
End Get
Set(value As Byte)
_coolContestValue = value
End Set
End Property
Public Property Beauty_Contest_Value As Byte
Get
Return _beautyContestValue
End Get
Set(value As Byte)
_beautyContestValue = value
End Set
End Property
Public Property Cute_Contest_Value As Byte
Get
Return _cuteContestValue
End Get
Set(value As Byte)
_cuteContestValue = value
End Set
End Property
Public Property Smart_Contest_Value As Byte
Get
Return _smartContestValue
End Get
Set(value As Byte)
_smartContestValue = value
End Set
End Property
Public Property Tough_Contest_Value As Byte
Get
Return _toughContestValue
End Get
Set(value As Byte)
_toughContestValue = value
End Set
End Property
Public Property Sheen_Contest_Value As Byte
Get
Return _sheenContestValue
End Get
Set(value As Byte)
_sheenContestValue = value
End Set
End Property
Public Property Sinnoh_Ribbon_Set_1 As Sinnoh_Ribbon_Set_1_Object
Get
Return _sinnohRibbonSet1
End Get
Set(value As Sinnoh_Ribbon_Set_1_Object)
_sinnohRibbonSet1 = value
End Set
End Property
Public Property Sinnoh_Ribbon_Set_2 As Sinnoh_Ribbon_Set_2_Object
Get
Return _sinnohRibbonSet2
End Get
Set(value As Sinnoh_Ribbon_Set_2_Object)
_sinnohRibbonSet2 = value
End Set
End Property
Public ReadOnly Property Block_Identifier As String Implements IDataBlock.Block_Identifier
Get
Return "A"
End Get
End Property
Public Function ToBlock() As Byte() Implements IDataBlock.ToBlock
Dim _blockData(31) As Byte
Dim _dataStream As MemoryStream = New MemoryStream(_blockData)
Dim _dataWriter As BinaryWriter = New BinaryWriter(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataWriter
.Write(National_Pokedex_ID)
.Write(Held_Item)
.Write(Original_Trainer_ID)
.Write(Original_Trainer_Secret_ID)
.Write(Experience)
.Write(Friendship)
.Write(Ability)
.Write(Markings.ToByte())
.Write(Original_Language)
.Write(HP_Effort_Value)
.Write(Attack_Effort_Value)
.Write(Defense_Effort_Value)
.Write(Speed_Effort_Effort_Value)
.Write(Special_Attack_Effort_Value)
.Write(Special_Defense_Effort_Value)
.Write(Cool_Contest_Value)
.Write(Beauty_Contest_Value)
.Write(Cute_Contest_Value)
.Write(Smart_Contest_Value)
.Write(Tough_Contest_Value)
.Write(Sheen_Contest_Value)
.Write(Sinnoh_Ribbon_Set_1.ToUShort())
.Write(Sinnoh_Ribbon_Set_2.ToUShort())
End With
_dataWriter.Close()
_dataStream.Close()
Return _blockData
End Function
Public Sub New()
MyBase.New()
_nationalPokedexID = Index_.MissingNO
_heldItem = Items.NOTHING
_originalTrainerID = 0
_originalTrainerSecretID = 0
_experience = 0
_friendship = 0
_ability = Abilities.Cacophony
_markings = New Markings_Object()
_originalLanguage = 0
_hpEffortValue = 0
_attackEffortValue = 0
_defenseEffortValue = 0
_speedEffortValue = 0
_specialAttackEffortValue = 0
_specialDefenseEffortValue = 0
_coolContestValue = 0
_beautyContestValue = 0
_cuteContestValue = 0
_smartContestValue = 0
_toughContestValue = 0
_sheenContestValue = 0
_sinnohRibbonSet1 = New Sinnoh_Ribbon_Set_1_Object()
_sinnohRibbonSet2 = New Sinnoh_Ribbon_Set_2_Object()
End Sub
Public Sub New(ByVal _data As Byte())
MyBase.New()
Dim _dataStream As MemoryStream = New MemoryStream(_data)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_nationalPokedexID = CType(.ReadUInt16(), Index_)
_heldItem = CType(.ReadUInt16(), Items)
_originalTrainerID = .ReadUInt16()
_originalTrainerSecretID = .ReadUInt16()
_experience = .ReadUInt32()
_friendship = .ReadByte()
_ability = CType(.ReadByte(), Abilities)
_markings = New Markings_Object(.ReadByte())
_originalLanguage = CType(.ReadByte(), Original_Languages)
_hpEffortValue = .ReadByte()
_attackEffortValue = .ReadByte()
_defenseEffortValue = .ReadByte()
_speedEffortValue = .ReadByte()
_specialAttackEffortValue = .ReadByte()
_specialDefenseEffortValue = .ReadByte()
_coolContestValue = .ReadByte()
_beautyContestValue = .ReadByte()
_cuteContestValue = .ReadByte()
_smartContestValue = .ReadByte()
_toughContestValue = .ReadByte()
_sheenContestValue = .ReadByte()
_sinnohRibbonSet1 = New Sinnoh_Ribbon_Set_1_Object(.ReadUInt16())
_sinnohRibbonSet2 = New Sinnoh_Ribbon_Set_2_Object(.ReadUInt16())
End With
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
Public Class Block_B
Implements IDataBlock
Private _move1 As Moves
Private _move2 As Moves
Private _move3 As Moves
Private _move4 As Moves
Private _move1CurrentPP As Byte
Private _move2CurrentPP As Byte
Private _move3CurrentPP As Byte
Private _move4CurrentPP As Byte
Private _move1PPUp As Byte
Private _move2PPUp As Byte
Private _move3PPUp As Byte
Private _move4PPUp As Byte
Private _individualValues As Individual_Values_Object
Private _hoennRibbonSet1 As Hoenn_Ribbon_Set_1_Object
Private _hoennRibbonSet2 As Hoenn_Ribbon_Set_2_Object
Private _bitFlags1 As First_Flag_Set_Object
Private _shinyLeaves As Shiny_Leaves_Object
Private _platinumEggLocation As Locations
Private _platinumMetAtLocation As Locations
Public Property Move_1 As Moves
Get
Return _move1
End Get
Set(value As Moves)
_move1 = value
End Set
End Property
Public Property Move_2 As Moves
Get
Return _move2
End Get
Set(value As Moves)
_move2 = value
End Set
End Property
Public Property Move_3 As Moves
Get
Return _move3
End Get
Set(value As Moves)
_move3 = value
End Set
End Property
Public Property Move_4 As Moves
Get
Return _move4
End Get
Set(value As Moves)
_move4 = value
End Set
End Property
Public Property Move_1_Current_PP As Byte
Get
Return _move1CurrentPP
End Get
Set(value As Byte)
_move1CurrentPP = value
End Set
End Property
Public Property Move_2_Current_PP As Byte
Get
Return _move2CurrentPP
End Get
Set(value As Byte)
_move2CurrentPP = value
End Set
End Property
Public Property Move_3_Current_PP As Byte
Get
Return _move3CurrentPP
End Get
Set(value As Byte)
_move3CurrentPP = value
End Set
End Property
Public Property Move_4_Current_PP As Byte
Get
Return _move4CurrentPP
End Get
Set(value As Byte)
_move4CurrentPP = value
End Set
End Property
Public Property Move_1_PP_Up As Byte
Get
Return _move1PPUp
End Get
Set(value As Byte)
_move1PPUp = value
End Set
End Property
Public Property Move_2_PP_Up As Byte
Get
Return _move2PPUp
End Get
Set(value As Byte)
_move2PPUp = value
End Set
End Property
Public Property Move_3_PP_Up As Byte
Get
Return _move3PPUp
End Get
Set(value As Byte)
_move3PPUp = value
End Set
End Property
Public Property Move_4_PP_Up As Byte
Get
Return _move4PPUp
End Get
Set(value As Byte)
_move4PPUp = value
End Set
End Property
Public Property Individual_Values As Individual_Values_Object
Get
Return _individualValues
End Get
Set(value As Individual_Values_Object)
_individualValues = value
End Set
End Property
Public Property Hoenn_Ribbon_Set_1 As Hoenn_Ribbon_Set_1_Object
Get
Return _hoennRibbonSet1
End Get
Set(value As Hoenn_Ribbon_Set_1_Object)
_hoennRibbonSet1 = value
End Set
End Property
Public Property Hoenn_Ribbon_Set_2 As Hoenn_Ribbon_Set_2_Object
Get
Return _hoennRibbonSet2
End Get
Set(value As Hoenn_Ribbon_Set_2_Object)
_hoennRibbonSet2 = value
End Set
End Property
Public Property Bit_Flags_1 As First_Flag_Set_Object
Get
Return _bitFlags1
End Get
Set(value As First_Flag_Set_Object)
_bitFlags1 = value
End Set
End Property
Public Property Shiny_Leaves As Shiny_Leaves_Object
Get
Return _shinyLeaves
End Get
Set(value As Shiny_Leaves_Object)
_shinyLeaves = value
End Set
End Property
Public Property Platinum_Egg_Location As Locations
Get
Return _platinumEggLocation
End Get
Set(value As Locations)
_platinumEggLocation = value
End Set
End Property
Public Property Platinum_Met_At_Location As Locations
Get
Return _platinumMetAtLocation
End Get
Set(value As Locations)
_platinumMetAtLocation = value
End Set
End Property
Public ReadOnly Property Block_Identifier As String Implements IDataBlock.Block_Identifier
Get
Return "B"
End Get
End Property
Public Function ToBlock() As Byte() Implements IDataBlock.ToBlock
Dim _blockData(31) As Byte
Dim _dataStream As MemoryStream = New MemoryStream(_blockData)
Dim _dataWriter As BinaryWriter = New BinaryWriter(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataWriter
.Write(Move_1)
.Write(Move_2)
.Write(Move_3)
.Write(Move_4)
.Write(Move_1_Current_PP)
.Write(Move_2_Current_PP)
.Write(Move_3_Current_PP)
.Write(Move_4_Current_PP)
.Write(Move_1_PP_Up)
.Write(Move_2_PP_Up)
.Write(Move_3_PP_Up)
.Write(Move_4_PP_Up)
.Write(Individual_Values.ToUInteger())
.Write(Hoenn_Ribbon_Set_1.ToUShort())
.Write(Hoenn_Ribbon_Set_2.ToUShort())
.Write(Bit_Flags_1.ToByte())
.Write(Shiny_Leaves.ToByte())
_dataStream.Seek(28, SeekOrigin.Begin)
.Write(Platinum_Egg_Location)
.Write(Platinum_Met_At_Location)
End With
_dataWriter.Close()
_dataStream.Close()
Return _blockData
End Function
Public Sub New()
MyBase.New()
_move1 = Moves.NOTHING
_move2 = Moves.NOTHING
_move3 = Moves.NOTHING
_move4 = Moves.NOTHING
_move1CurrentPP = 0
_move2CurrentPP = 0
_move3CurrentPP = 0
_move4CurrentPP = 0
_move1PPUp = 0
_move2PPUp = 0
_move3PPUp = 0
_move4PPUp = 0
_individualValues = New Individual_Values_Object()
_hoennRibbonSet1 = New Hoenn_Ribbon_Set_1_Object()
_hoennRibbonSet2 = New Hoenn_Ribbon_Set_2_Object()
_bitFlags1 = New First_Flag_Set_Object()
_shinyLeaves = New Shiny_Leaves_Object()
_platinumEggLocation = Locations.Mystery_Zone
_platinumMetAtLocation = Locations.Mystery_Zone
End Sub
Public Sub New(ByVal _data As Byte())
MyBase.New()
Dim _dataStream As MemoryStream = New MemoryStream(_data)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_move1 = CType(.ReadUInt16(), Moves)
_move2 = CType(.ReadUInt16(), Moves)
_move3 = CType(.ReadUInt16(), Moves)
_move4 = CType(.ReadUInt16(), Moves)
_move1CurrentPP = .ReadByte()
_move2CurrentPP = .ReadByte()
_move3CurrentPP = .ReadByte()
_move4CurrentPP = .ReadByte()
_move1PPUp = .ReadByte()
_move2PPUp = .ReadByte()
_move3PPUp = .ReadByte()
_move4PPUp = .ReadByte()
_individualValues = New Individual_Values_Object(.ReadUInt32())
_hoennRibbonSet1 = New Hoenn_Ribbon_Set_1_Object(.ReadUInt16())
_hoennRibbonSet2 = New Hoenn_Ribbon_Set_2_Object(.ReadUInt16())
_bitFlags1 = New First_Flag_Set_Object(.ReadByte())
_shinyLeaves = New Shiny_Leaves_Object(.ReadByte())
_dataStream.Seek(28, SeekOrigin.Begin)
_platinumEggLocation = CType(.ReadUInt16(), Locations)
_platinumMetAtLocation = CType(.ReadUInt16(), Locations)
End With
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
Public Class Block_C
Implements IDataBlock
Private _nickname As Nickname_Object
Private _originGame As Byte ' change
Private _sinnohRibbonSet3 As Sinnoh_Ribbon_Set_3_Object
Private _sinnohRibbonSet4 As Sinnoh_Ribbon_Set_4_Object
Public Property Nickname As Nickname_Object
Get
Return _nickname
End Get
Set(value As Nickname_Object)
_nickname = value
End Set
End Property
Public Property Origin_Game As Byte
Get
Return _originGame
End Get
Set(value As Byte)
_originGame = value
End Set
End Property
Public Property Sinnoh_Ribbon_Set_3 As Sinnoh_Ribbon_Set_3_Object
Get
Return _sinnohRibbonSet3
End Get
Set(value As Sinnoh_Ribbon_Set_3_Object)
_sinnohRibbonSet3 = value
End Set
End Property
Public Property Sinnoh_Ribbon_Set_4 As Sinnoh_Ribbon_Set_4_Object
Get
Return _sinnohRibbonSet4
End Get
Set(value As Sinnoh_Ribbon_Set_4_Object)
_sinnohRibbonSet4 = value
End Set
End Property
Public ReadOnly Property Block_Identifier As String Implements IDataBlock.Block_Identifier
Get
Return "C"
End Get
End Property
Public Function ToBlock() As Byte() Implements IDataBlock.ToBlock
Dim _blockData(31) As Byte
Dim _dataStream As MemoryStream = New MemoryStream(_blockData)
Dim _dataWriter As BinaryWriter = New BinaryWriter(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataWriter
.Write(Nickname.Nickname_Data)
_dataStream.Seek(17, SeekOrigin.Begin)
.Write(Origin_Game)
.Write(Sinnoh_Ribbon_Set_3.ToUShort())
.Write(Sinnoh_Ribbon_Set_4.ToUShort())
End With
_dataWriter.Close()
_dataStream.Close()
Return _blockData
End Function
Public Sub New()
MyBase.New()
_nickname = New Nickname_Object()
_originGame = 0
_sinnohRibbonSet3 = New Sinnoh_Ribbon_Set_3_Object()
_sinnohRibbonSet4 = New Sinnoh_Ribbon_Set_4_Object()
End Sub
Public Sub New(ByVal _data As Byte())
MyBase.New()
Dim _dataStream As MemoryStream = New MemoryStream(_data)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_nickname = New Nickname_Object(.ReadBytes(16))
_dataStream.Seek(17, SeekOrigin.Begin)
_originGame = .ReadByte()
_sinnohRibbonSet3 = New Sinnoh_Ribbon_Set_3_Object(.ReadUInt16())
_sinnohRibbonSet4 = New Sinnoh_Ribbon_Set_4_Object(.ReadUInt16())
End With
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
Public Class Block_D
Implements IDataBlock
Private _originalTrainerName As Original_Trainer_Name_Object
Private _dateEggReceived As Pokemon_Date_Object
Private _dateMet As Pokemon_Date_Object
Private _diamondPearlEggLocation As Locations
Private _diamondPearlMetAtLocation As Locations
Private _pokerus As Pokerus_Strains
Private _pokeBall As Byte ' change to something else
Private _bitFlags2 As Second_Flag_Set_Object
Private _encounterType As Encounter_Types
Private _heartGoldSoulSilverPokeBall As Byte ' change to something else
Public Property Original_Trainer_Name As Original_Trainer_Name_Object
Get
Return _originalTrainerName
End Get
Set(value As Original_Trainer_Name_Object)
_originalTrainerName = value
End Set
End Property
Public Property Date_Egg_Received As Pokemon_Date_Object
Get
Return _dateEggReceived
End Get
Set(value As Pokemon_Date_Object)
_dateEggReceived = value
End Set
End Property
Public Property Date_Met As Pokemon_Date_Object
Get
Return _dateMet
End Get
Set(value As Pokemon_Date_Object)
_dateMet = value
End Set
End Property
Public Property DiamondPearl_Egg_Location As Locations
Get
Return _diamondPearlEggLocation
End Get
Set(value As Locations)
_diamondPearlEggLocation = value
End Set
End Property
Public Property DiamondPearl_Met_At_Location As Locations
Get
Return _diamondPearlMetAtLocation
End Get
Set(value As Locations)
_diamondPearlEggLocation = value
End Set
End Property
Public Property Pokerus As Pokerus_Strains
Get
Return _pokerus
End Get
Set(value As Pokerus_Strains)
_pokerus = value
End Set
End Property
Public Property Poke_Ball As Byte
Get
Return _pokeBall
End Get
Set(value As Byte)
_pokeBall = value
End Set
End Property
Public Property Bit_Flags_2 As Second_Flag_Set_Object
Get
Return _bitFlags2
End Get
Set(value As Second_Flag_Set_Object)
_bitFlags2 = value
End Set
End Property
Public Property Encounter_Type As Encounter_Types
Get
Return _encounterType
End Get
Set(value As Encounter_Types)
_encounterType = value
End Set
End Property
Public Property HeartGoldSoulSilver_Poke_Ball As Byte
Get
Return _heartGoldSoulSilverPokeBall
End Get
Set(value As Byte)
_heartGoldSoulSilverPokeBall = value
End Set
End Property
Public ReadOnly Property Block_Identifier As String Implements IDataBlock.Block_Identifier
Get
Return "D"
End Get
End Property
Public Function ToBlock() As Byte() Implements IDataBlock.ToBlock
Dim _blockData(31) As Byte
Dim _dataStream As MemoryStream = New MemoryStream(_blockData)
Dim _dataWriter As BinaryWriter = New BinaryWriter(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataWriter
.Write(Original_Trainer_Name.Original_Trainer_Name_Data)
.Write(Date_Egg_Received.ToBytes())
.Write(Date_Met.ToBytes())
.Write(DiamondPearl_Egg_Location)
.Write(DiamondPearl_Met_At_Location)
.Write(Pokerus)
.Write(Poke_Ball)
.Write(Bit_Flags_2.ToByte())
.Write(Encounter_Type)
.Write(HeartGoldSoulSilver_Poke_Ball)
End With
_dataWriter.Close()
_dataStream.Close()
Return _blockData
End Function
Public Sub New()
MyBase.New()
_originalTrainerName = New Original_Trainer_Name_Object()
_dateEggReceived = New Pokemon_Date_Object()
_dateMet = New Pokemon_Date_Object()
_diamondPearlEggLocation = Locations.Mystery_Zone
_diamondPearlMetAtLocation = Locations.Mystery_Zone
_pokerus = Pokerus_Strains.Strain_A
_pokeBall = 0
_bitFlags2 = New Second_Flag_Set_Object()
_encounterType = Encounter_Types.PalPark_Egg_Hatched_SpecialEvent
_heartGoldSoulSilverPokeBall = 0
End Sub
Public Sub New(ByVal _data As Byte())
MyBase.New()
Dim _dataStream As MemoryStream = New MemoryStream(_data)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_originalTrainerName = New Original_Trainer_Name_Object(.ReadBytes(16))
_dateEggReceived = New Pokemon_Date_Object(.ReadBytes(3))
_dateMet = New Pokemon_Date_Object(.ReadBytes(3))
_diamondPearlEggLocation = CType(.ReadUInt16(), Locations)
_diamondPearlMetAtLocation = CType(.ReadUInt16(), Locations)
_pokerus = CType(.ReadByte(), Pokerus_Strains)
_pokeBall = .ReadByte()
_bitFlags2 = New Second_Flag_Set_Object(.ReadByte())
_encounterType = CType(.ReadByte(), Encounter_Types)
_heartGoldSoulSilverPokeBall = .ReadByte()
End With
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
Public Class Party_Data
Implements IDataBlock
Private _status As Status_Object
Private _level As Byte
Private _capsuleIndex As Byte ' change to custom object
Private _currentHP As UShort
Private _maxHP As UShort
Private _attack As UShort
Private _defense As UShort
Private _speed As UShort
Private _specialAttack As UShort
Private _specialDefense As UShort
Private _trashData As Party_Trash_Data_Object
Private _sealCoordinates As Seal_Coordinates_Object
Public Property Status As Status_Object
Get
Return _status
End Get
Set(value As Status_Object)
_status = value
End Set
End Property
Public Property Level As Byte
Get
Return _level
End Get
Set(value As Byte)
_level = value
End Set
End Property
Public Property Capsule_Index As Byte
Get
Return _capsuleIndex
End Get
Set(value As Byte)
_capsuleIndex = value
End Set
End Property
Public Property Current_HP As UShort
Get
Return _currentHP
End Get
Set(value As UShort)
_currentHP = value
End Set
End Property
Public Property Maximum_HP As UShort
Get
Return _maxHP
End Get
Set(value As UShort)
_maxHP = value
End Set
End Property
Public Property Attack As UShort
Get
Return _attack
End Get
Set(value As UShort)
_attack = value
End Set
End Property
Public Property Defense As UShort
Get
Return _defense
End Get
Set(value As UShort)
_defense = value
End Set
End Property
Public Property Speed As UShort
Get
Return _speed
End Get
Set(value As UShort)
_speed = value
End Set
End Property
Public Property Special_Attack As UShort
Get
Return _specialAttack
End Get
Set(value As UShort)
_specialAttack = value
End Set
End Property
Public Property Special_Defense As UShort
Get
Return _specialDefense
End Get
Set(value As UShort)
_specialDefense = value
End Set
End Property
Public Property Trash_Data As Party_Trash_Data_Object
Get
Return _trashData
End Get
Set(value As Party_Trash_Data_Object)
_trashData = value
End Set
End Property
Public Property Seal_Coordinates As Seal_Coordinates_Object
Get
Return _sealCoordinates
End Get
Set(value As Seal_Coordinates_Object)
_sealCoordinates = value
End Set
End Property
Public ReadOnly Property Block_Identifier As String Implements IDataBlock.Block_Identifier
Get
Return "PARTY"
End Get
End Property
Public Function ToBlock() As Byte() Implements IDataBlock.ToBlock
Dim _blockData(99) As Byte
Dim _dataStream As MemoryStream = New MemoryStream(_blockData)
Dim _dataWriter As BinaryWriter = New BinaryWriter(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataWriter
.Write(Status.ToByte())
_dataStream.Seek(4, SeekOrigin.Begin)
.Write(Level)
.Write(Capsule_Index)
.Write(Current_HP)
.Write(Maximum_HP)
.Write(Attack)
.Write(Defense)
.Write(Speed)
.Write(Special_Attack)
.Write(Special_Defense)
.Write(Trash_Data.Trash_Data)
.Write(Seal_Coordinates.Seal_Coordinates_Data)
End With
_dataWriter.Close()
_dataStream.Close()
Return _blockData
End Function
Public Sub New()
MyBase.New()
_status = New Status_Object()
_level = 0
_capsuleIndex = 0
_currentHP = 0
_maxHP = 0
_attack = 0
_defense = 0
_speed = 0
_specialAttack = 0
_specialDefense = 0
_trashData = New Party_Trash_Data_Object()
_sealCoordinates = New Seal_Coordinates_Object()
End Sub
Public Sub New(ByVal _data As Byte())
MyBase.New()
Dim _dataStream As MemoryStream = New MemoryStream(_data)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_status = New Status_Object(.ReadByte())
_dataStream.Seek(4, SeekOrigin.Begin)
_level = .ReadByte()
_capsuleIndex = .ReadByte()
_currentHP = .ReadUInt16()
_maxHP = .ReadUInt16()
_attack = .ReadUInt16()
_defense = .ReadUInt16()
_speed = .ReadUInt16()
_specialAttack = .ReadUInt16()
_specialDefense = .ReadUInt16()
_trashData = New Party_Trash_Data_Object(.ReadBytes(56))
_sealCoordinates = New Seal_Coordinates_Object(.ReadBytes(24))
End With
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
#End Region
#Region "Custom Objects"
Public Class Personality_Value_Object
Private _personalityValue As UInteger
Private _nature As Natures
Private _genderValue As Byte
Private _abilityNumber As Byte
''' <summary>
''' The Personality Value of the Pokemon.
''' </summary>
''' <returns></returns>
Public Property Personality_Value As UInteger
Get
Return _personalityValue
End Get
Set(value As UInteger)
_personalityValue = value
End Set
End Property
''' <summary>
''' The Nature derived from the Personality Value of the Pokemon.
''' </summary>
''' <returns></returns>
Public Property Nature As Natures
Get
Return _nature
End Get
Set(value As Natures)
_nature = value
End Set
End Property
''' <summary>
''' The Gender Value derived from the Personality Value of the Pokemon.
''' </summary>
''' <returns></returns>
Public Property Gender_Value As Byte
Get
Return _genderValue
End Get
Set(value As Byte)
_genderValue = value
End Set
End Property
''' <summary>
''' The Number of the Ability that the Pokemon has.
''' </summary>
''' <returns></returns>
Public Property Ability_Number As Byte
Get
Return _abilityNumber
End Get
Set(value As Byte)
_abilityNumber = value
End Set
End Property
''' <summary>
''' Creates a new Personality Value object with all values set to 0.
''' </summary>
Public Sub New()
MyBase.New()
_personalityValue = 0
_nature = Natures.Hardy
_genderValue = 0
_abilityNumber = 0
End Sub
''' <summary>
''' Creates a new Personality Value object with all values set according to the provided data.
''' </summary>
''' <param name="_data">The Personality Value data.</param>
Public Sub New(ByVal _data As UInteger)
MyBase.New()
_personalityValue = _data
_nature = CType(_personalityValue Mod 25, Natures)
_genderValue = CType(_personalityValue And 255, Byte)
_abilityNumber = CType(_personalityValue And 1, Byte)
End Sub
End Class
Public Class Markings_Object
Private _circleActive As Boolean
Private _triangleActive As Boolean
Private _squareActive As Boolean
Private _heartActive As Boolean
Private _starActive As Boolean
Private _diamondActive As Boolean
''' <summary>
''' Indicates whether or not the Circle marking is active.
''' </summary>
''' <returns></returns>
Public Property Circle_Active As Boolean
Get
Return _circleActive
End Get
Set(value As Boolean)
_circleActive = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Triangle marking is active.
''' </summary>
''' <returns></returns>
Public Property Triangle_Active As Boolean
Get
Return _triangleActive
End Get
Set(value As Boolean)
_triangleActive = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Square marking is active.
''' </summary>
''' <returns></returns>
Public Property Square_Active As Boolean
Get
Return _squareActive
End Get
Set(value As Boolean)
_squareActive = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Heart marking is active.
''' </summary>
''' <returns></returns>
Public Property Heart_Active As Boolean
Get
Return _heartActive
End Get
Set(value As Boolean)
_heartActive = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Star marking is active.
''' </summary>
''' <returns></returns>
Public Property Star_Active As Boolean
Get
Return _starActive
End Get
Set(value As Boolean)
_starActive = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Diamond marking is active.
''' </summary>
''' <returns></returns>
Public Property Diamond_Active As Boolean
Get
Return _diamondActive
End Get
Set(value As Boolean)
_diamondActive = value
End Set
End Property
''' <summary>
''' Sets the X_Active flags according to the provided data.
''' </summary>
''' <param name="_data">The Markings data.</param>
Private Sub SetMarkings(ByVal _data As Byte)
Dim _tempData As Byte = _data And 1
Select Case _tempData
Case 0
_circleActive = False
Exit Select
Case 1
_circleActive = True
Exit Select
End Select
_tempData = _data And 2
Select Case _tempData
Case 0
_triangleActive = False
Exit Select
Case 2
_triangleActive = True
Exit Select
End Select
_tempData = _data And 4
Select Case _tempData
Case 0
_squareActive = False
Exit Select
Case 4
_squareActive = True
Exit Select
End Select
_tempData = _data And 8
Select Case _tempData
Case 0
_heartActive = False
Exit Select
Case 8
_heartActive = True
Exit Select
End Select
_tempData = _data And 16
Select Case _tempData
Case 0
_starActive = False
Exit Select
Case 16
_starActive = True
Exit Select
End Select
_tempData = _data And 32
Select Case _tempData
Case 0
_diamondActive = False
Exit Select
Case 32
_diamondActive = True
Exit Select
End Select
End Sub
''' <summary>
''' Creates a new Markings object with all Markings set to False.
''' </summary>
Public Sub New()
MyBase.New()
_circleActive = False
_triangleActive = False
_squareActive = False
_heartActive = False
_starActive = False
_diamondActive = False
End Sub
''' <summary>
''' Creates a new Markings object with all Markings set according to the provided data.
''' </summary>
''' <param name="_data">The Markings data.</param>
Public Sub New(ByVal _data As Byte)
MyBase.New()
SetMarkings(_data)
End Sub
''' <summary>
''' Returns a compiled byte containing the Markings flags.
''' </summary>
''' <returns></returns>
Public Function ToByte() As Byte
Dim _marks As Byte = 0
Select Case _circleActive
Case True
_marks += 1
Exit Select
End Select
Select Case _triangleActive
Case True
_marks += 2
Exit Select
End Select
Select Case _squareActive
Case True
_marks += 4
Exit Select
End Select
Select Case _heartActive
Case True
_marks += 8
Exit Select
End Select
Select Case _starActive
Case True
_marks += 16
Exit Select
End Select
Select Case _diamondActive
Case True
_marks += 32
Exit Select
End Select
Return _marks
End Function
End Class
Public MustInherit Class Ribbon_Set_Object
Private _ribbon1Present As Boolean
Private _ribbon2Present As Boolean
Private _ribbon3Present As Boolean
Private _ribbon4Present As Boolean
Private _ribbon5Present As Boolean
Private _ribbon6Present As Boolean
Private _ribbon7Present As Boolean
Private _ribbon8Present As Boolean
Private _ribbon9Present As Boolean
Private _ribbon10Present As Boolean
Private _ribbon11Present As Boolean
Private _ribbon12Present As Boolean
Private _ribbon13Present As Boolean
Private _ribbon14Present As Boolean
Private _ribbon15Present As Boolean
Private _ribbon16Present As Boolean
''' <summary>
''' Indicates whether or not the first Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_1_Present As Boolean
Get
Return _ribbon1Present
End Get
Set(value As Boolean)
_ribbon1Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the second Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_2_Present As Boolean
Get
Return _ribbon2Present
End Get
Set(value As Boolean)
_ribbon2Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the third Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_3_Present As Boolean
Get
Return _ribbon3Present
End Get
Set(value As Boolean)
_ribbon3Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the fourth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_4_Present As Boolean
Get
Return _ribbon4Present
End Get
Set(value As Boolean)
_ribbon4Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the fifth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_5_Present As Boolean
Get
Return _ribbon5Present
End Get
Set(value As Boolean)
_ribbon5Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the sixth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_6_Present As Boolean
Get
Return _ribbon6Present
End Get
Set(value As Boolean)
_ribbon6Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the seventh Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_7_Present As Boolean
Get
Return _ribbon7Present
End Get
Set(value As Boolean)
_ribbon7Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the eighth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_8_Present As Boolean
Get
Return _ribbon8Present
End Get
Set(value As Boolean)
_ribbon8Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the ninth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_9_Present As Boolean
Get
Return _ribbon9Present
End Get
Set(value As Boolean)
_ribbon9Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the tenth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_10_Present As Boolean
Get
Return _ribbon10Present
End Get
Set(value As Boolean)
_ribbon10Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the eleventh Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_11_Present As Boolean
Get
Return _ribbon11Present
End Get
Set(value As Boolean)
_ribbon11Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the twelfth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_12_Present As Boolean
Get
Return _ribbon12Present
End Get
Set(value As Boolean)
_ribbon12Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the thirteenth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_13_Present As Boolean
Get
Return _ribbon13Present
End Get
Set(value As Boolean)
_ribbon13Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the fourteenth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_14_Present As Boolean
Get
Return _ribbon14Present
End Get
Set(value As Boolean)
_ribbon14Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the fifteenth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_15_Present As Boolean
Get
Return _ribbon15Present
End Get
Set(value As Boolean)
_ribbon15Present = value
End Set
End Property
''' <summary>
''' Indicates whether or not the sixteenth Ribbon in the Ribbon Set is present.
''' </summary>
''' <returns></returns>
Public Property Ribbon_16_Present As Boolean
Get
Return _ribbon16Present
End Get
Set(value As Boolean)
_ribbon16Present = value
End Set
End Property
Private _ribbon1Name As String
Private _ribbon2Name As String
Private _ribbon3Name As String
Private _ribbon4Name As String
Private _ribbon5Name As String
Private _ribbon6Name As String
Private _ribbon7Name As String
Private _ribbon8Name As String
Private _ribbon9Name As String
Private _ribbon10Name As String
Private _ribbon11Name As String
Private _ribbon12Name As String
Private _ribbon13Name As String
Private _ribbon14Name As String
Private _ribbon15Name As String
Private _ribbon16Name As String
''' <summary>
''' The name for the first Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_1_Name As String
Get
Return _ribbon1Name
End Get
End Property
''' <summary>
''' The name for the second Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_2_Name As String
Get
Return _ribbon2Name
End Get
End Property
''' <summary>
''' The name for the third Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_3_Name As String
Get
Return _ribbon3Name
End Get
End Property
''' <summary>
''' The name for the fourth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_4_Name As String
Get
Return _ribbon4Name
End Get
End Property
''' <summary>
''' The name for the fifth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_5_Name As String
Get
Return _ribbon5Name
End Get
End Property
''' <summary>
''' The name for the sixth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_6_Name As String
Get
Return _ribbon6Name
End Get
End Property
''' <summary>
''' The name for the seventh Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_7_Name As String
Get
Return _ribbon7Name
End Get
End Property
''' <summary>
''' The name for the eighth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_8_Name As String
Get
Return _ribbon8Name
End Get
End Property
''' <summary>
''' The name for the ninth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_9_Name As String
Get
Return _ribbon9Name
End Get
End Property
''' <summary>
''' The name for the tenth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_10_Name As String
Get
Return _ribbon10Name
End Get
End Property
''' <summary>
''' The name for the eleventh Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_11_Name As String
Get
Return _ribbon11Name
End Get
End Property
''' <summary>
''' The name for the twelfth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_12_Name As String
Get
Return _ribbon12Name
End Get
End Property
''' <summary>
''' The name for the thirteenth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_13_Name As String
Get
Return _ribbon13Name
End Get
End Property
''' <summary>
''' The name for the fourteenth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_14_Name As String
Get
Return _ribbon14Name
End Get
End Property
''' <summary>
''' The name for the fifteenth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_15_Name As String
Get
Return _ribbon15Name
End Get
End Property
''' <summary>
''' The name for the sixteenth Ribbon in this set.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Ribbon_16_Name As String
Get
Return _ribbon16Name
End Get
End Property
''' <summary>
''' Sets the Ribbon_X_Present flags according to the provided data.
''' </summary>
''' <param name="_data">The Ribbon Set data.</param>
Private Sub SetRibbons(ByVal _data As UShort)
Dim _tempData As UShort = _data And 1
Select Case _tempData
Case 0
_ribbon1Present = False
Exit Select
Case 1
_ribbon1Present = True
Exit Select
End Select
_tempData = _data And 2
Select Case _tempData
Case 0
_ribbon2Present = False
Exit Select
Case 2
_ribbon2Present = True
Exit Select
End Select
_tempData = _data And 4
Select Case _tempData
Case 0
_ribbon3Present = False
Exit Select
Case 4
_ribbon3Present = True
Exit Select
End Select
_tempData = _data And 8
Select Case _tempData
Case 0
_ribbon4Present = False
Exit Select
Case 8
_ribbon4Present = True
Exit Select
End Select
_tempData = _data And 16
Select Case _tempData
Case 0
_ribbon5Present = False
Exit Select
Case 16
_ribbon5Present = True
Exit Select
End Select
_tempData = _data And 32
Select Case _tempData
Case 0
_ribbon6Present = False
Exit Select
Case 32
_ribbon6Present = True
Exit Select
End Select
_tempData = _data And 64
Select Case _tempData
Case 0
_ribbon7Present = False
Exit Select
Case 64
_ribbon7Present = True
Exit Select
End Select
_tempData = _data And 128
Select Case _tempData
Case 0
_ribbon8Present = False
Exit Select
Case 128
_ribbon8Present = True
Exit Select
End Select
_tempData = _data And 256
Select Case _tempData
Case 0
_ribbon9Present = False
Exit Select
Case 256
_ribbon9Present = True
Exit Select
End Select
_tempData = _data And 512
Select Case _tempData
Case 0
_ribbon10Present = False
Exit Select
Case 512
_ribbon10Present = True
Exit Select
End Select
_tempData = _data And 1024
Select Case _tempData
Case 0
_ribbon11Present = False
Exit Select
Case 1024
_ribbon11Present = True
Exit Select
End Select
_tempData = _data And 2048
Select Case _tempData
Case 0
_ribbon12Present = False
Exit Select
Case 2048
_ribbon12Present = True
Exit Select
End Select
_tempData = _data And 4096
Select Case _tempData
Case 0
_ribbon13Present = False
Exit Select
Case 4096
_ribbon13Present = True
Exit Select
End Select
_tempData = _data And 8192
Select Case _tempData
Case 0
_ribbon14Present = False
Exit Select
Case 8192
_ribbon14Present = True
Exit Select
End Select
_tempData = _data And 16384
Select Case _tempData
Case 0
_ribbon15Present = False
Exit Select
Case 16384
_ribbon15Present = True
Exit Select
End Select
_tempData = _data And 32768
Select Case _tempData
Case 0
_ribbon16Present = False
Exit Select
Case 32768
_ribbon16Present = True
Exit Select
End Select
End Sub
''' <summary>
''' Creates a new Ribbon Set object with all Ribbons set to False.
''' </summary>
''' <param name="_r1N">The name for the first Ribbon in this set.</param>
''' <param name="_r2N">The name for the second Ribbon in this set.</param>
''' <param name="_r3N">The name for the third Ribbon in this set.</param>
''' <param name="_r4N">The name for the fourth Ribbon in this set.</param>
''' <param name="_r5N">The name for the fifth Ribbon in this set.</param>
''' <param name="_r6N">The name for the sixth Ribbon in this set.</param>
''' <param name="_r7N">The name for the seventh Ribbon in this set.</param>
''' <param name="_r8N">The name for the eighth Ribbon in this set.</param>
''' <param name="_r9N">The name for the ninth Ribbon in this set.</param>
''' <param name="_r10N">The name for the tenth Ribbon in this set.</param>
''' <param name="_r11N">The name for the eleventh Ribbon in this set.</param>
''' <param name="_r12N">The name for the twelfth Ribbon in this set.</param>
''' <param name="_r13N">The name for the thirteenth Ribbon in this set.</param>
''' <param name="_r14N">The name for the fourteenth Ribbon in this set.</param>
''' <param name="_r15N">The name for the fifteenth Ribbon in this set.</param>
''' <param name="_r16N">The name for the sixteenth Ribbon in this set.</param>
Public Sub New(Optional ByVal _r1N As String = "", Optional ByVal _r2N As String = "", Optional ByVal _r3N As String = "", Optional ByVal _r4N As String = "",
Optional ByVal _r5N As String = "", Optional ByVal _r6N As String = "", Optional ByVal _r7N As String = "", Optional ByVal _r8N As String = "",
Optional ByVal _r9N As String = "", Optional ByVal _r10N As String = "", Optional ByVal _r11N As String = "", Optional ByVal _r12N As String = "",
Optional ByVal _r13N As String = "", Optional ByVal _r14N As String = "", Optional ByVal _r15N As String = "", Optional ByVal _r16N As String = "")
MyBase.New()
_ribbon1Present = False
_ribbon2Present = False
_ribbon3Present = False
_ribbon4Present = False
_ribbon5Present = False
_ribbon6Present = False
_ribbon7Present = False
_ribbon8Present = False
_ribbon9Present = False
_ribbon10Present = False
_ribbon11Present = False
_ribbon12Present = False
_ribbon13Present = False
_ribbon14Present = False
_ribbon15Present = False
_ribbon16Present = False
_ribbon1Name = _r1N
_ribbon2Name = _r2N
_ribbon3Name = _r3N
_ribbon4Name = _r4N
_ribbon5Name = _r5N
_ribbon6Name = _r6N
_ribbon7Name = _r7N
_ribbon8Name = _r8N
_ribbon9Name = _r9N
_ribbon10Name = _r10N
_ribbon11Name = _r11N
_ribbon12Name = _r12N
_ribbon13Name = _r13N
_ribbon14Name = _r14N
_ribbon15Name = _r15N
_ribbon16Name = _r16N
End Sub
''' <summary>
''' Creates a new Ribbon Set object with all Ribbons set according to the provided data.
''' </summary>
''' <param name="_data">The Ribbon Set data.</param>
''' <param name="_r1N">The name for the first Ribbon in this set.</param>
''' <param name="_r2N">The name for the second Ribbon in this set.</param>
''' <param name="_r3N">The name for the third Ribbon in this set.</param>
''' <param name="_r4N">The name for the fourth Ribbon in this set.</param>
''' <param name="_r5N">The name for the fifth Ribbon in this set.</param>
''' <param name="_r6N">The name for the sixth Ribbon in this set.</param>
''' <param name="_r7N">The name for the seventh Ribbon in this set.</param>
''' <param name="_r8N">The name for the eighth Ribbon in this set.</param>
''' <param name="_r9N">The name for the ninth Ribbon in this set.</param>
''' <param name="_r10N">The name for the tenth Ribbon in this set.</param>
''' <param name="_r11N">The name for the eleventh Ribbon in this set.</param>
''' <param name="_r12N">The name for the twelfth Ribbon in this set.</param>
''' <param name="_r13N">The name for the thirteenth Ribbon in this set.</param>
''' <param name="_r14N">The name for the fourteenth Ribbon in this set.</param>
''' <param name="_r15N">The name for the fifteenth Ribbon in this set.</param>
''' <param name="_r16N">The name for the sixteenth Ribbon in this set.</param>
Public Sub New(ByVal _data As UShort, Optional ByVal _r1N As String = "", Optional ByVal _r2N As String = "", Optional ByVal _r3N As String = "", Optional ByVal _r4N As String = "",
Optional ByVal _r5N As String = "", Optional ByVal _r6N As String = "", Optional ByVal _r7N As String = "", Optional ByVal _r8N As String = "",
Optional ByVal _r9N As String = "", Optional ByVal _r10N As String = "", Optional ByVal _r11N As String = "", Optional ByVal _r12N As String = "",
Optional ByVal _r13N As String = "", Optional ByVal _r14N As String = "", Optional ByVal _r15N As String = "", Optional ByVal _r16N As String = "")
MyBase.New()
SetRibbons(_data)
_ribbon1Name = _r1N
_ribbon2Name = _r2N
_ribbon3Name = _r3N
_ribbon4Name = _r4N
_ribbon5Name = _r5N
_ribbon6Name = _r6N
_ribbon7Name = _r7N
_ribbon8Name = _r8N
_ribbon9Name = _r9N
_ribbon10Name = _r10N
_ribbon11Name = _r11N
_ribbon12Name = _r12N
_ribbon13Name = _r13N
_ribbon14Name = _r14N
_ribbon15Name = _r15N
_ribbon16Name = _r16N
End Sub
''' <summary>
''' Returns a compiled unsigned short containing the Ribbons flags.
''' </summary>
''' <returns></returns>
Public Function ToUShort() As UShort
Dim _ribbons As UShort = 0
Select Case _ribbon1Present
Case True
_ribbons += 1
Exit Select
End Select
Select Case _ribbon2Present
Case True
_ribbons += 2
Exit Select
End Select
Select Case _ribbon3Present
Case True
_ribbons += 4
Exit Select
End Select
Select Case _ribbon4Present
Case True
_ribbons += 8
Exit Select
End Select
Select Case _ribbon5Present
Case True
_ribbons += 16
Exit Select
End Select
Select Case _ribbon6Present
Case True
_ribbons += 32
Exit Select
End Select
Select Case _ribbon7Present
Case True
_ribbons += 64
Exit Select
End Select
Select Case _ribbon8Present
Case True
_ribbons += 128
Exit Select
End Select
Select Case _ribbon9Present
Case True
_ribbons += 256
Exit Select
End Select
Select Case _ribbon10Present
Case True
_ribbons += 512
Exit Select
End Select
Select Case _ribbon11Present
Case True
_ribbons += 1024
Exit Select
End Select
Select Case _ribbon12Present
Case True
_ribbons += 2048
Exit Select
End Select
Select Case _ribbon13Present
Case True
_ribbons += 4096
Exit Select
End Select
Select Case _ribbon14Present
Case True
_ribbons += 8192
Exit Select
End Select
Select Case _ribbon15Present
Case True
_ribbons += 16384
Exit Select
End Select
Select Case _ribbon16Present
Case True
_ribbons += 32768
Exit Select
End Select
Return _ribbons
End Function
End Class
Public Class Sinnoh_Ribbon_Set_1_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Sinnoh Champ Ribbon", "Ability Ribbon", "Great Ability Ribbon", "Double Ability Ribbon", "Multi Ability Ribbon", "Pair Ability Ribbon", "World Ability Ribbon", "Alert Ribbon", "Shock Ribbon", "Downcast Ribbon", "Careless Ribbon", "Relax Ribbon", "Snooze Ribbon", "Smile Ribbon", "Gorgeous Ribbon", "Royal Ribbon")
End Sub
End Class
Public Class Sinnoh_Ribbon_Set_2_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Gorgeous Royal Ribbon", "Footprint Ribbon", "Record Ribbon", "History Ribbon", "Legend Ribbon", "Red Ribbon", "Green Ribbon", "Blue Ribbon", "Festival Ribbon", "Carnival Ribbon", "Classic Ribbon", "Premier Ribbon")
End Sub
End Class
Public Class Sinnoh_Ribbon_Set_3_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Cool Ribbon", "Cool Ribbon Great", "Cool Ribbon Ultra", "Cool Ribbon Master", "Beauty Ribbon", "Beauty Ribbon Great", "Beauty Ribbon Ultra", "Beauty Ribbon Master", "Cute Ribbon", "Cute Ribbon Great", "Cute Ribbon Ultra", "Cute Ribbon Master", "Smart Ribbon", "Smart Ribbon Great", "Smart Ribbon Ultra", "Smart Ribbon Master")
End Sub
End Class
Public Class Sinnoh_Ribbon_Set_4_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Tough Ribbon", "Tough Ribbon Great", "Tough Ribbon Ultra", "Tough Ribbon Master")
End Sub
End Class
Public Class Hoenn_Ribbon_Set_1_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Cool Ribbon", "Cool Ribbon Super", "Cool Ribbon Hyper", "Cool Ribbon Master", "Beauty Ribbon", "Beauty Ribbon Super", "Beauty Ribbon Hyper", "Beauty Ribbon Master", "Cute Ribbon", "Cute Ribbon Super", "Cute Ribbon Hyper", "Cute Ribbon Master", "Smart Ribbon", "Smart Ribbon Super", "Smart Ribbon Hyper", "Smart Ribbon Master")
End Sub
End Class
Public Class Hoenn_Ribbon_Set_2_Object
Inherits Ribbon_Set_Object
Public Sub New()
MyBase.New()
Ribbon_1_Present = False
Ribbon_2_Present = False
Ribbon_3_Present = False
Ribbon_4_Present = False
Ribbon_5_Present = False
Ribbon_6_Present = False
Ribbon_7_Present = False
Ribbon_8_Present = False
Ribbon_9_Present = False
Ribbon_10_Present = False
Ribbon_11_Present = False
Ribbon_12_Present = False
Ribbon_13_Present = False
Ribbon_14_Present = False
Ribbon_15_Present = False
Ribbon_16_Present = False
End Sub
Public Sub New(ByVal _data As UShort)
MyBase.New(_data, "Tough Ribbon", "Tough Ribbon Super", "Tough Ribbon Hyper", "Tough Ribbon Master", "Champion Ribbon", "Winning Ribbon", "Victory Ribbon", "Artist Ribbon", "Effort Ribbon", "Marine Ribbon", "Land Ribbon", "Sky Ribbon", "Country Ribbon", "National Ribbon", "Earth Ribbon", "World Ribbon")
End Sub
End Class
Public Class Individual_Values_Object
Private _hp As Byte
Private _attack As Byte
Private _defense As Byte
Private _speed As Byte
Private _specialAttack As Byte
Private _specialDefense As Byte
Private _isEgg As Boolean
Private _isNicknamed As Boolean
''' <summary>
''' The HP Individual Value.
''' </summary>
''' <returns></returns>
Public Property HP As Byte
Get
Return _hp
End Get
Set(value As Byte)
_hp = value
End Set
End Property
''' <summary>
''' The Attack Individual Value.
''' </summary>
''' <returns></returns>
Public Property Attack As Byte
Get
Return _attack
End Get
Set(value As Byte)
_attack = value
End Set
End Property
''' <summary>
''' The Defense Individual Value.
''' </summary>
''' <returns></returns>
Public Property Defense As Byte
Get
Return _defense
End Get
Set(value As Byte)
_defense = value
End Set
End Property
''' <summary>
''' The Speed Individual Value.
''' </summary>
''' <returns></returns>
Public Property Speed As Byte
Get
Return _speed
End Get
Set(value As Byte)
_speed = value
End Set
End Property
''' <summary>
''' The Special Attack Individual Value.
''' </summary>
''' <returns></returns>
Public Property Special_Attack As Byte
Get
Return _specialAttack
End Get
Set(value As Byte)
_specialAttack = value
End Set
End Property
''' <summary>
''' The Special Defense Individual Value.
''' </summary>
''' <returns></returns>
Public Property Special_Defense As Byte
Get
Return _specialDefense
End Get
Set(value As Byte)
_specialDefense = value
End Set
End Property
''' <summary>
''' The Is Egg flag.
''' </summary>
''' <returns></returns>
Public Property Is_Egg As Boolean
Get
Return _isEgg
End Get
Set(value As Boolean)
_isEgg = value
End Set
End Property
''' <summary>
''' The Is Nicknamed flag.
''' </summary>
''' <returns></returns>
Public Property Is_Nicknamed As Boolean
Get
Return _isNicknamed
End Get
Set(value As Boolean)
_isNicknamed = value
End Set
End Property
''' <summary>
''' Sets the Individual Values according to the provided data.
''' </summary>
''' <param name="_data">The Individual Value data.</param>
Private Sub SetIndividualValues(ByVal _data As UInteger)
Dim _tempData As UInteger = _data And 31
_hp = _tempData
_tempData = _data And 992
_attack = _tempData >> 5
_tempData = _data And 31744
_defense = _tempData >> 10
_tempData = _data And 1015808
_speed = _tempData >> 15
_tempData = _data And 32505856
_specialAttack = _tempData >> 20
_tempData = _data And 1040187392
_specialDefense = _tempData >> 25
End Sub
''' <summary>
''' Sets the Individual Value flags according to the provided data.
''' </summary>
''' <param name="_data">The Individual Value data.</param>
Private Sub SetFlags(ByVal _data As UInteger)
Dim _tempData As UInteger = _data And 1073741824
Select Case _tempData
Case 0
_isEgg = False
Exit Select
Case 1073741824
_isEgg = True
Exit Select
End Select
_tempData = _data And 2147483648
Select Case _tempData
Case 0
_isNicknamed = False
Exit Select
Case 2147483648
_isNicknamed = True
Exit Select
End Select
End Sub
''' <summary>
''' Creates a new Individual Value object with the Individual Values set to 0 and the flags set to False.
''' </summary>
Public Sub New()
MyBase.New()
_hp = 0
_attack = 0
_defense = 0
_speed = 0
_specialAttack = 0
_specialDefense = 0
_isEgg = False
_isNicknamed = False
End Sub
''' <summary>
''' Creates a new Individual Value object with the Individual Values and flags set according to the provided data.
''' </summary>
''' <param name="_data">The Individual Value data.</param>
Public Sub New(ByVal _data As UInteger)
MyBase.New()
SetIndividualValues(_data)
SetFlags(_data)
End Sub
''' <summary>
''' Returns a compiled unsigned integer containing the Individual Value data.
''' </summary>
''' <returns></returns>
Public Function ToUInteger() As UInteger
Dim _individualValues As UInteger = 0
Select Case _isNicknamed
Case True
_individualValues = ((((_individualValues >> 31) Or 1) - 1) Or 1) << 31
Exit Select
End Select
Select Case _isEgg
Case True
_individualValues = ((((_individualValues >> 30) Or 1) - 1) Or 1) << 30
Exit Select
End Select
_individualValues = ((((_individualValues >> 25) Or 31) - 31) Or _specialDefense) << 25
_individualValues = ((((_individualValues >> 20) Or 31) - 31) Or _specialAttack) << 20
_individualValues = ((((_individualValues >> 15) Or 31) - 31) Or _speed) << 15
_individualValues = ((((_individualValues >> 10) Or 31) - 31) Or _defense) << 10
_individualValues = ((((_individualValues >> 5) Or 31) - 31) Or _attack) << 5
_individualValues = ((((_individualValues >> 0) Or 31) - 31) Or _hp) << 0
Return _individualValues
End Function
End Class
Public Class First_Flag_Set_Object
Private _fatefulEncounterFlag As Boolean
Private _femaleFlag As Boolean
Private _genderlessFlag As Boolean
Private _alternateForm As Byte
''' <summary>
''' Indicates whether or not this Pokemon was met in a fateful encounter.
''' </summary>
''' <returns></returns>
Public Property Fateful_Encounter_Flag As Boolean
Get
Return _fatefulEncounterFlag
End Get
Set(value As Boolean)
_fatefulEncounterFlag = value
End Set
End Property
''' <summary>
''' Indicates whether or not this Pokemon is Female.
''' </summary>
''' <returns></returns>
Public Property Female_Flag As Boolean
Get
Return _femaleFlag
End Get
Set(value As Boolean)
_femaleFlag = value
End Set
End Property
''' <summary>
''' Indicates whether or not this Pokemon is Genderless.
''' </summary>
''' <returns></returns>
Public Property Genderless_Flag As Boolean
Get
Return _genderlessFlag
End Get
Set(value As Boolean)
_genderlessFlag = value
End Set
End Property
''' <summary>
''' Indicates what form this Pokemon is in(if this Pokemon has any alternate forms).
''' </summary>
''' <returns></returns>
Public Property Alternate_Form As Byte
Get
Return _alternateForm
End Get
Set(value As Byte)
_alternateForm = value
End Set
End Property
''' <summary>
''' Sets the Flag Set(first) flags according to the provided data.
''' </summary>
''' <param name="_data">The Flag Set(first) data.</param>
Private Sub SetFlags(ByVal _data As Byte)
Dim _tempData As Byte = _data And 1
Select Case _tempData
Case 0
_fatefulEncounterFlag = False
Exit Select
Case 1
_fatefulEncounterFlag = True
Exit Select
End Select
_tempData = _data And 2
Select Case _tempData
Case 0
_femaleFlag = False
Exit Select
Case 2
_femaleFlag = True
Exit Select
End Select
_tempData = _data And 4
Select Case _tempData
Case 0
_genderlessFlag = False
Exit Select
Case 4
_genderlessFlag = True
Exit Select
End Select
_tempData = _data And 248
_alternateForm = _tempData >> 3
End Sub
''' <summary>
''' Creates a new Flag Set(first) Object with all flags set to False or 0.
''' </summary>
Public Sub New()
MyBase.New()
_fatefulEncounterFlag = False
_femaleFlag = False
_genderlessFlag = False
_alternateForm = 0
End Sub
''' <summary>
''' Creates a new Flag Set(first) Object with all flags set according to the provided data.
''' </summary>
''' <param name="_data">The Flag Set(first) data.</param>
Public Sub New(ByVal _data As Byte)
MyBase.New()
SetFlags(_data)
End Sub
''' <summary>
''' Returns a compiled byte containing the Flag Set(first) data.
''' </summary>
''' <returns></returns>
Public Function ToByte() As Byte
Dim _flags As Byte = 0
_flags = ((((_flags >> 3) Or 31) - 31) Or _alternateForm) << 3
Select Case _genderlessFlag
Case True
_flags = ((((_flags >> 2) Or 1) - 1) Or 1) << 2
Exit Select
End Select
Select Case _femaleFlag
Case True
_flags = ((((_flags >> 1) Or 1) - 1) Or 1) << 1
Exit Select
End Select
Select Case _fatefulEncounterFlag
Case True
_flags = ((((_flags >> 0) Or 1) - 1) Or 1) << 1
Exit Select
End Select
Return _flags
End Function
End Class
Public Class Second_Flag_Set_Object
Private _metAtLevel As Byte
Private _femaleOriginalTrainerGenderFlag As Boolean
''' <summary>
''' The level at which the Pokemon was met.
''' </summary>
''' <returns></returns>
Public Property Met_At_Level As Byte
Get
Return _metAtLevel
End Get
Set(value As Byte)
_metAtLevel = value
End Set
End Property
''' <summary>
''' Indicates whether or not the Original Trainer of the Pokemon is Female.
''' </summary>
''' <returns></returns>
Public Property Female_Original_Trainer_Gender_Flag As Boolean
Get
Return _femaleOriginalTrainerGenderFlag
End Get
Set(value As Boolean)
_femaleOriginalTrainerGenderFlag = value
End Set
End Property
''' <summary>
''' Creates a new Flag Set(second) Object with all flags set to False or 0.
''' </summary>
Public Sub New()
MyBase.New()
_metAtLevel = 0
_femaleOriginalTrainerGenderFlag = False
End Sub
''' <summary>
''' Creates a new Flag Set(second) Object with all flags set according to provided data.
''' </summary>
''' <param name="_data">The Flag Set(second) data.</param>
Public Sub New(ByVal _data As Byte)
MyBase.New()
_metAtLevel = _data And 127
Dim _tempData As Byte = (_data And 128) >> 7
Select Case _tempData
Case 0
_femaleOriginalTrainerGenderFlag = False
Exit Select
Case 1
_femaleOriginalTrainerGenderFlag = True
Exit Select
End Select
End Sub
''' <summary>
''' Returns a compiled byte containing the Flag Set(second) data.
''' </summary>
''' <returns></returns>
Public Function ToByte() As Byte
Dim _flags As Byte = 0
Select Case _femaleOriginalTrainerGenderFlag
Case True
_flags = ((((_flags >> 7) Or 1) - 1) Or 1) << 7
Exit Select
End Select
_flags = ((((_flags >> 0) Or 127) - 127) Or _metAtLevel) << 0
Return _flags
End Function
End Class
Public Class Shiny_Leaves_Object
Private _leafA As Boolean
Private _leafB As Boolean
Private _leafC As Boolean
Private _leafD As Boolean
Private _leafE As Boolean
Private _leafCrown As Boolean
''' <summary>
''' Indicates if Leaf A is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_A As Boolean
Get
Return _leafA
End Get
Set(value As Boolean)
_leafA = value
End Set
End Property
''' <summary>
''' Indicates if Leaf B is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_B As Boolean
Get
Return _leafB
End Get
Set(value As Boolean)
_leafB = value
End Set
End Property
''' <summary>
''' Indicates if Leaf C is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_C As Boolean
Get
Return _leafC
End Get
Set(value As Boolean)
_leafC = value
End Set
End Property
''' <summary>
''' Indicates if Leaf D is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_D As Boolean
Get
Return _leafD
End Get
Set(value As Boolean)
_leafD = value
End Set
End Property
''' <summary>
''' Indicates if Leaf E is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_E As Boolean
Get
Return _leafE
End Get
Set(value As Boolean)
_leafE = value
End Set
End Property
''' <summary>
''' Indicates if the Leaf Crown is present.
''' </summary>
''' <returns></returns>
Public Property Leaf_Crown As Boolean
Get
Return _leafCrown
End Get
Set(value As Boolean)
_leafCrown = value
End Set
End Property
''' <summary>
''' Sets the Shiny Leaves flags according to the provided data.
''' </summary>
''' <param name="_data">The Shiny Leaves data.</param>
Private Sub SetLeaves(ByVal _data As Byte)
Dim _tempData As Byte = _data And 1
Select Case _tempData
Case 0
_leafA = False
Exit Select
Case 1
_leafA = True
Exit Select
End Select
_tempData = _data And 2
Select Case _tempData
Case 0
_leafB = False
Exit Select
Case 2
_leafB = True
Exit Select
End Select
_tempData = _data And 4
Select Case _tempData
Case 0
_leafC = False
Exit Select
Case 4
_leafC = True
Exit Select
End Select
_tempData = _data And 8
Select Case _tempData
Case 0
_leafD = False
Exit Select
Case 8
_leafD = True
Exit Select
End Select
_tempData = _data And 16
Select Case _tempData
Case 0
_leafE = False
Exit Select
Case 16
_leafE = True
Exit Select
End Select
_tempData = _data And 32
Select Case _tempData
Case 0
_leafCrown = False
Exit Select
Case 32
_leafCrown = True
Exit Select
End Select
End Sub
''' <summary>
''' Creates a new Shiny Leaves object with all flags set to False.
''' </summary>
Public Sub New()
MyBase.New()
_leafA = False
_leafB = False
_leafC = False
_leafD = False
_leafE = False
_leafCrown = False
End Sub
''' <summary>
''' Creates a new Shiny Leaves object with all flags set according to the provided data.
''' </summary>
''' <param name="_data"></param>
Public Sub New(ByVal _data As Byte)
MyBase.New()
SetLeaves(_data)
End Sub
''' <summary>
''' Returns a compiled byte containing the Shiny Leaves data.
''' </summary>
''' <returns></returns>
Public Function ToByte() As Byte
Dim _leaves As Byte = 0
Select Case _leafA
Case True
_leaves += 1
Exit Select
End Select
Select Case _leafB
Case True
_leaves += 2
Exit Select
End Select
Select Case _leafC
Case True
_leaves += 4
Exit Select
End Select
Select Case _leafD
Case True
_leaves += 8
Exit Select
End Select
Select Case _leafE
Case True
_leaves += 16
Exit Select
End Select
Select Case _leafCrown
Case True
_leaves += 32
Exit Select
End Select
Return _leaves
End Function
End Class
Public Class Nickname_Object
' TODO: add support for trash bytes
Private _nicknameData(21) As Byte
''' <summary>
''' Data for the Pokemon's Nickname
''' </summary>
''' <returns></returns>
Public Property Nickname_Data As Byte()
Get
Return _nicknameData
End Get
Set(value As Byte())
_nicknameData = value
End Set
End Property
''' <summary>
''' Creates a new Nickname object with a zeroed-out array.
''' </summary>
Public Sub New()
MyBase.New()
_nicknameData = New Byte() {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
End Sub
''' <summary>
''' Creates a new Nickname object with the provided data.
''' </summary>
''' <param name="_data">The Nickname data.</param>
Public Sub New(ByVal _data As Byte())
MyBase.New()
_nicknameData = _data
End Sub
End Class
Public Class Original_Trainer_Name_Object
' TODO: add support for trash bytes
Private _originalTrainerNameData(15) As Byte
''' <summary>
''' Data for the name of the Pokemon's Original Trainer.
''' </summary>
''' <returns></returns>
Public Property Original_Trainer_Name_Data As Byte()
Get
Return _originalTrainerNameData
End Get
Set(value As Byte())
_originalTrainerNameData = value
End Set
End Property
''' <summary>
''' Creates a new Original Trainer Name object with a zeroed-out array.
''' </summary>
Public Sub New()
MyBase.New()
_originalTrainerNameData = New Byte() {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
End Sub
''' <summary>
''' Creates a new Original Trainer Name object with the provided data.
''' </summary>
''' <param name="_data">The Original Trainer Name data.</param>
Public Sub New(ByVal _data As Byte())
MyBase.New()
_originalTrainerNameData = _data
End Sub
End Class
Public Class Pokemon_Date_Object
Private _dateDay As Byte
Private _dateMonth As Byte
Private _dateYear As Byte
''' <summary>
''' The day of the Date object.
''' </summary>
''' <returns></returns>
Public Property Day As Byte
Get
Return _dateDay
End Get
Set(value As Byte)
_dateDay = value
End Set
End Property
''' <summary>
''' The month of the Date object.
''' </summary>
''' <returns></returns>
Public Property Month As Byte
Get
Return _dateMonth
End Get
Set(value As Byte)
_dateMonth = value
End Set
End Property
''' <summary>
''' The year of the Date object.
''' </summary>
''' <returns></returns>
Public Property Year As Byte
Get
Return _dateYear
End Get
Set(value As Byte)
_dateYear = value
End Set
End Property
''' <summary>
''' Creates a new Pokemon Date object with all values set to 0.
''' </summary>
Public Sub New()
MyBase.New()
_dateYear = 0
_dateMonth = 0
_dateDay = 0
End Sub
''' <summary>
''' Creates a new Pokemon Date object with all values set according to the provided data.
''' </summary>
''' <param name="_data">The Pokemon Date data.</param>
Public Sub New(ByVal _data As Byte())
MyBase.New()
_dateYear = _data(0)
_dateMonth = _data(1)
_dateDay = _data(2)
End Sub
''' <summary>
''' Returns a compiled byte array containing the Pokemon Date data.
''' </summary>
''' <returns></returns>
Public Function ToBytes() As Byte()
Return New Byte() {_dateYear, _dateMonth, _dateDay}
End Function
End Class
Public Class Status_Object
Private _asleepTurns As Byte
Private _poisoned As Boolean
Private _burned As Boolean
Private _frozen As Boolean
Private _paralyzed As Boolean
Private _toxic As Boolean
''' <summary>
''' Indicates if the Pokemon is Asleep and for how many turns it will stay asleep.
''' </summary>
''' <returns></returns>
Public Property Asleep_Turns As Byte
Get
Return _asleepTurns
End Get
Set(value As Byte)
_asleepTurns = value
End Set
End Property
''' <summary>
''' Indicates if the Pokemon is Poisoned.
''' </summary>
''' <returns></returns>
Public Property Poisoned As Boolean
Get
Return _poisoned
End Get
Set(value As Boolean)
_poisoned = value
End Set
End Property
''' <summary>
''' Indicates if the Pokemon is Burned.
''' </summary>
''' <returns></returns>
Public Property Burned As Boolean
Get
Return _burned
End Get
Set(value As Boolean)
_burned = value
End Set
End Property
''' <summary>
''' Indicates if the Pokemon is Frozen.
''' </summary>
''' <returns></returns>
Public Property Frozen As Boolean
Get
Return _frozen
End Get
Set(value As Boolean)
_frozen = value
End Set
End Property
''' <summary>
''' Indicates if the Pokemon is Paralyzed.
''' </summary>
''' <returns></returns>
Public Property Paralyzed As Boolean
Get
Return _paralyzed
End Get
Set(value As Boolean)
_paralyzed = value
End Set
End Property
''' <summary>
''' Indicates if the Pokemon is Toxic.
''' </summary>
''' <returns></returns>
Public Property Toxic As Boolean
Get
Return _toxic
End Get
Set(value As Boolean)
_toxic = value
End Set
End Property
''' <summary>
''' Sets the Status flags according to the provided data.
''' </summary>
''' <param name="_data">The Status data.</param>
Private Sub SetFlags(ByVal _data As Byte)
Dim _tempData As Byte = _data And 128
Select Case _tempData
Case 0
_toxic = False
Exit Select
Case 128
_toxic = True
Exit Select
End Select
_tempData = _data And 64
Select Case _tempData
Case 0
_paralyzed = False
Exit Select
Case 64
_paralyzed = True
Exit Select
End Select
_tempData = _data And 32
Select Case _tempData
Case 0
_frozen = False
Exit Select
Case 32
_frozen = True
Exit Select
End Select
_tempData = _data And 16
Select Case _tempData
Case 0
_burned = False
Exit Select
Case 16
_burned = True
Exit Select
End Select
_tempData = _data And 8
Select Case _tempData
Case 0
_poisoned = False
Exit Select
Case 8
_poisoned = True
Exit Select
End Select
_tempData = _data And 7
_asleepTurns = _tempData
End Sub
''' <summary>
''' Creates a new Status object with all flags set to False or 0.
''' </summary>
Public Sub New()
MyBase.New()
_asleepTurns = 0
_poisoned = False
_burned = False
_frozen = False
_paralyzed = False
_toxic = False
End Sub
''' <summary>
''' Creates a new Status object with all flags set according to the provided data.
''' </summary>
''' <param name="_data">The Status data.</param>
Public Sub New(ByVal _data As Byte)
MyBase.New()
SetFlags(_data)
End Sub
''' <summary>
''' Returns a compiled byte containing the Status flags.
''' </summary>
''' <returns></returns>
Public Function ToByte() As Byte
Dim _statuses As Byte = 0
Select Case _toxic
Case True
_statuses += 128
End Select
Select Case _paralyzed
Case True
_statuses += 64
End Select
Select Case _frozen
Case True
_statuses += 32
End Select
Select Case _burned
Case True
_statuses += 16
End Select
Select Case _poisoned
Case True
_statuses += 8
End Select
_statuses = ((_statuses Or 7) - 7) Or _asleepTurns
Return _statuses
End Function
End Class
Public Class Party_Trash_Data_Object
Private _trashData(55) As Byte
''' <summary>
''' Trash Data contained in the Battle section of the Pokemon file.
''' </summary>
''' <returns></returns>
Public Property Trash_Data As Byte()
Get
Return _trashData
End Get
Set(value As Byte())
_trashData = value
End Set
End Property
''' <summary>
''' Creates a new Party Trash Data object with a zeroed-out array.
''' </summary>
Public Sub New()
MyBase.New()
_trashData = New Byte() {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
End Sub
''' <summary>
''' Creates a new Party Trash Data object with the provided data.
''' </summary>
''' <param name="_data">The party Trash Data.</param>
Public Sub New(ByVal _data As Byte())
MyBase.New()
_trashData = _data
End Sub
End Class
Public Class Seal_Coordinates_Object
Private _sealCoordinatesData(23) As Byte
''' <summary>
''' Data for the coordinates of the Seals on the Pokemon's Poke Ball Capsule.
''' </summary>
''' <returns></returns>
Public Property Seal_Coordinates_Data As Byte()
Get
Return _sealCoordinatesData
End Get
Set(value As Byte())
_sealCoordinatesData = value
End Set
End Property
''' <summary>
''' Creates a new Seal Coordinates object with a zeroed-out array.
''' </summary>
Public Sub New()
MyBase.New()
_sealCoordinatesData = New Byte() {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
End Sub
''' <summary>
''' Creates a new Seal Coordinates object with the provided data.
''' </summary>
''' <param name="_data">The Seal Coordinates data.</param>
Public Sub New(ByVal _data As Byte())
MyBase.New()
_sealCoordinatesData = _data
End Sub
End Class
Public Class Personality_Value_Generator_Object
Private _personalityValue As UInteger
Private _individualValues1 As UShort
Private _individualValues2 As UShort
Private _personalityValueType As Personality_Value_Types
''' <summary>
''' The Personality Value generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Personality_Value As UInteger
Get
Return _personalityValue
End Get
End Property
''' <summary>
''' The first compiled 16-bit unsigned integer containing the Individual Values.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Individual_Values_1 As UShort
Get
Return _individualValues1
End Get
End Property
''' <summary>
''' The second compiled 16-bit unsigned integer containing the Individual Values.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Individual_Values_2 As UShort
Get
Return _individualValues2
End Get
End Property
''' <summary>
''' The type of Personality Value that was generated.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Personality_Value_Type As Personality_Value_Types
Get
Return _personalityValueType
End Get
End Property
Private _seed1 As UShort
Private _seed2 As UShort
Private _seed3 As UShort
Private _seed4 As UShort
Private _seed5 As UShort
Private _seed6 As UShort
''' <summary>
''' The first seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_1 As UShort
Get
Return _seed1
End Get
End Property
''' <summary>
''' The second seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_2 As UShort
Get
Return _seed2
End Get
End Property
''' <summary>
''' The third seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_3 As UShort
Get
Return _seed3
End Get
End Property
''' <summary>
''' The fourth seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_4 As UShort
Get
Return _seed4
End Get
End Property
''' <summary>
''' The fifth seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_5 As UShort
Get
Return _seed5
End Get
End Property
''' <summary>
''' The sixth seed generated when Generate() is called.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Seed_6 As UShort
Get
Return _seed6
End Get
End Property
Private _hp As Byte
Private _attack As Byte
Private _defense As Byte
Private _speed As Byte
Private _specialAttack As Byte
Private _specialDefense As Byte
''' <summary>
''' The HP Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property HP As Byte
Get
Return _hp
End Get
End Property
''' <summary>
''' The Attack Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Attack As Byte
Get
Return _attack
End Get
End Property
''' <summary>
''' The Defense Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Defense As Byte
Get
Return _defense
End Get
End Property
''' <summary>
''' The Speed Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Speed As Byte
Get
Return _speed
End Get
End Property
''' <summary>
''' The Special Attack Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Special_Attack As Byte
Get
Return _specialAttack
End Get
End Property
''' <summary>
''' The Special Defense Individual Value.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Special_Defense As Byte
Get
Return _specialDefense
End Get
End Property
''' <summary>
''' The orders in which to generate the Personality Value.
''' </summary>
Public Enum Personality_Value_Types
ABCD = 1 ' normal nds/gba
ABCE ' wild gba
ABCF ' uncommon gba
ABDE ' rare gba
ABDF ' very rare gba
ABEF ' ultra rare gba
ACDE ' ???
ACDF ' ???
ADEF ' ???
BACD_Restricted ' common gba event (16-bit seeds)
BACD_Unrestricted ' common gba event (32-bit seeds)
End Enum
''' <summary>
''' Creates a new Personality Value Generator object with all values set to null.
''' </summary>
Public Sub New()
MyBase.New()
_personalityValue = 0
_individualValues1 = 0
_individualValues2 = 0
_personalityValueType = Personality_Value_Types.ABCD
End Sub
''' <summary>
''' Sets the Individual Values using the compiled 16-bit unsigned integers produced by Generate(UInteger, Personality_Value_Types)
''' </summary>
Private Sub SetIndividualValues()
_hp = 0
_attack = 0
_defense = 0
_speed = 0
_specialAttack = 0
_specialDefense = 0
_hp = _individualValues1 And 31
_attack = (_individualValues1 >> 5) And 31
_defense = (_individualValues1 >> 10) And 31
_speed = _individualValues2 And 31
_specialAttack = (_individualValues2 >> 5) And 31
_specialDefense = (_individualValues2 >> 10) And 31
End Sub
''' <summary>
''' Generates a Personality Value and its corresponding Individual Values based on the provided seed and Personality Value type.
''' </summary>
''' <param name="_seed">The seed to generate the Personality Value from.</param>
''' <param name="_type">The type of Personality Value.</param>
Public Sub Generate(Optional ByVal _seed As UInteger = 0, Optional ByVal _type As Personality_Value_Types = Personality_Value_Types.ABCD)
_seed1 = 0
_seed2 = 0
_seed3 = 0
_seed4 = 0
_seed5 = 0
_seed6 = 0
_personalityValue = 0
_individualValues1 = 0
_individualValues2 = 0
_personalityValueType = _type
Select Case _personalityValueType
Case Personality_Value_Types.ABCD
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed3)
_individualValues2 = GetCall(_seed4)
Exit Select
Case Personality_Value_Types.ABCE
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed3)
_individualValues2 = GetCall(_seed5)
Exit Select
Case Personality_Value_Types.ABCF
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_seed6 = NextSeed(_seed5)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed3)
_individualValues2 = GetCall(_seed6)
Exit Select
Case Personality_Value_Types.ABDE
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed4)
_individualValues2 = GetCall(_seed5)
Exit Select
Case Personality_Value_Types.ABDF
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_seed6 = NextSeed(_seed5)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed4)
_individualValues2 = GetCall(_seed6)
Exit Select
Case Personality_Value_Types.ABEF
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_seed6 = NextSeed(_seed5)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed2)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed5)
_individualValues2 = GetCall(_seed6)
Exit Select
Case Personality_Value_Types.ACDE
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed3)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed4)
_individualValues2 = GetCall(_seed5)
Exit Select
Case Personality_Value_Types.ACDF
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_seed6 = NextSeed(_seed5)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed3)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed4)
_individualValues2 = GetCall(_seed6)
Exit Select
Case Personality_Value_Types.ADEF
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_seed5 = NextSeed(_seed4)
_seed6 = NextSeed(_seed5)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed4)) << 16) Or 65535) - 65535) Or GetCall(_seed1)
_individualValues1 = GetCall(_seed5)
_individualValues2 = GetCall(_seed6)
Exit Select
Case Personality_Value_Types.BACD_Restricted
If _seed > 65535 Then
Throw New ArgumentException("For BACD Restricted Personality Values, the value of the seed cannot be greater than 65535.", "_seed")
Exit Sub
End If
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed1)) << 16) Or 65535) - 65535) Or GetCall(_seed2)
_individualValues1 = GetCall(_seed3)
_individualValues2 = GetCall(_seed4)
Exit Select
Case Personality_Value_Types.BACD_Unrestricted
_seed1 = NextSeed(_seed)
_seed2 = NextSeed(_seed1)
_seed3 = NextSeed(_seed2)
_seed4 = NextSeed(_seed3)
_personalityValue = (((((((_personalityValue >> 16) Or 65535) - 65535) Or GetCall(_seed1)) << 16) Or 65535) - 65535) Or GetCall(_seed2)
_individualValues1 = GetCall(_seed3)
_individualValues2 = GetCall(_seed4)
Exit Select
End Select
SetIndividualValues()
End Sub
''' <summary>
''' Returns a 32-bit unsigned integer calculated with the Pokemon Random Number Generator equation and the provided seed.
''' </summary>
''' <param name="_seed">The provided 32-bit seed.</param>
''' <returns></returns>
Private Function NextSeed(Optional ByVal _seed As UInteger = 0) As UInteger
Dim temp As ULong = (_seed * &H41C64E6D) + &H6073
Dim _temp2 As UInteger = BitConverter.ToUInt32(BitConverter.GetBytes(temp), 0)
Return _temp2
End Function
''' <summary>
''' Returns the last 16 bits of the provided number.
''' </summary>
''' <param name="_seed">The number to shorten.</param>
''' <returns></returns>
Private Function GetCall(ByVal _seed As UInteger) As UShort
Dim _temp As UShort = _seed >> 16
Return _temp
End Function
''' <summary>
''' Returns the Personality Value as a Personality_Value_Object.
''' </summary>
''' <returns></returns>
Public Function ToPersonalityValueObject() As Personality_Value_Object
Return New Personality_Value_Object(Personality_Value)
End Function
''' <summary>
''' Returns the Individual Values as an Individual_Values_Object.
''' </summary>
''' <returns></returns>
Public Function ToIndividualValuesObject() As Individual_Values_Object
Dim _individualValuesObject As New Individual_Values_Object()
With _individualValuesObject
.HP = HP
.Attack = Attack
.Defense = Defense
.Speed = Speed
.Special_Attack = Special_Attack
.Special_Defense = Special_Defense
.Is_Egg = False
.Is_Nicknamed = False
End With
Return _individualValuesObject
End Function
End Class
Public Class File_Encryption_Object
Implements IDisposable
''' <summary>
''' Which mode to operate under.
''' </summary>
Public Enum Modes As Byte
Decryption = 0
Encryption = 1
End Enum
Private _decryptedData(135) As Byte
Private _encryptedData(135) As Byte
''' <summary>
''' Byte array for the decrypted data.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Decrypted_Data As Byte()
Get
Return _decryptedData
End Get
End Property
''' <summary>
''' Byte array for the encrypted data.
''' </summary>
''' <returns></returns>
Public ReadOnly Property Encrypted_Data As Byte()
Get
Return _encryptedData
End Get
End Property
''' <summary>
''' Decrypts the pokemon object.
''' </summary>
''' <returns></returns>
Private Function Decrypt() As Byte()
Dim _checksum As UShort = BitConverter.ToUInt16(_encryptedData, 6)
Dim _currentSeed As UInteger = _checksum
For x As Integer = 8 To 135 Step 2
Dim _nextNum As UInteger = NextSeed(_currentSeed)
_currentSeed = _nextNum
Dim _xorFix As UShort = BitConverter.ToUInt16(_encryptedData, x) Xor (_nextNum >> 16)
_encryptedData(x + 1) = CByte(_xorFix >> 8)
_encryptedData(x) = CByte(_xorFix And 255)
Next
Return _encryptedData
End Function
''' <summary>
''' Encrypts the pokemon object.
''' </summary>
''' <returns></returns>
Private Function Encrypt() As Byte()
Dim _checksum As UShort = BitConverter.ToUInt16(_decryptedData, 6)
Dim _currentSeed As UInteger = _checksum
For x As Integer = 8 To 135 Step 2
Dim _nextNum As UInteger = NextSeed(_currentSeed)
_currentSeed = _nextNum
Dim _xorFix As UShort = BitConverter.ToUInt16(_decryptedData, x) Xor (_nextNum >> 16)
_decryptedData(x + 1) = CByte(_xorFix >> 8)
_decryptedData(x) = CByte(_xorFix And 255)
Next
Return _decryptedData
End Function
''' <summary>
''' Returns a 32-bit unsigned integer calculated with the Pokemon Random Number Generator equation and the provided seed.
''' </summary>
''' <param name="_seed">The provided 32-bit seed.</param>
''' <returns></returns>
Private Function NextSeed(Optional ByVal _seed As UInteger = 0) As UInteger
Dim temp As ULong = (_seed * &H41C64E6D) + &H6073
Dim _temp2 As UInteger = BitConverter.ToUInt32(BitConverter.GetBytes(temp), 0)
Return _temp2
End Function
''' <summary>
''' Creates a new encryption object.
''' </summary>
''' <param name="_mode">Encryption or decryption.</param>
''' <param name="_data">Data to modify.</param>
Public Sub New(ByVal _mode As Modes, ByRef _data As Byte())
Select Case _mode
Case Modes.Decryption
_encryptedData = _data
_data = Decrypt()
Exit Sub
Case Modes.Encryption
_decryptedData = _data
_data = Encrypt()
Exit Sub
End Select
End Sub
#Region "IDisposable Support"
Private disposedValue As Boolean
Protected Overridable Sub Dispose(disposing As Boolean)
If Not disposedValue Then
If disposing Then
_decryptedData = Nothing
_encryptedData = Nothing
End If
End If
disposedValue = True
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Dispose(True)
End Sub
#End Region
End Class
#End Region
#Region "Enumerations"
Public Enum Natures As Byte
Hardy = 0
Lonely
Brave
Adamant
Naughty
Bold
Docile
Relaxed
Impish
Lax
Timid
Hasty
Serious
Jolly
Naive
Modest
Mild
Quiet
Bashful
Rash
Calm
Gentle
Sassy
Careful
Quirky
End Enum
Public Enum Original_Languages As Byte
Japanese = 1
English
French
Italian
Deutsch
Spanish = 7
South_Korean
End Enum
Public Enum Unown_Alternate_Forms As Byte
A = 0
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
Exclamation_Point
Question_Mark
End Enum
Public Enum Deoxys_Alternate_Forms As Byte
Normal = 0
Attack
Defense
Speed
End Enum
Public Enum Burmy_Wormadam_Alternate_Forms As Byte
Plant = 0
Sandy
Trash
End Enum
Public Enum Shellos_Gastrodon_Alternate_Forms As Byte
West = 0
East
End Enum
Public Enum Rotom_Alternate_Forms As Byte
Normal = 0
Heat
Wash
Frost
Fan
Cut
End Enum
Public Enum Giratina_Alternate_Forms As Byte
Altered = 0
Origin
End Enum
Public Enum Shaymin_Alternate_Forms As Byte
Land = 0
Sky
End Enum
Public Enum Arceus_Alternate_Forms As Byte
Normal = 0
Fist
Sky
Toxic
Earth
Stone
Insect
Spooky
Iron
Flame
Splash
Meadow
Zap
Mind
Icicle
Draco
Dread
End Enum
Public Enum Pokerus_Strains As Byte
Strain_A = 0
Strain_B
Strain_C
Strain_D
Strain_A_2 = 4
Strain_B_2
Strain_C_2
Strain_D_2
Strain_A_3 = 8
Strain_B_3
Strain_C_3
Strain_D_3
Strain_A_4 = 12
Strain_B_4
Strain_C_4
Strain_D_4
End Enum
Public Enum Encounter_Types As Byte
PalPark_Egg_Hatched_SpecialEvent = 0
Tall_Grass = 2
In_Game_Event = 4
Cave_HallOfOrigin = 5
Surfing_Fishing = 7
Building = 9
GreatMarsh_SafariZone = 10
Starter_Fossil_Gift = 12
End Enum
#End Region
Public Function ToPKM(Optional ByVal _party As Boolean = False) As Byte()
Dim _data(135) As Byte
Dim _mmStrm As New MemoryStream(_data)
Dim _bnWrtr As New BinaryWriter(_mmStrm)
With _bnWrtr
.Write(Personality_Value.Personality_Value)
.Seek(6, SeekOrigin.Begin)
.Write(Checksum)
.Write(Data_Block_A.ToBlock())
.Write(Data_Block_B.ToBlock())
.Write(Data_Block_C.ToBlock())
.Write(Data_Block_D.ToBlock())
End With
Return _data
End Function
Public Sub New()
MyBase.New()
_blockA = New Block_A()
_blockB = New Block_B()
_blockC = New Block_C()
_blockD = New Block_D()
_partyData = New Party_Data()
End Sub
Public Sub New(ByVal _data As Byte(), Optional ByVal _encrypted As Boolean = False)
MyBase.New()
If _data.Length < 136 Then Exit Sub
Dim _pokemonData(135) As Byte
_pokemonData = _data
If _encrypted = True Then
Dim _decryptor As New File_Encryption_Object(File_Encryption_Object.Modes.Decryption, _pokemonData)
_decryptor.Dispose()
End If
Dim _dataStream As MemoryStream = New MemoryStream(_pokemonData)
Dim _dataReader As BinaryReader = New BinaryReader(_dataStream)
_dataStream.Seek(0, SeekOrigin.Begin)
With _dataReader
_personalityValue = New Personality_Value_Object(.ReadUInt32())
_dataStream.Seek(6, SeekOrigin.Begin)
_checksum = .ReadUInt16()
_blockA = New Block_A(.ReadBytes(32))
_blockB = New Block_B(.ReadBytes(32))
_blockC = New Block_C(.ReadBytes(32))
_blockD = New Block_D(.ReadBytes(32))
End With
If _data.Length = 236 Then : GoTo LinePartyData
Else : _partyData = New Party_Data() : GoTo LineCloseStreamObjects
End If
LinePartyData:
_dataStream.Seek(136, SeekOrigin.Begin)
With _dataReader
_partyData = New Party_Data(.ReadBytes(100))
End With
GoTo LineCloseStreamObjects
LineCloseStreamObjects:
_dataReader.Close()
_dataStream.Close()
End Sub
End Class
#Region "Enumerations"
' Credit: http://bulbapedia.bulbagarden.net/wiki/List_of_locations_by_index_number_(Generation_IV)
Public Enum Locations As UShort
Mystery_Zone = 0 ' start of diamond/pearl
Twinleaf_Town
Sandgem_Town
Floaroma_Town
Solaceon_Town
Celestic_Town
Jubilife_City
Canalave_City
Oreburgh_City
Eterna_City
Hearthome_City
Pastoria_City
Veilstone_City
Sunyshore_City
Snowpoint_City
Pokemon_League
Route_201
Route_202
Route_203
Route_204
Route_205
Route_206
Route_207
Route_208
Route_209
Route_210
Route_211
Route_212
Route_213
Route_214
Route_215
Route_216
Route_217
Route_218
Route_219
Route_220
Route_221
Route_222
Route_223
Route_224
Route_225
Route_226
Route_227
Route_228
Route_229
Route_230
Oreburgh_Mine
Valley_Windworks
Eterna_Forest
Fuego_Ironworks
Mt_Coronet
Spear_Pillar
Great_Marsh
Solaceon_Ruins
Victory_Road_Sinnoh
Pal_Park
Amity_Square
Ravaged_Path
Floaroma_Meadow
Oreburgh_Gate
Fullmoon_Island
Sendoff_Spring
Turnback_Cave
Flower_Paradise
Snowpoint_Temple
Wayward_Cave
Ruin_Maniac_Cave
Maniac_Tunnel
Trophy_Garden
Iron_Island
Old_Chateau
Galactic_HQ
Verity_Lakefront
Valor_Lakefront
Acuity_Lakefront
Spring_Path
Lake_Verity
Lake_Valor
Lake_Acuity
Newmoon_Island
Battle_Tower
Fight_Area
Survival_Area
Resort_Area
Stark_Mountain
Seabreak_Path
Hall_of_Origin
Verity_Cavern
Valor_Cavern
Acuity_Cavern
Jubilife_TV
Poketch_Co
GTS
Trainers_School
Mining_Museum
Flower_Shop
Cycle_Shop
Contest_Hall
Poffin_House
Foreign_Building
Pokemon_Day_Care
Veilstone_Store
Game_Corner
Canalave_Library
Vista_Lighthouse
Sunyshore_Market
Pokemon_Mansion
Footstep_House
Cafe
Grand_Lake
Restaurant
Battle_Park ' end of diamond/pearl
Battle_Frontier ' start of platinum
Battle_Factory
Battle_Castle
Battle_Arcade
Battle_Hall
Distortion_World
Global_Terminal
Villa
Battleground
ROTOMs_Room
T_G_Eterna_Bldg
Iron_Ruins
Iceburg_Ruins
Rock_Peak_Ruins ' end of platinum
New_Bark_Town ' start of heart gold/soul silver
Cherrygrove_City
Violet_City
Azalea_Town
Cianwood_City
Goldenrod_City
Olivine_City
Ecruteak_City
Mahogany_Town
Lake_of_Rage
Blackthorn_City
Mt_Silver
Pallet_Town
Viridian_City
Pewter_City
Cerulean_City
Lavender_Town
Vermilion_City
Celadon_City
Fuchsia_City
Cinnabar_Island
Indigo_Plateau
Saffron_City
Route_1
Route_2
Route_3
Route_4
Route_5
Route_6
Route_7
Route_8
Route_9
Route_10
Route_11
Route_12
Route_13
Route_14
Route_15
Route_16
Route_17
Route_18
Route_19
Route_20
Route_21
Route_22
Route_23
Route_24
Route_25
Route_26
Route_27
Route_28
Route_29
Route_30
Route_31
Route_32
Route_33
Route_34
Route_35
Route_36
Route_37
Route_38
Route_39
Route_40
Route_41
Route_42
Route_43
Route_44
Route_45
Route_46
Route_47
Route_48
DIGLETTs_Cave
Mt_Moon
Cerulean_Cave
Rock_Tunnel
Power_Plant
Safari_Zone
Seafoam_Islands
Sprout_Tower
Bell_Tower
Burned_Tower
National_Park
Radio_Tower
Ruins_of_Alph
Union_Cave
SLOWPOKE_Well
Lighthouse
Team_Rocket_HQ
Ilex_Forest
Goldenrod_Tunnel
Mt_Mortar
Ice_Path
Whirl_Islands
Mt_Silver_Cave
Dark_Cave
Victory_Road_Kanto
Dragons_Den
Tohjo_Falls
Viridian_Forest
Pokeathlon_Dome
S_S_Aqua
Safari_Zone_Gate
Cliff_Cave
Frontier_Access
Bellchime_Trail
Sinjoh_Ruins
Embedded_Tower
Pokewalker
Cliff_Edge_Gate ' end of heart gold/soul silver
Day_Care_Couple = 2000
Link_trade_arrive
Link_trade_met
Kanto
Johto
Hoenn
Sinnoh
Unknown
Distant_land
Traveling_Man
Riley
Cynthia ' platinum
Mystery_Zone_2
Mr_Pokemon ' heart gold/soul silver
Primo ' heart gold/soul silver
Lovely_place = 3000
Pokemon_Ranger
Faraway_place
Pokemon_Movie
Pokemon_Movie_06
Pokemon_Movie_07
Pokemon_Movie_08
Pokemon_Movie_09
Pokemon_Movie_10
Pokemon_Movie_11
Pokemon_Movie_12
Pokemon_Movie_13
Pokemon_Movie_14
Pokemon_Movie_15
Pokemon_Movie_16
Pokemon_Cartoon
Space_World
Space_World_06
Space_World_07
Space_World_08
Space_World_09
Space_World_10
Space_World_11
Space_World_12
Space_World_13
Space_World_14
Space_World_15
Space_World_16
Pokemon_Festa
Pokemon_Festa_06
Pokemon_Festa_07
Pokemon_Festa_08
Pokemon_Festa_09
Pokemon_Festa_10
Pokemon_Festa_11
Pokemon_Festa_12
Pokemon_Festa_13
Pokemon_Festa_14
Pokemon_Festa_15
Pokemon_Festa_16
POKePARK
POKePARK_06
POKePARK_07
POKePARK_08
POKePARK_09
POKePARK_10
POKePARK_11
POKePARK_12
POKePARK_13
POKePARK_14
POKePARK_15
POKePARK_16
Pokemon_Center
PC_Tokyo
PC_Osaka
PC_Fukuoka
PC_Nagoya
PC_Sapporo
PC_Yokohama
Nintendo_World
Pokemon_Event
Pokemon_Event_06
Pokemon_Event_07
Pokemon_Event_08
Pokemon_Event_09
Pokemon_Event_10
Pokemon_Event_11
Pokemon_Event_12
Pokemon_Event_13
Pokemon_Event_14
Pokemon_Event_15
Pokemon_Event_16
Wi_Fi_Event
Wi_Fi_Gift
Pokemon_Fan_Club
Event_Site
Concert_Event
End Enum
' Credit: http://bulbapedia.bulbagarden.net/wiki/Ability
Public Enum Abilities As Byte
Cacophony = 0
Stench
Drizzle
Speed_Boost
Battle_Armor
Sturcy
Damp
Limber
Sand_Veil
[Static]
Volt_Absorb
Water_Absorb
Oblivious
Cloud_Nine
Compound_Eyes
Insomnia
Color_Change
Immunity
Flash_Fire
Shield_Dust
Own_Tempo
Suction_Cups
Intimidate
Shadow_Tag
Rough_Skin
Wonder_Guard
Levitate
Effect_Spore
Synchronize
Clear_Body
Natural_Cure
Lightning_Rod
Serene_Grace
Swift_Swim
Chlorophyll
Illuminate
Trace
Huge_Power
Poison_Point
Inner_Focus
Magma_Armor
Water_Veil
Magnet_Pull
Soundproof
Rain_Dish
Sand_Stream
Pressure
Thick_Fat
Early_Bird
Flame_Body
Run_Away
Keen_Eye
Hyper_Cutter
Pickup
Truant
Hustle
Cute_Charm
Plus
Minus
Forecast
Sticky_Hold
Shed_Skin
Guts
Marvel_Scale
Liquid_Ooze
Overgrow
Blaze
Torrent
Swarm
Rock_Head
Drought
Arena_Trap
Vital_Spirit
White_Smoke
Pure_Power
Shell_Armor
Air_Lock
Tangled_Feet
Motor_Drive
Rivalry
Steadfast
Snow_Cloak
Gluttony
Anger_Point
Unburden
Heatproof
Simple
Dry_Skin
Download
Iron_Fist
Poison_Heal
Adaptability
Skill_Link
Hydration
Solar_Power
Quick_Feet
Normalize
Sniper
Magic_Guard
No_Guard
Stall
Technician
Leaf_Guard
Klutz
Mold_Breaker
Super_Luck
Aftermath
Anticipation
Forewarn
Unaware
Tinted_Lens
Filter
Slow_Start
Scrappy
Storm_Drain
Ice_Body
Solid_Rock
Snow_Warning
Honey_Gather
Frisk
Reckless
Multitype
Flower_Gift
Bad_Dreams
End Enum
Public Enum Index_ As UShort
MissingNO = 0
Bulbasaur
Ivysaur
Venusaur
Charmander
Charmeleon
Charizard
Squirtle
Wartortle
Blastoise
Caterpie
Metapod
Butterfree
Weedle
Kakuna
Beedrill
Pidgey
Pidgeotto
Pidgeot
Rattata
Raticate
Spearow
Fearow
Ekans
Arbok
Pikachu
Raichu
Sandshrew
Sandslash
Nidoran_F
Nidorina
Nidoqueen
Nidoran_M
Nidorino
Nidoking
Clefairy
Clefable
Vulpix
Ninetales
Jigglypuff
Wigglytuff
Zubat
Golbat
Oddish
Gloom
Vileplume
Paras
Parasect
Venonat
Venomoth
Diglett
Dugtrio
Meowth
Persian
Psyduck
Golduck
Mankey
Primeape
Growlithe
Arcanine
Poliwag
Poliwhirl
Poliwrath
Abra
Kadabra
Alakazam
Machop
Machoke
Machamp
Bellsprout
Weepinbell
Victreebel
Tentacool
Tentacruel
Geodude
Graveler
Golem
Ponyta
Rapidash
Slowpoke
Slowbro
Magnemite
Magneton
Farfetch_d
Doduo
Dodrio
Seel
Dewgong
Grimer
Muk
Shellder
Cloyster
Gastly
Haunter
Gengar
Onix
Drowzee
Hypno
Krabby
Kingler
Voltorb
Electrode
Exeggcute
Exeggutor
Cubone
Marowak
Hitmonlee
Hitmonchan
Lickitung
Koffing
Weezing
Rhyhorn
Rhydon
Chansey
Tangela
Kangaskhan
Horsea
Seadra
Goldeen
Seaking
Staryu
Starmie
Mr_Mime
Scyther
Jynx
Electabuzz
Magmar
Pinsir
Tauros
Magikarp
Gyarados
Lapras
Ditto
Eevee
Vaporeon
Jolteon
Flareon
Porygon
Omanyte
Omastar
Kabuto
Kabutops
Aerodactyl
Snorlax
Articuno
Zapdos
Moltres
Dratini
Dragonair
Dragonite
Mewtwo
Mew
Chikorita
Bayleef
Meganium
Cyndaquil
Quilava
Typhlosion
Totodile
Croconaw
Feraligatr
Sentret
Furret
Hoothoot
Noctowl
Ledyba
Ledian
Spinarak
Ariados
Crobat
Chinchou
Lanturn
Pichu
Cleffa
Igglybuff
Togepi
Togetic
Natu
Xatu
Mareep
Flaaffy
Ampharos
Bellossom
Marill
Azumarill
Sudowoodo
Politoed
Hoppip
Skiploom
Jumpluff
Aipom
Sunkern
Sunflora
Yanma
Wooper
Quagsire
Espeon
Umbreon
Murkrow
Slowking
Misdreavus
Unown
Wobbuffet
Girafarig
Pineco
Forretress
Dunsparce
Gligar
Steelix
Snubbull
Granbull
Qwilfish
Scizor
Shuckle
Heracross
Sneasel
Teddiursa
Ursaring
Slugma
Magcargo
Swinub
Piloswine
Corsola
Remoraid
Octillery
Delibird
Mantine
Skarmory
Houndour
Houndoom
Kingdra
Phanpy
Donphan
Porygon2
Stantler
Smeargle
Tyrogue
Hitmontop
Smoochum
Elekid
Magby
Miltank
Blissey
Raikou
Entei
Suicune
Larvitar
Pupitar
Tyranitar
Lugia
Ho_Oh
Celebi
Treecko
Grovyle
Sceptile
Torchic
Combusken
Blaziken
Mudkip
Marshtomp
Swampert
Poochyena
Mightyena
Zigzagoon
Linoone
Wurmple
Silcoon
Beautifly
Cascoon
Dustox
Lotad
Lombre
Ludicolo
Seedot
Nuzleaf
Shiftry
Taillow
Swellow
Wingull
Pelipper
Ralts
Kirlia
Gardevoir
Surskit
Masquerain
Shroomish
Breloom
Slakoth
Vigoroth
Slaking
Nincada
Ninjask
Shedinja
Whismur
Loudred
Exploud
Makuhita
Hariyama
Azurill
Nosepass
Skitty
Delcatty
Sableye
Mawile
Aron
Lairon
Aggron
Meditite
Medicham
Electrike
Manectric
Plusle
Minun
Volbeat
Illumise
Roselia
Gulpin
Swalot
Carvanha
Sharpedo
Wailmer
Wailord
Numel
Camerupt
Torkoal
Spoink
Grumpig
Spinda
Trapinch
Vibrava
Flygon
Cacnea
Cacturne
Swablu
Altaria
Zangoose
Seviper
Lunatone
Solrock
Barboach
Whiscash
Corphish
Crawdaunt
Baltoy
Claydol
Lileep
Cradily
Anorith
Armaldo
Feebas
Milotic
Castform
Kecleon
Shuppet
Banette
Duskull
Dusclops
Tropius
Chimecho
Absol
Wynaut
Snorunt
Glalie
Spheal
Sealeo
Walrein
Clamperl
Huntail
Gorebyss
Relicanth
Luvdisc
Bagon
Shelgon
Salamence
Beldum
Metang
Metagross
Regirock
Regice
Registeel
Latias
Latios
Kyogre
Groudon
Rayquaza
Jirachi
Deoxys
Turtwig
Grotle
Torterra
Chimchar
Monferno
Infernape
Piplup
Prinplup
Empoleon
Starly
Staravia
Staraptor
Bidoof
Bibarel
Kricketot
Kricketune
Shinx
Luxio
Luxray
Budew
Roserade
Cranidos
Rampardos
Shieldon
Bastiodon
Burmy
Wormadam
Mothim
Combee
Vespiquen
Pachirisu
Buizel
Floatzel
Cherubi
Cherrim
Shellos
Gastrodon
Ambipom
Drifloon
Drifblim
Buneary
Lopunny
Mismagius
Honchkrow
Glameow
Purugly
Chingling
Stunky
Skuntank
Bronzor
Bronzong
Bonsly
Mime_Jr
Happiny
Chatot
Spiritomb
Gible
Gabite
Garchomp
Munchlax
Riolu
Lucario
Hippopotas
Hippowdon
Skorupi
Drapion
Croagunk
Toxicroak
Carnivine
Finneon
Lumineon
Mantyke
Snover
Abomasnow
Weavile
Magnezone
Lickilicky
Rhyperior
Tangrowth
Electivire
Magmortar
Togekiss
Yanmega
Leafeon
Glaceon
Gliscor
Mamoswine
Porygon_Z
Gallade
Probopass
Dusknoir
Froslass
Rotom
Uxie
Mesprit
Azelf
Dialga
Palkia
Heatran
Regigigas
Giratina
Cresselia
Phione
Manaphy
Darkrai
Shaymin
Arceus
End Enum
Public Enum Moves As UShort
[NOTHING] = 0
Pound
Karate_Chop
DoubleSlap
Comet_Punch
Mega_Punch
Pay_Day
Fire_Punch
Ice_Punch
ThunderPunch
Scratch
ViceGrip
Guillotine
Razor_Wind
Swords_Dance
Cut
Gust
Wing_Attack
Whirlwind
Fly
Bind
Slam
Vine_Whip
Stomp
Double_Kick
Mega_Kick
Jump_Kick
Rolling_Kick
Sand_Attack
Headbutt
Horn_Attack
Fury_Attack
Horn_Drill
Tackle
Body_Slam
Wrap
Take_Down
Thrash
Double_Edge
Tail_Whip
Poison_Sting
Twineedle
Pin_Missile
Leer
Bite
Growl
Roar
Sing
Supersonic
SonicBoom
Disable
Acid
Ember
Flamethrower
Mist
Water_Gun
Hydro_Pump
Surf
Ice_Beam
Blizzard
Psybeam
BubbleBeam
Aurora_Beam
Hyper_Beam
Peck
Drill_Peck
Submission
Low_Kick
Counter
Seismic_Toss
Strength
Absorb
Mega_Drain
Leech_Seed
Growth
Razor_Leaf
SolarBeam
PoisonPowder
Stun_Spore
Sleep_Powder
Petal_Dance
String_Shot
Dragon_Rage
Fire_Spin
ThunderShock
Thunderbolt
Thunder_Wave
Thunder
Rock_Throw
Earthquake
Fissure
Dig
Toxic
Confusion
Psychic
Hypnosis
Meditate
Agility
Quick_Attack
Rage
Teleport
Night_Shade
Mimic
Screech
Double_Team
Recover
Harden
Minimize
SmokeScreen
Confuse_Ray
Withdraw
Defense_Curl
Barrier
Light_Screen
Haze
Reflect
Focus_Energy
Bide
Metronome
Mirror_Move
Selfdestruct
Egg_Bomb
Lick
Smog
Sludge
Bone_Club
Fire_Blast
Waterfall
Clamp
Swift
Skull_Bash
Spike_Cannon
Constrict
Amnesia
Kinesis
Softboiled
Hi_Jump_Kick
Glare
Dream_Eater
Poison_Gas
Barrage
Leech_Life
Lovely_Kiss
Sky_Attack
Transform
Bubble
Dizzy_Punch
Spore
Flash
Psywave
Splash
Acid_Armor
Crabhammer
Explosion
Fury_Swipes
Bonemerang
Rest
Rock_Slide
Hyper_Fang
Sharpen
Conversion
Tri_Attack
Super_Fang
Slash
Substitute
Struggle
Sketch
Triple_Kick
Thief
Spider_Web
Mind_Reader
Nightmare
Flame_Wheel
Snore
Curse
Flail
Conversion_2
Aeroblast
Cotton_Spore
Reversal
Spite
Powder_Snow
Protect
Mach_Punch
Scary_Face
Faint_Attack
Sweet_Kiss
Belly_Drum
Sludge_Bomb
Mud_Slap
Octazooka
Spikes
Zap_Cannon
Foresight
Destiny_Bond
Perish_Song
Icy_Wind
Detect
Bone_Rush
Lock_On
Outrage
Sandstorm
Giga_Drain
Endure
Charm
Rollout
False_Swipe
Swagger
Milk_Drink
Spark
Fury_Cutter
Steel_Wing
Mean_Look
Attract
Sleep_Talk
Heal_Bell
[Return]
Present
Frustration
Safeguard
Pain_Split
Sacred_Fire
Magnitude
DynamicPunch
Megahorn
DragonBreath
Baton_Pass
Encore
Pursuit
Rapid_Spin
Sweet_Scent
Iron_Tail
Metal_Claw
Vital_Throw
Morning_Sun
Synthesis
Moonlight
Hidden_Power
Cross_Chop
Twister
Rain_Dance
Sunny_Day
Crunch
Mirror_Coat
Psych_Up
ExtremeSpeed
AncientPower
Shadow_Ball
Future_Sight
Rock_Smash
Whirlpool
Beat_Up
Fake_Out
Uproar
Stockpile
Spit_Up
Swallow
Heat_Wave
Hail
Torment
Flatter
Will_O_Wisp
Memento
Facade
Focus_Punch
SmellingSalt
Follow_Me
Nature_Power
Charge
Taunt
Helping_Hand
Trick
Role_Play
Wish
Assist
Ingrain
Superpower
Magic_Coat
Recycle
Revenge
Brick_Break
Yawn
Knock_Off
Endeavor
Eruption
Skill_Swap
Imprison
Refresh
Grudge
Snatch
Secret_Power
Dive
Arm_Thrust
Camouflage
Tail_Glow
Luster_Purge
Mist_Ball
FeatherDance
Teeter_Dance
Blaze_Kick
Mud_Sport
Ice_Ball
Needle_Arm
Slack_Off
Hyper_Voice
Poison_Fang
Crush_Claw
Blast_Burn
Hydro_Cannon
Meteor_Mash
Astonish
Weather_Ball
Aromatherapy
Fake_Tears
Air_Cutter
Overheat
Odor_Sleuth
Rock_Tomb
Silver_Wind
Metal_Sound
GrassWhistle
Tickle
Cosmic_Power
Water_Spout
Signal_Beam
Shadow_Punch
Extrasensory
Sky_Uppercut
Sand_Tomb
Sheer_Cold
Muddy_Water
Bullet_Seed
Aerial_Ace
Icicle_Spear
Iron_Defense
Block
Howl
Dragon_Claw
Frenzy_Plant
Bulk_Up
Bounce
Mud_Shot
Poison_Tail
Covet
Volt_Tackle
Magical_Leaf
Water_Sport
Calm_Mind
Leaf_Blade
Dragon_Dance
Rock_Blast
Shock_Wave
Water_Pulse
Doom_Desire
Psycho_Boost
Roost
Gravity
Miracle_Eye
Wake_Up_Slap
Hammer_Arm
Gyro_Ball
Healing_Wish
Brine
Natural_Gift
Feint
Pluck
Tailwind
Acupressure
Metal_Burst
U_turn
Close_Combat
Payback
Assurance
Embargo
Fling
Psycho_Shift
Trump_Card
Heal_Block
Wring_Out
Power_Trick
Gastro_Acid
Lucky_Chant
Me_First
Copycat
Power_Swap
Guard_Swap
Punishment
Last_Resort
Worry_Seed
Sucker_Punch
Toxic_Spikes
Heart_Swap
Aqua_Ring
Magnet_Rise
Flare_Blitz
Force_Palm
Aura_Sphere
Rock_Polish
Poison_Jab
Dark_Pulse
Night_Slash
Aqua_Tail
Seed_Bomb
Air_Slash
X_Scissor
Bug_Buzz
Dragon_Pulse
Dragon_Rush
Power_Gem
Drain_Punch
Vacuum_Wave
Focus_Blast
Energy_Ball
Brave_Bird
Earth_Power
Switcheroo
Giga_Impact
Nasty_Plot
Bullet_Punch
Avalanche
Ice_Shard
Shadow_Claw
Thunder_Fang
Ice_Fang
Fire_Fang
Shadow_Sneak
Mud_Bomb
Psycho_Cut
Zen_Headbutt
Mirror_Shot
Flash_Cannon
Rock_Climb
Defog
Trick_Room
Draco_Meteor
Discharge
Lava_Plume
Leaf_Storm
Power_Whip
Rock_Wrecker
Cross_Poison
Gunk_Shot
Iron_Head
Magnet_Bomb
Stone_Edge
Captivate
Stealth_Rock
Grass_Knot
Chatter
Judgment
Bug_Bite
Charge_Beam
Wood_Hammer
Aqua_Jet
Attack_Order
Defend_Order
Heal_Order
Head_Smash
Double_Hit
Roar_of_Time
Spacial_Rend
Lunar_Dance
Crush_Grip
Magma_Storm
Dark_Void
Seed_Flare
Ominous_Wind
Shadow_Force
End Enum
Public Enum Items As UShort
[NOTHING] = 0
Master_Ball
Ultra_Ball
Great_Ball
Poke_Ball
Safari_Ball
Net_Ball
Dive_Ball
Nest_Ball
Repeat_Ball
Timer_Ball
Luxury_Ball
Premier_Ball
Dusk_Ball
Heal_Ball
Quick_Ball
Cherish_Ball
Potion
Antidote
Burn_Heal
Ice_Heal
Awakening
Parlyz_Heal
Full_Restore
Max_Potion
Hyper_Potion
Super_Potion
Full_Heal
Revive
Max_Revive
Fresh_Water
Soda_Pop
Lemonade
Moomoo_Milk
EnergyPowder
Energy_Root
Heal_Powder
Revival_Herb
Ether
Max_Ether
Elixir
Max_Elixir
Lava_Cookie
Berry_Juice
Sacred_Ash
HP_Up
Protein
Iron
Carbos
Calcium
Rare_Candy
PP_Up
Zinc
PP_Max
Old_Gateau
Guard_Spec
Dire_Hit
X_Attack
X_Defend
X_Speed
X_Accuracy
X_Special
X_Sp_Def
Poke_Doll
Fluffy_Tail
Blue_Flute
Yellow_Flute
Red_Flute
Black_Flute
White_Flute
Shoal_Salt
Shoal_Shell
Red_Shard
Blue_Shard
Yellow_Shard
Green_Shard
Super_Repel
Max_Repel
Escape_Rope
Repel
Sun_Stone
Moon_Stone
Fire_Stone
Thunderstone
Water_Stone
Leaf_Stone
TinyMushroom
Big_Mushroom
Pearl
Big_Pearl
Stardust
Star_Piece
Nugget
Heart_Scale
Honey
Growth_Mulch
Damp_Mulch
Stable_Mulch
Gooey_Mulch
Root_Fossil
Claw_Fossil
Helix_Fossil
Dome_Fossil
Old_Amber
Armor_Fossil
Skull_Fossil
Rare_Bone
Shiny_Stone
Dusk_Stone
Dawn_Stone
Oval_Stone
Odd_Keystone
Griseous_Orb
Adamant_Orb = 135
Lustrous_Orb
Grass_Mail
Flame_Mail
Bubble_Mail
Bloom_Mail
Tunnel_Mail
Steel_Mail
Heart_Mail
Snow_Mail
Space_Mail
Air_Mail
Mosaic_Mail
Brick_Mail
Cheri_Berry
Chesto_Berry
Pecha_Berry
Rawst_Berry
Aspear_Berry
Leppa_Berry
Oran_Berry
Persim_Berry
Lum_Berry
Sitrus_Berry
Figy_Berry
Wiki_Berry
Mago_Berry
Aguav_Berry
Iapapa_Berry
Razz_Berry
Bluk_Berry
Nanab_Berry
Wepear_Berry
Pinap_Berry
Pomeg_Berry
Kelpsy_Berry
Qualot_Berry
Hondew_Berry
Grepa_Berry
Tamato_Berry
Cornn_Berry
Magost_Berry
Rabuta_Berry
Nomel_Berry
Spelon_Berry
Pamtre_Berry
Watmel_Berry
Durin_Berry
Belue_Berry
Occa_Berry
Passho_Berry
Wacan_Berry
Rindo_Berry
Yache_Berry
Chople_Berry
Kebia_Berry
Shuca_Berry
Coba_Berry
Payapa_Berry
Tanga_Berry
Charti_Berry
Kasib_Berry
Haban_Berry
Colbur_Berry
Babiri_Berry
Chilan_Berry
Liechi_Berry
Ganlon_Berry
Salac_Berry
Petaya_Berry
Apicot_Berry
Lansat_Berry
Starf_Berry
Enigma_Berry
Micle_Berry
Custap_Berry
Jaboca_Berry
Rowap_Berry
BrightPowder
White_Herb
Macho_Brace
Exp_Share
Quick_Claw
Soothe_Bell
Mental_Herb
Choice_Band
Kings_Rock
SilverPowder
Amulet_Coin
Cleanse_Tag
Soul_Dew
DeepSeaTooth
DeepSeaScale
Smoke_Ball
Everstone
Focus_Band
Lucky_Egg
Scope_Lens
Metal_Coat
Leftovers
Dragon_Scale
Light_Ball
Soft_Sand
Hard_Stone
Miracle_Seed
BlackGlasses
Black_Belt
Magnet
Mystic_Water
Sharp_Beak
Poison_Barb
NeverMeltIce
Spell_Tag
TwistedSpoon
Charcoal
Dragon_Fang
Silk_Scarf
Up_Grade
Shell_Bell
Sea_Incense
Lax_Incense
Lucky_Punch
Metal_Powder
Thick_Club
Stick
Red_Scarf
Blue_Scarf
Pink_Scarf
Green_Scarf
Yellow_Scarf
Wide_Lens
Muscle_Band
Wise_Glasses
Expert_Belt
Light_Clay
Life_Orb
Power_Herb
Toxic_Orb
Flame_Orb
Quick_Powder
Focus_Sash
Zoom_Lens
Metronome
Iron_Ball
Lagging_Tail
Destiny_Knot
Black_Sludge
Icy_Rock
Smooth_Rock
Heat_Rock
Damp_Rock
Grip_Claw
Choice_Scarf
Sticky_Barb
Power_Bracer
Power_Belt
Power_Lens
Power_Band
Power_Anklet
Power_Weight
Shed_Shell
Big_Root
Choice_Specs
Flame_Plate
Splash_Plate
Zap_Plate
Meadow_Plate
Icicle_Plate
Fist_Plate
Toxic_Plate
Earth_Plate
Sky_Plate
Mind_Plate
Insect_Plate
Stone_Plate
Spooky_Plate
Draco_Plate
Dread_Plate
Iron_Plate
Odd_Incense
Rock_Incense
Full_Incense
Wave_Incense
Rose_Incense
Luck_Incense
Pure_Incense
Protector
Electirizer
Magmarizer
Dubious_Disc
Reaper_Cloth
Razor_Claw
Razor_Fang
TM01
TM02
TM03
TM04
TM05
TM06
TM07
TM08
TM09
TM10
TM11
TM12
TM13
TM14
TM15
TM16
TM17
TM18
TM19
TM20
TM21
TM22
TM23
TM24
TM25
TM26
TM27
TM28
TM29
TM30
TM31
TM32
TM33
TM34
TM35
TM36
TM37
TM38
TM39
TM40
TM41
TM42
TM43
TM44
TM45
TM46
TM47
TM48
TM49
TM50
TM51
TM52
TM53
TM54
TM55
TM56
TM57
TM58
TM59
TM60
TM61
TM62
TM63
TM64
TM65
TM66
TM67
TM68
TM69
TM70
TM71
TM72
TM73
TM74
TM75
TM76
TM77
TM78
TM79
TM80
TM81
TM82
TM83
TM84
TM85
TM86
TM87
TM88
TM89
TM90
TM91
TM92
HM01
HM02
HM03
HM04
HM05
HM06
HM07
HM08
Explorer_Kit = 428
Loot_Sack
Rule_Book
Poke_Radar
Point_Card
Journal
Seal_Case
Fashion_Case
Seal_Bag
Pal_Pad
Works_Key
Old_Charm
Galactic_Key
Red_Chain
Town_Map
Vs_Seeker
Coin_Case
Old_Rod
Good_Rod
Super_Rod
Sprayduck
Poffin_Case
Bicycle
Suite_Key
Oaks_Letter
Lunar_Wing
Member_Card
Azure_Flute
SS_Ticket
Contest_Pass
Magma_Stone
Parcel
Coupon_1
Coupon_2
Coupon_3
Storage_Key
SecretPotion
Vs_Recorder
Gracidea
Secret_Key
Apricorn_Box
Unown_Report
Berry_Pots
Dowsing_MCHN
Blue_Card
SlowpokeTail
Clear_Bell
Card_Key
Basement_Key
Squirtbottle
Red_Scale
Lost_Item
Pass
Machine_Part
Silver_Wing
Rainbow_Wing
Mystery_Egg
Red_Apricorn
Ylw_Apricorn
Blu_Apricorn
Grn_Apricorn
Pnk_Apricorn
Wht_Apricorn
Blk_Apricorn
Fast_Ball
Level_Ball
Lure_Ball
Heavy_Ball
Love_Ball
Friend_Ball
Moon_Ball
Sport_Ball
Park_Ball
Photo_Album
GB_Sounds
Tidal_Bell
RageCandyBar
Data_Card_01
Data_Card_02
Data_Card_03
Data_Card_04
Data_Card_05
Data_Card_06
Data_Card_07
Data_Card_08
Data_Card_09
Data_Card_10
Data_Card_11
Data_Card_12
Data_Card_13
Data_Card_14
Data_Card_15
Data_Card_16
Data_Card_17
Data_Card_18
Data_Card_19
Data_Card_20
Data_Card_21
Data_Card_22
Data_Card_23
Data_Card_24
Data_Card_25
Data_Card_26
Data_Card_27
Jade_Orb
Lock_Capsule
Red_Orb
Blue_Orb
Enigma_Stone
End Enum
#End Region
Public Class Johto_Kanto
Public Enum Gender
Male = 0
Female = 1
Genderless = 2
End Enum
#Region "Pokewalker"
Public Enum Pokewalker_Routes As Byte
Refreshing_Field = 0
Noisy_Forest
Rugged_Road
Beautiful_Beach
Suburban_Area
Dim_Cave
Blue_Lake
Town_Outskirts
Hoenn_Field
Warm_Beach
Volcano_Path
Treehouse
Scary_Cave
Sinnoh_Field
Icy_Mountain_Rd
Big_Forest
White_Lake
Stormy_Beach
Resort
Quiet_Cave
Beyond_the_Sea = &HF9
Night_Skys_Edge = &HFA
Yellow_Forest = &HFB
Rally = &HFC
Sightseeing = &HFD
Winners_Path = &HFE
Amity_Meadow = &HFF
End Enum
Public Enum Pokewalker_Rarity
Very_Common = 0
Common
Uncommon
Rare
Very_Rare
End Enum
Public Enum Pokewalker_Category
C = 0
B
A
End Enum
Public Structure Pokewalker
Public Group As Pokewalker_Category
Public Index As Index_
Public Level As Byte
Public Steps As UShort
Public Rarity As Pokewalker_Rarity
Public Item As Items
Public Move_1 As Moves
Public Move_2 As Moves
Public Move_3 As Moves
Public Move_4 As Moves
Public Location As Pokewalker_Routes
Public Gender_ As Gender
Public Sub New(_Grp As Pokewalker_Category, _Index As Index_, _Lvl As Byte,
_Stps As UShort, _Rare As Pokewalker_Rarity, _Item As Items,
_M1 As Moves, _M2 As Moves, _M3 As Moves, _M4 As Moves,
_Location As Pokewalker_Routes, _Gen As Gender)
Group = _Grp
Index = _Index
Level = _Lvl
Steps = _Stps
Rarity = _Rare
Item = _Item
Move_1 = _M1
Move_2 = _M2
Move_3 = _M3
Move_4 = _M4
Location = _Location
Gender_ = _Gen
End Sub
End Structure
Public Encounter_Pokewalker As New List(Of Pokewalker)
Private Pokewalker_Added As Boolean = False
Public Sub Add_Pokewalker()
If Pokewalker_Added = True Then Exit Sub
' Before National Pokedex
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Kangaskhan, 8, 3000, Pokewalker_Rarity.Uncommon, Items.NOTHING, Moves.Comet_Punch, Moves.Leer, Moves.Fake_Out, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Doduo, 8, 2000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Peck, Moves.Growl, Moves.Quick_Attack, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Nidoran_F, 5, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Growl, Moves.Scratch, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Nidoran_M, 5, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Leer, Moves.Peck, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Pidgey, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Sand_Attack, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Sentret, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Scratch, Moves.Foresight, Moves.Defense_Curl, Moves.NOTHING, Pokewalker_Routes.Refreshing_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Wobbuffet, 15, 4000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Counter, Moves.Mirror_Coat, Moves.Safeguard, Moves.Destiny_Bond, Pokewalker_Routes.Noisy_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Bellsprout, 8, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Vine_Whip, Moves.Growth, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Noisy_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Paras, 6, 700, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Scratch, Moves.Stun_Spore, Moves.PoisonPowder, Moves.NOTHING, Pokewalker_Routes.Noisy_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Venonat, 6, 700, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Disable, Moves.Foresight, Moves.Supersonic, Pokewalker_Routes.Noisy_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Spearow, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Peck, Moves.Growl, Moves.Leer, Moves.NOTHING, Pokewalker_Routes.Noisy_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Oddish, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Absorb, Moves.Sweet_Kiss, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Noisy_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Onix, 9, 4000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Harden, Moves.Bind, Moves.Screech, Moves.Rock_Throw, Pokewalker_Routes.Rugged_Road, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Magby, 9, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Smog, Moves.Leer, Moves.Ember, Moves.Sunny_Day, Pokewalker_Routes.Rugged_Road, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Machop, 7, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Low_Kick, Moves.Leer, Moves.Focus_Energy, Moves.NOTHING, Pokewalker_Routes.Rugged_Road, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Ponyta, 7, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Growl, Moves.Tackle, Moves.Tail_Whip, Moves.NOTHING, Pokewalker_Routes.Rugged_Road, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Geodude, 8, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Defense_Curl, Moves.Mud_Slap, Moves.Rock_Polish, Moves.NOTHING, Pokewalker_Routes.Rugged_Road, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Hoothoot, 6, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Growl, Moves.Foresight, Moves.Hypnosis, Pokewalker_Routes.Rugged_Road, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Magnemite, 11, 4000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Metal_Sound, Moves.Tackle, Moves.ThunderShock, Moves.Supersonic, Pokewalker_Routes.Suburban_Area, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Elekid, 11, 5000, Pokewalker_Rarity.Very_Rare, Items.NOTHING, Moves.Quick_Attack, Moves.Leer, Moves.Low_Kick, Moves.ThunderPunch, Pokewalker_Routes.Suburban_Area, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Magnemite, 8, 10000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Metal_Sound, Moves.Tackle, Moves.ThunderShock, Moves.NOTHING, Pokewalker_Routes.Suburban_Area, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Murkrow, 11, 1000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Peck, Moves.Astonish, Moves.Pursuit, Moves.Haze, Pokewalker_Routes.Suburban_Area, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Rattata, 7, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Tail_Whip, Moves.Quick_Attack, Moves.Focus_Energy, Pokewalker_Routes.Suburban_Area, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Hoothoot, 7, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Growl, Moves.Foresight, Moves.Hypnosis, Pokewalker_Routes.Suburban_Area, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Gastly, 15, 5000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Hypnosis, Moves.Spite, Moves.Curse, Moves.Destiny_Bond, Pokewalker_Routes.Dim_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Smoochum, 12, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Pound, Moves.Lick, Moves.Sweet_Kiss, Moves.Avalanche, Pokewalker_Routes.Dim_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Gastly, 10, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Hypnosis, Moves.Lick, Moves.Spite, Moves.Mean_Look, Pokewalker_Routes.Dim_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Onix, 10, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Harden, Moves.Bind, Moves.Screech, Moves.Rock_Throw, Pokewalker_Routes.Dim_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Zubat, 8, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Leech_Life, Moves.Supersonic, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Dim_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Machop, 8, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Low_Kick, Moves.Leer, Moves.Focus_Energy, Moves.NOTHING, Pokewalker_Routes.Dim_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Poliwag, 15, 4000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Sport, Moves.Hypnosis, Moves.DoubleSlap, Moves.Belly_Drum, Pokewalker_Routes.Blue_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Dratini, 10, 5000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Wrap, Moves.Leer, Moves.Thunder_Wave, Moves.NOTHING, Pokewalker_Routes.Blue_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Shellder, 12, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Withdraw, Moves.Supersonic, Moves.NOTHING, Pokewalker_Routes.Blue_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Krabby, 12, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.ViceGrip, Moves.Leer, Moves.Harden, Moves.Crabhammer, Pokewalker_Routes.Blue_Lake, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Tentacool, 9, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Poison_Sting, Moves.Supersonic, Moves.Constrict, Moves.NOTHING, Pokewalker_Routes.Blue_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Goldeen, 9, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Peck, Moves.Tail_Whip, Moves.Water_Sport, Moves.Supersonic, Pokewalker_Routes.Blue_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Abra, 15, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Teleport, Moves.NOTHING, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Town_Outskirts, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Voltorb, 15, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.SonicBoom, Moves.Spark, Moves.Rollout, Pokewalker_Routes.Town_Outskirts, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Grimer, 13, 1500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Pound, Moves.Harden, Moves.Mud_Slap, Moves.Disable, Pokewalker_Routes.Town_Outskirts, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Koffing, 13, 1500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Smog, Moves.SmokeScreen, Moves.Selfdestruct, Pokewalker_Routes.Town_Outskirts, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Rattata, 16, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Focus_Energy, Moves.Bite, Moves.Pursuit, Moves.Hyper_Fang, Pokewalker_Routes.Town_Outskirts, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Furret, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Foresight, Moves.Defense_Curl, Moves.Quick_Attack, Moves.Fury_Swipes, Pokewalker_Routes.Town_Outskirts, Gender.Male))
' After National Pokedex
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Linoone, 30, 5000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Sand_Attack, Moves.Odor_Sleuth, Moves.Mud_Sport, Moves.Fury_Swipes, Pokewalker_Routes.Hoenn_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Skitty, 30, 7500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Attract, Moves.Assist, Moves.Charm, Moves.Faint_Attack, Pokewalker_Routes.Hoenn_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Volbeat, 25, 2000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Moonlight, Moves.Quick_Attack, Moves.Tail_Glow, Moves.Signal_Beam, Pokewalker_Routes.Hoenn_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Illumise, 25, 2000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Charm, Moves.Moonlight, Moves.Wish, Moves.Encore, Pokewalker_Routes.Hoenn_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Zigzagoon, 17, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tail_Whip, Moves.Headbutt, Moves.Sand_Attack, Moves.Odor_Sleuth, Pokewalker_Routes.Hoenn_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Wurmple, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.String_Shot, Moves.Poison_Sting, Moves.Bug_Bite, Pokewalker_Routes.Hoenn_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Azurill, 20, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Tail_Whip, Moves.Bubble, Moves.Slam, Moves.Water_Gun, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Wailmer, 31, 7000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Water_Pulse, Moves.Mist, Moves.Rest, Moves.Brine, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Horsea, 20, 1500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Leer, Moves.Water_Gun, Moves.Focus_Energy, Moves.BubbleBeam, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Carvanha, 26, 1500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Ice_Fang, Moves.Screech, Moves.Swagger, Moves.Assurance, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Goldeen, 22, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Sport, Moves.Supersonic, Moves.Horn_Attack, Moves.Aqua_Tail, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Magikarp, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Splash, Moves.Tackle, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Warm_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Slugma, 31, 5000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Ember, Moves.Recover, Moves.AncientPower, Moves.Amnesia, Pokewalker_Routes.Volcano_Path, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Meditite, 32, 5000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Feint, Moves.Calm_Mind, Moves.Force_Palm, Moves.Hi_Jump_Kick, Pokewalker_Routes.Volcano_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Rhyhorn, 25, 2000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Stomp, Moves.Fury_Attack, Moves.Scary_Face, Moves.Rock_Blast, Pokewalker_Routes.Volcano_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Houndour, 27, 2000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Roar, Moves.Bite, Moves.Odor_Sleuth, Moves.Beat_Up, Pokewalker_Routes.Volcano_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Geodude, 29, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Selfdestruct, Moves.Rollout, Moves.Rock_Blast, Moves.Earthquake, Pokewalker_Routes.Volcano_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Ponyta, 19, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tail_Whip, Moves.Ember, Moves.Flame_Wheel, Moves.Stomp, Pokewalker_Routes.Volcano_Path, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Castform, 30, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Rain_Dance, Moves.Sunny_Day, Moves.Hail, Moves.Weather_Ball, Pokewalker_Routes.Treehouse, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Kecleon, 30, 5000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Feint, Moves.Psybeam, Moves.Shadow_Sneak, Moves.Slash, Pokewalker_Routes.Treehouse, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Girafarig, 28, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Agility, Moves.Psybeam, Moves.Baton_Pass, Moves.Assurance, Pokewalker_Routes.Treehouse, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Stantler, 28, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Hypnosis, Moves.Stomp, Moves.Confuse_Ray, Moves.Calm_Mind, Pokewalker_Routes.Treehouse, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Gloom, 14, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Absorb, Moves.Sweet_Scent, Moves.Acid, Moves.PoisonPowder, Pokewalker_Routes.Treehouse, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Weepinbell, 13, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Vine_Whip, Moves.Growth, Moves.Wrap, Moves.Sleep_Powder, Pokewalker_Routes.Treehouse, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Marowak, 30, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Bonemerang, Moves.Rage, Moves.False_Swipe, Moves.Thrash, Pokewalker_Routes.Scary_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Tauros, 30, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Pursuit, Moves.Rest, Moves.Payback, Moves.Zen_Headbutt, Pokewalker_Routes.Scary_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Golbat, 33, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Wing_Attack, Moves.Confuse_Ray, Moves.Air_Cutter, Moves.Mean_Look, Pokewalker_Routes.Scary_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Natu, 24, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Teleport, Moves.Miracle_Eye, Moves.Me_First, Moves.Confuse_Ray, Pokewalker_Routes.Scary_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Machop, 13, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Leer, Moves.Focus_Energy, Moves.Karate_Chop, Moves.Bullet_Punch, Pokewalker_Routes.Scary_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Gastly, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Mean_Look, Moves.Curse, Moves.Night_Shade, Moves.Spite, Pokewalker_Routes.Scary_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Combee, 30, 7000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Sweet_Scent, Moves.Gust, Moves.Bug_Bite, Moves.NOTHING, Pokewalker_Routes.Sinnoh_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Mime_Jr, 29, 7000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Light_Screen, Moves.Reflect, Moves.Psybeam, Moves.Substitute, Pokewalker_Routes.Sinnoh_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Shinx, 33, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Roar, Moves.Swagger, Moves.Thunder_Fang, Moves.Crunch, Pokewalker_Routes.Sinnoh_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Budew, 30, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Sport, Moves.Stun_Spore, Moves.Mega_Drain, Moves.Worry_Seed, Pokewalker_Routes.Scary_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Bidoof, 113, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Growl, Moves.Defense_Curl, Moves.Rollout, Pokewalker_Routes.Sinnoh_Field, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Kricketot, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Growl, Moves.Bide, Moves.Bug_Bite, Moves.NOTHING, Pokewalker_Routes.Sinnoh_Field, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Snorunt, 28, 10000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Icy_Wind, Moves.Headbutt, Moves.Protect, Moves.Ice_Fang, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Snover, 31, 10000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Wood_Hammer, Moves.Mist, Moves.Ice_Shard, Moves.Ingrain, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Sneasel, 28, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Faint_Attack, Moves.Crush_Claw, Moves.Agility, Moves.Icy_Wind, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Bronzor, 20, 3000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Hypnosis, Moves.Imprison, Moves.Confuse_Ray, Moves.Extrasensory, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Mareep, 15, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Growl, Moves.ThunderShock, Moves.Thunder_Wave, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Swinub, 16, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Mud_Sport, Moves.Powder_Snow, Moves.Mud_Slap, Moves.Endure, Pokewalker_Routes.Icy_Mountain_Rd, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Tropius, 35, 6000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Stomp, Moves.Sweet_Scent, Moves.Whirlwind, Moves.Magical_Leaf, Pokewalker_Routes.Big_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Bonsly, 30, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Mimic, Moves.Block, Moves.Faint_Attack, Moves.Rock_Tomb, Pokewalker_Routes.Big_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Tangela, 30, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Vine_Whip, Moves.Bind, Moves.Mega_Drain, Moves.Stun_Spore, Pokewalker_Routes.Big_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Bibarel, 30, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Gun, Moves.Headbutt, Moves.Hyper_Fang, Moves.Yawn, Pokewalker_Routes.Big_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Exeggcute, 17, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Hypnosis, Moves.Reflect, Moves.Leech_Seed, Moves.Bullet_Seed, Pokewalker_Routes.Big_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Mareep, 19, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Growl, Moves.ThunderShock, Moves.Thunder_Wave, Moves.Cotton_Spore, Pokewalker_Routes.Big_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Misdreavus, 32, 6000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Destiny_Bond, Moves.Psybeam, Moves.Pain_Split, Moves.Payback, Pokewalker_Routes.White_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Chingling, 22, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Astonish, Moves.Recover, Moves.Uproar, Moves.Last_Resort, Pokewalker_Routes.White_Lake, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Haunter, 25, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Night_Shade, Moves.Confuse_Ray, Moves.Sucker_Punch, Moves.Shadow_Punch, Pokewalker_Routes.White_Lake, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Buizel, 28, 1000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Pursuit, Moves.Swift, Moves.Aqua_Jet, Moves.Baton_Pass, Pokewalker_Routes.White_Lake, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Chinchou, 17, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Thunder_Wave, Moves.Flail, Moves.Water_Gun, Moves.Confuse_Ray, Pokewalker_Routes.White_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Remoraid, 19, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Lock_On, Moves.Psybeam, Moves.Aurora_Beam, Moves.BubbleBeam, Pokewalker_Routes.White_Lake, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Shellos, 30, 5000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Mud_Bomb, Moves.Mirror_Coat, Moves.Rain_Dance, Moves.Body_Slam, Pokewalker_Routes.Stormy_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Finneon, 26, 4000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Rain_Dance, Moves.Gust, Moves.Water_Pulse, Moves.Captivate, Pokewalker_Routes.Stormy_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Seel, 27, 1500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Encore, Moves.Rest, Moves.Aqua_Ring, Moves.Aurora_Beam, Pokewalker_Routes.Stormy_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Magikarp, 30, 500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Splash, Moves.Tackle, Moves.Flail, Moves.Bounce, Pokewalker_Routes.Stormy_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Psyduck, 22, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Ice_Punch, Moves.Disable, Moves.Confusion, Moves.Yawn, Pokewalker_Routes.Stormy_Beach, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Shellder, 20, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Supersonic, Moves.Icicle_Spear, Moves.Protect, Moves.Leer, Pokewalker_Routes.Stormy_Beach, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Pikachu, 30, 8000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Double_Team, Moves.Slam, Moves.Thunderbolt, Moves.Feint, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Pachirisu, 33, 8000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Flail, Moves.Sweet_Kiss, Moves.Discharge, Moves.Super_Fang, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Clefairy, 31, 4000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Wake_Up_Slap, Moves.Cosmic_Power, Moves.Lucky_Chant, Moves.Metronome, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Jigglypuff, 30, 4000, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Rollout, Moves.DoubleSlap, Moves.Rest, Moves.Body_Slam, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Marill, 25, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Gun, Moves.Rollout, Moves.BubbleBeam, Moves.Aqua_Ring, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Hoppip, 25, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Sleep_Powder, Moves.Bullet_Seed, Moves.Leech_Seed, Moves.Mega_Drain, Pokewalker_Routes.Resort, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Spiritomb, 31, 10000, Pokewalker_Rarity.Very_Rare, Items.NOTHING, Moves.Hypnosis, Moves.Dream_Eater, Moves.Ominous_Wind, Moves.Sucker_Punch, Pokewalker_Routes.Quiet_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Munchlax, 33, 10000, Pokewalker_Rarity.Very_Rare, Items.NOTHING, Moves.Screech, Moves.Stockpile, Moves.Swallow, Moves.Body_Slam, Pokewalker_Routes.Quiet_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Feebas, 30, 500, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Splash, Moves.Tackle, Moves.Flail, Moves.NOTHING, Pokewalker_Routes.Quiet_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Chingling, 26, 500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Astonish, Moves.Confusion, Moves.Uproar, Moves.Last_Resort, Pokewalker_Routes.Quiet_Cave, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Golbat, 33, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Wing_Attack, Moves.Confuse_Ray, Moves.Air_Cutter, Moves.Mean_Look, Pokewalker_Routes.Quiet_Cave, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Noctowl, 30, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Hypnosis, Moves.Reflect, Moves.Confusion, Moves.Take_Down, Pokewalker_Routes.Quiet_Cave, Gender.Female))
' Special
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Staryu, 18, 5000, Pokewalker_Rarity.Rare, Items.Water_Stone, Moves.Water_Gun, Moves.Rapid_Spin, Moves.Recover, Moves.Light_Screen, Pokewalker_Routes.Beyond_the_Sea, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Octillery, 19, 5000, Pokewalker_Rarity.Very_Rare, Items.Focus_Band, Moves.Psybeam, Moves.Aurora_Beam, Moves.BubbleBeam, Moves.Signal_Beam, Pokewalker_Routes.Beyond_the_Sea, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Horsea, 15, 2500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.SmokeScreen, Moves.Leer, Moves.Water_Gun, Moves.Focus_Energy, Pokewalker_Routes.Beyond_the_Sea, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Corsola, 16, 2500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Harden, Moves.Bubble, Moves.Recover, Moves.Refresh, Pokewalker_Routes.Beyond_the_Sea, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Chinchou, 12, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Supersonic, Moves.Thunder_Wave, Moves.Flail, Moves.Water_Gun, Pokewalker_Routes.Beyond_the_Sea, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Remoraid, 14, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Water_Gun, Moves.Lock_On, Moves.Psybeam, Moves.Aurora_Beam, Pokewalker_Routes.Beyond_the_Sea, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Clefairy, 8, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Pound, Moves.Encore, Moves.Sing, Moves.Moonlight, Pokewalker_Routes.Night_Skys_Edge, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Jigglypuff, 10, 5000, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Sing, Moves.Defense_Curl, Moves.Pound, Moves.NOTHING, Pokewalker_Routes.Night_Skys_Edge, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Zubat, 9, 2500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Leech_Life, Moves.Supersonic, Moves.Astonish, Moves.NOTHING, Pokewalker_Routes.Night_Skys_Edge, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Hoothoot, 6, 2500, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Growl, Moves.Foresight, Moves.Hypnosis, Pokewalker_Routes.Night_Skys_Edge, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Geodude, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Tackle, Moves.Defense_Curl, Moves.Mud_Sport, Moves.NOTHING, Pokewalker_Routes.Night_Skys_Edge, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Onix, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Mud_Sport, Moves.Tackle, Moves.Harden, Moves.Rock_Throw, Pokewalker_Routes.Night_Skys_Edge, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Pikachu, 15, 10000, Pokewalker_Rarity.Very_Rare, Items.Shuca_Berry, Moves.Fly, Moves.Thunder, Moves.Growl, Moves.Tail_Whip, Pokewalker_Routes.Yellow_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Pikachu, 14, 9500, Pokewalker_Rarity.Very_Rare, Items.Lum_Berry, Moves.Surf, Moves.Thunderbolt, Moves.Thunder_Wave, Moves.Quick_Attack, Pokewalker_Routes.Yellow_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Pikachu, 12, 5000, Pokewalker_Rarity.Very_Rare, Items.Sitrus_Berry, Moves.Volt_Tackle, Moves.Fake_Out, Moves.ThunderShock, Moves.Growl, Pokewalker_Routes.Yellow_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Pikachu, 13, 2000, Pokewalker_Rarity.Rare, Items.Leppa_Berry, Moves.Flail, Moves.Helping_Hand, Moves.Shock_Wave, Moves.Thunder_Wave, Pokewalker_Routes.Yellow_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Pikachu, 10, 0, Pokewalker_Rarity.Very_Common, Items.TinyMushroom, Moves.ThunderShock, Moves.Growl, Moves.Tail_Whip, Moves.Thunder_Wave, Pokewalker_Routes.Yellow_Forest, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Pikachu, 10, 0, Pokewalker_Rarity.Very_Common, Items.Oran_Berry, Moves.ThunderShock, Moves.Growl, Moves.Tail_Whip, Moves.NOTHING, Pokewalker_Routes.Yellow_Forest, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Sableye, 15, 1000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Foresight, Moves.Night_Shade, Moves.Astonish, Moves.Fury_Swipes, Pokewalker_Routes.Rally, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Chatot, 15, 1000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Peck, Moves.Growl, Moves.Mirror_Move, Moves.Sing, Pokewalker_Routes.Rally, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Pikachu, 10, 500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.ThunderShock, Moves.Growl, Moves.Tail_Whip, Moves.Thunder_Wave, Pokewalker_Routes.Rally, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Croagunk, 10, 500, Pokewalker_Rarity.Common, Items.NOTHING, Moves.Astonish, Moves.Mud_Slap, Moves.Poison_Sting, Moves.Taunt, Pokewalker_Routes.Rally, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Pachirisu, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Growl, Moves.Bide, Moves.Quick_Attack, Moves.NOTHING, Pokewalker_Routes.Rally, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Buneary, 5, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Splash, Moves.Pound, Moves.Defense_Curl, Moves.Foresight, Pokewalker_Routes.Rally, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Eevee, 10, 7000, Pokewalker_Rarity.Very_Rare, Items.NOTHING, Moves.Tail_Whip, Moves.Tackle, Moves.Helping_Hand, Moves.Sand_Attack, Pokewalker_Routes.Sightseeing, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Torchic, 10, 10000, Pokewalker_Rarity.Very_Rare, Items.NOTHING, Moves.Scratch, Moves.Growl, Moves.Focus_Energy, Moves.Ember, Pokewalker_Routes.Sightseeing, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Poliwhirl, 15, 2000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Bubble, Moves.Hypnosis, Moves.Water_Gun, Moves.DoubleSlap, Pokewalker_Routes.Sightseeing, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Pelipper, 15, 3000, Pokewalker_Rarity.Rare, Items.NOTHING, Moves.Water_Sport, Moves.Wing_Attack, Moves.Supersonic, Moves.Water_Gun, Pokewalker_Routes.Sightseeing, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Pikachu, 8, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.ThunderShock, Moves.Growl, Moves.Tail_Whip, Moves.Thunder_Wave, Pokewalker_Routes.Sightseeing, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Meowth, 10, 0, Pokewalker_Rarity.Very_Common, Items.NOTHING, Moves.Scratch, Moves.Growl, Moves.Bite, Moves.Fake_Out, Pokewalker_Routes.Sightseeing, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Beldum, 5, 8000, Pokewalker_Rarity.Rare, Items.Shuca_Berry, Moves.Take_Down, Moves.Zen_Headbutt, Moves.Iron_Head, Moves.Iron_Defense, Pokewalker_Routes.Winners_Path, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Munchlax, 5, 8000, Pokewalker_Rarity.Very_Rare, Items.Leftovers, Moves.Metronome, Moves.Tackle, Moves.Defense_Curl, Moves.Selfdestruct, Pokewalker_Routes.Winners_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Horsea, 5, 3000, Pokewalker_Rarity.Common, Items.Dragon_Scale, Moves.Bubble, Moves.SmokeScreen, Moves.Muddy_Water, Moves.NOTHING, Pokewalker_Routes.Winners_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Duskull, 5, 3000, Pokewalker_Rarity.Common, Items.Reaper_Cloth, Moves.Leer, Moves.Night_Shade, Moves.Imprison, Moves.NOTHING, Pokewalker_Routes.Winners_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Magikarp, 5, 0, Pokewalker_Rarity.Very_Common, Items.Wacan_Berry, Moves.Splash, Moves.Bounce, Moves.NOTHING, Moves.NOTHING, Pokewalker_Routes.Winners_Path, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Bronzor, 5, 0, Pokewalker_Rarity.Very_Common, Items.Occa_Berry, Moves.Tackle, Moves.Confusion, Moves.Trick_Room, Moves.NOTHING, Pokewalker_Routes.Winners_Path, Gender.Genderless))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Elekid, 5, 5000, Pokewalker_Rarity.Rare, Items.Tamato_Berry, Moves.Quick_Attack, Moves.Leer, Moves.ThunderPunch, Moves.NOTHING, Pokewalker_Routes.Amity_Meadow, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.A, Index_.Magby, 5, 5000, Pokewalker_Rarity.Rare, Items.Kelpsy_Berry, Moves.Smog, Moves.Leer, Moves.Fire_Punch, Moves.NOTHING, Pokewalker_Routes.Amity_Meadow, Gender.Male))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Smoochum, 5, 2000, Pokewalker_Rarity.Common, Items.Hondew_Berry, Moves.Pound, Moves.Lick, Moves.Ice_Punch, Moves.NOTHING, Pokewalker_Routes.Amity_Meadow, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.B, Index_.Happiny, 5, 2000, Pokewalker_Rarity.Common, Items.Pomeg_Berry, Moves.Pound, Moves.Charm, Moves.Copycat, Moves.Heal_Bell, Pokewalker_Routes.Amity_Meadow, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Cleffa, 5, 0, Pokewalker_Rarity.Very_Common, Items.Qualot_Berry, Moves.Pound, Moves.Charm, Moves.Encore, Moves.Metronome, Pokewalker_Routes.Amity_Meadow, Gender.Female))
Encounter_Pokewalker.Add(New Pokewalker(Pokewalker_Category.C, Index_.Igglybuff, 5, 0, Pokewalker_Rarity.Very_Common, Items.Grepa_Berry, Moves.Sing, Moves.Charm, Moves.Defense_Curl, Moves.Wish, Pokewalker_Routes.Amity_Meadow, Gender.Male))
Pokewalker_Added = True
End Sub
''' <summary>
''' Create a special Pokewalker PID(Pokemon IDentification number) based on a Pokemon's information.
''' </summary>
''' <param name="Nature"></param>
''' <param name="TID">Trainer ID</param>
''' <param name="SID">Secret Trainer ID</param>
''' <param name="Gender_">Male or female</param>
''' <param name="Species">Species of Pokemon</param>
''' <param name="AbilityNum">0 or 1</param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Pokewalker_PID(ByVal Nature As Byte,
ByVal TID As UShort,
ByVal SID As UShort,
ByVal Gender_ As Gender,
ByVal Species As UShort,
ByVal AbilityNum As Byte) As UInteger ' Credit to Wichu
Dim NewPID As UInteger = 0
NewPID = (((TID Xor SID) >> 8) Xor &HFF) << 24
Dim _Nature As SByte = Nature - (NewPID Mod 25)
NewPID += _Nature
Dim _Gender As Byte = 0
If Gender_ = Gender.Male Then
_Gender = (((Pokemon.Gender_Rate(Species) - (NewPID And &HFF)) / 25) + 1) * 25
ElseIf Gender_ = Gender.Female Then
_Gender = ((((NewPID And &HFF) - Pokemon.Gender_Rate(Species)) / 25) + 1) * 25
End If
NewPID += _Gender
Dim RandomNum As UShort = 0
While True
RandomNum = Pokemon.GetRandomUInt32()
If RandomNum Mod 24 = Nature And (RandomNum And 1) = AbilityNum Then Exit While
End While
Dim AbilityFix As SByte = 0
If Not (RandomNum And 1) = (NewPID And 1) Then
AbilityFix = -25
Else : AbilityFix = 0
End If
NewPID += AbilityFix
Return NewPID
End Function
#End Region
End Class
Public Class Sinnoh
End Class
Public Class Diamond
End Class
Public Class Pearl
End Class
Public Class Platinum
End Class
Public Class Heart_Gold
' encounters a/0/3/7
Public Structure Encounter
Public Walk_Rate As Byte
Public Surf_Rate As Byte
Public Rock_Smash_Rate As Byte
Public Old_Rod_Rate As Byte
Public Good_Rod_Rate As Byte
Public Super_Rod_Rate As Byte
Public [Padding] As UShort
Public Walk_Level_1 As Byte
Public Walk_Level_2 As Byte
Public Walk_Level_3 As Byte
Public Walk_Level_4 As Byte
Public Walk_Level_5 As Byte
Public Walk_Level_6 As Byte
Public Walk_Level_7 As Byte
Public Walk_Level_8 As Byte
Public Walk_Level_9 As Byte
Public Walk_Level_10 As Byte
Public Walk_Level_11 As Byte
Public Walk_Level_12 As Byte
Public Walk_NAT_ID_Morning_1 As UShort
Public Walk_NAT_ID_Morning_2 As UShort
Public Walk_NAT_ID_Morning_3 As UShort
Public Walk_NAT_ID_Morning_4 As UShort
Public Walk_NAT_ID_Morning_5 As UShort
Public Walk_NAT_ID_Morning_6 As UShort
Public Walk_NAT_ID_Morning_7 As UShort
Public Walk_NAT_ID_Morning_8 As UShort
Public Walk_NAT_ID_Morning_9 As UShort
Public Walk_NAT_ID_Morning_10 As UShort
Public Walk_NAT_ID_Morning_11 As UShort
Public Walk_NAT_ID_Morning_12 As UShort
Public Walk_NAT_ID_Day_1 As UShort
Public Walk_NAT_ID_Day_2 As UShort
Public Walk_NAT_ID_Day_3 As UShort
Public Walk_NAT_ID_Day_4 As UShort
Public Walk_NAT_ID_Day_5 As UShort
Public Walk_NAT_ID_Day_6 As UShort
Public Walk_NAT_ID_Day_7 As UShort
Public Walk_NAT_ID_Day_8 As UShort
Public Walk_NAT_ID_Day_9 As UShort
Public Walk_NAT_ID_Day_10 As UShort
Public Walk_NAT_ID_Day_11 As UShort
Public Walk_NAT_ID_Day_12 As UShort
Public Walk_NAT_ID_Night_1 As UShort
Public Walk_NAT_ID_Night_2 As UShort
Public Walk_NAT_ID_Night_3 As UShort
Public Walk_NAT_ID_Night_4 As UShort
Public Walk_NAT_ID_Night_5 As UShort
Public Walk_NAT_ID_Night_6 As UShort
Public Walk_NAT_ID_Night_7 As UShort
Public Walk_NAT_ID_Night_8 As UShort
Public Walk_NAT_ID_Night_9 As UShort
Public Walk_NAT_ID_Night_10 As UShort
Public Walk_NAT_ID_Night_11 As UShort
Public Walk_NAT_ID_Night_12 As UShort
Public Hoenn_NAT_ID_1 As UShort
Public Hoenn_NAT_ID_2 As UShort
Public Sinnoh_NAT_ID_1 As UShort
Public Sinnoh_NAT_ID_2 As UShort
Public Surf_1 As Encounter_Block
Public Surf_2 As Encounter_Block
Public Surf_3 As Encounter_Block
Public Surf_4 As Encounter_Block
Public Surf_5 As Encounter_Block
Public Rock_Smash_1 As Encounter_Block
Public Rock_Smash_2 As Encounter_Block
Public Old_Rod_1 As Encounter_Block
Public Old_Rod_2 As Encounter_Block
Public Old_Rod_3 As Encounter_Block
Public Old_Rod_4 As Encounter_Block
Public Old_Rod_5 As Encounter_Block
Public Good_Rod_1 As Encounter_Block
Public Good_Rod_2 As Encounter_Block
Public Good_Rod_3 As Encounter_Block
Public Good_Rod_4 As Encounter_Block
Public Good_Rod_5 As Encounter_Block
Public Super_Rod_1 As Encounter_Block
Public Super_Rod_2 As Encounter_Block
Public Super_Rod_3 As Encounter_Block
Public Super_Rod_4 As Encounter_Block
Public Super_Rod_5 As Encounter_Block
Public Radio_NAT_ID_1 As UShort
Public Radio_NAT_ID_2 As UShort
End Structure
Public Structure Encounter_Block
Public Min_Level As Byte
Public Max_Level As Byte
Public NAT_ID As UShort
Public Sub New(ByVal Data As Byte())
Min_Level = Data(0)
Max_Level = Data(1)
NAT_ID = BitConverter.ToUInt16(Data, 2)
End Sub
End Structure
End Class
Public Class Soul_Silver
' encounter a/0/3/7
Public Structure Encounter
Public Walk_Rate As Byte
Public Surf_Rate As Byte
Public Rock_Smash_Rate As Byte
Public Old_Rod_Rate As Byte
Public Good_Rod_Rate As Byte
Public Super_Rod_Rate As Byte
Public [Padding] As UShort
Public Walk_Level_1 As Byte
Public Walk_Level_2 As Byte
Public Walk_Level_3 As Byte
Public Walk_Level_4 As Byte
Public Walk_Level_5 As Byte
Public Walk_Level_6 As Byte
Public Walk_Level_7 As Byte
Public Walk_Level_8 As Byte
Public Walk_Level_9 As Byte
Public Walk_Level_10 As Byte
Public Walk_Level_11 As Byte
Public Walk_Level_12 As Byte
Public Walk_NAT_ID_Morning_1 As UShort
Public Walk_NAT_ID_Morning_2 As UShort
Public Walk_NAT_ID_Morning_3 As UShort
Public Walk_NAT_ID_Morning_4 As UShort
Public Walk_NAT_ID_Morning_5 As UShort
Public Walk_NAT_ID_Morning_6 As UShort
Public Walk_NAT_ID_Morning_7 As UShort
Public Walk_NAT_ID_Morning_8 As UShort
Public Walk_NAT_ID_Morning_9 As UShort
Public Walk_NAT_ID_Morning_10 As UShort
Public Walk_NAT_ID_Morning_11 As UShort
Public Walk_NAT_ID_Morning_12 As UShort
Public Walk_NAT_ID_Day_1 As UShort
Public Walk_NAT_ID_Day_2 As UShort
Public Walk_NAT_ID_Day_3 As UShort
Public Walk_NAT_ID_Day_4 As UShort
Public Walk_NAT_ID_Day_5 As UShort
Public Walk_NAT_ID_Day_6 As UShort
Public Walk_NAT_ID_Day_7 As UShort
Public Walk_NAT_ID_Day_8 As UShort
Public Walk_NAT_ID_Day_9 As UShort
Public Walk_NAT_ID_Day_10 As UShort
Public Walk_NAT_ID_Day_11 As UShort
Public Walk_NAT_ID_Day_12 As UShort
Public Walk_NAT_ID_Night_1 As UShort
Public Walk_NAT_ID_Night_2 As UShort
Public Walk_NAT_ID_Night_3 As UShort
Public Walk_NAT_ID_Night_4 As UShort
Public Walk_NAT_ID_Night_5 As UShort
Public Walk_NAT_ID_Night_6 As UShort
Public Walk_NAT_ID_Night_7 As UShort
Public Walk_NAT_ID_Night_8 As UShort
Public Walk_NAT_ID_Night_9 As UShort
Public Walk_NAT_ID_Night_10 As UShort
Public Walk_NAT_ID_Night_11 As UShort
Public Walk_NAT_ID_Night_12 As UShort
Public Hoenn_NAT_ID_1 As UShort
Public Hoenn_NAT_ID_2 As UShort
Public Sinnoh_NAT_ID_1 As UShort
Public Sinnoh_NAT_ID_2 As UShort
Public Surf_1 As Encounter_Block
Public Surf_2 As Encounter_Block
Public Surf_3 As Encounter_Block
Public Surf_4 As Encounter_Block
Public Surf_5 As Encounter_Block
Public Rock_Smash_1 As Encounter_Block
Public Rock_Smash_2 As Encounter_Block
Public Old_Rod_1 As Encounter_Block
Public Old_Rod_2 As Encounter_Block
Public Old_Rod_3 As Encounter_Block
Public Old_Rod_4 As Encounter_Block
Public Old_Rod_5 As Encounter_Block
Public Good_Rod_1 As Encounter_Block
Public Good_Rod_2 As Encounter_Block
Public Good_Rod_3 As Encounter_Block
Public Good_Rod_4 As Encounter_Block
Public Good_Rod_5 As Encounter_Block
Public Super_Rod_1 As Encounter_Block
Public Super_Rod_2 As Encounter_Block
Public Super_Rod_3 As Encounter_Block
Public Super_Rod_4 As Encounter_Block
Public Super_Rod_5 As Encounter_Block
Public Radio_NAT_ID_1 As UShort
Public Radio_NAT_ID_2 As UShort
End Structure
Public Structure Encounter_Block
Public Min_Level As Byte
Public Max_Level As Byte
Public NAT_ID As UShort
Public Sub New(ByVal Data As Byte())
Min_Level = Data(0)
Max_Level = Data(1)
NAT_ID = BitConverter.ToUInt16(Data, 2)
End Sub
End Structure
End Class
Public Class My_Pokemon_Ranch
Public OT_English As String = "Hayley"
Public OT_Japanese As String = "ユカリ"
Public OT_French As String = "EULALIE"
Public OT_German As String = "EUKALIA"
Public OT_Italian As String = "GIULIA"
Public OT_Spanish As String = "EULALIA"
Public OT_ID As UShort = 1000
Public Enum Moves As UShort
[NOTHING]
Pound
Karate_Chop
DoubleSlap
Comet_Punch
Mega_Punch
Pay_Day
Fire_Punch
Ice_Punch
ThunderPunch
Scratch
ViceGrip
Guillotine
Razor_Wind
Swords_Dance
Cut
Gust
Wing_Attack
Whirlwind
Fly
Bind
Slam
Vine_Whip
Stomp
Double_Kick
Mega_Kick
Jump_Kick
Rolling_Kick
Sand_Attack
Headbutt
Horn_Attack
Fury_Attack
Horn_Drill
Tackle
Body_Slam
Wrap
Take_Down
Thrash
Double_Edge
Tail_Whip
Poison_Sting
Twineedle
Pin_Missile
Leer
Bite
Growl
Roar
Sing
Supersonic
SonicBoom
Disable
Acid
Ember
Flamethrower
Mist
Water_Gun
Hydro_Pump
Surf
Ice_Beam
Blizzard
Psybeam
BubbleBeam
Aurora_Beam
Hyper_Beam
Peck
Drill_Peck
Submission
Low_Kick
Counter
Seismic_Toss
Strength
Absorb
Mega_Drain
Leech_Seed
Growth
Razor_Leaf
SolarBeam
PoisonPowder
Stun_Spore
Sleep_Powder
Petal_Dance
String_Shot
Dragon_Rage
Fire_Spin
ThunderShock
Thunderbolt
Thunder_Wave
Thunder
Rock_Throw
Earthquake
Fissure
Dig
Toxic
Confusion
Psychic
Hypnosis
Meditate
Agility
Quick_Attack
Rage
Teleport
Night_Shade
Mimic
Screech
Double_Team
Recover
Harden
Minimize
SmokeScreen
Confuse_Ray
Withdraw
Defense_Curl
Barrier
Light_Screen
Haze
Reflect
Focus_Energy
Bide
Metronome
Mirror_Move
Selfdestruct
Egg_Bomb
Lick
Smog
Sludge
Bone_Club
Fire_Blast
Waterfall
Clamp
Swift
Skull_Bash
Spike_Cannon
Constrict
Amnesia
Kinesis
Softboiled
Hi_Jump_Kick
Glare
Dream_Eater
Poison_Gas
Barrage
Leech_Life
Lovely_Kiss
Sky_Attack
Transform
Bubble
Dizzy_Punch
Spore
Flash
Psywave
Splash
Acid_Armor
Crabhammer
Explosion
Fury_Swipes
Bonemerang
Rest
Rock_Slide
Hyper_Fang
Sharpen
Conversion
Tri_Attack
Super_Fang
Slash
Substitute
Struggle
Sketch
Triple_Kick
Thief
Spider_Web
Mind_Reader
Nightmare
Flame_Wheel
Snore
Curse
Flail
Conversion_2
Aeroblast
Cotton_Spore
Reversal
Spite
Powder_Snow
Protect
Mach_Punch
Scary_Face
Faint_Attack
Sweet_Kiss
Belly_Drum
Sludge_Bomb
Mud_Slap
Octazooka
Spikes
Zap_Cannon
Foresight
Destiny_Bond
Perish_Song
Icy_Wind
Detect
Bone_Rush
Lock_On
Outrage
Sandstorm
Giga_Drain
Endure
Charm
Rollout
False_Swipe
Swagger
Milk_Drink
Spark
Fury_Cutter
Steel_Wing
Mean_Look
Attract
Sleep_Talk
Heal_Bell
[Return]
Present
Frustration
Safeguard
Pain_Split
Sacred_Fire
Magnitude
DynamicPunch
Megahorn
DragonBreath
Baton_Pass
Encore
Pursuit
Rapid_Spin
Sweet_Scent
Iron_Tail
Metal_Claw
Vital_Throw
Morning_Sun
Synthesis
Moonlight
Hidden_Power
Cross_Chop
Twister
Rain_Dance
Sunny_Day
Crunch
Mirror_Coat
Psych_Up
ExtremeSpeed
AncientPower
Shadow_Ball
Future_Sight
Rock_Smash
Whirlpool
Beat_Up
Fake_Out
Uproar
Stockpile
Spit_Up
Swallow
Heat_Wave
Hail
Torment
Flatter
Will_O_Wisp
Memento
Facade
Focus_Punch
SmellingSalt
Follow_Me
Nature_Power
Charge
Taunt
Helping_Hand
Trick
Role_Play
Wish
Assist
Ingrain
Superpower
Magic_Coat
Recycle
Revenge
Brick_Break
Yawn
Knock_Off
Endeavor
Eruption
Skill_Swap
Imprison
Refresh
Grudge
Snatch
Secret_Power
Dive
Arm_Thrust
Camouflage
Tail_Glow
Luster_Purge
Mist_Ball
FeatherDance
Teeter_Dance
Blaze_Kick
Mud_Sport
Ice_Ball
Needle_Arm
Slack_Off
Hyper_Voice
Poison_Fang
Crush_Claw
Blast_Burn
Hydro_Cannon
Meteor_Mash
Astonish
Weather_Ball
Aromatherapy
Fake_Tears
Air_Cutter
Overheat
Odor_Sleuth
Rock_Tomb
Silver_Wind
Metal_Sound
GrassWhistle
Tickle
Cosmic_Power
Water_Spout
Signal_Beam
Shadow_Punch
Extrasensory
Sky_Uppercut
Sand_Tomb
Sheer_Cold
Muddy_Water
Bullet_Seed
Aerial_Ace
Icicle_Spear
Iron_Defense
Block
Howl
Dragon_Claw
Frenzy_Plant
Bulk_Up
Bounce
Mud_Shot
Poison_Tail
Covet
Volt_Tackle
Magical_Leaf
Water_Sport
Calm_Mind
Leaf_Blade
Dragon_Dance
Rock_Blast
Shock_Wave
Water_Pulse
Doom_Desire
Psycho_Boost
Roost
Gravity
Miracle_Eye
Wake_Up_Slap
Hammer_Arm
Gyro_Ball
Healing_Wish
Brine
Natural_Gift
Feint
Pluck
Tailwind
Acupressure
Metal_Burst
U_turn
Close_Combat
Payback
Assurance
Embargo
Fling
Psycho_Shift
Trump_Card
Heal_Block
Wring_Out
Power_Trick
Gastro_Acid
Lucky_Chant
Me_First
Copycat
Power_Swap
Guard_Swap
Punishment
Last_Resort
Worry_Seed
Sucker_Punch
Toxic_Spikes
Heart_Swap
Aqua_Ring
Magnet_Rise
Flare_Blitz
Force_Palm
Aura_Sphere
Rock_Polish
Poison_Jab
Dark_Pulse
Night_Slash
Aqua_Tail
Seed_Bomb
Air_Slash
X_Scissor
Bug_Buzz
Dragon_Pulse
Dragon_Rush
Power_Gem
Drain_Punch
Vacuum_Wave
Focus_Blast
Energy_Ball
Brave_Bird
Earth_Power
Switcheroo
Giga_Impact
Nasty_Plot
Bullet_Punch
Avalanche
Ice_Shard
Shadow_Claw
Thunder_Fang
Ice_Fang
Fire_Fang
Shadow_Sneak
Mud_Bomb
Psycho_Cut
Zen_Headbutt
Mirror_Shot
Flash_Cannon
Rock_Climb
Defog
Trick_Room
Draco_Meteor
Discharge
Lava_Plume
Leaf_Storm
Power_Whip
Rock_Wrecker
Cross_Poison
Gunk_Shot
Iron_Head
Magnet_Bomb
Stone_Edge
Captivate
Stealth_Rock
Grass_Knot
Chatter
Judgment
Bug_Bite
Charge_Beam
Wood_Hammer
Aqua_Jet
Attack_Order
Defend_Order
Heal_Order
Head_Smash
Double_Hit
Roar_of_Time
Spacial_Rend
Lunar_Dance
Crush_Grip
Magma_Storm
Dark_Void
Seed_Flare
Ominous_Wind
Shadow_Force
End Enum
Public Enum Items As UShort
[NOTHING]
Master_Ball
Ultra_Ball
Great_Ball
Poke_Ball
Safari_Ball
Net_Ball
Dive_Ball
Nest_Ball
Repeat_Ball
Timer_Ball
Luxury_Ball
Premier_Ball
Dusk_Ball
Heal_Ball
Quick_Ball
Cherish_Ball
Potion
Antidote
Burn_Heal
Ice_Heal
Awakening
Parlyz_Heal
Full_Restore
Max_Potion
Hyper_Potion
Super_Potion
Full_Heal
Revive
Max_Revive
Fresh_Water
Soda_Pop
Lemonade
Moomoo_Milk
EnergyPowder
Energy_Root
Heal_Powder
Revival_Herb
Ether
Max_Ether
Elixir
Max_Elixir
Lava_Cookie
Berry_Juice
Sacred_Ash
HP_Up
Protein
Iron
Carbos
Calcium
Rare_Candy
PP_Up
Zinc
PP_Max
Old_Gateau
Guard_Spec
Dire_Hit
X_Attack
X_Defend
X_Speed
X_Accuracy
X_Special
X_Sp_Def
Poke_Doll
Fluffy_Tail
Blue_Flute
Yellow_Flute
Red_Flute
Black_Flute
White_Flute
Shoal_Salt
Shoal_Shell
Red_Shard
Blue_Shard
Yellow_Shard
Green_Shard
Super_Repel
Max_Repel
Escape_Rope
Repel
Sun_Stone
Moon_Stone
Fire_Stone
Thunderstone
Water_Stone
Leaf_Stone
TinyMushroom
Big_Mushroom
Pearl
Big_Pearl
Stardust
Star_Piece
Nugget
Heart_Scale
Honey
Growth_Mulch
Damp_Mulch
Stable_Mulch
Gooey_Mulch
Root_Fossil
Claw_Fossil
Helix_Fossil
Dome_Fossil
Old_Amber
Armor_Fossil
Skull_Fossil
Rare_Bone
Shiny_Stone
Dusk_Stone
Dawn_Stone
Oval_Stone
Odd_Keystone
Griseous_Orb
Adamant_Orb = 135
Lustrous_Orb
Grass_Mail
Flame_Mail
Bubble_Mail
Bloom_Mail
Tunnel_Mail
Steel_Mail
Heart_Mail
Snow_Mail
Space_Mail
Air_Mail
Mosaic_Mail
Brick_Mail
Cheri_Berry
Chesto_Berry
Pecha_Berry
Rawst_Berry
Aspear_Berry
Leppa_Berry
Oran_Berry
Persim_Berry
Lum_Berry
Sitrus_Berry
Figy_Berry
Wiki_Berry
Mago_Berry
Aguav_Berry
Iapapa_Berry
Razz_Berry
Bluk_Berry
Nanab_Berry
Wepear_Berry
Pinap_Berry
Pomeg_Berry
Kelpsy_Berry
Qualot_Berry
Hondew_Berry
Grepa_Berry
Tamato_Berry
Cornn_Berry
Magost_Berry
Rabuta_Berry
Nomel_Berry
Spelon_Berry
Pamtre_Berry
Watmel_Berry
Durin_Berry
Belue_Berry
Occa_Berry
Passho_Berry
Wacan_Berry
Rindo_Berry
Yache_Berry
Chople_Berry
Kebia_Berry
Shuca_Berry
Coba_Berry
Payapa_Berry
Tanga_Berry
Charti_Berry
Kasib_Berry
Haban_Berry
Colbur_Berry
Babiri_Berry
Chilan_Berry
Liechi_Berry
Ganlon_Berry
Salac_Berry
Petaya_Berry
Apicot_Berry
Lansat_Berry
Starf_Berry
Enigma_Berry
Micle_Berry
Custap_Berry
Jaboca_Berry
Rowap_Berry
BrightPowder
White_Herb
Macho_Brace
Exp_Share
Quick_Claw
Soothe_Bell
Mental_Herb
Choice_Band
Kings_Rock
SilverPowder
Amulet_Coin
Cleanse_Tag
Soul_Dew
DeepSeaTooth
DeepSeaScale
Smoke_Ball
Everstone
Focus_Band
Lucky_Egg
Scope_Lens
Metal_Coat
Leftovers
Dragon_Scale
Light_Ball
Soft_Sand
Hard_Stone
Miracle_Seed
BlackGlasses
Black_Belt
Magnet
Mystic_Water
Sharp_Beak
Poison_Barb
NeverMeltIce
Spell_Tag
TwistedSpoon
Charcoal
Dragon_Fang
Silk_Scarf
Up_Grade
Shell_Bell
Sea_Incense
Lax_Incense
Lucky_Punch
Metal_Powder
Thick_Club
Stick
Red_Scarf
Blue_Scarf
Pink_Scarf
Green_Scarf
Yellow_Scarf
Wide_Lens
Muscle_Band
Wise_Glasses
Expert_Belt
Light_Clay
Life_Orb
Power_Herb
Toxic_Orb
Flame_Orb
Quick_Powder
Focus_Sash
Zoom_Lens
Metronome
Iron_Ball
Lagging_Tail
Destiny_Knot
Black_Sludge
Icy_Rock
Smooth_Rock
Heat_Rock
Damp_Rock
Grip_Claw
Choice_Scarf
Sticky_Barb
Power_Bracer
Power_Belt
Power_Lens
Power_Band
Power_Anklet
Power_Weight
Shed_Shell
Big_Root
Choice_Specs
Flame_Plate
Splash_Plate
Zap_Plate
Meadow_Plate
Icicle_Plate
Fist_Plate
Toxic_Plate
Earth_Plate
Sky_Plate
Mind_Plate
Insect_Plate
Stone_Plate
Spooky_Plate
Draco_Plate
Dread_Plate
Iron_Plate
Odd_Incense
Rock_Incense
Full_Incense
Wave_Incense
Rose_Incense
Luck_Incense
Pure_Incense
Protector
Electirizer
Magmarizer
Dubious_Disc
Reaper_Cloth
Razor_Claw
Razor_Fang
TM01
TM02
TM03
TM04
TM05
TM06
TM07
TM08
TM09
TM10
TM11
TM12
TM13
TM14
TM15
TM16
TM17
TM18
TM19
TM20
TM21
TM22
TM23
TM24
TM25
TM26
TM27
TM28
TM29
TM30
TM31
TM32
TM33
TM34
TM35
TM36
TM37
TM38
TM39
TM40
TM41
TM42
TM43
TM44
TM45
TM46
TM47
TM48
TM49
TM50
TM51
TM52
TM53
TM54
TM55
TM56
TM57
TM58
TM59
TM60
TM61
TM62
TM63
TM64
TM65
TM66
TM67
TM68
TM69
TM70
TM71
TM72
TM73
TM74
TM75
TM76
TM77
TM78
TM79
TM80
TM81
TM82
TM83
TM84
TM85
TM86
TM87
TM88
TM89
TM90
TM91
TM92
HM01
HM02
HM03
HM04
HM05
HM06
HM07
HM08
Explorer_Kit = 428
Loot_Sack
Rule_Book
Poke_Radar
Point_Card
Journal
Seal_Case
Fashion_Case
Seal_Bag
Pal_Pad
Works_Key
Old_Charm
Galactic_Key
Red_Chain
Town_Map
Vs_Seeker
Coin_Case
Old_Rod
Good_Rod
Super_Rod
Sprayduck
Poffin_Case
Bicycle
Suite_Key
Oaks_Letter
Lunar_Wing
Member_Card
Azure_Flute
SS_Ticket
Contest_Pass
Magma_Stone
Parcel
Coupon_1
Coupon_2
Coupon_3
Storage_Key
SecretPotion
Vs_Recorder
Gracidea
Secret_Key
Apricorn_Box
Unown_Report
Berry_Pots
Dowsing_MCHN
Blue_Card
SlowpokeTail
Clear_Bell
Card_Key
Basement_Key
Squirtbottle
Red_Scale
Lost_Item
Pass
Machine_Part
Silver_Wing
Rainbow_Wing
Mystery_Egg
Red_Apricorn
Ylw_Apricorn
Blu_Apricorn
Grn_Apricorn
Pnk_Apricorn
Wht_Apricorn
Blk_Apricorn
Fast_Ball
Level_Ball
Lure_Ball
Heavy_Ball
Love_Ball
Friend_Ball
Moon_Ball
Sport_Ball
Park_Ball
Photo_Album
GB_Sounds
Tidal_Bell
RageCandyBar
Data_Card_01
Data_Card_02
Data_Card_03
Data_Card_04
Data_Card_05
Data_Card_06
Data_Card_07
Data_Card_08
Data_Card_09
Data_Card_10
Data_Card_11
Data_Card_12
Data_Card_13
Data_Card_14
Data_Card_15
Data_Card_16
Data_Card_17
Data_Card_18
Data_Card_19
Data_Card_20
Data_Card_21
Data_Card_22
Data_Card_23
Data_Card_24
Data_Card_25
Data_Card_26
Data_Card_27
Jade_Orb
Lock_Capsule
Red_Orb
Blue_Orb
Enigma_Stone
End Enum
Public Enum Pokemon_Available
Pikachu = 25
Vulpix = 37
Ponyta = 77
Lickitung = 108
Tangela = 114
Eevee = 133
Aerodactyl = 142
Yanma = 193
Miltank = 241
Shroomish = 285
Wailmer = 320
Wynaut = 360
Staravia = 397
Combee = 415
Pachirisu = 417
Shellos = 422
Buneary = 427
Croagunk = 453
Finneon = 456
Snover = 459
Phione = 489
Mew = 151
End Enum
End Class
Public Class Pokemon
#Region "Gender Rates"
Public Shared Gender_Rate As Byte() = {&HFF, &H1F, &H1F, &H1F, &H1F, &H1F, &H1F, &H1F,
&H1F, &H1F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &HFE, &HFE, &HFE,
&H0, &H0, &H0, &HBF, &HBF, &HBF, &HBF, &HBF, &HBF,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H3F, &H3F, &H7F, &H7F, &H7F, &H3F, &H3F,
&H3F, &H3F, &H3F, &H3F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&HFF, &HFF, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &HFF, &HFF, &H7F, &H7F, &H7F,
&H7F, &H0, &H0, &H7F, &H7F, &H7F, &H7F, &H7F, &HFE,
&H7F, &HFE, &H7F, &H7F, &H7F, &H7F, &HFF, &HFF,
&H7F, &H7F, &HFE, &H3F, &H3F, &H7F, &H0, &H7F, &H7F,
&H7F, &HFF, &H1F, &H1F, &H1F, &H1F, &HFF, &H1F,
&H1F, &H1F, &H1F, &H1F, &H1F, &HFF, &HFF, &HFF,
&H7F, &H7F, &H7F, &HFF, &HFF, &H1F, &H1F, &H1F,
&H1F, &H1F, &H1F, &H1F, &H1F, &H1F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &HBF, &HBF, &H1F, &H1F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H1F, &H1F, &H7F, &H7F, &H7F, &HFF, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &HBF, &HBF,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &HBF, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &HFF, &H7F,
&H7F, &H0, &H0, &HFE, &H3F, &H3F, &HFE, &HFE, &HFF,
&HFF, &HFF, &H7F, &H7F, &H7F, &HFF, &HFF, &HFF,
&H1F, &H1F, &H1F, &H1F, &H1F, &H1F, &H1F, &H1F,
&H1F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&HFF, &H7F, &H7F, &H7F, &H3F, &H3F, &HBF, &H7F,
&HBF, &HBF, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H0, &HFE, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &HFF, &HFF, &H7F, &H7F,
&H7F, &H7F, &HFF, &HFF, &H1F, &H1F, &H1F, &H1F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H1F, &HBF, &H7F, &H7F,
&H7F, &HFF, &HFF, &HFF, &HFF, &HFF, &HFF, &HFE,
&H0, &HFF, &HFF, &HFF, &HFF, &HFF, &H1F, &H1F, &H1F,
&H1F, &H1F, &H1F, &H1F, &H1F, &H1F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H1F, &H1F, &H1F, &H1F, &H7F, &HFE,
&H0, &H1F, &HFE, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&HBF, &HBF, &H7F, &H7F, &H7F, &HFF, &HFF, &H7F,
&H7F, &HFE, &H7F, &H7F, &H7F, &H7F, &H7F, &H1F,
&H1F, &H1F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F,
&H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &H7F, &HFF,
&H7F, &H7F, &H7F, &H3F, &H3F, &H1F, &H7F, &H1F,
&H1F, &H7F, &H7F, &HFF, &H0, &H7F, &H7F, &HFE, &HFF,
&HFF, &HFF, &HFF, &HFF, &HFF, &H7F, &HFF, &HFF,
&HFE, &HFF, &HFF, &HFF, &HFF, &HFF}
#End Region
#Region "Ability Stuff"
Public Shared Ability_1 As Byte() = {&H0, &H41, &H41, &H41, &H42, &H42,
&H42, &H43, &H43, &H43, &H13, &H3D, &HE, &H13, &H3D, &H44,
&H33, &H33, &H33, &H32, &H32, &H33, &H33, &H16, &H16, &H9,
&H9, &H8, &H8, &H26, &H26, &H26, &H26, &H26, &H26, &H38, &H38,
&H12, &H12, &H38, &H38, &H27, &H27, &H22, &H22, &H22, &H1B,
&H1B, &HE, &H13, &H8, &H8, &H35, &H7, &H6, &H6, &H48, &H48,
&H16, &H16, &HB, &HB, &HB, &H1C, &H1C, &H1C, &H3E, &H3E, &H3E,
&H22, &H22, &H22, &H1D, &H1D, &H45, &H45, &H45, &H32, &H32,
&HC, &HC, &H2A, &H2A, &H33, &H32, &H32, &H2F, &H2F, &H1, &H1,
&H4B, &H4B, &H1A, &H1A, &H1A, &H45, &HF, &HF, &H34, &H34,
&H2B, &H2B, &H22, &H22, &H45, &H45, &H7, &H33, &H14, &H1A,
&H1A, &H1F, &H1F, &H1E, &H22, &H30, &H21, &H26, &H21, &H21,
&H23, &H23, &H2B, &H44, &HC, &H9, &H31, &H34, &H16, &H21,
&H16, &HB, &H7, &H32, &HB, &HA, &H12, &H24, &H21, &H21, &H21,
&H21, &H45, &H11, &H2E, &H2E, &H2E, &H3D, &H3D, &H27, &H2E,
&H1C, &H41, &H41, &H41, &H42, &H42, &H42, &H43, &H43, &H43,
&H32, &H32, &HF, &HF, &H44, &H44, &H44, &H44, &H27, &HA, &HA,
&H9, &H38, &H38, &H37, &H37, &H1C, &H1C, &H9, &H9, &H9, &H22,
&H2F, &H2F, &H5, &HB, &H22, &H22, &H22, &H32, &H22, &H22, &H3,
&H6, &H6, &H1C, &H1C, &HF, &HC, &H1A, &H1A, &H17, &H27, &H5,
&H5, &H20, &H34, &H45, &H16, &H16, &H26, &H44, &H5, &H44,
&H27, &H35, &H3E, &H28, &H28, &HC, &HC, &H37, &H37, &H15, &H48,
&H21, &H33, &H30, &H30, &H21, &H35, &H5, &H24, &H16, &H14,
&H3E, &H16, &HC, &H9, &H31, &H2F, &H1E, &H2E, &H2E, &H2E,
&H3E, &H3D, &H2D, &H2E, &H2E, &H1E, &H41, &H41, &H41, &H42,
&H42, &H42, &H43, &H43, &H43, &H32, &H16, &H35, &H35, &H13,
&H3D, &H44, &H3D, &H13, &H21, &H21, &H21, &H22, &H22, &H22,
&H3E, &H3E, &H33, &H33, &H1C, &H1C, &H1C, &H21, &H16, &H1B,
&H1B, &H36, &H48, &H36, &HE, &H3, &H19, &H2B, &H2B, &H2B, &H2F,
&H2F, &H2F, &H5, &H38, &H38, &H33, &H34, &H5, &H5, &H5, &H4A,
&H4A, &H9, &H9, &H39, &H3A, &H23, &HC, &H1E, &H40, &H40, &H18,
&H18, &H29, &H29, &HC, &H28, &H49, &H2F, &H2F, &H14, &H34,
&H1A, &H1A, &H8, &H8, &H1E, &H1E, &H11, &H3D, &H1A, &H1A,
&HC, &HC, &H34, &H34, &H1A, &H1A, &H15, &H15, &H4, &H4, &H21,
&H3F, &H3B, &H10, &HF, &HF, &H1A, &H2E, &H22, &H1A, &H2E,
&H17, &H27, &H27, &H2F, &H2F, &H2F, &H4B, &H21, &H21, &H21,
&H21, &H45, &H45, &H16, &H1D, &H1D, &H1D, &H1D, &H1D, &H1D,
&H1A, &H1A, &H2, &H46, &H4C, &H20, &H2E, &H41, &H41, &H41,
&H42, &H42, &H42, &H43, &H43, &H43, &H33, &H16, &H16, &H56,
&H56, &H3D, &H44, &H4F, &H4F, &H4F, &H1E, &H1E, &H68, &H68,
&H5, &H5, &H3D, &H6B, &H44, &H76, &H2E, &H32, &H21, &H21,
&H22, &H7A, &H3C, &H3C, &H65, &H6A, &H6A, &H32, &H38, &H1A,
&HF, &H7, &H2F, &H1A, &H1, &H1, &H1A, &H1A, &H5, &H2B, &H1E,
&H33, &H2E, &H8, &H8, &H8, &H35, &H50, &H50, &H2D, &H2D, &H4,
&H4, &H6B, &H6B, &H1A, &H21, &H21, &H21, &H75, &H75, &H2E,
&H2A, &H14, &H1F, &H22, &H4E, &H31, &H37, &H3, &H66, &H51,
&H34, &HC, &H5B, &H50, &H5, &H2E, &H51, &H1A, &H1A, &H1A,
&H1A, &H2E, &H2E, &H12, &H70, &H2E, &H1A, &H5D, &H5D, &H7B,
&H1E, &H79}
Public Shared Ability_2 As Byte() = {&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H4D, &H4D, &H4D, &H3E, &H3E, &H0, &H0,
&H3D, &H3D, &H0, &H0, &H0, &H0, &H4F, &H4F,
&H4F, &H4F, &H4F, &H4F, &H62, &H62, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H57, &H57, &H6E, &H6E, &H47, &H47, &H65,
&H65, &HD, &HD, &H53, &H53, &H12, &H12,
&H6, &H6, &H6, &H27, &H27, &H27, &H63, &H63,
&H63, &H0, &H0, &H0, &H40, &H40, &H5, &H5,
&H5, &H12, &H12, &H14, &H14, &H5, &H5, &H27,
&H30, &H30, &H5D, &H5D, &H3C, &H3C, &H5C,
&H5C, &H0, &H0, &H0, &H5, &H6C, &H6C, &H4B,
&H4B, &H9, &H9, &H0, &H0, &H1F, &H1F, &H78,
&H59, &HC, &H0, &H0, &H45, &H45, &H20, &H66,
&H71, &H61, &H61, &H29, &H29, &H1E, &H1E, &H6F,
&H65, &H6C, &H0, &H0, &H68, &H53, &H0, &H0,
&H4B, &H0, &H5B, &HB, &HA, &H12, &H58, &H4B,
&H4B, &H4, &H4, &H2E, &H2F, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H33, &H33, &H33, &H33, &H30,
&H30, &HF, &HF, &H0, &H23, &H23, &H0, &H62, &H0,
&H20, &H20, &H30, &H30, &H0, &H0, &H0, &H0, &H25,
&H25, &H45, &H6, &H66, &H66, &H66, &H35, &H5E,
&H5E, &HE, &HB, &HB, &H1C, &H1C, &H69, &H14, &H0,
&H0, &H0, &H30, &H0, &H0, &H32, &H8, &H5, &H32,
&H5F, &H21, &H65, &H52, &H3E, &H33, &H5F, &H5F,
&H31, &H31, &H51, &H51, &H1E, &H61, &H61, &H37,
&HB, &H5, &H12, &H12, &H61, &H0, &H0, &H58, &H77,
&H65, &H50, &H65, &H6C, &H0, &H0, &H71, &H20, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H5F, &H5F, &H52,
&H52, &H0, &H0, &H0, &H0, &H0, &H2C, &H2C, &H2C, &H30,
&H30, &H30, &H0, &H0, &H0, &H0, &H24, &H24, &H24,
&H0, &H0, &H5A, &H5A, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H3E, &H3E, &H25, &H2A, &H60, &H60,
&H64, &H16, &H45, &H45, &H45, &H0, &H0, &H1F, &H1F,
&H0, &H0, &H44, &H6E, &H26, &H3C, &H3C, &H0, &H0,
&HC, &HC, &H56, &H74, &H0, &H14, &H14, &H4D, &H47,
&H1A, &H1A, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H6B, &H6B, &H4B, &H4B, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H77, &H77, &H0, &H0, &H5E,
&H0, &H69, &H0, &H73, &H73, &H73, &H73, &H73, &H0,
&H0, &H0, &H45, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H6D, &H6D, &H0, &H0, &H16, &H16, &H16, &H26, &H26,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0, &H35, &H0,
&H0, &H0, &H0, &H72, &H72, &H35, &H54, &H54, &H67,
&H67, &H0, &H69, &H14, &H14, &H0, &H6A, &H6A, &H55,
&H55, &H45, &H6F, &H20, &H4D, &H0, &H0, &H0, &H0, &H2F,
&H27, &H27, &H0, &H0, &H61, &H61, &H57, &H57, &H0, &H72,
&H72, &HB, &H0, &H0, &H2E, &H5, &HC, &H74, &H66, &H0,
&H0, &H20, &H6E, &H66, &H51, &H8, &H51, &H58, &H50,
&H2A, &H0, &H51, &H0, &H0, &H0, &H0, &H0, &H0, &H0,
&H0, &H0, &H0, &H0, &H0, &H0, &H0, &H0}
#End Region
#Region "Experience(Level-Based Functions)"
Public Function Erratic(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
If n <= 50 Then
EXP = ((n ^ 3) * (100 - n)) / 50
ElseIf n >= 50 And n <= 68 Then
EXP = ((n ^ 3) * (150 - n)) / 100
ElseIf n >= 68 And n <= 98 Then
EXP = ((n ^ 3) * Math.Floor((1911 - (10 * n)) / 3)) / 50
ElseIf n >= 98 And n <= 100 Then
EXP = ((n ^ 3) * (160 - n)) / 100
End If
Return EXP
End Function
Public Function Fast(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
EXP = (4 * (n ^ 3)) / 5
Return EXP
End Function
Public Function MediumFast(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
EXP = (n ^ 3)
Return EXP
End Function
Public Function MediumSlow(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
EXP = ((6 / 5) * (n ^ 3)) - (15 * (n ^ 2)) + (100 * n) - 140
Return EXP
End Function
Public Function Slow(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
EXP = (5 * (n ^ 3)) / 4
Return EXP
End Function
Public Function Fluctuating(ByVal n As Byte) As UInteger
Dim EXP As UInteger = 0
If n <= 15 Then
EXP = (n ^ 3) * ((Math.Floor((n + 1) / 3) + 24) / 50)
ElseIf n >= 15 And n <= 36 Then
EXP = (n ^ 3) * ((n + 14) / 50)
ElseIf n >= 36 And n <= 100 Then
EXP = (n ^ 3) * ((Math.Floor(n / 2) + 32) / 50)
End If
Return EXP
End Function
#End Region
#Region "Stats(Calculation)"
Public Function HPStat(ByVal IV As Byte, ByVal EV As Byte, ByVal BASE As Byte, ByVal LEVEL As Byte) As UShort
Dim Stat As UShort = 0
Stat = (((IV + (2 * BASE) + (EV / 4) + 100) * LEVEL) / 100) + 10
Return Math.Floor(Stat)
End Function
Public Function OtherStat(ByVal IV As Byte, ByVal EV As Byte, ByVal BASE As Byte, ByVal LEVEL As Byte, ByVal NATURE As Decimal) As UShort
Dim Stat As UShort = 0
Stat = ((((IV + (2 * BASE) + (EV / 4)) * LEVEL) / 100) + 5) * NATURE
Return Math.Floor(Stat)
End Function
#End Region
Public Shared Function GetRandomUInt32() As UInteger
Static r As New System.Security.Cryptography.RNGCryptoServiceProvider
Dim bytes(4) As Byte
r.GetBytes(bytes)
Return BitConverter.ToUInt32(bytes, 0)
End Function
End Class
End Namespace |
'=============================================================================
' Copyright (c) 2009 Siemens
' All rights reserved
'===============================================================================
'
'Description: wrappers to UFapp
'
'
'=============================================================================*/
Imports System
Imports System.Runtime.InteropServices
Public Class wrappers
Const UFAPP_DLLNAME As String = "UFLegacyApp.dll"
'************************************************************************************
' Hookup to a function in UFapp
<DllImport(UFAPP_DLLNAME, EntryPoint:="UFappFunction1", _
CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
Shared Function UFappFunction1() As Integer
End Function
'************************************************************************************
' Hookup to another function in UFapp
<DllImport(UFAPP_DLLNAME, EntryPoint:="UFappFunction2", _
CallingConvention:=CallingConvention.Cdecl, CharSet:=CharSet.Ansi)> _
Shared Function UFappFunction2(ByVal value As Integer, ByVal str As String) As Integer
End Function
End Class
|
Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.ServiceModel.Web
Imports System.ServiceModel.Channels
Imports System.Security.Cryptography
Imports System.IO
Imports System.Net.Mail
Imports System.Threading
Imports System.Net
Imports SF.BLL
<ServiceContract(Namespace:="")>
<AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)>
Public Class S1
#Region "decryption"
Public Shared Function DecryptStringAES(a As String) As String
Dim keybytes = Encoding.UTF8.GetBytes("7061737323313233")
Dim iv = Encoding.UTF8.GetBytes("7061737323313233")
'DECRYPT FROM CRIPTOJS
Try
Dim encrypted = Convert.FromBase64String(a)
Dim decriptedFromJavascript = DecryptStringFromBytes(encrypted, keybytes, iv)
Return decriptedFromJavascript
Catch ex As Exception
Return String.Empty
End Try
'Return String.Format("roundtrip reuslt:{0}{1}Javascript result:{2}", roundtrip, Environment.NewLine, decriptedFromJavascript)
End Function
Private Shared Function DecryptStringFromBytes(cipherText As Byte(), key As Byte(), iv As Byte()) As String
' Check arguments.
If cipherText Is Nothing OrElse cipherText.Length <= 0 Then
Throw New ArgumentNullException("cipherText")
End If
If key Is Nothing OrElse key.Length <= 0 Then
Throw New ArgumentNullException("key")
End If
If iv Is Nothing OrElse iv.Length <= 0 Then
Throw New ArgumentNullException("key")
End If
' Declare the string used to hold
' the decrypted text.
Dim plaintext As String = Nothing
' Create an RijndaelManaged object
' with the specified key and IV.
Using rijAlg = New RijndaelManaged()
'Settings
rijAlg.Mode = CipherMode.CBC
'rijAlg.Padding = PaddingMode.PKCS7
rijAlg.Padding = PaddingMode.None
rijAlg.FeedbackSize = 128
rijAlg.Key = key
rijAlg.IV = iv
' Create a decrytor to perform the stream transform.
Dim decryptor = rijAlg.CreateDecryptor(rijAlg.Key, rijAlg.IV)
' Create the streams used for decryption.
Using msDecrypt = New MemoryStream(cipherText)
Using csDecrypt = New CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read)
Using srDecrypt = New StreamReader(csDecrypt)
' Read the decrypted bytes from the decrypting stream
' and place them in a string.
plaintext = srDecrypt.ReadToEnd()
End Using
End Using
End Using
End Using
Return plaintext
End Function
Private Shared Function EncryptStringToBytes(plainText As String, key As Byte(), iv As Byte()) As Byte()
' Check arguments.
If plainText Is Nothing OrElse plainText.Length <= 0 Then
Throw New ArgumentNullException("plainText")
End If
If key Is Nothing OrElse key.Length <= 0 Then
Throw New ArgumentNullException("key")
End If
If iv Is Nothing OrElse iv.Length <= 0 Then
Throw New ArgumentNullException("key")
End If
Dim encrypted As Byte()
' Create a RijndaelManaged object
' with the specified key and IV.
Using rijAlg = New RijndaelManaged()
rijAlg.Mode = CipherMode.CBC
rijAlg.Padding = PaddingMode.PKCS7
rijAlg.FeedbackSize = 128
rijAlg.Key = key
rijAlg.IV = iv
' Create a decrytor to perform the stream transform.
Dim encryptor = rijAlg.CreateEncryptor(rijAlg.Key, rijAlg.IV)
' Create the streams used for encryption.
Using msEncrypt = New MemoryStream()
Using csEncrypt = New CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write)
Using swEncrypt = New StreamWriter(csEncrypt)
'Write all data to the stream.
swEncrypt.Write(plainText)
End Using
encrypted = msEncrypt.ToArray()
End Using
End Using
End Using
' Return the encrypted bytes from the memory stream.
Return encrypted
End Function
#End Region
#Region "end user enroll"
<OperationContract()>
<WebGet()>
Public Function logIn(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di due secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 2 Then
' If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function register(a As String) As String
Dim retval As Boolean = False
Dim ProviderUserKey As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Try
Dim _newuser As MembershipUser = Membership.CreateUser(ar0(0), ar0(1))
If Not _newuser Is Nothing Then
_newuser.IsApproved = True
Roles.AddUserToRole(_newuser.UserName, "users")
retval = True
ProviderUserKey = _newuser.ProviderUserKey.ToString()
_newuser = Nothing
'SF.BLL.Impianti_Users.Add(ar0(2), ProviderUserKey, False)
End If
Catch ex As Exception
retval = False
End Try
If retval = False Then
Return "0;"
Else
Return "1;" & ProviderUserKey
End If
End Function
<OperationContract()>
<WebGet()>
Public Function logA(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di 10 secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 11 Then
' If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' If Roles.IsUserInRole(ar0(0), "Administrators") Then
' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' End If
' End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
If Roles.IsUserInRole(ar0(0), "Administrators") Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
End If
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function logO(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di 10 secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 11 Then
' 'If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' ' If Roles.IsUserInRole(ar0(0), "Operators") Then
' ' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' ' End If
' 'End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
If Roles.IsUserInRole(ar0(0), "Operators") Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
End If
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function logU(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di 10 secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 11 Then
' If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' If Roles.IsUserInRole(ar0(0), "Endusers") Then
' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' End If
' End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
If Roles.IsUserInRole(ar0(0), "Endusers") Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
End If
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function logS(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di 10 secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 11 Then
' If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' If Roles.IsUserInRole(ar0(0), "Supervisors") Then
' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' End If
' End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
If Roles.IsUserInRole(ar0(0), "Supervisors") Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
End If
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function logM(a As String) As String
Dim retval As String = String.Empty
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
Dim ts = TimeSpan.FromMilliseconds(Convert.ToDouble(ar0(2)))
''non deve esserci differenza maggiore di 10 secondi tra l'orario passato
''e quello attuale.
'If Now.Second - ts.Seconds < 11 Then
' If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
' If Roles.IsUserInRole(ar0(0), "Maintainers") Then
' retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
' End If
' End If
'End If
If Membership.ValidateUser(ar0(0), ar0(1)) = True Then
If Roles.IsUserInRole(ar0(0), "Maintainers") Then
retval = Membership.GetUser(ar0(0)).ProviderUserKey.ToString()
End If
End If
Return retval
End Function
#End Region
#Region "aspnetroles"
<OperationContract()>
<WebGet()>
Public Function aspnetroles_Add(RoleName As String) As Boolean
If String.IsNullOrEmpty(RoleName) Then
Return False
End If
Return SF.BLL.aspnetroles.Add(RoleName)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetroles_Del(RoleName As String) As Boolean
If String.IsNullOrEmpty(RoleName) Then
Return False
End If
Return SF.BLL.aspnetroles.Del(RoleName)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetroles_List() As List(Of aspnetroles)
Return SF.BLL.aspnetroles.List
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetroles_ListActive(IdImpianto As String) As List(Of aspnetroles)
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.aspnetroles.ListActive(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetroles_Update(RoleId As String, RoleName As String) As Boolean
If String.IsNullOrEmpty(RoleId) Then
Return False
End If
If String.IsNullOrEmpty(RoleName) Then
Return False
End If
Return SF.BLL.aspnetroles.Update(RoleId, RoleName)
End Function
#End Region
#Region "aspnetusersstat"
<OperationContract()>
<WebGet()>
Public Function aspnetusersstat_Read() As aspnetusersstat
Return SF.BLL.aspnetusersstat.Read
End Function
#End Region
#Region "aspnetusers"
Private Function RandomNumber(ByVal min As Integer, ByVal max As Integer) As Integer
Dim random As New Random()
Return random.Next(min, max)
End Function 'RandomNumber
Private Function RandomString(ByVal size As Integer, ByVal lowerCase As Boolean) As String
Dim builder As New StringBuilder()
Dim random As New Random()
Dim ch As Char
Dim i As Integer
For i = 0 To size - 1
ch = Convert.ToChar(Convert.ToInt32((26 * random.NextDouble() + 65)))
builder.Append(ch)
Next i
If lowerCase Then
Return builder.ToString().ToLower()
End If
Return builder.ToString()
End Function 'RandomString
Public Function CreatePassword() As String
Dim builder As New StringBuilder()
builder.Append(RandomString(4, True))
builder.Append(RandomNumber(1000, 9999))
builder.Append(RandomString(2, False))
Return builder.ToString()
End Function 'GetPassword
Private Function loadModule(moduleName As String) As String
Dim fullpath As String = HttpContext.Current.Request.MapPath("~\Modules\" & moduleName)
Dim sr As StreamReader = New StreamReader(fullpath)
Dim retVal As String = sr.ReadToEnd()
sr.Close()
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_AddUser(a) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Dim password As String = String.Empty
Dim rolename As String = String.Empty
Dim comment As String = String.Empty
Dim email As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
password = ar0(1)
rolename = ar0(2)
comment = ar0(3)
email = ar0(4)
retVal = SF.BLL.aspnetUsers.AddUser(username, password, rolename, comment, email)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_UpdUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Dim comment As String = String.Empty
Dim email As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
comment = ar0(1)
email = ar0(2)
retVal = SF.BLL.aspnetUsers.UpdUser(username, comment, email)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_approveUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
retVal = SF.BLL.aspnetUsers.approveUser(username)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_disapproveUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
retVal = SF.BLL.aspnetUsers.disapproveUser(username)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_lockUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
retVal = SF.BLL.aspnetUsers.lockUser(username)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_UnlockUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
retVal = SF.BLL.aspnetUsers.UnlockUser(username)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_changeUserPass(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Dim oldPass As String = String.Empty
Dim newPass As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
oldPass = ar0(1)
newPass = ar0(2)
retVal = SF.BLL.aspnetUsers.changeUserPass(username, oldPass, newPass)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetuser_emailNewPass(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Dim lang As String = String.Empty
Dim resetpwd As String = String.Empty
Dim newpwd As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
lang = ar0(1)
resetpwd = SF.BLL.aspnetUsers.resetP(username)
Catch ex As Exception
retVal = False
End Try
newpwd = CreatePassword()
If SF.BLL.aspnetUsers.changeUserPass(username, resetpwd, newpwd) Then
Dim moduleName As String = "Parking_forgotPwdEmail_" & lang & ".html"
Dim mailContent As String = loadModule(moduleName)
mailContent = Replace(mailContent, "@!@pwd@!@", newpwd)
Dim Message As New System.Net.Mail.MailMessage
Message.From = New MailAddress("noReply@clevergy.it")
Message.To.Add(username)
Message.Subject = "Password reset"
Message.Body = mailContent
Message.IsBodyHtml = True
' Replace SmtpMail.SmtpServer = server with the following:
Dim smtp As New SmtpClient("smtp.mandrillapp.com")
smtp.Port = 587
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("clv.emcs.00@gmail.com", "gr4SmRnLxNn6hRFyW8lq-Q")
Try
smtp.Send(Message)
retVal = True
Catch ex As Exception
retVal = False
End Try
Else
retVal = False
End If
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_removeUser(a As String) As Boolean
Dim retVal As Boolean = False
Dim username As String = String.Empty
Try
Dim decrypted = DecryptStringAES(a)
Dim ar0 As String() = decrypted.Split(";")
username = ar0(0)
retVal = SF.BLL.aspnetUsers.removeUser(username)
Catch ex As Exception
retVal = False
End Try
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_GetActiveUsersByRoleName(RoleName As String) As List(Of aspnetUsers)
If String.IsNullOrEmpty(RoleName) Then
Return Nothing
End If
Return SF.BLL.aspnetUsers.GetActiveUsersByRoleName(RoleName)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_GetTotActiveUsersByRoleName(RoleName As String) As Integer
If String.IsNullOrEmpty(RoleName) Then
Return 0
End If
Return SF.BLL.aspnetUsers.GetTotActiveUsersByRoleName(RoleName)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_GetUsersByRoleName(RoleName As String, searchString As String, IdImpianto As String) As List(Of aspnetUsers)
If String.IsNullOrEmpty(RoleName) Then
Return Nothing
End If
Return SF.BLL.aspnetUsers.GetUsersByRoleName(RoleName, searchString, IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_GetUsersAll() As List(Of aspnetUsers)
Return SF.BLL.aspnetUsers.GetUsersAll()
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_GetUserByUserName(UserName As String) As aspnetUsers
If String.IsNullOrEmpty(UserName) Then
Return Nothing
End If
Return SF.BLL.aspnetUsers.GetUserByUserName(UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_userok(UserId As String) As Boolean
Return SF.BLL.aspnetUsers.userok(UserId)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_whoIsOnline() As List(Of String)
Return SF.BLL.aspnetUsers.whoIsOnline
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_getUser(UserId As String) As String
Return SF.BLL.aspnetUsers.getUser(UserId)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_getUserS(UserId As String) As String
Return SF.BLL.aspnetUsers.getUserS(UserId)
End Function
<OperationContract()>
<WebGet()>
Public Function aspnetusers_getUserA(UserId As String) As String
Return SF.BLL.aspnetUsers.getUserA(UserId)
End Function
#End Region
#Region "UserMenu"
<OperationContract()>
<WebGet()>
Public Function getUserMenu(username As String) As List(Of SF.BLL.UserMenu)
Dim retVal As New List(Of SF.BLL.UserMenu)
Dim _list As List(Of SF.BLL.UserMenu) = SF.BLL.UserMenu.List(username)
If Not _list Is Nothing Then
Dim _usermenuList = From c In _list Where c.IdVocePadre = 0 Select c
If Not _usermenuList Is Nothing Then
If _usermenuList.Count > 0 Then
For Each c In _usermenuList
Dim fathermenu As New SF.BLL.UserMenu
fathermenu.IdVoceMenu = c.IdVoceMenu
fathermenu.IdVocePadre = c.IdVocePadre
fathermenu.IdAzione = c.IdAzione
fathermenu.DescrVoce = c.DescrVoce
fathermenu.URLAzione = c.URLAzione
fathermenu.mainPage = c.mainPage
retVal.Add(fathermenu)
Dim _VociMenu = From o In _list Where o.IdVocePadre = fathermenu.IdVoceMenu Select o
If Not _VociMenu Is Nothing Then
If _VociMenu.Count > 0 Then
For Each o In _VociMenu
Dim vocemenu As New SF.BLL.UserMenu
vocemenu.IdVoceMenu = o.IdVoceMenu
vocemenu.IdVocePadre = o.IdVocePadre
vocemenu.IdAzione = o.IdAzione
vocemenu.DescrVoce = o.DescrVoce
vocemenu.URLAzione = o.URLAzione
vocemenu.mainPage = String.Empty
retVal.Add(vocemenu)
Next
End If
_VociMenu = Nothing
End If
Next
End If
_usermenuList = Nothing
End If
End If
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function UserMenu_ListFather(UserName As String) As List(Of SF.BLL.UserMenu)
If String.IsNullOrEmpty(UserName) Then
Return Nothing
End If
Return SF.BLL.UserMenu.ListFather(UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function UserMenu_ListChildren(UserName As String, IdVocePadre As Integer) As List(Of SF.BLL.UserMenu)
If String.IsNullOrEmpty(UserName) Then
Return Nothing
End If
If IdVocePadre = 0 Then
Return Nothing
End If
Return SF.BLL.UserMenu.ListChildren(UserName, IdVocePadre)
End Function
#End Region
#Region "menuUtente"
<OperationContract()>
<WebGet()>
Public Function menuUtente_Read(username As String) As List(Of SF.BLL.menuUtente)
If String.IsNullOrEmpty(username) Then
Return Nothing
End If
Return SF.BLL.menuUtente.Read(username)
End Function
#End Region
#Region "User_hsId"
<OperationContract()>
<WebGet()>
Public Function User_hsId_Add(hsId As Integer, UserId As String) As Boolean
If hsId <= 0 Then
Return False
End If
If String.IsNullOrEmpty(UserId) Then
Return Nothing
End If
Return SF.BLL.User_hsId.Add(hsId, UserId)
End Function
<OperationContract()>
<WebGet()>
Public Function User_hsId_Del(Id As Integer) As Boolean
If Id <= 0 Then
Return False
End If
Return SF.BLL.User_hsId.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function User_hsId_List(UserId As String) As List(Of User_hsId)
If String.IsNullOrEmpty(UserId) Then
Return Nothing
End If
Return SF.BLL.User_hsId.List(UserId)
End Function
#End Region
#Region "Impianti"
<OperationContract()>
<WebGet()>
Public Function Impianti_Add(DesImpianto As String, Indirizzo As String, Latitude As Decimal, Longitude As Decimal, AltSLM As Decimal, IsActive As Boolean) As Boolean
If String.IsNullOrEmpty(DesImpianto) Then
Return False
End If
Return SF.BLL.Impianti.Add(DesImpianto, Indirizzo, Latitude, Longitude, AltSLM, IsActive)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_List(searchString As String) As List(Of SF.BLL.Impianti)
Return SF.BLL.Impianti.List(searchString)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_ListByUser(UserId As String, searchString As String) As List(Of Impianti)
If String.IsNullOrEmpty(UserId) Then
Return Nothing
End If
Return SF.BLL.Impianti.ListByUser(UserId, searchString)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_ListPaged(id As Integer, searchString As String) As List(Of Impianti)
Return SF.BLL.Impianti.ListPaged(id, searchString)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Read(IdImpianto As String) As Impianti
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.Impianti.Read(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_setIsActive(IdImpianto As String, IsActive As Boolean) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
Return SF.BLL.Impianti.setIsActive(IdImpianto, IsActive)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Upd(IdImpianto As String, DesImpianto As String, Indirizzo As String, Latitude As Decimal, Longitude As Decimal, AltSLM As Decimal, IsActive As Boolean) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If String.IsNullOrEmpty(DesImpianto) Then
Return False
End If
Return SF.BLL.Impianti.Upd(IdImpianto, DesImpianto, Indirizzo, Latitude, Longitude, AltSLM, IsActive)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_setGeolocation(IdImpianto As String, Latitude As Decimal, Longitude As Decimal, AltSLM As Decimal) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
Return SF.BLL.Impianti.setGeolocation(IdImpianto, Latitude, Longitude, AltSLM)
End Function
#End Region
#Region "Impianti_Contatti"
<OperationContract()>
<WebGet()>
Public Function Impianti_Contatti_Add(hsId As String, _
IdImpianto As String, _
Descrizione As String, _
Indirizzo As String, _
Nome As String, _
TelFisso As String, _
TelMobile As String, _
emailaddress As String) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If String.IsNullOrEmpty(Descrizione) Then
Return False
End If
Return SF.BLL.Impianti_Contatti.Add(hsId, IdImpianto, Descrizione, Indirizzo, Nome, TelFisso, TelMobile, emailaddress)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Contatti_Del(IdContatto As Integer) As Boolean
If IdContatto <= 0 Then
Return False
End If
Return SF.BLL.Impianti_Contatti.Del(IdContatto)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Contatti_List(IdImpianto As String, hsId As Integer) As IList(Of Impianti_Contatti)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.Impianti_Contatti.List(IdImpianto, hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Contatti_Read(IdContatto As Integer) As Impianti_Contatti
If IdContatto <= 0 Then
Return Nothing
End If
Return SF.BLL.Impianti_Contatti.Read(IdContatto)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_Contatti_Update(IdContatto As Integer, _
hsId As Integer, _
Descrizione As String, _
Indirizzo As String, _
Nome As String, _
TelFisso As String, _
TelMobile As String, _
emailaddress As String) As Boolean
If IdContatto <= 0 Then
Return False
End If
If String.IsNullOrEmpty(Descrizione) Then
Return False
End If
Return SF.BLL.Impianti_Contatti.Update(IdContatto, hsId, Descrizione, Indirizzo, Nome, TelFisso, TelMobile, emailaddress)
End Function
#End Region
#Region "HeatingSystem"
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_Add(IdImpianto As String, Descr As String, Indirizzo As String, Latitude As Decimal, Longitude As Decimal, AltSLM As Integer, UserName As String) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If String.IsNullOrEmpty(Indirizzo) Then
Return False
End If
Return SF.BLL.HeatingSystem.Add(IdImpianto, Descr, Indirizzo, Latitude, Longitude, AltSLM, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_Del(hsId As Integer) As Boolean
If hsId <= 0 Then
Return False
End If
Return SF.BLL.HeatingSystem.Del(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_getTotMap(IdImpianto As String) As Integer
If String.IsNullOrEmpty(IdImpianto) Then Return 0
Return SF.BLL.HeatingSystem.getTotMap(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_List(IdImpianto As String) As List(Of HeatingSystem)
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.HeatingSystem.List(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_ListEnabled(IdImpianto As String) As List(Of HeatingSystem)
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.HeatingSystem.ListEnabled(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_ListAll() As List(Of HeatingSystem)
Return SF.BLL.HeatingSystem.ListAll()
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_Read(hsId As Integer) As HeatingSystem
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.HeatingSystem.Read(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setMaintenanceMode(hsId As Integer, MaintenanceMode As Boolean) As Boolean
If hsId <= 0 Then
Return False
End If
Return SF.BLL.HeatingSystem.setMaintenanceMode(hsId, MaintenanceMode)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setIwMonitoring(hsId As Integer, IwMonitoringId As Integer, IwMonitoringDes As String) As Boolean
If hsId <= 0 Then
Return False
End If
Return SF.BLL.HeatingSystem.setIwMonitoring(hsId, IwMonitoringId, RTrim(IwMonitoringDes))
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setIsEnabled(hsId As Integer, isEnabled As Boolean) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.HeatingSystem.setIsEnabled(hsId, isEnabled)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setNote(hsId As Integer, Note As String, UserName As String) As Boolean
If hsId <= 0 Then
Return False
End If
Return SF.BLL.HeatingSystem.setNote(hsId, Note, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_Update(hsId As Integer, Descr As String, Indirizzo As String, Latitude As Decimal, Longitude As Decimal, AltSLM As Integer, VPNConnectionId As Integer, MapId As Integer, UserName As String) As Boolean
If hsId <= 0 Then
Return False
End If
If String.IsNullOrEmpty(Indirizzo) Then
Return False
End If
Return SF.BLL.HeatingSystem.Update(hsId, Descr, Indirizzo, Latitude, Longitude, AltSLM, VPNConnectionId, MapId, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_resetSystemStatus(hsId As Integer) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.HeatingSystem.resetSystemStatus(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_requestLog(hsId As Integer) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.HeatingSystem.requestLog(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setGeoLocation(hsId As Integer, Latitude As Decimal, Longitude As Decimal) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.HeatingSystem.setGeoLocation(hsId, Latitude, Longitude)
End Function
<OperationContract()>
<WebGet()>
Public Function HeatingSystem_setDateTime(hsId As Integer) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.HeatingSystem.setDateTime(hsId)
End Function
#End Region
#Region "hs_Elem"
<OperationContract()>
<WebGet()>
Public Function hs_Elem_Read(hsId As Integer) As hs_Elem
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Elem.Read(hsId)
End Function
#End Region
#Region "tbhsElem"
<OperationContract()>
<WebGet()>
Public Function tbhsElem_List() As List(Of tbhsElem)
Return SF.BLL.tbhsElem.List
End Function
#End Region
#Region "hs_Docs"
<OperationContract()>
<WebGet()>
Public Function hs_Docs_Add(hsId As Integer, _
DocName As String, _
Creator As String) As Boolean
If String.IsNullOrEmpty(DocName) Then
Return False
End If
Return SF.BLL.hs_Docs.Add(hsId, DocName, Creator)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_Del(IdDoc As Integer) As Boolean
If IdDoc <= 0 Then
Return False
End If
Return SF.BLL.hs_Docs.Del(IdDoc)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_List(hsId As Integer) As List(Of hs_Docs)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Docs.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_Read(IdDoc As Integer) As hs_Docs
If IdDoc <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Docs.Read(IdDoc)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_getBinaryData(IdDoc As Integer) As Boolean
If IdDoc <= 0 Then
Return False
End If
Return SF.BLL.hs_Docs.getBinaryData(IdDoc)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_DocsgetTot(hsId As Integer) As Integer
If hsId <= 0 Then
Return 0
End If
Return SF.BLL.hs_Docs.getTot(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_setBinaryData(IdDoc As Integer, BinaryData As String, UserName As String) As Boolean
If IdDoc <= 0 Then
Return False
End If
If String.IsNullOrEmpty(BinaryData) Then
Return False
End If
Return SF.BLL.hs_Docs.setBinaryData(IdDoc, BinaryData, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Docs_Update(IdDoc As Integer, DocName As String, UserName As String) As Boolean
If IdDoc <= 0 Then
Return False
End If
If String.IsNullOrEmpty(DocName) Then
Return False
End If
Return SF.BLL.hs_Docs.Update(IdDoc, DocName, UserName)
End Function
#End Region
#Region "hs_ErrorLog"
<OperationContract()>
<WebGet()>
Public Function hs_ErrorLog_List(hsId As Integer, fromDate As String, toDate As String) As List(Of hs_ErrorLog)
If hsId <= 0 Then
Return Nothing
End If
Dim _fromDate As Date = CDate(fromDate)
Dim a As Date = CDate(toDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
Dim _toDate As Date = DateAdd(DateInterval.Minute, -1, b)
Return SF.BLL.hs_ErrorLog.List(hsId, _fromDate, _toDate)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_ErrorLog_ListAll(hsId As Integer, rowNumber As Integer) As List(Of hs_ErrorLog)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_ErrorLog.ListAll(hsId, rowNumber)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_ErrorLog_ListByElement(hsId As Integer, hselement As String, rowNumber As Integer) As List(Of hs_ErrorLog)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(hselement) Then
Return Nothing
End If
Return SF.BLL.hs_ErrorLog.ListByElement(hsId, hselement, rowNumber)
End Function
#End Region
#Region "hs_Tickets"
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Add(hsId As Integer, _
TicketTitle As String, _
Requester As String, _
emailRequester As String, _
Description As String, _
Executor As String, _
emailExecutor As String, _
UserName As String, _
TicketType As Integer, _
elementName As String, _
elementId As Integer) As Boolean
If String.IsNullOrEmpty(TicketTitle) Then
Return False
End If
If String.IsNullOrEmpty(Requester) Then
Return False
End If
'If String.IsNullOrEmpty(emailRequester) Then
' Return False
'End If
If String.IsNullOrEmpty(Description) Then
Return False
End If
If String.IsNullOrEmpty(Executor) Then
Return False
End If
If String.IsNullOrEmpty(emailExecutor) Then
Return False
End If
Return SF.BLL.hs_Tickets.Add(hsId, TicketTitle, Requester, emailRequester, Description, Executor, emailExecutor, UserName, TicketType, elementName, elementId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Del(TicketId As Integer) As Boolean
If TicketId <= 0 Then
Return False
End If
Return SF.BLL.hs_Tickets.Del(TicketId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_List(hsId As Integer, TicketStatus As Integer, searchString As String) As List(Of hs_Tickets)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets.List(hsId, TicketStatus, searchString)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_ListAll(TicketStatus As Integer, searchString As String) As List(Of hs_Tickets)
Return SF.BLL.hs_Tickets.ListAll(TicketStatus, searchString)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_ListPaged(hsId As Integer, TicketStatus As Integer, searchString As String, RowNumber As Integer) As List(Of hs_Tickets)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets.ListPaged(hsId, TicketStatus, searchString, RowNumber)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_getTotOpen(hsId As Integer) As Integer
If hsId <= 0 Then
Return 0
End If
Return SF.BLL.hs_Tickets.getTotOpen(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Read(TicketId As Integer) As hs_Tickets
If TicketId <= 0 Then
Return Nothing
End If
Dim retval As hs_Tickets = SF.BLL.hs_Tickets.Read(TicketId)
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Update(TicketId As Integer, _
TicketTitle As String, _
Requester As String, _
emailRequester As String, _
Description As String, _
Executor As String, _
emailExecutor As String, _
UserName As String) As Boolean
If TicketId <= 0 Then
Return False
End If
If String.IsNullOrEmpty(TicketTitle) Then
Return False
End If
If String.IsNullOrEmpty(Requester) Then
Return False
End If
'If String.IsNullOrEmpty(emailRequester) Then
' Return False
'End If
If String.IsNullOrEmpty(Description) Then
Return False
End If
If String.IsNullOrEmpty(Executor) Then
Return False
End If
If String.IsNullOrEmpty(emailExecutor) Then
Return False
End If
Return SF.BLL.hs_Tickets.Update(TicketId, TicketTitle, Requester, emailRequester, Description, Executor, emailExecutor, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Update_Rapportino(TicketId As Integer, _
Manutentore As String, _
RespCliente As String, _
Note As String, _
Esito As String, _
Note_cliente As String, _
tipoManutenzione As String) As Boolean
If TicketId <= 0 Then
Return False
End If
If String.IsNullOrEmpty(Manutentore) Then
Return False
End If
If String.IsNullOrEmpty(RespCliente) Then
Return False
End If
If String.IsNullOrEmpty(Note) Then
Return False
End If
If String.IsNullOrEmpty(Esito) Then
Return False
End If
If String.IsNullOrEmpty(Note_cliente) Then
Return False
End If
If String.IsNullOrEmpty(tipoManutenzione) Then
Return False
End If
Return SF.BLL.hs_Tickets.Update_Rapportino(TicketId, Manutentore, RespCliente, Note, Esito, Note_cliente, tipoManutenzione)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_ChangeStatus(TicketId As Integer, DateExecution As String, ExecutorComment As String, TicketStatus As Integer) As Boolean
If TicketId <= 0 Then
Return False
End If
'richiesta chiusura, la data di esecuzione è impostata ad oggi
If TicketStatus = 5 Or TicketStatus = 6 Then
DateExecution = FormatDateTime(Now, DateFormat.GeneralDate)
End If
If String.IsNullOrEmpty(DateExecution) Then
DateExecution = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
End If
Dim _DateExecution As Date = CDate(DateExecution)
Return SF.BLL.hs_Tickets.ChangeStatus(TicketId, _DateExecution, ExecutorComment, TicketStatus)
End Function
#End Region
#Region "TotTicket"
<OperationContract()>
<WebGet()>
Public Function TotTicket_read() As TotTicket
Return SF.BLL.TotTicket.read()
End Function
<OperationContract()>
<WebGet()>
Public Function TotTicket_readHsId(hsId) As TotTicket
Return SF.BLL.TotTicket.readHsId(hsId)
End Function
#End Region
#Region "hs_Rapportino"
<OperationContract()>
<WebGet()>
Public Function hs_Rapportino_Add(TicketId As Integer, _
Manutentore As String, _
RespCliente As String, _
Note As String, _
Esito As String, _
Note_cliente As String, _
tipoManutenzione As String, _
Ctr_Pulizia_moduli As Boolean, _
Ctr_Inv_Strn As Boolean, _
Ctr_Fotovoltatico As Boolean, _
Ctr_Impianto_ok As Boolean) As Boolean
If String.IsNullOrEmpty(Manutentore) Then
Return False
End If
If String.IsNullOrEmpty(RespCliente) Then
Return False
End If
'If String.IsNullOrEmpty(emailRequester) Then
' Return False
'End If
If String.IsNullOrEmpty(Note) Then
Return False
End If
'If String.IsNullOrEmpty(Esito) Then
' Return False
'End If
If String.IsNullOrEmpty(Note_cliente) Then
Return False
End If
Return SF.BLL.hs_Rapportino.Add(TicketId, Manutentore, RespCliente, Note, Esito, Note_cliente, tipoManutenzione, Ctr_Pulizia_moduli, Ctr_Inv_Strn, Ctr_Fotovoltatico, Ctr_Impianto_ok)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Rapportino_Read(TicketId As Integer) As hs_Rapportino
If TicketId <= 0 Then
Return Nothing
End If
Dim retval As hs_Rapportino = SF.BLL.hs_Rapportino.Read(TicketId)
Return retval
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Rapportino_Update(RapportinoId As Integer, _
TicketId As Integer, _
Manutentore As String, _
RespCliente As String, _
Note As String, _
Esito As String, _
Note_cliente As String, _
tipoManutenzione As String, _
Ctr_Pulizia_moduli As Boolean, _
Ctr_Inv_Strn As Boolean, _
Ctr_Fotovoltatico As Boolean, _
Ctr_Impianto_ok As Boolean) As Boolean
If RapportinoId <= 0 Then
Return False
End If
If String.IsNullOrEmpty(Manutentore) Then
Return False
End If
If String.IsNullOrEmpty(RespCliente) Then
Return False
End If
If String.IsNullOrEmpty(Note) Then
Return False
End If
If String.IsNullOrEmpty(Note_cliente) Then
Return False
End If
Return SF.BLL.hs_Rapportino.Update(RapportinoId, TicketId, Manutentore, RespCliente, Note, Esito, Note_cliente, tipoManutenzione, Ctr_Pulizia_moduli, Ctr_Inv_Strn, Ctr_Fotovoltatico, Ctr_Impianto_ok)
End Function
#End Region
#Region "Rapportini_Firme"
<OperationContract()>
<WebGet()>
Public Function Rapportini_Firme_Add(Id As Integer,
imgFirma As String) As Boolean
If String.IsNullOrEmpty(imgFirma) Then
Return False
End If
Return SF.BLL.Rapportini_Firme.Add(Id, imgFirma)
End Function
<OperationContract()>
<WebInvoke(Method:="POST", BodyStyle:=WebMessageBodyStyle.WrappedRequest, RequestFormat:=WebMessageFormat.Json, ResponseFormat:=WebMessageFormat.Json)>
Public Function post_Rapportini_Firme_Add(Id As Integer, imgFirma As String) As Boolean
If Id <= 0 Then Return False
If String.IsNullOrEmpty(imgFirma) Then
Return False
End If
Return SF.BLL.Rapportini_Firme.Add(Id, imgFirma)
End Function
<OperationContract()>
<WebGet()>
Public Function Rapportini_Firme_Read(Id As Integer) As Rapportini_Firme
If Id <= 0 Then
Return Nothing
End If
Dim retval As Rapportini_Firme = SF.BLL.Rapportini_Firme.Read(Id)
Return retval
End Function
#End Region
#Region "hs_Tickets_Executors"
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Executors_Add(hsId As Integer, IdContatto As Integer) As Boolean
If hsId <= 0 Then
Return False
End If
If IdContatto <= 0 Then
Return False
End If
Return SF.BLL.hs_Tickets_Executors.Add(hsId, IdContatto)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Executors_Del(Id As Integer) As Boolean
If Id <= 0 Then
Return False
End If
Return SF.BLL.hs_Tickets_Executors.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Executors_List(hsId As Integer) As List(Of hs_Tickets_Executors)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets_Executors.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Executors_Read(Id As Integer) As hs_Tickets_Executors
If Id <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets_Executors.Read(Id)
End Function
#End Region
#Region "hs_Tickets_Requesters"
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Requesters_Add(hsId As Integer, IdContatto As Integer) As Boolean
If hsId <= 0 Then
Return False
End If
If IdContatto <= 0 Then
Return False
End If
Return SF.BLL.hs_Tickets_Requesters.Add(hsId, IdContatto)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Requesters_Del(Id As Integer) As Boolean
If Id <= 0 Then
Return False
End If
Return SF.BLL.hs_Tickets_Requesters.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Requesters_List(hsId As Integer) As List(Of hs_Tickets_Requesters)
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets_Requesters.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hs_Tickets_Requesters_Read(Id As Integer) As hs_Tickets_Requesters
If Id <= 0 Then
Return Nothing
End If
Return SF.BLL.hs_Tickets_Requesters.Read(Id)
End Function
#End Region
#Region "SolarSystem"
<OperationContract()>
<WebGet()>
Public Function SolarSystem_Del(hsId As Integer) As Boolean
If hsId <= 0 Then
Return False
End If
Return SF.BLL.SolarSystem.Del(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_List(IdImpianto As String) As List(Of SolarSystem)
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.SolarSystem.List(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_ListAll() As List(Of SolarSystem)
Return SF.BLL.SolarSystem.ListAll()
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_Read(hsId As Integer) As SolarSystem
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.SolarSystem.Read(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_Update(hsId As Integer, _
IdImpianto As String, _
NominalCapacity As Decimal, _
Panels As Integer, _
Stringboxes As Integer, _
Inverters As Integer, _
PowerSupplyType As String, _
LineType As String, _
marcamodello As String, _
installationDate As String, _
UserName As String) As Boolean
If hsId <= 0 Then
Return False
End If
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = CDate(installationDate)
End If
Return SF.BLL.SolarSystem.Update(hsId, IdImpianto, NominalCapacity, Panels, Stringboxes, Inverters, PowerSupplyType, LineType, marcamodello, _installationDate, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_setGeoLocation(hsId As Integer, Latitude As Decimal, Longitude As Decimal)
If hsId <= 0 Then Return False
Return SF.BLL.SolarSystem.setGeoLocation(hsId, Latitude, Longitude)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_setInvPVpowerErrCounter(hsId As Integer, InvPVpowerErrCounter As Integer) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.SolarSystem.setInvPVpowerErrCounter(hsId, InvPVpowerErrCounter)
End Function
<OperationContract()>
<WebGet()>
Public Function SolarSystem_getInvPVpowerErrCounter(hsId As Integer) As Integer
If hsId <= 0 Then Return False
Return SF.BLL.SolarSystem.getInvPVpowerErrCounter(hsId)
End Function
#End Region
#Region "EO_Inv"
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Add(hsId As Integer, Cod As String, Descr As String, marcamodello As String, installationDate As String) As Boolean
If hsId <= 0 Then Return False
If String.IsNullOrEmpty(Cod) Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Inv.Add(hsId, Cod, Descr, marcamodello, _installationDate)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_List(hsId As Integer) As List(Of EO_Inv)
If hsId <= 0 Then Return Nothing
Return SF.BLL.EO_Inv.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Read(Id As Integer) As EO_Inv
If Id <= 0 Then Return Nothing
Return SF.BLL.EO_Inv.Read(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_ReadByCod(hsId As Integer, Cod As String) As EO_Inv
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(Cod) Then Return Nothing
Return SF.BLL.EO_Inv.ReadByCod(hsId, Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Update(Id As Integer, Cod As String, Descr As String, marcamodello As String, installationDate As String) As Boolean
If Id <= 0 Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Inv.Update(Id, Cod, Descr, marcamodello, _installationDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Eo_Inv_PotIst(hsId As Integer) As Boolean
If hsId <= 0 Then Return False
Return SF.BLL.EO_Inv.PotIst(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function Eo_Inv_setGetoLocation(Id As Integer, Latitude As Decimal, Longitude As Decimal) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv.setGetoLocation(Id, Latitude, Longitude)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_setPVpowerErrCounter(Id As Integer, PVpowerErrCounter As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv.setPVpowerErrCounter(Id, PVpowerErrCounter)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_getPVpowerErrCounter(Id As Integer) As Integer
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv.getPVpowerErrCounter(Id)
End Function
#End Region
#Region "Log_EO_Inv"
<OperationContract()>
<WebGet()>
Public Function Log_EO_Inv_List(hsId As Integer, Cod As String, fromDate As String, toDate As String) As List(Of Log_EO_Inv)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _fromDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(fromDate) Then
_fromDate = CDate(fromDate)
End If
Dim _toDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_toDate) Then
Dim a As Date = CDate(toDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_toDate = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.Log_EO_Inv.List(hsId, Cod, _fromDate, _toDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Log_EO_Inv_ListPaged(hsId As Integer, Cod As String, fromDate As String, toDate As String, rowNumber As Integer) As List(Of Log_EO_Inv)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _fromDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(fromDate) Then
_fromDate = CDate(fromDate)
End If
Dim _toDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_toDate) Then
Dim a As Date = CDate(toDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_toDate = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.Log_EO_Inv.ListPaged(hsId, Cod, _fromDate, _toDate, rowNumber)
End Function
<OperationContract()>
<WebGet()>
Public Function log_EO_Inv_ReadLast(hsId As Integer, Cod As String) As Log_EO_Inv
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Return SF.BLL.Log_EO_Inv.ReadLast(hsId, Cod)
End Function
#End Region
#Region "Inv_Profile"
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Add(InvId As Integer, ProfileNr As Integer, descr As String, ProfileData As String) As Boolean
If InvId <= 0 Then Return False
If ProfileNr < 0 Then Return False
'If ProfileData.Length <= 0 Then Return False
If String.IsNullOrEmpty(ProfileData) Then Return False
Dim m_ProfileData As Decimal() = New Decimal(95) {}
Dim ar() As String = ProfileData.Split(";")
For y As Integer = 0 To 95
m_ProfileData(y) = CDec(ar(y))
Next
Return SF.BLL.Inv_Profile.Add(InvId, ProfileNr, descr, m_ProfileData)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_List(InvId As Integer) As List(Of Inv_Profile)
If InvId <= 0 Then Return Nothing
Return SF.BLL.Inv_Profile.List(InvId)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Read(InvId As Integer, ProfileNr As Integer) As Inv_Profile
If InvId <= 0 Then Return Nothing
If ProfileNr < 0 Then Return Nothing
Return SF.BLL.Inv_Profile.Read(InvId, ProfileNr)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Update(InvId As Integer, ProfileNr As Integer, descr As String, ProfileData As String) As Boolean
If InvId <= 0 Then Return False
If ProfileNr < 0 Then Return False
' If ProfileData.Length <= 0 Then Return False
If String.IsNullOrEmpty(ProfileData) Then Return False
Dim m_ProfileData As Decimal() = New Decimal(95) {}
Dim ar() As String = ProfileData.Split(";")
For y As Integer = 0 To 95
m_ProfileData(y) = CDec(Replace(ar(y), ".", ","))
Next
Return SF.BLL.Inv_Profile.Update(InvId, ProfileNr, descr, m_ProfileData)
End Function
#End Region
#Region "Inv_Profile_Tasks"
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_Add(InvId As Integer,
ProfileNr As Integer,
Subject As String,
StartDate As String,
EndDate As String,
chkMonday As Boolean,
chkTuesday As Boolean,
chkWednesday As Boolean,
chkThursday As Boolean,
chkFriday As Boolean,
chkSaturday As Boolean,
chkSunday As Boolean,
yearsRepeatable As Boolean) As Boolean
If InvId <= 0 Then Return False
If ProfileNr < 0 Then Return False
If String.IsNullOrEmpty(Subject) Then Return False
Return SF.BLL.Inv_Profile_Tasks.Add(InvId, ProfileNr, Subject, StartDate, EndDate, chkMonday, chkTuesday, chkWednesday, chkThursday, chkFriday, chkSaturday, chkSunday, yearsRepeatable)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_Del(TaskId As Integer) As Boolean
If TaskId <= 0 Then Return False
Return SF.BLL.Inv_Profile_Tasks.Del(TaskId)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_List(InvId As Integer) As List(Of Inv_Profile_Tasks)
If InvId <= 0 Then Return Nothing
Return SF.BLL.Inv_Profile_Tasks.List(InvId)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_ListAll() As List(Of Inv_Profile_Tasks)
Return SF.BLL.Inv_Profile_Tasks.ListAll()
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_ListByMonth(InvId As Integer, calYear As Integer, calMonth As Integer) As List(Of Inv_Profile_Tasks)
If InvId <= 0 Then Return Nothing
Return SF.BLL.Inv_Profile_Tasks.ListByMonth(InvId, calYear, calMonth)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_ListByDates(InvId As Integer, startDate As String, endDate As String) As List(Of Inv_Profile_Tasks)
If InvId <= 0 Then Return Nothing
Dim _startDate As Date = CDate(startDate)
Dim a As Date = CDate(endDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
Dim _endDate As Date = DateAdd(DateInterval.Minute, -1, b)
Return SF.BLL.Inv_Profile_Tasks.ListByDates(InvId, _startDate, _endDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_ListCurrent(InvId As Integer, selDate As String) As List(Of Inv_Profile_Tasks)
If InvId <= 0 Then Return Nothing
Dim _selDate As Date = Now
If Not String.IsNullOrEmpty(selDate) Then
_selDate = FormatDateTime(selDate, DateFormat.GeneralDate) ' CDate(selDate)
End If
Return SF.BLL.Inv_Profile_Tasks.ListCurrent(InvId, _selDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_Read(TaskId As Integer) As Inv_Profile_Tasks
If TaskId <= 0 Then Return Nothing
Return SF.BLL.Inv_Profile_Tasks.Read(TaskId)
End Function
<OperationContract()>
<WebGet()>
Public Function Inv_Profile_Tasks_Update(TaskId As Integer,
ProfileNr As Integer,
Subject As String,
StartDate As String,
EndDate As String,
chkMonday As Boolean,
chkTuesday As Boolean,
chkWednesday As Boolean,
chkThursday As Boolean,
chkFriday As Boolean,
chkSaturday As Boolean,
chkSunday As Boolean,
yearsRepeatable As Boolean) As Boolean
If TaskId <= 0 Then Return Nothing
If ProfileNr < 0 Then Return Nothing
If String.IsNullOrEmpty(Subject) Then Return Nothing
Return SF.BLL.Inv_Profile_Tasks.Update(TaskId, ProfileNr, Subject, StartDate, EndDate, chkMonday, chkTuesday, chkWednesday, chkThursday, chkFriday, chkSaturday, chkSunday, yearsRepeatable)
End Function
#End Region
#Region "hist_yearlyPVPower"
<OperationContract()>
<WebGet()>
Public Function hist_yearlyPVPower_ListByMonth(hsId As Integer, anno As Integer) As List(Of hist_yearlyPVPower)
If hsId < 0 Then Return Nothing
Return SF.BLL.hist_yearlyPVPower.ListByMonth(hsId, anno)
End Function
#End Region
#Region "pvgis_prezzo"
<OperationContract()>
<WebGet()>
Public Function pvgis_prezzo_Read(hsId As Integer, anno As Integer) As pvgis_prezzo
' Return SF.BLL.pvgis_prezzo.Read(anno)
Dim retVal As pvgis_prezzo = New pvgis_prezzo
retVal = SF.BLL.pvgis_prezzo.Read(hsId, anno)
If retVal Is Nothing Then
retVal = New pvgis_prezzo
End If
Return retVal
End Function
<OperationContract()>
<WebGet()>
Public Function pvgis_prezzo_List(anno As Integer) As List(Of pvgis_prezzo)
Return SF.BLL.pvgis_prezzo.List(anno)
End Function
<OperationContract()>
<WebGet()>
Public Function pvgis_prezzo_Add(hsId As Integer,
anno As Integer,
pvgis_1 As Decimal, prezzo_1 As Decimal, tariffa_1 As Decimal, E_ceduta_1 As Decimal, E_Attesa_1 As Decimal,
pvgis_2 As Decimal, prezzo_2 As Decimal, tariffa_2 As Decimal, E_ceduta_2 As Decimal, E_Attesa_2 As Decimal,
pvgis_3 As Decimal, prezzo_3 As Decimal, tariffa_3 As Decimal, E_ceduta_3 As Decimal, E_Attesa_3 As Decimal,
pvgis_4 As Decimal, prezzo_4 As Decimal, tariffa_4 As Decimal, E_ceduta_4 As Decimal, E_Attesa_4 As Decimal,
pvgis_5 As Decimal, prezzo_5 As Decimal, tariffa_5 As Decimal, E_ceduta_5 As Decimal, E_Attesa_5 As Decimal,
pvgis_6 As Decimal, prezzo_6 As Decimal, tariffa_6 As Decimal, E_ceduta_6 As Decimal, E_Attesa_6 As Decimal,
pvgis_7 As Decimal, prezzo_7 As Decimal, tariffa_7 As Decimal, E_ceduta_7 As Decimal, E_Attesa_7 As Decimal,
pvgis_8 As Decimal, prezzo_8 As Decimal, tariffa_8 As Decimal, E_ceduta_8 As Decimal, E_Attesa_8 As Decimal,
pvgis_9 As Decimal, prezzo_9 As Decimal, tariffa_9 As Decimal, E_ceduta_9 As Decimal, E_Attesa_9 As Decimal,
pvgis_10 As Decimal, prezzo_10 As Decimal, tariffa_10 As Decimal, E_ceduta_10 As Decimal, E_Attesa_10 As Decimal,
pvgis_11 As Decimal, prezzo_11 As Decimal, tariffa_11 As Decimal, E_ceduta_11 As Decimal, E_Attesa_11 As Decimal,
pvgis_12 As Decimal, prezzo_12 As Decimal, tariffa_12 As Decimal, E_ceduta_12 As Decimal, E_Attesa_12 As Decimal) As Boolean
Return SF.BLL.pvgis_prezzo.Add(hsId, anno,
pvgis_1, prezzo_1, tariffa_1, E_ceduta_1, E_Attesa_1,
pvgis_2, prezzo_2, tariffa_2, E_ceduta_2, E_Attesa_2,
pvgis_3, prezzo_3, tariffa_3, E_ceduta_3, E_Attesa_3,
pvgis_4, prezzo_4, tariffa_4, E_ceduta_4, E_Attesa_4,
pvgis_5, prezzo_5, tariffa_5, E_ceduta_5, E_Attesa_5,
pvgis_6, prezzo_6, tariffa_6, E_ceduta_6, E_Attesa_6,
pvgis_7, prezzo_7, tariffa_7, E_ceduta_7, E_Attesa_7,
pvgis_8, prezzo_8, tariffa_8, E_ceduta_8, E_Attesa_8,
pvgis_9, prezzo_9, tariffa_9, E_ceduta_9, E_Attesa_9,
pvgis_10, prezzo_10, tariffa_10, E_ceduta_10, E_Attesa_10,
pvgis_11, prezzo_11, tariffa_11, E_ceduta_11, E_Attesa_11,
pvgis_12, prezzo_12, tariffa_12, E_ceduta_12, E_Attesa_12)
End Function
<OperationContract()>
<WebGet()>
Public Function pvgis_prezzo_Update(hsId As Integer,
anno As Integer,
pvgis_1 As Decimal, prezzo_1 As Decimal, tariffa_1 As Decimal, E_ceduta_1 As Decimal, E_Attesa_1 As Decimal,
pvgis_2 As Decimal, prezzo_2 As Decimal, tariffa_2 As Decimal, E_ceduta_2 As Decimal, E_Attesa_2 As Decimal,
pvgis_3 As Decimal, prezzo_3 As Decimal, tariffa_3 As Decimal, E_ceduta_3 As Decimal, E_Attesa_3 As Decimal,
pvgis_4 As Decimal, prezzo_4 As Decimal, tariffa_4 As Decimal, E_ceduta_4 As Decimal, E_Attesa_4 As Decimal,
pvgis_5 As Decimal, prezzo_5 As Decimal, tariffa_5 As Decimal, E_ceduta_5 As Decimal, E_Attesa_5 As Decimal,
pvgis_6 As Decimal, prezzo_6 As Decimal, tariffa_6 As Decimal, E_ceduta_6 As Decimal, E_Attesa_6 As Decimal,
pvgis_7 As Decimal, prezzo_7 As Decimal, tariffa_7 As Decimal, E_ceduta_7 As Decimal, E_Attesa_7 As Decimal,
pvgis_8 As Decimal, prezzo_8 As Decimal, tariffa_8 As Decimal, E_ceduta_8 As Decimal, E_Attesa_8 As Decimal,
pvgis_9 As Decimal, prezzo_9 As Decimal, tariffa_9 As Decimal, E_ceduta_9 As Decimal, E_Attesa_9 As Decimal,
pvgis_10 As Decimal, prezzo_10 As Decimal, tariffa_10 As Decimal, E_ceduta_10 As Decimal, E_Attesa_10 As Decimal,
pvgis_11 As Decimal, prezzo_11 As Decimal, tariffa_11 As Decimal, E_ceduta_11 As Decimal, E_Attesa_11 As Decimal,
pvgis_12 As Decimal, prezzo_12 As Decimal, tariffa_12 As Decimal, E_ceduta_12 As Decimal, E_Attesa_12 As Decimal) As Boolean
Return SF.BLL.pvgis_prezzo.Update(hsId, anno,
pvgis_1, prezzo_1, tariffa_1, E_ceduta_1, E_Attesa_1,
pvgis_2, prezzo_2, tariffa_2, E_ceduta_2, E_Attesa_2,
pvgis_3, prezzo_3, tariffa_3, E_ceduta_3, E_Attesa_3,
pvgis_4, prezzo_4, tariffa_4, E_ceduta_4, E_Attesa_4,
pvgis_5, prezzo_5, tariffa_5, E_ceduta_5, E_Attesa_5,
pvgis_6, prezzo_6, tariffa_6, E_ceduta_6, E_Attesa_6,
pvgis_7, prezzo_7, tariffa_7, E_ceduta_7, E_Attesa_7,
pvgis_8, prezzo_8, tariffa_8, E_ceduta_8, E_Attesa_8,
pvgis_9, prezzo_9, tariffa_9, E_ceduta_9, E_Attesa_9,
pvgis_10, prezzo_10, tariffa_10, E_ceduta_10, E_Attesa_10,
pvgis_11, prezzo_11, tariffa_11, E_ceduta_11, E_Attesa_11,
pvgis_12, prezzo_12, tariffa_12, E_ceduta_12, E_Attesa_12)
End Function
#End Region
#Region "EO_InvStr"
<OperationContract()>
<WebGet()>
Public Function EO_InvStr_List(InvId As Integer) As List(Of EO_InvStr)
Return SF.BLL.EO_InvStr.List(InvId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_InvStr_Add(InvId As Integer,
StrId As Integer) As Boolean
Return SF.BLL.EO_InvStr.Add(InvId, StrId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_InvStr_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_InvStr.Del(Id)
End Function
#End Region
#Region "EO_StrPan"
<OperationContract()>
<WebGet()>
Public Function EO_StrPan_List(StrId As Integer) As List(Of EO_StrPan)
Return SF.BLL.EO_StrPan.List(StrId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_StrPan_Add(PanId As Integer,
StrId As Integer) As Boolean
Return SF.BLL.EO_StrPan.Add(PanId, StrId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_StrPan_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_StrPan.Del(Id)
End Function
#End Region
#Region "EO_Inv_AlarmMessages"
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_Add(Id As Integer, DescrIT As String, DescrEN As String, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
If String.IsNullOrEmpty(DescrIT) Then Return False
Return SF.BLL.EO_Inv_AlarmMessages.Add(Id, DescrIT, DescrEN, isAlarm)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv_AlarmMessages.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_List() As List(Of EO_Inv_AlarmMessages)
Return SF.BLL.EO_Inv_AlarmMessages.List
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_Read(Id As Integer) As EO_Inv_AlarmMessages
If Id <= 0 Then Return Nothing
Return SF.BLL.EO_Inv_AlarmMessages.Read(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_Update(Id As Integer, DescrIT As String, DescrEN As String, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
If String.IsNullOrEmpty(DescrIT) Then Return False
Return SF.BLL.EO_Inv_AlarmMessages.Update(Id, DescrIT, DescrEN, isAlarm)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmMessages_setisAlarm(Id As Integer, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Inv_AlarmMessages.setisAlarm(Id, isAlarm)
End Function
#End Region
#Region "EO_Inv_AlarmCodes"
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmCodes_Add(AlarmCode As Integer, MessageId As Integer) As Boolean
If AlarmCode <= 0 Then Return False
If MessageId <= 0 Then Return False
Return SF.BLL.EO_Inv_AlarmCodes.Add(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmCodes_Del(AlarmCode As Integer, MessageId As Integer) As Boolean
If AlarmCode <= 0 Then Return False
If MessageId <= 0 Then Return False
Return SF.BLL.EO_Inv_AlarmCodes.Del(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmCodes_Read(AlarmCode As Integer, MessageId As Integer) As EO_Inv_AlarmCodes
If AlarmCode <= 0 Then Return Nothing
If MessageId <= 0 Then Return Nothing
Return SF.BLL.EO_Inv_AlarmCodes.Read(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_AlarmCodes_ReadByAlarmCode(AlarmCode As Integer) As EO_Inv_AlarmCodes
If AlarmCode <= 0 Then Return Nothing
Return SF.BLL.EO_Inv_AlarmCodes.ReadByAlarmCode(AlarmCode)
End Function
#End Region
#Region "EO_Inv_Status"
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_Add(Cod As Integer, Descr As String) As Boolean
Return SF.BLL.EO_Inv_Status.Add(Cod, Descr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_Del(Cod As Integer) As Boolean
If Cod <= 0 Then Return False
Return SF.BLL.EO_Inv_Status.Del(Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_List() As List(Of EO_Inv_Status)
Return SF.BLL.EO_Inv_Status.List()
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_Read(Cod As Integer) As EO_Inv_Status
If Cod <= 0 Then Return Nothing
Return SF.BLL.EO_Inv_Status.Read(Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_Update(Cod As Integer, Descr As String) As Boolean
If Cod <= 0 Then Return False
Return SF.BLL.EO_Inv_Status.Update(Cod, Descr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Inv_Status_setisAlarm(Cod As Integer, isAlarm As Boolean) As Boolean
' If Cod <= 0 Then Return False
Return SF.BLL.EO_Inv_Status.setisAlarm(Cod, isAlarm)
End Function
#End Region
#Region "EO_Str"
<OperationContract()>
<WebGet()>
Public Function EO_Str_Add(hsId As Integer, Cod As String, Descr As String, marcamodello As String, installationDate As String) As Integer
If hsId <= 0 Then Return False
If String.IsNullOrEmpty(Cod) Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Str.Add(hsId, Cod, Descr, marcamodello, _installationDate)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Str.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_List(hsId As Integer) As List(Of EO_Str)
If hsId <= 0 Then Return Nothing
' Return Nothing
Return SF.BLL.EO_Str.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_Read(Id As Integer) As EO_Str
If Id <= 0 Then Return Nothing
Return SF.BLL.EO_Str.Read(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_ReadByCod(hsId As Integer, Cod As String) As EO_Str
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(Cod) Then Return Nothing
Return SF.BLL.EO_Str.ReadByCod(hsId, Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_Update(Id As Integer, Cod As String, Descr As String, marcamodello As String, installationDate As String) As Boolean
If Id <= 0 Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Str.Update(Id, Cod, Descr, marcamodello, installationDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Eo_Str_setGetoLocation(Id As Integer, Latitude As Decimal, Longitude As Decimal) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Str.setGetoLocation(Id, Latitude, Longitude)
End Function
#End Region
#Region "Log_EO_Str"
<OperationContract()>
<WebGet()>
Public Function Log_EO_Str_List(hsId As Integer, Cod As String, fromDate As String, toDate As String) As List(Of Log_EO_Str)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _fromDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(fromDate) Then
_fromDate = CDate(fromDate)
End If
Dim _toDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_toDate) Then
Dim a As Date = CDate(toDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_toDate = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.Log_EO_Str.List(hsId, Cod, _fromDate, _toDate)
End Function
<OperationContract()>
<WebGet()>
Public Function Log_EO_Str_ListPaged(hsId As Integer, Cod As String, fromDate As String, toDate As String, rowNumber As Integer) As List(Of Log_EO_Str)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _fromDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(fromDate) Then
_fromDate = CDate(fromDate)
End If
Dim _toDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_toDate) Then
Dim a As Date = CDate(toDate)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_toDate = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.Log_EO_Str.ListPaged(hsId, Cod, _fromDate, _toDate, rowNumber)
End Function
#End Region
#Region "EO_Pan"
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Add(hsId As Integer,
Cod As String,
Descr As String,
ChannelId As Integer,
marcamodello As String,
installationDate As String,
PanelNum As Integer,
UserName As String) As Integer
If hsId <= 0 Then Return False
If String.IsNullOrEmpty(Cod) Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Pan.Add(hsId, Cod, Descr, ChannelId, marcamodello, _installationDate, PanelNum, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Update(Id As Integer, Cod As String, Descr As String, ChannelId As Integer, marcamodello As String, installationDate As String, PanelNum As Integer, UserName As String) As Boolean
If Id <= 0 Then Return False
Dim _installationDate As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(installationDate) Then
_installationDate = installationDate
End If
Return SF.BLL.EO_Pan.Update(Id, Cod, Descr, ChannelId, marcamodello, _installationDate, PanelNum, UserName)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_List(hsId As Integer) As List(Of EO_Pan)
If hsId <= 0 Then Return Nothing
' Return Nothing
Return SF.BLL.EO_Pan.List(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_ListByIdInv(IdInv As Integer) As List(Of EO_Pan)
If IdInv <= 0 Then Return Nothing
Return SF.BLL.EO_Pan.ListByIdInv(IdInv)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_ListByCodInv(hsId As Integer, CodInv As String) As List(Of EO_Pan)
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(CodInv) Then Return Nothing
Return SF.BLL.EO_Pan.ListByCodInv(hsId, CodInv)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_ListByIdStr(IdStr As Integer) As List(Of EO_Pan)
If IdStr <= 0 Then Return Nothing
Return SF.BLL.EO_Pan.ListByIdStr(IdStr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_ListByCodStr(hsId As Integer, CodStr As String) As List(Of EO_Pan)
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(CodStr) Then Return Nothing
Return SF.BLL.EO_Pan.ListByCodStr(hsId, CodStr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Read(Id As Integer) As EO_Pan
If Id <= 0 Then Return Nothing
Return SF.BLL.EO_Pan.Read(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_ReadByCod(hsId As Integer, Cod As String) As EO_Pan
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(Cod) Then Return Nothing
Return SF.BLL.EO_Pan.ReadByCod(hsId, Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_setGetoLocation(Id As Integer, Latitude As Decimal, Longitude As Decimal) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Pan.setGetoLocation(Id, Latitude, Longitude)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_inv(hsId As Integer, Cod As String) As Decimal
Return SF.BLL.EO_Pan.Sum_inv(hsId, Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_Str(hsId As Integer, Cod As String) As Decimal
Return SF.BLL.EO_Pan.Sum_Str(hsId, Cod)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_TotPanByIdInv(IdInv As Integer) As Integer
If IdInv <= 0 Then Return 0
Return SF.BLL.EO_Pan.TotPanByIdInv(IdInv)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_TotPanByCodInv(hsId As Integer, CodInv As String) As Integer
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(CodInv) Then Return Nothing
Return SF.BLL.EO_Pan.TotPanByCodInv(hsId, CodInv)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_TotPanByIdStr(IdStr As Integer) As Integer
If IdStr <= 0 Then Return 0
Return SF.BLL.EO_Pan.TotPanByIdStr(IdStr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Sum_TotPanByCodStr(hsId As Integer, CodStr As String) As Integer
If hsId <= 0 Then Return Nothing
If String.IsNullOrEmpty(CodStr) Then Return Nothing
Return SF.BLL.EO_Pan.TotPanByCodStr(hsId, CodStr)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Pan_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Pan.Del(Id)
End Function
#End Region
#Region "EO_inv_Stat_PvPower"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_PvPower_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_PvPower)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_PvPower.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "EO_inv_Stat_Temp"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_Temp_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_Temp)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_Temp.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "EO_inv_Stat_Freq"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_Freq_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_Freq)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_Freq.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "EO_inv_Stat_RMS_V"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_RMS_V_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_RMS_V)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_RMS_V.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "EO_inv_Stat_RMS_I"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_RMS_I_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_RMS_I)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_RMS_I.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "EO_inv_Stat_RMS_P"
<OperationContract()>
<WebGet()>
Public Function EO_inv_Stat_RMS_P_ListbyCod(hsId As Integer, Cod As String, DateFrom As String, DateTo As String) As List(Of EO_inv_Stat_RMS_P)
If hsId <= 0 Then
Return Nothing
End If
If String.IsNullOrEmpty(Cod) Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
'Dim aa As Date = CDate(DateFrom)
'Dim bb As Date = DateAdd(DateInterval.Day, -1, aa)
'_DateFrom = DateAdd(DateInterval.Minute, 1, bb)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.EO_inv_Stat_RMS_P.ListbyCod(hsId, Cod, _DateFrom, _DateTo)
End Function
#End Region
#Region "hist_totPVPower"
<OperationContract()>
<WebGet()>
Public Function hist_totPVPower_List(hsId As Integer, DateFrom As String, DateTo As String) As List(Of hist_totPVPower)
If hsId <= 0 Then
Return Nothing
End If
Dim _DateFrom As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(DateFrom) Then
_DateFrom = CDate(DateFrom)
End If
Dim _DateTo As Date = FormatDateTime("01/01/1900", DateFormat.GeneralDate)
If IsDate(_DateTo) Then
Dim a As Date = CDate(DateTo)
Dim b As Date = DateAdd(DateInterval.Day, 1, a)
_DateTo = DateAdd(DateInterval.Minute, -1, b)
End If
Return SF.BLL.hist_totPVPower.List(hsId, _DateFrom, _DateTo)
End Function
<OperationContract()>
<WebGet()>
Public Function hist_totPVPower_ListAllTime(hsId As Integer) As Decimal
If hsId <= 0 Then
Return Nothing
End If
Return SF.BLL.hist_totPVPower.ListAllTime(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hist_totPVPower_ListcurrentMonth(hsId As Integer) As Decimal
Return SF.BLL.hist_totPVPower.ListcurrentMonth(hsId)
End Function
<OperationContract()>
<WebGet()>
Public Function hist_totPVPower_ListByMonth(hsId As Integer, anno As Integer) As List(Of hist_totPVPower)
If hsId < 0 Then Return Nothing
Return SF.BLL.hist_totPVPower.ListByMonth(hsId, anno)
End Function
#End Region
#Region "EO_Str_AlarmMessages"
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_Add(Id As Integer, DescrIT As String, DescrEN As String, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
If String.IsNullOrEmpty(DescrIT) Then Return False
Return SF.BLL.EO_Str_AlarmMessages.Add(Id, DescrIT, DescrEN, isAlarm)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_Del(Id As Integer) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Str_AlarmMessages.Del(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_List() As List(Of EO_Str_AlarmMessages)
Return SF.BLL.EO_Str_AlarmMessages.List
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_Read(Id As Integer) As EO_Str_AlarmMessages
If Id <= 0 Then Return Nothing
Return SF.BLL.EO_Str_AlarmMessages.Read(Id)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_Update(Id As Integer, DescrIT As String, DescrEN As String, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
If String.IsNullOrEmpty(DescrIT) Then Return False
Return SF.BLL.EO_Str_AlarmMessages.Update(Id, DescrIT, DescrEN, isAlarm)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmMessages_setisAlarm(Id As Integer, isAlarm As Boolean) As Boolean
If Id <= 0 Then Return False
Return SF.BLL.EO_Str_AlarmMessages.setisAlarm(Id, isAlarm)
End Function
#End Region
#Region "EO_Str_AlarmCodes"
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmCodes_Add(AlarmCode As Integer, MessageId As Integer) As Boolean
If AlarmCode <= 0 Then Return False
If MessageId <= 0 Then Return False
Return SF.BLL.EO_Str_AlarmCodes.Add(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmCodes_Del(AlarmCode As Integer, MessageId As Integer) As Boolean
If AlarmCode <= 0 Then Return False
If MessageId <= 0 Then Return False
Return SF.BLL.EO_Str_AlarmCodes.Del(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmCodes_Read(AlarmCode As Integer, MessageId As Integer) As EO_Str_AlarmCodes
If AlarmCode <= 0 Then Return Nothing
If MessageId <= 0 Then Return Nothing
Return SF.BLL.EO_Str_AlarmCodes.Read(AlarmCode, MessageId)
End Function
<OperationContract()>
<WebGet()>
Public Function EO_Str_AlarmCodes_ReadByAlarmCode(AlarmCode As Integer) As EO_Str_AlarmCodes
If AlarmCode <= 0 Then Return Nothing
Return SF.BLL.EO_Str_AlarmCodes.ReadByAlarmCode(AlarmCode)
End Function
#End Region
#Region "Energy_Aggregazione"
<OperationContract()>
<WebGet()>
Public Function Energy_Aggregazione_SumMonth(hsId As Integer, Mese As Integer, Anno As Integer) As Energy_Aggregazione
If hsId <= 0 Then Return Nothing
If Mese <= 0 Then Return Nothing
If Anno <= 0 Then Return Nothing
Return SF.BLL.Energy_Aggregazione.SumMonth(hsId, Mese, Anno)
End Function
<OperationContract()>
<WebGet()>
Public Function Energy_Aggregazione_SumYear(hsId As Integer, Anno As Integer) As Energy_Aggregazione
If hsId <= 0 Then Return Nothing
If Anno <= 0 Then Return Nothing
Return SF.BLL.Energy_Aggregazione.SumYear(hsId, Anno)
End Function
<OperationContract()>
<WebGet()>
Public Function Energy_Aggregazione_SumMonthList(hsId As Integer, Mese As Integer, Anno As Integer) As List(Of Energy_Aggregazione)
If hsId <= 0 Then Return Nothing
If Mese <= 0 Then Return Nothing
If Anno <= 0 Then Return Nothing
Return SF.BLL.Energy_Aggregazione.SumMonthList(hsId, Mese, Anno)
End Function
#End Region
#Region "Impianti_RemoteConnections"
<OperationContract()>
<WebGet()>
Public Function Impianti_RemoteConnections_Add(IdImpianto As String, Descr As String, remoteaddress As String, remotePort As Integer, connectionType As Integer, NoteInterne As String) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If String.IsNullOrEmpty(Descr) Then
Return False
End If
Dim IdAddress As Integer = SF.BLL.Impianti_RemoteConnections.getLastId() + 1
Return SF.BLL.Impianti_RemoteConnections.Add(IdImpianto, IdAddress, Descr, remoteaddress, remotePort, connectionType, NoteInterne)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_RemoteConnections_Del(IdImpianto As String, IdAddress As Integer) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If IdAddress <= 0 Then
Return False
End If
Return SF.BLL.Impianti_RemoteConnections.Del(IdImpianto, IdAddress)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_RemoteConnections_List(IdImpianto As String) As List(Of Impianti_RemoteConnections)
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
Return SF.BLL.Impianti_RemoteConnections.List(IdImpianto)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_RemoteConnections_Read(IdImpianto As String, IdAddress As Integer) As Impianti_RemoteConnections
If String.IsNullOrEmpty(IdImpianto) Then
Return Nothing
End If
If IdAddress <= 0 Then
Return Nothing
End If
Return SF.BLL.Impianti_RemoteConnections.Read(IdImpianto, IdAddress)
End Function
<OperationContract()>
<WebGet()>
Public Function Impianti_RemoteConnections_Upd(IdImpianto As String, IdAddress As Integer, Descr As String, remoteaddress As String, remotePort As Integer, connectionType As Integer, NoteInterne As String) As Boolean
If String.IsNullOrEmpty(IdImpianto) Then
Return False
End If
If IdAddress <= 0 Then
Return False
End If
Return SF.BLL.Impianti_RemoteConnections.Upd(IdImpianto, IdAddress, Descr, remoteaddress, remotePort, connectionType, NoteInterne)
End Function
#End Region
End Class
|
Imports DTIServerControls
Public Class ChangePassword
Inherits DTIServerBase
Private _CurrentUser As dsDTIAdminPanel.DTIUsersRow
''' <summary>
''' User to change password for
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.Description("User to change password for")> _
Public Property CurrentUser As dsDTIAdminPanel.DTIUsersRow
Get
Return _CurrentUser
End Get
Set(value As dsDTIAdminPanel.DTIUsersRow)
_CurrentUser = value
End Set
End Property
Private _EmailText As String = Nothing
Public Property EmailText As String
Get
Return _EmailText
End Get
Set(value As String)
_EmailText = value
End Set
End Property
Private _EmailSubject As String = Nothing
Public Property EmailSubject As String
Get
Return _EmailSubject
End Get
Set(value As String)
_EmailSubject = value
End Set
End Property
Private _DisableDefaultStyle As Boolean
''' <summary>
''' Remove defualt style of change password control
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<System.ComponentModel.Description("Remove defualt style of change password control")> _
Public Property DisableDefaultStyle As Boolean
Get
Return _DisableDefaultStyle
End Get
Set(value As Boolean)
_DisableDefaultStyle = value
End Set
End Property
Public Event NoUserFound()
Public Event PasswordChanged()
Private WithEvents pwChange As New ChangePasswordControl
Private Sub ChangePassword_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim pantheman As New Panel
Me.Controls.Add(pantheman)
pwChange = CType(Me.Page.LoadControl("~/res/DTIAdminPanel/ChangePasswordControl.ascx"), ChangePasswordControl)
With pwChange
.CurrentUser = CurrentUser
.EmailSubject = EmailSubject
.EmailText = EmailText
End With
pantheman.Controls.Add(pwChange)
If Not DisableDefaultStyle Then
'jQueryLibrary.jQueryInclude.addStyleBlock(Page, ".Kurk-login {width:240px} " & _
' ".Kurk-Spacer {clear:both; height:10px} " & _
' ".Kurk-Error {width: 240px} " & _
' ".Kurk-tbUser {width: 240px} " & _
' ".Kurk-tbPass { width: 240px} " & _
' ".Kurk-Remember {font-size: .8em;float:left} " & _
' ".Kurk-btnLogin {float:right} " & _
' ".Kurk-Forgot {font-size: .8em} ")
End If
End Sub
Private Sub pwChange_NoUserFound() Handles pwChange.NoUserFound
RaiseEvent NoUserFound()
End Sub
Private Sub ChangePassword_PasswordChanged() Handles Me.PasswordChanged
RaiseEvent PasswordChanged()
End Sub
End Class
|
Namespace Drawing
''' <summary>
''' Представляет столбец таблицы, отображаемой на странице PDF.
''' </summary>
Public Class ColumnObject
Enum AlignmentHorisontal
Left = 0
Center = 1
Right = 2
End Enum
Public Property Name As String
Public Property Width As Double
Public Property AlignmentH As AlignmentHorisontal
End Class
End Namespace
|
#Region "Microsoft.VisualBasic::ca1e2d8d2e0bc8aaf1fe0a2f3bf22421, mzkit\src\mzmath\ms2_math-core\Spectra\Alignment\JaccardAlignment.vb"
' Author:
'
' xieguigang (gg.xie@bionovogene.com, BioNovoGene Co., LTD.)
'
' Copyright (c) 2018 gg.xie@bionovogene.com, BioNovoGene Co., LTD.
'
'
' MIT License
'
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
' /********************************************************************************/
' Summaries:
' Code Statistics:
' Total Lines: 34
' Code Lines: 25
' Comment Lines: 0
' Blank Lines: 9
' File Size: 1.31 KB
' Class JaccardAlignment
'
' Constructor: (+1 Overloads) Sub New
' Function: (+2 Overloads) GetScore
'
'
' /********************************************************************************/
#End Region
Imports System.Runtime.CompilerServices
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Ms1
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Spectra.Xml
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.Linq
Namespace Spectra
Public Class JaccardAlignment : Inherits AlignmentProvider
ReadOnly topSet As Integer
Public Sub New(mzwidth As Tolerance, intocutoff As LowAbundanceTrimming, Optional topSet As Integer = 5)
MyBase.New(mzwidth, intocutoff)
Me.topSet = topSet
End Sub
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Overrides Function GetScore(a As ms2(), b As ms2()) As Double
Return GlobalAlignment.JaccardIndex(a, b, mzwidth, topSet)
End Function
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Overrides Function GetScore(alignment() As SSM2MatrixFragment) As (forward As Double, reverse As Double)
Dim j = GetJaccardScore(alignment, topSet)
Return (j, j)
End Function
Public Shared Function GetJaccardScore(alignment() As SSM2MatrixFragment, Optional topSet As Integer = 5) As Double
Dim q = (From t As SSM2MatrixFragment
In alignment
Order By t.query Descending
Take topSet
Where t.query > 0
Select t).ToArray
Dim r = (From t As SSM2MatrixFragment
In alignment
Order By t.ref Descending
Take topSet
Where t.ref > 0
Select t).ToArray
Static NA As Index(Of String) = {"NA", "n/a", "NaN"}
alignment = q.JoinIterates(r).Distinct.ToArray
Dim intersect As Integer = Aggregate a As SSM2MatrixFragment
In alignment
Where Not a.da Like NA
Into Count
Dim union As Integer = alignment.Length
Dim J As Double = intersect / union
Return J
End Function
End Class
End Namespace
|
Public Class checkPhoneNumber
Dim phoneNumber As String
Dim validSubmission As Boolean = True
Dim errorMessage As String = ""
Sub New(ByVal inputPhoneNumber As String)
phoneNumber = inputPhoneNumber
End Sub
Sub checkPhoneNumber()
Trim(phoneNumber)
If phoneNumber.Length <> 0 Then
'IF PHONE IS NOT 0 THEN CONTINUE
If (phoneNumber.Length <> 10 Or Not (IsNumeric(phoneNumber.Length))) Then
'IF PHONE IS NOT TEN DIGITS THEN DISPLAY ERROR
validSubmission = False
errorMessage = "Phone number must be numeric; " + _
"no symbols (dashes, hypens, parentheses, etc)." + vbCrLf
Else
'IF PHONE IS TEN DIGITS, NO ERROR
End If
Else
'DO NOTHING
End If
End Sub
Function getValidSubmission()
Return validSubmission
End Function
Function getErrorMessage()
Return errorMessage
End Function
End Class
|
Sub activateribbon()
' Purpose: Macro to show Excel in its regular state (Display ribbon, formula bar, and worksheets)
' Author: Orlando Mezquita
' Date: 19JAN15
ActiveWindow.DisplayHeadings = True
Application.DisplayFullScreen = False
Application.DisplayFormulaBar = True
ActiveWindow.DisplayWorkbookTabs = True
End Sub
|
Option Explicit On
Option Strict On
''' -----------------------------------------------------------------------------
''' <project>Iniciar Aplicación con MS Windows</project>
''' <class>IniciarWindows</class>
''' <autor>Guido Ramirez</autor>
''' <date>07/OCT/2014</date>
''' <Propietario>IshidayAsociados</Propietario>
''' -----------------------------------------------------------------------------
'''
''' <summary>
''' Permite que la aplicacion inicie al arrancar he iniciar sesion en MS Windows
''' </summary>
Imports Microsoft
Imports Microsoft.Win32
Imports Microsoft.Win32.Registry
Public Class IniciarWindows
Private Function start_Up(ByVal bCrear As Boolean) As String
' clave del registro para
' colocar el path del ejecutable para iniciar con windows
Const CLAVE As String = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
'ProductName : el nombre del programa.
Dim subClave As String = Application.ProductName.ToString
' Mensaje para retornar el resultado
Dim msg As String = ""
Try
' Abre la clave del usuario actual (CurrentUser) para poder extablecer el dato
' si la clave CurrentVersion\Run no existe la crea
Dim Registro As RegistryKey = CurrentUser.CreateSubKey(CLAVE, RegistryKeyPermissionCheck.ReadWriteSubTree)
With Registro
.OpenSubKey(CLAVE, True)
Select Case bCrear
' Crear
'--------------------------------------------------------------------------------------------
Case True
' Escribe el path con SetValue
'Valores : ProductName el nombre del programa y ExecutablePath : la ruta del exe
.SetValue(subClave, _
Application.ExecutablePath.ToString)
Return "Ok .. clave añadida"
' Eliminar
'--------------------------------------------------------------------------------------------
'Elimina la entrada con DeleteValue
Case False
If .GetValue(subClave, "").ToString <> "" Then
.DeleteValue(subClave) ' eliminar
msg = "Ok .. clave eliminada"
Else
msg = "No se eliminó , por que el programa" & _
" no iniciaba con windows"
End If
End Select
End With
' Error
'--------------------------------------------------------------------------------------------
Catch ex As Exception
msg = ex.Message.ToString
End Try
'retorno
Return msg
End Function
Public Sub IniciarConWindows()
start_Up(True)
End Sub
Public Sub NoIniciarConWindows()
start_Up(False)
End Sub
End Class
|
Imports BVSoftware.Bvc5.Core
Imports System.Data
Imports System.Collections.ObjectModel
Partial Class Kit_Edit_Categories
Inherits BaseAdminPage
Protected Sub Page_PreInit1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Me.PageTitle = "Edit Kit Categories"
Me.CurrentTab = AdminTabType.Catalog
ValidateCurrentUserHasPermission(Membership.SystemPermissions.CatalogView)
End Sub
Sub Page_Load(ByVal Sender As Object, ByVal E As EventArgs) Handles MyBase.Load
If Not Page.IsPostBack() Then
Dim EditID As String
EditID = Request.QueryString("id")
If EditID.Trim.Length < 1 Then
msg.ShowError("Unable to load the requested kit.")
Else
Dim p As New Catalog.Product
p = Catalog.InternalProduct.FindByBvin(EditID)
If Not p Is Nothing Then
ViewState("ID") = EditID
lblProductName.Text = p.Sku & " " & p.ProductName
Else
msg.ShowError("Unable to load the requested kit.")
End If
p = Nothing
End If
LoadCategories()
End If
End Sub
Sub LoadCategories()
chkCategories.Items.Clear()
Dim t As Collection(Of Catalog.Category) = Catalog.InternalProduct.GetCategories(Request.QueryString("ID"))
Dim tree As Collection(Of ListItem) = Catalog.Category.ListFullTreeWithIndents(True)
For Each li As ListItem In tree
Me.chkCategories.Items.Add(li)
Next
For Each ca As Catalog.Category In t
'Dim ca As Catalog.Category = Catalog.Category.FindByBvin(mydatarow.Item(0).ToString)
For Each l As ListItem In chkCategories.Items
If l.Value = ca.Bvin Then
l.Selected = True
End If
Next
Next
End Sub
Private Sub SaveSettings()
Catalog.Category.RemoveProductFromAll(Request.QueryString("id").ToString)
Dim li As ListItem
For Each li In chkCategories.Items
If li.Selected = True Then
Catalog.Category.AddProduct(li.Value, Request.QueryString("id").ToString)
Else
Catalog.Category.RemoveProduct(li.Value, Request.QueryString("id").ToString)
End If
Next
End Sub
Private Sub CancelButton_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles CancelButton.Click
Cancel()
End Sub
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles SaveButton.Click
Save()
End Sub
Private Sub Cancel()
Response.Redirect("Kit_Edit.aspx?id=" & ViewState("ID"))
End Sub
Protected Sub Save()
SaveSettings()
Response.Redirect("Kit_Edit.aspx?id=" & ViewState("ID"))
End Sub
End Class
|
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Security.Policy
Imports System.Data.SqlClient
Imports System.Security.Permissions
Imports System.Web.Security
Namespace Admin
<PrincipalPermission(SecurityAction.Demand, Authenticated := True, Role := "Super Administrator")> _
Public Partial Class ManageUsers
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
Dim aID As Guid = getApplicationID()
SqlDataSource1.SelectParameters("ApplicationId").DefaultValue = aID.ToString()
GridView1.DataBind()
End Sub
' Get the applicationID from Applications table.
Private Function getApplicationID() As Guid
Dim appName As String = "cmsCCSLABS"
Dim aID As New Guid()
Try
' Connect to Database
Dim conn As New SqlConnection(SqlDataSource1.ConnectionString)
Dim command As New SqlCommand("SELECT (ApplicationId) FROM aspnet_Applications WHERE ApplicationName='" & appName & "';", conn)
conn.Open()
aID = CType(command.ExecuteScalar(), Guid)
conn.Close()
' Add the error message on the page here.
Catch ex As Exception
End Try
Return aID
End Function
Protected Sub lbAdd_Click(sender As Object, e As EventArgs)
panelMessages.Visible = False
lblMessages.Text = ""
Try
' Email address must be unique - see web.config
Membership.CreateUser(tbMembersName.Text, tbPassword.Text, "2Unique@Email.com")
Catch ex As Exception
lblMessages.Text = ex.Message
panelMessages.Visible = True
End Try
tbMembersName.Text = ""
tbPassword.Text = ""
End Sub
Protected Sub textChanged(sender As Object, e As EventArgs)
panelMessages.Visible = False
lblMessages.Text = ""
End Sub
End Class
End Namespace
|
Imports System.Data
Imports System.Xml
Namespace Talent.TradingPortal
Public Class XmlAddLoyaltyPointsResponse
Inherits XmlResponse
Private ndLoyaltyPoints, ndItem, ndheader, ndHeaderRootHeader As XmlNode
Private ndCustomerNo, ndProductCode, ndDate, ndTime, ndStand, ndArea, ndRow, ndSeat, ndPoints, ndSuccess, ndReturnCode As XmlNode
Protected Overrides Sub InsertBodyV1()
Try
If ResultDataSet IsNot Nothing Then
If ResultDataSet.Tables.Count > 0 Then
If ResultDataSet.Tables(0).Rows.Count > 0 Then
With MyBase.xmlDoc
ndLoyaltyPoints = .CreateElement("LoyaltyPoints")
End With
CreateItemNodes()
End If
End If
End If
Const c1 As String = "//" ' Constants are faster at run time
Const c2 As String = "/TransactionHeader"
ndheader = MyBase.xmlDoc.SelectSingleNode(c1 & RootElement())
ndHeaderRootHeader = MyBase.xmlDoc.SelectSingleNode(c1 & RootElement() & c2)
ndheader.InsertAfter(ndLoyaltyPoints, ndHeaderRootHeader)
Catch ex As Exception
Const strError As String = "Failed to create the response xml"
With Err
.ErrorMessage = ex.Message
.ErrorStatus = strError
.ErrorNumber = "TTPRSLY-01"
.HasError = True
End With
End Try
End Sub
Protected Sub CreateItemNodes()
For Each row As DataRow In ResultDataSet.Tables(0).Rows
With MyBase.xmlDoc
ndItem = .CreateElement("Item")
ndCustomerNo = .CreateElement("CustomerNumber")
ndProductCode = .CreateElement("ProductCode")
ndDate = .CreateElement("Date")
ndTime = .CreateElement("Time")
ndStand = .CreateElement("StandCode")
ndArea = .CreateElement("AreaCode")
ndRow = .CreateElement("Row")
ndSeat = .CreateElement("Seat")
ndPoints = .CreateElement("Points")
ndReturnCode = .CreateElement("ReturnCode")
ndSuccess = .CreateElement("Success")
End With
ndCustomerNo.InnerText = row("CustomerNumber").ToString
ndProductCode.InnerText = row("ProductCode").ToString
ndDate.InnerText = row("Date").ToString
ndTime.InnerText = row("Time").ToString
ndStand.InnerText = row("Stand").ToString
ndArea.InnerText = row("Area").ToString
ndRow.InnerText = row("Row").ToString
ndSeat.InnerText = row("Seat").ToString
ndPoints.InnerText = row("Points").ToString
ndReturnCode.InnerText = row("ReturnCode").ToString
ndSuccess.InnerText = row("Success").ToString
With ndItem
.AppendChild(ndCustomerNo)
.AppendChild(ndProductCode)
.AppendChild(ndDate)
.AppendChild(ndTime)
.AppendChild(ndStand)
.AppendChild(ndArea)
.AppendChild(ndRow)
.AppendChild(ndSeat)
.AppendChild(ndPoints)
.AppendChild(ndReturnCode)
.AppendChild(ndSuccess)
End With
ndLoyaltyPoints.AppendChild(ndItem)
Next
End Sub
End Class
End Namespace |
Imports System.Data.SqlClient
Imports Cerberus
Public Class CuentaXPeriodo
Implements InterfaceTablas
Private conex As ConexionSQL
Private Ambiente As AmbienteCls
Public idCuentaXPeriodo As Integer
Public tipoCuenta As String
Public monto As Decimal
Public idEmpresa As Integer
Public idSucursal As Integer
Public noDocumento As String
Public fechaCuenta As Date
Public creado As DateTime
Public actualizado As DateTime
Public creadoPor As Integer
Public actualizadoPor As Integer
Public estado As String 'BO = Borrador, CO = Completo, CA=Cancelado
Public idEmpleado As Integer
Public numeroPeriodos As Integer
Public montoXPeriodo As Decimal
Public descripccionCuenta As String
Public esActivo As Boolean
Public idConceptoCuenta As Integer
Public idError As Integer
Public descripError As String
Private consec As Consecutivo
Public Sub New(Ambiente As AmbienteCls)
Me.Ambiente = Ambiente
Me.conex = Ambiente.conex
End Sub
Public Sub seteaDatos(rdr As SqlDataReader) Implements InterfaceTablas.seteaDatos
idCuentaXPeriodo = rdr("idCuentaXPeriodo")
tipoCuenta = rdr("tipoCuenta")
monto = rdr("monto")
idEmpresa = rdr("idEmpresa")
idSucursal = rdr("idSucursal")
noDocumento = rdr("noDocumento")
fechaCuenta = rdr("fechaCuenta")
creado = rdr("creado")
actualizado = rdr("actualizado")
creadoPor = rdr("creadoPor")
actualizadoPor = rdr("actualizadoPor")
estado = rdr("estado")
idEmpleado = rdr("idEmpleado")
numeroPeriodos = rdr("numeroPeriodos")
montoXPeriodo = rdr("montoXPeriodo")
descripccionCuenta = rdr("descripccionCuenta")
esActivo = rdr("esActivo")
idConceptoCuenta = rdr("idConceptoCuenta")
End Sub
Public Function guardar() As Boolean Implements InterfaceTablas.guardar
Return armaQry("INSERT", True)
End Function
Public Function actualizar() As Boolean Implements InterfaceTablas.actualizar
Return armaQry("UPDATE", False)
End Function
Private Function armaQry(accion As String, esInsert As Boolean) As Boolean Implements InterfaceTablas.armaQry
If validaDatos(esInsert) Then
conex.numCon = 0
conex.tabla = "CuentaXPeriodo"
conex.accion = accion
conex.agregaCampo("tipoCuenta", tipoCuenta, False, False)
conex.agregaCampo("monto", monto, False, False)
conex.agregaCampo("idEmpresa", idEmpresa, False, False)
conex.agregaCampo("idSucursal", idSucursal, False, False)
conex.agregaCampo("noDocumento", noDocumento, False, False)
conex.agregaCampo("fechaCuenta", fechaCuenta, False, False)
conex.agregaCampo("estado", estado, False, False)
conex.agregaCampo("idEmpleado", idEmpleado, False, False)
If esInsert Then
conex.agregaCampo("creado", "CURRENT_TIMESTAMP", False, True)
conex.agregaCampo("creadoPor", creadoPor, False, False)
End If
conex.agregaCampo("actualizado", "CURRENT_TIMESTAMP", False, True)
conex.agregaCampo("actualizadoPor", actualizadoPor, False, False)
conex.agregaCampo("numeroPeriodos", numeroPeriodos, False, False)
conex.agregaCampo("montoXPeriodo", montoXPeriodo, False, False)
conex.agregaCampo("descripccionCuenta", descripccionCuenta, False, False)
conex.agregaCampo("esActivo", esActivo, False, False)
conex.agregaCampo("idConceptoCuenta", idConceptoCuenta, False, False)
'SI ES INSERT NO SE CONCATENA, no importa ponerlo o no...
conex.condicion = "WHERE idCuentaXPeriodo = " & idCuentaXPeriodo
conex.armarQry()
If conex.ejecutaQry Then
If accion = "INSERT" Then
Return obtenerID()
Else
Return True
End If
Else
idError = conex.idError
descripError = conex.descripError
Return False
End If
Else
Return False
End If
End Function
Public Function obtenerID() As Boolean
conex.numCon = 0
conex.Qry = "SELECT @@IDENTITY as ID"
If conex.ejecutaConsulta() Then
If conex.reader.Read Then
idCuentaXPeriodo = conex.reader("ID")
conex.reader.Close()
Return True
Else
idError = 1
descripError = "No se pudo Obtener el ID"
conex.reader.Close()
Return False
End If
Else
idError = conex.idError
descripError = conex.descripError
Return False
End If
End Function
Public Function getNombreEstado() As String
Return If(estado = "BO", "BORRADOR", If(estado = "CO", "COMPLETO", If(estado = "CA", "CANCELADO", If(estado = "PR", "PROCESADO", "NUEVO"))))
End Function
Public Sub cargaGridCom(dgv As DataGridView, obj As List(Of CuentaXPeriodo), busqueda As String)
Dim condicion As String
condicion = ""
If Not busqueda = Nothing Then
busqueda = busqueda.Replace("*", "%")
condicion = " AND (Concat(Empleado.NombreEmpleado,' ',Empleado.ApPatEmpleado,' ',Empleado.ApMatEmpleado) like '%" & busqueda & "%' "
condicion &= "OR cp.noDocumento like '%" & busqueda & "%' "
condicion &= "OR cp.monto like '%" & busqueda & "%' "
condicion &= "OR cp.estado like '%" & busqueda & "%' "
condicion &= "OR convert(date,cp.fechaCuenta) like '%" & busqueda & "%' "
condicion &= ")"
End If
cargarGridGen(dgv, condicion, obj)
End Sub
Private Sub cargarGridGen(grid As DataGridView, condicion As String, objEmp As List(Of CuentaXPeriodo))
Dim plantilla As CuentaXPeriodo
Dim dtb As New DataTable("CuentaXPeriodo")
Dim row As DataRow
Dim indice As Integer = 0
dtb.Columns.Add("Documento", Type.GetType("System.String"))
dtb.Columns.Add("Empleado", Type.GetType("System.String"))
dtb.Columns.Add("Fecha Cuenta", Type.GetType("System.String"))
dtb.Columns.Add("Total Cuenta", Type.GetType("System.Double"))
dtb.Columns.Add("Estado", Type.GetType("System.String"))
objEmp.Clear()
conex.Qry = "SELECT cp.*,Concat(Empleado.NombreEmpleado,' ',Empleado.ApPatEmpleado,' ',Empleado.ApMatEmpleado) as nEmpleado FROM CuentaXPeriodo AS cp,Empleado WHERE cp.idEmpleado = Empleado.idEmpleado AND cp.idEmpresa = " & idEmpresa & condicion
conex.numCon = 0
If conex.ejecutaConsulta() Then
While conex.reader.Read
plantilla = New CuentaXPeriodo(Ambiente)
plantilla.seteaDatos(conex.reader)
objEmp.Add(plantilla)
row = dtb.NewRow
row("Documento") = plantilla.noDocumento
row("Empleado") = conex.reader("nEmpleado")
row("Fecha Cuenta") = Format(plantilla.fechaCuenta, "dd/MM/yyyy")
row("Total Cuenta") = plantilla.monto
row("Estado") = plantilla.getNombreEstado
dtb.Rows.Add(row)
indice += 1
End While
conex.reader.Close()
grid.DataSource = dtb
'Bloquear REORDENAR
For i As Integer = 0 To grid.Columns.Count - 1
grid.Columns(i).SortMode = DataGridViewColumnSortMode.NotSortable
Next
Else
Mensaje.tipoMsj = TipoMensaje.Error
Mensaje.origen = "Cuenta.cargarGridGen"
Mensaje.Mensaje = conex.descripError
Mensaje.ShowDialog()
End If
End Sub
Public Function eliminar() As Boolean Implements InterfaceTablas.eliminar
If estado = "BO" Then
Return armaQry("DELETE", False)
ElseIf estado = "CO" Then
estado = "CA"
Return armaQry("UPDATE", False)
ElseIf estado = "PR" Then
idError = 1
descripError = "No se puede eliminar la Cuenta debido a que ya se encuentra Procesada."
Return False
Else
Return True
End If
End Function
Public Function buscarPID() As Boolean Implements InterfaceTablas.buscarPID
Throw New NotImplementedException()
End Function
Public Function getDetalleMod() As String Implements InterfaceTablas.getDetalleMod
Return ""
End Function
Public Function validaDatos(nuevo As Boolean) As Boolean Implements InterfaceTablas.validaDatos
consec = New Consecutivo(Ambiente)
consec.idEmpresa = Ambiente.empr.idEmpresa
consec.dato = tipoCuenta
consec.tabla = "CuentaXPeriodo"
If nuevo Then
creadoPor = Ambiente.usuario.idEmpleado
End If
actualizadoPor = Ambiente.usuario.idEmpleado
If noDocumento = Nothing Then
If consec.generaSiguienteConsec Then
noDocumento = consec.siguienteConsecutivo
Return True
Else
idError = consec.idError
descripError = consec.descripError
Return False
End If
End If
Return True
End Function
Public Function getCreadoPor() As Empleado Implements InterfaceTablas.getCreadoPor
Throw New NotImplementedException()
End Function
Public Function getActualizadoPor() As Empleado Implements InterfaceTablas.getActualizadoPor
Throw New NotImplementedException()
End Function
Public Function getEmpresa() As Empresa Implements InterfaceTablas.getEmpresa
Throw New NotImplementedException()
End Function
Public Function getSucursal() As Sucursal Implements InterfaceTablas.getSucursal
Throw New NotImplementedException()
End Function
End Class
|
Imports System.Web.Services
Imports System.Data.OracleClient
<System.Web.Services.WebService(Namespace:="http://tempuri.org/Plant23_BEC/BEC_INFO")> _
Public Class BEC_INFO
Inherits System.Web.Services.WebService
#Region " Web Services Designer Generated Code "
Public Sub New()
MyBase.New()
'This call is required by the Web Services Designer.
InitializeComponent()
'Add your own initialization code after the InitializeComponent() call
End Sub
'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
components = New System.ComponentModel.Container
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
#End Region
<WebMethod(Description:="Retrieves ICS Delivery Location based on Part Number and Container.")> _
Public Function GetICSDeliveryLocation(ByVal psPartNumber As String, ByVal psContainer As String) As DataSet
Dim strConn As String = "Provider=MSDAORA.1;Password=adavis6875;User ID=adavis;Data Source=TV92.TCRIX;Persist Security Info=True"
Dim MyConn As New OracleConnection(strConn)
Dim CmdICS_Delivery_Location As New OracleCommand
Dim ds As New DataSet
Dim da As OracleDataAdapter
Dim sel, frm, whr As String
Dim sqlGetICS_DELIVERY_LOCATION As String
Try
sel = "SELECT MES_PART_ID, PART_NBR, CNTR, DEST, CSOURCE, RLSEDATE, FIRST_REF_QUAL, FIRST_QUAL_TEXT, PKG_11Z, PKG_12Z, PKG_13Z, PKG_14Z, PKG_15Z, PKG_16Z, PKG_17Z, MOD_USERID, MOD_TMSTM"
frm = " FROM SO_BEC.ICS_DELIVERY_LOCATION"
whr = " WHERE PART_NBR = '" & psPartNumber & "' and CNTR = '" & psContainer & "'"
sqlGetICS_DELIVERY_LOCATION = sel & frm & whr
'Response.Write(sqlGetICS_DELIVERY_LOCATION)
' Create a Command object with the SQL statement.
MyConn.Open()
' get the information
With CmdICS_Delivery_Location
.Connection = MyConn
.CommandType = CommandType.Text
.CommandText = sqlGetICS_DELIVERY_LOCATION
.ExecuteNonQuery()
End With
'fill the dataset
da = New OracleDataAdapter(CmdICS_Delivery_Location)
da.Fill(ds)
Return ds
Catch ex As Exception
Throw New Exception(ex.Message)
If IsLoggingOn() Then
LogError(ex.Source, ex.Message)
End If
LogEvent(ex.Message)
Finally
MyConn.Dispose()
CmdICS_Delivery_Location.Dispose()
ds.Dispose()
da.Dispose()
End Try
End Function
Public Function GetPartLineRestriction(ByVal psMesPartId As String, ByVal psMesMachineId As String, ByVal psContainer As String) As Boolean
Dim strConn As String = "Provider=MSDAORA.1;Password=adavis6875;User ID=adavis;Data Source=TV92.TCRIX;Persist Security Info=True"
Dim MyConn As New OracleConnection(strConn)
Dim dr As OracleDataReader
Dim CmdGetPartLineRestriction As New OracleCommand
Dim sqlGetPartLineRestriction As String
Dim sel, frm, whr As String
Try
sel = "SELECT *"
frm = " FROM SO_BEC.PART_LINE_RESTRICTION"
whr = " WHERE MES_PART_ID = '" & psMesPartId & "' and MES_MACHINE_ID = '" & psMesMachineId & "' and CNTR = '" & psContainer & "'"
sqlGetPartLineRestriction = sel & frm & whr
'Open the connection if it is closed
If MyConn.State = ConnectionState.Closed Then MyConn.Open()
'Command object properties
With CmdGetPartLineRestriction
.Connection = MyConn
.CommandType = CommandType.Text
.CommandText = sqlGetPartLineRestriction
End With
'Execute the reader
dr = CmdGetPartLineRestriction.ExecuteReader(CommandBehavior.CloseConnection)
'Check to see if anything was returned and set the variable to the value
If dr.HasRows Then
Return True
Else
Return False
End If
Catch ex As Exception
Throw New Exception(ex.Message)
If IsLoggingOn() Then
LogError(ex.Source, ex.Message)
End If
LogEvent(ex.Message)
Finally
MyConn.Dispose()
CmdGetPartLineRestriction.Dispose()
dr.Dispose()
End Try
End Function
End Class
|
Public Class FrmSelectValue
Public Delegate Function AddNewItem() As Object
Private m_result As Object = Nothing
Private Shared m_newFunction As AddNewItem
Public Shared Function SelectValue(objects As IEnumerable(Of Object), text As String) As Object
Return SelectValue(objects, text, Nothing)
End Function
Public Shared Function SelectValue(objects As IEnumerable(Of Object), text As String, newFunction As AddNewItem) As Object
Dim frm As New FrmSelectValue
frm.Label1.Text = text
For Each o As Object In objects
frm.cmbValues.Items.Add(o)
Next
frm.Btn_Add.Visible = (newFunction IsNot Nothing)
m_newFunction = newFunction
frm.ShowDialog()
Dim result As Object = frm.GetResult
frm.Dispose()
Return result
End Function
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
m_result = cmbValues.SelectedItem
Me.Close()
End Sub
Private Function GetResult() As Object
Return m_result
End Function
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Me.Close()
End Sub
Private Sub Btn_Add_MouseDown(sender As Object, e As MouseEventArgs) Handles Btn_Add.MouseDown
Dim newObject As Object = m_newFunction.Invoke()
cmbValues.Items.Add(newObject)
cmbValues.SelectedItem = newObject
End Sub
End Class |
Imports System.Data.Entity
Namespace Areas.PSMD.Models
Public Class DataContext
Inherits Data.Entity.DbContext
Public Property Pokemon As DbSet(Of Pokemon)
Public Property Abilities As DbSet(Of Ability)
Public Property Types As DbSet(Of PkmType)
Public Property Experience As DbSet(Of ExperienceLevel)
Public Property Moves As DbSet(Of Move)
Public Property MoveMultiHits As DbSet(Of MoveMultiHit)
Public Property LevelUp As DbSet(Of PokemonLevelUp)
Public Property Items As DbSet(Of Item)
Public Property GameStrings As DbSet(Of GameString)
Public Sub New()
MyBase.New("DefaultConnection")
End Sub
End Class
End Namespace |
'Project: Payroll Calculator
'Programmer: Arthur Buckowitz
'Date: August 6, 2012
'Description: Processes amount of pay for each employee in selected file, allows information to be printed.
Imports System.IO.File
Imports System.IO
Public Class frmPayroll
Dim EmployeeInfo() As String
Dim PayArray() As PayInfo
Dim Line As Integer = 1
Private Structure PayInfo
Dim FirstName As String
Dim LastName As String
Dim EmployeeNumber As Integer
Dim HourlyPayRate As Decimal
Dim Pay As Decimal
End Structure
Private Sub btnOpen_Click(sender As System.Object, e As System.EventArgs) Handles btnOpen.Click
'Opens selected file, calls on readfile function to process.
If OpenFileDialog1.ShowDialog = DialogResult.OK Then
txtFileName.Text = OpenFileDialog1.FileName
Line = 1
lblEmpNumber.Text = ""
lblFirstName.Text = ""
lblHourlyRate.Text = ""
lblLastName.Text = ""
ReadFile()
btnFindPay.Enabled = True
End If
End Sub
Private Function ReadFile() As Boolean
Dim EndOfFile As Boolean = True
'Reads file, calls on the display sub to display file info.
Try
Dim StreamRead As StreamReader = OpenText(txtFileName.Text)
Dim strLine As String = ""
Dim i As Integer = 1
While Not StreamRead.EndOfStream
strLine = StreamRead.ReadLine()
If i = Line Then
EndOfFile = False
Exit While
End If
i += 1
End While
StreamRead.Close()
Display(strLine)
Catch ex As Exception
MsgBox("Error Reading")
End Try
Return EndOfFile
End Function
Private Sub Display(ByVal ReadLine As String)
'Displays the info from the file into labels on the form.
Try
If ReadLine Is "" Then
btnFindPay.Enabled = False
Exit Sub
Else
EmployeeInfo = ReadLine.Split(CChar("|"))
lblFirstName.Text = EmployeeInfo(0)
lblLastName.Text = EmployeeInfo(1)
lblEmpNumber.Text = EmployeeInfo(2)
lblHourlyRate.Text = Decimal.Parse(EmployeeInfo(3)).ToString("C")
End If
Catch ex As Exception
MsgBox("Invalid Data")
End Try
End Sub
Private Sub btnFindPay_Click(sender As System.Object, e As System.EventArgs) Handles btnFindPay.Click
'Stores info from file into array, uses calculate function to calculate pay.
If txtFileName.Text = "" Then
MsgBox("Please select file you wish to find pay for.")
ElseIf txtHoursWorked.Text = "" Then
MsgBox("Please enter number of hours worked.")
Else
If PayArray Is Nothing Then
ReDim PayArray(0)
Else
ReDim Preserve PayArray(PayArray.Length)
End If
PayArray(PayArray.Length - 1).FirstName = EmployeeInfo(0)
PayArray(PayArray.Length - 1).LastName = EmployeeInfo(1)
PayArray(PayArray.Length - 1).EmployeeNumber = Integer.Parse(EmployeeInfo(2))
PayArray(PayArray.Length - 1).HourlyPayRate = Decimal.Parse(EmployeeInfo(3))
PayArray(PayArray.Length - 1).Pay = CalculatePay(Integer.Parse(txtHoursWorked.Text), Decimal.Parse(EmployeeInfo(3)))
Line += 1
If ReadFile() = True Then
Line -= 1
End If
End If
txtHoursWorked.Text = ""
End Sub
Private Function CalculatePay(HoursWorked As Integer, HourlyRate As Decimal) As Decimal
Dim PayAmount As Decimal
'Calculates amount of pay from hours worked and pay rate.
PayAmount = HoursWorked * HourlyRate
Return PayAmount
End Function
Private Sub txtHoursWorked_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtHoursWorked.TextChanged
If Not IsNumeric(txtHoursWorked.Text) And txtHoursWorked.Text <> "" Then
'Validates the hours worked input.
MsgBox("Hours worked must be numeric, please correct.")
txtHoursWorked.Text = ""
End If
End Sub
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click
'Displays print preview.
PrintPreviewDialog1.ShowDialog()
End Sub
Private Sub PrintDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage
Dim PrintFont As New Font("Arial", 12)
Dim LineHeightSingle As Single = PrintFont.GetHeight + 2
Dim HorizontalPrintLocation As Single = e.MarginBounds.Left
Dim VerticalPrintLocation As Single = e.MarginBounds.Top
'Designates info to print document 1 for printing.
For Each Employee As PayInfo In PayArray
e.Graphics.DrawString("First Name: " & Employee.FirstName, PrintFont, Brushes.Black,
HorizontalPrintLocation, VerticalPrintLocation)
VerticalPrintLocation += LineHeightSingle
e.Graphics.DrawString("Last Name: " & Employee.LastName, PrintFont, Brushes.Black,
HorizontalPrintLocation, VerticalPrintLocation)
VerticalPrintLocation += LineHeightSingle
e.Graphics.DrawString("Employee Number: " & Employee.EmployeeNumber.ToString, PrintFont, Brushes.Black,
HorizontalPrintLocation, VerticalPrintLocation)
VerticalPrintLocation += LineHeightSingle
e.Graphics.DrawString("Pay Rate: " & Employee.HourlyPayRate.ToString("C"), PrintFont, Brushes.Black,
HorizontalPrintLocation, VerticalPrintLocation)
VerticalPrintLocation += LineHeightSingle
e.Graphics.DrawString("Pay: " & Employee.Pay.ToString("C"), PrintFont, Brushes.Black,
HorizontalPrintLocation, VerticalPrintLocation)
VerticalPrintLocation += LineHeightSingle + LineHeightSingle
Next
End Sub
Private Sub frmPayroll_Load(sender As Object, e As System.EventArgs) Handles Me.Load
'Disables find pay button, until file is selected in open file sub.
btnFindPay.Enabled = False
End Sub
End Class
|
Imports System.Data
''' <summary>
''' User View of Courier
''' </summary>
Partial Class Master_Default
Inherits System.Web.UI.Page
#Region "Properties"
''' <summary>
''' Gets or sets the page number details.
''' </summary>
''' <value>
''' The page number details.
''' </value>
Private Property PageNumberDetails() As Integer
Get
Return Me.ViewState("PageNumberDetails")
End Get
Set(ByVal value As Integer)
Me.ViewState("PageNumberDetails") = value
End Set
End Property
''' <summary>
''' Gets or sets the sort order.
''' </summary>
''' <value>
''' The sort order.
''' </value>
Private Property SortOrder() As String
Get
If Me.ViewState("SortOrder").ToString = "desc" Then
Me.ViewState("SortOrder") = "asc"
Else
Me.ViewState("SortOrder") = "desc"
End If
Return Me.ViewState("SortOrder").ToString
End Get
Set(ByVal value As String)
Me.ViewState("SortOrder") = value
End Set
End Property
''' <summary>
''' Gets or sets the sort expression.
''' </summary>
''' <value>
''' The sort expression.
''' </value>
Private Property SortExpression() As String
Get
Return Me.ViewState("SortExpression").ToString
End Get
Set(ByVal value As String)
Me.ViewState("SortExpression") = value
End Set
End Property
#End Region
#Region "Events"
''' <summary>
''' Handles the ItemUpdating event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewUpdateEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewUpdateEventArgs) Handles lstCourier.ItemUpdating
Dim txtRecipient As TextBox
Dim txtItem As TextBox
Dim txtQuantity As TextBox
Dim txtRemark As TextBox
Dim hdnRecordId As HiddenField
Dim CourierDAL As New CourierDAL
Dim ErrorApp As Boolean
Dim GlobalFunctions As New GlobalFunctions
Dim intReturn As Integer
Dim LogsDAL As New LogsDAL
Dim FromTime As String = "09:00:00 AM"
Dim ToTime As String = "04:00:00 PM"
Dim strMessage As String = ""
Try
bulError.Items.Clear()
With lstCourier
txtRecipient = CType(.EditItem.FindControl("txtRecipient"), TextBox)
txtItem = CType(.EditItem.FindControl("txtItem"), TextBox)
txtQuantity = CType(.EditItem.FindControl("txtQuantity"), TextBox)
txtRemark = CType(.EditItem.FindControl("txtRemark"), TextBox)
hdnRecordId = CType(.EditItem.FindControl("hdnRecordId"), HiddenField)
End With
If txtRecipient.Text.Trim.Length = 0 Or txtItem.Text.Trim.Length = 0 Or txtQuantity.Text.Trim.Length = 0 Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.REQUIRED_FIELDS_PROMPT, ErrorApp, False)
Else
ErrorApp = CourierDAL.UpdateCourier("UPDATE", Val(hdnRecordId.Value), txtRecipient.Text, _
txtItem.Text, txtRemark.Text, txtQuantity.Text, intReturn, 0, strMessage)
End If
If ErrorApp Or intReturn <> 0 Then
divError.Visible = True
divSuccess.Visible = False
bulError.Items.Clear()
GlobalFunctions.AddBulletedItems(bulError, strMessage, , False)
Else
SendEmailToApprover(Val(hdnRecordId.Value), "U")
lstCourier.EditIndex = -1
If SortExpression.ToString.Trim.Length > 0 Then
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, PageNumberDetails, ucGridPaging1.CurrentPageSize)
Else
DisplayCourier()
End If
divSuccess.Visible = True
divError.Visible = False
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.CHANGES_SAVED_APP_PROMPT)
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.COURIER_SCHED_PROMPT, , False)
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lstCourier_ItemUpdating; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Handles the Sorting event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewSortEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewSortEventArgs) Handles lstCourier.Sorting
Dim imgUrl As String
Dim imgCreatedDate As Image = CType(lstCourier.FindControl("imgCreatedDate"), Image)
Dim imgRecipient As Image = CType(lstCourier.FindControl("imgRecipient"), Image)
Dim imgItem As Image = CType(lstCourier.FindControl("imgItem"), Image)
Dim imgApprovedBy As Image = CType(lstCourier.FindControl("imgApprovedBy"), Image)
Dim imgApprovedDate As Image = CType(lstCourier.FindControl("imgApprovedDate"), Image)
Dim imgRemarks As Image = CType(lstCourier.FindControl("imgRemarks"), Image)
Dim imgStatus As Image = CType(lstCourier.FindControl("imgStatus"), Image)
Dim imgQuantity As Image = CType(lstCourier.FindControl("imgQuantity"), Image)
Dim LogsDAL As New LogsDAL
If SortOrder = "asc" Then
imgUrl = "~/Image/up2.png"
Else
imgUrl = "~/Image/down2.png"
End If
Try
imgCreatedDate.Visible = False
imgRecipient.Visible = False
imgItem.Visible = False
imgApprovedBy.Visible = False
imgApprovedDate.Visible = False
imgRemarks.Visible = False
imgStatus.Visible = False
imgQuantity.Visible = False
Select Case e.SortExpression
Case "CreatedDate"
imgCreatedDate.Visible = True
imgCreatedDate.ImageUrl = imgUrl
SortExpression = "CreatedDate"
Exit Select
Case "Recipient"
imgRecipient.Visible = True
imgRecipient.ImageUrl = imgUrl
SortExpression = "Recipient"
Exit Select
Case "ItemDescription"
imgItem.Visible = True
imgItem.ImageUrl = imgUrl
SortExpression = "ItemDescription"
Exit Select
Case "ApprovedBy"
imgApprovedBy.Visible = True
imgApprovedBy.ImageUrl = imgUrl
SortExpression = "ApprovedBy"
Exit Select
Case "ApprovedDate"
imgApprovedDate.Visible = True
imgApprovedDate.ImageUrl = imgUrl
SortExpression = "ApprovedDate"
Exit Select
Case "Remarks"
imgRemarks.Visible = True
imgRemarks.ImageUrl = imgUrl
SortExpression = "Remarks"
Exit Select
Case "RequestStatus"
imgStatus.Visible = True
imgStatus.ImageUrl = imgUrl
SortExpression = "RequestStatus"
Exit Select
Case "Quantity"
imgQuantity.Visible = True
imgQuantity.ImageUrl = imgUrl
SortExpression = "Quantity"
Exit Select
End Select
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString)
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lstCourier_Sorting; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Handles the Load event of the Page control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
populateCombos()
clearSortingProperties()
SetDateFields()
DisplayCourier()
End If
End Sub
''' <summary>
''' Handles the PreRender event of the Page control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
lnkCancel.Attributes.Add("onClick", "return confirm('Are you sure you want to save the changes you made?');")
End Sub
''' <summary>
''' Handles the Click event of the lnkCancel control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub lnkCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkCancel.Click
Dim intID As Integer
Dim ErrorApp As Boolean
Dim LogsDAL As New LogsDAL
Dim GlobalFunctions As New GlobalFunctions
Dim CourierDAL As New CourierDAL
Dim blnChkEmp As Boolean
Try
If txtCancelRemark.Text.Trim = "" Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.FILL_REMARKS_PROMPT, ErrorApp)
divError.Visible = True
divSuccess.Visible = False
Exit Sub
Else
For Each gvr As ListViewItem In lstCourier.Items
Dim cbME As CheckBox = CType(gvr.FindControl("chkSelect"), CheckBox)
If cbME.Checked And cbME.Visible Then
intID = Val(CType(gvr.FindControl("hdnRecordId"), HiddenField).Value)
blnChkEmp = True
ErrorApp = CourierDAL.ApproveCourier("LVS00003", _
intID, txtCancelRemark.Text)
SendEmailToApprover(intID, "C")
End If
Next
If blnChkEmp = False Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.RECORDS_SELECTED_PROMPT, ErrorApp)
End If
If ErrorApp Then
divError.Visible = True
divSuccess.Visible = False
Else
divError.Visible = False
divSuccess.Visible = True
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.CHANGES_SAVED_APP_PROMPT)
DisplayCourier()
End If
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lnkCancel_Click; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Courier_s the page changed.
''' </summary>
''' <param name="sender">The sender.</param>
''' <param name="e">The e.</param>
Protected Sub Courier_PageChanged(ByVal sender As Object, ByVal e As CustomPageChangeArgs)
Dim intPageNumber As Integer = 1
Dim LogsDAL As New LogsDAL
Try
If IsNothing(e) = False Then
If IsNumeric(e.CurrentPageNumber) Then
intPageNumber = e.CurrentPageNumber
PageNumberDetails = intPageNumber
End If
Else
intPageNumber = 1
End If
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, intPageNumber, ucGridPaging1.CurrentPageSize)
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:Courier_PageChanged; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Handles the Click event of the lnkClear control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub lnkClear_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkClear.Click
txtFromDate.Text = ""
txtItem.Text = ""
txtRecipient.Text = ""
txtToDate.Text = ""
ddlStatus.SelectedIndex = -1
End Sub
''' <summary>
''' Handles the Click event of the lnkSearch control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub lnkSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkSearch.Click
PageNumberDetails = 0
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, PageNumberDetails, ucGridPaging1.CurrentPageSize)
ucGridPaging1.InitDdlpages()
End Sub
''' <summary>
''' Handles the SelectedIndexChanged event of the ddlStatus control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
Protected Sub ddlStatus_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlStatus.SelectedIndexChanged
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, PageNumberDetails, ucGridPaging1.CurrentPageSize)
ucGridPaging1.InitDdlpages()
End Sub
''' <summary>
''' Handles the ItemCanceling event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewCancelEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemCanceling(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewCancelEventArgs) Handles lstCourier.ItemCanceling
lstCourier.EditIndex = -1
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, PageNumberDetails, ucGridPaging1.CurrentPageSize)
End Sub
''' <summary>
''' Handles the ItemDataBound event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewItemEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewItemEventArgs) Handles lstCourier.ItemDataBound
Dim hdnStatus As HiddenField
Dim chkSelect As CheckBox
Dim lnkDelete As LinkButton
Dim lnkEdit As LinkButton
If e.Item.ItemType = ListViewItemType.DataItem Then
lnkDelete = e.Item.FindControl("lnkDelete")
lnkEdit = e.Item.FindControl("lnkEdit")
hdnStatus = e.Item.FindControl("hdnStatus")
chkSelect = e.Item.FindControl("chkSelect")
If IsNothing(hdnStatus) = False Then
lnkDelete.Attributes.Add("onClick", "return confirm('Are you sure you want to delete the record you selected?');")
Select Case hdnStatus.Value
Case "LVS00003", "LVS00005", "LVS00006", "LVS00002"
lnkDelete.Visible = False
lnkEdit.Visible = False
End Select
Select Case hdnStatus.Value
Case "LVS00003", "LVS00005", "LVS00006", "LVS00001"
chkSelect.Visible = False
End Select
End If
End If
End Sub
''' <summary>
''' Handles the ItemDeleting event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewDeleteEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewDeleteEventArgs) Handles lstCourier.ItemDeleting
Dim CourierDAL As New CourierDAL
Dim GlobalFunctions As New GlobalFunctions
Dim hdnRecordId As HiddenField
Dim ErrorApp As Boolean
Dim LogsDAL As New LogsDAL
Try
hdnRecordId = CType(lstCourier.Items(e.ItemIndex).FindControl("hdnRecordId"), HiddenField)
SendEmailToApprover(Val(hdnRecordId.Value), "D")
ErrorApp = CourierDAL.UpdateCourier("DELETE", Val(hdnRecordId.Value), "", _
"", "", "", 0, 0)
If ErrorApp Then
divError.Visible = True
divSuccess.Visible = False
Else
DisplayCourier()
divSuccess.Visible = True
divError.Visible = False
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.CHANGES_SAVED_APP_PROMPT)
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lstCourier_ItemDeleting; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Handles the ItemEditing event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewEditEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewEditEventArgs) Handles lstCourier.ItemEditing
Dim LogsDAL As New LogsDAL
Try
lstCourier.EditIndex = e.NewEditIndex
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString, PageNumberDetails, ucGridPaging1.CurrentPageSize)
Dim lvwItem As ListViewItem
lvwItem = lstCourier.EditItem
Dim lnkUpdate As LinkButton = CType(lvwItem.FindControl("lnkUpdate"), LinkButton)
If IsNothing(lnkUpdate) = False Then
lnkUpdate.Attributes.Add("onClick", "return confirm('Are you sure you want to save the changes you made?');")
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lstCourier_ItemEditing; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Handles the ItemInserting event of the lstCourier control.
''' </summary>
''' <param name="sender">The source of the event.</param>
''' <param name="e">The <see cref="System.Web.UI.WebControls.ListViewInsertEventArgs"/> instance containing the event data.</param>
Protected Sub lstCourier_ItemInserting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.ListViewInsertEventArgs) Handles lstCourier.ItemInserting
Dim txtRecipient As TextBox
Dim txtItem As TextBox
Dim txtQuantity As TextBox
Dim txtRemark As TextBox
Dim CourierDAL As New CourierDAL
Dim ErrorApp As Boolean
Dim GlobalFunctions As New GlobalFunctions
Dim intReturn As Integer
Dim LogsDAL As New LogsDAL
Dim intID As Integer
Dim FromTime As String = "09:00:00 AM"
Dim ToTime As String = "04:00:00 PM"
Try
bulError.Items.Clear()
txtRecipient = CType(e.Item.FindControl("txtRecipient"), TextBox)
txtItem = CType(e.Item.FindControl("txtItem"), TextBox)
txtQuantity = CType(e.Item.FindControl("txtQuantity"), TextBox)
txtRemark = CType(e.Item.FindControl("txtRemark"), TextBox)
If txtRecipient.Text.Trim.Length = 0 Or txtItem.Text.Trim.Length = 0 Or txtQuantity.Text.Trim.Length = 0 Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.REQUIRED_FIELDS_PROMPT, ErrorApp, False)
Else
ErrorApp = CourierDAL.UpdateCourier("ADD", 0, txtRecipient.Text, _
txtItem.Text, txtRemark.Text, txtQuantity.Text, intReturn, intID)
End If
If ErrorApp Or intReturn <> 0 Then
divError.Visible = True
divSuccess.Visible = False
Else
SendEmailToApprover(intID, "A")
If SortExpression.ToString.Trim.Length > 0 Then
DisplayCourier(True, SortExpression.ToString, Me.ViewState("SortOrder").ToString)
Else
DisplayCourier()
End If
divSuccess.Visible = True
divError.Visible = False
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.CHANGES_SAVED_APP_PROMPT)
GlobalFunctions.AddBulletedItems(bulSuccessUpdate, Webconfig.COURIER_SCHED_PROMPT, , False)
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:lstCourier_ItemInserting; Description:" & _
ex.Message.ToString)
End Try
End Sub
#End Region
#Region "Methods / Functions"
''' <summary>
''' Sets the date fields.
''' </summary>
Protected Sub SetDateFields()
txtFromDate.Text = FormatDateTime(DateTime.Now.AddDays(-30), DateFormat.ShortDate)
txtToDate.Text = FormatDateTime(DateTime.Now.AddDays(90), DateFormat.ShortDate)
End Sub
''' <summary>
''' Clears the sorting properties.
''' </summary>
Private Sub clearSortingProperties()
Me.ViewState("SortOrder") = "ASC"
Me.ViewState("SortExpression") = "CreatedDate"
SortExpression = "CreatedDate"
End Sub
''' <summary>
''' Populates the combos.
''' </summary>
Protected Sub populateCombos()
Dim CourierDAL As New CourierDAL
Dim GlobalFunctions As New GlobalFunctions
GlobalFunctions.BindComboList(ddlStatus, _
CourierDAL.GetCourierStatus(), , "-Select Status-")
End Sub
''' <summary>
''' Displays the courier.
''' </summary>
''' <param name="blnSort">if set to <c>true</c> [BLN sort].</param>
''' <param name="strSortExp">The string sort exp.</param>
''' <param name="strSortOrder">The string sort order.</param>
''' <param name="intPageIndex">Index of the int page.</param>
''' <param name="intPageSize">Size of the int page.</param>
Private Sub DisplayCourier(Optional ByVal blnSort As Boolean = False, Optional ByVal strSortExp As String = "CreatedDate", _
Optional ByVal strSortOrder As String = "ASC", Optional ByVal intPageIndex As Integer = 1, _
Optional ByVal intPageSize As Integer = 15)
Dim ds As DataSet
Dim LogsDAL As New LogsDAL
Dim GlobalFunctions As New GlobalFunctions
Dim CourierDAL As New CourierDAL
Dim ErrorApp As Boolean
Dim totalPages As Integer
If intPageIndex = 0 Then
intPageIndex = 1
End If
Dim Session As New Session
Dim strStatus As String = GlobalFunctions.verifyDropdownlistGen(ddlStatus)
Try
bulError.Items.Clear()
If txtToDate.Text.Trim.Length > 0 And txtFromDate.Text.Trim.Length > 0 And IsDate(txtToDate.Text.Trim) _
And IsDate(txtFromDate.Text.Trim) Then
If (CDate(txtFromDate.Text.Trim) > CDate(txtToDate.Text.Trim)) Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.DATE_TO_PRIOR_PROMPT, ErrorApp, False)
End If
End If
If Not IsDate(txtFromDate.Text.Trim) And txtFromDate.Text.Trim.Length > 0 Then
bulError.Items.Add(Webconfig.INVALID_FROM_DATE_PROMPT)
ErrorApp = True
End If
If Not IsDate(txtToDate.Text.Trim) And txtToDate.Text.Trim.Length > 0 Then
GlobalFunctions.AddBulletedItems(bulError, Webconfig.INVALID_TO_DATE_PROMPT, ErrorApp, False)
End If
If ErrorApp = False Then
ds = CourierDAL.GetCourier(txtFromDate.Text, txtToDate.Text, _
Val(Session.USERNAME), "", txtRecipient.Text, _
txtItem.Text, strStatus, ErrorApp, strSortExp, strSortOrder, _
intPageIndex, intPageSize)
lstCourier.DataSource = ds.Tables(0)
lstCourier.DataBind()
If ds.Tables(0).Rows.Count > 0 Then
GlobalFunctions.SetPaging(ds, totalPages, intPageIndex, intPageSize, ucGridPaging1)
Else
ucGridPaging1.Visible = False
End If
End If
If ErrorApp Then
divError.Visible = True
Else
divError.Visible = False
End If
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:DisplayCourier; Description:" & _
ex.Message.ToString)
End Try
End Sub
''' <summary>
''' Mode: A-Add, U-Update, D-Delete, C-Cancel
''' </summary>
''' <param name="intID">The int identifier.</param>
''' <param name="strMode">The string mode.</param>
Private Sub SendEmailToApprover(ByVal intID As Integer, _
Optional ByVal strMode As String = "")
Dim LogsDAL As New LogsDAL
Dim CourierDAL As New CourierDAL
Try
CourierDAL.EmailCourierToApprover(intID, strMode)
Catch ex As Exception
LogsDAL.InsertLog("Error Log", "Module:Courier; Function:SendEmailToApprover; Description:" & _
ex.Message.ToString)
End Try
End Sub
#End Region
End Class
|
Public Interface IDataBaseAdapter
Property Connection As IDbConnection
Property Command As IDbCommand
Property DataAdapter As IDataAdapter
Property Transaction As IDbTransaction
Property DataBaseInfo As IDataBaseInfo
End Interface
|
Public Class Personnel
Public Property id As String = ""
Public Property regNo As String = ""
Public Property rollNo As String = ""
Public Property firstName As String = ""
Public Property secondName As String = ""
Public Property lastName As String = ""
Public Property address As String = ""
Public Property telephone As String = ""
Public Property email As String = ""
Public Property status As String = ""
Public Property name As String = ""
End Class
|
Imports Microsoft.VisualBasic
Public Class Macros
'CONSTANTS
Const FAT_CAL As Integer = 9
Const CARB_CAL As Integer = 4
Const PROTEIN_CAL As Integer = 4
Dim FatInt As Integer
Dim CarbInt As Integer
Dim ProteinInt As Integer
Dim CaloriesInt As Integer
'PROPERTIES
Public Property Fat As Integer
Get
Return FatInt
End Get
Set(value As Integer)
FatInt = value
End Set
End Property
Public Property Carb As Integer
Get
Return CarbInt
End Get
Set(value As Integer)
CarbInt = value
End Set
End Property
Public Property Protein As Integer
Get
Return ProteinInt
End Get
Set(value As Integer)
ProteinInt = value
End Set
End Property
Public Property Calories As Integer
Get
Return CaloriesInt
End Get
Set(value As Integer)
CaloriesInt = value
End Set
End Property
'CONSTRUCTOR
Public Sub New()
End Sub
Public Sub New(inFat As Integer,
inCarb As Integer,
InProtein As Integer)
Fat = inFat
Carb = inCarb
Protein = InProtein
CalorieCalc()
End Sub
'METHODS
Sub CalorieCalc()
Calories = (Fat * FAT_CAL) + (Carb * CARB_CAL) + (Protein * PROTEIN_CAL)
End Sub
End Class
|
Partial Public Class EquipMovementDetail
Inherits System.Web.UI.Page
Public Msg, ServerAction As String
Public PageAction As String
Public Key As String
Public CanModify As Boolean = False
Public CanDelete As Boolean = False
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
CheckRole(TaskMngStockMovement)
CanModify = CanDo(TaskMngStockMovement, actModify)
CanDelete = CanDo(TaskMngStockMovement, actDelete)
If Not IsPostBack Then
'ClearSessionData()
ClearSessionData("SEARCH")
Key = ValidateData(DataDecrypt(Request.Form("KeyEn") & ""))
KeyEn.Value = Request.Form("KeyEn") & ""
ServerAction = ValidateData(Request.Form("ServerAction") & "")
UID.Value = Request.Form("UID") & ""
If Key = "" Then
ServerAction = "ADD"
Else
ServerAction = "LOAD"
End If
InitCtrl()
Else
Key = ValidateData(DataDecrypt(Request.Form("KeyEn") & ""))
ServerAction = ValidateData(Request.Form("ServerAction") & "")
End If
Select Case ServerAction
Case "ADD" : AddData()
Case "LOAD" : LoadData()
Case "SAVE" : SaveData()
Case "DELETE" : DeleteData()
End Select
Catch ex As Exception
Msg = GetErrorMsg(ex)
End Try
End Sub
Private Sub InitCtrl()
Dim DT As DataTable = Nothing
Try
'txtServiceDate.Text = FormatDate(Now, "DD/MM/YYYY")
'txtServiceTime.Text = FormatDate(Now, "HH:MIN")
'txtMMDateF.Text = FormatDate(Now, "DD/MM/YYYY")
DT = DAL.SearchMovementType()
LoadList(ddlMovementType, DT, "MOVEMENT_TYPE_DESC", "MOVEMENT_TYPE", True, "== เลือก ==")
DT = DAL.SearchVendor()
LoadList(ddlVendorResponse, DT, "VENDOR_NAME", "VENDOR_CODE", True, "== เลือก ==")
DT = DAL.SearchEquipmentStatus()
LoadList(cboEquipmentStatus, DT, "EQUIPMENT_STATUS_DESC", "EQUIPMENT_STATUS", True, "== เลือก ==")
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
Finally
ClearObject(DT)
End Try
End Sub
Private Sub AddData()
Try
Key = ""
KeyEn.Value = ""
txtMMDateF.Text = FormatDate(Now, "DD/MM/YYYY")
txtMMDateT.Text = ""
'ddlMovementType.SelectedValue = ""
SetListValue(ddlMovementType, "")
SetListValue(ddlVendorResponse, "")
txtEquipmentName.Text = ""
hdnEquipmentID.Value = ""
txtSite.Text = ""
hdnSiteID.Value = ""
hdnOldSiteID.Value = ""
txtRemark.Text = ""
LoadCtrlDetail("0")
SetListValue(cboLocation, "")
SetListValue(cboNetwork, "")
SetListValue(cboSystem, "")
SetListValue(cboEquipmentStatus, "")
txtInstallDate.Text = ""
UnLockCtrl(txtMMDateF) : UnLockCtrl(txtMMDateT) : UnLockCtrl(ddlMovementType) : UnLockCtrl(ddlVendorResponse)
UnLockCtrl(cboLocation) : UnLockCtrl(cboNetwork) : UnLockCtrl(cboSystem) : UnLockCtrl(txtInstallDate) : UnLockCtrl(cboEquipmentStatus)
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
End Try
End Sub
Private Sub SaveData()
Dim Remark As String
Dim MovementType As String = Nothing, VendorResponse As String = Nothing, Location As String = Nothing, Network As String = Nothing _
, System As String = Nothing, EquipID As String = Nothing, SiteID As String = Nothing, OldSiteID As String = Nothing _
, InstallDate As String = Nothing, TransDateF As String = Nothing, TransDateT As String = Nothing, EquipStatus As String = Nothing
'Dim ret As String = ""
'Dim Criteria As String = ""
Dim DR As DataRow = Nothing
Dim DT As DataTable = Nothing
Dim catLog As String = catAddLog
Dim dbConn As OleDb.OleDbConnection = Nothing
Dim dbTrans As OleDb.OleDbTransaction = Nothing
Try
dbConn = DAL.OpenConn()
dbTrans = DAL.BeginTrans(dbConn)
Remark = ValidateData(txtRemark.Text)
If Key = "" Then
TransDateF = ValidateData(txtMMDateF.Text)
TransDateT = ValidateData(txtMMDateT.Text)
GetListValue(ddlMovementType, MovementType)
GetListValue(ddlVendorResponse, VendorResponse)
GetListValue(cboEquipmentStatus, EquipStatus)
EquipID = ValidateData(DataDecrypt(hdnEquipmentID.Value))
SiteID = ValidateData(DataDecrypt(hdnSiteID.Value))
OldSiteID = ValidateData(DataDecrypt(hdnOldSiteID.Value))
'If SiteID = OldSiteID Then OldSiteID = Nothing
GetListValue(cboLocation, Location)
GetListValue(cboNetwork, Network)
GetListValue(cboSystem, System)
InstallDate = txtInstallDate.Text
Else
catLog = catUpdateLog
End If
DAL.ManageEquipmentMovement(opINSERT, Key, TransDateF, TransDateT, MovementType, EquipID, SiteID, OldSiteID _
, Remark, VendorCode:=VendorResponse, LocationId:=Location, NetworkId:=Network, InstallDate:=InstallDate _
, SystemId:=System, Conn:=dbConn, Trans:=dbTrans)
If catLog = catUpdateLog Then
DT = DAL.SearchEquipMovement(RefTranID:=Key, Conn:=dbConn, Trans:=dbTrans)
For Each DR In DT.Rows
DAL.ManageEquipmentMovement(opINSERT, DR("TRANS_ID") & "", TransDateF, TransDateT, MovementType, EquipID, SiteID, OldSiteID _
, Remark, VendorCode:=VendorResponse, LocationId:=Location, NetworkId:=Network, InstallDate:=InstallDate _
, SystemId:=System, Conn:=dbConn, Trans:=dbTrans)
ClearObject(DR)
Next
ClearObject(DT)
Else
DAL.ManageEquipment(opUPDATE, EquipID, EquipStatus:=EquipStatus, VendorResponse:=VendorResponse, InstallDate:=InstallDate _
, Conn:=dbConn, Trans:=dbTrans)
If SiteID <> "" AndAlso SiteID <> OldSiteID Then
If OldSiteID <> "" Then DAL.MngSiteEquipment(opDELETE, OldSiteID, EquipID, Conn:=dbConn, Trans:=dbTrans)
DAL.MngSiteEquipment(opINSERT, SiteID, EquipID, Location, Network, System, InstallDate, Conn:=dbConn, Trans:=dbTrans)
'ลบออกจาก ชุดอุปกรณ์ เมื่ออยู่ในชุดของอุปกรณ์อื่น
DAL.ManageEquipmentSet(opDELETE, EquipID:=EquipID, Conn:=dbConn, Trans:=dbTrans)
DT = DAL.SearchEquipmentSet(EquipID, Conn:=dbConn, Trans:=dbTrans)
For Each DR In DT.Rows
DAL.ManageEquipmentMovement(opINSERT, "", TransDateF, TransDateT, MovementType, DR("EQUIPMENT_ID") & "", SiteID, OldSiteID _
, Remark, RefTransID:=Key, VendorCode:=VendorResponse, LocationId:=Location, NetworkId:=Network, InstallDate:=InstallDate _
, SystemId:=System, Conn:=dbConn, Trans:=dbTrans)
If OldSiteID <> "" Then DAL.MngSiteEquipment(opDELETE, OldSiteID, DR("EQUIPMENT_ID") & "", Conn:=dbConn, Trans:=dbTrans)
DAL.MngSiteEquipment(opINSERT, SiteID, DR("EQUIPMENT_ID") & "", Location, Network, System, InstallDate, Conn:=dbConn, Trans:=dbTrans)
ClearObject(DR)
Next
ClearObject(DT)
Else
If SiteID = "" AndAlso OldSiteID <> "" Then SiteID = OldSiteID
OldSiteID = ""
If SiteID <> "" Then DAL.MngSiteEquipment(opUPDATE, SiteID, EquipID, Location, Network, System, InstallDate _
, Conn:=dbConn, Trans:=dbTrans)
DT = DAL.SearchEquipmentSet(EquipID, Conn:=dbConn, Trans:=dbTrans)
For Each DR In DT.Rows
If SiteID <> "" Then DAL.MngSiteEquipment(opUPDATE, SiteID, DR("EQUIPMENT_ID") & "", Location, Network, System _
, InstallDate, Conn:=dbConn, Trans:=dbTrans)
DAL.ManageEquipmentMovement(opINSERT, "", TransDateF, TransDateT, MovementType, DR("EQUIPMENT_ID") & "", SiteID _
, OldSiteID, Remark, VendorCode:=VendorResponse, LocationId:=Location, NetworkId:=Network, InstallDate:=InstallDate _
, SystemId:=System, RefTransID:=Key, Conn:=dbConn, Trans:=dbTrans)
ClearObject(DR)
Next
ClearObject(DT)
End If
End If
'Save log
BLL.InsertAudit(catLog, "", Session("USER_NAME") & "", TaskMngStockMovement, Conn:=dbConn, Trans:=dbTrans)
KeyEn.Value = DataEncrypt(Key)
PageAction = "Result('S');"
ServerAction = "LOAD"
DAL.CommitTrans(dbTrans)
If Not IsNothing(dbTrans) Then DAL.RollbackTrans(dbTrans)
DAL.CloseConn(dbConn)
LoadData()
Catch ex As Exception
Msg = GetErrorMsg(ex, "SAVE")
Finally
ClearObject(DT) : ClearObject(DR)
If Not IsNothing(dbTrans) Then DAL.RollbackTrans(dbTrans)
DAL.CloseConn(dbConn)
End Try
End Sub
'Private Sub UpdateEquipmentDetail()
' 'Dim ret As String = ""
' Dim DT As DataTable = Nothing
' Dim DR As DataRow = Nothing
' Dim OldSiteID, SiteID, EquipID As String
' Try
' OldSiteID = ValidateData(DataDecrypt(hdnOldSiteID.Value))
' EquipID = ValidateData(DataDecrypt(hdnEquipmentID.Value))
' SiteID = ValidateData(DataDecrypt(hdnSiteID.Value))
' DR = GetDR(DAL.SearchSiteEquipment(SiteID, EquipID))
' If Not IsNothing(DR) Then
' If OldSiteID <> "" Then DAL.MngSiteEquipment(opDELETE, OldSiteID, EquipID)
' If SiteID <> "" Then
' DAL.MngSiteEquipment(opINSERT, SiteID, EquipID)
' DT = DAL.SearchEquipmentSet(EquipID)
' If DT.Rows.Count <> 0 Then
' For Each DR In DT.Rows
' DAL.MngSiteEquipment(opDELETE, OldSiteID, DR("EQUIPMENT_ID") & "")
' DAL.MngSiteEquipment(opINSERT, SiteID, DR("EQUIPMENT_ID") & "")
' ClearObject(DR)
' Next
' Else
' DR = GetDR(DAL.SearchEquipmentSet(EquipID:=EquipID))
' If Not IsNothing(DR) Then
' If DR("SITE_ID_EQ_SET") & "" <> DR("SITE_ID") & "" Then
' DAL.ManageEquipmentSet(opDELETE, DR("EQUIP_SET_ID") & "", DR("EQUIPMENT_ID") & "")
' End If
' ClearObject(DR)
' End If
' End If
' ClearObject(DT)
' End If
' End If
' Catch ex As Exception
' Throw ex
' Finally
' ClearObject(DT) : ClearObject(DR)
' End Try
' 'Return ret
'End Sub
Private Sub LoadData()
Dim DR As DataRow = Nothing
Try
If Key = "" Then
PageAction = "Result('N');"
Else
DR = GetDR(DAL.SearchEquipMovement(Key))
If Not IsNothing(DR) Then
txtMMDateF.Text = FormatDate(DR("TRANS_DATE"), "DD/MM/YYYY")
txtMMDateT.Text = FormatDate(DR("TRANS_DATE_TO"), "DD/MM/YYYY")
SetListValue(ddlMovementType, DR("MOVEMENT_TYPE") & "")
txtEquipmentName.Text = DR("EQUIPMENT_DESC") & ""
hdnEquipmentID.Value = DataEncrypt(DR("EQUIPMENT_ID") & "")
hdnOldSiteID.Value = DataEncrypt(DR("SITE_ID") & "")
txtSite.Text = DR("SITE_NAME") & ""
hdnSiteID.Value = DataEncrypt(DR("SITE_ID") & "")
txtRemark.Text = DR("COMMENTS") & ""
SetListValue(ddlVendorResponse, DR("VENDOR_CODE") & "")
SetListValue(cboEquipmentStatus, DR("EQUIPMENT_STATUS") & "")
LoadCtrlDetail(hdnOldSiteID.Value)
SetListValue(cboLocation, DR("LOCATION_ID") & "")
SetListValue(cboNetwork, DR("NETWORK_ID") & "")
SetListValue(cboSystem, DR("SYSTEM_ID") & "")
txtInstallDate.Text = FormatDate(DR("INSTALL_DATE"), "DD/MM/YYYY")
LockCtrl(txtMMDateF) : LockCtrl(txtMMDateT) : LockCtrl(ddlMovementType) : LockCtrl(ddlVendorResponse)
LockCtrl(cboLocation) : LockCtrl(cboNetwork) : LockCtrl(cboSystem) : LockCtrl(txtInstallDate) : LockCtrl(cboEquipmentStatus)
ClearObject(DR)
End If
End If
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
Finally
ClearObject(DR)
End Try
End Sub
Private Sub DeleteData()
Dim DR As DataRow = Nothing
Dim DT As DataTable = Nothing
Dim DR2 As DataRow = Nothing
Try
If Key = "" Then
PageAction = "Result('C');"
Else
DR = GetDR(DAL.SearchEquipMovement(Key))
If Not IsNothing(DR) Then
If DR("SERVICE_ID") & "" <> "" AndAlso DR("MOVEMENT_TYPE") & "" = "2" Then
DR2 = GetDR(DAL.SearchEquipMovement(EquipID:=DR("EQUIPMENT_ID") & "", MovementType:="3", ServiceID:=DR("SERVICE_ID") & ""))
If Not IsNothing(DR2) Then
Msg = "Can not delete this equipment is in return process of เลขที่ใบงาน " & DR("SERVICE_NO") & ""
ClearObject(DR2)
End If
End If
If Msg = "" Then
DAL.ManageEquipmentMovement(opDELETE, DR("TRANS_ID") & "")
DAL.ManageEquipmentMovement(opDELETE, RefTransID:=DR("TRANS_ID") & "")
DAL.MngSiteEquipment(opDELETE, DR("SITE_ID") & "", DR("EQUIPMENT_ID") & "")
'ลบกรณีเป็นอุปกรณ์ชุด
DR2 = GetDR(DAL.SearchEquipment(DR("EQUIPMENT_ID") & ""))
If Not IsNothing(DR2) Then
If DR2("EQUIP_SET_FLAG") & "" = "Y" Then
'เพิ่มอุปกรณ์ชุดลงใน Site
DT = DAL.SearchEquipmentSet(DR2("EQUIPMENT_ID") & "")
For Each DR2 In DT.Rows
DAL.MngSiteEquipment(opDELETE, DR2("SITE_ID") & "", DR2("EQUIPMENT_ID") & "")
ClearObject(DR2)
Next
ClearObject(DT)
Else
'ลบออกจากอุปกรณ์ชุดเมื่อไม่อยู่ใน Set เดียวกับอุปกร์ชุด
DR = GetDR(DAL.SearchEquipmentSet(EquipID:=DR2("EQUIPMENT_ID") & ""))
If Not IsNothing(DR) Then
If DR("SITE_ID") & "" <> DR("SITE_ID_EQ_SET") & "" Then
'ลบออกจาก Set ของอุปกรณ์
DAL.ManageEquipmentSet(opDELETE, DR("EQUIP_SET_ID") & "", DR("EQUIPMENT_ID") & "")
End If
ClearObject(DR)
End If
End If
ClearObject(DR2)
End If
PageAction = "Result('D');"
End If
ClearObject(DR)
Else
PageAction = "Result('C');"
End If
End If
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
Finally
ClearObject(DT) : ClearObject(DR) : ClearObject(DR2)
End Try
End Sub
Protected Sub btnLoadEquipDetail_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLoadEquipDetail.Click
LoadEquipmentDetail()
End Sub
Private Sub LoadEquipmentDetail()
Dim DR As DataRow
Dim EquipID As String = ""
Try
EquipID = DataDecrypt(hdnEquipmentID.Value)
If EquipID <> "" Then
DR = GetDR(DAL.SearchEquipment(EquipID))
txtSite.Text = ValidateData(Request.Form("txtSite"))
txtInstallDate.Text = ValidateData(Request.Form("txtInstallDate"))
If Not IsNothing(DR) Then
txtEquipmentName.Text = DR("EQUIPMENT_DESC") & ""
hdnOldSiteID.Value = DataEncrypt(DR("SITE_ID") & "")
If hdnOldSiteID.Value <> "" Then
LoadCtrlDetail(DR("SITE_ID") & "")
End If
txtSite.Text = DR("SITE_NAME") & ""
hdnSiteID.Value = DataEncrypt(DR("SITE_ID") & "")
SetListValue(cboLocation, DR("LOCATION_ID") & "")
SetListValue(cboNetwork, DR("NETWORK_ID") & "")
SetListValue(cboSystem, DR("SYSTEM_ID") & "")
SetListValue(ddlVendorResponse, DR("VENDOR_RESPONSE") & "")
SetListValue(cboEquipmentStatus, DR("EQUIPMENT_STATUS") & "")
txtInstallDate.Text = FormatDate(DR("SE_INSTALL_DATE"), "DD/MM/YYYY")
ClearObject(DR)
Else
Msg = "" : PageAction = "Result('LE');"
End If
Else
Msg = "" : PageAction = "Result('LE');"
End If
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
End Try
End Sub
Private Sub LoadCtrlDetail(ByVal SiteID As String)
Try
LoadList(cboLocation, DAL.SearchSiteLocation(SiteID:=SiteID), "LOCATION_NAME", "LOCATION_ID", True, "== เลือก ==")
LoadList(cboNetwork, DAL.SearchSiteNetwork(SiteID:=SiteID), "NETWORK_NAME", "NETWORK_ID", True, "== เลือก ==")
LoadList(cboSystem, DAL.SearchSiteSystem(SiteID:=SiteID), "SYSTEM_NAME", "SYSTEM_ID", True, "== เลือก ==")
Catch ex As Exception
Throw ex
End Try
End Sub
Protected Sub btnClearSite_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClearSite.Click
txtSite.Text = ""
hdnSiteID.Value = ""
LoadEquipmentDetail()
End Sub
Protected Sub btnLoadSite_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnLoadSite.Click
Dim SiteID, SiteIDOld As String
Try
SiteID = ValidateData(DataDecrypt(hdnSiteID.Value))
SiteIDOld = ValidateData(DataDecrypt(hdnOldSiteID.Value))
txtSite.Text = ValidateData(Request.Form("txtSite"))
If SiteID <> "" AndAlso SiteID <> SiteIDOld Then
LoadCtrlDetail(SiteID)
SetListValue(cboLocation, "")
SetListValue(cboNetwork, "")
SetListValue(cboSystem, "")
txtInstallDate.Text = ""
Else
Msg = "" : PageAction = "Result('LE');"
End If
Catch ex As Exception
Msg = GetErrorMsg(ex, "LOAD")
End Try
End Sub
End Class |
'==============================================================================
'Copyright 2013 Tony George <teejee2008@gmail.com>
'This program is free software; you can redistribute it and/or modify
'it under the terms of the GNU General Public License as published by
'the Free Software Foundation; either version 2 of the License, or
'(at your option) any later version.
'This program is distributed in the hope that it will be useful,
'but WITHOUT ANY WARRANTY; without even the implied warranty of
'MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'GNU General Public License for more details.
'You should have received a copy of the GNU General Public License
'along with this program; if not, write to the Free Software
'Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
'MA 02110-1301, USA.
'==============================================================================
Imports System.IO
Imports System.Collections
Imports System.Text.RegularExpressions
Public Class File
Public File, Name, ParentFolder, Title, Extension As String
Sub New(ByVal SourceFile As String)
If SourceFile = "" Then
Exit Sub
End If
Me.File = SourceFile
Me.Name = Path.GetFileName(SourceFile)
Me.Title = Path.GetFileNameWithoutExtension(SourceFile)
Me.Extension = Path.GetExtension(SourceFile).ToLower
Me.ParentFolder = Path.GetDirectoryName(SourceFile)
End Sub
End Class
|
Imports DevExpress.Mvvm.DataAnnotations
Imports System.ComponentModel.DataAnnotations
Namespace GridDemo
<MetadataType(GetType(DataAnnotationsElement2Metadata))>
Public Class DataAnnotationsElement2_FluentAPI
Public Property ID() As Integer
Public Property Employer() As String
Public Property FirstName() As String
Public Property LastName() As String
Public ReadOnly Property FullName() As String
Get
Return FirstName & " " & LastName
End Get
End Property
Public Property Age() As Integer
Public Property SSN() As String
Public Property Department() As String
End Class
Public NotInheritable Class DataAnnotationsElement2Metadata
Private Sub New()
End Sub
Public Shared Sub BuildMetadata(ByVal builder As MetadataBuilder(Of DataAnnotationsElement2_FluentAPI))
builder.Property(Function(p) p.ID).NotAutoGenerated()
builder.Property(Function(p) p.Employer).NotEditable()
builder.Property(Function(p) p.FirstName).DisplayName("First name").Required()
builder.Property(Function(p) p.LastName).DisplayName("Last name").Required()
builder.Property(Function(p) p.FullName).DisplayName("Full name")
builder.Property(Function(p) p.Age).DisplayFormatString("d2", applyDisplayFormatInEditMode:=True)
builder.Property(Function(p) p.SSN).ReadOnly()
builder.Property(Function(p) p.Department).NullDisplayText("Department not set")
End Sub
End Class
End Namespace
|
Option Compare Binary
Option Infer On
Option Strict On
Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Linq
Imports System.ServiceModel.DomainServices.Hosting
Imports System.ServiceModel.DomainServices.Server
Imports CableSoft.BLL.Utility
'TODO: 建立包含應用程式邏輯的方法。
<EnableClientAccess()> _
Public Class PRReasonCode
Inherits DomainService
Private _PRReasonCode As CableSoft.SO.BLL.CodeSet.PRReasonCode.PRReasonCode
Private result As New RIAResult
Public Property isHTML As Boolean = False
Private Sub InitClass(ByVal LoginInfo As LoginInfo)
_PRReasonCode = New CableSoft.SO.BLL.CodeSet.PRReasonCode.PRReasonCode(LoginInfo.ConvertTo(LoginInfo))
End Sub
Public Function Test(ByVal LoginInfo As LoginInfo) As RIAResult
InitClass(LoginInfo)
result.ResultBoolean = True
Return result
End Function
Public Function CopyToOtherDB(ByVal LoginInfo As LoginInfo,
ByVal IsCoverData As Boolean, ByVal dsSource As String) As RIAResult
Try
InitClass(LoginInfo)
Using ds As DataSet = Silverlight.DataSetConnector.Connector.FromXml(dsSource)
result = _PRReasonCode.CopyToOtherDB(IsCoverData, ds)
End Using
Catch ex As Exception
ErrorHandle.BuildMessage(result, ex, LoginInfo.DebugMode)
result.ResultBoolean = False
Return result
Finally
_PRReasonCode.Dispose()
End Try
Return result
End Function
Public Function Execute(ByVal LoginInfo As LoginInfo,
ByVal EditMode As EditMode, ByVal dsMaster As String) As RIAResult
Try
InitClass(LoginInfo)
Using dsSource As DataSet = Silverlight.DataSetConnector.Connector.FromXml(dsMaster)
result = _PRReasonCode.Execute(EditMode, dsSource)
End Using
If result.ResultDataSet IsNot Nothing Then
result.ResultXML = CableSoft.BLL.Utility.JsonServer.ToJson(result.ResultDataSet, JsonServer.JsonFormatting.None, JsonServer.NullValueHandling.Ignore, True, True, isHTML)
End If
Catch ex As Exception
ErrorHandle.BuildMessage(result, ex, LoginInfo.DebugMode)
result.ResultBoolean = False
Return result
Finally
_PRReasonCode.Dispose()
End Try
Return result
End Function
Public Function GetAllData(ByVal LoginInfo As LoginInfo) As RIAResult
Try
InitClass(LoginInfo)
Dim ds As DataSet = _PRReasonCode.GetAllData
result.ResultXML = CableSoft.BLL.Utility.JsonServer.ToJson(ds, JsonServer.JsonFormatting.None, JsonServer.NullValueHandling.Ignore, True, True, isHTML)
result.ResultBoolean = True
Catch ex As Exception
ErrorHandle.BuildMessage(result, ex, LoginInfo.DebugMode)
result.ResultBoolean = False
Return result
Finally
_PRReasonCode.Dispose()
End Try
Return result
End Function
Public Function GetMaxCode(ByVal LoginInfo As LoginInfo) As RIAResult
Try
InitClass(LoginInfo)
result.ResultXML = _PRReasonCode.GetMaxCode
result.ResultBoolean = True
Catch ex As Exception
ErrorHandle.BuildMessage(result, ex, LoginInfo.DebugMode)
result.ResultBoolean = False
Return result
Finally
_PRReasonCode.Dispose()
End Try
Return result
End Function
Public Function QueryCD014A(ByVal LoginInfo As LoginInfo, ByVal ServiceType As String) As RIAResult
Try
InitClass(LoginInfo)
Dim ds As DataSet = _PRReasonCode.QueryCD014A(ServiceType)
result.ResultXML = CableSoft.BLL.Utility.JsonServer.ToJson(ds, JsonServer.JsonFormatting.None, JsonServer.NullValueHandling.Ignore, True, True, isHTML)
result.ResultBoolean = True
Catch ex As Exception
ErrorHandle.BuildMessage(result, ex, LoginInfo.DebugMode)
result.ResultBoolean = False
Return result
Finally
_PRReasonCode.Dispose()
End Try
Return result
End Function
End Class
|
'
' Description: This class contains all the required procedures to export to
' Excel.
'
' Authors: Dennis Wallentin, www.excelkb.com
'
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Imported namespaces
'
'To read the Windows Registry subkey.
Imports Microsoft.Win32
'To use regular expressions.
Imports System.Text.RegularExpressions
'To catch COM exceptions and to release COM objects.
Imports System.Runtime.InteropServices
'To check that Excel templates exist or not.
Imports System.IO
'To get the path to the solution.
Imports System.Reflection
'Namespace alias for Excel.
Imports Excel = Microsoft.Office.Interop.Excel
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Friend Class CExportExcel
#Region "Export to Excel"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: This function creates a copy of a template based on
' which Excel template that has been selected.
' It populates the Data worksheet with selected data.
'
' Arguments: dtTable The in-memory datatable we get all data from.
' sClient The selected client's name.
' sProject The selected project's name.
' sStartDate The selected start date for the report.
' sEndDate The selected end date for the report.
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/15/08 Dennis Wallentin Ch25 Initial version
' 09/16/08 Dennis Wallentin Ch25 Updated variables
' 09/16/08 Dennis Wallentin Ch25 Moved function bFile_Exist
' to the class CCommonMethods
' 09/16/08 Dennis Wallentin Ch25 Moved function Get_Path
' to the class CCommonMethods
Friend Function bExport_Excel(ByVal dtTable As DataTable, _
ByVal sClient As String, _
ByVal sProject As String, _
ByVal sStartDate As String, _
ByVal sEndDate As String) As Boolean
'Declare and instantiate a new instance of the class.
Dim cCMethods As New CCommonMethods()
Dim cConnect As New Connect()
'Constants for the function's exception messages.
Const sERROR_MESSAGE As String = "An unexpected error has occured "
Const sERROR_MESSAGE_EXCEL As String = " in Excel."
Const sERROR_MESSAGE_NET As String = " in the .NET application."
'All variables for working with Excel COM objects.
Dim xlCalcMode As Excel.XlCalculation = Nothing
Dim xlPtCache As Excel.PivotCache = Nothing
Dim xlWkbTarget As Excel.Workbook = Nothing
Dim xlWksData As Excel.Worksheet = Nothing
Dim xlWksPivot As Excel.Worksheet = Nothing
Dim xlRngProjectData As Excel.Range = Nothing
Dim xlRngFields As Excel.Range = Nothing
Dim xlRngData As Excel.Range = Nothing
Dim xlRngList As Excel.Range = Nothing
Dim xlRngHours As Excel.Range = Nothing
Dim xlRngRevenue As Excel.Range = Nothing
Dim xlRngSortActivities As Excel.Range = Nothing
Dim xlRngSortLastName As Excel.Range = Nothing
Dim xlRngAutoFit As Excel.Range = Nothing
'Variable for working with the datatable.
Dim dtTableColumn As DataColumn = Nothing
'When exporting to Excel the first 4 columns in the
'datatable are not of interest and since all index in .NET
'are zero based we use the value 5 (4+1).
Dim iNumberOfColumns As Integer = dtTable.Columns.Count - 5
'Get the number of rows from the datatable.
Dim iNumberOfRows As Integer = dtTable.Rows.Count - 1
'Counters to iterate through the datatable's columns and rows.
Dim iRowsCounter As Integer = Nothing
Dim iColumnsCounter As Integer = Nothing
'Array to hold the retrieved data from the datatable. Since
'datatables includes a various of datatype we use here
'the object datatype.
Dim obDataArr(iNumberOfRows, iNumberOfColumns) As Object
'An array that holds the project specific values.
Dim sProjectDataArr() As String = {sClient, sProject, sStartDate + "-" + sEndDate}
'We need to separate the PETRAS Report Summary.xlt from the other templates
'as it does not contain a second worksheet with a Pivot table. Therefore we
'use a boolean flag.
Dim bSummaryReport As Boolean = False
'Variable to return the function's outcome.
Dim bExport As Boolean = Nothing
Try
'To prevent flickering when open and customize the report.
swXLApp.ScreenUpdating = False
'Create and open a copy of the selected template
Dim sWorkBook As String = cCMethods.Get_Path + swTemplateListArr(swshSelectedTemplate).ToString()
xlWkbTarget = swXLApp.Workbooks.Open(sWorkBook)
'Save the present setting for Excel's calculation mode and temporarily turn it off.
With swXLApp
xlCalcMode = .Calculation
.Calculation = Excel.XlCalculation.xlCalculationManual
End With
'We must explicit cast the object reference to the type Excel Worksheet.
xlWksData = CType(xlWkbTarget.Worksheets(Index:=1), Excel.Worksheet)
'If the Summary report template is in use we set the flag to true.
If swshSelectedTemplate = 3 Then
bSummaryReport = True
End If
'If not the selected template is the Summary report then
'we need to work with additional Excel objects.
If bSummaryReport = False Then
'The second worksheet which contains the pivot table.
xlWksPivot = CType(xlWkbTarget.Worksheets(Index:=2), Excel.Worksheet)
'The second worksheet in the templates includes a Pivot table and
'we need access to its pivot cache.
xlPtCache = xlWkbTarget.PivotCaches(Index:=1)
'The range object requires also to be casted to an Excel range.
xlRngAutoFit = CType(xlWksPivot.Columns("D:D"), Excel.Range)
End If
'Range to add project specific data.
xlRngProjectData = xlWksData.Range("C3:C5")
'Add the project specific data.
xlRngProjectData.Value = swXLApp.WorksheetFunction.Transpose(sProjectDataArr)
'Populate the array of data from the Datatable.
For iRowsCounter = 0 To iNumberOfRows
For iColumnsCounter = 0 To iNumberOfColumns
'The first 4 columns hold data which is irrelevant in this
'context which we need to consider here by adding 4 to the columns's
'counter.
obDataArr(iRowsCounter, iColumnsCounter) = dtTable.Rows(iRowsCounter)(4 + iColumnsCounter)
Next
Next
With xlWksData
'The fields's range, data's range, hours's range and revenue's range are all
'depended on which template that has been selected.
Select Case swshSelectedTemplate
Case xltTemplate.xlActivities
'Range to add the data to.
xlRngData = .Range(.Cells(RowIndex:=10, ColumnIndex:=4), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=iNumberOfColumns + 4))
'Range for the fields.
xlRngFields = .Range("D9:F9")
'Range which holds the project hours.
xlRngHours = .Range(.Cells(RowIndex:=10, ColumnIndex:=5), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=5))
'Range which holds the project revenues values.
xlRngRevenue = .Range(.Cells(RowIndex:=10, ColumnIndex:=6), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=6))
'Range which holds the cell to base the sorting.
xlRngSortActivities = .Range(Cell1:="B9")
Case xltTemplate.xltActivitiesConsultants
'Range to add the data to.
xlRngData = .Range(.Cells(RowIndex:=10, ColumnIndex:=2), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=iNumberOfColumns + 2))
'Range for the fields.
xlRngFields = .Range("B9:F9")
'Range which holds the project hours.
xlRngHours = .Range(.Cells(RowIndex:=10, ColumnIndex:=5), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=5))
'Range which holds the project revenues values.
xlRngRevenue = .Range(.Cells(RowIndex:=10, ColumnIndex:=6), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=6))
'Ranges which hold the cells to base the sorting on.
xlRngSortActivities = .Range(Cell1:="B9")
xlRngSortLastName = .Range(Cell1:="D9")
Case xltTemplate.xltConsultants
'Range to add the data to.
xlRngData = .Range(.Cells(RowIndex:=10, ColumnIndex:=3), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=iNumberOfColumns + 3))
'Range for the fields.
xlRngFields = .Range("C9:F9")
'Range which holds the project hours.
xlRngHours = .Range(.Cells(RowIndex:=10, ColumnIndex:=5), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=5))
'Range which holds the project revenues values.
xlRngRevenue = .Range(.Cells(RowIndex:=10, ColumnIndex:=6), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=6))
'Range which holds the cell to base the sorting.
xlRngSortLastName = .Range(Cell1:="D9")
Case xltTemplate.xltSummary
'Range to add the data to.
xlRngData = .Range(.Cells(RowIndex:=10, ColumnIndex:=2), _
.Cells(RowIndex:=iNumberOfRows + 10, ColumnIndex:=iNumberOfColumns + 2))
'Range for the fields.
xlRngFields = .Range("B9:C9")
End Select
End With
'Populate the data range with data.
xlRngData.Value = obDataArr
'Concatenate the two ranges into one range.
xlRngList = swXLApp.Union(xlRngFields, xlRngData)
'Sort the list based on which template is in use.
Select Case swshSelectedTemplate
Case xltTemplate.xlActivities
'Sort on activity name.
xlRngList.Sort(Key1:=xlRngSortActivities, _
Order1:=Excel.XlSortOrder.xlAscending, _
Header:=Excel.XlYesNoGuess.xlYes, _
Orientation:=Excel.XlSortOrientation.xlSortRows)
Case xltTemplate.xltActivitiesConsultants
'Sort first on activity name and then on lastname.
xlRngList.Sort(Key1:=xlRngSortActivities, _
Order1:=Excel.XlSortOrder.xlAscending, _
Key2:=xlRngSortLastName, _
Order2:=Excel.XlSortOrder.xlAscending, _
Header:=Excel.XlYesNoGuess.xlYes, _
Orientation:=Excel.XlSortOrientation.xlSortColumns)
Case xltTemplate.xltConsultants
'Sort by lastname.
xlRngList.Sort(Key1:=xlRngSortLastName, _
Order1:=Excel.XlSortOrder.xlAscending, _
Header:=Excel.XlYesNoGuess.xlYes, _
Orientation:=Excel.XlSortOrientation.xlSortColumns)
End Select
'Apply a built-in listformat to the list.
xlRngList.AutoFormat(Format:=Excel.XlRangeAutoFormat.xlRangeAutoFormatList3, _
Number:=True, Font:=True, Alignment:=True, Border:=True, _
Pattern:=True, Width:=True)
With xlWksData
'Autosize the range area we use.
.UsedRange.Columns.AutoFit()
'Give the worksheet a project specific name.
.Name = cCMethods.sCreate_Name( _
sClientName:=sClient, sProjectName:=sProject) + " " + "Data"
End With
'Restore the calculation mode.
swXLApp.Calculation = xlCalcMode
'If not the selected template is the Summary report then
'we need to work with additional Excel objects.
If bSummaryReport = False Then
'Update all the range names we use so they cover the actual
'ranges in the Data worksheet.
With xlWkbTarget
.Names.Item("rnList").RefersTo = xlRngList
.Names.Item("rnHours").RefersTo = xlRngHours
.Names.Item("rnRevenue").RefersTo = xlRngRevenue
End With
'Give the worksheet a project specific name.
xlWksPivot.Name = cCMethods.sCreate_Name( _
sClientName:=sClient, sProjectName:=sProject) + " " + "Pivot Table"
'Update the Pivot Cache.
xlPtCache.Refresh()
'Size the column D in the Pivot Table sheet.
xlRngAutoFit.AutoFit()
End If
'Things worked out as expected so we set the boolean value to true.
bExport = True
Catch COMExc As COMException
'All exceptions in COM Servers generate HRESULT messages. In most cases
'this message is not human understandable and therefore we need to use
'a customized message here as well.
MessageBox.Show(text:= _
sERROR_MESSAGE & _
sERROR_MESSAGE_EXCEL, _
caption:=swsCaption, _
buttons:=MessageBoxButtons.OK, _
icon:=MessageBoxIcon.Stop)
'Things didn't worked out as we expected so we set the boolean value
'to false.
bExport = False
Catch Generalexc As Exception
'Show customized message.
MessageBox.Show(text:=sERROR_MESSAGE & sERROR_MESSAGE_NET, _
caption:=swsCaption, _
buttons:=MessageBoxButtons.OK, _
icon:=MessageBoxIcon.Stop)
'Things didn't worked out as we expected so we set the boolean value
'to false.
bExport = False
Finally
'Restore the status.
swXLApp.ScreenUpdating = True
'Prepare the object for GC.
dtTableColumn = Nothing
'Release all resources consumed by the variable from the
'memory.
dtTable.Dispose()
dtTable = Nothing
cCMethods = Nothing
cConnect = Nothing
'Calling the Garbish Collector (GC)is a resource consuming process
'but when working with COM objects it's a necessary process.
'To make sure that all indirectly Excel COM objects will be released
'we call the GC twice.
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
GC.WaitForPendingFinalizers()
'Releae all Excel COM objects.
Release_All_ExcelCOMObjects(xlRngAutoFit)
Release_All_ExcelCOMObjects(xlRngSortLastName)
Release_All_ExcelCOMObjects(xlRngSortActivities)
Release_All_ExcelCOMObjects(xlRngRevenue)
Release_All_ExcelCOMObjects(xlRngHours)
Release_All_ExcelCOMObjects(xlRngList)
Release_All_ExcelCOMObjects(xlRngData)
Release_All_ExcelCOMObjects(xlRngFields)
Release_All_ExcelCOMObjects(xlRngProjectData)
Release_All_ExcelCOMObjects(xlWksPivot)
Release_All_ExcelCOMObjects(xlWksData)
Release_All_ExcelCOMObjects(xlWkbTarget)
Release_All_ExcelCOMObjects(xlPtCache)
Release_All_ExcelCOMObjects(xlCalcMode)
End Try
'Inform the calling procedure about the outcome.
Return bExport
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: Release all used Excel objects from memory.
'
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/16/08 Dennis Wallentin Ch25 Initial version
Private Sub Release_All_ExcelCOMObjects(ByVal oxlObject As Object)
Try
'Release the object and set it to nothing.
Marshal.FinalReleaseComObject(oxlObject)
oxlObject = Nothing
Catch ex As Exception
oxlObject = Nothing
End Try
End Sub
#End Region
End Class
|
''' <summary>
''' This interface used to make a class can have index declaration.
''' </summary>
Friend Interface IIndexable
Default Property Item(name As String) As Object
End Interface
|
Public Class Form1
''' <summary>
''' キーが押されたらキーコードを取得して表示
''' </summary>
Private Sub Form1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
Dim key As String
key = e.KeyChar.ToString
Label1.Text = key
Dim asc_code As Integer
asc_code = Asc(key)
Label2.Text = asc_code
Label3.Text = Hex(asc_code)
WriteUsbIo2(1, CByte(asc_code))
End Sub
''' <summary>
''' USB-IO2.0の出力を設定します。
''' </summary>
''' <param name="port">出力ポート(1~2)</param>
''' <param name="code">出力データ(0~255)</param>
Sub WriteUsbIo2(ByVal port As Byte, ByVal code As Byte)
Dim outData(8) As Byte '宣言時にで0で初期化される
outData(0) = port
outData(1) = code
Dim check As Integer
check = USBIO.uio_find()
If check = 0 Then
Try
check = USBIO.uio2_out(outData(0))
If check <> 0 Then
MsgBox("書き込みできませんでした", MsgBoxStyle.Critical)
End If
Catch ex As Exception
MsgBox(ex.ToString)
End Try
Else
MsgBox("1:必要なドライバが無い、2:USB-IOが繋がってない" & vbCrLf & check, MsgBoxStyle.Critical)
End If
End Sub
End Class
|
Public Class alerta
Public Sub New()
Me.Caption = ""
Me.Text = ""
Me.Image = My.Resources.hammer
End Sub
Public Property Caption() As String
Public Property Text() As String
Public Property Image() As Image
End Class
|
Public MustInherit Class Visitor
Protected Sub New()
End Sub
<VisitorDispatch()> _
Public Overridable Sub Visit(ByVal node As Expression)
Console.WriteLine("{0} has no implementation for {1}", Me, node)
End Sub
End Class
Public Class Print
Inherits Visitor
Public Overloads Sub Visit(ByVal op As BinaryOperation)
op.Left.Accept(Me)
Console.Write(" {0} ", op.Symbol)
op.Right.Accept(Me)
End Sub
Public Overloads Sub Visit(ByVal lit As Literal)
Console.Write(lit.Value)
End Sub
Public Overloads Sub Visit(ByVal op As UnaryOperation)
Console.Write(" {0}", op.Symbol)
op.Expr.Accept(Me)
End Sub
End Class
Public Class Eval
Inherits Visitor
Private Shared Function GetValue(ByVal exp As Expression) As Integer
Dim eval As Eval = Weaver.Create(Of Eval)(New Object(0 - 1) {})
exp.Accept(eval)
Return eval.value
End Function
Public Overloads Sub Visit(ByVal add As Add)
Me._value = (Eval.GetValue(add.Left) + Eval.GetValue(add.Right))
End Sub
Public Overloads Sub Visit(ByVal lit As Literal)
Me._value = lit.Value
End Sub
Public Overloads Sub Visit(ByVal neg As Neg)
Me._value = -Eval.GetValue(neg.Expr)
End Sub
Public Overloads Sub Visit(ByVal subt As Subt)
Me._value = (Eval.GetValue(subt.Left) - Eval.GetValue(subt.Right))
End Sub
Public ReadOnly Property Value() As Integer
Get
Return Me._value
End Get
End Property
Private _value As Integer
End Class
|
Namespace Data.Common
Public Enum PrimaryKeyEnum
IsPKey
IsNotPKey
End Enum
Public Enum AutoDateTimeEnum
Auto
NotAuto
End Enum
Public Enum AllowNullEnum
Allow
NotAllow
End Enum
Public Enum AutoIncrementEnum
Auto
NotAuto
End Enum
Public Class SaFieldsAttribute
Inherits Attribute
Public ReadOnly Property GeneralField As Boolean
Public ReadOnly Property PrimaryKey As Boolean
Public ReadOnly Property AutoDateTime As Boolean
Public ReadOnly Property HasDefaultValue As Boolean
Public ReadOnly Property DefaultValue As Object
Public ReadOnly Property AllowNull As Boolean
Public ReadOnly Property AutoIncrement As Boolean
Sub New()
Me.New(False, Nothing, AutoDateTimeEnum.NotAuto, AllowNullEnum.NotAllow, PrimaryKeyEnum.IsNotPKey, AutoIncrementEnum.NotAuto)
End Sub
Sub New(ByVal isPrimaryKey As PrimaryKeyEnum, Optional ByVal isAutoIncrement As AutoIncrementEnum = AutoIncrementEnum.NotAuto)
Me.New(False, Nothing, AutoDateTimeEnum.NotAuto, AllowNullEnum.NotAllow, isPrimaryKey, isAutoIncrement)
End Sub
Sub New(ByVal isPrimaryKey As PrimaryKeyEnum, ByVal leadingCode As String, Optional ByVal isAutoIncrement As AutoIncrementEnum = AutoIncrementEnum.NotAuto)
Me.New(False, Nothing, AutoDateTimeEnum.NotAuto, AllowNullEnum.NotAllow, isPrimaryKey, isAutoIncrement)
End Sub
Sub New(ByVal isAutoDateTime As AutoDateTimeEnum)
Me.New(False, Nothing, isAutoDateTime, AllowNullEnum.NotAllow, PrimaryKeyEnum.IsNotPKey, AutoIncrementEnum.NotAuto)
End Sub
Sub New(ByVal isAllowNull As AllowNullEnum)
Me.New(False, Nothing, AutoDateTimeEnum.NotAuto, isAllowNull, PrimaryKeyEnum.IsNotPKey, AutoIncrementEnum.NotAuto)
End Sub
Sub New(ByVal hasDefValue As Boolean, ByVal defValue As Object)
Me.New(hasDefValue, defValue, AutoDateTimeEnum.NotAuto, AllowNullEnum.NotAllow, PrimaryKeyEnum.IsNotPKey, AutoIncrementEnum.NotAuto)
End Sub
Sub New(ByVal hasDefValue As Boolean, ByVal defValue As Object, ByVal isAutoDateTime As AutoDateTimeEnum, ByVal isAllowNull As AllowNullEnum, ByVal isPrimaryKey As PrimaryKeyEnum, Optional ByVal isAutoIncrement As AutoIncrementEnum = AutoIncrementEnum.NotAuto)
HasDefaultValue = hasDefValue
If hasDefValue Then
DefaultValue = defValue
Else
DefaultValue = Nothing
End If
AutoDateTime = isAutoDateTime = AutoDateTimeEnum.Auto
AllowNull = isAllowNull = AllowNullEnum.Allow
PrimaryKey = isPrimaryKey = PrimaryKeyEnum.IsPKey
AutoIncrement = isAutoIncrement = AutoIncrementEnum.Auto
End Sub
End Class
End Namespace |
Imports System.Data.OleDb
Public Class LectorExcel
Public Shared Function DameValorCelda(
nombreFichero As String,
hoja As String,
columna As String,
fila As Integer) As String
If (Not (IO.File.Exists(nombreFichero))) Then
Throw New IO.FileNotFoundException("No existe el archivo de Excel indicado")
End If
If (String.IsNullOrEmpty(hoja) OrElse
String.IsNullOrEmpty(columna) OrElse
fila < 1 OrElse fila > 65536) Then
Throw New ArgumentException("Argumentos/valores no válidos")
End If
Dim cadenaConexion As String =
"Provider=Microsoft.ACE.OLEDB.12.0;" &
"Extended Properties='Excel 12.0 Xml;HDR=No';" &
"Data Source=" & nombreFichero
' Configurar la conexión
Using conex As New OleDbConnection(cadenaConexion)
' Creamos un objeto Command
Dim cmd As OleDbCommand = conex.CreateCommand()
Dim celda As String = columna & fila
' Formatear la consulta SQL
cmd.CommandText = String.Format(
"SELECT F1 FROM [{0}${1}:{2}]", hoja, celda, celda)
MessageBox.Show(cmd.CommandText)
' Abrir la consexion
conex.Open()
' Ejecutar la consulta SQL
Dim valor As Object
Try
valor = cmd.ExecuteScalar()
Catch ex As Exception
valor = ""
End Try
' Devolver el valor convertido a String
Return Convert.ToString(valor)
End Using
End Function
End Class
|
Module Module1
Sub Main()
Dim ret As Int32
'Scan device
ret = VII_ScanDevice(1)
If ret <= 0 Then
System.Console.WriteLine("No device connected")
Return
End If
'Open device
ret = VII_OpenDevice(ControlI2C.VII_USBI2C, 0, 0)
If ret <> ControlI2C.SUCCESS Then
System.Console.WriteLine("Open device error")
Return
End If
'Initialize device(hardware mode)
Dim I2C_Config As ControlI2C.VII_INIT_CONFIG
I2C_Config.AddrType = ControlI2C.VII_ADDR_7BIT
I2C_Config.ClockSpeed = 400000
I2C_Config.ControlMode = ControlI2C.VII_HCTL_MODE
I2C_Config.MasterMode = ControlI2C.VII_MASTER
I2C_Config.SubAddrWidth = ControlI2C.VII_SUB_ADDR_NONE
ret = VII_InitI2C(ControlI2C.VII_USBI2C, 0, 0, I2C_Config)
If ret <> ControlI2C.SUCCESS Then
System.Console.WriteLine("Initialize device error")
Return
End If
'Put the HMC5883 IC into the correct operating mode
Dim Address As UInt16
Address = &H1E '0011110b, I2C 7bit address of HMC5883
Address = Address << 1 '
Dim write_buffer(8) As Byte
Dim read_buffer(8) As Byte
write_buffer(0) = &H0
ret = ControlI2C.VII_WriteBytes(ControlI2C.VII_USBI2C, 0, 0, Address, &H2, write_buffer, 1)
If ret <> ControlI2C.SUCCESS Then
System.Console.WriteLine("Write data error!")
End If
While True
'Read status
ret = ControlI2C.VII_ReadBytes(ControlI2C.VII_USBI2C, 0, 0, Address, &H9, read_buffer, 1)
If ret <> ControlI2C.SUCCESS Then
System.Console.WriteLine("Read data error!")
End If
'Data ready
If (read_buffer(0) & &H1) > 0 Then
'Tell the HMC5883 where to begin reading data
ret = ControlI2C.VII_ReadBytes(ControlI2C.VII_USBI2C, 0, 0, Address, &H3, read_buffer, 6)
If ret <> ControlI2C.SUCCESS Then
System.Console.WriteLine("Read data error!")
End If
Dim x, y, z As Int32
x = (read_buffer(0) << 8) Or read_buffer(1)
y = (read_buffer(2) << 8) Or read_buffer(3)
z = (read_buffer(4) << 8) Or read_buffer(5)
Console.WriteLine("------------------------------------------------------\n")
Console.WriteLine("x = {0:d}", x)
Console.WriteLine("y = {0:d}", y)
Console.WriteLine("z = {0:d}", z)
Console.WriteLine("------------------------------------------------------\n")
End If
End While
End Sub
End Module
|
Public Class ComplianceBO
Public Property PermitKey As Integer
Public Property ComplianceNumber As String
Public Property Compliance As ComplianceDO
Public Property Revisions As List(Of String)
End Class
|
Imports Microsoft.VisualBasic
Imports System
Imports System.Linq
Imports System.Reflection
Imports System.Windows.Forms
Imports Neurotec.Biometrics.Standards
Partial Public Class OpenSubjectDialog
Inherits Form
#Region "Private types"
Private Structure ListItem
Private privateValue As UShort
Public Property Value() As UShort
Get
Return privateValue
End Get
Set(ByVal value As UShort)
privateValue = value
End Set
End Property
Private privateName As String
Public Property Name() As String
Get
Return privateName
End Get
Set(ByVal value As String)
privateName = value
End Set
End Property
Public Overrides Function ToString() As String
Return Name
End Function
End Structure
#End Region
#Region "Public constructor"
Public Sub New()
InitializeComponent()
End Sub
#End Region
#Region "Private methods"
Private Sub ListTypes()
cbType.BeginUpdate()
Try
cbType.Items.Clear()
Dim selected As ListItem = CType(cbOwner.SelectedItem, ListItem)
Dim type = GetType(CbeffBdbFormatIdentifiers)
Dim fields = type.GetFields(BindingFlags.Static Or BindingFlags.Public).Where(Function(x) x.Name.StartsWith(selected.Name))
Dim ownerNameLength As Integer = selected.Name.Length
For Each item As FieldInfo In fields
Dim li As ListItem = New ListItem With {.Name = item.Name.Substring(ownerNameLength), .Value = CUShort(item.GetValue(Nothing))}
cbType.Items.Add(li)
Next item
Dim count As Integer = cbType.Items.Count
If count > 0 Then
cbType.SelectedIndex = 0
End If
cbType.Enabled = count > 0
Finally
cbType.EndUpdate()
End Try
End Sub
Private Sub ListOwners()
cbOwner.BeginUpdate()
Try
cbOwner.Items.Clear()
Dim items = New Object() { New ListItem With {.Name = "Auto detect", .Value = CbeffBiometricOrganizations.NotForUse}, New ListItem With {.Name = "Neurotechnologija", .Value = CbeffBiometricOrganizations.Neurotechnologija}, New ListItem With {.Name = "IncitsTCM1Biometrics", .Value = CbeffBiometricOrganizations.IncitsTCM1Biometrics}, New ListItem With {.Name = "IsoIecJtc1SC37Biometrics", .Value = CbeffBiometricOrganizations.IsoIecJtc1SC37Biometrics} }
cbOwner.Items.AddRange(items)
Finally
cbOwner.EndUpdate()
End Try
End Sub
#End Region
#Region "Private events"
Private Sub BtnBrowseClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnBrowse.Click
If openFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
tbFileName.Text = openFileDialog.FileName
End If
End Sub
Private Sub CbOwnerSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbOwner.SelectedIndexChanged
ListTypes()
End Sub
Private Sub OpenSubjectDialogLoad(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
ListOwners()
cbOwner.SelectedIndex = 0
End Sub
Private Sub OpenSubjectDialogShown(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Shown
Dim result = openFileDialog.ShowDialog()
If result = System.Windows.Forms.DialogResult.OK Then
tbFileName.Text = openFileDialog.FileName
btnOk.Focus()
Else
DialogResult = result
End If
End Sub
#End Region
#Region "Public properties"
Public ReadOnly Property FileName() As String
Get
Return tbFileName.Text
End Get
End Property
Public ReadOnly Property FormatOwner() As UShort
Get
Dim item As ListItem = CType(cbOwner.SelectedItem, ListItem)
Return item.Value
End Get
End Property
Public ReadOnly Property FormatType() As UShort
Get
If cbType.SelectedIndex <> -1 Then
Dim item As ListItem = CType(cbType.SelectedItem, ListItem)
Return item.Value
Else
Return 0
End If
End Get
End Property
#End Region
End Class
|
Partial Public Class Sejour
Inherits IEntity
Implements IEntityInterface
Private Property InternId As Integer Implements IEntityInterface.Id
Get
Return Me.Id
End Get
Set(value As Integer)
Me.Id = value
End Set
End Property
Public Property EstActuel As Boolean
Get
Return Me.Defunt.SejourActif Is Me
End Get
Set(value As Boolean)
' il faut qu'il y ait un défunt
If Me.Defunt IsNot Nothing Then
Me.Defunt.SejourActif = Me
Else
Throw New Exception("Un séjour doit être associé à un défunt avant d'être marqué comme actif.")
End If
End Set
End Property
End Class
|
Imports System.Drawing.Imaging
Imports System.Globalization
Imports System.IO
Imports System.Windows.Data
'''
''' One-way converter from System.Drawing.Image to System.Windows.Media.ImageSource
'''
''' Copied from http://stevecooper.org/2010/08/06/databinding-a-system-drawing-image-into-a-wpf-system-windows-image/
''' Written by Matt Galbraith of Microsoft
''' Date copied: 12-13-2015
'''
<ValueConversion(GetType(System.Drawing.Image), GetType(System.Windows.Media.ImageSource))>
Public Class ImageConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
' empty images are empty…
If value Is Nothing Then
Return Nothing
End If
Dim image = DirectCast(value, System.Drawing.Image)
' Winforms Image we want to get the WPF Image from…
Dim bitmap = New System.Windows.Media.Imaging.BitmapImage()
bitmap.BeginInit()
Dim memoryStream As New MemoryStream()
' Save to a memory stream…
image.Save(memoryStream, ImageFormat.Png)
' Rewind the stream…
memoryStream.Seek(0, System.IO.SeekOrigin.Begin)
bitmap.StreamSource = memoryStream
bitmap.EndInit()
Return bitmap
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException
End Function
End Class
'=======================================================
'Service provided by Telerik (www.telerik.com)
'Conversion powered by NRefactory.
'Twitter: @telerik
'Facebook: facebook.com/telerik
'=======================================================
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'* Copyright (C) 2013-2016 NamCore Studio <https://github.com/megasus/Namcore-Studio>
'*
'* This program is free software; you can redistribute it and/or modify it
'* under the terms of the GNU General Public License as published by the
'* Free Software Foundation; either version 3 of the License, or (at your
'* option) any later version.
'*
'* This program is distributed in the hope that it will be useful, but WITHOUT
'* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
'* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
'* more details.
'*
'* You should have received a copy of the GNU General Public License along
'* with this program. If not, see <http://www.gnu.org/licenses/>.
'*
'* Developed by Alcanmage/megasus
'*
'* //FileInfo//
'* /Filename: ThreadExtensions
'* /Description: Needed when using threadding
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Imports System.Threading
Namespace Framework.Extension
Public Class CompletedEventArgs
Inherits EventArgs
End Class
Public Class ThreadExtensions
'// Declaration
Private _args() As Object
Private _delegateToInvoke As [Delegate]
'// Declaration
Public Shared Function QueueUserWorkItem(method As [Delegate], ByVal ParamArray args() As Object) _
As Boolean
Return _
ThreadPool.QueueUserWorkItem(AddressOf ProperDelegate,
New ThreadExtensions With {._args = args, ._delegateToInvoke = method})
End Function
Public Shared Sub ScSend(sc As SynchronizationContext, del As [Delegate],
ByVal ParamArray args() As Object)
sc.Send(New SendOrPostCallback(AddressOf ProperDelegate),
New ThreadExtensions With {._args = args, ._delegateToInvoke = del})
End Sub
Private Shared Sub ProperDelegate(state As Object)
Try
Dim sd = DirectCast(state, ThreadExtensions)
sd._delegateToInvoke.DynamicInvoke(sd._args)
Catch ex As Exception
End Try
End Sub
End Class
End Namespace |
Public Class DateTextBox
Inherits Panel
Public Shadows Event DateChanged(sender As Object, e As EventArgs)
Private WithEvents m_textbox As TextBox
Private Shared m_dateSelector As New DateSelector
Private m_dateFormat As String = "dd/MM/yyyy"
Private m_date As Nullable(Of DateTime) = Nothing
Public Sub New()
m_textbox = New TextBox
With m_textbox
.Parent = Me
.Dock = DockStyle.Fill
End With
End Sub
Public Property DateFormat() As String
Get
Return m_dateFormat
End Get
Set(value As String)
m_dateFormat = value
End Set
End Property
Public Overrides Property Text As String
Get
Return m_textbox.Text
End Get
Set(value As String)
m_textbox.Text = value
End Set
End Property
Public Function GetDate() As Nullable(Of DateTime)
Return m_date
End Function
Public Sub SetDate(value As Nullable(Of DateTime))
m_date = value
If m_date Is Nothing Then
m_textbox.Text = ""
Else
m_date = CDate(m_date.Value.ToString("dd/MM/yyyy") & " 00:00:00")
m_textbox.Text = Format(m_date, m_dateFormat)
End If
RaiseEvent DateChanged(Me, New EventArgs())
End Sub
Private Sub DateTextBox_LostFocus(sender As Object, e As EventArgs) Handles m_textbox.LostFocus
m_textbox.Text = m_textbox.Text.Trim
If Not String.IsNullOrEmpty(m_textbox.Text) Then
If IsDate(m_textbox.Text) Then
m_date = CDate(m_textbox.Text)
m_date = CDate(m_date.Value.ToString("dd/MM/yyyy") & " 00:00:00")
m_textbox.Text = Format(m_date.Value, m_dateFormat)
Else
m_date = Nothing
MsgBox("Le format de la date saisie n'est pas reconnu.", MsgBoxStyle.Critical Or MsgBoxStyle.OkOnly, "Date invalide...")
m_textbox.Focus()
End If
Else
m_date = Nothing
End If
RaiseEvent DateChanged(Me, e)
End Sub
Private Sub m_textbox_MouseUp(sender As Object, e As MouseEventArgs) Handles m_textbox.MouseUp
If e.Button = MouseButtons.Right Then
m_dateSelector.Location = CType(sender, TextBox).ClientRectangle.Location
m_dateSelector.CalendarDate = m_date
With m_textbox.Location
m_dateSelector.Location = m_textbox.PointToScreen(New Point(.X - 2 * m_textbox.Left, .Y))
End With
If m_dateSelector.ShowDialog(Me.FindForm) = DialogResult.OK Then
SetDate(m_dateSelector.CalendarDate)
End If
End If
End Sub
Private Class DateSelector
Inherits Form
Private m_date As Nullable(Of DateTime)
Private WithEvents m_monthCalendar As MonthCalendar
Private WithEvents m_cancelButton As Button
Private WithEvents m_okButton As Button
Private m_backPanel As Panel
Friend Sub New()
MyBase.New
m_date = Today
m_backPanel = New Panel
With m_backPanel
.Parent = Me
.Dock = DockStyle.Fill
.BorderStyle = BorderStyle.FixedSingle
End With
m_monthCalendar = New MonthCalendar
With m_monthCalendar
.Parent = m_backPanel
.Dock = DockStyle.Top
.CalendarDimensions = New Size(1, 1)
.MaxSelectionCount = 1
.ShowTodayCircle = False
.ShowToday = False
.SetDate(m_date)
End With
m_okButton = New Button
With m_okButton
.Parent = m_backPanel
.Top = m_monthCalendar.Height - 20
.Height = 20
.Width = (m_monthCalendar.Width - 2) / 2
.Left = 1
.Text = "OK"
End With
m_cancelButton = New Button
With m_cancelButton
.Parent = m_backPanel
.Top = m_monthCalendar.Height - 20
.Height = 20
.Width = (m_monthCalendar.Width - 2) / 2
.Left = .Width + 1
.Text = "Annuler"
End With
With Me
.FormBorderStyle = FormBorderStyle.None
.Width = m_monthCalendar.Width
.Height = m_okButton.Top + m_okButton.Height + 1
.StartPosition = FormStartPosition.Manual
End With
End Sub
Friend Property CalendarDate As Nullable(Of DateTime)
Get
Return m_date
End Get
Set(value As Nullable(Of DateTime))
m_date = value
If (m_date IsNot Nothing) AndAlso (IsDate(m_date.Value)) Then
m_monthCalendar.SetDate(m_date)
End If
End Set
End Property
Private Sub m_okButton_MouseUp(sender As Object, e As MouseEventArgs) Handles m_okButton.MouseUp
If e.Button = MouseButtons.Left Then
Me.Hide()
Me.DialogResult = DialogResult.OK
m_date = m_monthCalendar.SelectionStart
End If
End Sub
Private Sub m_cancel_MouseUp(sender As Object, e As MouseEventArgs) Handles m_cancelButton.MouseUp
If e.Button = MouseButtons.Left Then
Me.Hide()
Me.DialogResult = DialogResult.Cancel
End If
End Sub
End Class
End Class
|
Public Class Options
Private Sub Options_Load(sender As Object, e As EventArgs) Handles MyBase.Load
loadCurrent()
End Sub
Private Sub loadCurrent()
appBGHex.Text = getHexFromColor(Syntax.uiColor)
appFGHex.Text = getHexFromColor(Syntax.fgColor)
cmdHexTB.Text = getHexFromColor(Syntax.commandColor)
funcHexTB.Text = getHexFromColor(Syntax.functionColor)
svHexTB.Text = getHexFromColor(Syntax.svColor)
cvHexTB.Text = getHexFromColor(Syntax.classVarColor)
bgHexTB.Text = getHexFromColor(Syntax.bgColor)
End Sub
Private Function getColorFromHex(ByVal s As String)
s = s.Replace("#", "")
Dim R As Integer = Convert.ToInt32(s.Substring(0, s.Length - 4), 16) : s = s.Remove(0, 2)
Dim G As Integer = Convert.ToInt32(s.Substring(0, s.Length - 2), 16) : s = s.Remove(0, 2)
Dim B As Integer = Convert.ToInt32(s.Substring(0, s.Length), 16)
Return Color.FromArgb(255, R, G, B)
End Function
Private Function getHexFromColor(ByVal c As Color)
Dim R As String = Hex(c.R) : If R.Length = 1 Then R = 0 & R
Dim G As String = Hex(c.G) : If G.Length = 1 Then G = 0 & G
Dim B As String = Hex(c.B) : If B.Length = 1 Then B = 0 & B
Return "#" & R & G & B
End Function
Private Function chooseColor()
Dim colorPicker As New ColorDialog
If colorPicker.ShowDialog = DialogResult.OK Then
Return Color.FromArgb(255, colorPicker.Color.R, colorPicker.Color.G, colorPicker.Color.B)
End If
End Function
Private Sub highlightSyntax()
If codeRTB.Text.Length > 0 Then
If bgColorPrev.BackColor = Color.Transparent = False Then
codeRTB.BackColor = bgColorPrev.BackColor
End If
Dim selectStart As Integer = codeRTB.SelectionStart
codeRTB.Select(0, codeRTB.TextLength)
codeRTB.SelectionColor = fgPrevLabel.ForeColor
codeRTB.DeselectAll()
'Keywords
For Each word As String In Syntax.commandList
Dim pos As Integer = 0
Do While codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos) >= 0
pos = codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos)
codeRTB.Select(pos, word.Length)
codeRTB.SelectionColor = cmdColorPrev.BackColor
pos += 1
Loop
Next
'Functions
For Each word As String In Syntax.functionList
Dim pos As Integer = 0
Do While codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos) >= 0
pos = codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos)
codeRTB.Select(pos, word.Length)
codeRTB.SelectionColor = funcColorPrev.BackColor
pos += 1
Loop
Next
'Special variables
For Each word As String In Variables.svList.Keys
Dim pos As Integer = 0
Do While codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos) >= 0
pos = codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos)
codeRTB.Select(pos, word.Length)
codeRTB.SelectionColor = svColorPrev.BackColor
pos += 1
Loop
Next
'Class variables
For Each word As String In Syntax.classVar
Dim pos As Integer = 0
Do While codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos) >= 0
pos = codeRTB.Text.ToUpper.IndexOf(word.ToUpper, pos)
codeRTB.Select(pos, word.Length)
codeRTB.SelectionColor = cvColorPrev.BackColor
pos += 1
Loop
Next
codeRTB.SelectionStart = selectStart
codeRTB.DeselectAll()
End If
End Sub
Private Sub appBGHex_TextChanged(sender As Object, e As EventArgs) Handles appBGHex.TextChanged
If appBGHex.Text.Length = 7 Then bgPrevPanel.BackColor = getColorFromHex(appBGHex.Text)
End Sub
Private Sub appFGHex_TextChanged(sender As Object, e As EventArgs) Handles appFGHex.TextChanged
If appFGHex.Text.Length = 7 Then fgPrevLabel.ForeColor = getColorFromHex(appFGHex.Text)
End Sub
Private Sub pickBGColorBtn_Click(sender As Object, e As EventArgs) Handles pickBGColorBtn.Click
appBGHex.Text = getHexFromColor(chooseColor())
bgPrevPanel.BackColor = getColorFromHex(appBGHex.Text)
End Sub
Private Sub pickFGColorBtn_Click(sender As Object, e As EventArgs) Handles pickFGColorBtn.Click
appFGHex.Text = getHexFromColor(chooseColor())
fgPrevLabel.ForeColor = getColorFromHex(appFGHex.Text)
End Sub
Private Sub cmdHexTB_TextChanged(sender As Object, e As EventArgs) Handles cmdHexTB.TextChanged
If cmdHexTB.Text.Length = 7 Then cmdColorPrev.BackColor = getColorFromHex(cmdHexTB.Text)
highlightSyntax()
End Sub
Private Sub funcHexTB_TextChanged(sender As Object, e As EventArgs) Handles funcHexTB.TextChanged
If funcHexTB.Text.Length = 7 Then funcColorPrev.BackColor = getColorFromHex(funcHexTB.Text)
highlightSyntax()
End Sub
Private Sub svHexTB_TextChanged(sender As Object, e As EventArgs) Handles svHexTB.TextChanged
If svHexTB.Text.Length = 7 Then svColorPrev.BackColor = getColorFromHex(svHexTB.Text)
highlightSyntax()
End Sub
Private Sub cvHexTB_TextChanged(sender As Object, e As EventArgs) Handles cvHexTB.TextChanged
If cvHexTB.Text.Length = 7 Then cvColorPrev.BackColor = getColorFromHex(cvHexTB.Text)
highlightSyntax()
End Sub
Private Sub bgHexTB_TextChanged(sender As Object, e As EventArgs) Handles bgHexTB.TextChanged
If bgHexTB.Text.Length = 7 Then bgColorPrev.BackColor = getColorFromHex(bgHexTB.Text)
highlightSyntax()
End Sub
Private Sub pickCMDColorBtn_Click(sender As Object, e As EventArgs) Handles pickCMDColorBtn.Click
cmdHexTB.Text = getHexFromColor(chooseColor())
cmdColorPrev.BackColor = getColorFromHex(cmdHexTB.Text)
highlightSyntax()
End Sub
Private Sub pickFuncColorBtn_Click(sender As Object, e As EventArgs) Handles pickFuncColorBtn.Click
funcHexTB.Text = getHexFromColor(chooseColor())
funcColorPrev.BackColor = getColorFromHex(funcHexTB.Text)
highlightSyntax()
End Sub
Private Sub pickSVColorBtn_Click(sender As Object, e As EventArgs) Handles pickSVColorBtn.Click
svHexTB.Text = getHexFromColor(chooseColor())
svColorPrev.BackColor = getColorFromHex(svHexTB.Text)
highlightSyntax()
End Sub
Private Sub pickCVColorBtn_Click(sender As Object, e As EventArgs) Handles pickCVColorBtn.Click
cvHexTB.Text = getHexFromColor(chooseColor())
cvColorPrev.BackColor = getColorFromHex(cvHexTB.Text)
highlightSyntax()
End Sub
Private Sub pickTBBGColorBtn_Click(sender As Object, e As EventArgs) Handles pickTBBGColorBtn.Click
bgHexTB.Text = getHexFromColor(chooseColor())
bgColorPrev.BackColor = getColorFromHex(bgHexTB.Text)
highlightSyntax()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Close()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Syntax.uiColor = getColorFromHex(appBGHex.Text)
Syntax.fgColor = getColorFromHex(appFGHex.Text)
Syntax.bgColor = getColorFromHex(bgHexTB.Text)
Syntax.commandColor = getColorFromHex(cmdHexTB.Text)
Syntax.functionColor = getColorFromHex(funcHexTB.Text)
Syntax.svColor = getColorFromHex(svHexTB.Text)
Syntax.classVarColor = getColorFromHex(cvHexTB.Text)
CodePad.setTheme()
Close()
End Sub
End Class |
' --------------------------------------------------------------------------------
' Name: Anthony Marquez
' Class: VB.Net 2
' Abstract: Manage players form
' --------------------------------------------------------------------------------
' --------------------------------------------------------------------------------
' Options
' --------------------------------------------------------------------------------
Option Explicit On
Option Strict Off
' --------------------------------------------------------------------------------
' Imports
' --------------------------------------------------------------------------------
Public Class FManagePlayers
' --------------------------------------------------------------------------------
' Constants
' --------------------------------------------------------------------------------
' --------------------------------------------------------------------------------
' Name: FMain_Shown
' Abstract: Execute code as long as form is open
' --------------------------------------------------------------------------------
Private Sub FManagePlayers_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Try
Dim blnResult As Boolean = False
' Load the players lists
blnResult = LoadPlayersList()
' Did it work?
If blnResult = False Then
' No, warn the user
MessageBox.Show(Me, "Unable to load the players list" & vbNewLine & _
"The form will now close", _
Me.Text & " Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
' and close the form
Me.Close()
End If
Catch excError As Exception
' Log and display error message
WriteLog(excError)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: LoadPlayersList
' Abstract: Execute code as long as form is open
' --------------------------------------------------------------------------------
Private Function LoadPlayersList() As Boolean
Dim blnResult As Boolean = False
Try
Dim strSourceTable As String = ""
If chkShowDeleted.Checked = False Then
strSourceTable = "VActivePlayers"
Else
strSourceTable = "VInactivePlayers"
End If
' We are busy
SetBusyCursor(Me, True)
' Load listbox with custom sql select statement
blnResult = LoadListBoxFromDatabase(strSourceTable, "intPlayerID", "strLastName + ', ' + strFirstName", lstPlayers)
Catch excError As Exception
WriteLog(excError)
Finally
' We are not busy
SetBusyCursor(Me, False)
End Try
Return blnResult
End Function
' --------------------------------------------------------------------------------
' Name: btnAdd_Click
' Abstract: Add the player to database
' --------------------------------------------------------------------------------
Private Sub btnAdd_Click(sender As Object, e As EventArgs) Handles btnAdd.Click
Try
Dim intNewItemIndex As Integer = 0
' Wrong Wrong wrong this is a blue print not an instance
' Always create a new instance of the class
' FAddPlayer.ShowDialog() !!!WRONG!!!
' Make instance of FAddTeam
Dim frmAddPlayer As New FAddPlayer
' Make instance of CListItem
Dim liNewPlayer As New CListItem
' Show modally
frmAddPlayer.ShowDialog()
' Ddd it work?
If frmAddPlayer.GetResult = True Then
' Yes, get the new player info
liNewPlayer = frmAddPlayer.GetNewPlayerInformation
' Add new record to listbox (True = select)
intNewItemIndex = lstPlayers.Items.Add(liNewPlayer)
' Select new player added
lstPlayers.SelectedIndex = intNewItemIndex
End If
Catch excError As Exception
' Display error message
WriteLog(excError)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: btnEdit_Click
' Abstract: Edit the selected player
' --------------------------------------------------------------------------------
Private Sub btnEdit_Click(sender As Object, e As EventArgs) Handles btnEdit.Click
Try
Dim intSelectedPlayerID As Integer
Dim liSelectedPlayer As CListItem
Dim frmEditPlayer As FEditPlayer
Dim liNewPlayerInformation As CListItem
Dim intIndex As Integer
' Is the team selected?
If lstPlayers.SelectedIndex < 0 Then
' No, Warn the user
MessageBox.Show("You must select a team to edit.", Me.Text & " Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
' Yes, get the team to edit ID
liSelectedPlayer = lstPlayers.SelectedItem
intSelectedPlayerID = liSelectedPlayer.GetID
' Create an instance
frmEditPlayer = New FEditPlayer
' Set, the form values
frmEditPlayer.SetPlayerID(intSelectedPlayerID)
' Show it modally
frmEditPlayer.ShowDialog(Me)
' Was the add succesful?
If frmEditPlayer.GetResult = True Then
' Get new team values
liNewPlayerInformation = frmEditPlayer.GetNewPlayerInformation
' Yes, remove and re-add from list so it get's sorted correctly
lstPlayers.Items.RemoveAt(lstPlayers.SelectedIndex)
' Add item returns index of newly added item
intIndex = lstPlayers.Items.Add(liNewPlayerInformation)
' which we can use to select it
lstPlayers.SelectedIndex = intIndex
End If
End If
Catch excError As Exception
' Display error message
WriteLog(excError)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: btnDelete_Click
' Abstract: Delete record from database and update listbox
' --------------------------------------------------------------------------------
Private Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
Try
' Delete?
If chkShowDeleted.Checked = False Then
' Yes
DeletePlayer()
Else
' No, undelete
UndeletePlayer()
End If
Catch excError As Exception
WriteLog(excError)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: DeletePlayer
' Abstract: Delete record from database and update listbox
' --------------------------------------------------------------------------------
Private Sub DeletePlayer()
Try
Dim liSelectedPlayer As CListItem
Dim intSelectedPlayerID As Integer
Dim strSelectedPlayerName As String
Dim intSelectedPlayerIndex As Integer
Dim drConfirm As DialogResult
Dim blnResult As Boolean
' Is a team selected?
If lstPlayers.SelectedIndex < 0 Then
' No, Warn the user
MessageBox.Show("You must selected a player to delete.", Me.Text & " Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
' Get the player ID, name and index
liSelectedPlayer = lstPlayers.SelectedItem
intSelectedPlayerID = liSelectedPlayer.GetID
strSelectedPlayerName = liSelectedPlayer.GetName
intSelectedPlayerIndex = lstPlayers.SelectedIndex
' Yes, confirm they want to delete (Use name for user configuration)
drConfirm = MessageBox.Show("Are you sure?", "Delete player: " & strSelectedPlayerName, _
MessageBoxButtons.YesNo, MessageBoxIcon.Question)
' Yes?
If drConfirm = Windows.Forms.DialogResult.Yes Then
' We are busy
SetBusyCursor(Me, True)
' yes, delete the team (use ID for database command)
blnResult = DeletePlayerFromDatabase(intSelectedPlayerID)
' Was the delete successful
If blnResult = True Then
' Yes, remove the Player from the list
lstPlayers.Items.RemoveAt(intSelectedPlayerIndex)
' Select the next team on the list
HighlightNextItemInList(lstPlayers, intSelectedPlayerIndex)
End If
End If
End If
Catch excError As Exception
WriteLog(excError)
Finally
' We are not busy
SetBusyCursor(Me, False)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: UndeletePlayer
' Abstract: mark player as active
' --------------------------------------------------------------------------------
Private Sub UndeletePlayer()
Try
Dim intSelectedPlayerID As Integer
Dim liSelectedPlayer As CListItem
Dim intSelectedPlayerIndex As Integer
Dim blnResult As Boolean
' Is a team selected?
If lstPlayers.SelectedIndex < 0 Then
' No, Warn the user
MessageBox.Show("You must selected a player to delete.", Me.Text & " Error", _
MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
' Get the player ID and index
liSelectedPlayer = lstPlayers.SelectedItem
intSelectedPlayerID = liSelectedPlayer.GetID
intSelectedPlayerIndex = lstPlayers.SelectedIndex
' We are busy
SetBusyCursor(Me, True)
' Yes undelete the player
blnResult = UndeletePlayerFromDatabase(intSelectedPlayerID)
' Was the delete succesful?
If blnResult = True Then
' Yes, remove the team from the listbox
lstPlayers.Items.RemoveAt(intSelectedPlayerIndex)
' Select the next team in the list
HighlightNextItemInList(lstPlayers, intSelectedPlayerIndex)
End If
End If
Catch excError As Exception
WriteLog(excError)
Finally
' We are no longer busy
SetBusyCursor(Me, False)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: chkShowDeleted_CheckedChanged
' Abstract: Toggle between active and inactive players
' --------------------------------------------------------------------------------
Private Sub chkShowDeleted_CheckedChanged(sender As Object, e As EventArgs) Handles chkShowDeleted.CheckedChanged
Try
' Is show deleted checked?
If chkShowDeleted.Checked = False Then
' No, enable buttons
btnAdd.Enabled = True
btnEdit.Enabled = True
btnDelete.Text = "&Delete"
Else
' Yes, disable buttons
btnAdd.Enabled = False
btnEdit.Enabled = False
btnDelete.Text = "&Undelete"
End If
LoadPlayersList()
Catch excError As Exception
WriteLog(excError)
End Try
End Sub
' --------------------------------------------------------------------------------
' Name: btnClose_Click
' Abstract: Execute code as long as form is open
' --------------------------------------------------------------------------------
Private Sub btnClose_Click(sender As Object, e As EventArgs) Handles btnClose.Click
Try
Me.Close()
Catch excError As Exception
WriteLog(excError)
End Try
End Sub
End Class
|
Imports System.Globalization
Imports VBChess.Shared
Public Class PawnToStringConverter
Implements IMultiValueConverter
Private Const Symbols As String = "♔♕♖♗♘♙♚♛♜♝♞♟"
Public Function Convert(values() As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
If values(0) Is Nothing OrElse values(1) Is Nothing Then
Return String.Empty
Else
If values(0).GetType() Is GetType(PawnTypes) AndAlso values(1).GetType() Is GetType(PlayerOrientation) Then
Dim index As Integer = CType(values(0), Integer)
Dim orientation As PlayerOrientation = DirectCast(values(1), PlayerOrientation)
Return Symbols.Substring(index + CInt(IIf(orientation = PlayerOrientation.Bottom, 0, 6)), 1)
End If
End If
End Function
Public Function ConvertBack(value As Object, targetTypes() As Type, parameter As Object, culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
|
Partial Public Class ExtraColumn
Inherits Page
Public Sub New()
InitializeComponent()
End Sub
'Executes when the user navigates to this page.
Protected Overrides Sub OnNavigatedTo(ByVal e As System.Windows.Navigation.NavigationEventArgs)
End Sub
Private Sub ProductsDomainDataSource_LoadedData(ByVal sender As System.Object, ByVal e As System.Windows.Controls.LoadedDataEventArgs) Handles ProductsDomainDataSource.LoadedData
If e.HasError Then
System.Windows.MessageBox.Show(e.Error.ToString, "Load Error", System.Windows.MessageBoxButton.OK)
e.MarkErrorAsHandled()
End If
End Sub
End Class
|
'---------------------------------------------
' FontMenuForm.vb (c) 2002 by Charles Petzold
'---------------------------------------------
Imports System
Imports System.Drawing
Imports System.Windows.Forms
Class FontMenuForm
Inherits PrintableForm
Protected strText As String = "Sample Text"
Protected fnt As New Font("Times New Roman", 24, FontStyle.Italic)
Shared Shadows Sub Main()
Application.Run(New FontMenuForm())
End Sub
Sub New()
Text = "Font Menu Form"
Menu = New MainMenu()
Menu.MenuItems.Add("&Font!", AddressOf MenuFontOnClick)
End Sub
Private Sub MenuFontOnClick(ByVal obj As Object, ByVal ea As EventArgs)
Dim dlg As New FontDialog()
dlg.Font = fnt
If dlg.ShowDialog() = DialogResult.OK Then
fnt = dlg.Font
Invalidate()
End If
End Sub
Protected Overrides Sub DoPage(ByVal grfx As Graphics, _
ByVal clr As Color, ByVal cx As Integer, ByVal cy As Integer)
Dim szf As SizeF = grfx.MeasureString(strText, fnt)
Dim br As New SolidBrush(clr)
grfx.DrawString(strText, fnt, br, (cx - szf.Width) / 2, _
(cy - szf.Height) / 2)
End Sub
Function GetAscent(ByVal grfx As Graphics, ByVal fnt As Font) As Single
Return fnt.GetHeight(grfx) * _
fnt.FontFamily.GetCellAscent(fnt.Style) / _
fnt.FontFamily.GetLineSpacing(fnt.Style)
End Function
Function GetDescent(ByVal grfx As Graphics, ByVal fnt As Font) As Single
Return fnt.GetHeight(grfx) * _
fnt.FontFamily.GetCellDescent(fnt.Style) / _
fnt.FontFamily.GetLineSpacing(fnt.Style)
End Function
Function PointsToPageUnits(ByVal grfx As Graphics, _
ByVal fnt As Font) As Single
Dim fFontSize As Single
If grfx.PageUnit = GraphicsUnit.Display Then
fFontSize = 100 * fnt.SizeInPoints / 72
Else
fFontSize = grfx.DpiX * fnt.SizeInPoints / 72
End If
Return fFontSize
End Function
End Class
|
Imports RTIS.CommonVB
Imports RTIS.DataLayer
Imports RTIS.DataLayer.clsDBConnBase
Public Class dtoSalesOrderPhaseInfo : Inherits dtoBase
Private pSalesOrderPhaseInfo As clsSalesOrderPhaseInfo
Public Sub New(ByRef rDBConn As clsDBConnBase)
MyBase.New(rDBConn)
SetTableDetails()
End Sub
Protected Overrides Sub SetTableDetails()
pTableName = "vwSalesOrderPhaseInfo"
End Sub
Public Overrides Property IsDirtyValue As Boolean
Get
Return False
End Get
Set(value As Boolean)
End Set
End Property
Public Overrides Property ObjectKeyFieldValue As Integer
Get
Return pSalesOrderPhaseInfo.SalesOrderPhaseID
End Get
Set(value As Integer)
End Set
End Property
Public Overrides Property RowVersionValue As ULong
Get
Return 0
End Get
Set(value As ULong)
End Set
End Property
Public Overrides Sub ObjectToSQLInfo(ByRef rFieldList As String, ByRef rParamList As String, ByRef rParameterValues As IDataParameterCollection, vSetList As Boolean)
End Sub
Public Overrides Function ReaderToObject(ByRef rDataReader As IDataReader) As Boolean
Dim mOK As Boolean
Try
If pSalesOrderPhaseInfo Is Nothing Then SetObjectToNew()
With pSalesOrderPhaseInfo
.FirstDatePlanned = DBReadDate(rDataReader, "PlannedStartDate")
.QtyOT = DBReadInt32(rDataReader, "QtyOT")
End With
With pSalesOrderPhaseInfo.SalesOrderPhase
.SalesOrderPhaseID = DBReadInt32(rDataReader, "SalesOrderPhaseID")
.DateRequired = DBReadDate(rDataReader, "DateRequired")
.QuantityItems = DBReadInt32(rDataReader, "QuantityItems")
.PhaseNumber = DBReadInt32(rDataReader, "PhaseNumber")
.DespatchStatus = DBReadByte(rDataReader, "DespatchStatus")
.InvoiceStatus = DBReadByte(rDataReader, "InvoiceStatus")
.ProductionStatus = DBReadByte(rDataReader, "ProductionStatus")
.MatReqStatus = DBReadByte(rDataReader, "MatReqStatus")
.DateCreated = DBReadDate(rDataReader, "DateCreated")
.DateCommitted = DBReadDate(rDataReader, "DateCommitted")
.CommittedBy = DBReadInt32(rDataReader, "CommittedBy")
.JobNo = DBReadString(rDataReader, "SOPJobNo")
.OrderReceivedDate = DBReadDate(rDataReader, "OrderReceivedDate")
.ManReqDays = DBReadInt32(rDataReader, "ManReqDays")
.TotalPrice = DBReadDecimal(rDataReader, "TotalPrice")
End With
With pSalesOrderPhaseInfo.SalesOrder
.SalesOrderID = DBReadInt32(rDataReader, "SalesOrderID")
.OrderNo = DBReadString(rDataReader, "OrderNo")
.ContractManagerID = DBReadInt32(rDataReader, "ContractManagerID")
.DateEntered = DBReadDate(rDataReader, "DateEntered")
.OrderStatusENUM = DBReadInt32(rDataReader, "OrderStatusENUM")
.OrderTypeID = DBReadInt32(rDataReader, "OrderTypeID")
.ProjectName = DBReadString(rDataReader, "ProjectName")
End With
With pSalesOrderPhaseInfo.Customer
.CompanyName = DBReadString(rDataReader, "CompanyName")
End With
mOK = True
Catch Ex As Exception
mOK = False
If clsErrorHandler.HandleError(Ex, clsErrorHandler.PolicyDataLayer) Then Throw
' or raise an error ?
mOK = False
Finally
End Try
Return mOK
End Function
Protected Overrides Function SetObjectToNew() As Object
pSalesOrderPhaseInfo = New clsSalesOrderPhaseInfo
Return pSalesOrderPhaseInfo
End Function
Public Function LoadSOPCollectionByWhere(ByRef rSalesOrderPhaseInfos As colSalesOrderPhaseInfos, ByVal vWhere As String) As Boolean
Dim mParams As New Hashtable
Dim mOK As Boolean
mOK = MyBase.LoadCollection(rSalesOrderPhaseInfos, mParams, "SalesOrderPhaseID", vWhere)
Return mOK
End Function
End Class
|
Imports System.Reflection
Imports System.Windows.Controls
Imports SkyEditor.Core
Imports SkyEditor.Core.UI
Imports SkyEditor.Core.Utilities
<Obsolete("Will be deleted in the future. Use DataBoundObjectControl instead.")> Public MustInherit Class ObjectControl
Inherits UserControl
Implements IViewControl
''' <summary>
''' Updates UI elements to display certain properties.
''' </summary>
Public Overridable Sub RefreshDisplay()
End Sub
''' <summary>
''' Updates the EditingObject using data in UI elements.
''' </summary>
Public Overridable Sub UpdateObject()
End Sub
''' <summary>
''' Returns an IEnumeriable of Types that this control can display or edit.
''' </summary>
''' <returns></returns>
Public Overridable Function GetSupportedTypes() As IEnumerable(Of TypeInfo) Implements IViewControl.GetSupportedTypes
Dim context = Me.DataContext
If context IsNot Nothing Then
Return context.GetType
Else
Return {}
End If
End Function
''' <summary>
''' Determines whether or not the control supports the given object.
''' The given object will inherit or implement one of the types in GetSupportedTypes.
''' </summary>
''' <param name="Obj"></param>
''' <returns></returns>
Public Overridable Function SupportsObject(Obj As Object) As Boolean Implements IViewControl.SupportsObject
Return True
End Function
''' <summary>
''' If True, this control will not be used if another one exists.
''' </summary>
''' <returns></returns>
Public Overridable Function IsBackupControl() As Boolean Implements IViewControl.GetIsBackupControl
Return False
End Function
Public Overridable Function GetSortOrder(currentType As TypeInfo, isTab As Boolean) As Integer Implements IViewControl.GetSortOrder
Return 0
End Function
''' <summary>
''' Called when Header is changed.
''' </summary>
Public Event HeaderUpdated(sender As Object, e As HeaderUpdatedEventArgs) Implements IViewControl.HeaderUpdated
''' <summary>
''' Called when IsModified is changed.
''' </summary>
Public Event IsModifiedChanged As EventHandler Implements IViewControl.IsModifiedChanged
''' <summary>
''' Returns the value of the Header. Only used when the iObjectControl is behaving as a tab.
''' </summary>
''' <returns></returns>
Public Property Header As String Implements IViewControl.Header
Get
Return _header
End Get
Set(value As String)
_header = value
RaiseEvent HeaderUpdated(Me, New HeaderUpdatedEventArgs With {.NewValue = value})
End Set
End Property
Dim _header As String
''' <summary>
''' Returns the current EditingObject, after casting it to type T.
''' </summary>
''' <typeparam name="T"></typeparam>
''' <returns></returns>
Protected Function GetEditingObject(Of T)() As T
If TypeOf _editingObject Is T Then
Return DirectCast(_editingObject, T)
Else
'I should probably throw my own exception here, since I'm casting EditingObject to T even though I just found that EditingObject is NOT T, but there will be an exception anyway
Return DirectCast(_editingObject, T)
End If
End Function
''' <summary>
''' Returns the current EditingObject.
''' It is recommended to use GetEditingObject(Of T), since it returns iContainter(Of T).Item if the EditingObject implements that interface.
''' </summary>
''' <returns></returns>
Protected Function GetEditingObject() As Object
Return _editingObject
End Function
Protected Sub SetEditingObject(Of T)(Value As T)
If TypeOf _editingObject Is T Then
_editingObject = Value
Else
_editingObject = Value
End If
End Sub
''' <summary>
''' The way to get the EditingObject from outside this class. Refreshes the display on set, and updates the object on get.
''' Calling this from inside this class could result in a stack overflow, especially if called from UpdateObject, so use GetEditingObject or GetEditingObject(Of T) instead.
''' </summary>
''' <returns></returns>
Public Overridable Property EditingObject As Object Implements IViewControl.ViewModel
Get
UpdateObject()
Return _editingObject
End Get
Set(value As Object)
_editingObject = value
RefreshDisplay()
End Set
End Property
Dim _editingObject As Object
''' <summary>
''' Whether or not the EditingObject has been modified without saving.
''' Set to true when the user changes anything in the GUI.
''' Set to false when the object is saved, or if the user undoes every change.
''' </summary>
''' <returns></returns>
Public Property IsModified As Boolean Implements IViewControl.IsModified
Get
Return _isModified
End Get
Set(value As Boolean)
Dim oldValue As Boolean = _isModified
_isModified = value
If Not oldValue = _isModified Then
RaiseEvent IsModifiedChanged(Me, New EventArgs)
End If
End Set
End Property
Dim _isModified As Boolean
End Class
|
Public Class vote
Private pReviewerRef As Integer
Private pRecipientRef As Integer
Private pRawScore As Integer
Private pWeightedScore As Double
Private pComment As String
Private pCommentScore As Double
Private pTierFactor As Double
Private pReviewerFactor As Double
Private pReviewerScore As Double
Private pRecipientFactor As Double
Private pRecipientScore As Double
Public Property reviewer() As Integer
Get
Return pReviewerRef
End Get
Set(value As Integer)
pReviewerRef = value
End Set
End Property
Public Property recipient() As Integer
Get
Return pRecipientRef
End Get
Set(value As Integer)
pRecipientRef = value
End Set
End Property
Public Property rawScore() As Integer
Get
Return pRawScore
End Get
Set(value As Integer)
pRawScore = value
End Set
End Property
Public Property weightedScore() As Double
Get
Return pWeightedScore
End Get
Set(value As Double)
pWeightedScore = value
End Set
End Property
Public Property tierFactor() As Double
Get
Return pTierFactor
End Get
Set(value As Double)
pTierFactor = value
End Set
End Property
Public Property reviewerFactor() As Double
Get
Return pReviewerFactor
End Get
Set(value As Double)
pReviewerFactor = value
End Set
End Property
Public Property reviewerScore() As Double
Get
Return pReviewerScore
End Get
Set(value As Double)
pReviewerScore = value
End Set
End Property
Public Property RecipientFactor() As Double
Get
Return pRecipientFactor
End Get
Set(value As Double)
pRecipientFactor = value
End Set
End Property
Public Property recipientScore() As Double
Get
Return pRecipientScore
End Get
Set(value As Double)
pRecipientScore = value
End Set
End Property
Public Property comment() As String
Get
Return pComment
End Get
Set(value As String)
pComment = value
End Set
End Property
Public Property commentScore As Double
Get
Return pCommentScore
End Get
Set(value As Double)
pCommentScore = value
End Set
End Property
End Class |
Imports System.Data.SqlClient
Public Class Modalidade
Private sIDModalidade As Integer
Private sModalidade As String
Public Property Modalidade As String
Get
Return sModalidade
End Get
Set(value As String)
sModalidade = value
End Set
End Property
Public Property IDModalidade As Integer
Get
Return sIDModalidade
End Get
Set(value As Integer)
sIDModalidade = value
End Set
End Property
Public Function Salvar() As Integer
Dim retorno As Integer = 0
If Not IsNumeric(sIDModalidade) Then
MsgBox("O campo ID é composto apenas de números!", MsgBoxStyle.Critical, "Atenção")
Return retorno
Exit Function
End If
If sModalidade = "" Then
MsgBox("O campo nome da modalidade não pode ser vazio!", MsgBoxStyle.Critical, "Atenção")
Return retorno
Exit Function
End If
If IsNumeric(sModalidade) Then
MsgBox("O campo nome da modalidade só podem conter letras!", MsgBoxStyle.Critical, "Atenção")
Return retorno
Exit Function
End If
Try
Dim MyCommand As SqlCommand
Dim nReg As Integer
MyCommand = New SqlCommand("INSERT INTO MODALIDADE VALUES (@IDMODALIDADE,@NOMEMODALIDADE)", frmMenu.Conexao)
MyCommand.Parameters.Add(New SqlParameter("@IDMODALIDADE", SqlDbType.Int))
MyCommand.Parameters.Add(New SqlParameter("@NOMEMODALIDADE", SqlDbType.VarChar))
MyCommand.Parameters("@IDMODALIDADE").Value = sIDModalidade
MyCommand.Parameters("@NOMEMODALIDADE").Value = sModalidade
nReg = MyCommand.ExecuteNonQuery()
If nReg > 0 Then
MsgBox("Inserção realizada com sucesso!", MsgBoxStyle.Information, "Mensagem")
retorno = nReg
End If
Catch ex As Exception
MsgBox("Erro ao tentar incluir a modalidade!", MsgBoxStyle.Critical)
End Try
Return retorno
End Function
Public Function Alterar() As Integer
Dim retorno As Integer = 0
If sModalidade = "" Then
MsgBox("A modalidade deve ser preenchida!", MsgBoxStyle.Critical, "Atenção")
Return retorno
Exit Function
End If
If IsNumeric(sModalidade) Then
MsgBox("O campo nome da modalidade só podem conter letras!", MsgBoxStyle.Critical, "Atenção")
Return retorno
Exit Function
End If
Try
Dim MyCommand As SqlCommand
Dim nReg As Integer
MyCommand = New SqlCommand("UPDATE MODALIDADE SET NOMEMODALIDADE = @NOMEMODALIDADE , WHERE IDMODALIDADE = @IDMODALIDADE", frmMenu.Conexao)
MyCommand.Parameters.Add(New SqlParameter("@NOMEMODALIDADE", SqlDbType.VarChar))
MyCommand.Parameters.Add(New SqlParameter("@IDMODALIDADE", SqlDbType.Int))
MyCommand.Parameters("@IDMODALIDADE").Value = sIDModalidade
MyCommand.Parameters("@NOMEMODALIDADE").Value = sModalidade
nReg = MyCommand.ExecuteNonQuery()
If nReg > 0 Then
MsgBox("Alteração realizada com sucesso!", MsgBoxStyle.Information, "Mensagem")
retorno = nReg
End If
Catch ex As Exception
MsgBox("Erro ao tentar alterar a modalidade!", MsgBoxStyle.Critical)
End Try
Return retorno
End Function
Public Function Listar() As DataTable
Dim daModalidade As SqlDataAdapter
Dim dtCidade As New DataTable()
Try
daModalidade = New SqlDataAdapter("SELECT * FROM MODALIDADE", frmMenu.Conexao)
daModalidade.Fill(dtCidade)
daModalidade.FillSchema(dtCidade, SchemaType.Source)
Catch ex As Exception
MsgBox("Erro ao carregar cidades!!!")
End Try
Return dtCidade
End Function
Public Function Excluir() As Integer
Dim nReg As Integer = 0
Try
Dim MyCommand As SqlCommand
MyCommand = New SqlCommand("DELETE FROM MODALIDADE WHERE IDMODALIDADE=@IDMODALIDADE", frmMenu.Conexao)
MyCommand.Parameters.Add(New SqlParameter("@IDMODALIDADE", SqlDbType.Int))
MyCommand.Parameters("@IDMODALIDADE").Value = CInt(sIDModalidade)
nReg = MyCommand.ExecuteNonQuery()
If nReg > 0 Then
MsgBox("Modalidade excluída com sucesso!", MsgBoxStyle.Information, "Mensagem")
End If
Catch ex As Exception
MsgBox("Erro ao tentar excluir a modalidade, pode ser que existam alunos cadastrados com ela!", MsgBoxStyle.Critical)
End Try
Return nReg
End Function
End Class
|
' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.
Imports Microsoft.VisualBasic
Imports System.ComponentModel
Imports System.Diagnostics.CodeAnalysis
Imports System.Globalization
Imports System.Windows.Media
''' <summary>
''' A class that demonstrates the Rating control.
''' </summary>
<Sample("(0)Rating", DifficultyLevel.Basic, "Rating")> _
Partial Public Class RatingSample
Inherits UserControl
''' <summary>
''' Initializes a new instance of the RatingSample class.
''' </summary>
Public Sub New()
InitializeComponent()
End Sub
''' <summary>
''' Changes the foreground of the rating control to yellow.
''' </summary>
''' <param name="sender">Sender Rating.</param>
''' <param name="e">Event args.</param>
<SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification:="Method is called in XAML.")> _
Private Sub OnMovieValueChanged(ByVal sender As Object, ByVal e As RoutedPropertyChangedEventArgs(Of Global.System.Nullable(Of Double)))
movie.Foreground = New SolidColorBrush(Color.FromArgb(255, 255, 203, 0))
End Sub
''' <summary>
''' Set the value of the rating control to 0.
''' </summary>
''' <param name="sender">Sender Button.</param>
''' <param name="e">Event args.</param>
<SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification:="Method is called in XAML.")> _
Private Sub Button_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
movie.Value = 0
End Sub
End Class |
'Created by Salleh Jahaf
'Program: Assignment 8 Jefferson Realty
'Program was created to show houses on the market with various details to sort by
'Version 1.01 last updated on 12/17/2015
Option Infer On
Public Class frmDataBase
'Save button in navigator
Private Sub TblHomesBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TblHomesBindingNavigatorSaveItem.Click
'Show connection error to user
Try
Me.Validate()
Me.TblHomesBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.JeffersonRealtyDataSet)
Catch Ex As Exception
MessageBox.Show(Ex.Message, "Jefferson Realty", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'JeffersonRealtyDataSet.tblHomes' table. You can move, or remove it, as needed.
Try
Me.TblHomesTableAdapter.Fill(Me.JeffersonRealtyDataSet.tblHomes)
Catch ex As Exception
MessageBox.Show(ex.Message, "Jefferson Realty", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
'Only show houses with a certain number of bathrooms selected by user
Private Sub Number_Of_Bathrooms(sender As Object, e As EventArgs) Handles ddbBathroom1.Click, ddbBathroom2.Click, ddbBathroom3.Click, ddbBathroom4.Click, ddbBathroom5.Click
Dim tsmSelection As ToolStripMenuItem
Dim intBathrooms As Integer
tsmSelection = sender
intBathrooms = tsmSelection.Tag
Dim records = From Houses In JeffersonRealtyDataSet.tblHomes
Where Houses.NumberOfBathrooms = intBathrooms
Select Houses
TblHomesBindingSource.DataSource = records.AsDataView
End Sub
'Show all houses
Private Sub ddbDisplayAll_Click(sender As Object, e As EventArgs) Handles ddbDisplayAll.Click
Dim records = From Houses In JeffersonRealtyDataSet.tblHomes
Order By Houses.ID
Select Houses
TblHomesBindingSource.DataSource = records.AsDataView
End Sub
'Only show houses with a certain number of bedrooms selected by user
Private Sub ddbBedroom1_Click(sender As Object, e As EventArgs) Handles ddbBedroom1.Click, ddbBedroom2.Click, ddbBedroom3.Click, ddbBedroom4.Click, ddbBedroom5.Click
Dim tsmSelection As ToolStripMenuItem
Dim intBedrooms As Integer
tsmSelection = sender
intBedrooms = tsmSelection.Tag
Dim records = From Houses In JeffersonRealtyDataSet.tblHomes
Where Houses.NumberOfBedrooms = intBedrooms
Select Houses
TblHomesBindingSource.DataSource = records.AsDataView
End Sub
'Only show houses with a certain zipcode selected by user
Private Sub ddbZipcode4_Click(sender As Object, e As EventArgs) Handles ddbZipcode4.Click, ddbZipcode6.Click, ddbZipcode8.Click
Dim tsmSelection As ToolStripMenuItem
Dim intZipcode As Integer
tsmSelection = sender
intZipcode = tsmSelection.Tag
Dim records = From Houses In JeffersonRealtyDataSet.tblHomes
Where Houses.Zipcode = intZipcode
Select Houses
TblHomesBindingSource.DataSource = records.AsDataView
End Sub
'Display average asking price of all houses
Private Sub ddbAverageAll_Click(sender As Object, e As EventArgs) Handles ddbAverageAll.Click
Dim dblAvgHomes As Double =
Aggregate Houses In JeffersonRealtyDataSet.tblHomes
Select Houses.AskingPrice Into Average()
MessageBox.Show("Average asking price for all homes is " & dblAvgHomes.ToString("C2"), "Jefferson Realty", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
'Display average asking price of houses with a certain zipcode selected by user
Private Sub ddbAvgZip4_Click(sender As Object, e As EventArgs) Handles ddbAvgZip4.Click, ddbAvgZip6.Click, ddbAvgZip8.Click
Dim tsmSelection As ToolStripMenuItem
Dim intZipcode As Integer
tsmSelection = sender
intZipcode = tsmSelection.Tag
Dim dblAvgHomes As Double =
Aggregate Houses In JeffersonRealtyDataSet.tblHomes
Where Houses.Zipcode = intZipcode
Select Houses.AskingPrice Into Average()
MessageBox.Show("Average asking price in zipcode " & intZipcode.ToString & " is " & dblAvgHomes.ToString("C2"), "Jefferson Realty", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
End Class
|
Public Class FormMemory
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents vsbScrollBar As System.Windows.Forms.VScrollBar
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FormMemory))
Me.vsbScrollBar = New System.Windows.Forms.VScrollBar
Me.SuspendLayout()
'
'vsbScrollBar
'
Me.vsbScrollBar.Cursor = System.Windows.Forms.Cursors.Arrow
Me.vsbScrollBar.Dock = System.Windows.Forms.DockStyle.Right
Me.vsbScrollBar.Location = New System.Drawing.Point(271, 0)
Me.vsbScrollBar.Name = "vsbScrollBar"
Me.vsbScrollBar.Size = New System.Drawing.Size(21, 270)
Me.vsbScrollBar.TabIndex = 0
'
'frmMemory
'
Me.AutoScaleBaseSize = New System.Drawing.Size(8, 16)
Me.ClientSize = New System.Drawing.Size(292, 270)
Me.Controls.Add(Me.vsbScrollBar)
Me.Cursor = System.Windows.Forms.Cursors.Hand
Me.Font = New System.Drawing.Font("Consolas", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.KeyPreview = True
Me.Name = "frmMemory"
Me.Text = "Memory"
Me.ResumeLayout(False)
End Sub
#End Region
Private sIndex As Integer
Private lh As Single
Private b As Brush = New SolidBrush(Color.Black)
Private b2 As Brush = New SolidBrush(Color.Beige)
Private colX(2) As Integer
Private ctrlWidth As Integer
Private ctrlHeight As Integer
Private mouseIsOver As Boolean
Private freezeSel As Boolean
Private selIdx As Integer
Private Const Space4 As String = " "
Private p As Pen
Private p2 As Pen = New Pen(Color.LightGray)
Private sf As StringFormat = New StringFormat(StringFormatFlags.MeasureTrailingSpaces Or StringFormatFlags.FitBlackBox)
Private Sub frmMemory_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Font = New Font("Consolas", 10, FontStyle.Regular)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.DoubleBuffered = True
Me.UpdateStyles()
With vsbScrollBar
.Minimum = 0
.Maximum = maxMem
End With
lh = Me.CreateGraphics.MeasureString("8", Me.Font).Height
End Sub
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
With e.Graphics
.CompositingQuality = Drawing2D.CompositingQuality.HighSpeed
.PixelOffsetMode = Drawing2D.PixelOffsetMode.HighSpeed
.SmoothingMode = Drawing2D.SmoothingMode.HighSpeed
End With
RenderMemory(e.Graphics)
End Sub
Friend Sub RenderMemory(ByVal g As Graphics)
Dim y As Single = 6
Dim x As Single = 2
Dim s As String = ""
Dim h As Integer = 0
p = New Pen(CType(IIf(isDebugging, Color.Blue, Color.Gray), Color))
If followPointer And isRunning Then
h = CInt(ctrlHeight / (lh + 6))
sIndex = ptr
sIndex = sIndex - h \ 2
If sIndex < 0 Then sIndex = 0
vsbScrollBar.Value = sIndex
End If
For i As Integer = sIndex To maxMem
Select Case maxCellSize
Case 255
s = padZeros(Hex(i)) + Space4 + _
padZeros(mem(i)) + Space4 + _
padZeros(Hex(mem(i))) + Space4 + _
Chr(mem(i))
Case 511
s = padZeros(Hex(i)) + Space4 + _
padZeros(mem(i)) + Space4 + _
padZeros(Hex(mem(i))) + Space4 + _
ChrW(mem(i))
End Select
If i = ptr Then g.FillRectangle(b2, 0, y, ctrlWidth, lh + 4)
If i = selIdx And mouseIsOver Then g.DrawRectangle(p, 0, y, ctrlWidth, lh + 4)
g.DrawString(s, Me.Font, b, x, y + 3, sf)
y += (lh + 6)
If y >= ctrlHeight Then Exit For
Next i
g.DrawLine(p2, colX(0), 0, colX(0), Height)
g.DrawLine(p2, colX(1), 0, colX(1), Height)
g.DrawLine(p2, colX(2), 0, colX(2), Height)
p.Dispose()
End Sub
Private Function padZeros(ByVal s As String) As String
Return StrDup(4 - s.Length, "0") + s
End Function
Private Function padZeros(ByVal v As Integer) As String
Dim s As String = CStr(v)
Return Microsoft.VisualBasic.Strings.StrDup(4 - s.Length, "0") + s
End Function
Private Sub vsbScrollBar_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles vsbScrollBar.Scroll
sIndex = vsbScrollBar.Value
Me.Refresh()
End Sub
Private Sub frmMemory_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If freezeSel Then
Me.Refresh()
Else
If e.Y >= 6 And e.X < vsbScrollBar.Left Then
selIdx = CInt((e.Y + 6) / (lh + 6) - 1 + sIndex)
Me.Refresh()
Me.Cursor = IIf(isRunning, Cursors.Hand, Cursors.Default)
Else
Me.Cursor = Cursors.Default
End If
End If
End Sub
Private Sub frmMemory_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseWheel
If freezeSel Then Exit Sub
sIndex -= e.Delta \ 10
If sIndex < 0 Then
sIndex = 0
ElseIf sIndex > maxMem Then
sIndex = maxMem
End If
vsbScrollBar.Value = sIndex
Me.Refresh()
End Sub
Private Sub frmMemory_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
Try
Dim g As Graphics = Me.CreateGraphics
colX(0) = CInt(g.MeasureString(StrDup(4, "8 ") + "88", Me.Font, 0, sf).Width)
colX(1) = CInt(g.MeasureString(StrDup(12, "8 ") + "88", Me.Font, 0, sf).Width)
colX(2) = CInt(g.MeasureString(StrDup(20, "8 ") + "88", Me.Font, 0, sf).Width)
Width = CInt(g.MeasureString(StrDup(32, "8 "), Me.Font).Width + vsbScrollBar.Width * 2)
ctrlWidth = vsbScrollBar.Left - 2
ctrlHeight = CInt(g.VisibleClipBounds.Height - (lh + 6))
Me.MaximumSize = New Size(Width, Screen.PrimaryScreen.WorkingArea.Height)
g.Dispose()
Catch
End Try
End Sub
Private Sub frmMemory_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseEnter
mouseIsOver = True
Me.Refresh()
End Sub
Private Sub frmMemory_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.MouseLeave
mouseIsOver = False
Me.Refresh()
End Sub
Private Sub frmMemory_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
If isDebugging Then
freezeSel = True
vsbScrollBar.Enabled = False
DoInputChar(Me, selIdx, mem(selIdx))
vsbScrollBar.Enabled = True
freezeSel = False
Me.Refresh()
End If
End Sub
End Class
|
Public Class AddEmployee
Private Sub AddEmployee_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Location = AdminPage.Location
Me.Show()
End Sub
Private Sub AddEmployee_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Application.Exit()
End Sub
Private Sub btnSubmit_Click(sender As System.Object, e As System.EventArgs) Handles btnSubmit.Click
'check fields
If txtFName.Text.Trim.Equals("") Then
'error no first name entered
Invalid.Show("No First Name entered")
Return
End If
If txtLName.Text.Trim.Equals("") Then
'error no last name entered
Invalid.Show("No Last Name entered")
Return
End If
If txtAddress1.Text.Trim.Equals("") Then
'error no address entered
Invalid.Show("No Address entered")
Return
End If
If txtSSN.Text.Trim.Equals("") Then
'error no SSN entered
Invalid.Show("No SSN entered")
Return
End If
If txtPhone.Text.Trim.Equals("") Then
'error no phone entered
Invalid.Show("No Phone Number entered")
Return
End If
If txtCity.Text.Trim.Equals("") Then
'error no city entered
Invalid.Show("No City entered")
Return
End If
If txtState.Text.Trim.Equals("") Then
'error no state entered
Invalid.Show("No State entered")
Return
End If
If txtZip.Text.Trim.Equals("") Then
'error no zip entered
Invalid.Show("No Zip Code entered")
Return
End If
If txtUserId.Text.Trim.Equals("") Then
'error no userId entered
Invalid.Show("No UserId entered")
Return
End If
Dim empDB As New EmployeeDB
empDB.LoadDB()
If (empDB.search(txtUserId.Text)) Then
'error user id already taken
Invalid.Show("UserID already exists")
Return
End If
If txtPassword.Text.Trim.Equals("") Then
'error no password entered
Invalid.Show("No Password entered")
Return
End If
Dim tempEmp As New Employee
tempEmp.fName = txtFName.Text.Trim
tempEmp.lName = txtLName.Text.Trim
tempEmp.address1 = txtAddress1.Text.Trim
tempEmp.address2 = txtAddress2.Text.Trim
tempEmp.city = txtCity.Text.Trim
tempEmp.password = txtPassword.Text.Trim
tempEmp.phone = txtPhone.Text.Trim
tempEmp.SSN = txtSSN.Text.Trim
tempEmp.state = txtState.Text.Trim
tempEmp.userId = txtUserId.Text.Trim
tempEmp.zip = txtZip.Text.Trim
If radAdmin.Checked Then
tempEmp.admin = True
Else
tempEmp.admin = False
End If
'clear forms
txtFName.Text = ""
txtLName.Text = ""
txtAddress1.Text = ""
txtAddress2.Text = ""
txtCity.Text = ""
txtPassword.Text = ""
txtPhone.Text = ""
txtSSN.Text = ""
txtState.Text = ""
txtUserId.Text = ""
txtZip.Text = ""
radNotAdmin.Checked = True
empDB.addEmp(tempEmp)
AdminPage.Location = Me.Location
AdminPage.Show()
Me.Hide()
End Sub
Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
AdminPage.Location = Me.Location
AdminPage.Show()
Me.Hide()
End Sub
Private Sub radAdmin_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radAdmin.CheckedChanged
If radAdmin.Checked = True Then
radNotAdmin.Checked = False
Else
radNotAdmin.Checked = True
End If
End Sub
Private Sub radNotAdmin_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles radNotAdmin.CheckedChanged
If radNotAdmin.Checked = True Then
radAdmin.Checked = False
Else
radAdmin.Checked = True
End If
End Sub
End Class |
Imports System.IO
Imports System.Data
Imports System.Data.SqlClient
Imports AppSimplicity.SchemaDiscovery
Namespace SqlServer
Public Class SQLServerMetaDataProvider
Inherits BaseProvider
Implements IMetaDataProvider
Public Function GetTables() As System.Collections.Generic.List(Of Entities.Table) Implements IMetaDataProvider.GetTables
Dim time As New Stopwatch
time.Start()
Dim lReturnValue As New List(Of SchemaDiscovery.Entities.Table)
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, commandType:=CommandType.Text, commandText:=My.Resources.SQLServerExtractionScripts.GET_TABLES)
For Each lDR As DataRow In lDS.Tables(0).Rows
Dim lTable As New SchemaDiscovery.Entities.Table
lTable.Name = lDR.Item("TABLE_NAME").ToString()
lTable.ClassName = lDR.Item("TABLE_NAME").ToString()
lTable.Schema = lDR.Item("TABLE_SCHEMA").ToString()
lReturnValue.Add(lTable)
Next
time.Stop()
Return lReturnValue
End Function
Private Function GetAllColumns(ByVal pTable As Entities.AbstractDataObject) As List(Of Entities.Column)
Dim lReturnValue As New List(Of SchemaDiscovery.Entities.Column)
Dim lParameters As New List(Of SqlClient.SqlParameter)
lParameters.Add(New SqlParameter("@TABLE_SCHEMA", pTable.Schema))
lParameters.Add(New SqlParameter("@TABLE_NAME", pTable.Name))
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, My.Resources.SQLServerExtractionScripts.GET_TABLE_COLUMNS, lParameters.ToArray())
For Each lDR As DataRow In lDS.Tables(0).Rows
Dim lColumn As New SchemaDiscovery.Entities.Column
lColumn.ColumnName = lDR.Item("COLUMN_NAME").ToString()
lColumn.IsNullable = IIf(lDR.Item("IS_NULLABLE").ToString() = "YES", True, False)
lColumn.SQLType = lDR.Item("DATA_TYPE").ToString()
lColumn.CharMaxLength = IIf(lDR.IsNull("CHARACTER_MAXIMUM_LENGTH"), 0, lDR.Item("CHARACTER_MAXIMUM_LENGTH"))
lColumn.IsIdentity = IIf(lDR.Item("IS_IDENTITY") = "YES", True, False)
lReturnValue.Add(lColumn)
Next
Return lReturnValue
End Function
Public Function GetColumns(ByVal pTable As Entities.Table) As System.Collections.Generic.List(Of Entities.Column) Implements IMetaDataProvider.GetColumns
Return Me.GetAllColumns(pTable)
End Function
Public Function GetColumns(ByVal pView As Entities.View) As System.Collections.Generic.List(Of Entities.Column) Implements IMetaDataProvider.GetColumns
Return Me.GetAllColumns(pView)
End Function
Public Function GetStoredProcedureParameters(ByVal storedProcedure As Entities.StoredProcedure) As System.Collections.Generic.List(Of Entities.StoredProcedureParameter) Implements IMetaDataProvider.GetStoredProcedureParameters
Dim lReturnValue As New List(Of SchemaDiscovery.Entities.StoredProcedureParameter)
Dim lParameters As New List(Of SqlClient.SqlParameter)
lParameters.Add(New SqlParameter("@SPECIFIC_SCHEMA", storedProcedure.Schema))
lParameters.Add(New SqlParameter("@SPECIFIC_NAME", storedProcedure.Name))
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, My.Resources.SQLServerExtractionScripts.GET_STOREDPROCEDURE_PARAMETERS, lParameters.ToArray())
For Each lDR As DataRow In lDS.Tables(0).Rows
Dim lParameter As New Entities.StoredProcedureParameter
lParameter.ParameterName = lDR.Item("PARAMETER_NAME").ToString()
lParameter.SQLType = lDR.Item("DATA_TYPE").ToString()
lParameter.CharMaxLength = IIf(lDR.Item("CHARACTER_MAXIMUM_LENGTH") Is System.DBNull.Value, 0, lDR.Item("CHARACTER_MAXIMUM_LENGTH"))
lParameter.ParameterDirection = ParameterDirection.Input
lReturnValue.Add(lParameter)
Next
Return lReturnValue
End Function
Public Function GetStoredProcedures() As System.Collections.Generic.List(Of Entities.StoredProcedure) Implements IMetaDataProvider.GetStoredProcedures
Dim lReturnValue As New List(Of SchemaDiscovery.Entities.StoredProcedure)
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, My.Resources.SQLServerExtractionScripts.GET_STORED_PROCEDURES)
For Each lDR As DataRow In lDS.Tables(0).Rows
Dim lProc As New SchemaDiscovery.Entities.StoredProcedure
lProc.Schema = lDR.Item("SPECIFIC_SCHEMA").ToString()
lProc.Name = lDR.Item("SPECIFIC_NAME").ToString()
lReturnValue.Add(lProc)
Next
Return lReturnValue
End Function
Public Function GetViews() As System.Collections.Generic.List(Of Entities.View) Implements IMetaDataProvider.GetViews
Dim lReturnValue As New List(Of SchemaDiscovery.Entities.View)
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, My.Resources.SQLServerExtractionScripts.GET_VIEWS)
For Each lDR As DataRow In lDS.Tables(0).Rows
Dim lView As New SchemaDiscovery.Entities.View
lView.Name = lDR.Item("TABLE_NAME").ToString()
lView.ClassName = lDR.Item("TABLE_NAME").ToString()
lView.Schema = lDR.Item("TABLE_SCHEMA").ToString()
lReturnValue.Add(lView)
Next
Return lReturnValue
End Function
Public Sub ScriptData(ByVal table As Entities.Table, ByRef OutputStream As System.IO.Stream) Implements IMetaDataProvider.ScriptData
Dim lScripter As New SQLServerDataScripter(ConnectionString)
Dim lStreamWriter As New System.IO.StreamWriter(OutputStream, System.Text.Encoding.Unicode)
lScripter.ScriptData(table, lStreamWriter)
End Sub
Public Function GetKeys(ByVal table As Entities.Table) As System.Collections.Generic.List(Of Entities.TableKey) Implements IMetaDataProvider.GetKeys
Dim lReturnValue As New List(Of Entities.TableKey)
Dim lParameters As New List(Of SqlClient.SqlParameter)
lParameters.Add(New SqlParameter("@SCHEMA_NAME", table.Schema))
lParameters.Add(New SqlParameter("@TABLE_NAME", table.Name))
Dim lDS As DataSet = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, My.Resources.SQLServerExtractionScripts.GET_TABLE_KEYS, lParameters.ToArray())
If (lDS.Tables.Count > 1) Then
If (lDS.Tables.Count > 1) Then
For Each lRow As System.Data.DataRow In lDS.Tables(0).Rows
Dim lKey As New Entities.TableKey
lKey.Name = lRow.Item("KEY_NAME")
lKey.KeyType = Entities.KeyTypes.Index
If (lRow.Item("KEY_TYPE").ToString() = "PRIMARY_KEY") Then
lKey.KeyType = Entities.KeyTypes.PrimaryKey
End If
For Each lColRow As DataRow In lDS.Tables(1).Rows
If (lColRow.Item("KEY_NAME") = lKey.Name) Then
Dim lCol As New Entities.KeyColumn
lCol.ColumnName = lColRow.Item("COLUMN_NAME")
lCol.SortDirection = Entities.SortDirection.Ascending
If lColRow.Item("SORT_DIRECTION").ToString() = "DESC" Then
lCol.SortDirection = Entities.SortDirection.Descending
End If
lKey.Columns.Add(lCol)
End If
Next
lReturnValue.Add(lKey)
Next
End If
End If
Return lReturnValue
End Function
Public Sub SetConnectionString(ByVal connectionString As String) Implements IMetaDataProvider.SetConnectionString
_connectionString = connectionString
End Sub
Private _connectionString As String
Public Property ConnectionString As String Implements IMetaDataProvider.ConnectionString
Get
Return _connectionString
End Get
Set(value As String)
_connectionString = value
End Set
End Property
End Class
End Namespace
|
Imports FLEXYGO.Objects
Imports FLEXYGO.Processing.ProcessManager
Public Class SampleCreateUser
''' <summary>
''' Sample create user
''' </summary>
''' <param name="Entity">The entity.</param>
''' <param name="Ret">Returns a Process Helper.</param>
''' <returns><c>true</c> if no error, <c>false</c> otherwise.</returns>
''' <exception cref="System.Exception">Returns error</exception>
Public Shared Function SampleCreateUser(ByVal Entity As EntityObject, ByRef Ret As ProcessHelper) As Boolean
Try
'Get the employee's name
Dim split As String() = Entity("Name").split(" ")
Dim userName = split(0).ToLower
'Create a new entity sysUser
Dim user As EntityObject = New EntityObject("sysUser", Ret.ConfToken)
'Create a new GUID
Dim guid As Guid = Guid.NewGuid()
'Fill the entity with the minimum fields
user("Id") = guid
user("RoleId") = "users"
user("ProfileName") = "default"
user("Email") = Entity("Email")
user("EmailConfirmed") = False
user("UserName") = userName
user("CultureId") = "es-ES"
user("PhoneNumberConfirmed") = False
user("TwoFactorEnabled") = False
user("AccessFailedCount") = False
'We check if it has been inserted correctly
If user.Insert Then
Ret.Success = True
Ret.SuccessMessage = "User Create"
Else
Ret.Success = False
Ret.LastException = user.LastException
End If
Return Ret.Success
Catch ex As Exception
Ret.Success = False
Ret.LastException = ex
Return False
End Try
End Function
End Class |
Imports System.ComponentModel
' This class demonstrates the code that will be generated by the POCO mechanism at runtime
Namespace MVVMDemo.POCOViewModels
Public Class PropertiesViewModel_RuntimeGeneratedCode
Inherits PropertiesViewModel
Implements INotifyPropertyChanged
Public Overrides Property UserName() As String
Get
Return MyBase.UserName
End Get
Set(ByVal value As String)
If MyBase.UserName = value Then
Return
End If
Dim oldValue As String = MyBase.UserName
MyBase.UserName = value
OnUserNameChanged(oldValue)
RaisePropertyChanged("UserName")
End Set
End Property
Public Overrides Property ChangedStatus() As String
Get
Return MyBase.ChangedStatus
End Get
Set(ByVal value As String)
If MyBase.ChangedStatus = value Then
Return
End If
MyBase.UserName = value
RaisePropertyChanged("ChangedStatus")
End Set
End Property
#Region "INotifyPropertyChanged implementation"
Public Event PropertyChanged As PropertyChangedEventHandler Implements INotifyPropertyChanged.PropertyChanged
Private Sub RaisePropertyChanged(ByVal propertyName As String)
Dim handler = PropertyChangedEvent
If handler IsNot Nothing Then
handler(Me, New PropertyChangedEventArgs(propertyName))
End If
End Sub
#End Region
End Class
End Namespace
|
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'* Copyright (C) 2013-2016 NamCore Studio <https://github.com/megasus/Namcore-Studio>
'*
'* This program is free software; you can redistribute it and/or modify it
'* under the terms of the GNU General Public License as published by the
'* Free Software Foundation; either version 3 of the License, or (at your
'* option) any later version.
'*
'* This program is distributed in the hope that it will be useful, but WITHOUT
'* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
'* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
'* more details.
'*
'* You should have received a copy of the GNU General Public License along
'* with this program. If not, see <http://www.gnu.org/licenses/>.
'*
'* Developed by Alcanmage/megasus
'*
'* //FileInfo//
'* /Filename: SkillCreation
'* /Description: Includes functions for setting up the known skills of a specific
'* character
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Imports NCFramework.Framework.Database
Imports NCFramework.Framework.Logging
Imports NCFramework.Framework.Modules
Namespace Framework.Transmission
Public Module SkillCreation
Public Sub AddSkills(skillsstring As String, player As Character,
Optional forceTargetCore As Boolean = False)
'TODO
Dim useCore As Modules.Core
Dim useStructure As DbStructure
If forceTargetCore Then
useCore = GlobalVariables.targetCore
useStructure = GlobalVariables.targetStructure
Else
useCore = GlobalVariables.sourceCore
useStructure = GlobalVariables.sourceStructure
End If
Dim mySkills() As String = skillsstring.Split(","c)
Dim skillCount As Integer = UBound(Split(skillsstring, ","))
For i = 0 To skillCount - 1
Dim mySkill As String = mySkills(i)
LogAppend("Adding Skill " & mySkill, "SkillCreation_AddSkills")
Select Case useCore
Case Modules.Core.TRINITY
runSQLCommand_characters_string(
"INSERT IGNORE INTO `" & useStructure.character_skills_tbl(0) & "`( `" &
useStructure.skill_guid_col(0) & "`, `" &
useStructure.skill_skill_col(0) & "`, `" &
useStructure.skill_value_col(0) & "`, `" &
useStructure.skill_max_col(0) &
"` ) VALUES ( '" &
player.CreatedGuid.ToString & "', '" &
mySkill & "', '1', '1' )", forceTargetCore)
End Select
Next
End Sub
Public Sub AddUpdateSkill(skill As Skill, player As Character,
Optional forceTargetCore As Boolean = False)
'TODO
Dim useCore As Modules.Core
Dim useStructure As DbStructure
If forceTargetCore Then
useCore = GlobalVariables.targetCore
useStructure = GlobalVariables.targetStructure
Else
useCore = GlobalVariables.sourceCore
useStructure = GlobalVariables.sourceStructure
End If
LogAppend("Adding Skill " & skill.Id.ToString(), "SkillCreation_AddUpdateSkill")
Select Case useCore
Case Modules.Core.TRINITY
runSQLCommand_characters_string(
"INSERT IGNORE INTO `" & useStructure.character_skills_tbl(0) & "` ( `" &
useStructure.skill_guid_col(0) & "`, `" &
useStructure.skill_skill_col(0) & "`, `" &
useStructure.skill_value_col(0) & "`, `" &
useStructure.skill_max_col(0) &
"` ) VALUES ( '" &
player.CreatedGuid.ToString & "', '" &
skill.Id.ToString() & "', '" & skill.Value.ToString() & "', '" & skill.Max.ToString() &
"' ) on duplicate key update `" &
useStructure.skill_value_col(0) & "`=values(`" &
useStructure.skill_value_col(0) & "`), `" &
useStructure.skill_max_col(0) & "`=values(`" &
useStructure.skill_max_col(0) & "`)", forceTargetCore)
End Select
End Sub
Public Sub AddProfession(prof As Profession, player As Character,
Optional forceTargetCore As Boolean = False)
'TODO
Dim useCore As Modules.Core
Dim useStructure As DbStructure
If forceTargetCore Then
useCore = GlobalVariables.targetCore
useStructure = GlobalVariables.targetStructure
Else
useCore = GlobalVariables.sourceCore
useStructure = GlobalVariables.sourceStructure
End If
LogAppend("Adding Skill " & prof.Id.ToString(), "SkillCreation_AddUpdateSkill")
Select Case useCore
Case Modules.Core.TRINITY
runSQLCommand_characters_string(
"INSERT IGNORE INTO `" & useStructure.character_skills_tbl(0) & "` ( `" &
useStructure.skill_guid_col(0) & "`, `" &
useStructure.skill_skill_col(0) & "`, `" &
useStructure.skill_value_col(0) & "`, `" &
useStructure.skill_max_col(0) &
"` ) VALUES ( '" &
player.CreatedGuid.ToString & "', '" &
prof.Id.ToString() & "', '" & prof.Rank.ToString() & "', '" & prof.Max.ToString() &
"' ) on duplicate key update `" &
useStructure.skill_value_col(0) & "`=values(`" &
useStructure.skill_value_col(0) & "`), `" &
useStructure.skill_max_col(0) & "`=values(`" &
useStructure.skill_max_col(0) & "`)", forceTargetCore)
End Select
End Sub
Public Sub AddCharacterSkills(player As Character)
'TODO
Select Case GlobalVariables.targetCore
Case Modules.Core.TRINITY, Modules.Core.MANGOS
If Not player.Skills Is Nothing Then
For Each skl As Skill In player.Skills
LogAppend("Adding Skill " & skl.Id, "SkillCreation_AddCharacterSkills")
runSQLCommand_characters_string(
"INSERT IGNORE INTO `" & GlobalVariables.targetStructure.character_skills_tbl(0) &
"`( `" &
GlobalVariables.targetStructure.skill_guid_col(0) & "`, `" &
GlobalVariables.targetStructure.skill_skill_col(0) & "`, `" &
GlobalVariables.targetStructure.skill_value_col(0) & "`, `" &
GlobalVariables.targetStructure.skill_max_col(0) &
"` ) VALUES ( '" &
player.CreatedGuid.ToString & "', '" &
skl.Id.ToString() & "', '" & skl.Value.ToString() & "', '" & skl.Max.ToString() & "' )",
True)
Next
End If
End Select
End Sub
End Module
End Namespace |
Option Strict On
Option Explicit On
Imports Microsoft.Win32.SafeHandles
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.data
Imports System.Security
<SuppressUnmanagedCodeSecurity()>
Friend Class NativeMethods
<DllImport("kernel32", SetLastError:=True)>
Public Shared Function CreateFile(fileName As String, desiredAccess As UInteger,
shareMode As UInteger, securityAttributes As IntPtr, creationDisposition As UInteger,
flagsAndAttributes As UInteger,
hTemplateFile As IntPtr) As SafeFileHandle
End Function
<DllImport("kernel32", SetLastError:=True)>
Public Shared Function DeviceIoControl(hVol As SafeFileHandle, controlCode As Integer,
ByVal inbuffer As IntPtr, inBufferSize As Integer,
ByRef outBuffer As SCSI_ADDRESS, outBufferSize As Integer,
<Out()> ByRef bytesReturned As Integer, ovelapped As IntPtr) As Boolean
End Function
<DllImport("kernel32", SetLastError:=True)>
Public Shared Function DeviceIoControl(hVol As SafeFileHandle, controlCode As Integer,
ByRef inbuffer As SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, inBufferSize As Integer,
ByRef outBuffer As SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER, outBufferSize As Integer,
<Out()> ByRef bytesReturned As Integer, ovelapped As IntPtr) As Boolean
End Function
End Class
Friend Enum CharacterCode
ISO88591 = 0
ISO646ASCII = 1
MSJIS = &H80
Korean = &H81
MandarinStandardChinese = &H82
End Enum
Friend Enum CommandDirection As Byte
SCSI_IOCTL_DATA_OUT = 0
SCSI_IOCTL_DATA_IN = 1
SCSI_IOCTL_DATA_UNSPECIFIED = 2
End Enum
Public Enum Language
' Language codes, some are in cdrdao, which led me to the rest in
' "Standard handbook of audio and radio engineering", google books.
Unknown = 0
Albanian
Breton
Catalan
Croatian
Welsh
Czech
Danish
German
English
Spanish
Esperanto
Estonian
Basque
Faroese
French
Frisian
Irish
Gaelic
Galician
Icelandic
Italia
Lappish
Latin
Latvian
Luxembourgian
Lithuanian
Hungarian
Maltese
Dutch
Norwegian
Occitan
Polish
Portugese
Romanian
Romansh
Serbian
Slovak
Slovenian
Finnish
Swedish
Turkish
Flemish
' gap for reserved ones.
Zulu = &H45
Vietnamese
Uzbek
Urdu
Ukrainian
Thai
Telugu
Tatar
Tamil
Tadzhik
Swahili
SrananTongo
Somali
Sinhalese
Shona
SerboCroat
Ruthenian
Russian
Quechua
Pushtu
Punjabi
Persian
Papamiento
Oriya
Nepali
Ndebele
Marathi
Moldavian
Malaysian
Malagasay
Macedonian
Laotian
Korean
Khmer
Kazakh
Kannada
Japanese
Indonesian
Hindi
Hebrew
Hausa
Gurani
Gujurati
Greek
Georgian
Fulani
Dari
Churash
Chinese
Burmese
Bulgarian
Bengali
Bielorussian
Bambora
Azerbaijani
Assamese
Armenian
Arabic
Amharic
End Enum
Friend Enum PackType As Byte
Title = &H80
Performer = &H81
Songwriter = &H82
Composer = &H83
Arranger = &H84
Message = &H85
DiscInformation = &H86
Genre = &H87
' Toc = &H88
' Toc2 = &H89
Code = &H8E
Size = &H8F
End Enum
<StructLayout(LayoutKind.Sequential)>
Public Structure SCSI_ADDRESS
Public Length As Integer
Public PortNumber As Byte
Public PathId As Byte
Public TargetId As Byte
Public Lun As Byte
Public Shared Function GetSize() As Byte
Return CType(Marshal.SizeOf(GetType(SCSI_ADDRESS)), Byte)
End Function
End Structure
<StructLayout(LayoutKind.Sequential)>
Friend Structure SCSI_PASS_THROUGH_DIRECT ' x86 x64
Public Length As Short ' 0 0
Public ScsiStatus As Byte ' 2 2
Public PathId As Byte ' 3 3
Public TargetId As Byte ' 4 4
Public Lun As Byte ' 5 5
Public CdbLength As Byte ' 6 6
Public SenseInfoLength As Byte ' 7 7
Public DataIn As CommandDirection ' 8 8
Public DataTransferLength As Integer ' 12 12
Public TimeOutValue As Integer ' 16 16
Public DataBuffer As IntPtr ' 20 24
Public SenseInfoOffset As Integer ' 24 32
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=16)>
Public cdb As Byte() ' 28 36
' Size 44 56
Public Shared Function GetSize() As Integer
Return Marshal.SizeOf(GetType(SCSI_PASS_THROUGH_DIRECT))
End Function
End Structure
<StructLayout(LayoutKind.Sequential)>
Friend Structure SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
Public ScsiPassThroughDirect As SCSI_PASS_THROUGH_DIRECT ' 0 0
Public Filler As Integer ' 44 56
<MarshalAs(UnmanagedType.ByValArray, sizeconst:=32)>
Public SenseBuffer As Byte() ' 48 60
' = 80 96
End Structure
Friend Class BlockInfo
Property BlockNumber As Integer
Property CharCode As Integer
Property FirstTrack As Integer
Property LastTrack As Integer
Public Property PackCounts As IDictionary(Of PackType, Integer)
Public Property LanguageCode As Integer ' language code of this block
Sub New(blockNo As Integer)
Me.BlockNumber = blockNo
Me.PackCounts = New Dictionary(Of PackType, Integer)
End Sub
Private Shared Function GetBlockNo(bytes As Byte(), index As Integer) As Integer
Return (bytes(index + 3) >> 4) And &H7
End Function
End Class
Friend Class BlockInfoCollection
Inherits KeyedCollection(Of Integer, BlockInfo)
Protected Overrides Function GetKeyForItem(item As BlockInfo) As Integer
Return item.BlockNumber
End Function
Public Function GetExistingOrAddNew(blockNo As Integer) As BlockInfo
If Me.Contains(blockNo) Then
Return Me(blockNo)
Else
Dim blockInfo As New BlockInfo(blockNo)
Me.Add(blockInfo)
Return blockInfo
End If
End Function
End Class
Public Class CdText
Public Property LanguageCodes As Integer()
Public Property DiscInformation As String
Public Property GenreCode As Integer
Public Property Genre As String
Friend Sub New()
End Sub
Property TrackData As DataTable
End Class
Public Class CdTextRetriever
Public Shared Function GetCdText(driveInfo As DriveInfo) As CdText
Dim devicePath As String = String.Format("\\.\{0}:", driveInfo.Name(0))
Const FILE_ATTRIBUTE_NORMAL As UInteger = &H80
Const GENERIC_READ As UInteger = &H80000000UI
Const GENERIC_WRITE As UInteger = &H40000000
Const FILE_SHARE_READ As UInteger = 1
Const FILE_SHARE_WRITE As UInteger = 2
Const OPEN_EXISTING As UInteger = 3
Using hDevice As SafeFileHandle = NativeMethods.CreateFile(devicePath, GENERIC_READ Or GENERIC_WRITE, FILE_SHARE_READ Or FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, IntPtr.Zero)
If hDevice.IsInvalid OrElse hDevice.IsClosed Then Return Nothing
Return ReadCdText(hDevice)
End Using
End Function
Private Shared Function ReadCdText(hDevice As SafeFileHandle) As CdText
Dim address As SCSI_ADDRESS = GetScsiAddress(hDevice)
If address.Length = 0 And address.Lun = 0 And address.PathId = 0 And address.PortNumber = 0 And address.TargetId = 0 Then Return Nothing
Dim bytes(1) As Byte
GetCdTextBytes(hDevice, address, bytes)
bytes = New Byte((CType(bytes(0), Integer) << 8) Or bytes(1) + 1) {}
GetCdTextBytes(hDevice, address, bytes)
Dim parser As New DataPacketParser
Return parser.ReadCtText(bytes)
End Function
Private Shared Function GetScsiAddress(hDevice As SafeFileHandle) As SCSI_ADDRESS
Dim address As New SCSI_ADDRESS
Dim bytesReturned As Integer
Const IOCTL_SCSI_GET_ADDRESS As Integer = &H41018
Try
Dim result As Boolean = NativeMethods.DeviceIoControl(hDevice, IOCTL_SCSI_GET_ADDRESS, IntPtr.Zero, 0, address, SCSI_ADDRESS.GetSize, bytesReturned, IntPtr.Zero)
If result = False Then Return Nothing
Catch ex As Exception
Return Nothing
End Try
Return address
End Function
Private Shared Sub GetCdTextBytes(hDevice As SafeFileHandle, address As SCSI_ADDRESS, bytes As Byte())
Dim bytesReturned As Integer
Dim sptdwb As New SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER
Dim pinnedBytesHandle As GCHandle = GCHandle.Alloc(bytes, GCHandleType.Pinned)
sptdwb.ScsiPassThroughDirect.cdb = New Byte(15) {}
sptdwb.SenseBuffer = New Byte(31) {}
sptdwb.ScsiPassThroughDirect.Length = CShort(SCSI_PASS_THROUGH_DIRECT.GetSize)
sptdwb.ScsiPassThroughDirect.CdbLength = 10
sptdwb.ScsiPassThroughDirect.DataIn = CommandDirection.SCSI_IOCTL_DATA_IN
sptdwb.ScsiPassThroughDirect.DataTransferLength = bytes.Length
sptdwb.ScsiPassThroughDirect.DataBuffer = pinnedBytesHandle.AddrOfPinnedObject
sptdwb.ScsiPassThroughDirect.TimeOutValue = 10
sptdwb.ScsiPassThroughDirect.SenseInfoOffset = Marshal.OffsetOf(GetType(SCSI_PASS_THROUGH_DIRECT_WITH_BUFFER), "SenseBuffer").ToInt32
sptdwb.ScsiPassThroughDirect.SenseInfoLength = 24
sptdwb.ScsiPassThroughDirect.PathId = address.PathId
sptdwb.ScsiPassThroughDirect.TargetId = address.TargetId
sptdwb.ScsiPassThroughDirect.Lun = address.Lun
sptdwb.ScsiPassThroughDirect.cdb(0) = &H43
sptdwb.ScsiPassThroughDirect.cdb(2) = 5
sptdwb.ScsiPassThroughDirect.cdb(7) = CByte((bytes.Length >> 8) And &HFF)
sptdwb.ScsiPassThroughDirect.cdb(8) = CByte(bytes.Length And &HFF)
Try
Const IOCTL_SCSI_PASS_THROUGH_DIRECT As Integer = &H4D014
Dim result As Boolean = NativeMethods.DeviceIoControl(hDevice, IOCTL_SCSI_PASS_THROUGH_DIRECT, sptdwb, Marshal.SizeOf(sptdwb), sptdwb, Marshal.SizeOf(sptdwb), bytesReturned, IntPtr.Zero)
If result = False Then Throw New Win32Exception
Dim error1 As IoctlResult = IoctlResult.FromSenseBuffer(sptdwb.SenseBuffer, sptdwb.ScsiPassThroughDirect.ScsiStatus)
If Not (error1.SenseKey = 0 AndAlso error1.AdditionalSenseCode = 0 AndAlso error1.AdditionalSenseCodeQualifier = 0) Then
Debug.Print("unable to get CD Text: " & error1.ErrorMessage)
'Throw New IO.IOException(error1.ErrorMessage)
End If
Finally
pinnedBytesHandle.Free()
End Try
End Sub
End Class
Friend Class Crc
Private Shared table() As UShort
Shared Sub New()
table = New UShort(255) {}
For i As UShort = 0 To 255
Dim temp As UShort = 0
Dim a As UShort = i << 8
For j As Integer = 0 To 7
If (((temp Xor a) And &H8000US) <> 0US) Then
temp = (temp << 1) Xor 4129US
Else
temp <<= 1
End If
a <<= 1
Next
table(i) = temp
Next
End Sub
Private Shared Function GetCrc(bytes As Byte(), index As Integer) As UShort
Dim crc As UShort = 0
For i As Integer = index To index + 15
crc = (crc << 8) Xor table((crc >> 8) Xor bytes(i))
Next
Return Not crc
End Function
Private Shared Function GetCrcFromPackData(bytes As Byte(), index As Integer) As UShort
Return (CUShort(bytes(index + 16)) << 8) Or bytes(index + 17)
End Function
Public Shared Function CrcIsOk(bytes As Byte(), index As Integer) As Boolean
Dim crcCalculated As UShort = Crc.GetCrc(bytes, index)
Dim crcStored As UShort = GetCrcFromPackData(bytes, index)
Return crcCalculated = crcStored
End Function
End Class
Public Class DataPacketParser
Private blockInfos As BlockInfoCollection
Private cdText As CdText
Public Function ReadCtText(bytes As Byte()) As CdText
blockInfos = New BlockInfoCollection
cdText = New CdText
Pass1(bytes)
Pass2(bytes)
Return cdText
End Function
Private Sub Pass1(bytes As Byte())
Dim languageCodes(7) As Language
Dim discInfoBuilder As New StringBuilder
Dim genreBuilder As New StringBuilder
For index As Integer = 4 To bytes.Length - 19 Step 18
If Not Crc.CrcIsOk(bytes, index) Then
' maybe you could be more lenient if it's just some one or two corrupt packets.
Throw New IO.InvalidDataException("Crc check failed.")
End If
Dim packTypeRaw As Byte = bytes(index)
Select Case packTypeRaw
Case PackType.Size ' &H8F
Dim blockInfo As BlockInfo = blockInfos.GetExistingOrAddNew(GetBlockNo(bytes, index))
Select Case bytes(index + 1)
Case 0
blockInfo.CharCode = bytes(index + 4)
blockInfo.FirstTrack = bytes(index + 5)
blockInfo.LastTrack = bytes(index + 6)
blockInfo.PackCounts.Add(PackType.Title, bytes(index + 8))
blockInfo.PackCounts.Add(PackType.Performer, bytes(index + 9))
blockInfo.PackCounts.Add(PackType.Songwriter, bytes(index + 10))
blockInfo.PackCounts.Add(PackType.Composer, bytes(index + 11))
blockInfo.PackCounts.Add(PackType.Arranger, bytes(index + 12))
blockInfo.PackCounts.Add(PackType.Message, bytes(index + 13))
blockInfo.PackCounts.Add(PackType.DiscInformation, bytes(index + 14))
blockInfo.PackCounts.Add(PackType.Genre, bytes(index + 15))
Case 1
blockInfo.PackCounts.Add(PackType.Code, bytes(index + 10))
Case 2
For j As Integer = 8 To 15
languageCodes(j - 8) = CType(bytes(index + j), Language)
Next
blockInfo.LanguageCode = languageCodes(blockInfo.BlockNumber)
End Select
Case PackType.DiscInformation ' &H86
discInfoBuilder.Append(EncodingManager.Iso88591.GetString(bytes, index + 4, 12))
Case PackType.Genre
If bytes(index + 3) = 0 Then
cdText.GenreCode = (CInt(bytes(index + 4)) << 8) Or bytes(index + 5)
genreBuilder.Append(EncodingManager.Iso88591.GetString(bytes, index + 6, 10))
Else
genreBuilder.Append(EncodingManager.Iso88591.GetString(bytes, index + 4, 12))
End If
End Select
Next
cdText.LanguageCodes = languageCodes
cdText.DiscInformation = discInfoBuilder.ToString
cdText.Genre = genreBuilder.ToString
End Sub
Private Sub Pass2(bytes As Byte())
Dim dt As DataTable = GetDataTable()
For index As Integer = 4 To bytes.Length - 19 Step 18
Dim packType As PackType = CType(bytes(index), PackType)
If (packType >= packType.Title AndAlso packType <= packType.Message) OrElse packType = packType.Code Then
Dim blockNo As Integer = GetBlockNo(bytes, index)
Dim blockInfo As BlockInfo = blockInfos(blockNo)
Dim languageCode As Integer = blockInfo.LanguageCode
Dim encoding As Encoding = EncodingManager.GetEncoding(blockInfo.CharCode)
Dim trackNo As Integer = GetTrackNo(bytes, index)
Dim maxTrackNo As Integer = blockInfo.LastTrack
Dim chars() As Char = encoding.GetChars(bytes, index + 4, 12)
Dim dr As DataRow = GetDataRow(dt, languageCode, trackNo)
Dim sb As New StringBuilder
Dim colIndex As Integer = ColumnIndexFromPackType(packType)
For j As Integer = 0 To chars.Length - 1
If chars(j) = Char.MinValue Then
Dim s As String = If(dr.Field(Of String)(colIndex), "")
sb.Insert(0, s)
dr(colIndex) = sb.ToString
trackNo += 1
If trackNo > maxTrackNo Then Exit For
sb.Clear()
dr = GetDataRow(dt, languageCode, trackNo)
Else
sb.Append(chars(j))
If j = chars.Length - 1 Then
Dim s As String = If(dr.Field(Of String)(colIndex), "")
sb.Insert(0, s)
dr(colIndex) = sb.ToString
End If
End If
Next
End If
Next
cdText.TrackData = dt
End Sub
Private Shared Function GetDataRow(dt As DataTable, language As Integer, trackNo As Integer) As DataRow
Dim dr As DataRow = (From dr2 As DataRow In dt.AsEnumerable Where dr2.Field(Of Integer)(0) = language AndAlso dr2.Field(Of Integer)(1) = trackNo Select dr2).FirstOrDefault
If dr Is Nothing Then
dr = dt.NewRow
dr(0) = language
dr(1) = trackNo
dt.Rows.Add(dr)
End If
Return dr
End Function
Private Shared Function ColumnIndexFromPackType(packType As PackType) As Integer
Select Case packType
Case packType.Title
Return 2
Case packType.Performer
Return 3
Case packType.Songwriter
Return 4
Case packType.Composer
Return 5
Case packType.Arranger
Return 6
Case packType.Message
Return 7
Case packType.Code
Return 8
Case Else
Throw New ArgumentException("Invalid pack type")
End Select
End Function
Private Shared Function GetDataTable() As DataTable
Dim dt As New DataTable
dt.Columns.Add("Language", GetType(Integer))
dt.Columns.Add("Track No", GetType(Integer))
dt.Columns.Add("Title", GetType(String))
dt.Columns.Add("Performer", GetType(String))
dt.Columns.Add("Songwriter", GetType(String))
dt.Columns.Add("Composer", GetType(String))
dt.Columns.Add("Arranger", GetType(String))
dt.Columns.Add("Messages", GetType(String))
dt.Columns.Add("Code", GetType(String))
dt.PrimaryKey = New DataColumn() {dt.Columns(0), dt.Columns(1)}
Return dt
End Function
Private Shared Function GetBlockNo(bytes As Byte(), index As Integer) As Integer
Return (bytes(index + 3) >> 4) And &H7
End Function
Private Shared Function GetTrackNo(bytes As Byte(), index As Integer) As Integer
Return bytes(index + 1) And &H7F
End Function
Private Shared Function GetIsDoubleByte(bytes As Byte(), index As Integer) As Boolean
Return (bytes(index + 3) And &H80) = &H80
End Function
End Class
Friend Class EncodingManager
Private Shared s_iso646Ascii As Encoding
Private Shared ReadOnly Property Iso646Ascii As Encoding
Get
If s_iso646Ascii Is Nothing Then
s_iso646Ascii = Encoding.GetEncoding(20127)
End If
Return s_iso646Ascii
End Get
End Property
Private Shared s_iso88591 As Encoding
Public Shared ReadOnly Property Iso88591 As Encoding
Get
If s_iso88591 Is Nothing Then
s_iso88591 = Encoding.GetEncoding("ISO-8859-1")
End If
Return s_iso88591
End Get
End Property
Private Shared s_mandarinStandardChinese As Encoding
Private Shared ReadOnly Property MandarinStandardChinese As Encoding
Get
Return s_mandarinStandardChinese
End Get
End Property
Public Shared Function GetEncoding(code As Integer) As Encoding
Select Case code
Case CharacterCode.ISO646ASCII
Return EncodingManager.Iso646Ascii
Case CharacterCode.ISO88591
Return EncodingManager.Iso88591
Case CharacterCode.Korean
Throw New NotImplementedException("Don't know how to decode korean")
Case CharacterCode.MandarinStandardChinese
Return EncodingManager.MandarinStandardChinese
Case CharacterCode.MSJIS
Throw New NotImplementedException("Don't know how to decode MSJIS")
Case Else
Throw New NotImplementedException("Don't know how to decode character code: " & code)
End Select
End Function
End Class
Public Class IoctlResult
Private Shared SenseRepository As IDictionary(Of Integer, IoctlResult)
Private m_sk As Integer
Public ReadOnly Property SenseKey() As Integer
Get
Return m_sk
End Get
End Property
Private m_asc As Integer
Public ReadOnly Property AdditionalSenseCode() As Integer
Get
Return m_asc
End Get
End Property
Private m_ascq As Integer
Public ReadOnly Property AdditionalSenseCodeQualifier() As Integer
Get
Return m_ascq
End Get
End Property
Private m_scsiStatus As Integer
Public ReadOnly Property ScsiStatus As Integer
Get
Return m_scsiStatus
End Get
End Property
Private m_error As String
Public Property ErrorMessage() As String
Get
Return String.Format("Error: {0} sk{1} asc{2} ascq{3}", m_error, m_sk, m_asc, m_ascq)
End Get
Set(ByVal value As String)
m_error = value
End Set
End Property
Private Sub New(sk As Integer, asc As Integer, ascq As Integer, errorMessage As String, scsiStatus As Integer)
m_sk = sk
m_asc = asc
m_ascq = ascq
m_error = errorMessage
m_scsiStatus = scsiStatus
End Sub
Public Shared Function FromSenseBuffer(sense As Byte(), scsiStatus As Integer) As IoctlResult
Dim sk As Integer = sense(2)
Dim asc As Integer = sense(12)
Dim ascq As Integer = sense(13)
Dim key As Integer = HashCode(sk, asc, ascq)
If IoctlResult.SenseRepository Is Nothing Then BuildRepository()
Dim error1 As IoctlResult = Nothing
If IoctlResult.SenseRepository.TryGetValue(key, error1) Then
error1.m_scsiStatus = scsiStatus
Else
error1 = New IoctlResult(sk And &HF, asc, ascq, "Unknown!!", scsiStatus)
End If
Return error1
End Function
Private Shared Sub BuildRepository()
Dim textReader As New IO.StringReader(My.Resources.SkAscAscq)
IoctlResult.SenseRepository = New Dictionary(Of Integer, IoctlResult)
While textReader.Peek() > -1
Dim line As String = textReader.ReadLine
Dim sk As Integer = 0
Dim asc As Integer = 0
Dim ascq As Integer = 0
Dim spaceCount As Integer = 0
Dim i As Integer = 0
Dim val As Byte
Do
Dim c As Char = line(i)
If c = " "c Then
spaceCount += 1
val = 0
Else
If line(i + 1) <> " "c Then
val = (Byte.Parse(c, Globalization.NumberStyles.HexNumber) << 4)
Else
val = val Or (Byte.Parse(c, Globalization.NumberStyles.HexNumber))
Select Case spaceCount
Case 0
sk = val
Case 1
asc = val
Case 2
ascq = val
End Select
End If
End If
i += 1
Loop Until spaceCount = 3
Dim key As Integer = HashCode(sk, asc, ascq)
SenseRepository.Add(key, New IoctlResult(sk, asc, ascq, line.Substring(i), -1))
End While
End Sub
Private Shared Function HashCode(sk As Integer, asc As Integer, ascq As Integer) As Integer
If sk = 4 AndAlso asc = &H40 Then Return &HFF4004
If sk = &HB AndAlso asc = &H4D Then Return &HFF4D0B
If asc = &H34 AndAlso ascq = 0 Then Return &H34FF
If asc = &H35 Then
Select Case ascq
Case 0
Return &H35FF
Case 1
Return &H135FF
Case 2
Return &H235FF
Case 3
Return &H335FF
Case 4
Return &H435FF
End Select
End If
Return (sk And &HF) Or ((asc << 8) And &HFF00) Or ((ascq << 16) And &HFF0000)
End Function
Public Overrides Function GetHashCode() As Integer
Return HashCode(m_sk, m_asc, m_ascq)
End Function
Public Overrides Function ToString() As String
Return String.Format("SK:{0:x2}/ASC:{1:x2}/ASCQ:{2:x2} ScsiStatus:{3} {4}", Me.SenseKey, Me.AdditionalSenseCode, Me.AdditionalSenseCodeQualifier, Me.ScsiStatus, Me.ErrorMessage)
End Function
End Class
Public Class ReadCdTextWorkerResult
Public Property Success() As Boolean
Public Property ErrorMessage() As String
Public Property CDText As CdText
End Class
Friend Class ReadCdTextWorker
Inherits System.ComponentModel.BackgroundWorker
Protected Overrides Sub OnDoWork(e As System.ComponentModel.DoWorkEventArgs)
MyBase.OnDoWork(e)
Dim result As New ReadCdTextWorkerResult
Dim driveInfo As System.IO.DriveInfo = DirectCast(e.Argument, System.IO.DriveInfo)
' IsReady has to be in a non-ui thread as it can block for a long time when the CD drive
' is spinning up.
If driveInfo.IsReady Then
Try
result.CDText = CdTextRetriever.GetCdText(driveInfo)
If result.CDText Is Nothing Then
result.Success = False
Else
result.Success = True
End If
Catch ex As Exception
result.Success = False
End Try
Else
Const fmt As String = "Drive {0} is not ready. Check a CD is inserted"
result.ErrorMessage = String.Format(fmt, driveInfo)
End If
e.Result = result
End Sub
End Class
|
Namespace Models
Public Class TaskModel
Public Property Id As Integer
Public Property AreaName As String
Public Property SectionName As String
Public Property StationName As String
Public Property MasterFileName As String
Public Property TaskName As String
Public Property TaskMemory As String
Public Property TaskMemoryPlus As Integer
Public Property TaskNodes As Integer
Public Property TaskConnection As Integer
Public Property MaxNoOfInstances As Integer
Public Property ModelAffiliation As String
Public Sub New()
End Sub
End Class
End Namespace
|
Option Explicit On
'===================================================================================================================================
'Projet : Vinicom
'Auteur : Marc Collin
'Création : 23/06/04
'===================================================================================================================================
' Classe : Client
' Description : Contient les informations du Client
'===================================================================================================================================
'Membres de Classes
'==================
'Public
' getListe : Rend la Liste des Clients
'Protected
'Private
'Membres d'instances
'==================
'Public
' idTypeClient : Identifiant du type de client
' libTypeClient : (ReadOnly) Libellé du type de client
' load(id) : Chargement de l'objet en base
' Rend True si le chargement est OK
' insert(id) : insertio de l'objet en base
' Rend True si l'insertion est OK
' update(id) : MAJ de l'objet en base
' Rend True si la MAJ est OK
' delete(id) : Suppression de l'objet en base
' Rend True si le DELETE est OK
'Protected
'Private
'===================================================================================================================================
'Historique :
'============
'
'===================================================================================================================================
Imports System.Collections.Generic
Public Class Client
Inherits Tiers
Private m_IdPrestaShop As Long
Private m_idTypeClient As Integer
Private m_libTypeClient As String
Private m_oPreCommande As preCommande
Private m_CodeTarif As String
Private m_Origine As String
Private m_IBAN As String
Public Property IBAN() As String
Get
Return m_IBAN
End Get
Set(ByVal value As String)
m_IBAN = value
End Set
End Property
Private m_BIC As String
Public Property BIC() As String
Get
Return m_BIC
End Get
Set(ByVal value As String)
m_BIC = value
End Set
End Property
#Region "Accesseurs"
'=======================================================================
' METHODE DE CLASSE |
'Fonction : getListe
'Description : Liste des Clients
'Retour : Rend une collection de Clients
'=======================================================================
Public Shared Function getListe(Optional ByVal strCode As String = "", Optional ByVal strNom As String = "", Optional ByVal strRS As String = "") As Collection
Dim colReturn As Collection
Persist.shared_connect()
colReturn = ListeCLT(strCode, strNom, strRS)
Persist.shared_disconnect()
Return colReturn
End Function
'Identifiant du type de client
Public Property idTypeClient() As Integer
Get
Debug.Assert(Not m_bResume, "Objet de type resumé")
Return m_idTypeClient
End Get
Set(ByVal Value As Integer)
RaiseUpdated()
m_idTypeClient = Value
End Set
End Property
'Identifiant du type de client
Public ReadOnly Property codeTypeClient() As String
Get
Dim oParam As Param
oParam = New Param()
oParam.load(idTypeClient)
Return oParam.code
End Get
End Property
'Libellé du type de client
Public ReadOnly Property libTypeClient() As String
Get
Dim oParam As Param
oParam = New Param()
oParam.load(idTypeClient)
Return oParam.code
End Get
End Property
'code Tarif
Public Property CodeTarif() As String
Get
Return m_CodeTarif
End Get
Set(ByVal Value As String)
If Value <> CodeTarif Then
RaiseUpdated()
m_CodeTarif = Value
End If
End Set
End Property
''' <summary>
''' Si le client est de type 'Intermédiaire' , indique l'origine des commande pour lequel il est un intermédiaire
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property Origine() As String
Get
Return m_Origine
End Get
Set(ByVal Value As String)
If Value <> Origine Then
RaiseUpdated()
m_Origine = Value
End If
End Set
End Property
Private ReadOnly Property colgPrecom() As ColEvent
Get
Debug.Assert(Not m_bResume, "Objet de type resumé")
Return m_oPreCommande.colLignes
End Get
End Property
Public ReadOnly Property oPrecommande() As preCommande
Get
Return m_oPreCommande
End Get
End Property
Public Shared Function createandload(ByVal pid As Long) As Client
'=======================================================================
' Contructeur pour chargement
'=======================================================================
Dim objClient As Client
Dim bReturn As Boolean
objClient = New Client
Try
If pid <> 0 Then
bReturn = objClient.load(pid)
If Not bReturn Then
setError("Client.createAndLoad", getErreur())
End If
End If
Catch ex As Exception
setError("Client.createAndLoad", ex.ToString)
End Try
Debug.Assert(objClient.id = pid, "Client " & pid & " non chargée")
Return objClient
End Function 'Createanload
''' <summary>
''' Constructeur pour Chargement par la clé
''' </summary>
''' <param name="pCode"> Code Fournisseur</param>
''' <returns>Objet Fournisseur ou null</returns>
''' <remarks></remarks>
Public Shared Function createandload(ByVal pCode As String) As Client
Dim oClt As Client
Dim bReturn As Boolean
Dim nId As Integer
oClt = New Client
Try
If Not String.IsNullOrEmpty(pCode) Then
nId = Client.getCLTIDByKey(pCode)
If nId <> -1 Then
bReturn = oClt.load(nId)
If Not bReturn Then
setError("Client.createAndLoad", getErreur())
oClt = Nothing
End If
Else
setError("Client.createAndLoad", "No ID for " & pCode)
oClt = Nothing
End If
End If
Catch ex As Exception
setError("Client.createAndLoad", ex.ToString)
oClt = Nothing
End Try
Return oClt
End Function 'Createanload
''' <summary>
''' Constructeur pour Chargement par la clé
''' </summary>
''' <param name="pIdPrestashop"> Code Fournisseur</param>
''' <returns>Objet Fournisseur ou null</returns>
''' <remarks></remarks>
Public Shared Function createandloadPrestashop(ByVal pIdPrestashop As String, pdossier As String) As Client
Dim oClt As Client
Dim bReturn As Boolean
Dim nId As Integer
shared_connect()
Try
If Not String.IsNullOrEmpty(pIdPrestashop) Then
nId = Client.getCLTIDByPrestashopId(pIdPrestashop, pdossier)
If nId <> -1 Then
oClt = New Client
bReturn = oClt.load(nId)
If Not bReturn Then
setError("Client.createandloadPrestashop", getErreur())
oClt = Nothing
End If
Else
setError("Client.createandloadPrestashop", "No ID for " & pIdPrestashop)
oClt = Nothing
End If
End If
Catch ex As Exception
setError("Client.createandloadPrestashop", ex.ToString)
oClt = Nothing
End Try
shared_disconnect()
Return oClt
End Function 'CreateanloadPrestashop
#End Region
'=======================================================================
'Fonction : savePrecommande
'Description : Sauvegarde des lignes de precommandes
'Détails :
'Retour :
'=======================================================================
Public Function savePrecommande() As Boolean
Dim bReturn As Boolean
Debug.Assert(Not m_oPreCommande Is Nothing, "Precommande Existante")
Persist.shared_connect()
bReturn = m_oPreCommande.save()
Persist.shared_disconnect()
Return bReturn
End Function 'savePrecommande
'=======================================================================
'Fonction : Load
'Description : Chargement de l'objet en base
'Détails : Appelle LoadFRN (de Persist)
'Retour : Rend Vrai si le chargement s'est correctement effectué
'=======================================================================
Protected Overrides Function DBLoad(Optional ByVal pid As Integer = 0) As Boolean
Dim bReturn As Boolean
shared_connect()
If pid <> 0 Then
m_id = pid
End If
bReturn = loadCLT()
m_oPreCommande = New preCommande(Me)
m_oPreCommande.load(m_id)
shared_disconnect()
'Mise à jour des indicateurs
If bReturn Then
m_bNew = False
setUpdatedFalse()
m_bDeleted = False
End If
Return bReturn
End Function
'=======================================================================
'Fonction : LoadLight
'Description : Chargement du Résumé de l'objet en base
'Détails : Appelle LoadFRN (de Persist)
'Retour : Rend Vrai si le chargement s'est correctement effectué
'=======================================================================
Friend Overrides Function LoadLight() As Boolean
Debug.Assert(m_id <> 0, "L'id doit être initialisé")
Dim bReturn As Boolean
shared_connect()
bReturn = loadCLTLight()
shared_disconnect()
'Mise à jour des indicateurs
If bReturn Then
m_bNew = False
setUpdatedFalse()
m_bDeleted = False
End If
Return bReturn
End Function
'=======================================================================
'Fonction : LoadPreCommande
'Description : Chargement de la precommande
'Détails : Appelle Loadprecommande (de Persist)
'Retour : Rend Vrai si le chargement s'est correctement effectué
'=======================================================================
Public Function LoadPreCommande() As Boolean
Debug.Assert(m_id <> 0, "Le Client doit être sauvegardé au Préalable")
Dim bReturn As Boolean
bReturn = True
shared_connect()
bReturn = m_oPreCommande.load(m_id)
shared_disconnect()
Return bReturn
End Function
'=======================================================================
'Fonction : delete
'Description : suppression de l'objet en base
'Détails : Appelle deleteFRN (de Persist)
' DELETEpRECOMMANDE
'Retour : Rend Vrai si le DELETE s'est correctement effectué
'=======================================================================
Friend Overrides Function delete() As Boolean
Dim bReturn As Boolean
bReturn = deletePRECOMMANDE()
If bReturn Then
bReturn = deleteCLT()
m_oPreCommande = Nothing
End If
Return bReturn
End Function 'delete
'=======================================================================
'Fonction : checkFordelete
'description : Controle si l'élément est supprimable
' table commandesClients
'=======================================================================
Public Overrides Function checkForDelete() As Boolean
Dim bReturn As Boolean
Try
shared_connect()
bReturn = True
If existeCommandeClient() Then
bReturn = False
End If
shared_disconnect()
Catch ex As Exception
bReturn = False
End Try
Return bReturn
End Function 'checkForDelete
'Fonction : Insert
'Description : Insert de l'objet en base
'Détails : Appelle InsertFRN (de Persist)
'Retour : Rend Vrai si l'INSERT s'est correctement effectué
'=======================================================================
Friend Overrides Function insert() As Boolean
Dim bReturn As Boolean
bReturn = insertCLT()
If (bReturn) Then
m_oPreCommande.setClientId(Me)
End If
'If m_bcolLgPrecomLoaded Then
'bReturn = savePrecommande()
'End If
Return bReturn
End Function
'=======================================================================
'Fonction : update
'Description : Update de l'objet en base
'Détails : Appelle UpdateFRN (de Persist)
'Retour : Rend Vrai si l'UPDATE s'est correctement effectué
'=======================================================================
Friend Overrides Function update() As Boolean
Dim bReturn As Boolean
bReturn = updateCLT()
'If m_bcolLgPrecomLoaded Then
'bReturn = savePrecommande()
'End If
Return bReturn
End Function
Public Overrides Function save() As Boolean
Dim bReturn As Boolean
shared_connect()
bReturn = MyBase.Save()
If (bReturn) Then
If (Not m_oPreCommande Is Nothing) Then
m_oPreCommande.save()
End If
End If
shared_disconnect()
Return bReturn
End Function
'=======================================================================
'Fonction : Equals
'Description : Comparaison d'objet
'Détails : Compare chaque membre de l'objet
'Retour : Rend Vrai si l'objet passé en paramétre est équivalent
'=======================================================================
Public Overrides Function Equals(ByVal obj As Object) As Boolean
Dim objclt As Client
Dim bReturn As Boolean
Try
bReturn = True
objclt = CType(obj, Client)
bReturn = MyBase.Equals(obj)
If bReturn Then
bReturn = bReturn And (objclt.idTypeClient.Equals(Me.idTypeClient))
bReturn = bReturn And (objclt.CodeTarif.Equals(Me.CodeTarif))
bReturn = bReturn And (objclt.IBAN.Equals(Me.IBAN))
bReturn = bReturn And (objclt.BIC.Equals(Me.BIC))
End If
Return bReturn
Catch ex As Exception
Return False
End Try
Return True
End Function ' Equals
'=======================================================================
'Fonction : new
'Description : Création de l'objet
'Détails :
'Retour :
'=======================================================================
Public Sub New(ByVal pcode As String, ByVal pnom As String)
MyBase.New(pcode, pnom)
m_typedonnee = vncEnums.vncTypeDonnee.CLIENT
Debug.Assert(Param.typeclientdefaut.defaut, "Pas de Type de Client par Defaut")
m_idTypeClient = Param.typeclientdefaut.id
m_libTypeClient = Param.typeclientdefaut.valeur
m_oPreCommande = New preCommande(Me)
m_CodeTarif = "A"
IBAN = ""
BIC = ""
End Sub 'New
Friend Sub New()
MyBase.New("", "")
m_typedonnee = vncEnums.vncTypeDonnee.CLIENT
Debug.Assert(Param.typeclientdefaut.defaut, "Pas de Type de Client par Defaut")
m_idTypeClient = Param.typeclientdefaut.id
m_libTypeClient = Param.typeclientdefaut.valeur
m_oPreCommande = New preCommande(Me)
m_CodeTarif = "A"
IBAN = ""
BIC = ""
End Sub 'New
'=======================================================================
'Fonction : toString
'Description : Rend L'objet sous forme de chaine
'Retour : une Chaine
'=======================================================================
Public Overrides Function toString() As String
Return "CLT : [" & MyBase.toString() & "]" & idTypeClient & "," & libTypeClient
End Function
'=======================================================================
'Fonction : AjouteLgPrecomm
'Description : Ajoute une ligne LgPrecom au client parametre = Produit
'Retour : Boolean
'=======================================================================
Public Function ajouteLgPrecom(ByVal objProduit As Produit, Optional ByVal qteHab As Double = 0, Optional ByVal qteDern As Double = 0, Optional ByVal pPrixU As Double = 0, Optional ByVal pDateDernCom As Date = DATE_DEFAUT, Optional ByVal prefDernCommande As String = "") As lgPrecomm
Dim oLgPrecom As lgPrecomm
oLgPrecom = m_oPreCommande.ajouteLgPrecom(objProduit, qteHab, qteDern, pPrixU, pDateDernCom, prefDernCommande)
Return oLgPrecom
End Function 'AjouteLgPrecomm
'=======================================================================
'Fonction : AjouteLgPrecomm
'Description : Ajoute une ligne LgPrecom au client parametres (idProduit, CodeProduit,LibelleProduit)
'Retour : LgPrecomm
'=======================================================================
Public Function ajouteLgPrecom(ByVal idProduit As Integer, ByVal codeProduit As String, ByVal libProduit As String, Optional ByVal qteHab As Decimal = 0, Optional ByVal qteDern As Decimal = 0, Optional ByVal pPrixU As Double = 0, Optional ByVal pDateDernCom As Date = DATE_DEFAUT, Optional ByVal prefDernCommande As String = "") As lgPrecomm
Debug.Assert(idProduit <> 0, "ID Produit <> 0")
Dim objLgPrecom As lgPrecomm
objLgPrecom = m_oPreCommande.ajouteLgPrecom(idProduit, codeProduit, libProduit, qteHab, qteDern, pPrixU, pDateDernCom, prefDernCommande)
Return objLgPrecom
End Function 'AjouteLgPrecomm
Public Function ajouteLgPrecom() As lgPrecomm
Dim objLgPrecom As lgPrecomm
objLgPrecom = m_oPreCommande.ajouteLgPrecom()
Return objLgPrecom
End Function 'AjouteLgPrecomm
'=======================================================================
'Fonction : SupprimeLgPrecomm
'Description : Supprime une ligne de precommande au client
'Retour : Boolean
'=======================================================================
Public Function supprimeLgPrecom(ByVal nIndex As Integer) As Boolean
Try
m_oPreCommande.supprimeLgPrecom(nIndex)
Return True
Catch ex As Exception
Return False
End Try
End Function 'supprimeLgPrecomm
'=======================================================================
'Fonction : getLgPrecom
'Description : Renvoie la ligne de precommande
'Retour : Boolean
'=======================================================================
Public Function getLgPrecomByProductId(ByVal pidProduit As Integer) As lgPrecomm
Dim objLgPrecomm As lgPrecomm
Try
objLgPrecomm = m_oPreCommande.getLgPrecom(pidProduit)
Catch ex As Exception
objLgPrecomm = Nothing
End Try
Return objLgPrecomm
End Function 'getLgPrecomm
'=======================================================================
'Fonction : lgPrecomExists
'Description : Renvoie Vrai si la ligne de precommande existe
'Retour : Boolean
'=======================================================================
Public Function lgPrecomExists(ByVal pindex As Object) As Boolean
Dim bReturn As Boolean
Try
bReturn = m_oPreCommande.colLignes.keyExists(pindex)
Catch ex As Exception
bReturn = False
End Try
Return bReturn
End Function 'lgPrecommExists
'=======================================================================
'Fonction : getlgPrecomCount
'Description : Renvoie Le nombre de ligne de precommande
'Retour : integer
'=======================================================================
Public Function getlgPrecomCount() As Integer
Dim nReturn As Integer
Try
nReturn = m_oPreCommande.colLignes.Count
Catch ex As Exception
nReturn = 0
End Try
Return nReturn
End Function 'lgPrecommCount
'=======================================================================
'Fonction : reinitPrecommande
'Description : Réinitialise la precommande d'un client
'Retour : Boolean
'=======================================================================
Public Function reinitPrecommande() As Boolean
Dim bReturn As Boolean
Dim colCommande As Collection
Dim objCommandeClient As CommandeClient
Try
bReturn = True
'Suppression des lignes existantes
m_oPreCommande.colLignes.clear()
m_oPreCommande.save()
'chargement de la liste des commandes du client
colCommande = CommandeClient.getListe(strCode:="", strNomClient:=Me.rs, pOrigine:="", pEtat:=vncEtatCommande.vncRien)
'pour chaque commande
For Each objCommandeClient In colCommande
If objCommandeClient.oTiers.id = m_id Then
objCommandeClient.load()
objCommandeClient.loadcolLignes()
updatePrecommande(objCommandeClient)
objCommandeClient.releasecolLignes()
End If
Next objCommandeClient
colCommande = Nothing
Catch ex As Exception
bReturn = False
setError("Client.reinitPrecommande", ex.ToString)
End Try
Debug.Assert(bReturn, getErreur())
Return bReturn
End Function 'reinitPrecommande
'=======================================================================
'Fonction : updatePrecommande
'Description : Met à jour la précommande du client avec la commande en cours
'Retour : Boolean
'=======================================================================
Public Function updatePrecommande(ByVal objCommande As CommandeClient) As Boolean
Dim bColaDecharger As Boolean
Dim objLGCMD As LgCommande
Dim objLGPRECOM As lgPrecomm
Dim bReturn As Boolean
Try
LoadPreCommande()
bColaDecharger = False
If Not objCommande.bcolLignesLoaded Then
objCommande.loadcolLignes()
bColaDecharger = True
End If
For Each objLGCMD In objCommande.colLignes
'Parcours des lignes de commande
'Pour chaque ligne
If lgPrecomExists(objLGCMD.oProduit.id) Then
'Recupération de la ligne de precommande
objLGPRECOM = getLgPrecomByProductId(objLGCMD.oProduit.id)
If objLGPRECOM.dateDerniereCommande <= objCommande.dateCommande Then
'Si la date de dernierecommande est inférieur ou egale à la date de la commande
'MAJ du Prix, de la quantite , de la date et de la reference de la commande
objLGPRECOM.prixU = objLGCMD.prixU
objLGPRECOM.qteDern = objLGCMD.qteCommande
objLGPRECOM.dateDerniereCommande = objCommande.dateCommande
objLGPRECOM.refDerniereCommande = objCommande.code
End If
Else
ajouteLgPrecom(objLGCMD.oProduit.id, objLGCMD.oProduit.code, objLGCMD.oProduit.nom, objLGCMD.qteCommande, objLGCMD.qteCommande, objLGCMD.prixU, objCommande.dateCommande, objCommande.code)
End If
Next objLGCMD
If bColaDecharger Then
objCommande.releasecolLignes()
End If
bReturn = True
Catch ex As Exception
bReturn = False
setError("Client.updatePrecommande", ex.ToString)
End Try
Debug.Assert(bReturn, getErreur())
Return bReturn
End Function 'updatePrecommande
''' <summary>
''' Fixe le type de client à "intermédaire" et l'origine des commandes concernées
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function setTypeIntermediaire(pOrigine As String) As Boolean
Dim bReturn As Boolean
Try
For Each oParam As Param In Param.colTypeClient
If oParam.valeur = "Intermediaire" Or oParam.valeur = "Intermédiaire" Then
idTypeClient = oParam.id
Origine = pOrigine
End If
Next
bReturn = True
Catch ex As Exception
bReturn = False
End Try
Return bReturn
End Function
''' <summary>
''' Renvoie le client qui a été identifié comme intermédiaire pour une origine
''' </summary>
''' <param name="pOrigine"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Shared Function getIntermediairePourUneOrigine(pOrigine As String) As Client
Dim oReturn As Client = Nothing
Try
Dim idTypeClient As Integer
For Each oParam As Param In Param.colTypeClient
If oParam.code.ToUpper() = "INT" Then
idTypeClient = oParam.id
End If
Next
Dim strSQL As String
strSQL = "SELECT CLT_ID FROM client where clt_Origine = '" & pOrigine & "' and CLT_TYPE_id = " & idTypeClient
Dim strResultat As String = Persist.executeSQLQuery(strSQL)
If Not String.IsNullOrEmpty(strResultat) Then
oReturn = Client.createandload(CLng(strResultat))
End If
Catch ex As Exception
oReturn = Nothing
End Try
Return oReturn
End Function
End Class
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.