text stringlengths 43 2.01M |
|---|
Option Strict On
' Name: Moya Goleski
' Date: 2020-07-17
' Description: The purpose of this program is to create a car inventory application that will
' allow the user to create and update content. The content will include the Make,
' Model, Year, Price, and a value indicating wheter the car is New is used.
Public Class carInventoryForm
#Region "Variables and Constants"
' min price that can be entered
Const MIN_PRICE As Integer = 0
Dim cars As New List(Of CarClass)
Dim editMode As Boolean = False
Dim updatingData As Boolean = False
Dim currentlySelectedIndex As Integer = -1
#End Region
#Region "Event Handlers"
' EXIT BUTTON
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
'Exits the form
Application.Exit()
End Sub
' RESET BUTTON
Private Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
' Resets the form
ResetForm()
End Sub
' ENTER BUTTON
Private Sub btnEnter_Click(sender As Object, e As EventArgs) Handles btnEnter.Click
' users input for Make
Dim inputMake As String = cbMake.Text
' users input for Model
Dim inputModel As String = txtModel.Text
' users input for Year
Dim inputYear As String = cbYear.Text
' users input for Price
Dim inputPrice As String = txtPrice.Text
' user input for New or Used
Dim inputNewStatus As Boolean = ckNew.Checked
' errors for validation
Dim errors As String = ValidateInputs(inputMake, inputModel, inputYear, inputPrice)
' variable for Car Class
Dim carInventory As CarClass
If (String.IsNullOrEmpty(errors)) Then
' validation was successful
If (editMode) Then
' updating existing car
' updates Status
cars(currentlySelectedIndex).CarStatus = inputNewStatus
' updates Make
cars(currentlySelectedIndex).CarMake = inputMake
' updates Model
cars(currentlySelectedIndex).CarModel = inputModel
' updates Year
cars(currentlySelectedIndex).CarYear = inputYear
' updates Price
cars(currentlySelectedIndex).CarPrice = inputPrice
' calling UpdateInventoryList function
UpdateCarInventoryList()
' calling ResetForm function
ResetForm()
' message to show car update was successful
txtOutput.Text = "Update Successful"
Else
' create new car
carInventory = New CarClass(inputMake, inputModel, inputYear, inputPrice, inputNewStatus)
' adds to car class
cars.Add(carInventory)
' calling UpdateInventoryList function
UpdateCarInventoryList()
' calling ResetForm function
ResetForm()
' message to show that new car was added
txtOutput.Text = "New inventory added"
End If
Else
' validation failed
txtOutput.Text = errors
End If
End Sub
' HANDLES SELECTION OF CAR FROM LIST
Private Sub lvCarList_IndexChanged(sender As Object, e As EventArgs) Handles lvCarList.SelectedIndexChanged
Dim carInventory As CarClass
If (Not lvCarList.FocusedItem Is Nothing) Then
currentlySelectedIndex = lvCarList.FocusedItem.Index
carInventory = cars(currentlySelectedIndex)
editMode = True
cbMake.Text = carInventory.CarMake
txtModel.Text = carInventory.CarModel
cbYear.Text = carInventory.CarYear
txtPrice.Text = carInventory.CarPrice
ckNew.Checked = carInventory.CarStatus
End If
End Sub
' Prevents the user from using checkboxes in CarList
Private Sub lvwCustomers_ItemCheck(sender As Object, e As ItemCheckEventArgs) Handles lvCarList.ItemCheck
If (Not updatingData) Then
e.NewValue = e.CurrentValue
End If
End Sub
#End Region
#Region "Subs and Functions"
' RESETS THE FORM
Private Sub ResetForm()
' sets Make combo box back to default (empty)
cbMake.SelectedIndex = -1
' sets Model text to empty
txtModel.Text = String.Empty
' sets Year combo box back to default (empty)
cbYear.SelectedIndex = -1
' sets Price text to empty
txtPrice.Text = String.Empty
' sets New checkbox to unchecked
ckNew.Checked = False
' sets edit more to false
editMode = False
End Sub
' FUNCTION TO VALIDATE THE INPUT
Function ValidateInputs(Make As String, Model As String, Year As String, Price As String) As String
' empties error message
Dim errorMessage As String = String.Empty
' var. to make year integer
' Dim yearAsInteger As Integer
' var. to make price decimal
Dim priceAsDecimal As Decimal
' if Make is not selected
If (String.IsNullOrWhiteSpace(Make)) Then
' error message
errorMessage += "Please enter a valid make" & Environment.NewLine
End If
' if Model is empty
If (String.IsNullOrWhiteSpace(Model)) Then
' error message
errorMessage += "Please enter a valid model" & Environment.NewLine
End If
' if Year not selected
If (String.IsNullOrWhiteSpace(Year)) Then
' if Year is not integer
' If Integer.TryParse(Year, yearAsInteger) Then
' error message
errorMessage += "Please enter a valid year" & Environment.NewLine
' End If
End If
' if price not selected
If (String.IsNullOrWhiteSpace(Price)) Then
errorMessage += "Please enter a price" & Environment.NewLine
' if price is not decimal
Decimal.TryParse(Price, priceAsDecimal)
' if price not in range
If (priceAsDecimal <= MIN_PRICE) Then
' error message
errorMessage += "Please enter a valid price greater than " & MIN_PRICE & Environment.NewLine
End If
End If
' returns if there are any error message(s)
Return errorMessage
End Function
' UPDATES CAR LIST
' reloads current list of cars in ListView
Private Sub UpdateCarInventoryList()
Dim carListItem As ListViewItem
updatingData = True
lvCarList.Items.Clear()
For Each carInventory As CarClass In cars
carListItem = New ListViewItem()
carListItem.Checked = carInventory.CarStatus
carListItem.SubItems.Add(carInventory.CarIdentification.ToString)
carListItem.SubItems.Add(carInventory.CarMake)
carListItem.SubItems.Add(carInventory.CarModel)
carListItem.SubItems.Add(carInventory.CarYear)
carListItem.SubItems.Add(carInventory.CarPrice)
lvCarList.Items.Add(carListItem)
Next
updatingData = False
End Sub
#End Region
End Class |
Option Strict On
Imports System.Runtime.InteropServices
Imports System.Diagnostics
Imports System.Reflection
Public Class Form5
Private Structure KBDLLHOOKSTRUCT
Public key As Keys
Public scanCode As Integer
Public flags As Integer
Public time As Integer
Public extra As IntPtr
End Structure
'System level functions to be used for hook and unhook keyboard input
Private Delegate Function LowLevelKeyboardProc(ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function SetWindowsHookEx(ByVal id As Integer, ByVal callback As LowLevelKeyboardProc, ByVal hMod As IntPtr, ByVal dwThreadId As UInteger) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function UnhookWindowsHookEx(ByVal hook As IntPtr) As Boolean
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function CallNextHookEx(ByVal hook As IntPtr, ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
End Function
<DllImport("kernel32.dll", CharSet:=CharSet.Auto, SetLastError:=True)>
Private Shared Function GetModuleHandle(ByVal name As String) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)>
Private Shared Function GetAsyncKeyState(ByVal key As Keys) As Short
End Function
'Declaring Global objects
Private ptrHook As IntPtr
Private objKeyboardProcess As LowLevelKeyboardProc
Public Sub New()
Try
Dim objCurrentModule As ProcessModule = Process.GetCurrentProcess().MainModule
'Get Current Module
objKeyboardProcess = New LowLevelKeyboardProc(AddressOf captureKey)
'Assign callback function each time keyboard process
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0)
'Setting Hook of Keyboard Process for current module
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Catch ex As Exception
End Try
End Sub
Private Function captureKey(ByVal nCode As Integer, ByVal wp As IntPtr, ByVal lp As IntPtr) As IntPtr
Try
If nCode >= 0 Then
End If
Dim objKeyInfo As KBDLLHOOKSTRUCT = DirectCast(Marshal.PtrToStructure(lp, GetType(KBDLLHOOKSTRUCT)), KBDLLHOOKSTRUCT)
If objKeyInfo.key = Keys.RWin OrElse objKeyInfo.key = Keys.LWin Then
' Disabling Windows keys
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.ControlKey OrElse objKeyInfo.key = Keys.Escape Then
' Disabling Ctrl + Esc keys
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.ControlKey OrElse objKeyInfo.key = Keys.Down Then
' Disabling Ctrl + Esc keys
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.Alt OrElse objKeyInfo.key = Keys.Tab Then
' Disabling Ctrl + Esc keys
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.F2 Then
' Disabling Ctrl + Esc keys
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.Down Then
'Disabling Down key
Return CType(1, IntPtr)
End If
If objKeyInfo.key = Keys.F1 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F3 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F4 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F5 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F6 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F7 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F8 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F9 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F10 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F11 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F12 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F13 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F14 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F15 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F16 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F17 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F18 Then
'
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.F19 Then
End If
If objKeyInfo.key = Keys.Scroll Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.LShiftKey Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.RShiftKey Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.RControlKey Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.LControlKey Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.VolumeDown Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.VolumeMute Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.Escape Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.Delete Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.RWin Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.LWin Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.Scroll Then
End If
Return CType(1, IntPtr)
If objKeyInfo.key = Keys.Tab Then
End If
If objKeyInfo.key = Keys.ControlKey OrElse objKeyInfo.key = Keys.Alt Then
'
Return CType(1, IntPtr)
End If
Catch ex As Exception
End Try
End Function
End Class
|
<Command("Set Speed", "FanSpeed|0-100|% PumpSpeed|0-100|% Muzze|0-11| SwingSpeed|0-100|%", , , , CommandType.BatchParameter),
TranslateCommand("zh-TW", "风机/主泵", "风机|0-100|% 主泵|0-100|% 喷嘴|0-3| 摆布|0-100|% "),
Description("1=Injection1, 2=Injection2, 3=Injection1+2+3, 4=Injection1+2+3"),
TranslateDescription("zh-TW", "[1]=注入1 [2]=注入2 [3]=注入1+2 ")>
Public NotInheritable Class Command04
Inherits MarshalByRefObject
Implements ACCommand
Public Enum S60
Off
載入參數
背景執行
End Enum
Public 風機速度參數, 主泵速度參數, 壓力參數, 喷嘴參數, 擺布速度參數 As Integer
Public 风机, 主泵, 压力, 喷嘴, 摆布 As Integer
Public 參數已變更 As Boolean
Public Function Start(ByVal ParamArray param() As Integer) As Boolean Implements ACCommand.Start
With ControlCode
风机 = param(1)
主泵 = param(2)
' 压力 = param(3) * 10 + param(4)
喷嘴 = param(3)
摆布 = param(4)
If 风机 = 0 Then 風機速度參數 = .FanSpeed Else 風機速度參數 = 风机
If 主泵 = 0 Then 主泵速度參數 = .PumpSpeed Else 主泵速度參數 = 主泵
' If 压力 = 0 Then 壓力參數 = .SetPressure Else 壓力參數 = 压力
If 喷嘴 = 0 Then 喷嘴參數 = .InjectionS Else 喷嘴參數 = 喷嘴
If 摆布 = 0 Then 擺布速度參數 = .SwingSpeed Else 擺布速度參數 = 摆布
'風機速度參數 = param(1)
'主泵速度參數 = param(2)
'喷嘴參數 = param(5)
'擺布速度參數 = param(6)
'壓力參數 = param(3) * 10 + param(4)
.FanOn = True
.MainPumpOn = True
State = S60.載入參數
End With
End Function
Public Function Run() As Boolean Implements ACCommand.Run
With ControlCode
Select Case State
Case S60.Off
State = S60.Off
Case S60.載入參數
.FanSpeed = MinMax(風機速度參數, .Parameters.FanMinSpeed, .Parameters.FanMaxSpeed)
.PumpSpeed = MinMax(主泵速度參數, .Parameters.MainPumpMinSpeed, .Parameters.MainPumpMaxSpeed)
.SetPressure = MinMax(壓力參數, .Parameters.MainPumpMinSpeed, .Parameters.MainPumpMaxSpeed)
.InjectionS = 喷嘴參數
.SwingSpeed = 擺布速度參數
參數已變更 = False
State = S60.背景執行
Return True
Case S60.背景執行
If Not 參數已變更 Then Exit Select
State = S60.載入參數
End Select
End With
End Function
Public Sub Cancel() Implements ACCommand.Cancel
State = S60.Off
End Sub
Public Sub ParametersChanged(ByVal ParamArray param() As Integer) Implements ACCommand.ParametersChanged
风机 = param(1)
主泵 = param(2)
'压力 = param(3) * 10 + param(4)
喷嘴 = param(3)
摆布 = param(4)
If 风机 = 0 Then 風機速度參數 = ControlCode.FanSpeed Else 風機速度參數 = 风机
If 主泵 = 0 Then 主泵速度參數 = ControlCode.PumpSpeed Else 主泵速度參數 = 主泵
' If 压力 = 0 Then 壓力參數 = ControlCode.SetPressure Else 壓力參數 = 压力
If 喷嘴 = 0 Then 喷嘴參數 = ControlCode.InjectionS Else 喷嘴參數 = 喷嘴
If 摆布 = 0 Then 擺布速度參數 = ControlCode.SwingSpeed Else 擺布速度參數 = 摆布
參數已變更 = True
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 <> S60.Off
End Get
End Property
<EditorBrowsable(EditorBrowsableState.Advanced)> Private state_ As S60
Public Property State() As S60
Get
Return state_
End Get
Private Set(ByVal value As S60)
state_ = value
End Set
End Property
#End Region
End Class
#Region "Class Instance"
Partial Public Class ControlCode
Public ReadOnly Command04 As New Command04(Me)
End Class
#End Region
|
'Enhancements contributed by Rod Sawers: 10/25/2006
Imports System.Xml
Imports System.Text
Public Class FileMonitorEditor
#Region "Private Attributes"
Private mXMLTemplate As String
#End Region
#Region "Public Interface"
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
InitForm()
End Sub
Public Overrides Property XMLTemplate() As String
Get
Return mXMLTemplate
End Get
Set(ByVal value As String)
mXMLTemplate = value
End Set
End Property
Public Overrides Property XMLSettings() As String
Get
Return BuildXMLParams()
End Get
Set(ByVal value As String)
LoadXMLValues(value)
End Set
End Property
Public Overrides Sub LoadTemplateDefaults()
LoadXMLValues(mXMLTemplate)
End Sub
#End Region
#Region "Form Events"
Private Sub chkCountWarning_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkCountWarning.CheckedChanged
numCountWarning.Enabled = chkCountWarning.Checked
End Sub
Private Sub chkMaxCount_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkMaxCount.CheckedChanged
numMaxCount.Enabled = chkMaxCount.Checked
End Sub
Private Sub chkMaxAge_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkMaxAge.CheckedChanged
numMaxAge.Enabled = chkMaxAge.Checked
cboAgeType.Enabled = chkMaxAge.Checked
cboDateType.Enabled = chkMaxAge.Checked
cboFileType.Enabled = chkMaxAge.Checked
End Sub
#End Region
#Region "Private Methods"
Private Sub InitForm()
chkCountWarning.Checked = False
chkMaxCount.Checked = False
chkMaxAge.Checked = False
cboAgeType.SelectedIndex = 0
cboDateType.SelectedIndex = 0
cboFileType.SelectedIndex = 0
numCountWarning.Enabled = False
numMaxCount.Enabled = False
numMaxAge.Enabled = False
cboAgeType.Enabled = False
cboDateType.Enabled = False
cboFileType.Enabled = False
txtDirPath.Text = Nothing
txtFilePattern.Text = "*.*"
numCountWarning.Value = 0
numMaxCount.Value = 0
numMaxAge.Value = 0
End Sub
Private Sub LoadXMLValues(ByVal XML As String)
'Get default data from XML template (mXMLTemplate)
Dim XMLDoc As New XmlDocument
If XML Is Nothing OrElse XML.Trim.Length = 0 Then
InitForm()
Else
XMLDoc.LoadXml(XML)
Dim RootNode As XmlNode = XMLDoc.DocumentElement
Dim XMLNode As XmlNode = Nothing
Dim XMLAttribute As XmlAttribute = Nothing
'DirPath
XMLNode = RootNode.SelectSingleNode("DirPath")
txtDirPath.Text = CStr(XMLNode.InnerText).Trim()
XMLNode = Nothing
'FilePattern
XMLNode = RootNode.SelectSingleNode("FilePattern")
txtFilePattern.Text = CStr(XMLNode.InnerText).Trim()
'Count Warning
XMLNode = RootNode.SelectSingleNode("WarnCount")
If XMLNode Is Nothing OrElse XMLNode.InnerText.Trim.Length = 0 OrElse Not (IsNumeric(XMLNode.InnerText)) Then
chkCountWarning.Checked = False
numCountWarning.Value = 0
Else
XMLAttribute = XMLNode.Attributes("Enabled")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
chkCountWarning.Checked = False
Else
chkCountWarning.Checked = CBool(XMLAttribute.Value)
End If
Dim MaxCount As Integer
MaxCount = CInt(XMLNode.InnerText)
If MaxCount < numCountWarning.Minimum Then MaxCount = CInt(numCountWarning.Minimum)
If MaxCount > numCountWarning.Maximum Then MaxCount = CInt(numCountWarning.Maximum)
numCountWarning.Value = MaxCount
End If
numCountWarning.Enabled = chkCountWarning.Checked
XMLNode = Nothing
'Max Count
XMLNode = RootNode.SelectSingleNode("MaxCount")
If XMLNode Is Nothing OrElse XMLNode.InnerText.Trim.Length = 0 OrElse Not (IsNumeric(XMLNode.InnerText)) Then
chkMaxCount.Checked = False
numMaxCount.Value = 0
Else
XMLAttribute = XMLNode.Attributes("Enabled")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
chkMaxCount.Checked = False
Else
chkMaxCount.Checked = CBool(XMLAttribute.Value)
End If
Dim MaxCount As Integer
MaxCount = CInt(XMLNode.InnerText)
If MaxCount < numMaxCount.Minimum Then MaxCount = CInt(numMaxCount.Minimum)
If MaxCount > numMaxCount.Maximum Then MaxCount = CInt(numMaxCount.Maximum)
numMaxCount.Value = MaxCount
End If
numMaxCount.Enabled = chkMaxCount.Checked
XMLNode = Nothing
'Max Age
XMLNode = RootNode.SelectSingleNode("MaxAge")
If XMLNode Is Nothing OrElse XMLNode.InnerText.Trim.Length = 0 OrElse Not (IsNumeric(XMLNode.InnerText)) Then
chkMaxAge.Checked = False
numMaxAge.Value = 0
Else
XMLAttribute = XMLNode.Attributes("Enabled")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
chkMaxAge.Checked = False
Else
chkMaxAge.Checked = CBool(XMLAttribute.Value)
End If
Dim MaxAge As Integer
MaxAge = CInt(XMLNode.InnerText)
If MaxAge < numMaxAge.Minimum Then MaxAge = CInt(numMaxAge.Minimum)
If MaxAge > numMaxAge.Maximum Then MaxAge = CInt(numMaxAge.Maximum)
numMaxAge.Value = MaxAge
XMLAttribute = XMLNode.Attributes("AgeType")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
cboAgeType.SelectedIndex = 0
Else
cboAgeType.SelectedIndex = cboAgeType.FindStringExact(XMLAttribute.Value.ToLower)
End If
XMLAttribute = XMLNode.Attributes("DateType")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
cboDateType.SelectedIndex = 0
Else
cboDateType.SelectedIndex = cboDateType.FindStringExact(XMLAttribute.Value.ToLower)
End If
XMLAttribute = XMLNode.Attributes("FileType")
If XMLAttribute Is Nothing OrElse XMLAttribute.Value.Trim.Length = 0 Then
cboFileType.SelectedIndex = 0
Else
cboFileType.SelectedIndex = cboFileType.FindStringExact(XMLAttribute.Value.ToLower)
End If
End If
numMaxAge.Enabled = chkMaxAge.Checked
cboAgeType.Enabled = chkMaxAge.Checked
cboDateType.Enabled = chkMaxAge.Checked
cboFileType.Enabled = chkMaxAge.Checked
XMLNode = Nothing
End If
End Sub
Private Function BuildXMLParams() As String
Dim s As New StringBuilder
s.Append("<FileMonitor>" & vbCrLf)
s.Append(vbTab & "<DirPath>" & XMLEncode(txtDirPath.Text.Trim()) & "</DirPath>" & vbCrLf)
s.Append(vbTab & "<FilePattern>" & XMLEncode(txtFilePattern.Text.Trim()) & "</FilePattern>" & vbCrLf)
s.Append(vbTab & "<WarnCount Enabled='" & CStr(IIf(chkCountWarning.Checked, 1, 0)) & "'>" & numCountWarning.Value & "</WarnCount>" & vbCrLf)
s.Append(vbTab & "<MaxCount Enabled='" & CStr(IIf(chkMaxCount.Checked, 1, 0)) & "'>" & numMaxCount.Value & "</MaxCount>" & vbCrLf)
s.Append(vbTab & "<MaxAge Enabled='" & CStr(IIf(chkMaxAge.Checked, 1, 0)) & "' AgeType='" & cboAgeType.Text & "' DateType='" & cboDateType.Text & "' FileType='" & cboFileType.Text & "'>" & numMaxAge.Value & "</MaxAge>" & vbCrLf)
s.Append(vbTab & "<EnableCounters>1</EnableCounters>" & vbCrLf)
s.Append("</FileMonitor>")
Return s.ToString()
End Function
Private Function XMLEncode(ByVal XMLString As String) As String
If XMLString Is Nothing Then
Return Nothing
Else
Dim tmpStr As String = XMLString
tmpStr = tmpStr.Replace("&", "&")
tmpStr = tmpStr.Replace("<", "<")
tmpStr = tmpStr.Replace(">", ">")
tmpStr = tmpStr.Replace("""", """)
tmpStr = tmpStr.Replace("'", "'")
Return tmpStr
End If
End Function
#End Region
End Class
|
Imports Impacta.Dominio
Imports System.Data.SqlClient
Imports System.Transactions
Public Class ClienteRepositorio
Inherits RepositorioBase
Implements IClienteRepositorio
'Public Sub New()
' AbrirConexao()
'End Sub
Private Sub AbrirConexao()
If Conexao.State <> ConnectionState.Open Then
Conexao.Open()
End If
End Sub
''' <summary>
''' Método Selecionar usando ADO.NET. A instrução a ser executada foi "chumbada" dentro do próprio método.
''' </summary>
Public Function Selecionar() As List(Of Cliente) Implements IClienteRepositorio.Selecionar
Dim retorno As New List(Of Cliente)
Const instrucao As String = "Select * from Cliente Order by Nome"
Dim comando As New SqlCommand(instrucao, Conexao)
For Each registro In comando.ExecuteReader
Dim cliente As New Cliente
cliente.Guid = registro("Id")
cliente.Nome = registro("Nome")
cliente.Endereco = registro("Endereco")
cliente.Email = registro("Email")
retorno.Add(cliente)
Next
If Conexao.State = ConnectionState.Open Then
Conexao.Close()
End If
Return retorno
End Function
Function Selecionar(nome As String) As List(Of Cliente) Implements IClienteRepositorio.Selecionar
End Function
''' <summary>
''' Método Gravar usando ADO.NET. As instruções para a gravação estão dentro da procedure spGravarCliente.
''' </summary>
Sub Gravar(cliente As Cliente) Implements IClienteRepositorio.Gravar
AbrirConexao()
Const insertPessoa As String = "Insert into Pessoa (Nome, Endereco, Email) OUTPUT inserted.Id values (@Nome, @Endereco, @Email)"
Const insertCliente = "Insert Cliente (Pessoa_Id, DataNascimento, Renda) values (@Pessoa_Id, @DataNascimento, @Renda)"
Const insertDocumentos = "Insert PessoaDocumentos (Pessoa_Id, Tipo, Numero) value (@Pessoa_Id, @Tipo, @Numero)"
'Dim comando As New SqlCommand("spGravarCliente", Conexao)
Dim comandoPessoa As New SqlCommand(insertPessoa, Conexao)
comandoPessoa.CommandType = CommandType.Text
comandoPessoa.Parameters.Add("@Nome", SqlDbType.VarChar).Value = cliente.Nome
'comando.Parameters.Add("@DataNascimento", SqlDbType.Date).Value = cliente.DataNascimento
comandoPessoa.Parameters.Add("@Email", SqlDbType.VarChar).Value = cliente.Email
comandoPessoa.Parameters.Add("@Endereco", SqlDbType.VarChar).Value = cliente.Endereco
Dim comandoCliente As New SqlCommand(insertCliente, Conexao)
comandoCliente.CommandType = CommandType.Text
comandoCliente.Parameters.Add("@DataNascimento", SqlDbType.Date).Value = cliente.DataNascimento
comandoCliente.Parameters.Add("@Renda", SqlDbType.Decimal).Value = cliente.Renda
Dim comandoDocumentos As New SqlCommand(insertDocumentos, Conexao)
comandoDocumentos.CommandType = CommandType.Text
comandoDocumentos.Parameters.Add("@Tipo", SqlDbType.Int).Value = cliente.Documentos(0).Tipo
comandoDocumentos.Parameters.Add("@Numero", SqlDbType.VarChar).Value = cliente.Documentos(0).Numero
Try
Using transacao As New TransactionScope()
Dim pessoaId = comandoPessoa.ExecuteScalar()
comandoCliente.Parameters.Add("@Pessoa_Id", SqlDbType.Int).Value = pessoaId
comandoDocumentos.Parameters.Add("@Pessoa_Id", SqlDbType.Int).Value = pessoaId
comandoCliente.ExecuteNonQuery()
comandoDocumentos.ExecuteNonQuery()
transacao.Complete()
End Using
Finally
FecharConexao()
End Try
End Sub
Private Sub FecharConexao()
If Conexao IsNot Nothing AndAlso Conexao.State <> ConnectionState.Closed Then
Conexao.Close()
End If
End Sub
Sub Atualizar(cliente As Cliente) Implements IClienteRepositorio.Atualizar
Dim comando As New SqlCommand("spAtualizarCliente", Conexao)
Try
comando.CommandType = CommandType.StoredProcedure
comando.Parameters.Add("@Id", SqlDbType.VarChar).Value = cliente.Guid
comando.Parameters.Add("@Nome", SqlDbType.VarChar).Value = cliente.Nome
comando.Parameters.Add("@DataNascimento", SqlDbType.Date).Value = cliente.DataNascimento
comando.Parameters.Add("@Email", SqlDbType.VarChar).Value = cliente.Email
comando.Parameters.Add("@Endereco", SqlDbType.VarChar).Value = cliente.Endereco
comando.ExecuteNonQuery()
Finally
If comando IsNot Nothing Then comando.Dispose()
If Conexao IsNot Nothing AndAlso Conexao.State <> ConnectionState.Closed Then Conexao.Close()
End Try
End Sub
Sub Excluir(clienteId As String) Implements IClienteRepositorio.Excluir
Dim comando As New SqlCommand("spExcluirCliente", Conexao)
Try
comando.CommandType = CommandType.StoredProcedure
comando.Parameters.Add("@Id", SqlDbType.VarChar).Value = clienteId
comando.ExecuteNonQuery()
Finally
If comando IsNot Nothing Then comando.Dispose()
If Conexao IsNot Nothing AndAlso Conexao.State <> ConnectionState.Closed Then Conexao.Close()
End Try
End Sub
End Class |
Imports MaintenancePortalDataSetTableAdapters
Imports Talent.Common
Partial Class Navigation_AdhocGroupMaintenance
Inherits System.Web.UI.Page
Dim objBUTableAdapter As New BUSINESS_UNIT_TableAdapter
Dim objPTableAdapter As New PARTNER_TableAdapter
Public wfrPage As New Talent.Common.WebFormResource
Private _languageCode As String = Talent.Common.Utilities.GetDefaultLanguage
Dim objGroup1 As New NavigationDataSetTableAdapters.tbl_groupTableAdapter
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
With wfrPage
.BusinessUnit = "MAINTENANCE"
.PageCode = String.Empty
.PartnerCode = "*ALL"
.FrontEndConnectionString = ConfigurationManager.ConnectionStrings("TalentEBusinessDBConnectionString").ToString
.KeyCode = "AdhocGroupMaintenance.aspx"
.PageCode = "AdhocGroupMaintenance.aspx"
End With
ObjectDataSource1.SelectMethod = "GetAdhocGroups"
titleLabel.Text = "Maintain Adhoc Groups"
End Sub
Public Sub setLabel()
'instructionsLabel.Text = wfrPage.Content("instructionsLabel", _languageCode, True)
'pageLabel.Text = wfrPage.Content("selectPageLabel", _languageCode, True)
'AddNewPageButton.Text = wfrPage.Content("AddNewPageButton", _languageCode, True)
Dim liGroupHomeLink As New ListItem
liGroupHomeLink.Value = "NavigationMaintenance.aspx?BU="
liGroupHomeLink.Value += Request.QueryString("BU")
liGroupHomeLink.Value += "&partner="
liGroupHomeLink.Value += Request.QueryString("partner")
liGroupHomeLink.Text = "Navigation Overview"
navigationOptions.Items.Add(liGroupHomeLink)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Page.Title = "Group Navigation Maintenance - Maintain Adhoc Groups"
Dim master As MasterPage1 = CType(Me.Master, MasterPage1)
master.HeaderText = "Group Navigation Maintenance"
If String.IsNullOrEmpty(Request.QueryString("BU")) Then
Response.Redirect("../MaintenancePortal.aspx")
End If
If String.IsNullOrEmpty(Request.QueryString("partner")) Then
Response.Redirect("../MaintenancePortal.aspx")
End If
If Not String.IsNullOrEmpty(Request.QueryString("status")) Then
Dim groupStatus As String
groupStatus = Request.QueryString("status")
Select Case groupStatus
Case "added"
ErrorLabel.Text = "The group was successfully added"
Case "updated"
ErrorLabel.Text = "The group was successfully updated"
Case "deleted"
ErrorLabel.Text = "The group was successfully deleted"
Case Else
ErrorLabel.Text = ""
End Select
End If
If IsPostBack = False Then
setLabel()
fillPageDDL()
End If
End Sub
Public Sub fillPageDDL()
PageDDL.DataSource = objGroup1.GetAdhocGroups()
PageDDL.DataTextField = "GROUP_NAME"
PageDDL.DataValueField = "GROUP_ID"
PageDDL.DataBind()
PageDDL.Items.Insert(0, " -- ")
End Sub
Protected Sub AddNewPageButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles AddNewPageButton.Click
Response.Redirect("AdhocGroupDetails.aspx?Status=New&partner=" + Request.QueryString("partner") + "&BU=" + Request.QueryString("BU"))
End Sub
Protected Sub PageDDL_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles PageDDL.SelectedIndexChanged
Response.Redirect("AdhocGroupDetails.aspx?GroupId=" + PageDDL.SelectedValue + "&GroupName=" + PageDDL.SelectedItem.Text + "&partner=" + Request.QueryString("partner") + "&BU=" + Request.QueryString("BU"))
End Sub
Protected Sub CancelButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CancelButton.Click
Response.Redirect("NavigationMaintenance.aspx?partner=" + Request.QueryString("partner") + "&BU=" + Request.QueryString("BU"))
End Sub
End Class
|
' ****************************************************************
' This is free software licensed under the NUnit license. You
' may obtain a copy of the license as well as information regarding
' copyright ownership at http://nunit.org/?p=license&r=2.4.
' ****************************************************************
Option Explicit On
Imports System
Imports NUnit.Framework
Namespace NUnit.Samples
<TestFixture()> Public Class SimpleVBTest
Private fValue1 As Integer
Private fValue2 As Integer
Public Sub New()
MyBase.New()
End Sub
<SetUp()> Public Sub Init()
fValue1 = 2
fValue2 = 3
End Sub
<Test()> Public Sub Add()
Dim result As Double
result = fValue1 + fValue2
Assert.AreEqual(6, result)
End Sub
<Test()> Public Sub DivideByZero()
Dim zero As Integer
Dim result As Integer
zero = 0
result = 8 / zero
End Sub
<Test()> Public Sub TestEquals()
Assert.AreEqual(12, 12)
Assert.AreEqual(CLng(12), CLng(12))
Assert.AreEqual(12, 13, "Size")
Assert.AreEqual(12, 11.99, 0, "Capacity")
End Sub
<Test(), ExpectedException(GetType(Exception))> Public Sub ExpectAnException()
Throw New InvalidCastException()
End Sub
<Test(), Ignore("sample ignore")> Public Sub IgnoredTest()
' does not matter what we type the test is not run
Throw New ArgumentException()
End Sub
End Class
End Namespace |
'===============================================================================
' Microsoft patterns & practices
' CompositeUI Application Block
'===============================================================================
' Copyright © 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
' FITNESS FOR A PARTICULAR PURPOSE.
'===============================================================================
Imports Microsoft.VisualBasic
Imports System.Collections.Specialized
''' <summary>
''' Defines a method implemented by classes that can receive configuration through
''' name/value pairs in the settings file.
''' </summary>
Public Interface IConfigurable
''' <summary>
''' Configures the component with the received settings.
''' </summary>
Sub Configure(ByVal settings As NameValueCollection)
End Interface
|
Namespace UGPPSrvIntDocumento
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/GestionDocumental/SrvIntDocumento/v1")>
Partial Public Class OpConsultarDocumentoSolTipo
Inherits Object
Implements System.ComponentModel.INotifyPropertyChanged
Private contextoTransaccionalField As ContextoTransaccionalTipo
Private documentoField As DocumentoTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
Public Property contextoTransaccional() As ContextoTransaccionalTipo
Get
Return Me.contextoTransaccionalField
End Get
Set
Me.contextoTransaccionalField = Value
Me.RaisePropertyChanged("contextoTransaccional")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property documento() As DocumentoTipo
Get
Return Me.documentoField
End Get
Set
Me.documentoField = Value
Me.RaisePropertyChanged("documento")
End Set
End Property
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
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/GestionDocumental/SrvIntDocumento/v1")>
Partial Public Class OpConsultarDocumentoRespTipo
Inherits Object
Implements System.ComponentModel.INotifyPropertyChanged
Private contextoRespuestaField As ContextoRespuestaTipo
Private documentoField As DocumentoTipo
Private correspondenciaField As CorrespondenciaTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
Public Property contextoRespuesta() As ContextoRespuestaTipo
Get
Return Me.contextoRespuestaField
End Get
Set
Me.contextoRespuestaField = Value
Me.RaisePropertyChanged("contextoRespuesta")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property documento() As DocumentoTipo
Get
Return Me.documentoField
End Get
Set
Me.documentoField = Value
Me.RaisePropertyChanged("documento")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
Public Property correspondencia() As CorrespondenciaTipo
Get
Return Me.correspondenciaField
End Get
Set
Me.correspondenciaField = Value
Me.RaisePropertyChanged("correspondencia")
End Set
End Property
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
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/GestionDocumental/SrvIntDocumento/v1")>
Partial Public Class OpIngresarDocumentoSolTipo
Inherits Object
Private contextoTransaccionalField As ContextoTransaccionalTipo
Private documentosField() As DocumentoTipo
Private expedienteField As ExpedienteTipo
Private correspondenciaField As CorrespondenciaTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
Public Property contextoTransaccional() As ContextoTransaccionalTipo
Get
Return Me.contextoTransaccionalField
End Get
Set
Me.contextoTransaccionalField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("documentos", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property documentos() As DocumentoTipo()
Get
Return Me.documentosField
End Get
Set
Me.documentosField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
Public Property expediente() As ExpedienteTipo
Get
Return Me.expedienteField
End Get
Set
Me.expedienteField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=3)>
Public Property correspondencia() As CorrespondenciaTipo
Get
Return Me.correspondenciaField
End Get
Set
Me.correspondenciaField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/ContextoTransaccionalTipo/v1")>
Partial Public Class ContextoTransaccionalTipo
Inherits Object
Implements System.ComponentModel.INotifyPropertyChanged
Private idTxField As String
Private fechaInicioTxField As Date
Private idInstanciaProcesoField As String
Private idDefinicionProcesoField As String
Private valNombreDefinicionProcesoField As String
Private idInstanciaActividadField As String
Private valNombreDefinicionActividadField As String
Private idUsuarioAplicacionField As String
Private valClaveUsuarioAplicacionField As String
Private idUsuarioField As String
Private idEmisorField As String
Private valTamPaginaField As String
Private valNumPaginaField As String
Private criteriosOrdenamientoField() As CriterioOrdenamientoTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property idTx() As String
Get
Return Me.idTxField
End Get
Set
Me.idTxField = Value
Me.RaisePropertyChanged("idTx")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property fechaInicioTx() As Date
Get
Return Me.fechaInicioTxField
End Get
Set
Me.fechaInicioTxField = Value
Me.RaisePropertyChanged("fechaInicioTx")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property idInstanciaProceso() As String
Get
Return Me.idInstanciaProcesoField
End Get
Set
Me.idInstanciaProcesoField = Value
Me.RaisePropertyChanged("idInstanciaProceso")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property idDefinicionProceso() As String
Get
Return Me.idDefinicionProcesoField
End Get
Set
Me.idDefinicionProcesoField = Value
Me.RaisePropertyChanged("idDefinicionProceso")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property valNombreDefinicionProceso() As String
Get
Return Me.valNombreDefinicionProcesoField
End Get
Set
Me.valNombreDefinicionProcesoField = Value
Me.RaisePropertyChanged("valNombreDefinicionProceso")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=5)>
Public Property idInstanciaActividad() As String
Get
Return Me.idInstanciaActividadField
End Get
Set
Me.idInstanciaActividadField = Value
Me.RaisePropertyChanged("idInstanciaActividad")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=6)>
Public Property valNombreDefinicionActividad() As String
Get
Return Me.valNombreDefinicionActividadField
End Get
Set
Me.valNombreDefinicionActividadField = Value
Me.RaisePropertyChanged("valNombreDefinicionActividad")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=7)>
Public Property idUsuarioAplicacion() As String
Get
Return Me.idUsuarioAplicacionField
End Get
Set
Me.idUsuarioAplicacionField = Value
Me.RaisePropertyChanged("idUsuarioAplicacion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=8)>
Public Property valClaveUsuarioAplicacion() As String
Get
Return Me.valClaveUsuarioAplicacionField
End Get
Set
Me.valClaveUsuarioAplicacionField = Value
Me.RaisePropertyChanged("valClaveUsuarioAplicacion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=9)>
Public Property idUsuario() As String
Get
Return Me.idUsuarioField
End Get
Set
Me.idUsuarioField = Value
Me.RaisePropertyChanged("idUsuario")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=10)>
Public Property idEmisor() As String
Get
Return Me.idEmisorField
End Get
Set
Me.idEmisorField = Value
Me.RaisePropertyChanged("idEmisor")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=11)>
Public Property valTamPagina() As String
Get
Return Me.valTamPaginaField
End Get
Set
Me.valTamPaginaField = Value
Me.RaisePropertyChanged("valTamPagina")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=12)>
Public Property valNumPagina() As String
Get
Return Me.valNumPaginaField
End Get
Set
Me.valNumPaginaField = Value
Me.RaisePropertyChanged("valNumPagina")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("criteriosOrdenamiento", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=13)>
Public Property criteriosOrdenamiento() As CriterioOrdenamientoTipo()
Get
Return Me.criteriosOrdenamientoField
End Get
Set
Me.criteriosOrdenamientoField = Value
Me.RaisePropertyChanged("criteriosOrdenamiento")
End Set
End Property
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
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/CriterioOrdenamientoTipo")>
Partial Public Class CriterioOrdenamientoTipo
Inherits Object
Private valOrdenField As String
Private valNombreCampoField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=0)>
Public Property valOrden() As String
Get
Return Me.valOrdenField
End Get
Set
Me.valOrdenField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNombreCampo() As String
Get
Return Me.valNombreCampoField
End Get
Set
Me.valNombreCampoField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/DocumentoTipo/v1")>
Partial Public Class DocumentoTipo
Inherits Object
Private idDocumentoField As String
Private valNombreDocumentoField As String
Private docDocumentoField As ArchivoTipo
Private fecDocumentoField As String
Private valPaginasField As String
Private codTipoDocumentoField As String
Private valAutorOriginadorField As String
Private idRadicadoCorrespondenciaField As String
Private fecRadicacionCorrespondenciaField As String
Private valNaturalezaDocumentoField As String
Private valOrigenDocumentoField As String
Private descObservacionLegibilidadField As String
Private esMoverField As String
Private valNombreTipoDocumentalField As String
Private numFoliosField As String
Private valLegibleField As String
Private valTipoFirmaField As String
Private metadataDocumentoField As MetadataDocumentoTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property idDocumento() As String
Get
Return Me.idDocumentoField
End Get
Set
Me.idDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNombreDocumento() As String
Get
Return Me.valNombreDocumentoField
End Get
Set
Me.valNombreDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property docDocumento() As ArchivoTipo
Get
Return Me.docDocumentoField
End Get
Set
Me.docDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property fecDocumento() As String
Get
Return Me.fecDocumentoField
End Get
Set
Me.fecDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=4)>
Public Property valPaginas() As String
Get
Return Me.valPaginasField
End Get
Set
Me.valPaginasField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=5)>
Public Property codTipoDocumento() As String
Get
Return Me.codTipoDocumentoField
End Get
Set
Me.codTipoDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=6)>
Public Property valAutorOriginador() As String
Get
Return Me.valAutorOriginadorField
End Get
Set
Me.valAutorOriginadorField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=7)>
Public Property idRadicadoCorrespondencia() As String
Get
Return Me.idRadicadoCorrespondenciaField
End Get
Set
Me.idRadicadoCorrespondenciaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=8)>
Public Property fecRadicacionCorrespondencia() As String
Get
Return Me.fecRadicacionCorrespondenciaField
End Get
Set
Me.fecRadicacionCorrespondenciaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=9)>
Public Property valNaturalezaDocumento() As String
Get
Return Me.valNaturalezaDocumentoField
End Get
Set
Me.valNaturalezaDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=10)>
Public Property valOrigenDocumento() As String
Get
Return Me.valOrigenDocumentoField
End Get
Set
Me.valOrigenDocumentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=11)>
Public Property descObservacionLegibilidad() As String
Get
Return Me.descObservacionLegibilidadField
End Get
Set
Me.descObservacionLegibilidadField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=12)>
Public Property esMover() As String
Get
Return Me.esMoverField
End Get
Set
Me.esMoverField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=13)>
Public Property valNombreTipoDocumental() As String
Get
Return Me.valNombreTipoDocumentalField
End Get
Set
Me.valNombreTipoDocumentalField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=14)>
Public Property numFolios() As String
Get
Return Me.numFoliosField
End Get
Set
Me.numFoliosField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=15)>
Public Property valLegible() As String
Get
Return Me.valLegibleField
End Get
Set
Me.valLegibleField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=16)>
Public Property valTipoFirma() As String
Get
Return Me.valTipoFirmaField
End Get
Set
Me.valTipoFirmaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=17)>
Public Property metadataDocumento() As MetadataDocumentoTipo
Get
Return Me.metadataDocumentoField
End Get
Set
Me.metadataDocumentoField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/MetadataDocumentoTipo/v1")>
Partial Public Class MetadataDocumentoTipo
Inherits Object
Private serieDocumentalField As SerieDocumentalTipo
Private valAgrupadorField() As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property serieDocumental() As SerieDocumentalTipo
Get
Return Me.serieDocumentalField
End Get
Set
Me.serieDocumentalField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("valAgrupador", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valAgrupador() As String()
Get
Return Me.valAgrupadorField
End Get
Set
Me.valAgrupadorField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/ArchivoTipo/v1")>
Partial Public Class ArchivoTipo
Inherits Object
Private valNombreArchivoField As String
Private idArchivoField As String
Private valContenidoArchivoField() As Byte
Private valContenidoFirmaField() As Byte
Private codTipoMIMEArchivoField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property valNombreArchivo() As String
Get
Return Me.valNombreArchivoField
End Get
Set
Me.valNombreArchivoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property idArchivo() As String
Get
Return Me.idArchivoField
End Get
Set
Me.idArchivoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="base64Binary", IsNullable:=True, Order:=2)>
Public Property valContenidoArchivo() As Byte()
Get
Return Me.valContenidoArchivoField
End Get
Set
Me.valContenidoArchivoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="base64Binary", IsNullable:=True, Order:=3)>
Public Property valContenidoFirma() As Byte()
Get
Return Me.valContenidoFirmaField
End Get
Set
Me.valContenidoFirmaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property codTipoMIMEArchivo() As String
Get
Return Me.codTipoMIMEArchivoField
End Get
Set
Me.codTipoMIMEArchivoField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/CorrespondenciaTipo/v1")>
Partial Public Class CorrespondenciaTipo
Inherits Object
Private codEntidadOriginadoraField As String
Private codEntidadOriginadoraInicialField As String
Private valNombreEntidadOriginadoraField As String
Private codMedioRecepcionField As String
Private codMedioEnvioField As String
Private valNombreEntidadCorrespondenciaField As String
Private codPaisField As String
Private codTipoClienteField As String
Private codPuntoImpresionField As String
Private codSedeField As String
Private codTipoEnvioField As String
Private valDescripcionAnexosField As String
Private codDependenciaField As String
Private codPuntoRecepcionField As String
Private codTipoCorrespondenciaField As String
Private valNombreProcesoField As String
Private valIndRequiereRespuestaNotificacionField As String
Private personaNaturalField As PersonaNaturalTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property codEntidadOriginadora() As String
Get
Return Me.codEntidadOriginadoraField
End Get
Set
Me.codEntidadOriginadoraField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property codEntidadOriginadoraInicial() As String
Get
Return Me.codEntidadOriginadoraInicialField
End Get
Set
Me.codEntidadOriginadoraInicialField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property valNombreEntidadOriginadora() As String
Get
Return Me.valNombreEntidadOriginadoraField
End Get
Set
Me.valNombreEntidadOriginadoraField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property codMedioRecepcion() As String
Get
Return Me.codMedioRecepcionField
End Get
Set
Me.codMedioRecepcionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=4)>
Public Property codMedioEnvio() As String
Get
Return Me.codMedioEnvioField
End Get
Set
Me.codMedioEnvioField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=5)>
Public Property valNombreEntidadCorrespondencia() As String
Get
Return Me.valNombreEntidadCorrespondenciaField
End Get
Set
Me.valNombreEntidadCorrespondenciaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=6)>
Public Property codPais() As String
Get
Return Me.codPaisField
End Get
Set
Me.codPaisField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=7)>
Public Property codTipoCliente() As String
Get
Return Me.codTipoClienteField
End Get
Set
Me.codTipoClienteField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=8)>
Public Property codPuntoImpresion() As String
Get
Return Me.codPuntoImpresionField
End Get
Set
Me.codPuntoImpresionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=9)>
Public Property codSede() As String
Get
Return Me.codSedeField
End Get
Set
Me.codSedeField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=10)>
Public Property codTipoEnvio() As String
Get
Return Me.codTipoEnvioField
End Get
Set
Me.codTipoEnvioField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=11)>
Public Property valDescripcionAnexos() As String
Get
Return Me.valDescripcionAnexosField
End Get
Set
Me.valDescripcionAnexosField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=12)>
Public Property codDependencia() As String
Get
Return Me.codDependenciaField
End Get
Set
Me.codDependenciaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=13)>
Public Property codPuntoRecepcion() As String
Get
Return Me.codPuntoRecepcionField
End Get
Set
Me.codPuntoRecepcionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=14)>
Public Property codTipoCorrespondencia() As String
Get
Return Me.codTipoCorrespondenciaField
End Get
Set
Me.codTipoCorrespondenciaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=15)>
Public Property valNombreProceso() As String
Get
Return Me.valNombreProcesoField
End Get
Set
Me.valNombreProcesoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=16)>
Public Property valIndRequiereRespuestaNotificacion() As String
Get
Return Me.valIndRequiereRespuestaNotificacionField
End Get
Set
Me.valIndRequiereRespuestaNotificacionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=17)>
Public Property personaNatural() As PersonaNaturalTipo
Get
Return Me.personaNaturalField
End Get
Set
Me.personaNaturalField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/IdentificacionTipo/v1")>
Partial Public Class IdentificacionTipo
Inherits Object
Private codTipoIdentificacionField As String
Private valNumeroIdentificacionField As String
Private municipioExpedicionField As MunicipioTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property codTipoIdentificacion() As String
Get
Return Me.codTipoIdentificacionField
End Get
Set
Me.codTipoIdentificacionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNumeroIdentificacion() As String
Get
Return Me.valNumeroIdentificacionField
End Get
Set
Me.valNumeroIdentificacionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property municipioExpedicion() As MunicipioTipo
Get
Return Me.municipioExpedicionField
End Get
Set
Me.municipioExpedicionField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/PersonaNaturalTipo/v1")>
Partial Public Class PersonaNaturalTipo
Inherits Object
Private idPersonaField As IdentificacionTipo
Private valNombreCompletoField As String
Private valPrimerNombreField As String
Private valSegundoNombreField As String
Private valPrimerApellidoField As String
Private valSegundoApellidoField As String
Private codSexoField As String
Private descSexoField As String
Private codEstadoCivilField As String
Private descEstadoCivilField As String
Private codNivelEducativoField As String
Private descNivelEducativoField As String
Private codTipoPersonaNaturalField As String
Private descTipoPersonaNaturalField As String
Private contactoField As ContactoPersonaTipo
Private idAutorizadoField As IdentificacionTipo
Private idAbogadoField As IdentificacionTipo
Private codFuenteField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property idPersona() As IdentificacionTipo
Get
Return Me.idPersonaField
End Get
Set
Me.idPersonaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNombreCompleto() As String
Get
Return Me.valNombreCompletoField
End Get
Set
Me.valNombreCompletoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property valPrimerNombre() As String
Get
Return Me.valPrimerNombreField
End Get
Set
Me.valPrimerNombreField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property valSegundoNombre() As String
Get
Return Me.valSegundoNombreField
End Get
Set
Me.valSegundoNombreField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property valPrimerApellido() As String
Get
Return Me.valPrimerApellidoField
End Get
Set
Me.valPrimerApellidoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=5)>
Public Property valSegundoApellido() As String
Get
Return Me.valSegundoApellidoField
End Get
Set
Me.valSegundoApellidoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=6)>
Public Property codSexo() As String
Get
Return Me.codSexoField
End Get
Set
Me.codSexoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=7)>
Public Property descSexo() As String
Get
Return Me.descSexoField
End Get
Set
Me.descSexoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=8)>
Public Property codEstadoCivil() As String
Get
Return Me.codEstadoCivilField
End Get
Set
Me.codEstadoCivilField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=9)>
Public Property descEstadoCivil() As String
Get
Return Me.descEstadoCivilField
End Get
Set
Me.descEstadoCivilField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=10)>
Public Property codNivelEducativo() As String
Get
Return Me.codNivelEducativoField
End Get
Set
Me.codNivelEducativoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=11)>
Public Property descNivelEducativo() As String
Get
Return Me.descNivelEducativoField
End Get
Set
Me.descNivelEducativoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=12)>
Public Property codTipoPersonaNatural() As String
Get
Return Me.codTipoPersonaNaturalField
End Get
Set
Me.codTipoPersonaNaturalField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=13)>
Public Property descTipoPersonaNatural() As String
Get
Return Me.descTipoPersonaNaturalField
End Get
Set
Me.descTipoPersonaNaturalField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=14)>
Public Property contacto() As ContactoPersonaTipo
Get
Return Me.contactoField
End Get
Set
Me.contactoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=15)>
Public Property idAutorizado() As IdentificacionTipo
Get
Return Me.idAutorizadoField
End Get
Set
Me.idAutorizadoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=16)>
Public Property idAbogado() As IdentificacionTipo
Get
Return Me.idAbogadoField
End Get
Set
Me.idAbogadoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=17)>
Public Property codFuente() As String
Get
Return Me.codFuenteField
End Get
Set
Me.codFuenteField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/ContactoPersonaTipo/v1")>
Partial Public Class ContactoPersonaTipo
Inherits Object
Private telefonosField() As TelefonoTipo
Private correosElectronicosField() As CorreoElectronicoTipo
Private esAutorizaNotificacionElectronicaField As String
Private ubicacionesField() As UbicacionPersonaTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("telefonos", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property telefonos() As TelefonoTipo()
Get
Return Me.telefonosField
End Get
Set
Me.telefonosField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("correosElectronicos", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property correosElectronicos() As CorreoElectronicoTipo()
Get
Return Me.correosElectronicosField
End Get
Set
Me.correosElectronicosField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property esAutorizaNotificacionElectronica() As String
Get
Return Me.esAutorizaNotificacionElectronicaField
End Get
Set
Me.esAutorizaNotificacionElectronicaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("ubicaciones", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property ubicaciones() As UbicacionPersonaTipo()
Get
Return Me.ubicacionesField
End Get
Set
Me.ubicacionesField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/Transversales/CorreoElectronicoTipo/v1")>
Partial Public Class CorreoElectronicoTipo
Inherits Object
Private valCorreoElectronicoField As String
Private codFuenteField As String
Private descFuenteCorreoField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property valCorreoElectronico() As String
Get
Return Me.valCorreoElectronicoField
End Get
Set
Me.valCorreoElectronicoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property codFuente() As String
Get
Return Me.codFuenteField
End Get
Set
Me.codFuenteField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property descFuenteCorreo() As String
Get
Return Me.descFuenteCorreoField
End Get
Set
Me.descFuenteCorreoField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/UbicacionPersonaTipo/v1")>
Partial Public Class UbicacionPersonaTipo
Inherits Object
Private municipioField As MunicipioTipo
Private valDireccionField As String
Private codTipoDireccionField As String
Private descTipoDireccionField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property municipio() As MunicipioTipo
Get
Return Me.municipioField
End Get
Set
Me.municipioField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valDireccion() As String
Get
Return Me.valDireccionField
End Get
Set
Me.valDireccionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property codTipoDireccion() As String
Get
Return Me.codTipoDireccionField
End Get
Set
Me.codTipoDireccionField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property descTipoDireccion() As String
Get
Return Me.descTipoDireccionField
End Get
Set
Me.descTipoDireccionField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/MunicipioTipo/v1")>
Partial Public Class MunicipioTipo
Inherits Object
Implements System.ComponentModel.INotifyPropertyChanged
Private codMunicipioField As String
Private valNombreField As String
Private departamentoField As DepartamentoTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property codMunicipio() As String
Get
Return Me.codMunicipioField
End Get
Set
Me.codMunicipioField = Value
Me.RaisePropertyChanged("codMunicipio")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNombre() As String
Get
Return Me.valNombreField
End Get
Set
Me.valNombreField = Value
Me.RaisePropertyChanged("valNombre")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property departamento() As DepartamentoTipo
Get
Return Me.departamentoField
End Get
Set
Me.departamentoField = Value
Me.RaisePropertyChanged("departamento")
End Set
End Property
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
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/DepartamentoTipo/v1")>
Partial Public Class DepartamentoTipo
Inherits Object
Private codDepartamentoField As String
Private valNombreField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property codDepartamento() As String
Get
Return Me.codDepartamentoField
End Get
Set
Me.codDepartamentoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNombre() As String
Get
Return Me.valNombreField
End Get
Set
Me.valNombreField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/TelefonoTipo/v1")>
Partial Public Class TelefonoTipo
Inherits Object
Private codTipoTelefonoField As String
Private valNumeroTelefonoField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property codTipoTelefono() As String
Get
Return Me.codTipoTelefonoField
End Get
Set
Me.codTipoTelefonoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property valNumeroTelefono() As String
Get
Return Me.valNumeroTelefonoField
End Get
Set
Me.valNumeroTelefonoField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/ExpedienteTipo/v1")>
Partial Public Class ExpedienteTipo
Inherits Object
Implements System.ComponentModel.INotifyPropertyChanged
Private idNumExpedienteField As String
Private codSeccionField As String
Private valSeccionField As String
Private codSubSeccionField As String
Private valSubSeccionField As String
Private serieDocumentalField As SerieDocumentalTipo
Private valAnoAperturaField As String
Private valFondoField As String
Private valEntidadPredecesoraField As String
Private identificacionField As IdentificacionTipo
Private descDescripcionField As String
Private idCarpetaFileNetField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property idNumExpediente() As String
Get
Return Me.idNumExpedienteField
End Get
Set
Me.idNumExpedienteField = Value
Me.RaisePropertyChanged("idNumExpediente")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property codSeccion() As String
Get
Return Me.codSeccionField
End Get
Set
Me.codSeccionField = Value
Me.RaisePropertyChanged("codSeccion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property valSeccion() As String
Get
Return Me.valSeccionField
End Get
Set
Me.valSeccionField = Value
Me.RaisePropertyChanged("valSeccion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property codSubSeccion() As String
Get
Return Me.codSubSeccionField
End Get
Set
Me.codSubSeccionField = Value
Me.RaisePropertyChanged("codSubSeccion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property valSubSeccion() As String
Get
Return Me.valSubSeccionField
End Get
Set
Me.valSubSeccionField = Value
Me.RaisePropertyChanged("valSubSeccion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=5)>
Public Property serieDocumental() As SerieDocumentalTipo
Get
Return Me.serieDocumentalField
End Get
Set
Me.serieDocumentalField = Value
Me.RaisePropertyChanged("serieDocumental")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=6)>
Public Property valAnoApertura() As String
Get
Return Me.valAnoAperturaField
End Get
Set
Me.valAnoAperturaField = Value
Me.RaisePropertyChanged("valAnoApertura")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=7)>
Public Property valFondo() As String
Get
Return Me.valFondoField
End Get
Set
Me.valFondoField = Value
Me.RaisePropertyChanged("valFondo")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=8)>
Public Property valEntidadPredecesora() As String
Get
Return Me.valEntidadPredecesoraField
End Get
Set
Me.valEntidadPredecesoraField = Value
Me.RaisePropertyChanged("valEntidadPredecesora")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=9)>
Public Property identificacion() As IdentificacionTipo
Get
Return Me.identificacionField
End Get
Set
Me.identificacionField = Value
Me.RaisePropertyChanged("identificacion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=10)>
Public Property descDescripcion() As String
Get
Return Me.descDescripcionField
End Get
Set
Me.descDescripcionField = Value
Me.RaisePropertyChanged("descDescripcion")
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=11)>
Public Property idCarpetaFileNet() As String
Get
Return Me.idCarpetaFileNetField
End Get
Set
Me.idCarpetaFileNetField = Value
Me.RaisePropertyChanged("idCarpetaFileNet")
End Set
End Property
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
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/GestionDocumental/SrvIntDocumento/v1")>
Partial Public Class OpIngresarDocumentoRespTipo
Inherits Object
Private contextoRespuestaField As ContextoRespuestaTipo
Private documentosField() As DocumentoTipo
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
Public Property contextoRespuesta() As ContextoRespuestaTipo
Get
Return Me.contextoRespuestaField
End Get
Set
Me.contextoRespuestaField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute("documentos", Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property documentos() As DocumentoTipo()
Get
Return Me.documentosField
End Get
Set
Me.documentosField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/schema/GestionDocumental/SerieDocumentalTipo/v1")>
Partial Public Class SerieDocumentalTipo
Inherits Object
Private valNombreSerieField As String
Private codSerieField As String
Private valNombreSubserieField As String
Private codSubserieField As String
Private codTipoDocumentalField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=0)>
Public Property valNombreSerie() As String
Get
Return Me.valNombreSerieField
End Get
Set
Me.valNombreSerieField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=1)>
Public Property codSerie() As String
Get
Return Me.codSerieField
End Get
Set
Me.codSerieField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=2)>
Public Property valNombreSubserie() As String
Get
Return Me.valNombreSubserieField
End Get
Set
Me.valNombreSubserieField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property codSubserie() As String
Get
Return Me.codSubserieField
End Get
Set
Me.codSubserieField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property codTipoDocumental() As String
Get
Return Me.codTipoDocumentalField
End Get
Set
Me.codTipoDocumentalField = Value
End Set
End Property
End Class
'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.7.3056.0"),
System.SerializableAttribute(),
System.Diagnostics.DebuggerStepThroughAttribute(),
System.ComponentModel.DesignerCategoryAttribute("code"),
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.ugpp.gov.co/esb/schema/ContextoRespuestaTipo/v1")>
Partial Public Class ContextoRespuestaTipo
Inherits Object
Private idTxField As String
Private codEstadoTxField As String
Private fechaTxField As Date
Private idInstanciaProcesoField As String
Private idInstanciaActividadField As String
Private valCantidadPaginasField As String
Private valNumPaginaField As String
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=0)>
Public Property idTx() As String
Get
Return Me.idTxField
End Get
Set
Me.idTxField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=1)>
Public Property codEstadoTx() As String
Get
Return Me.codEstadoTxField
End Get
Set
Me.codEstadoTxField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, Order:=2)>
Public Property fechaTx() As Date
Get
Return Me.fechaTxField
End Get
Set
Me.fechaTxField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=3)>
Public Property idInstanciaProceso() As String
Get
Return Me.idInstanciaProcesoField
End Get
Set
Me.idInstanciaProcesoField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, IsNullable:=True, Order:=4)>
Public Property idInstanciaActividad() As String
Get
Return Me.idInstanciaActividadField
End Get
Set
Me.idInstanciaActividadField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=5)>
Public Property valCantidadPaginas() As String
Get
Return Me.valCantidadPaginasField
End Get
Set
Me.valCantidadPaginasField = Value
End Set
End Property
'''<remarks/>
<System.Xml.Serialization.XmlElementAttribute(Form:=System.Xml.Schema.XmlSchemaForm.Unqualified, DataType:="integer", IsNullable:=True, Order:=6)>
Public Property valNumPagina() As String
Get
Return Me.valNumPaginaField
End Get
Set
Me.valNumPaginaField = Value
End Set
End Property
End Class
End Namespace
|
Imports FastColoredTextBoxNS
Imports System.Text.RegularExpressions
Public Class Pestania
Inherits System.Windows.Forms.TabPage
Private popupMenu As AutocompleteMenu
Private keywords As String() = { _
"entero", "doble", "boolean", "caracter", "cadena", _
"div", "border", "bgcolor", "width", "height", _
"ruta", "version", "seleccionar", "variable", "nombreObj", _
"condicion", "valor" _
}
Private declarationHtml As String() = { _
"<jsl:transformacion ruta="""" version="""">" & vbLf & "^" & vbLf & "</jsl:final>", _
"<jsl:variable tipo = id^/>", _
"<jsl:asignar variable = id valor = expresion^/>", _
"<jsl:plantilla nombreObj = id>" & vbLf & "^" & vbLf & "</jsl:plantilla>", _
"<jsl:plantilla-aplicar seleccionar = id^/>", _
"<jsl:valor-de seleccionar = id^/>", _
"<jsl:para-cada seleccionar = id>" & vbLf & "^" & vbLf & "</jsl:para-cada>", _
"<jsl:if condicion = expresion>" & vbLf & "^" & vbLf & "</jsl:if>", _
"<jsl:en-caso>" & vbLf & "^" & vbLf & "</jsl:en-caso>", _
"<jsl:de condicion = expresion>" & vbLf & "^" & vbLf & "</jsl:de>", _
"<jsl:cualquier-otro>" & vbLf & "^" & vbLf & "</jsl:cualquier-otro>", _
"<html>" & vbLf & "^" & vbLf & "</html>", _
"<body>" & vbLf & "^" & vbLf & "</body>", _
"<head>" & vbLf & "<title>" & vbLf & "^" & vbLf & "</title>" & vbLf & "</head>", _
"<h1>^</h1>", "<h2>^</h2>", "<h3>^</h3>", "<h4>^</h4>", "<h5>^</h5>", "<h6>^</h6>", _
"<p>^</p>", "<b>^</b>", "<i>^</i>", "<th>^</th>", "<td>^</td>", _
"<table border=""^"" bgcolor="""" width="""">" & vbLf & "<tr>" & vbLf & "<th></th>" & vbLf & "</tr>" & vbLf & "<tr>" & vbLf & "<td></td>" & vbLf & "</tr>" & vbLf & "</table>", _
"<tr>" & vbLf & "<th>^</th>" & vbLf & "</tr>", _
"<tr>" & vbLf & "<td>^</td>" & vbLf & "</tr>"
}
Public Sub New()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Pestania))
Me.fctb = New FastColoredTextBoxNS.FastColoredTextBox()
Me.iconsList = New System.Windows.Forms.ImageList()
Me.SuspendLayout()
'
'fctb
'
Me.fctb.AutoScrollMinSize = New System.Drawing.Size(466, 330)
Me.fctb.BackBrush = Nothing
Me.fctb.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.fctb.Cursor = System.Windows.Forms.Cursors.IBeam
Me.fctb.DelayedEventsInterval = 500
Me.fctb.DelayedTextChangedInterval = 500
Me.fctb.DisabledColor = System.Drawing.Color.FromArgb(CType(CType(100, Byte), Integer), CType(CType(180, Byte), Integer), CType(CType(180, Byte), Integer), CType(CType(180, Byte), Integer))
Me.fctb.Dock = System.Windows.Forms.DockStyle.Fill
Me.fctb.Font = New System.Drawing.Font("Consolas", 9.75!)
Me.fctb.Language = FastColoredTextBoxNS.Language.Custom
Me.fctb.HighlightingRangeType = HighlightingRangeType.AllTextRange
Me.fctb.DescriptionFile = "jslDesc.xml"
Me.fctb.LeftBracket = "<"
Me.fctb.Location = New System.Drawing.Point(0, 85)
Me.fctb.Name = "fctb"
Me.fctb.Paddings = New System.Windows.Forms.Padding(0)
Me.fctb.RightBracket = ">"
Me.fctb.SelectionColor = System.Drawing.Color.FromArgb(CType(CType(50, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(0, Byte), Integer), CType(CType(255, Byte), Integer))
Me.fctb.Size = New System.Drawing.Size(500, 280)
Me.fctb.TabIndex = 7
Me.fctb.BorderStyle = Windows.Forms.BorderStyle.None
Me.fctb.AutoIndent = True
'Me.fctb.Text = resources.GetString("fctb.Text")
'
'imageList1
'
Me.iconsList.ImageStream = CType(resources.GetObject("imageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.iconsList.TransparentColor = System.Drawing.Color.Transparent
Me.iconsList.Images.SetKeyName(0, "script_16x16.png")
Me.iconsList.Images.SetKeyName(1, "app_16x16.png")
Me.iconsList.Images.SetKeyName(2, "1302166543_virtualbox.png")
'
'tabPage
'
Me.ClientSize = New System.Drawing.Size(500, 365)
Me.Controls.Add(Me.fctb)
Me.ResumeLayout(False)
Me.Text = "Sin guardar*"
Me.BorderStyle = Windows.Forms.BorderStyle.None
popupMenu = New AutocompleteMenu(fctb)
popupMenu.Items.ImageList = iconsList
popupMenu.SearchPattern = "[\w\.:=!<>]" '
BuildAutocompleteMenu()
End Sub
Public Sub abrir()
Dim openDialog As New OpenFileDialog()
openDialog.Filter = "Archivos JSL (*.jsl)|*.jsl|Archivos JSON (*.json)|*.json"
openDialog.FilterIndex = 1
If openDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Me.Text = openDialog.SafeFileName
Me.ToolTipText = openDialog.FileName
Me.fctb.OpenFile(Me.ToolTipText)
End If
End Sub
Public Sub guardarComo()
Dim saveDialog As New SaveFileDialog()
saveDialog.Filter = "Archivos JSL (*.jsl)|*.jsl|Archivos JSON (*.json)|*.json"
saveDialog.FilterIndex = 1
If saveDialog.ShowDialog = System.Windows.Forms.DialogResult.OK Then
Dim destino = saveDialog.FileName
Dim i = destino.LastIndexOf("\") + 1
Me.Text = destino.Substring(i)
Me.ToolTipText = destino
Me.fctb.SaveToFile(destino, System.Text.Encoding.UTF8)
End If
End Sub
Public Sub guardar()
Dim destino = Me.Text
If (destino.Contains("*")) Then
guardarComo()
Else
destino = Me.ToolTipText
Me.fctb.SaveToFile(destino, System.Text.Encoding.UTF8)
End If
End Sub
Public Function texto()
Return Me.fctb.Text
End Function
Private Sub BuildAutocompleteMenu()
Dim items As New List(Of AutocompleteItem)()
For Each item As String In declarationHtml
items.Add(New DeclarationSnippet(item) With {.ImageIndex = 0})
Next
For Each item As String In keywords
items.Add(New AutocompleteItem(item))
Next
items.Add(New InsertSpaceSnippet())
items.Add(New InsertSpaceSnippet("^(\w+)([=<>!:]+)(\w+)$"))
items.Add(New InsertEnterSnippet())
'set as autocomplete source
popupMenu.Items.SetAutocompleteItems(items)
End Sub
''' <summary>
''' This item appears when any part of snippet text is typed
''' </summary>
Private Class DeclarationSnippet
Inherits SnippetAutocompleteItem
Public Sub New(ByVal snippet As String)
MyBase.New(snippet)
End Sub
Public Overrides Function Compare(ByVal fragmentText As String) As CompareResult
Dim pattern = Regex.Escape(fragmentText)
If Regex.IsMatch(Text, "\b" & pattern, RegexOptions.IgnoreCase) Then
Return CompareResult.Visible
End If
Return CompareResult.Hidden
End Function
End Class
''' <summary>
''' Divides numbers and words: "123AND456" -> "123 AND 456"
''' Or "i=2" -> "i = 2"
''' </summary>
Private Class InsertSpaceSnippet
Inherits AutocompleteItem
Private pattern As String
Public Sub New(ByVal pattern As String)
MyBase.New("")
Me.pattern = pattern
End Sub
Public Sub New()
Me.New("^(\d+)([a-zA-Z_]+)(\d*)$")
End Sub
Public Overrides Function Compare(ByVal fragmentText As String) As CompareResult
If Regex.IsMatch(fragmentText, pattern) Then
Text = InsertSpaces(fragmentText)
If Text <> fragmentText Then
Return CompareResult.Visible
End If
End If
Return CompareResult.Hidden
End Function
Public Function InsertSpaces(ByVal fragment As String) As String
Dim m = Regex.Match(fragment, pattern)
If m Is Nothing Then
Return fragment
End If
If m.Groups(1).Value = "" AndAlso m.Groups(3).Value = "" Then
Return fragment
End If
Return (m.Groups(1).Value & " " & m.Groups(2).Value & " " & m.Groups(3).Value).Trim()
End Function
Public Overrides Property ToolTipTitle() As String
Get
Return Text
End Get
Set(ByVal value As String)
End Set
End Property
End Class
''' <summary>
''' Inerts line break after '>'
''' </summary>
Private Class InsertEnterSnippet
Inherits AutocompleteItem
Private enterPlace As Place = Place.Empty
Public Sub New()
MyBase.New("[Line break]")
End Sub
Public Overrides Function Compare(ByVal fragmentText As String) As CompareResult
Dim r = Parent.Fragment.Clone()
While r.Start.iChar > 0
If r.CharBeforeStart = ">"c Then
enterPlace = r.Start
Return CompareResult.Visible
End If
r.GoLeftThroughFolded()
End While
Return CompareResult.Hidden
End Function
Public Overrides Function GetTextForReplace() As String
'extend range
Dim r As Range = Parent.Fragment
Dim [end] As Place = r.[End]
r.Start = enterPlace
r.[End] = r.[End]
'insert line break
Return Environment.NewLine + r.Text
End Function
Public Overrides Sub OnSelected(ByVal popupMenu As AutocompleteMenu, ByVal e As SelectedEventArgs)
MyBase.OnSelected(popupMenu, e)
If Parent.Fragment.tb.AutoIndent Then
Parent.Fragment.tb.DoAutoIndent()
End If
End Sub
Public Overrides Property ToolTipTitle() As String
Get
Return "Insert line break after '>'"
End Get
Set(ByVal value As String)
End Set
End Property
End Class
Private WithEvents fctb As FastColoredTextBoxNS.FastColoredTextBox
Private WithEvents iconsList As System.Windows.Forms.ImageList
End Class
|
Imports TrackSpy.PlugIn
Imports System.Drawing
Imports Newtonsoft.Json.Linq
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.IO
Namespace plug_Ins
Public Class PluginMap
Inherits TrackSpy.PlugIn.BasePlugin
Implements IPlugin
#Region "Fields"
Private _Lng As Single
Private _Lat As Single
Private _trackMap As Bitmap
Private oTrackGpsList As List(Of Track_Gps_Data)
Private TransX As Single
Private TransY As Single
#End Region
#Region "Property"
Public Property Lng() As Single
Get
Return _Lng
End Get
Set(ByVal value As Single)
_Lng = value
End Set
End Property
Public Property Lat() As Single
Get
Return _Lat
End Get
Set(ByVal value As Single)
_Lat = value
End Set
End Property
#End Region
Protected Overrides ReadOnly Property Name() As String
Get
Return "MapRender"
End Get
End Property
Public Sub LoadTrackData(ByVal path As String)
'Dim fileContents As String
'fileContents = My.Computer.FileSystem.ReadAllText("C:\Users\andy.pye\Desktop\VB Projects\TrackSpyRender\TestData\track.json")
'fileContents = My.Computer.FileSystem.ReadAllText(path)
Dim json = JValue.Parse(path)
json = json.Root.First
oTrackGpsList = New List(Of Track_Gps_Data)
'Load gps data
For Each obj as JObject In json.Root
oTrackGpsList.Add(New Track_Gps_Data(obj.Item("lng"), obj.Item("lat"), obj.Item("track_id"), obj.Item("id")))
Next
BuildTrack()
End Sub
Private Sub BuildTrack()
Dim gp As New Drawing2D.GraphicsPath
Dim smallx As Single = 50000000000000
Dim smally As Single = 50000000000000
Dim g As Graphics
Dim Translatex As Single = 0
Dim Translatey As Single = 0
Dim m As New Drawing2D.Matrix()
Dim lng As Double = 0
Dim lat As Double = 0
If oTrackGpsList IsNot Nothing Then
'Create array to store points
Dim PointArray(oTrackGpsList.Count - 1) As PointF
For i as integer = 0 To oTrackGpsList.Count - 1
Dim longd As Double = oTrackGpsList(i).lng * 100000
Dim latd As Double = oTrackGpsList(i).lat * 100000
If latd < smally Then
smally = latd
End If
If longd < smallx Then
smallx = longd
End If
PointArray(i) = New PointF(longd, latd)
Next i
'Add lines to graphic path
gp.AddLines(PointArray)
'==============================
'Calc transform to fit in image
'==============================
If gp.GetBounds.X < 0 Then
Translatex = Math.Abs(gp.GetBounds.X)
Else
Translatex = -smallx
End If
If gp.GetBounds.Y < 0 Then
Translatey = Math.Abs(gp.GetBounds.Y)
Else
Translatey = -smally
End If
TransX = Translatex
TransY = Translatey
m.Translate(Translatex, Translatey)
gp.Transform(m)
_trackMap = New Bitmap(CInt(gp.GetBounds.Width), CInt(gp.GetBounds.Height))
g = Graphics.FromImage(_trackMap)
'gp = ReflectPath(gp)
g.FillPath(New SolidBrush(Color.OrangeRed), gp)
g.DrawPath(New Pen(Color.OrangeRed, 20), gp)
g.Dispose()
End If
End Sub
Public Overrides Sub PerformAction(ByVal context As TrackSpy.PlugIn.IPluginContext)
'Set up
'Map data
MyBase.PerformAction(context)
Dim m As New Drawing2D.Matrix()
Dim gp As New Drawing2D.GraphicsPath
Dim g As Graphics
m.Translate(TransX, TransY)
'g = Graphics.FromImage(trackMap)
gp.AddEllipse(New RectangleF((Me.Lng * 100000) - 30, (Me.Lat * 100000) - 30, 60, 60))
gp.Transform(m)
Dim TMap As New Bitmap(_trackMap.Width, _trackMap.Height)
g = Graphics.FromImage(TMap)
g.DrawImage(_trackMap, New RectangleF(0, 0, _trackMap.Width, _trackMap.Height))
g.DrawPath(Pens.Red, gp)
g.FillPath(Brushes.Red, gp)
TMap.RotateFlip(RotateFlipType.RotateNoneFlipY)
context.g.DrawImage(TMap, New RectangleF(context.Layout.GetX(), context.Layout.GetY(), context.Layout.GetWidth(), context.Layout.GetHeight()), New RectangleF(0, 0, _trackMap.Width, _trackMap.Height), GraphicsUnit.Pixel)
gp.Dispose()
g.Dispose()
End Sub
Private Function ReflectPath(ByVal gp As Drawing2D.GraphicsPath) As Drawing2D.GraphicsPath
Dim Xtranslation As Single = 2 * gp.GetBounds.Right
Dim Ytranslation As Single = 2 * gp.GetBounds.Bottom
Dim mtx As New Drawing2D.Matrix(-1, -1, 1, 1, Xtranslation, Ytranslation)
Dim pth As New Drawing2D.GraphicsPath(gp.PathPoints, gp.PathTypes)
Using mirror As New Drawing2D.GraphicsPath(gp.PathPoints, gp.PathTypes)
mirror.Transform(mtx)
mirror.Reverse()
pth.AddPath(mirror, True)
pth.CloseFigure()
End Using
Return pth
End Function
Private Function ReflectPathold(ByVal gp As Drawing2D.GraphicsPath) As Drawing2D.GraphicsPath
Using mirror As New Drawing2D.GraphicsPath(gp.PathPoints, gp.PathTypes)
Dim mtx As New Drawing2D.Matrix(-1, 0, 0, 1, gp.GetBounds.Width * 2.1F, 0) 'flip and translate X
mirror.Transform(mtx)
gp.AddPath(mirror, False)
End Using
Return gp
End Function
Private Sub DialRender_DataMap(ByVal Name As String, ByVal Value As Object) Handles Me.DataMap
'Map the data to the property
' Try
TrackSpy.Helper.ReflectionHelper.SetPropertyValue(Me, Name, Value)
'Catch ex As Exception
' Throw New Exceptions.DataMappingException(ex.Message)
'End Try
End Sub
Public Sub Save(ByVal filename As String)
Dim mlSerializer As Xml.Serialization.XmlSerializer = New Xml.Serialization.XmlSerializer(GetType(PluginMap))
Dim writer As IO.StringWriter = New IO.StringWriter()
mlSerializer.Serialize(writer, Me)
My.Computer.FileSystem.WriteAllText(filename, writer.ToString, False, System.Text.Encoding.Unicode)
End Sub
Public Overrides Sub Config(ByVal Settings() As Layout.SettingItem)
MyBase.Config(Settings)
End Sub
End Class
End Namespace |
Namespace Views
Public Interface IPickRacerView
Function SelectRacer(sourceList As IList(Of RacerView)) As Boolean
ReadOnly Property SelectedRacerId As Long
End Interface
End Namespace
|
Public Class GeneralModels
Public Class About
Public Property ServerName As String
Public Property TimeRunning As String
Public Property ElasticsearchUrl As String
Public Property HostOs As String
Public Property Processors As String
Public Property CommandLine As String
Public Property ThreatBridgeVersion As String
Public Property SystemStatus As Systemstatus
Public Property SystemHealth As Systemhealth
End Class
Public Class Systemstatus
Public Property name As String
Public Property cluster_name As String
Public Property version As Version
Public Property tagline As String
End Class
Public Class Version
Public Property number As String
Public Property build_hash As String
Public Property build_timestamp As Date
Public Property build_snapshot As Boolean
Public Property lucene_version As String
End Class
Public Class Systemhealth
Public Property cluster_name As String
Public Property status As String
Public Property timed_out As Boolean
Public Property number_of_nodes As Integer
Public Property number_of_data_nodes As Integer
Public Property active_primary_shards As Integer
Public Property active_shards As Integer
Public Property relocating_shards As Integer
Public Property initializing_shards As Integer
Public Property unassigned_shards As Integer
Public Property delayed_unassigned_shards As Integer
Public Property number_of_pending_tasks As Integer
Public Property number_of_in_flight_fetch As Integer
Public Property task_max_waiting_in_queue_millis As Integer
Public Property active_shards_percent_as_number As Single
End Class
Public Class Count
Public Property Total As Integer
Public Property Feeds As List(Of Feed)
End Class
Public Class Feed
Public Property Name As String
Public Property IndexId As String
Public Property Count As Integer
End Class
Public Class GlobalStats
Public Property TotalRecords As Integer
Public Property TotalTimeSpan As String
Public Property TotalRecordsAdded As Integer
Public Property TotalRecordsUpdated As Integer
Public Property TotalRecordsDeleted As Integer
Public Property TotalRecordsAged As Integer
Public Property TotalSearches As Integer
Public Property TotalHits As Integer
Public Property DailyTimeSpan As String
Public Property DailyRecordsAdded As Integer
Public Property DailyRecordsUpdated As Integer
Public Property DailyRecordsDeleted As Integer
Public Property DailyRecordsAged As Integer
Public Property DailySearches As Integer
Public Property DailyHits As Integer
End Class
End Class
|
'NOTE: This in the end does not work due to the OpenXml packaging class unable to handle more than 10MB in multiple threads
' There was a open xml version 2.6 that fixes this, but its not strong named signed.
' After attempting to strong sign it, it threw many compilation errors that could not get fixed.
' Using NPOI to do the stuff
'Imports DocumentFormat.OpenXml.Spreadsheet
'Imports DocumentFormat.OpenXml.Packaging
'Imports System.Windows.Forms
'Imports System.Drawing
'Friend Class cExcel07
' '----------------------------------------------------------------------------------------
' 'Functions:
' '1: export data - Done
' '2: Add Worksheet - done
' '3: Rename Worksheet - done
' '4: Clear Worksheet - done
' '----------------------------------------------------------------------------------------
' 'In Dev:
' '1: Import Data
' '2: Delete Sheet
' Private Shared _XLPackage As SpreadsheetDocument
' Private Shared _wbPart As WorkbookPart
' Private Shared _wb As Workbook
' Private Shared _xl_err_msg As String = ""
' Private Shared _worksheets As New Dictionary(Of String, String)
' Private Shared _tables As New Dictionary(Of String, String)
' Private Shared _sharedStrings As New Dictionary(Of String, String)
' Private Shared _sharedStrings_max_index As Integer = 0
' Private Shared _worksheet_max_id As Integer = 1
' Private Shared _table_max_id As Integer = 1
' Private Shared _bold_font_style_index As Integer
' Private Shared _date_style_index As Integer = 1
' 'Private Shared _export_col_widths As New Dictionary(Of String, Double)
' Private Shared _row_index As Integer = 1
' Private Shared _col_cnt As Integer
' Private Shared _XL_sheet_row_max As Integer = 1048576
' 'in testing, the use of shared strings does not really help with compression. it is faster to just not use it and write strings directly
' Private Shared _use_shared_strings As Boolean = False
' '-------------------------------------------------------------------
' 'user inputs
' Private Shared _file_path As String = EDIS.get_edis_pval("file_path")
' Private Shared _sheet_nm As String = EDIS.get_edis_pval("sheet_nm")
' Private Shared _new_sheet_nm As String = EDIS.get_edis_pval("new_sheet_nm")
' Private Shared _table_nm As String = EDIS.get_edis_pval("table_nm")
' Private Shared _use_auto_filter As String = EDIS.get_edis_pval("use_autofilter")
' Private Shared _bold_headers As String = EDIS.get_edis_pval("bold_headers")
' Private Shared _auto_fit_columns As String = EDIS.get_edis_pval("autofit_cols")
' Private Shared _include_headers As String = EDIS.get_edis_pval("include_headers")
' 'Private Shared _include_auto_filter As string
' Private Shared _src_qry As String = EDIS.get_edis_pval("src_qry")
' Private Shared _mssql_inst As String = EDIS._mssql_inst
' Private Shared _table_style_nm As String = EDIS.get_edis_pval("table_style") ' "TableStyleMedium3"
' Private Shared _output_tbl_nm As String = EDIS.get_edis_pval("output_tbl_nm")
' Shared Sub main(ByRef err_msg As String)
' Try
' Dim sub_task As String = EDIS.get_edis_pval("sub_task")
' log_edis_event("info", "Excel 07", "sub task " + sub_task)
' Select Case sub_task.ToLower
' Case "export_data"
' log_edis_event("info", "Excel 07", "going to export data proc")
' export_excel_07_data(err_msg)
' Case "rename_worksheet"
' u_rename_worksheet()
' Case "clear_worksheet"
' u_clear_worksheet()
' Case "add_worksheet"
' u_add_worksheet()
' Case "get_sheet_list"
' u_get_sheet_list()
' Case Else
' Throw New Exception("Task [" + sub_task + "] does not exist in excel 07 toolset")
' End Select
' 'err_msg = _xl_err_msg
' Catch ex As Exception
' err_msg = ex.Message.ToString()
' End Try
' End Sub
' Private Class export_column
' Property ord_pos As String
' Property col_width As Double
' Property col_nm As String
' End Class
' Private Shared Sub export_excel_07_data(ByRef err_msg As String)
' Try
' 'Synopsis
' ' This export overwrites the existing tab
' ' It will preserve the primary font and size from Excel, but all other stuff gets blown away
' ' Future enhancemment: Have it read the existing sheet on a reader up to the sheet data, then overwrite...
' ' link: https://blogs.msdn.microsoft.com/brian_jones/2010/06/22/writing-large-excel-files-with-the-open-xml-sdk/
' ' this could be tricky though as after sheet data, there might be other junk
' ' plus we will have to detect things like existing tables and what to do
' '_bold_headers = True
' '_auto_fit_columns = True
' log_edis_event("info", "Excel 07", "export data started")
' Dim buffer_for_auto_filter As Boolean = False
' If _use_auto_filter Or _table_nm <> "" Then
' buffer_for_auto_filter = True
' End If
' 'counter for rows
' Dim row_counter As Integer = 1
' Dim sheet_range_referene As String = ""
' If IO.File.Exists(_file_path) Then
' i_open_workbook()
' Else
' i_create_workbook()
' i_open_workbook()
' End If
' log_edis_event("info", "Excel 07", "workbook loaded")
' '-------------------------------------------------------
' 'Check if the table name exists on another worksheet...if so, throw error
' 'Still getting errors if sheets exist on other worksheets
' If _tables.ContainsKey(_table_nm) Then
' For Each wsPart In _XLPackage.WorkbookPart.WorksheetParts
' Dim curr_sheet_nm As String = get_sheet_nm_from_wspart(wsPart)
' 'dont evaluate if the sheet is the one we are writing to, since we will be replacing anyways
' If curr_sheet_nm <> _sheet_nm Then
' For Each itm In wsPart.TableDefinitionParts
' If itm.Table.Name = _table_nm Then
' Dim table_error_msg As String =
' "Table [" + _table_nm + "] already exists on worksheet [" + curr_sheet_nm + "]. Table names must be unique across the workbook."
' err_msg = table_error_msg
' Exit Sub
' End If
' Next
' End If
' Next
' End If
' log_edis_event("info", "Excel 07", "tables check complete")
' Dim column_meta As New List(Of export_column)
' Using _XLPackage
' 'default font for tracking width
' Dim fFam As New System.Drawing.FontFamily("Calibri")
' Dim font As New System.Drawing.Font(fFam, 11)
' '--------------------------------------------------------------------------------------------------------------------------------
' 'create the style sheet
' i_create_Style_Sheet()
' 'add worksheet part
' Dim wsPart As WorksheetPart = _wbPart.AddNewPart(Of WorksheetPart)()
' 'This gets added when we create the openxml writer
' 'wsPart.Worksheet = New Worksheet(New SheetData())
' log_edis_event("info", "Excel 07", "style sheet loaded")
' Dim writer As DocumentFormat.OpenXml.OpenXmlWriter = DocumentFormat.OpenXml.OpenXmlWriter.Create(wsPart)
' Using cn As New SqlClient.SqlConnection("Server= " + _mssql_inst + "; Integrated Security= True")
' cn.Open()
' Dim cmd As New SqlClient.SqlCommand
' cmd.Connection = cn
' cmd.CommandText = _src_qry
' cmd.CommandType = CommandType.Text
' Dim oxa As List(Of DocumentFormat.OpenXml.OpenXmlAttribute)
' 'create the worksheet and sheetdata for the Sheet
' writer.WriteStartElement(New Worksheet())
' writer.WriteStartElement(New SheetData())
' _row_index = 1
' Using reader = cmd.ExecuteReader
' _col_cnt = reader.FieldCount
' If _include_headers Then
' '----------------------------------------------------------------------------
' 'Add Headers
' oxa = New List(Of DocumentFormat.OpenXml.OpenXmlAttribute)
' 'add row index : NOT required...leaving out for compression purposes
' ' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("r", Nothing, counter.ToString))
' 'writer.WriteStartElement(New Row(), oxa)
' writer.WriteStartElement(New Row())
' 'Add field names
' For i = 0 To _col_cnt - 1
' Dim cell_val As String = reader.GetName(i)
' Dim cell_ref As String = i_get_XL_Col_Letter_From_Number(i + 1) + row_counter.ToString
' 'add column width to dictionary
' Dim col As New export_column With {.ord_pos = i, .col_width = i_get_cell_val_width(font, cell_val, buffer_for_auto_filter), .col_nm = cell_val}
' column_meta.Add(col)
' '_export_col_widths.Add(cell_val, i_get_cell_val_width(font, cell_val, buffer_for_auto_filter))
' ' _export_col_widths.Add(i.ToString, i_get_cell_val_width(font, cell_val, buffer_for_auto_filter))
' i_write_cell_value(writer, cell_val, cell_ref, "varchar")
' Next
' 'close header row
' writer.WriteEndElement()
' _row_index += 1
' log_edis_event("info", "Excel 07", "headers added")
' End If
' '--------------------------------------------------------------------------------------------------------------------------
' 'Add Data
' While reader.Read
' oxa = New List(Of DocumentFormat.OpenXml.OpenXmlAttribute)
' 'add row index : NOT required...leaving out for compression purposes
' 'oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("r", Nothing, counter.ToString))
' 'writer.WriteStartElement(New Row(), oxa)
' writer.WriteStartElement(New Row())
' 'add field values
' For i = 0 To reader.FieldCount - 1
' 'if we did not include headers, then add the first row to the export cols
' If Not _include_headers And _row_index = 1 Then
' Dim col As New export_column With {.ord_pos = i, .col_width = i_get_cell_val_width(font, reader(i).ToString, buffer_for_auto_filter), .col_nm = "COL_" + i.ToString}
' column_meta.Add(col)
' '_export_col_widths.Add(i.ToString, i_get_cell_val_width(font, reader(i).ToString, buffer_for_auto_filter))
' End If
' Dim cell_val As String = reader(i).ToString
' Dim cell_ref As String = i_get_XL_Col_Letter_From_Number(i + 1) + row_counter.ToString
' Dim data_type As String = reader.GetDataTypeName(i).ToString.ToLower
' 'evaluate the width
' If row_counter <= 100 Then
' 'Dim curr_catalog_row_width As Double = _export_col_widths.Item(reader.GetName(i))
' 'Dim curr_catalog_row_width As Double = _export_col_widths.Item(i.ToString)
' Dim curr_catalog_row_width As Double = column_meta.Item(i).col_width
' Dim this_row_width As Double = i_get_cell_val_width(font, cell_val, buffer_for_auto_filter)
' If this_row_width > curr_catalog_row_width Then
' column_meta.Item(i).col_width = this_row_width
' '_export_col_widths.Item(i.ToString) = this_row_width
' '_export_col_widths.Item(reader.GetName(i)) = this_row_width
' End If
' End If
' i_write_cell_value(writer, cell_val, cell_ref, data_type)
' Next
' 'close row
' writer.WriteEndElement()
' _row_index += 1
' End While
' 'back off counter 1 since we finished the looop
' _row_index -= 1
' log_edis_event("info", "Excel 07", "data loaded")
' 'check that we have not exceeded excels limit on rows
' If _row_index >= (_XL_sheet_row_max + 1) Then
' err_msg = "Excel Error: Data set exceeds maximum Excel row limit of [" + _XL_sheet_row_max + "]."
' Exit Sub
' End If
' 'close sheetdata
' writer.WriteEndElement()
' 'set the sheet range reference:
' sheet_range_referene = "A1:" + i_get_XL_Col_Letter_From_Number(_col_cnt) + _row_index.ToString
' If _use_auto_filter And _table_nm = "" Then
' writer.WriteElement(New AutoFilter() With {.Reference = sheet_range_referene})
' End If
' 'close worksheet
' writer.WriteEndElement()
' End Using
' End Using
' writer.Close()
' log_edis_event("info", "Excel 07", "writer closed")
' '-----------------------------------------------------------------------------------------------------
' 'Add Columns if Auto-fitting
' If _auto_fit_columns Then
' Dim cCnt As Integer = 1
' Dim cols As New Columns
' For Each col As export_column In column_meta
' Dim c As New Column() With {.BestFit = True, .CustomWidth = True, .Width = col.col_width.ToString, .Max = cCnt.ToString, .Min = cCnt.ToString}
' cols.Append(c)
' cCnt += 1
' Next
' Dim sheetData = wsPart.Worksheet.GetFirstChild(Of SheetData)
' 'Note: Columns must go before the sheet data, or excel cant read it
' wsPart.Worksheet.InsertBefore(cols, sheetData)
' log_edis_event("info", "Excel 07", "autofit cols applied")
' End If
' '---------------------------------------------------------------------------------------------------------------------------------------
' 'add table if specified
' If _table_nm <> "" Then
' ' Dim tbID As String = "rId" + Left(Guid.NewGuid().ToString, 8)
' 'Dim tbID As String = "rId" + _tables.Count.ToString
' Dim tblDefPart As TableDefinitionPart = wsPart.AddNewPart(Of TableDefinitionPart) '(tbID)
' Dim tbID As String = wsPart.GetIdOfPart(tblDefPart)
' Dim tb As New Table() With {.Id = _tables.Count.ToString + 1, .Name = _table_nm, .DisplayName = _table_nm, .Reference = sheet_range_referene, .TotalsRowShown = False}
' Dim af As New AutoFilter With {.Reference = sheet_range_referene}
' 'add tablecolumns
' Dim tCols As New TableColumns With {.Count = column_meta.Count}
' Dim tcolCnt As Integer = 1
' For Each col As export_column In column_meta
' Dim tc As New TableColumn() With {.Id = tcolCnt.ToString, .Name = col.col_nm.ToString}
' tCols.Append(tc)
' tcolCnt += 1
' Next
' 'add table style
' Dim tbStyleInfo As New TableStyleInfo() With {.Name = _table_style_nm, .ShowFirstColumn = False, .ShowRowStripes = True, .ShowColumnStripes = False}
' 'add style, autofilter, and columns to the table
' tb.Append(af)
' tb.Append(tCols)
' tb.Append(tbStyleInfo)
' 'relate to teh table def part
' tblDefPart.Table = tb
' 'append to the worksheet
' Dim tparts_cnt = wsPart.Worksheet.Elements(Of TableParts).Count
' If tparts_cnt = 0 Then
' tparts_cnt = 1
' End If
' Dim tableParts As New TableParts() With {.Count = tparts_cnt.ToString}
' Dim tblPart As New TablePart() With {.Id = tbID}
' tableParts.Append(tblPart)
' wsPart.Worksheet.Append(tableParts)
' log_edis_event("info", "Excel 07", "table added")
' End If
' '------------------------------------------------------------------------------------------------------
' 'Add Shared Strings Catalog
' 'need to update this to detect if an existing sharedstring part exists...and if so, pull in that catalog, drop existing sharestrings, and write new one
' If _sharedStrings.Count > 0 And _use_shared_strings Then
' 'drop/replace existing shared strings
' If Not _wbPart.GetPartsOfType(Of SharedStringTablePart) Is Nothing Then
' _wbPart.DeletePart(_wbPart.SharedStringTablePart)
' End If
' Dim sharedStrings = _wbPart.AddNewPart(Of SharedStringTablePart)
' Using ssWriter As DocumentFormat.OpenXml.OpenXmlWriter = DocumentFormat.OpenXml.OpenXmlWriter.Create(sharedStrings)
' ssWriter.WriteStartElement(New SharedStringTable)
' For Each itm In _sharedStrings
' ssWriter.WriteStartElement(New SharedStringItem())
' ssWriter.WriteElement(New Text(itm.Key))
' ssWriter.WriteEndElement()
' Next
' ssWriter.WriteEndElement()
' End Using
' End If
' 'Assign to the sheet
' 'Check if sheet exists
' If _worksheets.ContainsKey(_sheet_nm) Then
' 'get the existing sheet
' Dim tgt_sheet As Sheet = _wbPart.Workbook.Descendants(Of Sheet).Where(Function(s) s.Name.ToString.ToLower = _sheet_nm.ToLower).FirstOrDefault()
' 'grab the original ws part (aka xml file) because we are going to drop it
' Dim orig_ws_part As WorksheetPart = CType(_wbPart.GetPartById(tgt_sheet.Id), WorksheetPart)
' 'set the target sheet to the new wb part
' tgt_sheet.Id.Value = _wbPart.GetIdOfPart(wsPart)
' 'drop original
' _wbPart.DeletePart(orig_ws_part)
' Else
' 'add the sheet
' Dim sheets As Sheets = _wb.Elements(Of Sheets).FirstOrDefault
' Dim sh As Sheet = New Sheet() With {.Id = _wbPart.GetIdOfPart(wsPart), .SheetId = (_worksheets.Count + 1).ToString, .Name = _sheet_nm}
' sheets.Append(sh)
' End If
' log_edis_event("info", "Excel 07", "done")
' 'back off the row index 1 since we auto incriment after each row
' EDIS.log_rows_tsfr(_row_index - 1)
' End Using
' Catch ex As Exception
' err_msg = ex.Message.ToString()
' End Try
' End Sub
' Private Shared Sub u_get_sheet_list()
' Try
' log_edis_event("info", "Excel 07", "Sheet list task started")
' i_open_workbook()
' log_edis_event("info", "Excel 07", "workbook opened")
' Using cn As New SqlClient.SqlConnection("Server = " + _mssql_inst + "; Integrated Security = True")
' cn.Open()
' log_edis_event("info", "Excel 07", "connection to SQL Server [" + _mssql_inst + "] opened")
' For Each itm In _worksheets
' Dim sql As String = "INSERT [" + _output_tbl_nm + "] VALUES (@sheet_nm)"
' Using cmd As New SqlClient.SqlCommand(sql, cn)
' cmd.Parameters.AddWithValue("@sheet_nm", itm.Key.ToString)
' cmd.ExecuteNonQuery()
' log_edis_event("info", "Excel 07", "Worksheet [" + itm.Key.ToString + " loaded to table [" + _output_tbl_nm + "]")
' End Using
' Next
' End Using
' log_edis_event("info", "Excel 07", "Sheet List Task ended...no errors")
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' log_edis_event("error", "Excel 07", "Sheet List Task Error: " + _xl_err_msg)
' End Try
' End Sub
' Private Shared Sub u_rename_worksheet()
' Try
' i_open_workbook()
' If Not _worksheets.ContainsKey(_sheet_nm) Then
' _xl_err_msg = "Worksheet rename failure: Worksheet [" + _sheet_nm + "] does not exist."
' Exit Sub
' End If
' 'does the new sheet already exist?
' If _worksheets.ContainsKey(_new_sheet_nm) Then
' _xl_err_msg = "Worksheet rename failure: Worksheet [" + _new_sheet_nm + "] already exists. You cannot have 2 worksheets with the same name"
' Exit Sub
' End If
' Dim ws As Sheet = _wbPart.Workbook.Descendants(Of Sheet).Where(Function(s) s.Name.ToString.ToLower = _sheet_nm.ToLower).FirstOrDefault()
' ws.Name = _new_sheet_nm
' i_save_and_close_workbook()
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Sub u_clear_worksheet()
' Try
' i_open_workbook()
' If Not _worksheets.ContainsKey(_sheet_nm) Then
' _xl_err_msg = "Sheet [" + _sheet_nm + "] does Not exist"
' Exit Sub
' End If
' Dim ws As Sheet = _XLPackage.WorkbookPart.Workbook.Descendants(Of Sheet).Where(Function(s) s.Name.ToString.ToLower = _sheet_nm.ToLower).FirstOrDefault()
' Dim wsPart As WorksheetPart = CType(_wbPart.GetPartById(ws.Id), WorksheetPart)
' Dim sheetData As SheetData = wsPart.Worksheet.Elements(Of SheetData)().First()
' sheetData.RemoveAllChildren()
' log_edis_event("info", "clear worksheet", "data clear")
' 'if a table exists, remove as well
' 'doesnt work
' For Each tblDef As TableDefinitionPart In wsPart.TableDefinitionParts
' wsPart.DeletePart(tblDef)
' log_edis_event("info", "clear worksheet", "table [" + tblDef.Table.Name.ToString + "] removed")
' Next
' 'log_edis_event("info", "clear worksheet", "tables removed")
' 'wsPart.Worksheet.Save()
' i_save_and_close_workbook()
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Sub u_add_worksheet()
' Try
' i_open_workbook()
' If _worksheets.ContainsKey(_sheet_nm) Then
' _xl_err_msg = "Add Worksheet failure: Worksheet [" + _sheet_nm + "] already exists"
' Exit Sub
' End If
' Dim wspart As WorksheetPart = _wbPart.AddNewPart(Of WorksheetPart)
' wspart.Worksheet = New Worksheet(New SheetData())
' Dim sheets As Sheets = _wbPart.Workbook.GetFirstChild(Of Sheets)
' Dim relId As String = _wbPart.GetIdOfPart(wspart)
' Dim sheet_id As UInteger = 1
' If sheets.Elements(Of Sheet).Count > 0 Then
' sheet_id = sheets.Elements(Of Sheet).Select(Function(s) s.SheetId.Value).Max + 1
' End If
' Dim Sheet As New Sheet
' With Sheet
' .Id = relId
' .SheetId = sheet_id
' .Name = _sheet_nm
' End With
' sheets.Append(Sheet)
' i_save_and_close_workbook()
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' '=========================================================================================================================================
' '=========================================================================================================================================
' '=========================================================================================================================================
' '=========================================================================================================================================
' 'Internal Functions
' Private Shared Sub i_save_and_close_workbook()
' Try
' _wb.Save()
' _XLPackage.Close()
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Function i_open_workbook() As SpreadsheetDocument
' Try
' 'testing
' 'file_path = "C:\temp\Book1.xlsx"
' _XLPackage = SpreadsheetDocument.Open(_file_path, True)
' _wbPart = _XLPackage.WorkbookPart
' _wb = _wbPart.Workbook
' '---------------------------------------------------------------------------------------------------
' 'get inventory
' 'worksheets
' i_get_worksheets()
' 'tables
' i_get_tables()
' 'shared strings
' Dim stringTable = _XLPackage.WorkbookPart.GetPartsOfType(Of SharedStringTablePart).FirstOrDefault()
' If Not stringTable Is Nothing Then
' Dim ssArray = stringTable.SharedStringTable.Elements(Of SharedStringItem)().ToArray()
' For Each item In ssArray
' _sharedStrings.Add(item.InnerText.ToString, _sharedStrings.Count)
' Next
' End If
' Return _XLPackage
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' Return Nothing
' End Try
' End Function
' Private Shared Sub i_get_worksheets()
' Try
' For Each sh As Sheet In _XLPackage.WorkbookPart.Workbook.Sheets
' _worksheets.Add(sh.Name, sh.SheetId)
' If CInt(sh.SheetId.ToString) > _worksheet_max_id Then _worksheet_max_id = CInt(sh.SheetId.ToString)
' Next
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Function get_sheet_nm_from_wspart(wspart As WorksheetPart) As String
' Dim relId As String = _XLPackage.WorkbookPart.GetIdOfPart(wspart)
' For Each sh As Sheet In _XLPackage.WorkbookPart.Workbook.Sheets
' If sh.Id.Value = relId Then
' Return sh.Name
' End If
' Next
' End Function
' Private Shared Sub i_get_tables()
' Try
' For Each ws As WorksheetPart In _XLPackage.WorkbookPart.WorksheetParts
' For Each tblDef As TableDefinitionPart In ws.TableDefinitionParts
' _tables.Add(tblDef.Table.Name, tblDef.Table.Id)
' If CInt(tblDef.Table.Id.ToString) > _table_max_id Then _table_max_id = CInt(tblDef.Table.Id.ToString)
' Next
' Next
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Sub i_create_workbook()
' Try
' If IO.File.Exists(_file_path) Then
' Throw New Exception("File [" + _file_path + "] already exists")
' End If
' Dim wb_type As DocumentFormat.OpenXml.SpreadsheetDocumentType
' Select Case Right(_file_path, 4).ToLower
' Case "xlsx"
' wb_type = DocumentFormat.OpenXml.SpreadsheetDocumentType.Workbook
' Case "xlsm"
' wb_type = DocumentFormat.OpenXml.SpreadsheetDocumentType.MacroEnabledWorkbook
' End Select
' _XLPackage = SpreadsheetDocument.Create(_file_path, wb_type)
' 'add WB xml file
' Dim wbPart As WorkbookPart = _XLPackage.AddWorkbookPart
' 'append workbook node to workbookpart xml file
' wbPart.Workbook = New Workbook
' 'add worksheet xml file
' Dim wsPart As WorksheetPart = wbPart.AddNewPart(Of WorksheetPart)()
' 'append worksheet/sheetdata nodes to worksheetpart xml file
' wsPart.Worksheet = New Worksheet(New SheetData())
' 'add sheets collection
' Dim sheets As Sheets = _XLPackage.WorkbookPart.Workbook.AppendChild(Of Sheets)(New Sheets())
' 'add the sheet
' Dim ws As Sheet = New Sheet
' 'relate it to the worksheetpart
' ws.Id = _XLPackage.WorkbookPart.GetIdOfPart(wsPart)
' 'assign the id and name
' ws.SheetId = 1
' ws.Name = _sheet_nm
' 'append the single sheet to the sheets collection
' sheets.Append(ws)
' 'save and close
' wbPart.Workbook.Save()
' _XLPackage.Close()
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' End Try
' End Sub
' Private Shared Function i_get_cell_val_width(font_nm As System.Drawing.Font, cell_val As String, using_auto_filter As String) As Double
' Try
' Dim autoFilter_icon_buffer
' If using_auto_filter Then
' autoFilter_icon_buffer = 2.5D
' Else
' autoFilter_icon_buffer = 0D
' End If
' Dim text_size As Size = TextRenderer.MeasureText(cell_val, font_nm)
' Dim width As Double = CDbl(((text_size.Width / CDbl(7)) * 256) - (128 / 7)) / 256
' width = CDbl(Decimal.Round(CDec(width) + 0.2D + autoFilter_icon_buffer, 2))
' 'cannot exceed 255...checking at 254 for rounding
' If width > 254 Then
' width = 255
' End If
' Return width
' Catch ex As Exception
' _xl_err_msg = ex.Message.ToString
' Return Nothing
' End Try
' End Function
' Private Shared Sub i_write_cell_value(writer As DocumentFormat.OpenXml.OpenXmlWriter, cell_val As String, cellRef As String, data_type As String)
' Dim oxa = New List(Of DocumentFormat.OpenXml.OpenXmlAttribute)
' 'set the reference attribute for the cell : Not required...we are leaving out for compression purposes
' 'oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("r", Nothing, cellRef))
' If _bold_headers And _row_index = 1 Then
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("s", Nothing, _bold_font_style_index.ToString))
' End If
' Select Case data_type
' Case "int", "float", "smallint", "date", "tinyint", "bigint", "money", "numeric", "decimal"
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("t", Nothing, "n"))
' If data_type = "date" And Trim(cell_val) <> "" Then
' 'style for short date
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("s", Nothing, _date_style_index.ToString))
' 'convert the date to excel number
' Dim dt As Date = CDate(cell_val)
' Dim dtInt = CInt((dt.[Date] - New DateTime(1900, 1, 1)).TotalDays) + 2
' cell_val = dtInt.ToString
' End If
' 'write the cell
' writer.WriteStartElement(New Cell(), oxa)
' writer.WriteElement(New CellValue(cell_val))
' writer.WriteEndElement()
' Case "boolean"
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("t", Nothing, "b"))
' 'write the cell
' writer.WriteStartElement(New Cell(), oxa)
' If cell_val.ToLower = "true" Then
' cell_val = "1"
' Else
' cell_val = "0"
' End If
' writer.WriteElement(New CellValue(cell_val))
' writer.WriteEndElement()
' Case Else
' 'incase we want to flip it off
' If _use_shared_strings Then
' 'shared string
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("t", Nothing, "s"))
' 'add to shared string array if not exists
' If Not _sharedStrings.ContainsKey(cell_val) Then
' _sharedStrings.Add(cell_val, _sharedStrings.Count)
' End If
' writer.WriteStartElement(New Cell(), oxa)
' writer.WriteElement(New CellValue(_sharedStrings(cell_val).ToString()))
' writer.WriteEndElement()
' Else
' 'shared string
' oxa.Add(New DocumentFormat.OpenXml.OpenXmlAttribute("t", Nothing, "str"))
' writer.WriteStartElement(New Cell(), oxa)
' writer.WriteElement(New CellValue(cell_val))
' writer.WriteEndElement()
' End If
' End Select
' End Sub
' Private Shared Function i_get_XL_Col_Letter_From_Number(colIndex As Integer) As String
' Dim div As Integer = colIndex
' Dim colLetter As String = String.Empty
' Dim modnum As Integer = 0
' While div > 0
' modnum = (div - 1) Mod 26
' colLetter = Chr(65 + modnum) & colLetter
' div = CInt((div - modnum) \ 26)
' End While
' Return colLetter
' End Function
' Private Shared Sub i_create_Style_Sheet()
' Dim did_style_sheet_exist As Boolean
' Dim stylePart = _wbPart.WorkbookStylesPart
' If stylePart Is Nothing Then
' did_style_sheet_exist = False
' stylePart = _wbPart.AddNewPart(Of WorkbookStylesPart)()
' Else
' did_style_sheet_exist = True
' End If
' 'if the style sheet already exists, we just need to add a new font with bold
' If did_style_sheet_exist Then
' Dim sSheet = stylePart.Stylesheet
' 'Get the default font (style 0)
' Dim f = sSheet.Fonts.FirstOrDefault
' 'does the default go
' 'get the properties
' Dim fSize As String = f.Descendants(Of FontSize).FirstOrDefault.Val
' Dim color_theme As String = f.Descendants(Of DocumentFormat.OpenXml.Spreadsheet.Color).FirstOrDefault.Theme
' Dim color_rgb As String = f.Descendants(Of DocumentFormat.OpenXml.Spreadsheet.Color).FirstOrDefault.Rgb
' Dim fName As String = f.Descendants(Of FontName).FirstOrDefault.Val
' 'append the new font with a bold
' Dim fnew As New DocumentFormat.OpenXml.Spreadsheet.Font( 'Our bold headers ix 1
' New Bold(),
' New FontSize() With {.Val = fSize},
' New DocumentFormat.OpenXml.Spreadsheet.Color() With {.Theme = color_theme, .Rgb = color_rgb},
' New FontName() With {.Val = fName}
' )
' sSheet.Fonts.Append(fnew)
' 'New Color() With {.Rgb = New DocumentFormat.OpenXml.HexBinaryValue() With {.Value = "00000"}},
' _bold_font_style_index = (sSheet.Fonts.Elements(Of DocumentFormat.OpenXml.Spreadsheet.Font).Distinct.Count - 1).ToString
' Dim cF As New CellFormat() With {.FontId = _bold_font_style_index, .FillId = 0, .BorderId = 0, .ApplyFont = True}
' sSheet.CellFormats.Append(cF)
' '------------------------------------------------------------------------------------------------------------------------
' 'append a datestyle format as well
' Dim cfDate As New CellFormat() With {.FontId = 0, .FillId = 0, .BorderId = 0, .NumberFormatId = 14, .ApplyNumberFormat = True}
' sSheet.CellFormats.Append(cfDate)
' _date_style_index = (sSheet.CellFormats.Elements(Of CellFormat).Distinct.Count - 1).ToString
' Else
' _bold_font_style_index = 1
' _date_style_index = 2
' stylePart.Stylesheet = New Stylesheet(
' New Fonts(
' New DocumentFormat.OpenXml.Spreadsheet.Font( 'default
' New FontSize() With {.Val = 11},
' New DocumentFormat.OpenXml.Spreadsheet.Color() With {.Rgb = New DocumentFormat.OpenXml.HexBinaryValue() With {.Value = "00000"}},
' New FontName() With {.Val = "Calibri"}
' ),
' New DocumentFormat.OpenXml.Spreadsheet.Font( 'Our bold headers ix 1
' New Bold(),
' New FontSize() With {.Val = 11},
' New DocumentFormat.OpenXml.Spreadsheet.Color() With {.Rgb = New DocumentFormat.OpenXml.HexBinaryValue() With {.Value = "00000"}},
' New FontName() With {.Val = "Calibri"}
' )
' ),
' New Fills(
' New Fill(New PatternFill() With {.PatternType = PatternValues.None}) 'default
' ),
' New Borders(
' New Border( 'default
' New LeftBorder(),
' New RightBorder(),
' New TopBorder(),
' New BottomBorder(),
' New DiagonalBorder()
' )
' ),
' New CellFormats(
' New CellFormat() With {.FontId = 0, .FillId = 0, .BorderId = 0}, ' (index 0: default)
' New CellFormat() With {.FontId = _bold_font_style_index, .FillId = 0, .BorderId = 0, .ApplyFont = True}, 'bold (index 1)
' New CellFormat() With {.FontId = 0, .FillId = 0, .BorderId = 0, .NumberFormatId = 14, .ApplyNumberFormat = True} 'Shortdate (index 2) 'for short dates in MM/dd/yyyy (numberFormatID 14 is shortdate)
' )
' )
' End If
' End Sub
'End Class
|
Imports System.Configuration
Imports System.Data.SqlClient
Imports LibraryManagementDTO
Imports Utility
Public Class TinhHinhMuonSachDAL
Private connectionString As String
Public Sub New()
' Read ConnectionString value from App.config file
connectionString = ConfigurationManager.AppSettings("ConnectionString")
End Sub
Public Sub New(ConnectionString As String)
Me.connectionString = ConnectionString
End Sub
Public Function SelectAll(iThang As Integer, iNam As Integer) As List(Of TinhHinhMuonSachDTO)
Dim theLoaiDAL = New TheLoaiDAL()
Dim listTheLoai = New List(Of TheLoaiDTO)
Dim listTinhHinh = New List(Of TinhHinhMuonSachDTO)
theLoaiDAL.SelectALL(listTheLoai)
Dim tongSoLanMuon As Integer = 0
For Each theLoai In listTheLoai
tongSoLanMuon += theLoaiDAL.DemSoLanMuon(theLoai.MaTheLoai, iThang, iNam)
Next
For Each theLoai In listTheLoai
Dim soLanMuon As Integer = theLoaiDAL.DemSoLanMuon(theLoai.MaTheLoai, iThang, iNam)
Dim tiLe As Integer = If(tongSoLanMuon < 1, 0, (soLanMuon * 100) / tongSoLanMuon)
listTinhHinh.Add(New TinhHinhMuonSachDTO(theLoai.TenTheLoai, soLanMuon, tiLe))
Next
Return listTinhHinh
End Function
End Class
|
Imports AMC.DNN.Modules.CertRecert.Business.BaseControl
Imports AMC.DNN.Modules.CertRecert.Business.EnumItems
Imports AMC.DNN.Modules.CertRecert.Controls.Certifications
Imports AMC.DNN.Modules.CertRecert.Business.Entities
Imports AMC.DNN.Modules.CertRecert.Business.Controller
Imports AMC.DNN.Modules.CertRecert.Business.Helpers
Imports TIMSS.API.Core.Validation
Imports System.Linq
Imports AMC.DNN.Modules.CertRecert.Data.Enums
Imports AMC.DNN.Modules.CertRecert.Business.BusinessValidation
Imports TIMSS.API.Core
Namespace Controls.Common
Public Class Summary
Inherits SectionBaseUserControl
#Region "public Member"
Public totalCEMin As Decimal = 0
Public Property ParentSaveButtonClick() As Action(Of Object, EventArgs)
Public Property ParentSaveButton As Button
#End Region
#Region "Event Handlers"
''' <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 EventArgs) Handles Me.Load
Try
If CheckConflictValidation(RuleID, ConflictMessage) = True AndAlso Not String.IsNullOrEmpty(ConflictMessage) Then
Dim issuesCollection As New IssuesCollection
issuesCollection.Add(New CESummaryIssue(New BusinessObject(), ConflictMessage))
hdIsIncomplete.Value = CommonConstants.TAB_INCOMPLETED
Else
If RuleID = ValidationRuleId.RECERT_SUMMARY_COMMON_CALCULATOR.ToString() Then '' load summary form for ABNN
BindingDataToList(TotalCEOneForm)
BuildOptionTitle()
ElseIf RuleID = ValidationRuleId.RECERT_SUMMARY_ARN.ToString() Then '' load summary form for ARN
BindingDataToList_ARN(TotalPointARN)
BuildTitleTotalCEPoint_ARN()
End If
End If
Catch ex As Exception
ProcessModuleLoadException(Me, ex)
End Try
End Sub
Private Sub PreRenderPages(ByVal sender As Object, ByVal e As EventArgs) Handles Me.PreRender
If ParentSaveButtonClick IsNot Nothing Then
ParentSaveButtonClick.Invoke(ParentSaveButton, e)
End If
End Sub
#End Region
#Region "ABNN validation"
Public Overrides Sub ValidateFormFillCompleted()
End Sub
Private Sub BindingDataToList(ByRef totalCE As Decimal)
Dim objectItem As SummaryObject
Dim objectList As List(Of SummaryObject) = New List(Of SummaryObject)
Dim arrProgramTypeEnum As New ArrayList
For Each programtype As String In [Enum].GetNames(GetType(ActivityProgramType))
If Not String.IsNullOrEmpty(programtype) Then
arrProgramTypeEnum.Add(programtype)
End If
Next
Dim arr As List(Of SectionInfo) = If(CurrentFormInfo IsNot Nothing AndAlso CurrentFormInfo.Sections IsNot Nothing, CurrentFormInfo.Sections, New List(Of SectionInfo)())
For Each sectionInfo As SectionInfo In arr
If CheckExistItem(sectionInfo.SectionProgramType, arrProgramTypeEnum) Then '' only list programType in Enum
If sectionInfo.IsEnabled = True AndAlso Not String.IsNullOrEmpty(sectionInfo.SectionProgramType) Then ''Tab must be Enable
objectItem = New SummaryObject()
objectItem.CECategoryName = GetCategoryByNameByProgramTypeCode(sectionInfo.SectionProgramType)
If objectItem.CECategoryName <> String.Empty Then '' have form must list out
''set form name
If sectionInfo.SectionProgramType = ActivityProgramType.EDUCATION.ToString() Then
objectItem.CECategoryName = String.Format("{0} {1}", objectItem.CECategoryName, GetContinuingEducationTitle())
End If
'' set CEpoint
Dim totalCEString = GetCookie(sectionInfo.SectionProgramType + MasterCustomerId)
totalCE += Decimal.Parse(totalCEString)
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(totalCEString)
objectList.Add(objectItem)
End If
End If
End If
Next
objectList.Sort(Function(x, y) String.Compare(x.CECategoryName, y.CECategoryName))
Me.rptSummary.DataSource = objectList
Me.rptSummary.DataBind()
lblTotalCE.Text = CommonHelper.ChopUnusedDecimal(totalCE.ToString())
End Sub
Private Function GetCategoryByNameByProgramTypeCode(ByVal programTypeCode As String) As String
Dim typeName As String = String.Empty
Dim arr As List(Of SectionInfo) = If(CurrentFormInfo IsNot Nothing AndAlso CurrentFormInfo.Sections IsNot Nothing, CurrentFormInfo.Sections, New List(Of SectionInfo)())
For Each sectionInfo As SectionInfo In arr
If sectionInfo.IsEnabled = True Then
If sectionInfo.SectionProgramType = programTypeCode Then
typeName = sectionInfo.SectionValue
Exit For
End If
End If
Next
Return typeName
End Function
Private Function CheckExistItem(ByVal item As String, ByVal arrItem As ArrayList) As Boolean
For i As Integer = 0 To arrItem.Count - 1
If arrItem.Item(i).ToString() = item Then
Return True
End If
Next
Return False
End Function
Public Function GetFieldInfoTemp(ByVal fieldId As String,
ByVal sectionInfo As SectionInfo) As Business.Entities.FieldInfo
If sectionInfo IsNot Nothing And sectionInfo.Fields IsNot Nothing Then
For Each fieldInfo As Business.Entities.FieldInfo In From fieldInfo1 In sectionInfo.Fields Where fieldInfo1.FieldId = fieldId
Return fieldInfo
Next
End If
Return New Business.Entities.FieldInfo()
End Function
Public Overrides Function Save() As IIssuesCollection
Dim issuesCollection As New IssuesCollection
Dim errorMessages = String.Empty
If CheckConflictValidation(RuleID, ConflictMessage) = True AndAlso Not String.IsNullOrEmpty(ConflictMessage) Then
issuesCollection.Add(New CESummaryIssue(New BusinessObject(), ConflictMessage))
hdIsIncomplete.Value = CommonConstants.TAB_INCOMPLETED
End If
If RuleID = ValidationRuleId.RECERT_SUMMARY_COMMON_CALCULATOR.ToString() Then '' load summary form for ABNN
If Not CheckBusinessValidation(TotalCEOneForm, errorMessages) Then
issuesCollection.Add(New CESummaryIssue(New BusinessObject(), String.Format("{0}, you have {1}", errorMessages, lblTotalCE.Text)))
hdIsIncomplete.Value = CommonConstants.TAB_INCOMPLETED
Else
hdIsIncomplete.Value = CommonConstants.TAB_COMPLETED
End If
ElseIf RuleID = ValidationRuleId.RECERT_SUMMARY_ARN.ToString() Then '' load summary form for ARN
If Not CheckBusinessValidation_ARN(TotalPointARN, errorMessages) Then
issuesCollection.Add(New CESummaryIssue(New BusinessObject(), errorMessages))
hdIsIncomplete.Value = CommonConstants.TAB_INCOMPLETED
Else
hdIsIncomplete.Value = CommonConstants.TAB_COMPLETED
End If
End If
Return issuesCollection
End Function
Private Function CheckBusinessValidation(ByVal totalCE As Decimal, ByRef errorMessages As String) As Boolean
Dim checkValidation = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_SUMMARY_COMMON_CALCULATOR.ToString(),
Server.MapPath(ParentModulePath))
If checkValidation = False Then '' not require validation
Return True
End If
Dim totalCEMin As Decimal = 0
Dim totalCEMax As Decimal = 0
ProgramType = ActivityProgramType.SUMMARY.ToString()
Dim programTypeSetting = ModuleConfigurationHelper.Instance.GetProgramTypeSetting(ProgramType, Server.MapPath(ParentModulePath))
If programTypeSetting IsNot Nothing Then
Dim currentRecertOption = GetCurrentReCertOption()
If currentRecertOption IsNot Nothing Then
If currentRecertOption.QuestionCode = Enums.QuestionCode.RECERT_OPTION_2.ToString() Then
totalCEMin = Decimal.Parse(programTypeSetting.MinCEOpt2.ToString())
totalCEMax = Decimal.Parse(programTypeSetting.MaxCEOpt2.ToString())
errorMessages = DotNetNuke.Services.Localization.Localization.GetString("ErrorMessagesSummaryOption2.Text", Me.LocalResourceFile)
errorMessages = String.Format(errorMessages, totalCEMin, totalCEMax)
ElseIf currentRecertOption.QuestionCode = Enums.QuestionCode.RECERT_OPTION_3.ToString() Then
totalCEMin = Decimal.Parse(programTypeSetting.MinCEOpt3.ToString())
totalCEMax = Decimal.Parse(programTypeSetting.MaxCEOpt3.ToString())
errorMessages = DotNetNuke.Services.Localization.Localization.GetString("ErrorMessagesSummaryOption3.Text", Me.LocalResourceFile)
errorMessages = String.Format(errorMessages, totalCEMin, totalCEMax)
End If
If totalCE < totalCEMin OrElse totalCE > totalCEMax Then
Return False
End If
End If
End If
Return True
End Function
Private Sub BuildOptionTitle()
Dim errorMessages As String = String.Empty
CheckBusinessValidation(0, errorMessages)
lblOptionTitle.Text = errorMessages
End Sub
Private Function GetContinuingEducationTitle() As String
Dim message = String.Empty
Dim totalCEMinOption2 As Decimal = 0
Dim totalCEMinOption3 As Decimal = 0
ProgramType = ActivityProgramType.CONTEDUCATION.ToString()
Dim programTypeSetting = ModuleConfigurationHelper.Instance.GetProgramTypeSetting(ProgramType, Server.MapPath(ParentModulePath))
If programTypeSetting IsNot Nothing Then
Dim currentRecertOption = GetCurrentReCertOption()
If currentRecertOption IsNot Nothing Then
If currentRecertOption.QuestionCode = Enums.QuestionCode.RECERT_OPTION_2.ToString() Then
totalCEMinOption2 = Decimal.Parse(programTypeSetting.MinCEOpt2.ToString())
message = DotNetNuke.Services.Localization.Localization.GetString("ContinuingEducationSummaryTitle.Text", Me.LocalResourceFile)
message = String.Format(message, totalCEMinOption2, "2")
ElseIf currentRecertOption.QuestionCode = Enums.QuestionCode.RECERT_OPTION_3.ToString() Then
totalCEMinOption3 = Decimal.Parse(programTypeSetting.MinCEOpt3.ToString())
message = DotNetNuke.Services.Localization.Localization.GetString("ContinuingEducationSummaryTitle.Text", Me.LocalResourceFile)
message = String.Format(message, totalCEMinOption3, "3")
End If
End If
End If
Return message
End Function
#End Region
#Region "ARN_Validation"
Private Sub BindingDataToList_ARN(ByRef TotalPoint As Decimal)
TotalPoint = 0
Dim objectList As List(Of SummaryObject) = New List(Of SummaryObject)
Dim arrProgramTypeEnum As New ArrayList
For Each programtype As String In [Enum].GetNames(GetType(ActivityProgramType))
If Not String.IsNullOrEmpty(programtype) Then
arrProgramTypeEnum.Add(programtype)
End If
Next
Dim arr As List(Of SectionInfo) = If(CurrentFormInfo IsNot Nothing AndAlso CurrentFormInfo.Sections IsNot Nothing, CurrentFormInfo.Sections, New List(Of SectionInfo)())
Dim cePointofForm As Decimal = 0
Dim arrCommunityService As ArrayList = New ArrayList()
For Each sectionInfo As SectionInfo In arr
If CheckExistItem(sectionInfo.SectionProgramType, arrProgramTypeEnum) Then '' only list programType in Enum
If sectionInfo.IsEnabled = True AndAlso Not String.IsNullOrEmpty(sectionInfo.SectionProgramType) Then ''Tab must be Enable
Select Case sectionInfo.SectionProgramType
Case ActivityProgramType.EDUCATION.ToString()
If CreateSummaryObject_ContinuingEducation(sectionInfo.SectionProgramType, 3, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObject_ContinuingEducation(sectionInfo.SectionProgramType, 3, cePointofForm))
TotalPoint += cePointofForm
End If
Exit Select
Case ActivityProgramType.TEACHINGPRESN.ToString()
If CreateSummaryObject_TeachingPresentation(sectionInfo.SectionProgramType, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObject_TeachingPresentation(sectionInfo.SectionProgramType, cePointofForm))
TotalPoint += cePointofForm
End If
Exit Select
Case ActivityProgramType.CONTEDUCATION.ToString()
If CreateSummaryObject_EducationCourse(sectionInfo.SectionProgramType, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObject_EducationCourse(sectionInfo.SectionProgramType, cePointofForm))
TotalPoint += cePointofForm
End If
Exit Select
Case ActivityProgramType.PUBLICATION.ToString()
If CreateSummaryObject_Publication(sectionInfo.SectionProgramType, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObject_Publication(sectionInfo.SectionProgramType, cePointofForm))
TotalPoint += cePointofForm
End If
Exit Select
Case ActivityProgramType.COMMSERVR.ToString()
arrCommunityService.Add(sectionInfo.SectionProgramType)
Exit Select
Case ActivityProgramType.COMMSERVVL.ToString()
arrCommunityService.Add(sectionInfo.SectionProgramType)
Exit Select
Case ActivityProgramType.COMMSERVVS.ToString()
arrCommunityService.Add(sectionInfo.SectionProgramType)
Exit Select
Case ActivityProgramType.COMMSERVPRES.ToString()
arrCommunityService.Add(sectionInfo.SectionProgramType)
Exit Select
Case ActivityProgramType.COMMSERVPUB.ToString()
arrCommunityService.Add(sectionInfo.SectionProgramType)
Exit Select
Case Else
If CreateSummaryObjectItem(sectionInfo.SectionProgramType, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObjectItem(sectionInfo.SectionProgramType, cePointofForm))
TotalPoint += cePointofForm
End If
Exit Select
End Select
End If
End If
Next
'' create communityService ( sum 5 forms)
If arrCommunityService IsNot Nothing Then
If arrCommunityService.Count > 0 Then
If CreateSummaryObject_CommunityService(arrCommunityService, cePointofForm) IsNot Nothing Then
objectList.Add(CreateSummaryObject_CommunityService(arrCommunityService, cePointofForm))
TotalPoint += cePointofForm
SetCookie("TotalCEpointCummunityService", cePointofForm.ToString()) '' set data to be check validation
End If
End If
End If
objectList.Sort(Function(x, y) String.Compare(x.CECategoryName, y.CECategoryName))
Me.rptSummary.DataSource = objectList
Me.rptSummary.DataBind()
lblTotalCE.Text = CommonHelper.ChopUnusedDecimal(TotalPoint.ToString())
End Sub
Private Function CreateSummaryObjectItem(ByVal programType As String, ByRef cePointofForm As Decimal) As SummaryObject
Dim objectItem As SummaryObject = New SummaryObject()
cePointofForm = 0
objectItem.CECategoryName = GetCategoryByNameByProgramTypeCode(programType)
If objectItem.CECategoryName <> String.Empty Then '' have form must list out
'' set CEpoint
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(GetCookie(programType + MasterCustomerId))
If CommonHelper.CheckIsNumber(objectItem.TotalCEString) Then
cePointofForm = Decimal.Parse(objectItem.TotalCEString)
End If
End If
Return objectItem
End Function
Private Function CreateSummaryObject_ContinuingEducation(ByVal programType As String, ByVal columIndex As Integer,
ByRef cePointofForm As Decimal) As SummaryObject
Dim maxCEPoint As Decimal = 0
cePointofForm = 0
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxCEPoint = If(otherModuleSettings.ARNMaxSummaryPointOfContinuingEducation.HasValue, otherModuleSettings.ARNMaxSummaryPointOfContinuingEducation.Value, 0)
End If
cePointofForm = Decimal.Parse(GetCookie(programType + MasterCustomerId))
Dim validationContinuingEducationARN = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_CON_EDU_ARN.ToString(),
Server.MapPath(ParentModulePath))
If validationContinuingEducationARN AndAlso cePointofForm > maxCEPoint Then
cePointofForm = maxCEPoint
End If
Dim objectItem As SummaryObject = New SummaryObject()
Dim formName = GetCategoryByNameByProgramTypeCode(programType)
If formName <> String.Empty Then '' have form must list out
If columIndex = 3 Then '' total CE points
objectItem.CECategoryName = String.Format("{0} - {1}", formName, DotNetNuke.Services.Localization.Localization.GetString(
"SummaryContinuingEducationCol3.Text", Me.LocalResourceFile))
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(cePointofForm.ToString())
End If
End If
Return objectItem
End Function
Private Function CreateSummaryObject_TeachingPresentation(ByVal programType As String, ByRef cePointofForm As Decimal) As SummaryObject
Dim objectItem As SummaryObject = New SummaryObject()
cePointofForm = 0
Dim formName = GetCategoryByNameByProgramTypeCode(programType)
If formName <> String.Empty Then '' have form must list out
objectItem.CECategoryName = formName
Dim validationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_TEACH_PRESENTATION_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_TEACH_PRESENTATION_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim currentPoint As Decimal = 0
Dim maxCEHours As Decimal = 0
currentPoint = Decimal.Parse(GetCookie(programType + MasterCustomerId))
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxCEHours = If(otherModuleSettings.PresentationTotalHours.HasValue, otherModuleSettings.PresentationTotalHours.Value, 0)
End If
If (validationARN_Equal OrElse validationARN_Greater) AndAlso currentPoint > maxCEHours Then
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(maxCEHours.ToString())
Else
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(currentPoint.ToString())
End If
If CommonHelper.CheckIsNumber(objectItem.TotalCEString) Then
cePointofForm = Decimal.Parse(objectItem.TotalCEString)
End If
End If
Return objectItem
End Function
Private Function CreateSummaryObject_EducationCourse(ByVal programType As String, ByRef cePointofForm As Decimal) As SummaryObject
Dim objectItem As SummaryObject = New SummaryObject()
cePointofForm = 0
Dim formName = GetCategoryByNameByProgramTypeCode(programType)
If formName <> String.Empty Then '' have form must list out
objectItem.CECategoryName = formName
Dim validationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_EDU_COURSE_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_EDU_COURSE_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim currentPoint As Decimal = 0
Dim maxCEHours As Decimal = 0
currentPoint = Decimal.Parse(GetCookie(programType + MasterCustomerId))
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxCEHours = If(otherModuleSettings.EducationCourseTotalHours.HasValue, otherModuleSettings.EducationCourseTotalHours.Value, 0)
End If
If (validationARN_Equal OrElse validationARN_Greater) AndAlso currentPoint > maxCEHours Then
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(maxCEHours.ToString())
Else
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(currentPoint.ToString())
End If
If CommonHelper.CheckIsNumber(objectItem.TotalCEString) Then
cePointofForm = Decimal.Parse(objectItem.TotalCEString)
End If
End If
Return objectItem
End Function
Private Function CreateSummaryObject_Publication(ByVal programType As String, ByRef cePointofForm As Decimal) As SummaryObject
Dim objectItem As SummaryObject = New SummaryObject()
cePointofForm = 0
Dim formName = GetCategoryByNameByProgramTypeCode(programType)
If formName <> String.Empty Then '' have form must list out
objectItem.CECategoryName = formName
Dim validationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_PUBLICATION_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_PUBLICATION_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim currentPoint As Decimal = 0
Dim maxCEHours As Decimal = 0
currentPoint = Decimal.Parse(GetCookie(programType + MasterCustomerId))
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxCEHours = If(otherModuleSettings.PublicationTotalHours.HasValue, otherModuleSettings.PublicationTotalHours.Value, 0)
End If
If (validationARN_Equal OrElse validationARN_Greater) AndAlso currentPoint > maxCEHours Then
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(maxCEHours.ToString())
Else
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(currentPoint.ToString())
End If
If CommonHelper.CheckIsNumber(objectItem.TotalCEString) Then
cePointofForm = Decimal.Parse(objectItem.TotalCEString)
End If
End If
Return objectItem
End Function
Private Function SumCommunityService(ByVal arrProgramType As ArrayList) As Decimal
Dim CEPoint As Decimal = 0
For i As Integer = 0 To arrProgramType.Count - 1
CEPoint += Decimal.Parse(GetCookie(arrProgramType(i).ToString() + MasterCustomerId))
Next
Return CEPoint
End Function
Private Function CreateSummaryObject_CommunityService(ByVal arrProgramType As ArrayList, ByRef cePointofForm As Decimal) As SummaryObject
Dim objectItem As SummaryObject = New SummaryObject()
cePointofForm = 0
If arrProgramType IsNot Nothing Then '' have form must list out
If arrProgramType.Count > 0 Then
objectItem.CECategoryName = DotNetNuke.Services.Localization.Localization.GetString("CommunityServiceName.Text", Me.LocalResourceFile)
Dim validationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_COM_SERVICE_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim currentPoint As Decimal = SumCommunityService(arrProgramType)
Dim maxCEHours As Decimal = 0
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxCEHours = If(otherModuleSettings.CommunityServiceTotalHours.HasValue, otherModuleSettings.CommunityServiceTotalHours.Value, 0)
End If
If validationARN_Greater = True AndAlso currentPoint > maxCEHours Then
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(maxCEHours.ToString())
Else
objectItem.TotalCEString = CommonHelper.ChopUnusedDecimal(currentPoint.ToString())
End If
If CommonHelper.CheckIsNumber(objectItem.TotalCEString) Then
cePointofForm = Decimal.Parse(objectItem.TotalCEString)
End If
End If
End If
Return objectItem
End Function
Private Sub BuildTitleTotalCEPoint_ARN()
lblOptionTitle.Text = DotNetNuke.Services.Localization.Localization.GetString("SummaryTitleARN.Text", Me.LocalResourceFile)
End Sub
#End Region
#Region "Validation"
''' <summary>
''' Check validation is conflicted
''' </summary>
''' <param name="ruleID"> get ruleID and check validation follow this ID </param>
''' <param name="conflictMessage"> if have conflict , message will be raised </param>
''' <returns> boolean value : have or none conflict </returns>
''' <comment>base on conflictMessage, to distinguish conflict or not validation</comment>
Public Function CheckConflictValidation(ByRef ruleID As String,
ByRef conflictMessage As String) As Boolean
Dim validationABNN = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_SUMMARY_COMMON_CALCULATOR.ToString(),
Server.MapPath(ParentModulePath))
Dim validationARN = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_SUMMARY_ARN.ToString(),
Server.MapPath(ParentModulePath))
conflictMessage = String.Empty
ruleID = String.Empty
If validationABNN = True AndAlso validationARN = True Then
conflictMessage = DotNetNuke.Services.Localization.Localization.GetString("ConflictMessage.Text", Me.LocalResourceFile)
Return True
ElseIf validationABNN = True Then
ruleID = ValidationRuleId.RECERT_SUMMARY_COMMON_CALCULATOR.ToString()
Return False
ElseIf validationARN = True Then
ruleID = ValidationRuleId.RECERT_SUMMARY_ARN.ToString()
Return False
End If
Return True '' don't have validation because conflictMessage is empty
End Function
Private Function CheckBusinessValidation_ARN(ByVal totalPoint As Decimal, ByRef errorMessages As String) As Boolean '' total CE point of 5 form must be equal to or greater than maximum CE
Dim validationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_COM_SERVICE_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationSummaryARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_SUMMARY_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationSummaryARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_SUMMARY_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationContinuingEducationARN = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_CON_EDU_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationResentationARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_TEACH_PRESENTATION_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationResentationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_TEACH_PRESENTATION_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationEducationCourseARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_EDU_COURSE_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationEducationCourseARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_EDU_COURSE_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationPublicationARN_Equal = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_PUBLICATION_EQUAL_ARN.ToString(),
Server.MapPath(ParentModulePath))
Dim validationPublicationARN_Greater = ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.RECERT_PUBLICATION_GREATER_ARN.ToString(),
Server.MapPath(ParentModulePath))
errorMessages = String.Empty
Dim currentPointFormE As Decimal = 0
Dim maxPointFormE As Decimal = 0
Dim maxTotalpoint As Decimal = 0
Dim flag As Boolean = True
currentPointFormE = Decimal.Parse(GetCookie("TotalCEpointCummunityService"))
Dim otherModuleSettings = ModuleConfigurationHelper.Instance.GetOtherModuleSettings(Server.MapPath(ParentModulePath))
If otherModuleSettings IsNot Nothing Then
maxPointFormE = If(otherModuleSettings.CommunityServiceTotalHours.HasValue, otherModuleSettings.CommunityServiceTotalHours.Value, 0)
maxTotalpoint = If(otherModuleSettings.ARNMaxSummaryPoint.HasValue, otherModuleSettings.ARNMaxSummaryPoint.Value, 0)
End If
'' check carryover point of form : E
If Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.COMMUNITY_SERVICE_VOLUNTEER_SERVICE_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) OrElse
Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.COMMUNITY_SERVICE_LEADERSHIP_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) OrElse
Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.COMMUNITY_SERVICE_PRESENTATION_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) OrElse
Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.COMMUNITY_SERVICE_PUBLICATION_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) OrElse
Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.COMMUNITY_SERVICE_REVIEW_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) Then '' if one of 5 forms uncheck optional rule => will check carry over rule on form
If validationARN_Greater = True AndAlso currentPointFormE < maxPointFormE Then ''
errorMessages = String.Format(DotNetNuke.Services.Localization.Localization.GetString(
"ValidationErrorMessage_CommunityService_ARN.Text", Me.LocalResourceFile), maxPointFormE, currentPointFormE)
flag = False
End If
End If
'' check carryover point of form : A,B,C,D
Dim maxCEPointCarryOver As Decimal = 0
Dim subMessageCarry = String.Empty
If otherModuleSettings IsNot Nothing Then
Dim arrProgramTypeEnum As New ArrayList
For Each programtype As String In [Enum].GetNames(GetType(ActivityProgramType))
If Not String.IsNullOrEmpty(programtype) Then
arrProgramTypeEnum.Add(programtype)
End If
Next
Dim arr As List(Of SectionInfo) = If(CurrentFormInfo IsNot Nothing AndAlso CurrentFormInfo.Sections IsNot Nothing, CurrentFormInfo.Sections, New List(Of SectionInfo)())
For Each sectionInfo As SectionInfo In arr
If CheckExistItem(sectionInfo.SectionProgramType, arrProgramTypeEnum) Then '' only list programType in Enum
If sectionInfo.IsEnabled = True AndAlso Not String.IsNullOrEmpty(sectionInfo.SectionProgramType) Then ''Tab must be Enable
Select Case sectionInfo.SectionProgramType
Case ActivityProgramType.EDUCATION.ToString()
If validationContinuingEducationARN Then
maxCEPointCarryOver = If(otherModuleSettings.ARNMaxSummaryPointOfContinuingEducation.HasValue, otherModuleSettings.ARNMaxSummaryPointOfContinuingEducation.Value, 0)
subMessageCarry = BuildErrorMessageForContiningEducation(sectionInfo.SectionProgramType, sectionInfo.SectionValue, maxCEPointCarryOver)
If Not String.IsNullOrEmpty(subMessageCarry) Then
errorMessages += subMessageCarry
flag = False
End If
End If
Exit Select
Case ActivityProgramType.TEACHINGPRESN.ToString()
If Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.PRESENTATIONS_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) Then '' not check optional rule => check rele on form
If validationResentationARN_Equal OrElse validationResentationARN_Greater Then
maxCEPointCarryOver = If(otherModuleSettings.PresentationTotalHours.HasValue, otherModuleSettings.PresentationTotalHours.Value, 0)
subMessageCarry = BuildErrorMessageValidationRuleCarryOverPoint(sectionInfo.SectionProgramType, maxCEPointCarryOver, sectionInfo.SectionValue)
If Not String.IsNullOrEmpty(subMessageCarry) Then
errorMessages += subMessageCarry
flag = False
End If
End If
End If
Exit Select
Case ActivityProgramType.CONTEDUCATION.ToString()
If Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.ACADEMIC_COURSEWORK_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) Then '' not check optional rule => check rele on form
If validationEducationCourseARN_Equal OrElse validationEducationCourseARN_Greater Then
maxCEPointCarryOver = If(otherModuleSettings.EducationCourseTotalHours.HasValue, otherModuleSettings.EducationCourseTotalHours.Value, 0)
subMessageCarry = BuildErrorMessageValidationRuleCarryOverPoint(sectionInfo.SectionProgramType, maxCEPointCarryOver, sectionInfo.SectionValue)
If Not String.IsNullOrEmpty(subMessageCarry) Then
errorMessages += subMessageCarry
flag = False
End If
End If
End If
Exit Select
Case ActivityProgramType.PUBLICATION.ToString()
If Not ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(ValidationRuleId.PROFESSIONAL_PUBLICATIONS_OPTIONAL.ToString(), Server.MapPath(ParentModulePath)) Then '' not check optional rule => check rele on form
If validationPublicationARN_Equal OrElse validationPublicationARN_Greater Then
maxCEPointCarryOver = If(otherModuleSettings.PublicationTotalHours.HasValue, otherModuleSettings.PublicationTotalHours.Value, 0)
subMessageCarry = BuildErrorMessageValidationRuleCarryOverPoint(sectionInfo.SectionProgramType, maxCEPointCarryOver, sectionInfo.SectionValue)
If Not String.IsNullOrEmpty(subMessageCarry) Then
errorMessages += subMessageCarry
flag = False
End If
End If
End If
Exit Select
End Select
End If
End If
Next
End If
'' check max values of Summary form
If validationSummaryARN_Greater = True Then ''
If totalPoint < maxTotalpoint Then
errorMessages += String.Format("<br/>" + DotNetNuke.Services.Localization.Localization.GetString(
"ValidationErrorMessageARN_greater.Text", Me.LocalResourceFile), CommonHelper.ChopUnusedDecimal(maxTotalpoint.ToString()))
flag = False
End If
Else
If validationSummaryARN_Equal = True Then ''
If totalPoint <> maxTotalpoint Then
errorMessages += String.Format("<br/>" + DotNetNuke.Services.Localization.Localization.GetString(
"ValidationErrorMessageARN_equal.Text", Me.LocalResourceFile), CommonHelper.ChopUnusedDecimal(maxTotalpoint.ToString()))
flag = False
End If
End If
End If
Return flag
End Function
Private Function BuildErrorMessageValidationRuleCarryOverPoint(ByVal programType As String, ByVal maxCEHours As Decimal,
ByVal formName As String) As String
Dim currentPoint As Decimal = 0
Dim message = String.Empty
currentPoint = Decimal.Parse(GetCookie(programType + MasterCustomerId))
If currentPoint < maxCEHours Then
message = String.Format("<br/>" + DotNetNuke.Services.Localization.Localization.GetString(
"ErrorMessageCarryOverPointOnSummary.Text", Me.LocalResourceFile),
formName, CommonHelper.ChopUnusedDecimal(maxCEHours.ToString()), CommonHelper.ChopUnusedDecimal(currentPoint.ToString()))
End If
Return message
End Function
Private Function BuildErrorMessageForContiningEducation(ByVal programType As String, ByVal formName As String,
ByVal maxCEHours As Decimal) As String
Dim pointofForm As Decimal = -1
Dim pointApprove As Decimal = -1
Dim subMessages = String.Empty
If Decimal.Parse(GetCookie(programType + MasterCustomerId)) <> 0 Then
pointofForm = Decimal.Parse(GetCookie(programType + MasterCustomerId))
End If
If pointofForm > maxCEHours Then
pointofForm = maxCEHours
End If
If Decimal.Parse(GetCookie("approvedHour")) <> 0 Then
pointApprove = Decimal.Parse(GetCookie("approvedHour"))
End If
Dim leftParam = Math.Ceiling((pointofForm * 2) / 3)
If ModuleConfigurationHelper.Instance.IsValidationRuleEnabled(
ValidationRuleId.CONTINUING_EDUCATION_OPTIONAL.ToString(),
Server.MapPath(ParentModulePath)) Then 'Bypass
If (pointApprove > -1 OrElse pointofForm > 0) AndAlso pointApprove < leftParam Then 'has invalid data
subMessages = "<br/>" +
String.Format(
Localization.GetString("MessagesContinuingEducationARNWithForm.Text",
LocalResourceFile), formName)
End If
Else 'Not Bypass
'no data or (has invalid data)
If (pointApprove = -1 AndAlso pointofForm = -1) OrElse ((pointApprove > -1 OrElse pointofForm > 0) AndAlso pointApprove < leftParam) Then
subMessages = "<br/>" +
String.Format(
Localization.GetString("MessagesContinuingEducationARNWithForm.Text",
LocalResourceFile), formName)
End If
End If
Return subMessages
End Function
#End Region
End Class
End Namespace
Public Class SummaryObject
Public Property TotalCEString() As String
Public Property CECategoryName() As String
End Class
|
Imports System.Text
Imports CoinMPTestVB8.Coin.CoinMP
Namespace CoinMPTest
Module ProblemCOPTDynamic
Private _ds As New DataSet
Public Sub Solve(ByVal solveProblem As SolveProblem)
Const NUM_COLS As Integer = 32
Const NUM_ROWS As Integer = 27
Const NUM_NZ As Integer = 83
Const NUM_RNG As Integer = 0
Const INF As Double = 1.0E+37
Dim probname As String = "Afiro"
Dim ncol As Integer = NUM_COLS
Dim nrow As Integer = NUM_ROWS
Dim nels As Integer = NUM_NZ
Dim nrng As Integer = NUM_RNG
Dim objectname As String = "Cost"
Dim objsens As Integer = CoinMP.ObjectSense.Min
Dim objconst As Double = 0.0
'OBJ Function
'Coefficient of each variable in objective function
' x1 x2
Dim dobj() As Double = {0, -0.4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.32, 0, 0, 0, -0.6, _
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0.48, 0, 0, 10} '-> 32
'Lower limit of each variable in objective function
Dim dclo() As Double = {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} '-> 32
'Upper limit of each variable in objective function
'Note:
'There are 42 entries in this array, which may be incorrect. 32 should be the correct number.
Dim dcup() As Double = {INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, _
INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, _
INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF, INF} '-> 42
'Equality of each constraint row
Dim rtyp() As Char = "EELLEELLLLEELLEELLLLLLLLLLL" '-> 27
'RHS value of each constraint row
Dim drhs() As Double = {0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 0, 0, 500, 0, 0, 44, 500, 0, _
0, 0, 0, 0, 0, 0, 0, 310, 300} '-> 27
'Cumulative total of number of occurances of each variable
'Note:
'This is a 0-based array
Dim mbeg() As Integer = {0, 4, 6, 8, 10, 14, 18, 22, 26, 28, 30, 32, 34, 36, 38, 40, _
44, 46, 48, 50, 52, 56, 60, 64, 68, 70, 72, 74, 76, 78, 80, 82, 83} '-> 33
'Number of coefficients for each variable
Dim mcnt() As Integer = {4, 2, 2, 2, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, _
4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1} '-> 32
'Ordinal position of each variable in the rows/constraints
'Note:
'This is a 0-based array
'The first four (0,1,2,23) are positions of the variable x1 in rows (c1,c2,c3,c24).
Dim midx() As Integer = {0, 1, 2, 23, 0, 3, 0, 21, 1, 25, 4, 5, 6, 24, 4, 5, 7, 24, 4, 5, _
8, 24, 4, 5, 9, 24, 6, 20, 7, 20, 8, 20, 9, 20, 3, 4, 4, 22, 5, 26, 10, 11, _
12, 21, 10, 13, 10, 23, 10, 20, 11, 25, 14, 15, 16, 22, 14, 15, 17, 22, 14, _
15, 18, 22, 14, 15, 19, 22, 16, 20, 17, 20, 18, 20, 19, 20, 13, 15, 15, 24, _
14, 26, 15} '-> 83
'Coefficient value of each variable as defined by colNames
Dim mval() As Double = {-1, -1.06, 1, 0.301, 1, -1, 1, -1, 1, 1, -1, -1.06, 1, 0.301, _
-1, -1.06, 1, 0.313, -1, -0.96, 1, 0.313, -1, -0.86, 1, 0.326, -1, 2.364, -1, _
2.386, -1, 2.408, -1, 2.429, 1.4, 1, 1, -1, 1, 1, -1, -0.43, 1, 0.109, 1, -1, _
1, -1, 1, -1, 1, 1, -0.43, 1, 1, 0.109, -0.43, 1, 1, 0.108, -0.39, 1, 1, _
0.108, -0.37, 1, 1, 0.107, -1, 2.191, -1, 2.219, -1, 2.249, -1, 2.279, 1.4, _
-1, 1, -1, 1, 1, 1} '-> 83
'Column names
Dim colNames() As String = {"x01", "x02", "x03", "x04", "x06", "x07", "x08", "x09", _
"x10", "x11", "x12", "x13", "x14", "x15", "x16", "x22", "x23", "x24", "x25", _
"x26", "x28", "x29", "x30", "x31", "x32", "x33", "x34", "x35", "x36", "x37", _
"x38", "x39"} '-> 32
'Row names
Dim rowNames() As String = {"r09", "r10", "x05", "x21", "r12", "r13", "x17", "x18", _
"x19", "x20", "r19", "r20", "x27", "x44", "r22", "r23", "x40", "x41", "x42", _
"x43", "x45", "x46", "x47", "x48", "x49", "x50", "x51"} '-> 27
Dim optimalValue As Double = -464.753142857
solveProblem.Run(probname, optimalValue, ncol, nrow, nels, nrng, objsens, objconst, _
dobj, dclo, dcup, rtyp, drhs, Nothing, mbeg, mcnt, midx, mval, _
colNames, rowNames, objectname, Nothing, Nothing)
End Sub
Public Sub db_Connect()
Dim con As System.Data.OleDb.OleDbConnection
Dim adapter As System.Data.OleDb.OleDbDataAdapter
Dim sql As String
Dim conStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\OPTMODELS\Afiro\Afiro.MDB;;Jet OLEDB:System Database=C:\OPTMODELS\C-OPTSYS\System.MDW.COPT;User ID=Admin;Password="
Dim dt As New DataTable()
con = New OleDb.OleDbConnection(conStr)
Try
con.Open()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Exclamation)
End Try
sql = "SELECT * FROM tsysCol"
adapter = New OleDb.OleDbDataAdapter(sql, conStr)
adapter.Fill(dt)
_ds.Tables.Add(dt)
dt = Nothing
sql = "SELECT * FROM tsysRow"
adapter = New OleDb.OleDbDataAdapter(sql, conStr)
dt = New DataTable
adapter.Fill(dt)
_ds.Tables.Add(dt)
dt = Nothing
sql = "SELECT * FROM tsysMtx"
adapter = New OleDb.OleDbDataAdapter(sql, conStr)
dt = New DataTable
adapter.Fill(dt)
_ds.Tables.Add(dt)
dt = Nothing
_ds.Tables(0).TableName = "tsysCol"
_ds.Tables(1).TableName = "tsysRow"
_ds.Tables(2).TableName = "tsysMtx"
'MsgBox("tsysCol:" & _ds.Tables(0).Rows.Count)
'MsgBox("tsysRow:" & _ds.Tables(1).Rows.Count)
'MsgBox("tsysMtx:" & _ds.Tables(2).Rows.Count)
con.Close()
con = Nothing
adapter = Nothing
'_ds = Nothing
dt = Nothing
'MsgBox("tsysCol:" & _ds.Tables(0).Rows.Count)
'MsgBox("tsysRow:" & _ds.Tables(1).Rows.Count)
'MsgBox("tsysMtx:" & _ds.Tables(2).Rows.Count)
End Sub
Public Sub GetRowCount()
MsgBox("tsysCol:" & _ds.Tables(0).Rows.Count)
MsgBox("tsysRow:" & _ds.Tables(1).Rows.Count)
MsgBox("tsysMtx:" & _ds.Tables(2).Rows.Count)
End Sub
End Module
End Namespace
|
'Program compilation
'created by Michael Dao
'This is a compilation of all my programs made during highschool, they all helped me practice programming
'Started: 11/11/2016
Public Class frmMenu
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'LCD Demo
Me.Hide()
frmLCD_Demo.Show()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'Dream calculator
Me.Hide()
frmDream_Calculator.Show()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
'Basketball Scoreboard
Me.Hide()
frmBasketball_Scoreboard.Show()
frmBasketball_Scoreboard_2.Show()
timerstop = False
End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
'quiz
Me.Hide()
frmQuiz.Show()
End Sub
Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
'message boxes
Me.Hide()
frmMessage_Boxes.Show()
End Sub
Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
'stopwatch
Me.Hide()
frmStopwatch.Show()
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
'Animation
Me.Hide()
frmAnimation.Show()
End Sub
Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
'Button Game
Me.Hide()
frmButton_Game.Show()
End Sub
Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
'Balloon chase
Me.Hide()
frmBalloon_Chase.Show()
End Sub
Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
'Investment Calculator
Me.Hide()
frmInvestment_Calculator.Show()
End Sub
Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
'Dodge the tomatoes
Me.Hide()
frmDodge_The_Tomatoes.Show()
End Sub
Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
'Sandwich Shop
Me.Hide()
frmSandwich_Shop.Show()
End Sub
Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
'Project 1: Racing Game
Me.Hide()
frmRacing_Game.Show()
End Sub
Private Sub Button14_Click_1(sender As Object, e As EventArgs) Handles Button14.Click
'Button Calculator
Me.Hide()
frmButton_Calculator.Show()
End Sub
Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
'Guessing Game
Me.Hide()
frmGuessing_Game.Show()
End Sub
Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
'Challenge the computer
Me.Hide()
frmChallenge_The_Computer.Show()
End Sub
Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
'Student Budget Calculator
Me.Hide()
frmStudent_Budget_Calculator.Show()
End Sub
Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
'Timetable Manger
Me.Hide()
frmTimetable_Manager.Show()
End Sub
Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
End Sub
End Class |
Public Class CLASS_DARQTPHR
Private _phrno As String
Public Property phrno() As String
Get
Return _phrno
End Get
Set(ByVal value As String)
_phrno = value
End Set
End Property
Private _phrcd As Integer
Public Property phrcd() As Integer
Get
Return _phrcd
End Get
Set(ByVal value As Integer)
_phrcd = value
End Set
End Property
Private _opentime As String
Public Property opentime() As String
Get
Return _opentime
End Get
Set(ByVal value As String)
_opentime = value
End Set
End Property
End Class
|
''' <summary>
''' Inherits DataGridViewColumn for allowing:
''' 1.) A custom cell editor to be used
''' 2.) A custom cell header to be used, which has a clickable "Filter" button
''' -- Using the filter button to display a CheckedListBox, which can be used by the end user to dynamically filter their DataGridView
''' </summary>
''' <remarks></remarks>
Public Class DataGridViewCustomTextBoxCellColumn
Inherits DataGridViewColumn
Private Const ClearItem As String = "(Clear Filter)"
Private isInit As Boolean = False
Private ContextCheckedListBox As CheckedListBox
''' <summary>
''' Maintains a KeyValuePairList of active filters
''' </summary>
''' <remarks></remarks>
Public ActiveFilters As New List(Of KeyValuePair(Of Integer, String))
''' <summary>
''' Default constructor
''' </summary>
''' <remarks></remarks>
Public Sub New()
MyBase.New(New DataGridViewCustomTextBoxCell())
' Make sure the filterable column header is used
DefaultHeaderCellType = GetType(DataGridViewCustomTextBoxCellColumnHeader)
' Wire up the click event to the filter button
AddHandler CType(Me.HeaderCell, DataGridViewCustomTextBoxCellColumnHeader).OnFilterBoxClicked, AddressOf OnFilterClicked
End Sub
''' <summary>
''' Allows filtering to be enabled/disabled for this column from the Visual Studio Form Designer
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Property AllowFiltering As Boolean
Get
Return CType(HeaderCell, DataGridViewCustomTextBoxCellColumnHeader).AllowFiltering
End Get
Set(value As Boolean)
CType(HeaderCell, DataGridViewCustomTextBoxCellColumnHeader).AllowFiltering = value
End Set
End Property
''' <summary>
''' Returns the CellTemplate to use for this column's cells
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public Overrides Property CellTemplate() As DataGridViewCell
Get
Return MyBase.CellTemplate
End Get
Set(ByVal value As DataGridViewCell)
If (value IsNot Nothing) AndAlso Not value.GetType().IsAssignableFrom(GetType(DataGridViewCustomTextBoxCell)) Then
Throw New InvalidCastException("Must be a DataGridViewCustomCell")
End If
MyBase.CellTemplate = value
End Set
End Property
''' <summary>
''' Clears all active filters for this column
''' </summary>
''' <remarks></remarks>
Public Sub ClearFilters()
ActiveFilters.Clear()
If ContextCheckedListBox IsNot Nothing Then
Dim i As Integer = 0
For i = 0 To ContextCheckedListBox.Items.Count - 1
ContextCheckedListBox.SetItemChecked(i, False)
Next
' Clear Filter entry is selected, show everything
For Each d As DataGridViewRow In DataGridView.Rows
If Not (d.IsNewRow) Then
d.Visible = True
End If
Next
CType(DataGridView.Columns(Index).HeaderCell, DataGridViewCustomTextBoxCellColumnHeader).Filtered = False
End If
End Sub
''' <summary>
''' Wires up events to reconfigure the filter lists for this column when rows are added/removed from the DataGridView
''' </summary>
''' <remarks></remarks>
Protected Overrides Sub OnDataGridViewChanged()
MyBase.OnDataGridViewChanged()
If Not (isInit) Then
AddHandler DataGridView.RowsAdded, AddressOf UpdateFilters
AddHandler DataGridView.UserDeletedRow, AddressOf UpdateFilters
isInit = True
End If
End Sub
''' <summary>
''' Destroys the filter dropdown window to force it to be recreated
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub UpdateFilters(sender As Object, e As EventArgs)
If ContextCheckedListBox IsNot Nothing Then
ContextCheckedListBox.Hide()
ContextCheckedListBox.Dispose()
ContextCheckedListBox = Nothing
End If
End Sub
''' <summary>
''' When the filter button is clicked, shows a list of items that can be filtered by
''' </summary>
''' <remarks></remarks>
Private Sub OnFilterClicked()
If ContextCheckedListBox Is Nothing Then
Dim r As Rectangle = DataGridView.GetColumnDisplayRectangle(Index, True)
ContextCheckedListBox = New CheckedListBox()
ContextCheckedListBox.Parent = DataGridView
ContextCheckedListBox.Location = New Point(r.X, DataGridView.ColumnHeadersHeight)
ContextCheckedListBox.MinimumSize = New Size(Width, 32)
ContextCheckedListBox.MaximumSize = New Size(320, 240)
ContextCheckedListBox.AutoSize = True
ContextCheckedListBox.BorderStyle = BorderStyle.Fixed3D
ContextCheckedListBox.BackColor = Color.DarkGray
ContextCheckedListBox.Tag = Index
AddHandler ContextCheckedListBox.LostFocus, AddressOf ClosingFilterForm
End If
If ContextCheckedListBox.Items.Count() = 0 Then
Dim tmp As List(Of String) = New List(Of String)()
tmp.Add(ClearItem)
For Each d As DataGridViewRow In DataGridView.Rows
If Not (d.IsNewRow) AndAlso d.Cells(Index).Value IsNot Nothing Then
tmp.Add(d.Cells(Index).Value.ToString())
End If
Next
ContextCheckedListBox.Items.Clear()
ContextCheckedListBox.Items.AddRange(tmp.Distinct().OrderBy(Function(x) x).ToArray())
End If
If Not (ContextCheckedListBox.Visible) Then
If ContextCheckedListBox.Location.X + ContextCheckedListBox.Width + 64 > DataGridView.Width - 64 Then
ContextCheckedListBox.Location = New Point(DataGridView.Width - ContextCheckedListBox.Width - 32, DataGridView.ColumnHeadersHeight)
End If
ContextCheckedListBox.Show()
End If
ContextCheckedListBox.Focus()
End Sub
''' <summary>
''' When the filter dropdown closes, filters the DataGridView to show only items that meet the filter criteria
''' </summary>
''' <param name="s"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ClosingFilterForm(s As Object, e As EventArgs)
If ContextCheckedListBox.CheckedItems.Contains(ClearItem) Then
ClearFilters()
ElseIf ContextCheckedListBox.CheckedItems.Count > 0 Then
ActiveFilters.Clear()
Dim idx As Integer = CInt(ContextCheckedListBox.Tag)
' Only show rows which the specified column's value matches what the filter is set for
If DataGridView.GetType() = GetType(FilteredDataGridView) Then
' If the DataGridView is a FilteredDataGridView, the GDV itself handles the filtering
For Each ci As Object In ContextCheckedListBox.CheckedItems
ActiveFilters.Add(New KeyValuePair(Of Integer, String)(idx, ci.ToString()))
Next
Else
' Regular DataGridView? Filter by this column only, no multi-column support
For Each d As DataGridViewRow In DataGridView.Rows
If Not (d.IsNewRow) Then
d.Visible = False
For Each ci As Object In ContextCheckedListBox.CheckedItems
ActiveFilters.Add(New KeyValuePair(Of Integer, String)(idx, ci.ToString()))
If d.Cells(idx).Value IsNot Nothing AndAlso ci.ToString() = d.Cells(idx).Value.ToString() Then
d.Visible = True
Exit For
End If
Next
End If
Next
End If
CType(DataGridView.Columns(Index).HeaderCell, DataGridViewCustomTextBoxCellColumnHeader).Filtered = True
End If
ContextCheckedListBox.Hide()
' Tell the parent to refresh the filters if it is a FilteredDataGridView
If DataGridView.GetType() = GetType(FilteredDataGridView) Then
CType(DataGridView, FilteredDataGridView).RefreshFilters()
End If
End Sub
End Class
|
'===============================================================================
' Microsoft patterns & practices
' CompositeUI Application Block
'===============================================================================
' Copyright © 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
' FITNESS FOR A PARTICULAR PURPOSE.
'===============================================================================
Imports Microsoft.VisualBasic
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports System
Imports System.Windows.Forms
Imports Microsoft.Practices.CompositeUI.SmartParts
Imports System.Collections.Generic
Imports Microsoft.Practices.ObjectBuilder
<TestClass()> _
Public Class ControlSmartPartStrategyFixture
Private Shared control As Control
Private Shared workItem As WorkItem
Private Shared strat As ControlSmartPartStrategy
Private Shared context As MockBuilderContext
<TestInitialize()> _
Public Sub Setup()
control = New Control()
workItem = New TestableRootWorkItem()
strat = New ControlSmartPartStrategy()
context = New MockBuilderContext(strat)
context.Locator.Add(New DependencyResolutionLocatorKey(GetType(WorkItem), Nothing), workItem)
End Sub
<TestMethod()> _
Public Sub AddingControlWithPlaceholderReplacesWSP()
Dim placeholder As SmartPartPlaceholder = New SmartPartPlaceholder()
placeholder.SmartPartName = "SP1"
control.Controls.Add(placeholder)
Dim smartPart1 As MockSmartPart = New MockSmartPart()
workItem.Items.Add(smartPart1, "SP1")
workItem.Items.Add(control)
Assert.AreSame(smartPart1, placeholder.SmartPart)
End Sub
<TestMethod()> _
Public Sub TestSmartPartHolderHavingNoSmartPartInContainerNoOp()
Dim smartpartHolder As SmartPartPlaceholder = New SmartPartPlaceholder()
smartpartHolder.SmartPartName = "SampleSmartPart"
control.Controls.Add(smartpartHolder)
workItem.Items.Add(control)
Assert.IsNull(smartpartHolder.SmartPart)
End Sub
<TestMethod()> _
Public Sub RemovingControlRemovesSmartParts()
Dim originalCount As Integer = workItem.Items.Count
Dim smartPart1 As MockSmartPart = New MockSmartPart()
smartPart1.Name = "SmartPart1"
Dim smartPart2 As MockSmartPart = New MockSmartPart()
smartPart2.Name = "SmartPart2"
smartPart1.Controls.Add(smartPart2)
control.Controls.Add(smartPart1)
workItem.Items.Add(control)
Assert.AreEqual(3, workItem.Items.Count - originalCount)
workItem.Items.Remove(control)
Assert.AreEqual(0, workItem.Items.Count - originalCount)
End Sub
<TestMethod()> _
Public Sub MonitorCallsRegisterWorkspace()
Dim control As MockControlWithWorkspace = New MockControlWithWorkspace()
workItem.Items.Add(control)
Assert.AreEqual(control.Workspace, workItem.Workspaces(control.Workspace.Name))
End Sub
<TestMethod()> _
Public Sub WorkspacesAreRegisteredWithName()
Dim mockControl As MockControlWithWorkspace = New MockControlWithWorkspace()
workItem.Items.Add(mockControl)
Assert.AreEqual(mockControl.Workspace, workItem.Workspaces(mockControl.Workspace.Name))
End Sub
<TestMethod()> _
Public Sub EmptyStringNameIsReplaceWhenAdded()
Dim control As Control = New Control()
Dim workspace As TabWorkspace = New TabWorkspace()
control.Controls.Add(workspace)
workItem.Items.Add(control)
Dim tabWorkSpaces As ICollection(Of TabWorkspace) = workItem.Workspaces.FindByType(Of TabWorkspace)()
Assert.IsNull(workItem.Workspaces(workspace.Name))
Assert.IsTrue(tabWorkSpaces.Contains(workspace))
End Sub
#Region "Supporting Classes"
<SmartPart()> _
Private Class MockSmartPart : Inherits UserControl
End Class
Private Class MockControlWithWorkspace : Inherits UserControl
Private innerWorkspace As TabWorkspace
Private button As Button
Public ReadOnly Property Workspace() As TabWorkspace
Get
Return innerWorkspace
End Get
End Property
Public Sub New()
innerWorkspace = New TabWorkspace()
innerWorkspace.Name = "TestName"
button = New Button()
Me.Controls.Add(innerWorkspace)
Me.Controls.Add(button)
End Sub
End Class
#End Region
End Class
|
Imports System.Net
Imports System.Net.Sockets
Imports System.Threading
Imports System.Text
''' <summary>
''' The AsyncClient class is an Asynchronous network socket implementation specifically designed act as
''' a network client. This class is used for providing logging over TCP support, as well as
''' Inter-Process Communication (IPC) support.
''' </summary>
''' <remarks></remarks>
Public Class AsyncClient
Implements INetService, IDisposable
''' <summary>
''' True if there is a communication error
''' </summary>
''' <remarks></remarks>
Public HasError As Boolean = False
Private remoteHost As String = "localhost"
Private remotePort As Integer = 10000
Private connectDone As New ManualResetEvent(False)
Private sendDone As New ManualResetEvent(False)
Private receiveDone As New ManualResetEvent(False)
Private response As String = String.Empty
Private ipHostInfo As IPHostEntry = Nothing
Private ipAddress As IPAddress = Nothing
Private remoteEP As IPEndPoint = Nothing
Private client As Socket = Nothing
''' <summary>
''' Default constructor
''' </summary>
''' <remarks></remarks>
Public Sub New()
End Sub
''' <summary>
''' Initializes the client to connect to the specified network host/port
''' </summary>
''' <param name="host">The network host or IPv4 address to connect to</param>
''' <param name="port">The server port to connect to</param>
''' <remarks></remarks>
Public Sub New(host As String, Optional port As Integer = 10000)
remoteHost = host
remotePort = port
End Sub
''' <summary>
''' Disposes of this object
''' </summary>
''' <remarks></remarks>
Public Sub Dispose() Implements IDisposable.Dispose
If connectDone IsNot Nothing Then
'connectDone.Dispose()
connectDone = Nothing
End If
If sendDone IsNot Nothing Then
'sendDone.Dispose()
sendDone = Nothing
End If
If receiveDone IsNot Nothing Then
'receiveDone.Dispose()
receiveDone = Nothing
End If
If client IsNot Nothing Then
'client.Dispose()
client = Nothing
End If
End Sub
''' <summary>
''' Called when data is received from the server
''' </summary>
''' <param name="state">The state of the socket</param>
''' <remarks></remarks>
Public Overridable Sub OnReceive(ByRef state As StateObject) Implements INetService.OnReceive
'Logger.ToLog("AsyncClient.OnReceive")
'Logger.ToLog("Read {0} bytes from socket. " + vbLf + " Data : {1}", state.sb.Length, state.sb.ToString())
' Send(state.workSocket, state.sb.ToString())
End Sub
''' <summary>
''' Initializes this class to setup a network socket
''' </summary>
''' <remarks></remarks>
Public Sub Init() Implements INetService.Init
'Logger.ToLog("AsyncClient.Init")
If remoteHost.Equals("localhost") Or remoteHost.Equals("127.0.0.1") Then
remoteEP = New IPEndPoint(IPAddress.Loopback, remotePort)
Else
ipHostInfo = Dns.GetHostEntry(remoteHost)
ipAddress = ipHostInfo.AddressList(0)
remoteEP = New IPEndPoint(ipAddress, remotePort)
End If
client = New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
Dim ar As IAsyncResult = client.BeginConnect(remoteEP, New AsyncCallback(AddressOf ConnectCallback), client)
connectDone.WaitOne()
If HasError Then
Throw New Exception()
End If
End Sub
''' <summary>
''' Starts operations
''' </summary>
''' <remarks></remarks>
Public Sub Start() Implements INetService.Start
'Init()
'Logger.ToLog("AsyncClient.Start")
'' Send test data to the remote device.
'Send(client, "This is a test<EOF>")
'sendDone.WaitOne()
'Receive(client)
'receiveDone.WaitOne()
'Logger.ToLog("Response received : {0}", response)
'Kill()
End Sub
''' <summary>
''' Sends a message to the server and waits for a response
''' </summary>
''' <param name="msg">The message to send to the server</param>
''' <remarks></remarks>
Public Sub SendMessageReceiveResponse(msg As String)
Init()
Send(client, msg & "<EOF>")
sendDone.WaitOne()
Receive(client)
receiveDone.WaitOne()
Kill()
End Sub
''' <summary>
''' Sends a message to the server and waits for a response
''' </summary>
''' <param name="msg">The message to send</param>
''' <remarks></remarks>
Public Sub SendMessageReceiveResponse(msg() As Byte)
Init()
Send(client, msg)
sendDone.WaitOne()
Receive(client)
receiveDone.WaitOne()
Kill()
End Sub
''' <summary>
''' Sends a message to the server and closes the socket without waiting for a response
''' </summary>
''' <param name="msg">The message to send. The message is suffixed with an EOF indicator to mark the end of the message.</param>
''' <remarks></remarks>
Public Sub SendMessageAndClose(msg As String)
Init()
Send(client, msg & "<EOF>")
sendDone.WaitOne()
Kill()
End Sub
''' <summary>
''' Sends a message to the server and closes the socket without waiting for a response
''' </summary>
''' <param name="msg">The message to send. The message is suffixed with an EOF indicator to mark the end of the message.</param>
''' <remarks></remarks>
Public Sub SendMessageAndClose(msg() As Byte)
Init()
Send(client, msg)
sendDone.WaitOne()
Kill()
End Sub
''' <summary>
''' Shuts down the client socket
''' </summary>
''' <remarks></remarks>
Public Sub Kill() Implements INetService.Kill
'Logger.ToLog("AsyncClient.Kill")
client.Shutdown(SocketShutdown.Both)
client.Close()
End Sub
''' <summary>
''' Called when a connection to the server is made
''' </summary>
''' <param name="ar">The result of the connection</param>
''' <remarks></remarks>
Private Sub ConnectCallback(ByVal ar As IAsyncResult)
'Logger.ToLog("AsyncClient.ConnectCallback")
Dim cl As Socket = CType(ar.AsyncState, Socket)
If Not (cl.Connected) Then
HasError = True
Else
cl.EndConnect(ar)
'Logger.ToLog("Socket connected to {0}", client.RemoteEndPoint.ToString())
End If
connectDone.Set()
End Sub
''' <summary>
''' Called to begin receiving data from the server
''' </summary>
''' <param name="cl">The socket to receive data on</param>
''' <remarks></remarks>
Private Sub Receive(ByVal cl As Socket)
'Logger.ToLog("AsyncClient.Receive")
Dim state As New StateObject()
state.workSocket = cl
cl.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
End Sub
''' <summary>
''' Called when data is received from the server. This triggers the OnReceive callback.
''' </summary>
''' <param name="ar">The state of the socket</param>
''' <remarks></remarks>
Private Sub ReceiveCallback(ByVal ar As IAsyncResult)
'Logger.ToLog("AsyncClient.ReceiveCallback")
Dim state As StateObject = CType(ar.AsyncState, StateObject)
Dim cl As Socket = state.workSocket
Dim bytesRead As Integer = cl.EndReceive(ar)
If bytesRead > 0 Then
state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead))
cl.BeginReceive(state.buffer, state.offset, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReceiveCallback), state)
state.offset += bytesRead
Else
If state.sb.Length > 1 Then
response = state.sb.ToString()
End If
OnReceive(state)
receiveDone.Set()
End If
End Sub
''' <summary>
''' Begins sending data to the server
''' </summary>
''' <param name="cl">The socket to send data with</param>
''' <param name="data">The data to send</param>
''' <remarks></remarks>
Private Sub Send(ByVal cl As Socket, ByVal data As String)
'Logger.ToLog("AsyncClient.Send")
Dim byteData As Byte() = Encoding.ASCII.GetBytes(data)
cl.BeginSend(byteData, 0, byteData.Length, 0, New AsyncCallback(AddressOf SendCallback), cl)
End Sub
''' <summary>
''' Begins sending data to the server
''' </summary>
''' <param name="cl">The socket to send data with</param>
''' <param name="data">The data to send</param>
''' <remarks></remarks>
Private Sub Send(ByVal cl As Socket, ByVal data() As Byte)
'Logger.ToLog("AsyncClient.Send")
cl.BeginSend(data, 0, data.Length, 0, New AsyncCallback(AddressOf SendCallback), cl)
End Sub
''' <summary>
''' Called after data is sent to the server
''' </summary>
''' <param name="ar">The state of the connection</param>
''' <remarks></remarks>
Private Sub SendCallback(ByVal ar As IAsyncResult)
'Logger.ToLog("AsyncClient.SendCallback")
Dim cl As Socket = CType(ar.AsyncState, Socket)
If cl IsNot Nothing Then
Dim bytesSent As Integer = cl.EndSend(ar)
'Logger.ToLog("Sent {0} bytes to server.", bytesSent)
End If
sendDone.Set()
End Sub
End Class
|
Namespace AW.Types
Partial Public Class Address
Implements ITitledObject, INotEditableOncePersistent
Public Property AddressID() As Integer
#Region "City"
Public Property mappedCity As String
Friend myCity As TextString
<DemoProperty(Order:=13)>
Public ReadOnly Property City As TextString
Get
myCity = If(myCity, New TextString(mappedCity, Sub(v) mappedCity = v))
Return myCity
End Get
End Property
Public Sub AboutCity(a As FieldAbout, City As TextString)
Select Case a.TypeCode
Case AboutTypeCodes.Name
Case AboutTypeCodes.Usable
Case AboutTypeCodes.Valid
Case Else
End Select
End Sub
#End Region
#Region "PostalCode"
Public Property mappedPostalCode As String
Friend myPostalCode As TextString
<DemoProperty(Order:=14)>
Public ReadOnly Property PostalCode As TextString
Get
myPostalCode = If(myPostalCode, New TextString(mappedPostalCode, Sub(v) mappedPostalCode = v))
Return myPostalCode
End Get
End Property
Public Sub AboutPostalCode(a As FieldAbout, PostalCode As TextString)
Select Case a.TypeCode
Case AboutTypeCodes.Name
Case AboutTypeCodes.Usable
Case AboutTypeCodes.Valid
Case Else
End Select
End Sub
#End Region
#Region "AddressLine1"
Public Property mappedAddressLine1 As String
Friend myAddressLine1 As TextString
<DemoProperty(Order:=11)>
Public ReadOnly Property AddressLine1 As TextString
Get
myAddressLine1 = If(myAddressLine1, New TextString(mappedAddressLine1, Sub(v) mappedAddressLine1 = v))
Return myAddressLine1
End Get
End Property
Public Sub AboutAddressLine1(a As FieldAbout, AddressLine1 As TextString)
Select Case a.TypeCode
Case AboutTypeCodes.Name
Case AboutTypeCodes.Usable
Case AboutTypeCodes.Valid
Case Else
End Select
End Sub
#End Region
#Region "AddressLine2"
Public Property mappedAddressLine2 As String
Friend myAddressLine2 As TextString
<DemoProperty(Order:=12)>
Public ReadOnly Property AddressLine2 As TextString
Get
myAddressLine2 = If(myAddressLine2, New TextString(mappedAddressLine2, Sub(v) mappedAddressLine2 = v))
Return myAddressLine2
End Get
End Property
Public Sub AboutAddressLine2(a As FieldAbout, AddressLine2 As TextString)
Select Case a.TypeCode
Case AboutTypeCodes.Name
Case AboutTypeCodes.Usable
Case AboutTypeCodes.Valid
Case Else
End Select
End Sub
#End Region
Public Property StateProvinceID() As Integer
<DemoProperty(Order:=15)>
Public Overridable Property StateProvince() As StateProvince
#Region "ModifiedDate"
Public Property mappedModifiedDate As Date
Friend myModifiedDate As TimeStamp
<DemoProperty(Order:=99)>
Public ReadOnly Property ModifiedDate As TimeStamp
Get
myModifiedDate = If(myModifiedDate, New TimeStamp(mappedModifiedDate, Sub(v) mappedModifiedDate = v))
Return myModifiedDate
End Get
End Property
Public Sub AboutModifiedDate(a As FieldAbout)
Select Case a.TypeCode
Case AboutTypeCodes.Usable
a.Usable = False
End Select
End Sub
#End Region
Public Property RowGuid() As Guid
Public Function Title() As Title Implements ITitledObject.Title
Return New Title(ToString())
End Function
Public Overrides Function ToString() As String
Return $"{AddressLine1}..."
End Function
End Class
End Namespace |
Imports System
Imports System.Collections.Generic
Partial Public Class InfoFrais
Public Property Id As Long
Public Property GrilleId As Long
Public Property BornInf As Decimal
Public Property BornSup As Decimal
Public Property Frais As Decimal
Public Property Taux As Decimal
Public Overridable Property Grille As Grille
End Class
|
Namespace States
''' <summary>
''' (c) Martin Korneffel 2016
''' Zustand wird erreicht, wenn ein für das editieren ausgewählter Datensatz nicht editierbar ist
''' </summary>
''' <typeparam name="TID"></typeparam>
''' <typeparam name="TRecord"></typeparam>
''' <remarks></remarks>
Public MustInherit Class ERR_record_not_editable(Of TID, TRecord As IRecordWithProcessingStatus(Of TID))
Inherits Base
''' <summary>
''' Datensatz, der nicht editiert werden konnte
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public MustOverride ReadOnly Property Record As TRecord
''' <summary>
''' Begründung, warum der Datensatz nicht editierbar ist
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
Public MustOverride ReadOnly Property ErrorMessage As String
End Class
End Namespace
|
Public Class FrmDevolucionBodega
#Region "Controles"
Sub bloquearEncabezado()
txtSolicitante.Enabled = False
txtObservaciones.Enabled = False
cmbBodega.Enabled = False
cmbTipo.Enabled = False
cmbSalida.Enabled = False
End Sub
Sub desbloquearEncabezado()
txtSolicitante.Enabled = True
txtObservaciones.Enabled = True
cmbBodega.Enabled = True
cmbTipo.Enabled = True
cmbSalida.Enabled = True
End Sub
Sub limpiar()
txtSolicitante.Text = ""
txtObservaciones.Text = ""
cargarBodega(Nothing)
cargarTipo(Nothing)
dgvDetalle.DataSource = ""
dtFecha.Value = Today
End Sub
Function validarEncabezado() As Boolean
If String.IsNullOrEmpty(txtSolicitante.Text) Then
MsgBox("Ingrese solicitante", MsgBoxStyle.Exclamation, "Advertencia")
txtSolicitante.Focus()
Return False
ElseIf String.IsNullOrEmpty(txtObservaciones.Text) Then
MsgBox("Ingrese una observacion para realizar la devolucion", MsgBoxStyle.Exclamation, "Advertencia")
txtObservaciones.Focus()
Return False
ElseIf cmbBodega.SelectedValue <= 0 Then
MsgBox("Seleccione bodega", MsgBoxStyle.Exclamation, "Advertencia")
cmbBodega.Focus()
Return False
ElseIf cmbTipo.SelectedValue <= 0 Then
MsgBox("Seleccione tipo de salida", MsgBoxStyle.Exclamation, "Advertencia")
cmbTipo.Focus()
Return False
ElseIf cmbSalida.SelectedValue <= 0 Then
MsgBox("Seleccione salida de bodega, para operar devolucion", MsgBoxStyle.Exclamation, "Advertencia")
cmbSalida.Focus()
Return False
End If
Return True
End Function
Sub cargarBodega(Valor As Integer)
If Valor <> Nothing Then
With cmbBodega
.DataSource = clordenes.seleccionBodegaConsultaKardex()
.ValueMember = "Codigo"
.DisplayMember = "Descripcion"
.SelectedValue = Valor
End With
Else
With cmbBodega
.DataSource = clordenes.seleccionBodegaConsultaKardex()
.ValueMember = "Codigo"
.DisplayMember = "Descripcion"
End With
End If
End Sub
Sub cargarTipo(Valor As Integer)
If Valor <> Nothing Then
With cmbTipo
.DataSource = clsalidas.consultarTipoEnvio()
.ValueMember = "Codigo"
.DisplayMember = "Descripcion"
.SelectedValue = Valor
End With
Else
With cmbTipo
.DataSource = clsalidas.consultarTipoEnvio()
.ValueMember = "Codigo"
.DisplayMember = "Descripcion"
End With
End If
End Sub
Sub obtenerNumero()
txtNumero.Text = cldevoluciones.ultimoNumeroDevolucion()
End Sub
Sub cargarSalidas(Valor As Integer)
If Valor <> Nothing Then
With cmbSalida
.DataSource = cldevoluciones.consultarSalidasDeBodega(vBodega)
.ValueMember = "Numero"
.DisplayMember = "Observaciones"
.SelectedValue = Valor
End With
Else
With cmbSalida
.DataSource = cldevoluciones.consultarSalidasDeBodega(vBodega)
.ValueMember = "Numero"
.DisplayMember = "Observaciones"
End With
End If
End Sub
Function cargarDetalle() As Boolean
With dgvDetalle
.DataSource = cldevoluciones.consultarDetalleSalidasDeBodegaDevolver(CInt(cmbSalida.SelectedValue))
End With
If dgvDetalle.Rows.Count > 0 Then
renderizarGrid()
Else
MsgBox("Ya se ha realizado la devolucion total para esta salida", MsgBoxStyle.Exclamation, "Advertencia")
Return False
End If
Return True
End Function
Sub renderizarGrid()
With dgvDetalle
.Columns(3).Visible = False
.Columns(5).Visible = False
.Columns(0).ReadOnly = True
.Columns(1).ReadOnly = True
.Columns(2).ReadOnly = True
.Columns(3).ReadOnly = True
.Columns(4).ReadOnly = True
.Columns(5).ReadOnly = True
.Columns(6).ReadOnly = True
.Columns(0).Width = 65
.Columns(1).Width = 200
.Columns(2).Width = 50
.Columns(4).Width = 65
.Columns(6).Width = 110
.Columns(7).Width = 50
.Columns(8).Width = 65
.Columns(7).DefaultCellStyle.BackColor = Color.Khaki
.Columns(8).DefaultCellStyle.BackColor = Color.Khaki
End With
End Sub
Function validarCantidades() As Boolean
Dim dtVerificacion As DataTable = cldevoluciones.verificarCantidadesPendientesDevolucion(CInt(cmbSalida.SelectedValue))
For i As Integer = 0 To dgvDetalle.Rows.Count - 1
dgvDetalle.Rows(i).DefaultCellStyle.BackColor = Color.White
If CBool(dgvDetalle.Item(8, i).Value) = True Then
If Decimal.Round(CDec(dgvDetalle.Item(7, i).Value), 2) > 0 Then
For j As Integer = 0 To dtVerificacion.Rows.Count - 1
If dgvDetalle.Item(0, i).Value = dtVerificacion.Rows(j)(0) And dgvDetalle.Item(5, i).Value = dtVerificacion.Rows(j)(1) Then
If (CDec(dtVerificacion.Rows(j)(2).ToString()) - CDec(dgvDetalle.Item(7, i).Value)) < 0 Then
MsgBox("Producto " & dgvDetalle.Item(1, i).Value & " Centro " & dgvDetalle.Item(6, i).Value & " no puede realizar una devolucion mayor a la de salida", MsgBoxStyle.Exclamation, "Validacion")
dgvDetalle.Rows(i).DefaultCellStyle.BackColor = Color.Khaki
Return False
End If
End If
Next
Else
MsgBox("Producto " & dgvDetalle.Item(1, i).Value & " debe tener ingresado un numero mayor a cero, verifique decimales solamente pueden ser dos", MsgBoxStyle.Exclamation, "Validacion")
dgvDetalle.Rows(i).DefaultCellStyle.BackColor = Color.Khaki
Return False
End If
End If
Next
Return True
End Function
Function validarDatos() As Boolean
Dim validar As Integer = 0
For i As Integer = 0 To dgvDetalle.Rows.Count - 1
If CBool(dgvDetalle.Item(8, i).Value) = True Then
validar += 1
End If
Next
If validar = 0 Then
MsgBox("Debe seleccionar por lo menos un producto para realizar devoluciones", MsgBoxStyle.Exclamation, "Advertencia")
Return False
End If
Return True
End Function
Function guardarMaestro() As Boolean
If cldevoluciones.insertarMaestro(CInt(txtNumero.Text), CDate(dtFecha.Text), txtSolicitante.Text, CInt(cmbBodega.SelectedValue), txtObservaciones.Text, CInt(cmbTipo.SelectedValue), vCliente) Then
If cldevoluciones.insertarMovimientoMaestro(CInt(txtNumero.Text)) = False Then
Return False
End If
End If
Return True
End Function
Function guardarDetalle() As Boolean
For i As Integer = 0 To dgvDetalle.Rows.Count - 1
If CBool(dgvDetalle.Item(8, i).Value) = True Then
If cldevoluciones.insertarDetalle(CInt(txtNumero.Text), dgvDetalle.Item(0, i).Value, dgvDetalle.Item(1, i).Value, CDec(dgvDetalle.Item(7, i).Value), dgvDetalle.Item(5, i).Value, dgvDetalle.Item(6, i).Value) = False Then
Return False
End If
End If
Next
Return True
End Function
Function guardarMovimientoDetalle() As Boolean
If cldevoluciones.insertarMovimientoDetalle(CInt(txtNumero.Text), CInt(cmbBodega.SelectedValue)) = False Then
Return False
End If
Return True
End Function
Sub mostrarReporte()
Dim frm As New RptDevoluciones
With frm
.Numero = CInt(txtNumero.Text)
.WindowState = FormWindowState.Maximized
.Show()
End With
End Sub
#End Region
Private clsolicitud As New clSolicitudMateriales
Private clcentro As New clCentroCosto
Private clproducto As New clProductos
Private clordenes As New clOrdenesCompra
Private cldevoluciones As New clDevolucionBodega
Private clsalidas As New clSalidaBodega
Private vCliente As Integer = Nothing
Private vBodega As Integer = 0
Private Sub FrmDevolucionBodega_Load(sender As Object, e As EventArgs) Handles MyBase.Load
bloquearEncabezado()
cargarBodega(Nothing)
cargarTipo(Nothing)
End Sub
Private Sub cmbBodega_MouseWheel(sender As Object, e As MouseEventArgs) Handles cmbBodega.MouseWheel
If cmbBodega.DroppedDown Then
Exit Sub
Else
cmbBodega.SelectedIndex = -1
lblBodega.Focus()
End If
End Sub
Private Sub cmbBodega_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbBodega.SelectedIndexChanged
If cmbBodega.SelectedIndex > 0 Then
vBodega = cmbBodega.SelectedValue
cargarSalidas(Nothing)
Else
vBodega = 0
cargarSalidas(Nothing)
End If
End Sub
Private Sub btnNuevo_Click(sender As Object, e As EventArgs) Handles btnNuevo.Click
obtenerNumero()
desbloquearEncabezado()
btnNuevo.Visible = False
btnGuardar.Visible = True
btnSeleccion.Visible = True
End Sub
Private Sub btnSalir_Click(sender As Object, e As EventArgs) Handles btnSalir.Click
If dgvDetalle.Rows.Count > 0 Then
If MessageBox.Show("Existen datos ingresados desea salir sin guardar", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = Windows.Forms.DialogResult.Yes Then
Me.Close()
Else
Exit Sub
End If
Else
Me.Close()
End If
End Sub
Private Sub cmbSalida_KeyDown(sender As Object, e As KeyEventArgs) Handles cmbSalida.KeyDown
If e.KeyValue = Keys.Enter Then
If validarEncabezado() Then
If cargarDetalle() Then
bloquearEncabezado()
End If
End If
End If
End Sub
Private Sub btnSeleccion_Click(sender As Object, e As EventArgs) Handles btnSeleccion.Click
If dgvDetalle.Rows.Count > 0 Then
For i As Integer = 0 To dgvDetalle.Rows.Count - 1
dgvDetalle.Item(8, i).Value = True
Next
End If
End Sub
Private Sub cmbTipo_MouseWheel(sender As Object, e As MouseEventArgs) Handles cmbTipo.MouseWheel
If cmbTipo.DroppedDown Then
Exit Sub
Else
cmbTipo.SelectedIndex = -1
lblTipo.Focus()
End If
End Sub
Private Sub cmbSalida_MouseWheel(sender As Object, e As MouseEventArgs) Handles cmbSalida.MouseWheel
If cmbSalida.DroppedDown Then
Exit Sub
Else
cmbSalida.SelectedIndex = -1
lblSalida.Focus()
End If
End Sub
Private Sub btnLimpiar_Click(sender As Object, e As EventArgs) Handles btnLimpiar.Click
limpiar()
bloquearEncabezado()
btnNuevo.Visible = True
btnGuardar.Visible = False
btnSeleccion.Visible = False
End Sub
Private Sub btnGuardar_Click(sender As Object, e As EventArgs) Handles btnGuardar.Click
lblNumero.Focus()
If validarCantidades() Then
If validarDatos() Then
obtenerNumero()
BeginTransaction()
If guardarMaestro() Then
If guardarDetalle() Then
If guardarMovimientoDetalle() Then
If cldevoluciones.ejecutarPolizaDevolucion(CInt(txtNumero.Text)) Then
If cldevoluciones.insertarSalidasMovimientos(CInt(cmbBodega.SelectedValue), CInt(cmbSalida.SelectedValue), CInt(txtNumero.Text)) Then
CommitTransaction()
MsgBox("Devolucion realizada", MsgBoxStyle.Information, "Guardado")
If MessageBox.Show("Desa imprimir la devolucion", "Imprimir devolucion", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
mostrarReporte()
End If
btnLimpiar_Click(sender, e)
Else
RollBackTransaction()
MsgBox("No se pudieron grabar los datos, operacion no se realizara", MsgBoxStyle.Exclamation, "Advetencia")
End If
Else
RollBackTransaction()
MsgBox("No se pudieron grabar los datos, operacion no se realizara", MsgBoxStyle.Exclamation, "Advetencia")
End If
Else
RollBackTransaction()
MsgBox("No se pudieron grabar los datos, operacion no se realizara", MsgBoxStyle.Exclamation, "Advetencia")
End If
Else
RollBackTransaction()
MsgBox("No se pudieron grabar los datos, operacion no se realizara", MsgBoxStyle.Exclamation, "Advetencia")
End If
Else
RollBackTransaction()
MsgBox("No se pudieron grabar los datos, operacion no se realizara", MsgBoxStyle.Exclamation, "Advetencia")
End If
End If
End If
End Sub
Private Sub btnBuscar_Click(sender As Object, e As EventArgs) Handles btnBuscar.Click
If dgvDetalle.Rows.Count > 0 Then
If MessageBox.Show("Existen datos ingresados desea salir e ir a la busqueda?", "Ir a busqueda", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = Windows.Forms.DialogResult.Yes Then
Dim frm As New FrmBusquedaDevolucionBodega
With frm
.ControlBox = False
.Show()
.MdiParent = Me.MdiParent
.Location = New Point(302, 2)
End With
Me.Close()
Else
Exit Sub
End If
Else
Dim frm As New FrmBusquedaDevolucionBodega
With frm
.ControlBox = False
.Show()
.MdiParent = Me.MdiParent
.Location = New Point(302, 2)
End With
Me.Close()
End If
End Sub
Private Sub btnConsultar_Click(sender As Object, e As EventArgs) Handles btnConsultar.Click
If validarEncabezado() Then
If cargarDetalle() Then
bloquearEncabezado()
End If
End If
End Sub
End Class |
Module modServerTCP
Public obj_Server As Nading.Network.Server.clsServer
Public Sub InitServerTCP()
' Declare the new object to make sure we can make use of it in the project.
obj_Server = New Nading.Network.Server.clsServer
' Add event handlers to the Server Object that will determine what will happen in specific events.
AddHandler obj_Server.ServerStarted, AddressOf OnServerStarted
AddHandler obj_Server.ServerStopped, AddressOf OnServerStopped
AddHandler obj_Server.ClientConnected, AddressOf OnClientConnected
AddHandler obj_Server.ClientDisconnected, AddressOf OnClientDisconnected
AddHandler obj_Server.ClientPacketReceived, AddressOf OnClientPacketReceived
' Set the server's bind Address and Port to listen on. (passed on through the main initialization sub)
obj_Server.ServerBindIPAdress = obj_Options.ServerBindAddress
obj_Server.ServerBindPort = obj_Options.ServerBindPort
' Start the server listener. Make sure you don't turn on packet queues or the above event triggers will no longer work.
obj_Server.StartServer(False)
End Sub
Friend Sub OnServerStarted()
WriteToConsole("Server succesfully started!")
End Sub
Friend Sub OnServerStopped()
WriteToConsole("Server succesfully stopped!")
End Sub
Friend Sub OnClientConnected(ByVal Client As Guid)
Dim Slot As Integer
' Debug Info
WriteToConsole("Received connection on GUID: " + Client.ToString)
' Try to find an empty slot for this new user.
Slot = FindEmptySlot()
' Check if there was an open slot, 0 means no.
If Slot <> 0 Then
' We have a slot available, let's set the ServerGUID.
obj_TempPlayer(Slot).ServerGUID = Client
' Now pass on the slot to the player themselves.
SendClientSlot(Client, Slot)
' Check to see if this is above our current HighIndex. If so, set our new index to the current slot.
If Slot > var_PlayerHighIndex Then var_PlayerHighIndex = Slot
' Debug Info
WriteToConsole("GUID: " + Client.ToString + " assigned to Slot: " + Slot.ToString)
Else
' We'll need to disconnect our new friend. No slots available.
' First we'll notify them of this however.
SendSystemMessage(Client, SystemMessages.MsgError, "The server is full, please try again later!", "Server Full")
' No need to forcibly disconnect them. The client will kill its own connection since we sent an error message.
' Debug Info
WriteToConsole("GUID: " + Client.ToString() + " dropped, no more Slots.")
End If
End Sub
Friend Sub OnClientPacketReceived(ByVal Client As Guid, ByVal PacketType As Byte, ByVal Packet As String)
Dim Slot As Integer, PacketContent() As String
' Since our packet is encrypted, we should decrypt it before it all goes to hell.
Packet = Crypto.Decrypt(Packet, CRYPTO_KEY)
' Retrieve the slot info.
PacketContent = Split(Packet, SEP_SYMBOL)
Slot = PacketContent(0)
' Pass on the packet to our handler sub.
HandleIncomingPacket(Client, Slot, PacketType, Packet)
' Debug Info
WriteToConsole("Received PacketType: " + PacketType.ToString + " from Slot: " + Slot.ToString)
End Sub
Friend Sub OnClientDisconnected(ByVal Client As Guid)
Dim Slot As Integer
' We've lost connection to this player, so we'll save their changes to our database and clear the slot to be used by someone else.
' First we need to figure out the player slot though.
Slot = FindPlayerByGUID(Client)
' if the slot is non-existant then there's no need to clear it.
If Slot <> 0 Then
' We have a slot to save and clear.
' So let's get to saving their data!
SavePlayer(Slot)
' Clear out our slot for future use.
ClearPlayer(Slot)
' See if we need to recalculate our HighIndex.
If Slot = var_PlayerHighIndex Then
' Our HighIndex has left the game! Recalculate.
CalculateHighIndex()
End If
End If
' Debug Info
WriteToConsole("Lost connection on GUID: " + Client.ToString + " with Slot: " + Slot.ToString)
End Sub
Public Sub SendDataTo(ByVal Client As Guid, ByVal PacketType As Byte, ByVal Packet As String)
' Encrypt our data before we send it off.
Packet = Crypto.Encrypt(Packet, CRYPTO_KEY)
' Easy peasy, just pass on the data.
obj_Server.SendPacketToClient(Client, PacketType, Packet)
' Debug Info
WriteToConsole("Sent PacketType: " + PacketType.ToString + " to Slot: " + CStr(FindPlayerByGUID(Client)))
End Sub
Public Sub SendDataToAll(ByVal PacketType As Byte, ByVal Packet As String)
' Encrypt our data before we send it off.
Packet = Crypto.Encrypt(Packet, CRYPTO_KEY)
' Nading supports this by default, so no need to loop through stuff. :)
obj_Server.SendPacketToAllClients(PacketType, Packet)
' Debug Info
WriteToConsole("Sent PacketType: " + PacketType.ToString + " to All")
End Sub
Public Sub SendClientSlot(ByVal Client As Guid, ByVal Slot As Integer)
' This is a simple one, all we need to do is pass on the player slot to the client.
' There's a simple reason for this, instead of constantly figuring out what GUID belongs to which Array slot
' the player client will simply pass on their ID along with other data.
SendDataTo(Client, ServerPackets.SendClientSlot, Slot.ToString)
End Sub
Public Sub SendSystemMessage(ByVal Client As Guid, ByVal MessageType As Byte, ByVal Message As String, ByVal MessageTitle As String)
Dim Packet As String
' We'll be sending a system message to a client. It's fairly simple stuff.
' First let's build the packet though.
Packet = MessageType.ToString + SEP_SYMBOL + Message + SEP_SYMBOL + MessageTitle
' Now let's send it to our player.
SendDataTo(Client, ServerPackets.SendSystemMessage, Packet)
End Sub
Public Sub SendLoginResult(ByVal Slot As Integer)
Dim Packet As String
' Is the user verified or rejected?
If obj_TempPlayer(Slot).LoginStatus = LoginStatus.Verified Then
' Verified. This means we can send them the ol' "it's OK to move on" packet.
' Which also contains all the user's character data.
' Time to build up our packet. We'll be throwing in basic character data.
' This is going to be used in the character selection screen which is triggered from this
' message.
' TODO: Clean this up, it looks terrible.
With obj_Player(Slot)
Packet = .Character(1).Name _
+ SEP_SYMBOL + .Character(1).Job.ToString _
+ SEP_SYMBOL + .Character(1).Level.ToString _
+ SEP_SYMBOL + .Character(2).Name _
+ SEP_SYMBOL + .Character(2).Job.ToString _
+ SEP_SYMBOL + .Character(2).Level.ToString _
+ SEP_SYMBOL + .Character(3).Name _
+ SEP_SYMBOL + .Character(3).Job.ToString _
+ SEP_SYMBOL + .Character(3).Level.ToString
End With
' The packet has been constructed, we can send it over now.
SendDataTo(obj_TempPlayer(Slot).ServerGUID, ServerPackets.SendLoginOK, Packet)
ElseIf obj_TempPlayer(Slot).LoginStatus = LoginStatus.Rejected Then
' Rejected, we should let them know.
' The message is client-side, and generic.
' No data needed here.
Packet = ""
' Send it off!
SendDataTo(obj_TempPlayer(Slot).ServerGUID, ServerPackets.SendLoginFailure, Packet)
End If
End Sub
Public Sub SendCreateCharResult(ByVal Slot As Integer)
Dim Packet As String
' Time to build up our packet. We'll be throwing in basic character data.
' This is going to be used in the character selection screen which is triggered from this
' message.
' TODO: Clean this up, it looks terrible.
With obj_Player(Slot)
Packet = .Character(1).Name _
+ SEP_SYMBOL + .Character(1).Job.ToString _
+ SEP_SYMBOL + .Character(1).Level.ToString _
+ SEP_SYMBOL + .Character(2).Name _
+ SEP_SYMBOL + .Character(2).Job.ToString _
+ SEP_SYMBOL + .Character(2).Level.ToString _
+ SEP_SYMBOL + .Character(3).Name _
+ SEP_SYMBOL + .Character(3).Job.ToString _
+ SEP_SYMBOL + .Character(3).Level.ToString
End With
' Send data off!
SendDataTo(obj_TempPlayer(Slot).ServerGUID, ServerPackets.SendCreateCharResult, Packet)
End Sub
End Module
|
Imports System.Data.SqlClient
Imports Cerberus
Public Class MetodoPagoRuta
Implements InterfaceTablas
'VARIABLES DE LA TABLA
Public idMetodoPago As Integer
Public inicioKm As Decimal
Public finKm As Decimal
Public tipoMetodo As String
Public valorMetodo As Decimal
Public creadoPor As Integer
Public actualizado As DateTime
Public actualizadoPor As Integer
Public idEmpresa As Integer
Public idSucursal As Integer
Public idConceptoCuenta
'Variables y objetos adicionales
Private Ambiente As AmbienteCls
Private conex As ConexionSQL
Public edoDocs As EstadoDocumentos
Public objCuenta As Cuenta
Public objActualizadoPor As Empleado
Public idError As Integer
Public descripError As String
Public Sub New(Ambiente As AmbienteCls)
Me.Ambiente = Ambiente
Me.conex = Ambiente.conex
Me.edoDocs = New EstadoDocumentos
End Sub
Public Function getNombreMeotodo() As String
Dim nombre As String
nombre = ""
If tipoMetodo = "F" Then
nombre = "Fijo"
ElseIf tipoMetodo = "P" Then
nombre = "Porcentaje"
End If
Return nombre
End Function
Public Sub seteaDatos(rdr As SqlDataReader) Implements InterfaceTablas.seteaDatos
idMetodoPago = rdr("idMetodoPago")
inicioKm = rdr("inicioKm")
finKm = rdr("finKm")
tipoMetodo = rdr("tipoMetodo")
valorMetodo = rdr("valorMetodo")
creadoPor = rdr("creadoPor")
actualizado = rdr("actualizado")
actualizadoPor = rdr("actualizadoPor")
idEmpresa = rdr("idEmpresa")
idSucursal = rdr("idSucursal")
idConceptoCuenta = rdr("idConceptoCuenta")
End Sub
Public Sub cargarGridComp(listaObj As List(Of MetodoPagoRuta), dgv As DataGridView)
cargarGridGen(dgv, "", listaObj)
End Sub
Private Sub cargarGridGen(dgv As DataGridView, v As String, listaObj As List(Of MetodoPagoRuta))
Dim plantilla As MetodoPagoRuta
Dim dtb As New DataTable("MetodoPagoRuta")
Dim row As DataRow
dtb.Columns.Add("Inicio KM", Type.GetType("System.Decimal"))
dtb.Columns.Add("Fin KM", Type.GetType("System.Decimal"))
dtb.Columns.Add("Tipo Metodo", Type.GetType("System.String"))
dtb.Columns.Add("Valor Metodo", Type.GetType("System.Decimal"))
dtb.Columns.Add("Concepto PAGO", Type.GetType("System.String"))
listaObj.Clear()
conex.numCon = 0
conex.accion = "SELECT"
conex.agregaCampo("M.*")
conex.agregaCampo("C.NombreConceptoCuenta")
conex.tabla = "MetodoPagoRuta as M, ConceptoCuenta as C"
conex.condicion = "WHERE M.idConceptoCuenta = C.idConceptoCuenta AND M.idEmpresa = " & idEmpresa
conex.armarQry()
If conex.ejecutaConsulta() Then
While conex.reader.Read
plantilla = New MetodoPagoRuta(Ambiente)
plantilla.seteaDatos(conex.reader)
listaObj.Add(plantilla)
row = dtb.NewRow
row("Inicio KM") = plantilla.inicioKm
row("Fin KM") = plantilla.finKm
row("Tipo Metodo") = If(plantilla.tipoMetodo = "F", "Fijo", "Porcentaje")
row("Valor Metodo") = plantilla.valorMetodo
row("Concepto PAGO") = conex.reader("NombreConceptoCuenta")
dtb.Rows.Add(row)
End While
conex.reader.Close()
dgv.DataSource = dtb
'Es para no permitir el reordenado de las coulmnas
For i As Integer = 0 To dgv.Columns.Count - 1
dgv.Columns(i).SortMode = DataGridViewColumnSortMode.NotSortable
Next
Else
Mensaje.tipoMsj = TipoMensaje.Error
Mensaje.origen = "MetodoPagoRuta.cargarGridGen"
Mensaje.Mensaje = conex.descripError
Mensaje.ShowDialog()
End If
End Sub
Public Function guardar() As Boolean Implements InterfaceTablas.guardar
Return armaQry("INSERT", True)
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 = "MetodoPagoRuta"
conex.accion = accion
conex.agregaCampo("inicioKm", inicioKm, False, False)
conex.agregaCampo("finKm", finKm, False, False)
conex.agregaCampo("tipoMetodo", tipoMetodo, False, False)
conex.agregaCampo("valorMetodo", valorMetodo, False, False)
conex.agregaCampo("idEmpresa", idEmpresa, False, False)
conex.agregaCampo("idSucursal", idSucursal, False, False)
conex.agregaCampo("idConceptoCuenta", idConceptoCuenta, 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.condicion = "WHERE idMetodoPago=" & idMetodoPago
conex.armarQry()
If conex.ejecutaQry Then
If accion = "INSERT" Then
Return ObtenerID()
Else
Return True
End If
Else
idError = conex.idError
descripError = "Ruta.armaQry" & vbCrLf & conex.descripError
Return False
End If
Else
Return False
End If
End Function
Private Function ObtenerID() As Boolean
conex.numCon = 0
conex.Qry = "SELECT @@IDENTITY as ID"
If conex.ejecutaConsulta() Then
If conex.reader.Read Then
idMetodoPago = 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 actualizar() As Boolean Implements InterfaceTablas.actualizar
Return armaQry("UPDATE", False)
End Function
Public Function eliminar() As Boolean Implements InterfaceTablas.eliminar
Return armaQry("DELETE", False)
End Function
Public Function buscarPID() As Boolean Implements InterfaceTablas.buscarPID
conex.numCon = 0
conex.accion = "SELECT"
conex.tabla = "MetodoPagoRuta"
conex.agregaCampo("*")
conex.condicion = "WHERE idMetodoPago=" & idMetodoPago
conex.armarQry()
If conex.ejecutaConsulta() Then
seteaDatos(conex.reader)
conex.reader.Close()
Return True
Else
idError = conex.idError
descripError = conex.descripError
Return False
End If
End Function
Public Function buscarPKM(km As Decimal) As Boolean
'select * from MetodoPagoRuta where 90 between inicioKm and finKm
conex.numCon = 0
conex.accion = "SELECT"
conex.tabla = "MetodoPagoRuta"
conex.agregaCampo("*")
conex.condicion = "WHERE " & km & " between inicioKM and finKM"
conex.armarQry()
If conex.ejecutaConsulta() Then
'Es aquí
If conex.reader.Read Then
seteaDatos(conex.reader)
conex.reader.Close()
Return True
Else
idError = 1
descripError = "No se encontro el METODO con el KM indicado.."
conex.reader.Close()
Return False
End If
Else
idError = conex.idError
descripError = conex.descripError
Return False
End If
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
If inicioKm = Nothing Then
idError = 1
descripError = "El campo de inicio de KM es obligatorio"
Return False
End If
If finKm = Nothing Then
idError = 1
descripError = "El campo de Fin KM es obligatorio"
Return False
End If
If tipoMetodo = Nothing Then
idError = 1
descripError = "Eliga un tipo de Método"
Return False
End If
If valorMetodo = Nothing Then
idError = 1
descripError = "Ingrese el valor de método"
Return False
End If
If idConceptoCuenta = Nothing Then
idError = 1
descripError = "Seleccione un concepto de cuenta"
Return False
End If
If nuevo Then
creadoPor = Ambiente.usuario.idEmpleado
idEmpresa = Ambiente.empr.idEmpresa
idSucursal = Ambiente.suc.idSucursal
End If
actualizadoPor = Ambiente.usuario.idEmpleado
idEmpresa = Ambiente.empr.idEmpresa
idSucursal = Ambiente.suc.idSucursal
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
If objActualizadoPor Is Nothing Then
objActualizadoPor = New Empleado(Ambiente)
objActualizadoPor.idEmpleado = actualizadoPor
objActualizadoPor.buscarPID()
End If
Return objActualizadoPor
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.Configuration
Imports System.Data.SqlClient
Imports QuanLyDaiLy_DTO
Imports Utility
Public Class ChiTietPhieuXuat_DAL
Private connectionString As String
Public Sub New()
' Read ConnectionString value from App.config file
connectionString = ConfigurationManager.AppSettings("ConnectionString")
End Sub
Public Sub New(ConnectionString As String)
Me.connectionString = ConnectionString
End Sub
Public Function buildMaCTPX(ByRef nextMsctpx As String) As Result
Dim x As String = "CTPX-"
nextMsctpx = String.Empty
nextMsctpx = x + ""
Dim query As String = String.Empty
query &= "SELECT TOP 1 [MaChiTietPhieuXuat] "
query &= "FROM [tblChiTietPhieuXuat] "
query &= "ORDER BY [MaChiTietPhieuXuat] DESC "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
Dim msOnDB As String
msOnDB = Nothing
If reader.HasRows = True Then
While reader.Read()
msOnDB = reader("MaChiTietPhieuXuat")
End While
End If
' new ID = current ID + 1
Dim v = msOnDB.Substring(5)
Dim convertDecimal = Convert.ToDecimal(v)
convertDecimal = convertDecimal + 1
Dim tmp = convertDecimal.ToString()
tmp = tmp.PadLeft(msOnDB.Length - 5, "0")
nextMsctpx = nextMsctpx + tmp
System.Console.WriteLine(nextMsctpx)
Catch ex As Exception
conn.Close()
' them that bai!!!
nextMsctpx = 1
Return New Result(False, "Lấy ID kế tiếp của Chi Tiết Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function insert(ctpx As ChiTietPhieuXuat_DTO) As Result
Dim query As String = String.Empty
query &= "INSERT INTO [tblChiTietPhieuXuat] ([MaChiTietPhieuXuat], [MaPhieuXuat], [MaMatHang], [MaDonViTinh], [SoLuongXuat], [DonGia])"
query &= "VALUES (@MaChiTietPhieuXuat,@MaPhieuXuat,@MaMatHang,@MaDonViTinh,@SoLuongXuat,@DonGia)"
'get MSHS
Dim nextMactpx = "1"
buildMaCTPX(nextMactpx)
ctpx.MaChiTietPhieuXuat = nextMactpx
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaChiTietPhieuXuat", ctpx.MaChiTietPhieuXuat)
.Parameters.AddWithValue("@MaPhieuXuat", ctpx.MaPhieuXuat)
.Parameters.AddWithValue("@MaMatHang", ctpx.MaMatHang)
.Parameters.AddWithValue("@MaDonViTinh", ctpx.MaDonViTinh)
.Parameters.AddWithValue("@SoLuongXuat", ctpx.SoLuongXuat)
.Parameters.AddWithValue("@DonGia", ctpx.DonGia)
End With
Try
conn.Open()
comm.ExecuteNonQuery()
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Thêm Chi Tiết Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function selectALL(ByRef listChiTietPhieuXuat As List(Of ChiTietPhieuXuat_DTO)) As Result
Dim query As String = String.Empty
query &= "SELECT [MaChiTietPhieuXuat], [MaPhieuXuat], [MaMatHang], [MaDonViTinh], [SoLuongXuat], [DonGia] "
query &= "FROM [tblChiTietPhieuXuat]"
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
listChiTietPhieuXuat.Clear()
While reader.Read()
listChiTietPhieuXuat.Add(New ChiTietPhieuXuat_DTO(reader("MaChiTietPhieuXuat"), reader("MaPhieuXuat"), reader("MaMatHang"), reader("MaDonViTinh"), reader("SoLuongXuat"), reader("DonGia"), Tinh(reader("SoLuongXuat"), reader("DonGia"))))
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Lấy tất cả Chi Tiết Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function selectALL_ByMaMatHang(mamathang As Integer, ByRef listChiTietPhieuXuat As List(Of PhieuXuatDisplay)) As Result
Dim query As String = String.Empty
query &= "SELECT [MaChiTietPhieuXuat], [tblDaiLy].MaDaiLy, [TenDaiLy], [tblChiTietPhieuXuat].[MaPhieuXuat], [TenMatHang], [TenDonViTinh], [SoLuongXuat], [DonGia], [NgayLapPhieu] "
query &= "FROM [tblChiTietPhieuXuat], [tblPhieuXuat], [tblMatHang], [tblDonViTinh], [tblDaiLy] "
query &= "WHERE [tblChiTietPhieuXuat].MaMatHang = @MaMatHang AND [tblDaiLy].MaDaiLy = [tblPhieuXuat].MaDaiLy AND [tblChiTietPhieuXuat].MaPhieuXuat = [tblPhieuXuat].MaPhieuXuat AND [tblChiTietPhieuXuat].MaMatHang = [tblMatHang].MaMatHang AND [tblChiTietPhieuXuat].MaDonViTinh = [tblDonViTinh].MaDonViTinh "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaMatHang", mamathang)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
listChiTietPhieuXuat.Clear()
While reader.Read()
listChiTietPhieuXuat.Add(New PhieuXuatDisplay(reader("MaChiTietPhieuXuat"), reader("TenDaiLy"), reader("MaPhieuXuat"), reader("TenMathang"), reader("TenDonViTinh"), reader("SoLuongXuat"), reader("DonGia"), Tinh(reader("SoLuongXuat"), reader("DonGia")), reader("NgayLapPhieu"), Sum(reader("MaDaiLy"))))
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Lấy tất cả Chi Tiết Phiếu Xuất theo Mã Mặt Hàng không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function selectALL_ByMaPhieuXuat(maphieuxuat As Integer, ByRef listChiTietPhieuXuat As List(Of PhieuXuatDisplay)) As Result
Dim query As String = String.Empty
query &= "SELECT [MaChiTietPhieuXuat], [tblDaiLy].MaDaiLy, [TenDaiLy], [tblChiTietPhieuXuat].[MaPhieuXuat], [TenMatHang], [TenDonViTinh], [SoLuongXuat], [DonGia], [NgayLapPhieu] "
query &= "FROM [tblChiTietPhieuXuat], [tblPhieuXuat], [tblMatHang], [tblDonViTinh], [tblDaiLy] "
query &= "WHERE [tblChiTietPhieuXuat].MaPhieuXuat = @MaPhieuXuat AND [tblDaiLy].MaDaiLy = [tblPhieuXuat].MaDaiLy AND [tblChiTietPhieuXuat].MaPhieuXuat = [tblPhieuXuat].MaPhieuXuat AND [tblChiTietPhieuXuat].MaMatHang = [tblMatHang].MaMatHang AND [tblChiTietPhieuXuat].MaDonViTinh = [tblDonViTinh].MaDonViTinh "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaPhieuXuat", maphieuxuat)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
listChiTietPhieuXuat.Clear()
While reader.Read()
listChiTietPhieuXuat.Add(New PhieuXuatDisplay(reader("MaChiTietPhieuXuat"), reader("TenDaiLy"), reader("MaPhieuXuat"), reader("TenMathang"), reader("TenDonViTinh"), reader("SoLuongXuat"), reader("DonGia"), Tinh(reader("SoLuongXuat"), reader("DonGia")), reader("NgayLapPhieu"), Sum(reader("MaDaiLy"))))
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Lấy tất cả Chi Tiết Phiếu Xuất theo Mã Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function selectALL_ByMaDonViTinh(madonvitinh As Integer, ByRef listChiTietPhieuXuat As List(Of PhieuXuatDisplay)) As Result
Dim query As String = String.Empty
query &= "SELECT [MaChiTietPhieuXuat], [tblDaiLy].MaDaiLy, [TenDaiLy], [tblChiTietPhieuXuat].[MaPhieuXuat], [TenMatHang], [TenDonViTinh], [SoLuongXuat], [DonGia], [NgayLapPhieu]"
query &= "FROM [tblChiTietPhieuXuat], [tblPhieuXuat], [tblMatHang], [tblDonViTinh], [tblDaiLy] "
query &= "WHERE [tblChiTietPhieuXuat].MaDonViTinh = @MaDonViTinh AND [tblDaiLy].MaDaiLy = [tblPhieuXuat].MaDaiLy AND [tblChiTietPhieuXuat].MaPhieuXuat = [tblPhieuXuat].MaPhieuXuat AND [tblChiTietPhieuXuat].MaMatHang = [tblMatHang].MaMatHang AND [tblChiTietPhieuXuat].MaDonViTinh = [tblDonViTinh].MaDonViTinh "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaDonViTinh", madonvitinh)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
listChiTietPhieuXuat.Clear()
While reader.Read()
listChiTietPhieuXuat.Add(New PhieuXuatDisplay(reader("MaChiTietPhieuXuat"), reader("TenDaiLy"), reader("MaPhieuXuat"), reader("TenMathang"), reader("TenDonViTinh"), reader("SoLuongXuat"), reader("DonGia"), Tinh(reader("SoLuongXuat"), reader("DonGia")), reader("NgayLapPhieu"), Sum(reader("MaDaiLy"))))
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Lấy tất cả Chi Tiết Phiếu Xuất theo Mã Đơn Vị Tính không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function update(ctpx As ChiTietPhieuXuat_DTO) As Result
Dim query As String = String.Empty
query &= " UPDATE [tblChiTietPhieuXuat] SET"
query &= " [MaPhieuXuat] = @MaPhieuXuat "
query &= " ,[MaMatHang] = @MaMatHang "
query &= " ,[MaDonViTinh] = @MaDonViTinh "
query &= " ,[SoLuongXuat] = @SoLuongXuat "
query &= " ,[DonGia] = @DonGia "
query &= " WHERE "
query &= " [MaChiTietPhieuXuat] = @MaChiTietPhieuXuat "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaPhieuXuat", ctpx.MaPhieuXuat)
.Parameters.AddWithValue("@MaMatHang", ctpx.MaMatHang)
.Parameters.AddWithValue("@MaDonViTinh", ctpx.MaDonViTinh)
.Parameters.AddWithValue("@SoLuongXuat", ctpx.SoLuongXuat)
.Parameters.AddWithValue("@DonGia", ctpx.DonGia)
.Parameters.AddWithValue("@MaChiTietPhieuXuat", ctpx.MaChiTietPhieuXuat)
End With
Try
conn.Open()
comm.ExecuteNonQuery()
Catch ex As Exception
Console.WriteLine(ex.StackTrace)
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Cập nhật Chi Tiết Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function delete(maChiTietPhieuXuat As String) As Result
Dim query As String = String.Empty
query &= " DELETE FROM [tblChiTietPhieuXuat] "
query &= " WHERE "
query &= " [MaChiTietPhieuXuat] = @MaChiTietPhieuXuat "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaChiTietPhieuXuat", maChiTietPhieuXuat)
End With
Try
conn.Open()
comm.ExecuteNonQuery()
Catch ex As Exception
Console.WriteLine(ex.StackTrace)
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Xóa Chi Tiết Phiếu Xuất không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function demSoPhieuXuat(madl As String, ctpx As PhieuXuatDisplay) As Integer
Dim soluongxuat As Integer
Dim query As String = String.Empty
query &= "SELECT COUNT(DISTINCT [MaChiTietPhieuXuat]) AS soluong "
query &= "FROM [tblChiTietPhieuXuat], [tblDaiLy], [tblPhieuXuat] "
query &= "WHERE [tblDaiLy].MaDaiLy = @MadaiLy
AND [tblDaily].MaDaiLy = [tblPhieuXuat].MaDaiLy
And [tblPhieuXuat].MaPhieuXuat = [tblChiTietPhieuXuat].MaPhieuXuat "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaDaiLy", madl)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
While reader.Read()
soluongxuat = reader("soluong")
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return 0
Finally
conn.Close()
End Try
End Using
End Using
Return soluongxuat
End Function
Public Function selectBaoCao(month As Integer, year As Integer, listDS As List(Of PhieuXuatDisplay)) As Result
Dim query As String = String.Empty
query &= "SELECT DISTINCT [MaChiTietPhieuXuat], [tblDaiLy].MaDaiLy, [TenDaiLy], [SoLuongXuat], [DonGia] "
query &= "FROM [tblDaiLy], [tblPhieuXuat], [tblChiTietPhieuXuat] "
query &= "WHERE [tblPhieuXuat].MaDaiLy = [tblDaiLy].MaDaiLy AND [tblPhieuXuat].MaPhieuXuat = [tblChiTietPhieuXuat].MaPhieuXuat
AND MONTH([NgayLapPhieu]) = @Month AND YEAR([NgayLapPhieu]) = @Year "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@Month", month)
.Parameters.AddWithValue("@Year", year)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
listDS.Clear()
While reader.Read()
listDS.Add(New PhieuXuatDisplay(reader("MaChiTietPhieuXuat"), reader("MaDaiLy"), reader("TenDaiLy"), reader("SoLuongXuat"), reader("DonGia"), Tinh(reader("SoLuongXuat"), reader("DonGia"))))
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return New Result(False, "Lấy tất cả Đại Lý không thành công", ex.StackTrace)
End Try
End Using
End Using
Return New Result(True) ' thanh cong
End Function
Public Function Tinh(soluongxuat As Integer, dongia As Integer) As Integer
Dim thanhtien As Integer = soluongxuat * dongia
Return thanhtien
End Function
Public Function Sum(madl As String) As Integer
Dim tongtrigia As Integer
Dim query As String = String.Empty
query &= "SELECT SUM([tblChiTietPhieuXuat].DonGia * [tblChiTietPhieuXuat].SoLuongXuat) AS Tong "
query &= "FROM [tblChiTietPhieuXuat], [tblDaiLy], [tblPhieuXuat] "
query &= "WHERE [tblDaiLy].MaDaiLy = @MadaiLy
AND [tblDaily].MaDaiLy = [tblPhieuXuat].MaDaiLy
And [tblPhieuXuat].MaPhieuXuat = [tblChiTietPhieuXuat].MaPhieuXuat "
Using conn As New SqlConnection(connectionString)
Using comm As New SqlCommand()
With comm
.Connection = conn
.CommandType = CommandType.Text
.CommandText = query
.Parameters.AddWithValue("@MaDaiLy", madl)
End With
Try
conn.Open()
Dim reader As SqlDataReader
reader = comm.ExecuteReader()
If reader.HasRows = True Then
While reader.Read()
tongtrigia = reader("Tong")
End While
End If
Catch ex As Exception
conn.Close()
System.Console.WriteLine(ex.StackTrace)
Return 0
Finally
conn.Close()
End Try
End Using
End Using
Return tongtrigia
End Function
End Class
|
Imports System
Imports System.Collections.Generic
Imports System.Windows.Forms
Imports Neurotec.Biometrics.Client
Imports Neurotec.Images
Imports Neurotec.Licensing
Partial Public Class DetectFaces
Inherits UserControl
#Region "Public constructor"
Public Sub New()
InitializeComponent()
End Sub
#End Region
#Region "Private fields"
Private _image As NImage
Private _biometricClient As NBiometricClient
Private _isSegmentationActivated? As Boolean
#End Region
#Region "Public properties"
Public Property BiometricClient() As NBiometricClient
Get
Return _biometricClient
End Get
Set(ByVal value As NBiometricClient)
_biometricClient = value
End Set
End Property
#End Region
#Region "Private methods"
Private Sub SetBiometricClientParams()
_biometricClient.FacesMaximalRoll = CSng(cbRollAngle.SelectedItem)
_biometricClient.FacesMaximalYaw = CSng(cbYawAngle.SelectedItem)
If (Not _isSegmentationActivated.HasValue) Then
_isSegmentationActivated = NLicense.IsComponentActivated("Biometrics.FaceSegmentsDetection")
End If
_biometricClient.FacesDetectAllFeaturePoints = _isSegmentationActivated.Value
_biometricClient.FacesDetectBaseFeaturePoints = _isSegmentationActivated.Value
End Sub
Private Sub DetectFace(ByVal image As NImage)
If image Is Nothing Then
Return
End If
SetBiometricClientParams()
' Detect asynchroniously all faces that are suitable for face recognition in the image
_biometricClient.BeginDetectFaces(image, AddressOf OnDetectDone, Nothing)
End Sub
Private Sub OnDetectDone(ByVal r As IAsyncResult)
If InvokeRequired Then
BeginInvoke(New AsyncCallback(AddressOf OnDetectDone), r)
Else
Try
facesView.Face = _biometricClient.EndDetectFaces(r)
Catch ex As Exception
Utils.ShowException(ex)
End Try
End If
End Sub
#End Region
#Region "Private form events"
Private Sub DetectFacesLoad(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Try
Dim item As Single = _biometricClient.FacesMaximalRoll
Dim items As New List(Of Single)()
For i As Single = 15 To 180 Step 15
items.Add((i))
Next i
If (Not items.Contains(item)) Then
items.Add(item)
End If
items.Sort()
Dim index As Integer = items.IndexOf(item)
Dim j As Integer = 0
Do While j <> items.Count
cbRollAngle.Items.Add(items(j))
j += 1
Loop
cbRollAngle.SelectedIndex = index
item = _biometricClient.FacesMaximalYaw
items.Clear()
For i As Single = 15 To 90 Step 15
items.Add((i))
Next i
If (Not items.Contains(item)) Then
items.Add(item)
End If
items.Sort()
index = items.IndexOf(item)
j = 0
Do While j <> items.Count
cbYawAngle.Items.Add(items(j))
j += 1
Loop
cbYawAngle.SelectedIndex = index
Catch ex As Exception
Utils.ShowException(ex)
End Try
End Sub
Private Sub TsbOpenImageClick(ByVal sender As Object, ByVal e As EventArgs) Handles tsbOpenImage.Click
openFaceImageDlg.Filter = NImages.GetOpenFileFilterString(True, True)
If openFaceImageDlg.ShowDialog() = DialogResult.OK Then
If _image IsNot Nothing Then
_image.Dispose()
End If
_image = Nothing
Try
' Read image
_image = NImage.FromFile(openFaceImageDlg.FileName)
DetectFace(_image)
Catch ex As Exception
Utils.ShowException(ex)
End Try
End If
End Sub
Private Sub TsbDetectFacialFeaturesClick(ByVal sender As Object, ByVal e As EventArgs) Handles tsbDetectFacialFeatures.Click
Try
DetectFace(_image)
Catch ex As Exception
Utils.ShowException(ex)
End Try
End Sub
Private Sub CbYawAngleSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbYawAngle.SelectedIndexChanged
_biometricClient.FacesMaximalYaw = CSng(cbYawAngle.SelectedItem)
End Sub
Private Sub CbRollAngleSelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cbRollAngle.SelectedIndexChanged
_biometricClient.FacesMaximalRoll = CSng(cbRollAngle.SelectedItem)
End Sub
#End Region
End Class
|
Namespace Entity
Public Class Su_kien
Private _ID As Long
Private _ID_kh_tuan As Integer
Private _ID_phong As Integer
Private _ID_mon As Integer
Private _ID_bm As Integer
Private _ID_cb As Integer
Private _ID_lop As Integer
Private _Ten_phong As String
Private _Ky_hieu As String
Private _Ten_mon As String
Private _Ten As String
Private _Hoten_giaovien As String
Private _Ten_lop As String
Private _Ca_hoc As eCA_HOC
Private _Thu As eTHU
Private _Tiet As Integer
Private _So_tiet As Integer
Private _Loai_tiet As eLOAI_TIET
Private _Top_thu As Integer
Private _Da_xep_lich As Boolean
Private _Thieu_dulieu As Boolean
Private _Locked As Boolean
Public Sub New()
Me._ID = -1
Me._ID_kh_tuan = -1
Me._ID_phong = -1
Me._ID_mon = -1
Me._ID_bm = -1
Me._ID_cb = -1
Me._ID_lop = -1
Me._Ten_phong = ""
Me._Ky_hieu = ""
Me._Ten_mon = ""
Me._Ten = ""
Me._Hoten_giaovien = ""
Me._Ten_lop = ""
Me._Ca_hoc = eCA_HOC.KHONG_XAC_DINH
Me._Thu = eTHU.KHONG_XAC_DINH
Me._Tiet = -1
Me._So_tiet = 0
Me._Loai_tiet = eLOAI_TIET.KHONG_XAC_DINH
Me._Top_thu = 0
Me._Da_xep_lich = False
Me._Thieu_dulieu = False
Me._Locked = False
End Sub
Public Sub New(ByVal ID As Long, ByVal ID_kh_tuan As Integer, ByVal ID_phong As Integer, _
ByVal ID_mon As Integer, ByVal ID_bm As Integer, ByVal _ID_cb As Integer, _
ByVal ID_lop As Integer, ByVal Ten_phong As String, _
ByVal Ten_mon As String, ByVal Ten_giaovien As String, ByVal Hoten_giaovien As String, _
ByVal Ten_lop As String, ByVal Ca_hoc As eCA_HOC, _
ByVal Thu As eTHU, ByVal Tiet As Integer, _
ByVal So_tiet As Integer, ByVal Loai_tiet As eLOAI_TIET, ByVal Top_thu As Integer, ByVal Ky_hieu As String, _
ByVal Da_xep_lich As Boolean, ByVal Locked As Boolean)
Me._ID = ID
Me._ID_kh_tuan = ID_kh_tuan
Me._ID_phong = ID_phong
Me._ID_mon = ID_mon
Me._ID_bm = ID_bm
Me._ID_cb = _ID_cb
Me._ID_lop = ID_lop
Me._Ten_phong = Ten_phong
Me._Ky_hieu = Ky_hieu
Me._Ten_mon = Ten_mon
Me._Ten = Ten_giaovien
Me._Hoten_giaovien = Hoten_giaovien
Me._Ten_lop = Ten_lop
Me._Ca_hoc = Ca_hoc
Me._Thu = Thu
Me._Tiet = Tiet
Me._So_tiet = So_tiet
Me._Loai_tiet = Loai_tiet
Me._Top_thu = Top_thu
Me._Da_xep_lich = Da_xep_lich
Me._Thieu_dulieu = False
Me._Locked = Locked
End Sub
Public Property ID() As Long
Get
Return Me._ID
End Get
Set(ByVal Value As Long)
Me._ID = Value
End Set
End Property
Public Property ID_kh_tuan() As Long
Get
Return Me._ID_kh_tuan
End Get
Set(ByVal Value As Long)
Me._ID_kh_tuan = Value
End Set
End Property
Public Property ID_lop() As Integer
Get
Return Me._ID_lop
End Get
Set(ByVal Value As Integer)
Me._ID_lop = Value
End Set
End Property
Public Property ID_phong() As Integer
Get
Return Me._ID_phong
End Get
Set(ByVal Value As Integer)
Me._ID_phong = Value
End Set
End Property
Public Property ID_cb() As Integer
Get
Return Me._ID_cb
End Get
Set(ByVal Value As Integer)
Me._ID_cb = Value
End Set
End Property
Public Property ID_mon() As Integer
Get
Return Me._ID_mon
End Get
Set(ByVal Value As Integer)
Me._ID_mon = Value
End Set
End Property
Public Property ID_bm() As Integer
Get
Return Me._ID_bm
End Get
Set(ByVal Value As Integer)
Me._ID_bm = Value
End Set
End Property
Public Property Ten_lop() As String
Get
Return Me._Ten_lop
End Get
Set(ByVal Value As String)
Me._Ten_lop = Value
End Set
End Property
Public Property Ten_phong() As String
Get
Return Me._Ten_phong
End Get
Set(ByVal Value As String)
Me._Ten_phong = Value
End Set
End Property
Public Property Ten() As String
Get
Return Me._Ten
End Get
Set(ByVal Value As String)
Me._Ten = Value
End Set
End Property
Public Property Hoten_giaovien() As String
Get
Return Me._Hoten_giaovien
End Get
Set(ByVal Value As String)
Me._Hoten_giaovien = Value
End Set
End Property
Public Property Ky_hieu() As String
Get
Return Me._Ky_hieu
End Get
Set(ByVal Value As String)
Me._Ky_hieu = Value
End Set
End Property
Public Property Ten_mon() As String
Get
Return Me._Ten_mon
End Get
Set(ByVal Value As String)
Me._Ten_mon = Value
End Set
End Property
Public Property Ca_hoc() As eCA_HOC
Get
Return Me._Ca_hoc
End Get
Set(ByVal Value As eCA_HOC)
Me._Ca_hoc = Value
End Set
End Property
Public Property Thu() As eTHU
Get
Return Me._Thu
End Get
Set(ByVal Value As eTHU)
Me._Thu = Value
End Set
End Property
Public Property Tiet() As Integer
Get
Return Me._Tiet
End Get
Set(ByVal Value As Integer)
Me._Tiet = Value
End Set
End Property
Public Property So_tiet() As Integer
Get
Return Me._So_tiet
End Get
Set(ByVal Value As Integer)
Me._So_tiet = Value
End Set
End Property
Public Property Loai_tiet() As eLOAI_TIET
Get
Return Me._Loai_tiet
End Get
Set(ByVal Value As eLOAI_TIET)
Me._Loai_tiet = Value
End Set
End Property
Public Property Top_thu() As Integer
Get
Return Me._Top_thu
End Get
Set(ByVal Value As Integer)
Me._Top_thu = Value
End Set
End Property
Public Property Da_xep_lich() As Boolean
Get
Return Me._Da_xep_lich
End Get
Set(ByVal Value As Boolean)
Me._Da_xep_lich = Value
End Set
End Property
Public Property Thieu_dulieu() As Boolean
Get
Return Me._Thieu_dulieu
End Get
Set(ByVal Value As Boolean)
Me._Thieu_dulieu = Value
End Set
End Property
Public Property Locked() As Boolean
Get
Return Me._Locked
End Get
Set(ByVal Value As Boolean)
Me._Locked = Value
End Set
End Property
Public Function Clone() As Su_kien
Dim sk As New Su_kien
sk.ID = Me.ID
sk.ID_kh_tuan = Me.ID_kh_tuan
sk.ID_phong = Me.ID_phong
sk.ID_mon = Me.ID_mon
sk.ID_bm = Me.ID_bm
sk.ID_cb = Me.ID_cb
sk.ID_lop = Me.ID_lop
sk.Ten_phong = Me.Ten_phong
sk.Ky_hieu = Me.Ky_hieu
sk.Ten_mon = Me.Ten_mon
sk.Ten = Me.Ten
sk.Hoten_giaovien = Me.Hoten_giaovien
sk.Ten_lop = Me.Ten_lop
sk.Ca_hoc = Me.Ca_hoc
sk.Thu = Me.Thu
sk.Tiet = Me.Tiet
sk.So_tiet = Me.So_tiet
sk.Loai_tiet = Me.Loai_tiet
sk.Top_thu = Me.Top_thu
sk.Da_xep_lich = Me.Da_xep_lich
sk.Thieu_dulieu = Me.Thieu_dulieu
sk.Locked = Me.Locked
Return sk
End Function
End Class
End Namespace |
Imports System.Text
Imports System
Imports System.ComponentModel
Imports System.Security.Permissions
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
#If DEBUG Then
Public Class RollOverImage
Inherits System.Web.UI.WebControls.Image
#Else
<AspNetHostingPermission(SecurityAction.Demand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
AspNetHostingPermission(SecurityAction.InheritanceDemand, _
Level:=AspNetHostingPermissionLevel.Minimal), _
DefaultProperty("ImageRollOverUrl"), _
ToolboxData("<{0}:RollOverImage runat=""server""> </{0}:RollOverImage>")> _
<ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
Public Class RollOverImage
Inherits System.Web.UI.WebControls.Image
#End If
Private _imageRollOverUrl As String = ""
''' <summary>
''' Property to get/set the Image Roll Over URL
''' </summary>
''' <value>
''' String passed to the set method
''' Default Value: ""
''' </value>
''' <returns>
''' imageRollOverUrl string returned by the get method
''' </returns>
''' <remarks></remarks>
<System.ComponentModel.Description("Property to get/set the Image Roll Over URL"),Category("Appearance"), Bindable(True)> _
Public Property ImageRollOverUrl() As String
Get
Return _imageRollOverUrl
End Get
Set(ByVal value As String)
_imageRollOverUrl = value
End Set
End Property
Private Sub RollOverImage_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
RollOverImageInclude.RegisterJs(Me.Page)
End Sub
Private Sub RollOverImage_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
Me.Attributes.Add("srcover", ResolveClientUrl(ImageRollOverUrl))
End Sub
Private Class RollOverImageInclude
Inherits WebControl
Protected Overrides ReadOnly Property TagKey() _
As HtmlTextWriterTag
Get
Return HtmlTextWriterTag.Script
End Get
End Property
''' <summary>
'''
''' </summary>
''' <param name="page"></param>
''' <remarks></remarks>
<System.ComponentModel.Description("")> _
Public Shared Sub RegisterJs(ByRef page As Page)
Dim jQueryIncludeHeader As RollOverImageInclude = BaseClasses.Spider.spiderPageforType(page, GetType(RollOverImageInclude))
If jQueryIncludeHeader Is Nothing Then
BaseClasses.BaseVirtualPathProvider.registerVirtualPathProvider()
page.Header.Controls.Add(New RollOverImageInclude("text/javascript", "oodomimagerollover.js"))
End If
End Sub
''' <summary>
''' Constructor for the RollOverImage class
''' </summary>
''' <param name="type">
''' Type of script
''' </param>
''' <param name="filename">
''' Filename of script
''' </param>
''' <remarks></remarks>
<System.ComponentModel.Description("Constructor for the RollOverImage class")> _
Public Sub New(ByVal type As String, ByVal filename As String)
Me.Attributes.Add("type", type)
Me.Attributes.Add("src", BaseClasses.Scripts.ScriptsURL(True) & "DTIMiniControls/" & filename)
End Sub
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
writer.Write("<script type=""" & Me.Attributes("type") & """ src=""" & Me.Attributes("src") & """></script>")
End Sub
End Class
End Class
|
#Region "Microsoft.VisualBasic::75a4e0207708d985ae588165706e7511, mzkit\src\assembly\assembly\MarkupData\mzML\XML\mzML.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: 27
' Code Lines: 20
' Comment Lines: 0
' Blank Lines: 7
' File Size: 916 B
' Class mzML
'
' Properties: cvList, fileDescription, id, run, version
'
' Function: LoadChromatogramList, ToString
'
'
' /********************************************************************************/
#End Region
Imports System.Runtime.CompilerServices
Imports System.Xml.Serialization
Imports BioNovoGene.Analytical.MassSpectrometry.Assembly.MarkupData.mzML.ControlVocabulary
Namespace MarkupData.mzML
<XmlType(NameOf(mzML), [Namespace]:=indexedmzML.xmlns)>
Public Class mzML
<XmlAttribute> Public Property id As String
<XmlAttribute> Public Property version As String
Public Property cvList As cvList
Public Property run As run
Public Property fileDescription As fileDescription
''' <summary>
''' load all ion channels (works for MRM ion paire)
''' </summary>
''' <param name="path"></param>
''' <returns></returns>
<MethodImpl(MethodImplOptions.AggressiveInlining)>
Public Shared Function LoadChromatogramList(path As String) As IEnumerable(Of chromatogram)
Return MarkupData.mzML.LoadChromatogramList(path)
End Function
Public Overrides Function ToString() As String
Return id
End Function
End Class
End Namespace
|
Imports Microsoft.VisualBasic
Imports System
Imports System.Drawing
Imports System.IO
Imports System.Text
Imports System.Windows.Forms
Imports Neurotec.Biometrics
Partial Public Class DeduplicationPanel
Inherits ControlBase
#Region "Public constructor"
Public Sub New()
InitializeComponent()
End Sub
#End Region
#Region "Private fields"
Private _taskSender As TaskSender
Private _resultsFile As String
#End Region
#Region "Public methods"
Public Overrides Sub Cancel()
If (Not IsBusy) Then
Return
End If
_taskSender.Cancel()
btnCancel.Enabled = False
rtbStatus.AppendText(Constants.vbCrLf & "Canceling, please wait ..." & Constants.vbCrLf)
End Sub
Public Overrides ReadOnly Property IsBusy() As Boolean
Get
If _taskSender IsNot Nothing Then
Return _taskSender.IsBusy
End If
Return False
End Get
End Property
Public Overrides Function GetTitle() As String
Return "Deduplication"
End Function
#End Region
#Region "Private methods"
Private Sub EnableControls(ByVal isIdle As Boolean)
btnStart.Enabled = isIdle
btnCancel.Enabled = Not isIdle
gbProperties.Enabled = isIdle
End Sub
Private Delegate Sub AppendStatusDelegate(ByVal msg As String, ByVal color As Color)
Private Sub AppendStatus(ByVal msg As String, ByVal color As Color)
If InvokeRequired Then
Dim del As AppendStatusDelegate = AddressOf AppendStatus
BeginInvoke(del, msg, color)
Return
End If
rtbStatus.SelectionStart = rtbStatus.TextLength
rtbStatus.SelectionColor = color
rtbStatus.AppendText(msg)
rtbStatus.SelectionColor = rtbStatus.ForeColor
End Sub
Private Sub WriteLogHeader()
Dim line As String = "TemplateId, MatchedWith, Score, FingersScore, FingersScores, IrisesScore, IrisesScores"
If Accelerator IsNot Nothing Then
line &= ", FacesScore, FacesScores, VoicesScore, VoicesScores, PalmsScore, PalmsScores"
End If
line &= Constants.vbLf
File.WriteAllText(_resultsFile, line)
End Sub
Private Sub MatchingTasksCompleted(ByVal tasks() As NBiometricTask)
If tasks IsNot Nothing Then
Try
Dim text = New StringBuilder()
For Each task As NBiometricTask In tasks
For Each subject As NSubject In task.Subjects
If subject.MatchingResults IsNot Nothing AndAlso subject.MatchingResults.Count > 0 Then
For Each item As NMatchingResult In subject.MatchingResults
Dim line = New StringBuilder()
line.Append(String.Format("{0},{1},{2}", subject.Id, item.Id, item.Score))
Using details = New NMatchingDetails(item.MatchingDetailsBuffer)
line.Append(String.Format(",{0},", details.FingersScore))
For Each t As NFMatchingDetails In details.Fingers
line.Append(String.Format("{0};", t.Score))
Next t
line.Append(String.Format(",{0},", details.IrisesScore))
For Each t As NEMatchingDetails In details.Irises
line.Append(String.Format("{0};", t.Score))
Next t
line.Append(String.Format(",{0},", details.FacesScore))
For Each t As NLMatchingDetails In details.Faces
line.Append(String.Format("{0};", t.Score))
Next t
line.Append(String.Format(",{0},", details.VoicesScore))
For Each t As NSMatchingDetails In details.Voices
line.Append(String.Format("{0};", t.Score))
Next t
line.Append(String.Format(",{0},", details.PalmsScore))
For Each t As NFMatchingDetails In details.Palms
line.Append(String.Format("{0};", t.Score))
Next t
End Using
text.AppendLine(line.ToString())
Next item
Else
text.AppendLine(String.Format("{0},NoMatches", subject.Id))
End If
Next subject
task.Dispose()
Next task
File.AppendAllText(_resultsFile, text.ToString())
Catch ex As Exception
AppendStatus(String.Format("{0}" & Constants.vbCrLf, ex), Color.DarkRed)
End Try
End If
End Sub
Private Sub TaskSenderExceptionOccured(ByVal ex As Exception)
AppendStatus(String.Format("{0}" & Constants.vbCrLf, ex), Color.DarkRed)
End Sub
Private Sub TaskSenderFinished()
EnableControls(True)
lblRemaining.Text = String.Empty
pbarProgress.Value = pbarProgress.Maximum
If _taskSender.Successful Then
rtbStatus.AppendText("Deduplication completed without errors")
pbStatus.Image = My.Resources.ok
pbStatus.Image = pbStatus.Image
Else
rtbStatus.AppendText(If(_taskSender.Canceled, "Deduplication canceled.", "There were errors during deduplication"))
pbStatus.Image = My.Resources._error
pbStatus.Image = pbStatus.Image
End If
End Sub
Private Sub TaskSenderProgressChanged()
Dim numberOfTasksCompleted = _taskSender.PerformedTaskCount
Dim elapsed As TimeSpan = _taskSender.ElapsedTime
Dim remaining As TimeSpan = TimeSpan.FromTicks(elapsed.Ticks / numberOfTasksCompleted * (pbarProgress.Maximum - numberOfTasksCompleted))
If remaining.TotalSeconds < 0 Then
remaining = TimeSpan.Zero
End If
lblRemaining.Text = String.Format("Estimated time remaining: {0:00}.{1:00}:{2:00}:{3:00}", remaining.Days, remaining.Hours, remaining.Minutes, remaining.Seconds)
pbarProgress.Value = If(numberOfTasksCompleted > pbarProgress.Maximum, pbarProgress.Maximum, numberOfTasksCompleted)
lblProgress.Text = String.Format("{0} / {1}", numberOfTasksCompleted, pbarProgress.Maximum)
End Sub
#End Region
#Region "Private form events"
Private Sub BtnStartClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnStart.Click
Try
If IsBusy Then
Return
End If
rtbStatus.Text = String.Empty
pbStatus.Image = Nothing
lblProgress.Text = String.Empty
lblRemaining.Text = String.Empty
_resultsFile = tbLogFile.Text
WriteLogHeader()
pbarProgress.Value = 0
pbarProgress.Maximum = GetTemplateCount()
_taskSender.TemplateLoader = TemplateLoader
_taskSender.IsAccelerator = Accelerator IsNot Nothing
BiometricClient.MatchingWithDetails = True
_taskSender.BiometricClient = BiometricClient
_taskSender.Start()
EnableControls(False)
Catch ex As Exception
Utilities.ShowError(ex)
End Try
End Sub
Private Sub DeduplicationPanelLoad(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
Try
_taskSender = New TaskSender(BiometricClient, TemplateLoader, NBiometricOperations.Identify)
AddHandler _taskSender.ProgressChanged, AddressOf TaskSenderProgressChanged
AddHandler _taskSender.Finished, AddressOf TaskSenderFinished
AddHandler _taskSender.ExceptionOccured, AddressOf TaskSenderExceptionOccured
AddHandler _taskSender.MatchingTasksCompleted, AddressOf MatchingTasksCompleted
lblProgress.Text = String.Empty
lblRemaining.Text = String.Empty
Catch ex As Exception
Utilities.ShowError(ex)
End Try
End Sub
Private Sub BtnCancelClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnCancel.Click
Cancel()
End Sub
Private Sub BtnBrowseClick(ByVal sender As Object, ByVal e As EventArgs) Handles btnBrowse.Click
If openFileDialog.ShowDialog() = DialogResult.OK Then
tbLogFile.Text = openFileDialog.FileName
End If
End Sub
#End Region
End Class
|
Imports System.IO.Ports
Imports System.Threading
Public Class BrailleComLib
#Region "Constantes de comandos UART"
Public ReadOnly BCLS_HANDSHAKE As Byte = &HF0
Public ReadOnly BCLS_PREPARAR_IMPRESION As Byte = &HF1
Public ReadOnly BCLS_HOJA_NUMERO As Byte = &HF2
Public ReadOnly BCLS_HOJA_ACTUAL As Byte = &HF3
Public ReadOnly BCLS_ABORTAR As Byte = &HF4
Public ReadOnly BCLS_SACAR_HOJA As Byte = &HF5
Public ReadOnly BCLS_ESTADO_ACTUAL As Byte = &HF6
Public ReadOnly BCLR_CMD_VALIDO As Byte = &HF4
Public ReadOnly BCLR_CMD_INVALIDO As Byte = &HF5
Public ReadOnly BCLE_RECEPCION_OK As Byte = &HF6
Public ReadOnly BCLE_RECEPCION_ERROR As Byte = &HF7
Public ReadOnly UART_TIMEOUT As Byte = &HFD
'Respuestas dadas por eventos.
Public ReadOnly BCLE_EVENTO_PREFIX As Byte = &HF8 'Para indicar un evento de los de abajo:
Public ReadOnly BCLE_EVENTO_IMPRESION_OK As Byte = &HA1 'Para indicar que la hoja se termino de imprimir.
Public ReadOnly BCLE_EVENTO_IMPRESION_FAIL As Byte = &HA2 'Para indicar que hubo un Error al imprimir la hoja.
Public ReadOnly BCLE_EVENTO_SHUTDOWN As Byte = &HA3 'Para indicar que el usuario presiono el boton de apagado.
Public ReadOnly BCLE_EVENTO_LINEA_TERMINADA As Byte = &HA4 'Va acompañada de el numero de linea justo a continuacion.
#End Region
#Region "Inicializacion de objetos"
Private Shared SerialPort1 As New SerialPort
Public Impresora_Conectada As Boolean = False
Private hoja_mem As Hoja_c
Private _trabajoAct As TrabajoActual_c
Private _sender As Object
Private timer1 As Timer
Public Event impresion_ok() 'Evento alzado por la libreria , utilizar constantes de arriba.
Public Event impresion_fail(dato As Byte) 'Evento alzado por la libreria , utilizar constantes de arriba.
Public Event linea_terminada(dato As Byte) 'Evento alzado por la libreria , utilizar constantes de arriba.
Public Event shutdown() 'Evento alzado por la libreria , utilizar constantes de arriba.
Private Shared responseReceived As New ManualResetEvent(False)
#End Region
#Region "Conexion, desconexion y handshake"
Public Function Conectar_Impresora(ByVal Puerto As String) As ConnectionResponse
'Verificar si el driver SerialPort1 esta abierto y cerrarlo.
If SerialPort1.IsOpen Then
SerialPort1.Close()
End If
'Asignar nuevos valores a SerialPort1
SerialPort1 = New SerialPort With {
.PortName = Puerto,
.BaudRate = 115200,
.ReadBufferSize = 128,
.WriteBufferSize = 512,
.ReadTimeout = 200
}
AddHandler SerialPort1.DataReceived, AddressOf DataReceivedHandler
Try
'Abrir puerto
SerialPort1.Open()
Catch ex As Exception
Return New ConnectionResponse(False, "Error al abrir el puerto:" + vbNewLine + ex.Message)
End Try
'Enviar handshake
If Handshake() Then
Impresora_Conectada = True
Return New ConnectionResponse(True, "Se realizó la conexión con éxito.")
Else
Return New ConnectionResponse(False, "La impresora no responde, ¿Es ese el puerto correcto?")
End If
End Function
Public Sub Desconectar_Impresora()
If SerialPort1.IsOpen Then
SerialPort1.Close()
Impresora_Conectada = False
End If
End Sub
Public Function Handshake() As Boolean
'Si recibe esto la impresora, debe continuar su funcionamiento normal
Try
responseReceived.Reset()
SendCommand(BCLS_HANDSHAKE, 0)
Return GetResponse().Equals(BCLR_CMD_VALIDO)
Catch ex As Exception
Return False
End Try
End Function
#End Region
#Region "Rutinas varias"
Public Sub New(ByRef sender As Object, ByRef trabajoAct As Object)
_sender = sender
_trabajoAct = trabajoAct
End Sub
Public Function GetSerialComList() As List(Of String)
Dim SerialPortList As New List(Of String)(My.Computer.Ports.SerialPortNames)
Return SerialPortList
End Function
Public Function SendHojasTotales(Hojas As Byte)
Dim retorno As Boolean = False
SerialEventEnable = False
SendCommand(BCLS_HOJA_NUMERO, Hojas)
retorno = GetResponse().Equals(BCLR_CMD_VALIDO)
SerialEventEnable = True
Return retorno
End Function
Public Function SendHojaActual(Hoja As Byte)
Dim retorno As Boolean = False
SerialEventEnable = False
SendCommand(BCLS_HOJA_ACTUAL, Hoja)
retorno = GetResponse().Equals(BCLR_CMD_VALIDO)
SerialEventEnable = True
Return retorno
End Function
Public Function ConsultarEstadoActual() 'Si retorna 1, está imprimiendo.
SerialEventEnable = False
SendCommand(BCLS_ESTADO_ACTUAL, 0)
Dim response As Byte = GetResponse()
SerialEventEnable = True
If (response <> UART_TIMEOUT) Then
If response = 1 Then
Return True
Else
Return False
End If
Else
Return False
End If
End Function
Public Sub ReiniciarImpresora()
If Impresora_Conectada Then
SerialPort1.RtsEnable = True
Thread.Sleep(500)
SerialPort1.RtsEnable = False
Thread.Sleep(6000)
End If
End Sub
Public Function SacarHoja()
Dim retorno As Boolean = False
SerialEventEnable = False
SendCommand(BCLS_SACAR_HOJA, 0)
retorno = GetResponse().Equals(BCLR_CMD_VALIDO)
SerialEventEnable = True
Return retorno
End Function
Public Function PrepararImpresion()
Dim retorno As Boolean = False
SerialEventEnable = False
SendCommand(BCLS_PREPARAR_IMPRESION, 0)
retorno = GetResponse().Equals(BCLR_CMD_VALIDO)
SerialEventEnable = True
Return retorno
End Function
#End Region
#Region "Envio de hojas"
Public Function SendHoja(hoja As Hoja_c) As Boolean ' prepara la impresora para recibir el array, manda la hoja y espera el OK.
'Transferir BitMatrix a BitArray
Dim bitArray(hoja.BitMatrix.Length - 1) As Boolean
Dim index As Integer = 0
For y As Integer = hoja.BitMatrix.GetLowerBound(1) To hoja.BitMatrix.GetUpperBound(1)
For x As Integer = hoja.BitMatrix.GetLowerBound(0) To hoja.BitMatrix.GetUpperBound(0)
bitArray(index) = hoja.BitMatrix(x, y)
index += 1
Next
Next
'Convertir BitArray en ByteArray
Dim SerialSendBuffer(Math.Ceiling(hoja.BitMatrix.Length / 8) - 1) As Byte 'excluye byte de checksum
For Each dato In SerialSendBuffer
dato = 0
Next
For i As Integer = SerialSendBuffer.GetLowerBound(0) To SerialSendBuffer.GetUpperBound(0)
If (8 * i) <= bitArray.GetUpperBound(0) Then
If bitArray(8 * i) Then
SerialSendBuffer(i) += 1
End If
End If
If ((8 * i) + 1) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 1) Then
SerialSendBuffer(i) += 2
End If
End If
If ((8 * i) + 2) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 2) Then
SerialSendBuffer(i) += 4
End If
End If
If ((8 * i) + 3) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 3) Then
SerialSendBuffer(i) += 8
End If
End If
If ((8 * i) + 4) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 4) Then
SerialSendBuffer(i) += 16
End If
End If
If ((8 * i) + 5) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 5) Then
SerialSendBuffer(i) += 32
End If
End If
If ((8 * i) + 6) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 6) Then
SerialSendBuffer(i) += 64
End If
End If
If ((8 * i) + 7) <= bitArray.GetUpperBound(0) Then
If bitArray((8 * i) + 7) Then
SerialSendBuffer(i) += 128
End If
End If
Next
SendHojaActual(hoja.Numero)
PrepararImpresion()
Return SendArray(SerialSendBuffer)
End Function
Private Function SendArray(array() As Byte) As Boolean ' Retorna 1 si fue exitoso 0 si hubo algun error
'TODO: Cambiar tipo a UINT8 para definir retornos personalizados que indiquen checksum malo y demas.
'calculo del checksum
Dim csum_long As Long = 0
For Each dato In array
csum_long += dato
Next
Dim checksum(0) As Byte
checksum(0) = csum_long Mod 256
'envio del checksum
SerialEventEnable = False
SerialClearBuffer()
'envio de la hoja
SerialPort1.Write(array, 0, array.Count)
SerialPort1.Write(checksum, 0, 1)
Dim respuesta As Byte = GetResponse()
SerialEventEnable = True
If (respuesta = BCLE_RECEPCION_OK) Then
Return True
Else
Return False
End If
End Function
#End Region
#Region "Envio de datos"
Private Function SendCommand(ByVal cmd As Byte, ByVal val As Byte) As Boolean
Try
Dim SerialSendBuffer(1) As Byte
SerialSendBuffer(0) = cmd
SerialSendBuffer(1) = val
SerialPort1.Write(SerialSendBuffer, 0, 2)
Return True
Catch ex As Exception
Return False
End Try
End Function
#End Region
#Region "Recepcion de datos"
Private lastResponse() As Byte
Private SerialEventEnable As Boolean = True
Private Sub SerialClearBuffer()
SerialPort1.DiscardInBuffer()
responseReceived.Reset()
End Sub
Private Function GetResponse() As Byte 'lee un solo byte.
Try
Dim inputByte As Byte = SerialPort1.ReadByte
Return inputByte
Catch ex As Exception
Return UART_TIMEOUT
End Try
End Function
Private Sub DataReceivedHandler(sender As Object, e As SerialDataReceivedEventArgs)
If SerialEventEnable Then
Thread.Sleep(100)
Dim sp As SerialPort = CType(sender, SerialPort)
Try
If (sp.BytesToRead < 3) Then
Thread.Sleep(100)
End If
Dim InBuffer(sp.BytesToRead - 1) As Byte
Dim AssignedBytes As Integer = sp.Read(InBuffer, 0, sp.BytesToRead)
Dim InString As String = ""
For Each dato In InBuffer
InString += "{" + Hex(dato) + "}"
Next
Dim sn As ImpresoraBraille = CType(_sender, ImpresoraBraille)
sn.ListBox1.Items.Add(InString)
If AssignedBytes = 3 Then
If InBuffer(0) = BCLE_EVENTO_PREFIX Then
'el dato recibido es un evento.
Dim args As New StatusUpdateArgs(InBuffer(1), InBuffer(2))
SerialClearBuffer()
Select Case args.IdEvento
Case BCLE_EVENTO_IMPRESION_FAIL
RaiseEvent impresion_fail(args.Dato)
Case BCLE_EVENTO_IMPRESION_OK
RaiseEvent impresion_ok()
Case BCLE_EVENTO_LINEA_TERMINADA
RaiseEvent linea_terminada(args.Dato)
Case BCLE_EVENTO_SHUTDOWN
RaiseEvent shutdown()
End Select
End If
Else
lastResponse = InBuffer
responseReceived.Set()
End If
SerialPort1.DiscardInBuffer()
Catch ex As Exception
'MsgBox(ex.Message, MsgBoxStyle.Critical, "Error en ""DataReceivedHandler"":")
End Try
End If
End Sub
#End Region
#Region "Debug"
Private Sub DebugBitArray_arduino(hoja As Hoja_c)
Dim txt As String = "bool bitArray["
txt += (hoja.BitMatrix.GetUpperBound(0) + 1).ToString
txt += "]["
txt += (hoja.BitMatrix.GetUpperBound(1) + 1).ToString
txt += "] = {"
For y As Integer = hoja.BitMatrix.GetLowerBound(1) To hoja.BitMatrix.GetUpperBound(1)
If y > hoja.BitMatrix.GetLowerBound(1) Then
txt += " "
End If
For x As Integer = hoja.BitMatrix.GetLowerBound(0) To hoja.BitMatrix.GetUpperBound(0)
If hoja.BitMatrix(x, y) Then
txt += "1"
Else
txt += "0"
End If
If y < hoja.BitMatrix.GetUpperBound(1) Or x < hoja.BitMatrix.GetUpperBound(0) Then
txt += ", "
End If
Next
If y < hoja.BitMatrix.GetUpperBound(1) Then
txt += vbNewLine
End If
Next
txt += "};"
Dim SaveFileDialog1 As New SaveFileDialog With {
.DefaultExt = "*.c",
.Filter = "c program file|*.c",
.CreatePrompt = True
}
If SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
Using outputFile As New System.IO.StreamWriter(SaveFileDialog1.FileName)
outputFile.Write(txt)
End Using
End If
End Sub
Private Sub DebugArray(array() As Byte)
Dim txt As String = "uint8_t SerialSendBuffer["
txt += array.Count.ToString
txt += "] = {"
For i As Integer = array.GetLowerBound(0) To array.GetUpperBound(0)
txt += array(i).ToString
If i < array.GetUpperBound(0) Then
txt += ", "
End If
Next
txt += "};"
Dim SaveFileDialog1 As New SaveFileDialog With {
.DefaultExt = "*.c",
.Filter = "c program file|*.c",
.CreatePrompt = True
}
If SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK Then
Using outputFile As New System.IO.StreamWriter(SaveFileDialog1.FileName)
outputFile.Write(txt)
End Using
End If
End Sub
#End Region
#Region "Estructuras"
Public Structure StatusUpdateArgs
Dim IdEvento As Byte
Dim Dato As Byte
Public Sub New(idEvento As Byte, dato As Byte)
Me.IdEvento = idEvento
Me.Dato = dato
End Sub
End Structure
Public Structure ConnectionResponse
Dim result As Boolean
Dim message As String
Public Sub New(_result As Boolean, _message As String)
result = _result
message = _message
End Sub
End Structure
#End Region
End Class
|
Imports System.Runtime.InteropServices
Imports Electroduck.WinIt.DiskInternal
Public Class Harddisk
Inherits FileLike
Public Structure PartitionPrototype
Dim nLength As DataQuantity
'Dim nType As Byte
Dim bBootable As Boolean
'Public Const PARTTYPE_EXTENDED As Byte = &H5
'Public Const PARTTYPE_RAW As Byte = &H6
'Public Const PARTTYPE_NTFS As Byte = &H7
'Public Const PARTTYPE_FAT32_CHS As Byte = &HC
'Public Const PARTTYPE_FAT32 As Byte = &HC
'Public Const PARTTYPE_FAT16 As Byte = &HE
'Public Const PARTTYPE_NTFS_RECOVERY As Byte = &H27
'Public Const PARTTYPE_DYNAMICVOL As Byte = &H42
'Public Const PARTTYPE_GPT As Byte = &HEE
'Public Const PARTTYPE_EFI As Byte = &HEF
End Structure
Private mNumber As Integer
Private mGeometry As DiskGeometry
Private mInfoStringsRead As Boolean = False
Private mVendor As String
Private mProductID As String
Private mProductRev As String
Private mSerialNum As String
Public Sub New(nDisk As Integer)
MyBase.New(String.Format("\\.\PhysicalDrive{0}", nDisk), AccessLevel.Read Or AccessLevel.Write,
ShareMode.Read Or ShareMode.Write, CreationDisposition.OpenExisting)
mNumber = nDisk
End Sub
Public ReadOnly Property Number As Integer
Get
Return mNumber
End Get
End Property
Public Shared Function GetDiskList() As Harddisk()
Dim lstDisks As New List(Of Harddisk)
Dim bDone As Boolean = False
Dim nDisk As Integer = 0
Do
Try
lstDisks.Add(New Harddisk(nDisk))
Catch ex As Exception
Debug.WriteLine("Got error message """ & ex.Message & """, disk list complete.")
bDone = True
End Try
nDisk += 1
Loop Until bDone
Return lstDisks.ToArray
End Function
Private Sub CheckGeometry()
If mGeometry Is Nothing Then
mGeometry = New DiskGeometry
IOControl(IOCTL_DISK_GET_DRIVE_GEOMETRY, Nothing, mGeometry)
End If
End Sub
Public ReadOnly Property Size As DataQuantity
Get
CheckGeometry()
Return New DataQuantity(mGeometry.nCylinders * mGeometry.nTracksPerCylinder _
* mGeometry.nSectorsPerTrack * mGeometry.nBytesPerSector)
End Get
End Property
Public ReadOnly Property IsRemovable As Boolean
Get
CheckGeometry()
Return mGeometry.typeMedia <> MediaType.FixedMedia
End Get
End Property
Public ReadOnly Property GeometryDU As DiscUtils.Geometry
Get
CheckGeometry()
Return New DiscUtils.Geometry(CInt(mGeometry.nCylinders), CInt(mGeometry.nTracksPerCylinder),
CInt(mGeometry.nSectorsPerTrack), CInt(mGeometry.nBytesPerSector))
End Get
End Property
Private Sub CheckInfoStrings()
If Not mInfoStringsRead Then
Dim sddh As New StorageDeviceDescriptorHeader
Dim query As New StoragePropertyQuery With {
.prop = StoragePropertyID.StorageDeviceProperty,
.qtype = StorageQueryType.PropertyStandardQuery
}
Using blkQuery As New StructMemoryBlock(query)
Using blkResult As New StructMemoryBlock(sddh, 1024)
IOControl(IOCTL_STORAGE_QUERY_PROPERTY, blkQuery, blkResult)
blkResult.BlockToStructure(sddh)
mVendor = If(sddh.nVendorIDOffset, blkResult.ExtractASCIIZString(sddh.nVendorIDOffset), "")
mProductID = If(sddh.nProductIDOffset, blkResult.ExtractASCIIZString(sddh.nProductIDOffset), "")
mProductRev = If(sddh.nProductRevisionOffset, blkResult.ExtractASCIIZString(sddh.nProductRevisionOffset), "")
mSerialNum = If(sddh.nSerialNumberOffset, blkResult.ExtractASCIIZString(sddh.nSerialNumberOffset), "")
End Using
End Using
mInfoStringsRead = True
End If
End Sub
Public ReadOnly Property VendorID As String
Get
CheckInfoStrings()
Return mVendor
End Get
End Property
Public ReadOnly Property ProductID As String
Get
CheckInfoStrings()
Return mProductID
End Get
End Property
Public ReadOnly Property ProductRevision As String
Get
CheckInfoStrings()
Return mProductRev
End Get
End Property
Public ReadOnly Property SerialNumber As String
Get
CheckInfoStrings()
Return mSerialNum
End Get
End Property
Public ReadOnly Property Name As String
Get
If ProductID.Length > 0 Then
Return ProductID.Trim
ElseIf ProductRevision.Length > 0 Then
Return If(VendorID.Length, VendorID.Trim & " ", "Generic rev.") & ProductRevision.Trim
ElseIf SerialNumber.Length > 0 Then
Return If(VendorID.Length, VendorID.Trim & " ", "Generic SN ") & SerialNumber.Trim
ElseIf VendorID.Length Then
Return VendorID.Trim & " brand disk"
Else
Return "Generic disk"
End If
End Get
End Property
Private Function GenerateSignature() As Integer
Return CInt(Date.Now.ToBinary And &H7FFF_FFFF)
End Function
Public Sub ReinitializeMBR(Optional nSignature As Integer = -1)
If nSignature = -1 Then
nSignature = GenerateSignature()
End If
Dim cdMBR As New CreateDiskMBR With {.nSignature = nSignature}
IOControl(IOCTL_DISK_CREATE_DISK, cdMBR, Nothing)
End Sub
Public Sub RepartitionMBR(arrParts() As PartitionPrototype, Optional nSignature As Integer = -1)
If nSignature = -1 Then
nSignature = GenerateSignature()
End If
Dim infLayout As New DriveLayoutInformationMBR With {
.nPartitionCount = arrParts.Length,
.nSignature = nSignature
}
Dim nMBRMax As Long = DataQuantity.FromTerabytes(2).Bytes
Dim nSpacing As Long = DataQuantity.FromMegabytes(2).Bytes
Dim nDiskSize As Long = Size.Bytes
If nDiskSize > nMBRMax Then
nDiskSize = nMBRMax
End If
Dim nCurPos As Long = nSpacing
For nPart = 0 To arrParts.Length - 1
infLayout.arrPartitionEntries(nPart).nStartingOffset = nCurPos
infLayout.arrPartitionEntries(nPart).nPartitionLength _
= If(arrParts(nPart).nLength IsNot Nothing, arrParts(nPart).nLength, nDiskSize - (nCurPos + nSpacing))
infLayout.arrPartitionEntries(nPart).nPartitionNumber = nPart + 1
infLayout.arrPartitionEntries(nPart).nPartitionType = 6 'arrParts(nPart).nType
infLayout.arrPartitionEntries(nPart).bBootIndicator = arrParts(nPart).bBootable
infLayout.arrPartitionEntries(nPart).bRecognizedPartition = True
infLayout.arrPartitionEntries(nPart).bRewritePartition = True
nCurPos += infLayout.arrPartitionEntries(nPart).nPartitionLength + nSpacing
If nCurPos > nDiskSize Then
Throw New ArgumentOutOfRangeException("arrParts", "Not enough space on disk for all partitions")
End If
Next
IOControl(IOCTL_DISK_SET_DRIVE_LAYOUT, infLayout, Nothing)
End Sub
Public ReadOnly Property Partition(nPart As Integer) As Partition
Get
Return New Partition(Me, nPart)
End Get
End Property
Public Overrides ReadOnly Property Length As Long
Get
Dim infLength As New LengthInfo
IOControl(IOCTL_DISK_GET_LENGTH_INFO, Nothing, infLength)
Return infLength.nLength
End Get
End Property
End Class
|
Imports DevExpress.Xpf.Charts
Imports DevExpress.Mvvm
Imports System
Imports System.Windows.Input
Imports DevExpress.SalesDemo.Model
Namespace ProductsDemo
Public Enum SalesPerformanceViewMode
Daily
Monthly
End Enum
Public Class SalesPerformanceViewModel
Inherits ViewModelBase
Private mode_Renamed As SalesPerformanceViewMode
Private selectedDate_Renamed As Date = Date.Now
Private chartDataSource_Renamed As Object
Private selectedDateString_Renamed As String
Private argumentDataMember_Renamed As String
Private valueDataMember_Renamed As String
Private secondButtonText_Renamed As String
Private thirdButtonText_Renamed As String
Private firstSalesVolumeHeader_Renamed As String
Private secondSalesVolumeHeader_Renamed As String
Private thirdSalesVolumeHeader_Renamed As String
Private firstSalesVolume_Renamed As String
Private secondSalesVolume_Renamed As String
Private thirdSalesVolume_Renamed As String
Private axisXLabelFormatString_Renamed As String
Private areaSeriesCrosshairLabelPattern_Renamed As String
Private areaSeriesVisible_Renamed As Boolean
Private barSeriesVisible_Renamed As Boolean
Private chartSideMarginsEnabled_Renamed As Boolean
Private dateTimeMeasureUnit_Renamed As DateTimeMeasureUnit
Private dateTimeGridAlignment_Renamed As DateTimeGridAlignment
Private gridSpacing As Double
Private axisXMinorCount_Renamed As Integer
Private timeForwardCommand_Renamed As ICommand
Private timeBackwardCommand_Renamed As ICommand
Private setCurrentTimePeriodCommand_Renamed As ICommand
Private setLastTimePeriodCommand_Renamed As ICommand
Public Property Mode() As SalesPerformanceViewMode
Get
Return mode_Renamed
End Get
Set(ByVal value As SalesPerformanceViewMode)
SetProperty(mode_Renamed, value, "Mode", AddressOf OnModePropertyChanged)
End Set
End Property
Public Property SelectedDate() As Date
Get
Return selectedDate_Renamed
End Get
Set(ByVal value As Date)
SetProperty(selectedDate_Renamed, value, "SelectedDate", AddressOf OnSelectedDatePropertyChanged)
End Set
End Property
Public Property SelectedDateString() As String
Get
Return selectedDateString_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(selectedDateString_Renamed, value, "SelectedDateString")
End Set
End Property
Public Property ChartDataSource() As Object
Get
Return chartDataSource_Renamed
End Get
Set(ByVal value As Object)
SetProperty(chartDataSource_Renamed, value, "ChartDataSource")
End Set
End Property
Public Property ArgumentDataMember() As String
Get
Return argumentDataMember_Renamed
End Get
Set(ByVal value As String)
SetProperty(argumentDataMember_Renamed, value, "ArgumentDataMember")
End Set
End Property
Public Property ValueDataMember() As String
Get
Return valueDataMember_Renamed
End Get
Set(ByVal value As String)
SetProperty(valueDataMember_Renamed, value, "ValueDataMember")
End Set
End Property
Public Property SecondButtonText() As String
Get
Return secondButtonText_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(secondButtonText_Renamed, value, "SecondButtonText")
End Set
End Property
Public Property ThirdButtonText() As String
Get
Return thirdButtonText_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(thirdButtonText_Renamed, value, "ThirdButtonText")
End Set
End Property
Public Property FirstSalesVolumeHeader() As String
Get
Return firstSalesVolumeHeader_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(firstSalesVolumeHeader_Renamed, value, "FirstSalesVolumeHeader")
End Set
End Property
Public Property SecondSalesVolumeHeader() As String
Get
Return secondSalesVolumeHeader_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(secondSalesVolumeHeader_Renamed, value, "SecondSalesVolumeHeader")
End Set
End Property
Public Property ThirdSalesVolumeHeader() As String
Get
Return thirdSalesVolumeHeader_Renamed
End Get
Private Set(ByVal value As String)
SetProperty(thirdSalesVolumeHeader_Renamed, value, "ThirdSalesVolumeHeader")
End Set
End Property
Public Property FirstSalesVolume() As String
Get
Return firstSalesVolume_Renamed
End Get
Set(ByVal value As String)
SetProperty(firstSalesVolume_Renamed, value, "FirstSalesVolume")
End Set
End Property
Public Property SecondSalesVolume() As String
Get
Return secondSalesVolume_Renamed
End Get
Set(ByVal value As String)
SetProperty(secondSalesVolume_Renamed, value, "SecondSalesVolume")
End Set
End Property
Public Property ThirdSalesVolume() As String
Get
Return thirdSalesVolume_Renamed
End Get
Set(ByVal value As String)
SetProperty(thirdSalesVolume_Renamed, value, "ThirdSalesVolume")
End Set
End Property
Public Property AxisXLabelFormatString() As String
Get
Return axisXLabelFormatString_Renamed
End Get
Set(ByVal value As String)
SetProperty(axisXLabelFormatString_Renamed, value, "AxisXLabelFormatString")
End Set
End Property
Public Property AreaSeriesCrosshairLabelPattern() As String
Get
Return areaSeriesCrosshairLabelPattern_Renamed
End Get
Set(ByVal value As String)
SetProperty(areaSeriesCrosshairLabelPattern_Renamed, value, "AreaSeriesCrosshairLabelPattern")
End Set
End Property
Public Property AreaSeriesVisible() As Boolean
Get
Return areaSeriesVisible_Renamed
End Get
Set(ByVal value As Boolean)
SetProperty(areaSeriesVisible_Renamed, value, "AreaSeriesVisible", AddressOf OnSeriesVisibilityChanged)
End Set
End Property
Public Property BarSeriesVisible() As Boolean
Get
Return barSeriesVisible_Renamed
End Get
Set(ByVal value As Boolean)
SetProperty(barSeriesVisible_Renamed, value, "BarSeriesVisible", AddressOf OnSeriesVisibilityChanged)
End Set
End Property
Public Property ChartSideMarginsEnabled() As Boolean
Get
Return chartSideMarginsEnabled_Renamed
End Get
Set(ByVal value As Boolean)
SetProperty(chartSideMarginsEnabled_Renamed, value, "ChartSideMarginsEnabled")
End Set
End Property
Public Property DateTimeMeasureUnit() As DateTimeMeasureUnit
Get
Return dateTimeMeasureUnit_Renamed
End Get
Set(ByVal value As DateTimeMeasureUnit)
SetProperty(dateTimeMeasureUnit_Renamed, value, "DateTimeMeasureUnit")
End Set
End Property
Public Property DateTimeGridAlignment() As DateTimeGridAlignment
Get
Return dateTimeGridAlignment_Renamed
End Get
Set(ByVal value As DateTimeGridAlignment)
SetProperty(dateTimeGridAlignment_Renamed, value, "DateTimeGridAlignment")
End Set
End Property
Public Property AxisXGridSpacing() As Double
Get
Return gridSpacing
End Get
Set(ByVal value As Double)
SetProperty(gridSpacing, value, "AxisXGridSpacing")
End Set
End Property
Public Property AxisXMinorCount() As Integer
Get
Return axisXMinorCount_Renamed
End Get
Set(ByVal value As Integer)
SetProperty(axisXMinorCount_Renamed, value, "AxisXMinorCount")
End Set
End Property
Public Property TimeForwardCommand() As ICommand
Get
Return timeForwardCommand_Renamed
End Get
Private Set(ByVal value As ICommand)
SetProperty(timeForwardCommand_Renamed, value, "TimeForwardCommand")
End Set
End Property
Public Property TimeBackwardCommand() As ICommand
Get
Return timeBackwardCommand_Renamed
End Get
Private Set(ByVal value As ICommand)
SetProperty(timeBackwardCommand_Renamed, value, "TimeBackwardCommand")
End Set
End Property
Public Property SetCurrentTimePeriodCommand() As ICommand
Get
Return setCurrentTimePeriodCommand_Renamed
End Get
Set(ByVal value As ICommand)
SetProperty(setCurrentTimePeriodCommand_Renamed, value, "SetCurrentTimePeriodCommand")
End Set
End Property
Public Property SetLastTimePeriodCommand() As ICommand
Get
Return setLastTimePeriodCommand_Renamed
End Get
Set(ByVal value As ICommand)
SetProperty(setLastTimePeriodCommand_Renamed, value, "SetLastTimePeriodCommand")
End Set
End Property
Public Sub New()
OnModePropertyChanged()
TimeForwardCommand = New DelegateCommand(AddressOf OnTimeForwardCommandExecuted, AddressOf CanExecuteTimeForward)
TimeBackwardCommand = New DelegateCommand(AddressOf OnTimeBackwardCommandExecuted)
SetCurrentTimePeriodCommand = New DelegateCommand(AddressOf OnSetCurrentTimePeriodCommandExecuted)
SetLastTimePeriodCommand = New DelegateCommand(AddressOf OnSetLastTimePeriodCommandExecuted)
End Sub
Private Sub OnModePropertyChanged()
SecondButtonText = If(Mode = SalesPerformanceViewMode.Daily, "Yesterday", "Last Month")
ThirdButtonText = If(Mode = SalesPerformanceViewMode.Daily, "Today", "This Month")
FirstSalesVolumeHeader = If(Mode = SalesPerformanceViewMode.Daily, "TODAY", "THIS MONTH")
SecondSalesVolumeHeader = If(Mode = SalesPerformanceViewMode.Daily, "YESTERDAY", "LAST MONTH")
ThirdSalesVolumeHeader = If(Mode = SalesPerformanceViewMode.Daily, "LAST WEEK", "YTD")
OnSelectedDatePropertyChanged()
End Sub
Private Sub OnSelectedDatePropertyChanged()
Dim fomatString As String = If(Mode = SalesPerformanceViewMode.Daily, "d", "MMMM, yyyy")
SelectedDateString = SelectedDate.ToString(fomatString)
End Sub
Private Sub OnSeriesVisibilityChanged()
If AreaSeriesVisible AndAlso (Not BarSeriesVisible) Then
ChartSideMarginsEnabled = False
Else
ChartSideMarginsEnabled = True
End If
End Sub
Private Function IsCurrentMonth(ByVal [date] As Date) As Boolean
Dim now As Date = Date.Now
Return now.Year = [date].Year AndAlso now.Month = [date].Month
End Function
Private Function IsToday(ByVal [date] As Date) As Boolean
Dim now As Date = Date.Now
Return now.Year = [date].Year AndAlso now.Month = [date].Month AndAlso now.Day = [date].Day
End Function
Private Function CanExecuteTimeForward() As Boolean
If Mode = SalesPerformanceViewMode.Daily Then
Return Not IsToday(SelectedDate)
Else
Return Not IsCurrentMonth(SelectedDate)
End If
End Function
Private Sub OnTimeForwardCommandExecuted()
If Mode = SalesPerformanceViewMode.Daily Then
SelectedDate = SelectedDate.AddDays(1)
Else
SelectedDate = SelectedDate.AddMonths(1)
End If
End Sub
Private Sub OnTimeBackwardCommandExecuted()
If Mode = SalesPerformanceViewMode.Daily Then
SelectedDate = SelectedDate.AddDays(-1)
Else
SelectedDate = SelectedDate.AddMonths(-1)
End If
End Sub
Private Sub OnSetCurrentTimePeriodCommandExecuted()
SelectedDate = Date.Now
End Sub
Private Sub OnSetLastTimePeriodCommandExecuted()
If Mode = SalesPerformanceViewMode.Daily Then
SelectedDate = Date.Now.AddDays(-1)
Else
SelectedDate = Date.Now.AddMonths(-1)
End If
End Sub
Protected Overrides Sub OnInitializeInDesignMode()
MyBase.OnInitializeInDesignMode()
OnModePropertyChanged()
SelectedDate = Date.Now
Dim dataProvider As IDataProvider = New SampleDataProvider()
FirstSalesVolume = "1.1M"
SecondSalesVolume = "2.2M"
ThirdSalesVolume = "12.3M"
ValueDataMember = "TotalCost"
ArgumentDataMember = "StartOfPeriod"
ChartDataSource = dataProvider.GetSales(Date.Today.AddMonths(-1), Date.Today, GroupingPeriod.Day)
AreaSeriesVisible = True
End Sub
End Class
End Namespace
|
Imports FLEXYGO.Configuration.Tokens
Imports FLEXYGO.Objects
Imports FLEXYGO.Objects.Settings
Imports FLEXYGO.Security
Imports FLEXYGO.Data
Imports FLEXYGO.Web
Imports FLEXYGO.Mocks
Imports Sample_Project
<TestClass()> Public Class UnitTest
''' <summary>
''' The User name
''' </summary>
Friend UserName As String = My.Settings.UserName
''' <summary>
''' The configuration connection string
''' </summary>
Friend ConfConnString As String = My.Settings.ConfConnectionString
''' <summary>
''' The data cons string
''' </summary>
Friend DataConsString As String = My.Settings.DataConnectionString
''' <summary>
''' The user group
''' </summary>
Friend UserGroup As String = My.Settings.UserGroup
''' <summary>
''' The Settings database connection
''' </summary>
Friend ConfDBConnection As New UserConnection("ConfConnectionString", ConfConnString, 0)
''' <summary>
''' The data database connection
''' </summary>
Friend DataDBConnection As New UserConnection("DataConnectionString", DataConsString, 0)
''' <summary>
''' The User Connection Strings
''' </summary>
Friend _ConnectionStrings As New UserConnectionCollection(ConfDBConnection, DataDBConnection)
''' <summary>
''' The configuration token
''' </summary>
Friend _conftoken As New ConfToken(New UserConnectionCollection("ConfConnectionString", "DataConnectionString"), UserName)
''' <summary>
''' The User security Configuration
''' </summary>
Friend _ConfUserSecurity As UserSecurityConfig = _conftoken.UserSecurity
Public Sub New()
If System.Web.HttpContext.Current Is Nothing Then
HttpContextManager.SetCurrentContext(MockHelper.GetMockedHttpContext, UserName)
End If
End Sub
Public Sub SetConfToken(lConfToken As ConfToken, Optional HTMLFormat As Boolean = False)
Me.UserName = lConfToken.UserSecurity.UserName
Me.ConfConnString = lConfToken.ConfConnString
Me.DataConsString = lConfToken.UserSecurity.ConnectionStrings.MainDataConnString
Me.UserGroup = My.Settings.UserGroup
Me.ConfDBConnection = New UserConnection("ConfConnectionString", ConfConnString, 0)
Me.DataDBConnection = New UserConnection("DataConnectionString", DataConsString, 0)
Me._ConnectionStrings = New UserConnectionCollection(ConfDBConnection, DataDBConnection)
Me._conftoken = lConfToken
Me._ConfUserSecurity = lConfToken.UserSecurity
End Sub
<TestMethod()> Public Sub TestImageController()
If Not MySession.Contains("ConfToken") Then
GlobalVars.SetConfToken(_conftoken)
End If
Try
Dim ctl As New ahoraflexy.controllers.CarouselController
Dim res As List(Of FLEXYGO.Utilities.General.BaseCollection) = ctl.ReadImages()
For Each itm As FLEXYGO.Utilities.General.BaseCollection In res
Dim File As String = itm("File").ToString.Replace("~", My.Settings.Path).Replace("/", "\")
If Not System.IO.File.Exists(File) Then
Assert.Fail(String.Format("File {0} not found", File))
End If
Next
Catch ex As Exception
Assert.Fail("Error in TestEntityController:" + vbCrLf + ex.Message)
End Try
End Sub
End Class
|
'===============================================================================
' Microsoft patterns & practices
' CompositeUI Application Block
'===============================================================================
' Copyright © 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
' FITNESS FOR A PARTICULAR PURPOSE.
'===============================================================================
Imports Microsoft.VisualBasic
Imports System
Imports System.ComponentModel
Imports System.Runtime.Serialization
Imports System.Security.Permissions
Imports System.Diagnostics
''' <summary>
''' Provides a dictionary of information which provides notification when items change
''' in the collection. It is serialized with the <see cref="WorkItem"/> when the
''' <see cref="WorkItem"/> is saved and loaded.
''' </summary>
<Serializable()> _
Public Class State
Inherits StateElement
Implements ISerializable
Private innerHasChanged As Boolean
Private stateID As String
Private innerTraceSource As TraceSource = Nothing
''' <summary>
''' Sets the <see cref="TraceSource"/> to use for tracing messages.
''' </summary>
<ClassNameTraceSourceAttribute()> _
Public WriteOnly Property TraceSource() As TraceSource
Set(ByVal value As TraceSource)
innerTraceSource = value
End Set
End Property
''' <summary>
''' Initializes a new instance of the <see cref="State"/> class using a random ID.
''' </summary>
Public Sub New()
Me.New(Guid.NewGuid().ToString())
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="State"/> class using the provided ID.
''' </summary>
''' <param name="id">The ID for the state.</param>
Public Sub New(ByVal id As String)
Me.stateID = id
End Sub
''' <summary>
''' Initializes a new instance of the <see cref="State"/> class using the provided
''' serialization information.
''' </summary>
''' <param name="info">The <see cref="SerializationInfo"/> to populate with data.</param>
''' <param name="context">The destination (see <see cref="StreamingContext"/>) for this serialization. </param>
Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New(info, context)
Me.stateID = CStr(info.GetValue("id", GetType(String)))
End Sub
''' <summary>
''' Populates a System.Runtime.Serialization.SerializationInfo with the data
''' needed to serialize the target object.
''' </summary>
''' <param name="info">The System.Runtime.Serialization.SerializationInfo to populate with data.</param>
''' <param name="context">The destination <see cref="StreamingContext"/>
''' for this serialization.</param>
<SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.SerializationFormatter)> _
Public Overrides Sub GetObjectData(ByVal info As SerializationInfo, ByVal context As StreamingContext) 'Implements ISerializable.GetObjectData
MyBase.GetObjectData(info, context)
info.AddValue("id", Me.stateID)
End Sub
''' <summary>
''' Gets and sets the value of an element in the state.
''' </summary>
Default Public Shadows Property Item(ByVal key As String) As Object
Get
Return MyBase.Item(key)
End Get
Set(ByVal value As Object)
MyBase.Item(key) = value
End Set
End Property
''' <summary>
''' Resets the <see cref="HasChanges"/> flag.
''' </summary>
Public Sub AcceptChanges()
innerHasChanged = False
End Sub
''' <summary>
''' Gets whether the state has changed since it was initially created or
''' the last call to <see cref="AcceptChanges"/>.
''' </summary>
<DefaultValue(False)> _
Public ReadOnly Property HasChanges() As Boolean
Get
Return innerHasChanged
End Get
End Property
''' <summary>
''' Gets the state ID.
''' </summary>
Public ReadOnly Property ID() As String
Get
Return Me.stateID
End Get
End Property
''' <summary>
''' Raises the <see cref="StateElement.StateChanged"/> event and sets the <see cref="HasChanges"/> flag to true.
''' </summary>
Protected Overrides Sub OnStateChanged(ByVal e As StateChangedEventArgs)
If Not innerTraceSource Is Nothing Then
innerTraceSource.TraceInformation(My.Resources.TraceStateChangedMessage, stateID, e.Key)
End If
MyBase.OnStateChanged(e)
innerHasChanged = True
End Sub
Private Class ClassNameTraceSourceAttribute
Inherits TraceSourceAttribute
Public Sub New()
MyBase.New(GetType(State).FullName)
End Sub
End Class
End Class
|
Public Class ItemVenda : Implements ITotalizavel
Private ID As Integer
Private Produto As Produto
Private Valor As Decimal
Private Quantidade As Integer
Public Sub New()
End Sub
Public Sub New(ByVal Produto As Produto)
Me.Produto = Produto
End Sub
Public Sub New(ByVal Produto As Produto, ByVal Valor As Decimal, ByVal Quantidade As Integer)
Me.Produto = Produto
Me.Valor = Valor
Me.Quantidade = Quantidade
End Sub
Public Sub New(ByVal ID As Integer, ByVal Produto As Produto, ByVal Valor As Decimal, ByVal Quantidade As Integer)
Me.ID = ID
Me.Produto = Produto
Me.Valor = Valor
Me.Quantidade = Quantidade
End Sub
Public Function GetID() As Integer
Return ID
End Function
Public Sub SetID(ByVal ID As Integer)
Me.ID = ID
End Sub
Public Function GetProduto() As Produto
Return Produto
End Function
Public Sub SetProduto(ByVal Produto As Produto)
Me.Produto = Produto
End Sub
Public Function GetValor() As Decimal
Return Valor
End Function
Public Sub SetValor(ByVal Valor As Decimal)
Me.Valor = Valor
End Sub
Public Function GetQuantidade() As Integer
Return Quantidade
End Function
Public Sub SetQuantidade(ByVal Quantidade As Integer)
Me.Quantidade = Quantidade
End Sub
Public Function Total() As Decimal Implements ITotalizavel.Total
Return Valor * Quantidade
End Function
Public Overrides Function ToString() As String
Return "Produto: " + Produto.GetCódigo().ToString() + "; Valor: " + Valor.ToString() + "; Quantidade: " + Quantidade.ToString()
End Function
End Class
|
Imports System.IO
Public Class Form1
'MEMBERS
Private currentIndex As Integer
Private population As Integer
Private tree(1) As Person
Private adminKey As Boolean = False
'MEMBER FUNCTIONS
'manageOption
'Given an index, we manage the display of pictures and names
'Parameters:
' Integer i Index of the person from the data base
'Returns:
' void
Private Sub manageOption(ByVal i As Integer)
Label1.Text = "ID: " & i.ToString() 'Helps the developer to check indices from the database
'Reset components
cboxChildren.Items.Clear()
'Load the pictures
loadPictures(i)
'If the admin is logged in, then we must enable the addition and deletion buttons
If adminKey = True Then
buttonAddMember.Enabled = True
buttonAddMember.Visible = True
buttonAddSideMember.Enabled = True
buttonAddSideMember.Visible = True
End If
'Set the right name
labelName.Text = tree(i).getFullName()
'Navigation buttons are displayed depending on the category of the person (ancestor, non-parent or parent that is not an ancestor)
If tree(i).Children.Count = 0 Then
cboxChildren.Visible = False
cboxChildren.Enabled = False
labelFather.Text = "Father: " & tree(tree(i).FatherIndex).getFullName()
labelMother.Text = "Mother: " & tree(tree(i).MotherIndex).getFullName()
buttonChild.Enabled = False
buttonFather.Enabled = True
buttonMother.Enabled = True
ElseIf tree(i).IsAncestor Then
cboxChildren.Visible = True
cboxChildren.Enabled = True
cboxChildren.Text = tree(tree(i).Children(0)).getFullName()
For j As Integer = 0 To tree(i).Children.Count - 1
cboxChildren.Items.Add(tree(CType(tree(i).Children(j).ToString(), Integer)).getFullName())
Next
labelFather.Text = "Father: Unknown"
labelMother.Text = "Mother: Unknown"
buttonChild.Enabled = True
buttonFather.Enabled = False
buttonMother.Enabled = False
Else
cboxChildren.Visible = True
cboxChildren.Enabled = True
cboxChildren.Text = tree(tree(i).Children(0)).getFullName()
For j As Integer = 0 To tree(i).Children.Count - 1
cboxChildren.Items.Add(tree(CType(tree(i).Children(j).ToString(), Integer)).getFullName())
Next
labelFather.Text = "Father: " & tree(tree(i).FatherIndex).getFullName()
labelMother.Text = "Mother: " & tree(tree(i).MotherIndex).getFullName()
buttonChild.Enabled = True
buttonFather.Enabled = True
buttonMother.Enabled = True
End If
End Sub
'loadTree
'Load the family tree from the database
'Parameters:
' void
'Returns:
' void
Private Sub loadTree()
Dim i As Integer = 0
Dim j As Integer = 0
Dim auxString As String
Dim auxArray(1) As String
Dim ancestors As Integer = countLines("Surnames.txt")
population = countLines("Names.txt")
ReDim tree(population - 1)
Dim fIndices(population - 1) As Integer
Dim mIndices(population - 1) As Integer
Dim names(population - 1) As String
Dim surnames(ancestors - 1) As String
Dim additInfo(population - 1) As String
Dim fileNumber As Integer = FreeFile()
Dim namesFilePath As String = Application.StartupPath & "\Names.txt"
Dim surnamesFilePath As String = Application.StartupPath & "\Surnames.txt"
Dim indicesFilePath As String = Application.StartupPath & "\Parent_Indices.txt"
Dim additionalInfoFilePath As String = Application.StartupPath & "\Additional_Info.txt"
FileOpen(fileNumber, namesFilePath, OpenMode.Input)
Do Until EOF(fileNumber)
names(i) = LineInput(fileNumber)
i += 1
Loop
FileClose(fileNumber)
i = 0
fileNumber = FreeFile()
FileOpen(fileNumber, surnamesFilePath, OpenMode.Input)
Do Until EOF(fileNumber)
surnames(i) = LineInput(fileNumber)
i += 1
Loop
FileClose(fileNumber)
i = 0
fileNumber = FreeFile()
FileOpen(fileNumber, indicesFilePath, OpenMode.Input)
Do Until EOF(fileNumber)
auxString = LineInput(fileNumber)
auxArray = auxString.Split(" ")
fIndices(i) = CType(auxArray(0), Integer)
mIndices(i) = CType(auxArray(1), Integer)
i += 1
Loop
FileClose(fileNumber)
i = 0
fileNumber = FreeFile()
FileOpen(fileNumber, additionalInfoFilePath, OpenMode.Input)
Do Until EOF(fileNumber)
additInfo(i) = LineInput(fileNumber)
i += 1
Loop
FileClose(fileNumber)
i = 0
While i <> population
tree(i) = New Person(names(i), fIndices(i), mIndices(i), additInfo(i))
If fIndices(i) = mIndices(i) And fIndices(i) = 0 Then
tree(i).FatherName = surnames(j)
tree(i).IsAncestor = True
j += 1
ElseIf fIndices(i) = mIndices(i) Then
tree(i).FatherName = tree(fIndices(i)).FatherName
tree(i).MotherName = tree(mIndices(i)).MotherName
tree(tree(i).FatherIndex).AddChild(i)
Else
tree(tree(i).FatherIndex).AddChild(i)
tree(tree(i).MotherIndex).AddChild(i)
tree(i).FatherName = tree(fIndices(i)).FatherName
tree(i).MotherName = tree(mIndices(i)).FatherName
End If
i += 1
End While
End Sub
'countLines
'Counts the lines in a text file given its name
'Parameters:
' String txtFileName The name of the text file
'Returns:
' Integer c The number of lines that the text file has
Private Function countLines(ByVal txtFileName As String) As Integer
'Set auxiliar variables
Dim c As Integer = 0
Dim fileNumber As Integer = FreeFile()
Dim sTrash As String
Dim filePath As String = Application.StartupPath & "\" & txtFileName
'Open, traverse, and close
FileOpen(fileNumber, filePath, OpenMode.Input)
Do Until EOF(fileNumber)
sTrash = LineInput(fileNumber)
c += 1
Loop
FileClose(fileNumber)
Return c
End Function
'logIn
'Handles the log in of the user, there's an admin already set. The one who began this instance of the program
'Parameters:
' void
'Returns:
' void
Private Sub logIn()
'Enter name
Dim name As String = InputBox("Please enter you full name", "Log In")
Dim i As Integer = 0
'Find the guy
While i < population
If name.ToUpper() = tree(i).getFullName().ToUpper() Then
currentIndex = i
'THE ADMIN HAS TO BE PRE-DEFINED
If currentIndex = 6 Then
adminKey = True
End If
i = population
End If
i += 1
End While
'If we didn't find it, then we go to some random guy
If i = population Then
currentIndex = 1
End If
End Sub
'indexOf
'Gets the index from the database of the guy we're trying to find
'Parameters:
' String name Name of the guy we're looking for
'Returns:
' Integer i Index of the guy from the database (-1 if not found)
Private Function indexOf(ByVal name As String) As Integer
Dim i As Integer = 0
While i <> population
If tree(i).getFullName() = name Then
Return i
End If
i += 1
End While
Return -1
End Function
'addMember
'Adds a member to the tree, who's parents already belonged to the family
'Parameters:
' String name Name of the guy we're looking for
'Returns:
' Integer i Index of the guy from the database
Private Sub addMember(ByVal i As Integer)
Dim fileNumber As Integer = FreeFile()
Dim filePath As String = Application.StartupPath & "\" & "Names.txt"
'Print newline and name in the names file
FileOpen(fileNumber, filePath, OpenMode.Append)
Print(fileNumber, vbNewLine)
Print(fileNumber, tree(i).Name)
FileClose(fileNumber)
fileNumber = FreeFile()
filePath = Application.StartupPath & "\" & "Surnames.txt"
'Print newline and father name in the Surnames file (since he's not an ancestor, NOT supported yet)
FileOpen(fileNumber, filePath, OpenMode.Append)
Print(fileNumber, vbNewLine)
Print(fileNumber, tree(i).FatherName)
FileClose(fileNumber)
fileNumber = FreeFile()
filePath = Application.StartupPath & "\" & "Parent_Indices.txt"
'Print the father's and mother's index in the indices file
FileOpen(fileNumber, filePath, OpenMode.Append)
Print(fileNumber, vbNewLine)
Dim printIndices As String = tree(i).FatherIndex.ToString() & " " & tree(i).MotherIndex.ToString()
Print(fileNumber, printIndices)
'Print newline and gender in the additional information file
FileClose(fileNumber)
fileNumber = FreeFile()
filePath = Application.StartupPath & "\" & "Additional_Info.txt"
FileOpen(fileNumber, filePath, OpenMode.Append)
Print(fileNumber, vbNewLine)
Print(fileNumber, tree(i).Gender)
FileClose(fileNumber)
End Sub
'loadPictures
'Depending on the person, we display the pictures of himself and his/her parents (if applicable)
'Parameters:
' Integer i Index of the person
'Returns:
' void
Private Sub loadPictures(ByVal i As Integer)
Dim pictureFile As String = Application.StartupPath & "\Photos\" & tree(i).getFullName() & ".jpg"
Dim pictureFileF As String = Application.StartupPath & "\Photos\" & tree(tree(i).FatherIndex).getFullName() & ".jpg"
Dim pictureFileM As String = Application.StartupPath & "\Photos\" & tree(tree(i).MotherIndex).getFullName() & ".jpg"
'Try to find the guy's picture, if not found then we display the default picture
Try
picboxPhoto.Image = Image.FromFile(pictureFile)
Catch e As FileNotFoundException
If tree(i).Gender = "M" Then
pictureFile = Application.StartupPath & "\Photos\Default_Man.jpg"
picboxPhoto.Image = Image.FromFile(pictureFile)
Else
pictureFile = Application.StartupPath & "\Photos\Default_Woman.jpg"
picboxPhoto.Image = Image.FromFile(pictureFile)
End If
End Try
If tree(i).IsAncestor Then
picboxPhotoF.Visible = False
picboxPhotoF.Enabled = False
picboxPhotoM.Visible = False
picboxPhotoM.Enabled = False
Else
picboxPhotoF.Visible = True
picboxPhotoF.Enabled = True
picboxPhotoM.Visible = True
picboxPhotoM.Enabled = True
'Try to find the father's picture, if not found then we display the default picture
Try
picboxPhotoF.Image = Image.FromFile(pictureFileF)
Catch e As FileNotFoundException
If tree(tree(i).FatherIndex).Gender = "M" Then
pictureFile = Application.StartupPath & "\Photos\Default_Man.jpg"
picboxPhotoF.Image = Image.FromFile(pictureFile)
Else
pictureFile = Application.StartupPath & "\Photos\Default_Woman.jpg"
picboxPhotoF.Image = Image.FromFile(pictureFile)
End If
End Try
'Try to find the mother's picture, if not found then we display the default picture
Try
picboxPhotoM.Image = Image.FromFile(pictureFileM)
Catch e As FileNotFoundException
If tree(tree(i).MotherIndex).Gender = "M" Then
pictureFile = Application.StartupPath & "\Photos\Default_Man.jpg"
picboxPhotoM.Image = Image.FromFile(pictureFile)
Else
pictureFile = Application.StartupPath & "\Photos\Default_Woman.jpg"
picboxPhotoM.Image = Image.FromFile(pictureFile)
End If
End Try
End If
End Sub
'Form1_Load
'Loads the form1 by loading the tree from the database, log the user in and manage its profile
'Parameters:
' Object sender
' EventArgs e
'Returns:
' void
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
loadTree()
logIn()
manageOption(currentIndex)
End Sub
'buttonFather_Click
'Click to the button that takes us to the father
'Parameters:
' Object sender
' EventArgs e
'Returns:
' void
Private Sub buttonFather_Click(sender As Object, e As EventArgs) Handles buttonFather.Click
currentIndex = tree(currentIndex).FatherIndex
manageOption(currentIndex)
End Sub
'buttonMother_Click
'Click to the button that takes us to the mother
'Parameters:
' Object sender
' EventArgs e
'Returns:
' void
Private Sub buttonMother_Click(sender As Object, e As EventArgs) Handles buttonMother.Click
currentIndex = tree(currentIndex).MotherIndex
manageOption(currentIndex)
End Sub
'buttonChild_Click
'Click to the button that takes us to a child, determined by the selection
'From the combo box that contains the names of all the children
'The default child selected is the first one in the combo box
'Parameters:
' Object sender
' EventArgs e
'Returns:
' void
Private Sub buttonChild_Click(sender As Object, e As EventArgs) Handles buttonChild.Click
Try
currentIndex = tree(currentIndex).Children(cboxChildren.SelectedIndex)
Catch f As ArgumentOutOfRangeException
currentIndex = tree(currentIndex).Children(0)
End Try
manageOption(currentIndex)
End Sub
'buttonAddSideMember_Click
'Adds the spouse of an existing member, it's reachable if his/her spouse and him have a child and is later added
'Parameters:
' Object sender
' EventArgs e
'Returns:
' void
Private Sub buttonAddSideMember_Click(sender As Object, e As EventArgs) Handles buttonAddSideMember.Click
Dim relative As String = InputBox("Enter the name of the full name of the husband or wife belonging to the family", "Add Side Family Member")
Dim relIndex As Integer = indexOf(relative)
If relIndex <> -1 Then
Dim nameLogging As String = InputBox("Please enter the names only", "Add Side Member")
Dim lastnameLogging As String = InputBox("Please enter the last name only", "Add Side Member")
Dim gender As String = InputBox("Please enter the gender: (M) for men and (W) for women", "Add Side Member")
population += 1
ReDim Preserve tree(population - 1)
tree(population - 1) = New Person(nameLogging, 0, 0, gender)
tree(population - 1).IsAncestor = True
tree(population - 1).FatherName = lastnameLogging
addMember(population - 1)
Else
MsgBox("The family member you provided doesn't exist yet", MsgBoxStyle.OkOnly, "Unsuccessful Addition")
End If
End Sub
'buttonAddMember_Click
'Adds a member that is descendant from existing (in the tree) parents
'Parameters:
' Object sender
' EventArgs e
'Returns:
Private Sub buttonAddMember_Click(sender As Object, e As EventArgs) Handles buttonAddMember.Click
Dim father As String = InputBox("Enter the name of the full name of the father", "Add Family Member")
Dim mother As String = InputBox("Enter the name of the full name of the mother", "Add Family Member")
Dim dadIndex As Integer = indexOf(father)
Dim momIndex As Integer = indexOf(mother)
If dadIndex <> -1 And momIndex <> -1 Then
Dim nameLogging As String = InputBox("Please enter the name only", "Add Family Member")
Dim gender As String = InputBox("Please enter the gender: (M) for men and (W) for women", "Add Family Member")
population += 1
ReDim Preserve tree(population - 1)
tree(population - 1) = New Person(nameLogging, dadIndex, momIndex, gender)
tree(population - 1).FatherName = tree(dadIndex).FatherName
tree(population - 1).MotherName = tree(momIndex).FatherName
tree(dadIndex).AddChild(population - 1)
tree(momIndex).AddChild(population - 1)
addMember(population - 1)
Else
MsgBox("The father or mother of the family member you were about to provide doesn't exist", MsgBoxStyle.OkOnly, "Unsuccessful Addition")
End If
End Sub
End Class |
#Region "Notes"
' Each instance of this class represents a service (cart, inventory, whatever)
' A "service" consists of a single entry in the AccountTypeCode table with a Type of Service
' and a Dataset of configuration values for the service.
' Each Dataset contains one or more data tables exposed through this class
' Each table is named as the Group value
' Each table is exposed as a hashtable through this class
' Each hashtable is referenced by table name (which is Group value)
'tasks:
'fetch dataset based on code
'loop thru dataset creating hashtables
'how to identify
#End Region
Imports ASi.DataAccess.SqlHelper
Imports ASi.LogEvent.LogEvent
Public Class Service
Inherits BaseConfigSettings
Private Const APP_NAME As String = "ASi.AccountBO"
Private Const PROCESS As String = "Service"
Private _LogEventBO As ASi.LogEvent.LogEvent
Private _ConnectString As String = ""
Private _AccountID As Integer = 0
Private _ServiceCode As String = ""
Public ReadOnly Property ConnectString() As String
Get
Return _ConnectString
End Get
End Property
Public ReadOnly Property AccountID() As Integer
Get
Return _AccountID
End Get
End Property
Public ReadOnly Property ServiceCode() As String
Get
Return _ServiceCode
End Get
End Property
Public Sub New(ByVal ConnectString As String, ByVal AccountID As Integer, ByVal ServiceCode As String)
MyBase.New(ConnectString, AccountID, ServiceCode)
_ConnectString = ConnectString
_AccountID = AccountID
_ServiceCode = ServiceCode
Try
_LogEventBO = New ASi.LogEvent.LogEvent
Catch ex As Exception
'consider throwing this error
'if not, component may work w/out logging
'if so, component will fail
End Try
'MyBase.RefreshDataset()
End Sub
#Region "Private"
Private Sub _LogEvent(ByVal Src As String, ByVal Msg As String, ByVal Type As ASi.LogEvent.LogEvent.MessageType)
Try
_LogEventBO.LogEvent(APP_NAME, Src, Msg, Type, LogType.Queue)
Catch ex As Exception
_LogEventBO.LogEvent(APP_NAME, Src, Msg, Type, LogType.SystemEventLog)
End Try
End Sub
#End Region
End Class
|
Imports System
Imports System.Net.NetworkInformation
Imports System.Collections.Generic
Imports Ladle.Module.XPO
Imports Ladle.Utils
Imports Ladle.AppLogger
Imports System.Data.SqlClient
Imports System.Linq
Public Class NetworkDeviceStatsTask
Inherits Task
Private FirstRun As Boolean = True
''' <summary>
'''
''' </summary>
''' <remarks></remarks>
Public Sub New()
MyBase.New()
Name = "NetworkDeviceStats"
RepeatEvery = 1000 * 60 * 5 ' Every 5 minutes
End Sub
''' <summary>
'''
''' </summary>
''' <remarks></remarks>
Public Overrides Sub OnExecute()
InProgress = True
If Not (FirstRun) Then
Logger.ToLog("Checking network devices ...")
Using conn As SqlConnection = New SqlConnection(SharedAppSettings.Instance.TPF_ConnectionString)
conn.Open()
Dim devs As List(Of Device_Host) = Device_Host.SelectAll(conn)
For Each d As Device_Host In devs
d.Ping(4, 1000, AddressOf PingCompleted)
Next
End Using
Logger.ToLog("Task {0} took {1} ms", Name, GetCurrentExecutionPeriod())
End If
FirstRun = False
InProgress = False
End Sub
Public Sub PingCompleted(sender As Object, e As PingCompletedEventArgs)
Dim dh As Device_Host = DirectCast(e.UserState, Device_Host)
Dim dp As Device_Ping = Nothing
If dh IsNot Nothing Then
If e.Reply IsNot Nothing Then
dp = New Device_Ping() With {
.DeviceId = dh.Id,
.Success = True,
.Status = e.Reply.Status.ToString(),
.RoundTripTime = e.Reply.RoundtripTime
}
dh.PingStats.Add(dp)
Else
dp = New Device_Ping() With {.Success = False}
dh.PingStats.Add(dp)
End If
If dp IsNot Nothing Then
dh.SaveObject(Of Device_Ping)(dp)
End If
End If
End Sub
End Class
|
Imports NXOpen
Imports NXOpen.Features
Public Class BodyFeatureSurrogate
Inherits FeatureSurrogate
Private nxBodyFeature As BodyFeature
Public Sub New(ByVal featureRef As BodyFeature)
MyBase.New(featureRef)
Me.nxBodyFeature = featureRef
End Sub
Public ReadOnly Property Bodies() As Body()
Get
Return Me.nxBodyFeature.GetBodies()
End Get
End Property
Public ReadOnly Property Faces() As Face()
Get
Return Me.nxBodyFeature.GetFaces()
End Get
End Property
Public ReadOnly Property Edges() As Edge()
Get
Return Me.nxBodyFeature.GetEdges()
End Get
End Property
End Class
|
Public Class DisplaySettingForm
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 OKButton As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents BackGroundColorButton As System.Windows.Forms.Button
Friend WithEvents DisplayColorSelectDialog As System.Windows.Forms.ColorDialog
Friend WithEvents ChartPanel As System.Windows.Forms.Panel
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents LineThicknessTextBox As System.Windows.Forms.TextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents PointWeightTextBox As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents PointColorButton As System.Windows.Forms.Button
Friend WithEvents SettingCancelButton As System.Windows.Forms.Button
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents LineColor1Button As System.Windows.Forms.Button
Friend WithEvents LineColor2Button As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(DisplaySettingForm))
Me.OKButton = New System.Windows.Forms.Button
Me.BackGroundColorButton = New System.Windows.Forms.Button
Me.Label1 = New System.Windows.Forms.Label
Me.LineThicknessTextBox = New System.Windows.Forms.TextBox
Me.ChartPanel = New System.Windows.Forms.Panel
Me.DisplayColorSelectDialog = New System.Windows.Forms.ColorDialog
Me.SettingCancelButton = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.LineColor1Button = New System.Windows.Forms.Button
Me.Label3 = New System.Windows.Forms.Label
Me.Label4 = New System.Windows.Forms.Label
Me.PointWeightTextBox = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.PointColorButton = New System.Windows.Forms.Button
Me.LineColor2Button = New System.Windows.Forms.Button
Me.Label6 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'OKButton
'
Me.OKButton.Location = New System.Drawing.Point(120, 296)
Me.OKButton.Name = "OKButton"
Me.OKButton.Size = New System.Drawing.Size(56, 40)
Me.OKButton.TabIndex = 0
Me.OKButton.Text = "&OK"
'
'BackGroundColorButton
'
Me.BackGroundColorButton.Location = New System.Drawing.Point(120, 16)
Me.BackGroundColorButton.Name = "BackGroundColorButton"
Me.BackGroundColorButton.Size = New System.Drawing.Size(32, 24)
Me.BackGroundColorButton.TabIndex = 2
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(16, 144)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(80, 32)
Me.Label1.TabIndex = 3
Me.Label1.Text = "Set Line Thickness"
'
'LineThicknessTextBox
'
Me.LineThicknessTextBox.Location = New System.Drawing.Point(120, 152)
Me.LineThicknessTextBox.Name = "LineThicknessTextBox"
Me.LineThicknessTextBox.Size = New System.Drawing.Size(40, 20)
Me.LineThicknessTextBox.TabIndex = 4
Me.LineThicknessTextBox.Text = ""
'
'ChartPanel
'
Me.ChartPanel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.ChartPanel.Location = New System.Drawing.Point(64, 224)
Me.ChartPanel.Name = "ChartPanel"
Me.ChartPanel.Size = New System.Drawing.Size(80, 56)
Me.ChartPanel.TabIndex = 5
'
'SettingCancelButton
'
Me.SettingCancelButton.Location = New System.Drawing.Point(48, 296)
Me.SettingCancelButton.Name = "SettingCancelButton"
Me.SettingCancelButton.Size = New System.Drawing.Size(56, 40)
Me.SettingCancelButton.TabIndex = 6
Me.SettingCancelButton.Text = "&Cancel"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(16, 16)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(88, 32)
Me.Label2.TabIndex = 7
Me.Label2.Text = "Set Background Color"
'
'LineColor1Button
'
Me.LineColor1Button.Location = New System.Drawing.Point(120, 48)
Me.LineColor1Button.Name = "LineColor1Button"
Me.LineColor1Button.Size = New System.Drawing.Size(32, 24)
Me.LineColor1Button.TabIndex = 8
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(16, 56)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(88, 16)
Me.Label3.TabIndex = 9
Me.Label3.Text = "Set Z line Color"
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(16, 192)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(80, 24)
Me.Label4.TabIndex = 10
Me.Label4.Text = "Point Weight"
'
'PointWeightTextBox
'
Me.PointWeightTextBox.Location = New System.Drawing.Point(120, 192)
Me.PointWeightTextBox.Name = "PointWeightTextBox"
Me.PointWeightTextBox.Size = New System.Drawing.Size(40, 20)
Me.PointWeightTextBox.TabIndex = 11
Me.PointWeightTextBox.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(16, 112)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(80, 24)
Me.Label5.TabIndex = 12
Me.Label5.Text = "Set Point Color"
'
'PointColorButton
'
Me.PointColorButton.Location = New System.Drawing.Point(120, 112)
Me.PointColorButton.Name = "PointColorButton"
Me.PointColorButton.Size = New System.Drawing.Size(32, 24)
Me.PointColorButton.TabIndex = 13
'
'LineColor2Button
'
Me.LineColor2Button.Location = New System.Drawing.Point(120, 80)
Me.LineColor2Button.Name = "LineColor2Button"
Me.LineColor2Button.Size = New System.Drawing.Size(32, 24)
Me.LineColor2Button.TabIndex = 14
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(16, 80)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(88, 16)
Me.Label6.TabIndex = 15
Me.Label6.Text = "Set Y Line Color"
'
'DisplaySettingForm
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(224, 350)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.LineColor2Button)
Me.Controls.Add(Me.PointColorButton)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.PointWeightTextBox)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.LineColor1Button)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.SettingCancelButton)
Me.Controls.Add(Me.ChartPanel)
Me.Controls.Add(Me.LineThicknessTextBox)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.BackGroundColorButton)
Me.Controls.Add(Me.OKButton)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "DisplaySettingForm"
Me.Text = "DisplaySettingForm"
Me.ResumeLayout(False)
End Sub
#End Region
'Module level declarations
Public mstrFormTitle As String
Public mstrVersion As String
Public InterFormMessage As New MessageClass
Private Linecolor1 As Color
Private Linecolor2 As Color
Private intLineThickness As Integer
Private Pointcolor As Color
Private intPointWeigth As Integer
Private Sub DisplaySettingForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
'Update the title and version of the main window
Me.Text = mstrFormTitle & " " & "Version " & mstrVersion
Me.CenterToScreen() 'Put this form in the center of the screen
'Initialize all environment parameters on the sample panel
ChartPanel.BackColor = InterFormMessage.backgroundcolor
Linecolor1 = InterFormMessage.Linecolor1
Linecolor2 = InterFormMessage.Linecolor2
Pointcolor = InterFormMessage.Pointcolor
intLineThickness = InterFormMessage.intLineThickness
LineThicknessTextBox.Text = CStr(InterFormMessage.intLineThickness)
intPointWeigth = InterFormMessage.intPointWeigth
PointWeightTextBox.Text = CStr(InterFormMessage.intPointWeigth)
Catch
MessageBox.Show("Error in initialization", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub BackGroundColorButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackGroundColorButton.Click
DisplayColorSelectDialog.Color = ChartPanel.BackColor 'Reload original color
DisplayColorSelectDialog.ShowDialog() 'Show modal dialog box
ChartPanel.BackColor = DisplayColorSelectDialog.Color 'Assign new color
End Sub
Private Sub LineColor1Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LineColor1Button.Click
DisplayColorSelectDialog.Color = Linecolor1 'Reload original color
DisplayColorSelectDialog.ShowDialog() 'Show modal dialog box
Linecolor1 = DisplayColorSelectDialog.Color 'Assign new color
ChartPanel.Refresh() 'Redraw the chart panel using new settings
End Sub
Private Sub LineColor2Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LineColor2Button.Click
DisplayColorSelectDialog.Color = Linecolor2 'Reload original color
DisplayColorSelectDialog.ShowDialog() 'Show modal dialog box
Linecolor2 = DisplayColorSelectDialog.Color 'Assign new color
ChartPanel.Refresh() 'Redraw the chart panel using new settings
End Sub
Private Sub PointColorButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PointColorButton.Click
DisplayColorSelectDialog.Color = Pointcolor 'Reload original color
DisplayColorSelectDialog.ShowDialog() 'Show modal dialog box
Pointcolor = DisplayColorSelectDialog.Color 'Assign new color
ChartPanel.Refresh() 'Redraw the chart panel using new settings
End Sub
Private Sub LineThicknessTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LineThicknessTextBox.TextChanged
Try
If LineThicknessTextBox.Text <> "" Then
intLineThickness = CInt(LineThicknessTextBox.Text)
End If
ChartPanel.Refresh() 'Redraw the chart panel using new settings
Catch
MessageBox.Show("Please input a valid numeric value", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub PointWeightTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PointWeightTextBox.TextChanged
Try
If PointWeightTextBox.Text <> "" Then
intPointWeigth = CInt(PointWeightTextBox.Text)
End If
ChartPanel.Refresh() 'Redraw the chart panel using new settings
Catch
MessageBox.Show("Please input a valid numeric value", "Error", _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub ChartPanel_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles ChartPanel.Paint
Dim ChartGraphics As Graphics = e.Graphics
Dim LinePen1 As New Pen(Linecolor1, intLineThickness)
Dim LinePen2 As New Pen(Linecolor2, intLineThickness)
Dim PointBrush As New SolidBrush(Pointcolor)
Dim intH As Integer = ChartPanel.Height
Dim intW As Integer = ChartPanel.Width
Dim StartPoint1 As New Point(intW / 2, 0)
Dim EndPoint1 As New Point(intW / 2, intH)
Dim StartPoint2 As New Point(0, intH / 2)
Dim EndPoint2 As New Point(intW, intH / 2)
'Draw a vertical and horizontal line in the ChartPanel
ChartGraphics.DrawLine(LinePen1, StartPoint1, EndPoint1)
ChartGraphics.DrawLine(LinePen2, StartPoint2, EndPoint2)
'Draw a filled circle in the ChartPanel
ChartGraphics.FillEllipse(PointBrush, 20, 20, intPointWeigth, intPointWeigth)
End Sub
Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
'Assign new parameters to InterFormMessage class environment fields
With InterFormMessage
.backgroundcolor = ChartPanel.BackColor
.Linecolor1 = Linecolor1
.Linecolor2 = Linecolor2
.intLineThickness = intLineThickness
.Pointcolor = Pointcolor
.intPointWeigth = intPointWeigth
End With
Close()
End Sub
Private Sub SettingCancelButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SettingCancelButton.Click
Close()
End Sub
End Class
|
Imports AutoMapper
Imports UGPP.CobrosCoactivo.Datos
Imports UGPP.CobrosCoactivo.Entidades
Public Class EtapaProcesalBLL
Private Property _etapaProcesal As EtapaProcesalDAL
Private Property _AuditEntity As LogAuditoria
Public Sub New()
_etapaProcesal = New EtapaProcesalDAL()
End Sub
Public Sub New(ByVal auditData As LogAuditoria)
_AuditEntity = auditData
_etapaProcesal = New EtapaProcesalDAL(_AuditEntity)
End Sub
''' <summary>
''' Convierte un objeto del tipo Datos.EtapaProcesalDAL a Entidades.EtapaProcesal
''' </summary>
''' <param name="prmObjEtapaProcesal">Objeto de tipo Datos.TIPOS_CAUSALES_PRIORIZACION</param>
''' <returns>Objeto de tipo Entidades.EtapaProcesal</returns>
Public Function ConvertirEntidadEtapaProcesal(ByVal prmObjEtapaProcesal As Datos.ETAPA_PROCESAL) As Entidades.EtapaProcesal
Dim etapaProcesal As Entidades.EtapaProcesal
Dim config As New MapperConfiguration(Function(cfg)
Return cfg.CreateMap(Of Entidades.EtapaProcesal, Datos.ETAPA_PROCESAL)()
End Function)
Dim IMapper = config.CreateMapper()
etapaProcesal = IMapper.Map(Of Datos.ETAPA_PROCESAL, Entidades.EtapaProcesal)(prmObjEtapaProcesal)
Return etapaProcesal
End Function
''' <summary>
''' Obtener todas las etapas procesales
''' </summary>
''' <returns>Lista de etapas procesales</returns>
Public Function ObtenerEtapaProcesal() As List(Of Entidades.EtapaProcesal)
Dim listaEtapaProcesalConsulta = _etapaProcesal.ObtenerEtapasProcesales()
Dim listaEtapaProcesal As List(Of Entidades.EtapaProcesal) = New List(Of Entidades.EtapaProcesal)
For Each listaEtapasProcesales As Datos.ETAPA_PROCESAL In listaEtapaProcesalConsulta
listaEtapaProcesal.Add(ConvertirEntidadEtapaProcesal(listaEtapasProcesales))
Next
Return listaEtapaProcesal
End Function
Public Function ObtenerEtapaProcesalPorId(ByVal Id As String) As List(Of Entidades.EtapaProcesal)
Dim listaEtapaProcesalConsulta = _etapaProcesal.ObtenerEtapasProcesalesPorId(Id)
Dim listaEtapaProcesal As List(Of Entidades.EtapaProcesal) = New List(Of Entidades.EtapaProcesal)
For Each listaEtapasProcesales As Datos.ETAPA_PROCESAL In listaEtapaProcesalConsulta
listaEtapaProcesal.Add(ConvertirEntidadEtapaProcesal(listaEtapasProcesales))
Next
Return listaEtapaProcesal
End Function
End Class
|
Imports Brilliantech.Framework.WCF.Data
Imports Brilliantech.ReportGenConnector
''' <summary>
''' 打印数据传输消息类
''' </summary>
''' <remarks></remarks>
<DataContract()>
Public Class PrintDataMessage
Inherits ServiceMessage
Private pf_printTask As List(Of PrintTask)
''' <summary>
''' 打印数据
''' </summary>
''' <value></value>
''' <returns></returns>
''' <remarks></remarks>
<DataMember()>
Public Property PrintTask As List(Of PrintTask)
Get
If pf_printTask Is Nothing Then
pf_printTask = New List(Of PrintTask)
End If
Return pf_printTask
End Get
Set(ByVal value As List(Of PrintTask))
pf_printTask = value
End Set
End Property
End Class
|
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs)
MsgBox("Hola mundo")
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles lbl_primervalor.Click
End Sub
Private Sub Label2_Click(sender As Object, e As EventArgs) Handles lbl_segundovalor.Click
End Sub
Private Sub Button1_Click_1(sender As Object, e As EventArgs) Handles btn_calcular.Click
Dim val1 As Integer = Integer.Parse(txt_primervalor.Text)
Dim val2 As Integer = Integer.Parse(txt_segundovalor.Text)
Dim resultado As Double = 0
Dim operador As String = cnb_operador.Text
Select Case operador
Case "Suma"
resultado = val1 + val2
Case "Resta"
resultado = val1 - val2
Case "Division"
If val2 <> 0 Then
resultado = val1 / val2
Else
MsgBox("No se puede dividir entre 0")
End If
Case "Multiplicacion"
resultado = val1 * val2
Case Else
MsgBox("Debe seleccionar un operador")
End Select
txt_resultado.Text = resultado
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles txt_segundovalor.TextChanged
End Sub
Private Sub lbl_operador_Click(sender As Object, e As EventArgs) Handles lbl_operador.Click
End Sub
Private Sub btn_salir_Click(sender As Object, e As EventArgs) Handles btn_salir.Click
Me.Close()
End Sub
Private Sub btn_limpiar_Click(sender As Object, e As EventArgs) Handles btn_limpiar.Click
txt_primervalor.Text = " "
txt_segundovalor.Text = " "
txt_resultado.Text = " "
End Sub
End Class
|
Imports System
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Markup
Imports System.Windows.Data
Imports System.Globalization
Imports DevExpress.Diagram.Core
Imports DevExpress.Diagram.Core.Layout
Namespace DiagramDemo.Utils
Public Class FormatWrapper
Public Sub New()
End Sub
Public Sub New(ByVal name As String, ByVal format As String)
FormatName = name
FormatString = format
End Sub
Public Property FormatName() As String
Public Property FormatString() As String
End Class
Public Class BaseKindHelper(Of T)
Public Function GetEnumMemberList() As Array
Return System.Enum.GetValues(GetType(T))
End Function
End Class
Public Class ClickModeKindHelper
Inherits BaseKindHelper(Of ClickMode)
End Class
Public Class TextWrappingKindHelper
Inherits BaseKindHelper(Of TextWrapping)
End Class
Public Class ScrollBarVisibilityKindHelper
Inherits BaseKindHelper(Of ScrollBarVisibility)
End Class
Public Class CharacterCasingKindHelper
Inherits BaseKindHelper(Of CharacterCasing)
End Class
Public Class NullableToStringConverter
Inherits MarkupExtension
Implements IValueConverter
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
Private nullString As String = "Null"
#Region "IValueConverter Members"
Private Function IValueConverter_Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
If value Is Nothing Then
Return nullString
End If
Return value.ToString()
End Function
Private Function IValueConverter_ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
#End Region
End Class
Public Class DecimalToConverter
Inherits MarkupExtension
Implements IValueConverter
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim target As Type = TryCast(parameter, Type)
If target Is Nothing Then
Return value
End If
Return System.Convert.ChangeType(value, target, culture)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Return System.Convert.ToDecimal(value)
End Function
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
End Class
Public Class IConvertibleConverter
Implements IValueConverter
Public Property ToType() As String
Public Property FromType() As String
#Region "IValueConverter Members"
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
Dim target As Type = Type.GetType(ToType, False)
If target Is Nothing Then
Return value
End If
Return System.Convert.ChangeType(value, target, culture)
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
Dim target As Type = Type.GetType(FromType, False)
If target Is Nothing Then
Return value
End If
Return System.Convert.ChangeType(value, target, culture)
End Function
#End Region
End Class
Public Class PositionXYToPointConverter
Inherits MarkupExtension
Implements IMultiValueConverter
Public Function Convert(ByVal values() As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IMultiValueConverter.Convert
Dim positions = Array.ConvertAll(values, Function(o) System.Convert.ToDouble(o))
Return New Point(positions(0), positions(1))
End Function
Public Function ConvertBack(ByVal value As Object, ByVal targetTypes() As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object() Implements IMultiValueConverter.ConvertBack
Dim point = DirectCast(value, Point)
Return New Object() { CInt((point.X)), CInt((point.Y)) }
End Function
Public Overrides Function ProvideValue(ByVal serviceProvider As IServiceProvider) As Object
Return Me
End Function
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmLanguage
Inherits DevExpress.XtraEditors.XtraForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmLanguage))
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.gboGrid = New System.Windows.Forms.GroupBox()
Me.BindingNavigator1 = New System.Windows.Forms.BindingNavigator(Me.components)
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator()
Me.BindingNavigatorPositionItem = New System.Windows.Forms.ToolStripTextBox()
Me.BindingNavigatorSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.grid = New System.Windows.Forms.DataGridView()
Me.FormID = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.FormName = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.Parent = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.ControlName = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.TextEnglish = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.TextVietNam = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.TextChina = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.TextJapan = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.IsTranslate = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.cboModule = New System.Windows.Forms.ComboBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.cboFormName = New System.Windows.Forms.ComboBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.tlsMenu = New System.Windows.Forms.ToolStrip()
Me.mnuNew = New System.Windows.Forms.ToolStripButton()
Me.mnuDelete = New System.Windows.Forms.ToolStripButton()
Me.mnuShowAll = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.gboGrid.SuspendLayout()
CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.BindingNavigator1.SuspendLayout()
CType(Me.grid, System.ComponentModel.ISupportInitialize).BeginInit()
Me.tlsMenu.SuspendLayout()
Me.SuspendLayout()
'
'gboGrid
'
Me.gboGrid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.gboGrid.Controls.Add(Me.BindingNavigator1)
Me.gboGrid.Controls.Add(Me.grid)
Me.gboGrid.Location = New System.Drawing.Point(0, 61)
Me.gboGrid.Name = "gboGrid"
Me.gboGrid.Size = New System.Drawing.Size(1044, 358)
Me.gboGrid.TabIndex = 8
Me.gboGrid.TabStop = False
'
'BindingNavigator1
'
Me.BindingNavigator1.AddNewItem = Nothing
Me.BindingNavigator1.CountItem = Me.BindingNavigatorCountItem
Me.BindingNavigator1.DeleteItem = Nothing
Me.BindingNavigator1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.BindingNavigator1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BindingNavigatorMoveFirstItem, Me.BindingNavigatorMovePreviousItem, Me.BindingNavigatorSeparator, Me.BindingNavigatorPositionItem, Me.BindingNavigatorCountItem, Me.BindingNavigatorSeparator1, Me.BindingNavigatorMoveNextItem, Me.BindingNavigatorMoveLastItem, Me.BindingNavigatorSeparator2})
Me.BindingNavigator1.Location = New System.Drawing.Point(3, 330)
Me.BindingNavigator1.MoveFirstItem = Me.BindingNavigatorMoveFirstItem
Me.BindingNavigator1.MoveLastItem = Me.BindingNavigatorMoveLastItem
Me.BindingNavigator1.MoveNextItem = Me.BindingNavigatorMoveNextItem
Me.BindingNavigator1.MovePreviousItem = Me.BindingNavigatorMovePreviousItem
Me.BindingNavigator1.Name = "BindingNavigator1"
Me.BindingNavigator1.PositionItem = Me.BindingNavigatorPositionItem
Me.BindingNavigator1.Size = New System.Drawing.Size(1038, 25)
Me.BindingNavigator1.TabIndex = 1
Me.BindingNavigator1.Text = "BindingNavigator1"
'
'BindingNavigatorCountItem
'
Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
Me.BindingNavigatorCountItem.Size = New System.Drawing.Size(35, 22)
Me.BindingNavigatorCountItem.Text = "of {0}"
Me.BindingNavigatorCountItem.ToolTipText = "Total number of items"
'
'BindingNavigatorMoveFirstItem
'
Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveFirstItem.Image = CType(resources.GetObject("BindingNavigatorMoveFirstItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveFirstItem.Name = "BindingNavigatorMoveFirstItem"
Me.BindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveFirstItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveFirstItem.Text = "Move first"
'
'BindingNavigatorMovePreviousItem
'
Me.BindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMovePreviousItem.Image = CType(resources.GetObject("BindingNavigatorMovePreviousItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMovePreviousItem.Name = "BindingNavigatorMovePreviousItem"
Me.BindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMovePreviousItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMovePreviousItem.Text = "Move previous"
'
'BindingNavigatorSeparator
'
Me.BindingNavigatorSeparator.Name = "BindingNavigatorSeparator"
Me.BindingNavigatorSeparator.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorPositionItem
'
Me.BindingNavigatorPositionItem.AccessibleName = "Position"
Me.BindingNavigatorPositionItem.AutoSize = False
Me.BindingNavigatorPositionItem.Name = "BindingNavigatorPositionItem"
Me.BindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 23)
Me.BindingNavigatorPositionItem.Text = "0"
Me.BindingNavigatorPositionItem.ToolTipText = "Current position"
'
'BindingNavigatorSeparator1
'
Me.BindingNavigatorSeparator1.Name = "BindingNavigatorSeparator1"
Me.BindingNavigatorSeparator1.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorMoveNextItem
'
Me.BindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveNextItem.Image = CType(resources.GetObject("BindingNavigatorMoveNextItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveNextItem.Name = "BindingNavigatorMoveNextItem"
Me.BindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveNextItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveNextItem.Text = "Move next"
'
'BindingNavigatorMoveLastItem
'
Me.BindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveLastItem.Image = CType(resources.GetObject("BindingNavigatorMoveLastItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveLastItem.Name = "BindingNavigatorMoveLastItem"
Me.BindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveLastItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveLastItem.Text = "Move last"
'
'BindingNavigatorSeparator2
'
Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
Me.BindingNavigatorSeparator2.Size = New System.Drawing.Size(6, 25)
'
'grid
'
Me.grid.AllowUserToAddRows = False
Me.grid.AllowUserToDeleteRows = False
Me.grid.AllowUserToOrderColumns = True
Me.grid.AllowUserToResizeRows = False
DataGridViewCellStyle1.BackColor = System.Drawing.Color.LemonChiffon
DataGridViewCellStyle1.SelectionBackColor = System.Drawing.Color.LemonChiffon
DataGridViewCellStyle1.SelectionForeColor = System.Drawing.Color.Blue
Me.grid.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
Me.grid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.grid.BackgroundColor = System.Drawing.Color.WhiteSmoke
Me.grid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.grid.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.FormID, Me.FormName, Me.Parent, Me.ControlName, Me.TextEnglish, Me.TextVietNam, Me.TextChina, Me.TextJapan, Me.IsTranslate})
Me.grid.EditMode = System.Windows.Forms.DataGridViewEditMode.EditOnEnter
Me.grid.EnableHeadersVisualStyles = False
Me.grid.Location = New System.Drawing.Point(3, 16)
Me.grid.Name = "grid"
Me.grid.RowHeadersWidth = 20
DataGridViewCellStyle2.SelectionBackColor = System.Drawing.Color.White
DataGridViewCellStyle2.SelectionForeColor = System.Drawing.Color.Blue
Me.grid.RowsDefaultCellStyle = DataGridViewCellStyle2
Me.grid.Size = New System.Drawing.Size(1038, 311)
Me.grid.TabIndex = 0
'
'FormID
'
Me.FormID.DataPropertyName = "FormID"
Me.FormID.Frozen = True
Me.FormID.HeaderText = "FormID"
Me.FormID.Name = "FormID"
Me.FormID.ReadOnly = True
Me.FormID.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'FormName
'
Me.FormName.DataPropertyName = "FormName"
Me.FormName.Frozen = True
Me.FormName.HeaderText = "FormName"
Me.FormName.Name = "FormName"
Me.FormName.ReadOnly = True
Me.FormName.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'Parent
'
Me.Parent.DataPropertyName = "Parent"
Me.Parent.HeaderText = "Parent"
Me.Parent.Name = "Parent"
Me.Parent.ReadOnly = True
Me.Parent.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'ControlName
'
Me.ControlName.DataPropertyName = "ControlName"
Me.ControlName.HeaderText = "ControlName"
Me.ControlName.Name = "ControlName"
Me.ControlName.ReadOnly = True
Me.ControlName.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'TextEnglish
'
Me.TextEnglish.DataPropertyName = "TextEnglish"
Me.TextEnglish.HeaderText = "TextEnglish"
Me.TextEnglish.Name = "TextEnglish"
Me.TextEnglish.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'TextVietNam
'
Me.TextVietNam.DataPropertyName = "TextVietNam"
Me.TextVietNam.HeaderText = "TextVietNam"
Me.TextVietNam.Name = "TextVietNam"
Me.TextVietNam.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'TextChina
'
Me.TextChina.DataPropertyName = "TextChina"
Me.TextChina.HeaderText = "TextChina"
Me.TextChina.Name = "TextChina"
Me.TextChina.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'TextJapan
'
Me.TextJapan.DataPropertyName = "TextJapan"
Me.TextJapan.HeaderText = "TextJapan"
Me.TextJapan.Name = "TextJapan"
Me.TextJapan.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'IsTranslate
'
Me.IsTranslate.DataPropertyName = "IsTranslate"
Me.IsTranslate.HeaderText = "IsTranslate"
Me.IsTranslate.Name = "IsTranslate"
Me.IsTranslate.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
'
'cboModule
'
Me.cboModule.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboModule.FormattingEnabled = True
Me.cboModule.Location = New System.Drawing.Point(201, 22)
Me.cboModule.Name = "cboModule"
Me.cboModule.Size = New System.Drawing.Size(135, 21)
Me.cboModule.TabIndex = 3
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(198, 7)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(42, 13)
Me.Label1.TabIndex = 4
Me.Label1.Text = "Module"
'
'cboFormName
'
Me.cboFormName.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.cboFormName.FormattingEnabled = True
Me.cboFormName.Location = New System.Drawing.Point(342, 22)
Me.cboFormName.Name = "cboFormName"
Me.cboFormName.Size = New System.Drawing.Size(181, 21)
Me.cboFormName.TabIndex = 1
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(339, 7)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(58, 13)
Me.Label2.TabIndex = 2
Me.Label2.Text = "FormName"
'
'tlsMenu
'
Me.tlsMenu.AutoSize = False
Me.tlsMenu.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
Me.tlsMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuNew, Me.mnuDelete, Me.mnuShowAll, Me.ToolStripSeparator1})
Me.tlsMenu.Location = New System.Drawing.Point(0, 0)
Me.tlsMenu.Name = "tlsMenu"
Me.tlsMenu.Size = New System.Drawing.Size(1044, 58)
Me.tlsMenu.TabIndex = 9
'
'mnuNew
'
Me.mnuNew.AutoSize = False
Me.mnuNew.Image = CType(resources.GetObject("mnuNew.Image"), System.Drawing.Image)
Me.mnuNew.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuNew.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuNew.Name = "mnuNew"
Me.mnuNew.Size = New System.Drawing.Size(60, 50)
Me.mnuNew.Text = "New"
Me.mnuNew.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuNew.ToolTipText = "New (Ctrl+N)"
'
'mnuDelete
'
Me.mnuDelete.AutoSize = False
Me.mnuDelete.Image = CType(resources.GetObject("mnuDelete.Image"), System.Drawing.Image)
Me.mnuDelete.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuDelete.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuDelete.Margin = New System.Windows.Forms.Padding(0, 1, 0, 0)
Me.mnuDelete.Name = "mnuDelete"
Me.mnuDelete.Size = New System.Drawing.Size(60, 50)
Me.mnuDelete.Text = "Delete"
Me.mnuDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuDelete.ToolTipText = "Delete(Ctrl+D)"
'
'mnuShowAll
'
Me.mnuShowAll.AutoSize = False
Me.mnuShowAll.Image = CType(resources.GetObject("mnuShowAll.Image"), System.Drawing.Image)
Me.mnuShowAll.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuShowAll.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuShowAll.Name = "mnuShowAll"
Me.mnuShowAll.Size = New System.Drawing.Size(60, 50)
Me.mnuShowAll.Text = "Show all"
Me.mnuShowAll.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuShowAll.ToolTipText = "Show all (F5)"
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 58)
'
'FrmLanguage
'
Me.Appearance.Options.UseFont = True
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1044, 421)
Me.Controls.Add(Me.cboModule)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.gboGrid)
Me.Controls.Add(Me.cboFormName)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.tlsMenu)
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.KeyPreview = True
Me.Name = "FrmLanguage"
Me.ShowInTaskbar = False
Me.Tag = "9997"
Me.Text = "Language Management"
Me.gboGrid.ResumeLayout(False)
Me.gboGrid.PerformLayout()
CType(Me.BindingNavigator1, System.ComponentModel.ISupportInitialize).EndInit()
Me.BindingNavigator1.ResumeLayout(False)
Me.BindingNavigator1.PerformLayout()
CType(Me.grid, System.ComponentModel.ISupportInitialize).EndInit()
Me.tlsMenu.ResumeLayout(False)
Me.tlsMenu.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents gboGrid As System.Windows.Forms.GroupBox
Friend WithEvents grid As System.Windows.Forms.DataGridView
Friend WithEvents tlsMenu As System.Windows.Forms.ToolStrip
Friend WithEvents mnuNew As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuDelete As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuShowAll As System.Windows.Forms.ToolStripButton
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents cboFormName As System.Windows.Forms.ComboBox
Friend WithEvents cboModule As System.Windows.Forms.ComboBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents FormID As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents FormName As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents Parent As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents ControlName As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents TextEnglish As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents TextVietNam As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents TextChina As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents TextJapan As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents IsTranslate As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents BindingNavigator1 As System.Windows.Forms.BindingNavigator
Friend WithEvents BindingNavigatorCountItem As System.Windows.Forms.ToolStripLabel
Friend WithEvents BindingNavigatorMoveFirstItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorMovePreviousItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorSeparator As System.Windows.Forms.ToolStripSeparator
Friend WithEvents BindingNavigatorPositionItem As System.Windows.Forms.ToolStripTextBox
Friend WithEvents BindingNavigatorSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents BindingNavigatorMoveNextItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorMoveLastItem As System.Windows.Forms.ToolStripButton
Friend WithEvents BindingNavigatorSeparator2 As System.Windows.Forms.ToolStripSeparator
End Class
|
Imports BVSoftware.Bvc5.Core.Content
Imports BVSoftware.Bvc5.Core
Imports System.Collections.Generic
Partial Class BVModules_ProductInputs_File_Upload_View
Inherits ProductInputTemplate
Protected required As Boolean
Protected wrapText As Boolean
Private generatedFileName As String
Public Overrides ReadOnly Property IsValid() As Boolean
Get
InputRequiredFieldValidator.Validate()
Return InputRequiredFieldValidator.IsValid
End Get
End Property
Private Sub LoadSettings()
Me.displayName = SettingsManager.GetSetting("DisplayName")
required = SettingsManager.GetBooleanSetting("Required")
End Sub
Protected Sub Display()
If displayName <> String.Empty Then
InputLabel.Visible = True
InputLabel.Text = displayName
Else
InputLabel.Visible = False
End If
'do not require file upload if a file has already previously been selected
If String.IsNullOrEmpty(ViewState("FileUpload")) Then
InputRequiredFieldValidator.Enabled = required
Else
InputRequiredFieldValidator.Enabled = False
End If
End Sub
Public Overrides Sub InitializeDisplay()
LoadSettings()
Display()
End Sub
Public Sub PageLoad(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
'upload the file on page load as GetValue is called three times
If IsPostBack AndAlso InputFileUpload.HasFile Then
Dim filename As String = Me.GetValue()
InputFileUpload.SaveAs(filename.Replace(WebAppSettings.SiteStandardRoot, Request.PhysicalApplicationPath).Replace("/", "\"))
Me.SetValue(filename) 'retain file in case we have a validation error so user will not have to re-upload it
End If
End Sub
Public Overrides Function GetValue() As String
'generate filename only if we have not already generated it (should only be on initial page load when the file is uploaded)
If generatedFileName Is Nothing Then
If InputFileUpload.HasFile Then
generatedFileName = InputFileUpload.FileName
Dim extensionStartPosition As Integer = InputFileUpload.FileName.LastIndexOf(".")
generatedFileName = generatedFileName.Substring(0, extensionStartPosition) + "-" + Guid.NewGuid.ToString() + generatedFileName.Substring(extensionStartPosition)
generatedFileName = WebAppSettings.SiteStandardRoot + "files/productinputs/" + generatedFileName
ElseIf Not String.IsNullOrEmpty(ViewState("FileUpload")) Then
'Retain initial file string if no file uploaded
generatedFileName = ViewState("FileUpload")
End If
End If
Return generatedFileName
End Function
Public Overrides Sub SetValue(ByVal value As String)
If value IsNot Nothing AndAlso value <> String.Empty Then
generatedFileName = value
PreviousFile.Visible = True 'show previously uploaded file (visible only if there is one)
If Me.IsViewableImage(value) Then
imgPreviousFile.ImageUrl = value
Else
'if uploaded image is in a file format not viewable by a browser, show a default image with overlay text
overlayText.Visible = True
overlayText.Text = value.Split(".")(value.Split(".").Length - 1)
imgPreviousFile.ImageUrl = "~/images/attachment.png"
End If
ViewState("FileUpload") = value 'hold initial value in case user does not upload a new file
InputRequiredFieldValidator.Enabled = False 'don't require file upload if a file has already previously been uploaded
End If
End Sub
Private Function IsViewableImage(ByVal img As String) As Boolean
Dim result As Boolean = False
Dim viewableTypes As New List(Of String)(New String() {".jpg", ".jpeg", ".gif", ".png", ".svg", ".bmp"})
For Each t As String In viewableTypes
If img.EndsWith(t) Then
result = True
Exit For
End If
Next
Return result
End Function
End Class |
Imports System.IO
Imports System.Net
Imports Newtonsoft.Json
Public Class Editor
Dim FileContent
Dim DialogBoxResult
Dim CurrentLine = 1
Dim SelectionIndex = 0
Dim CurrentCol = 0
Dim FirstTick As Boolean
Dim UpdateError As Exception = Nothing
Public Function HandleKeyEvent(e As KeyEventArgs)
If e.KeyCode = Keys.A And My.Computer.Keyboard.CtrlKeyDown Then ' Select All
TextArea.SelectAll()
e.Handled = True
ElseIf e.KeyCode = Keys.Z And My.Computer.Keyboard.CtrlKeyDown Then ' Undo
TextArea.Undo()
e.Handled = True
ElseIf e.KeyCode = Keys.Y And My.Computer.Keyboard.CtrlKeyDown Then ' Redo
TextArea.Redo()
e.Handled = True
ElseIf e.KeyCode = Keys.f11 Then ' Full Screen
If My.Forms.Editor.FormBorderStyle = FormBorderStyle.Sizable Then
My.Forms.Editor.FormBorderStyle = FormBorderStyle.None
My.Forms.Editor.WindowState = FormWindowState.Maximized
Else
My.Forms.Editor.FormBorderStyle = FormBorderStyle.Sizable
My.Forms.Editor.WindowState = FormWindowState.Maximized
End If
ElseIf e.KeyCode = Keys.O And My.Computer.Keyboard.CtrlKeyDown Then ' Open file
If Not ((OpenFileDialog.FileName = "") And (TextArea.Text = "")) Then
DialogBoxResult = MsgBox("Save changes to current file?", MsgBoxStyle.YesNoCancel)
' Yes = 6
' No = 7
' Cancel = 2
Else
DialogBoxResult = 7
End If
If Not (DialogBoxResult = 2) Then
If DialogBoxResult = 6 Then
SaveFileDialog.ShowDialog()
End If
OpenFileDialog.InitialDirectory = Environment.GetEnvironmentVariable("USERPROFILE")
OpenFileDialog.ShowDialog()
End If
ElseIf e.KeyCode = Keys.S And My.Computer.Keyboard.CtrlKeyDown Then ' Save File
SaveFileDialog.InitialDirectory = OpenFileDialog.FileName
SaveFileDialog.ShowDialog()
ElseIf e.KeyCode = Keys.N And My.Computer.Keyboard.CtrlKeyDown Then ' New File
Me.Cursor = Cursors.WaitCursor
If Not ((OpenFileDialog.FileName = "") And (TextArea.Text = "")) Then
DialogBoxResult = MsgBox("Save changes to current file?", MsgBoxStyle.YesNoCancel)
' Yes = 6
' No = 7
' Cancel = 2
Else
DialogBoxResult = 7
End If
If Not (DialogBoxResult = 2) Then
If DialogBoxResult = 6 Then
SaveFileDialog.ShowDialog()
End If
TextArea.Text = ""
End If
Me.Cursor = Cursors.Default
ElseIf e.KeyCode = Keys.R And My.Computer.Keyboard.CtrlKeyDown Then ' Run File
If Not My.Forms.Editor.SaveFileDialog.FileName = "" Then
My.Forms.Editor.SaveFileDialog.InitialDirectory = My.Forms.Editor.OpenFileDialog.FileName
My.Forms.Editor.SaveFileDialog.ShowDialog()
Timer1.Start()
NewProgressBar.Show()
Try
Process.Start("cmd", "/C cd \ & /K start " & Convert.ToString(My.Forms.Editor.SaveFileDialog.FileName))
Catch ex As Exception
MsgBox("Failed to run file " & My.Forms.Editor.SaveFileDialog.FileName & vbCrLf & vbCrLf & ex.ToString, vbCritical)
End Try
NewProgressBar.Hide()
Timer1.Stop()
End If
ElseIf e.KeyCode = Keys.F1 Then ' Show Help
Process.Start("https://github.com/Nanomotion/Nano-IDE/wiki")
ElseIf (e.KeyCode = Keys.Oemcomma Or e.KeyCode = Keys.Decimal) And My.Computer.Keyboard.CtrlKeyDown Then ' Show settings
Settings.Show()
End If
Return 0
End Function
Private Sub ContextMenuRequest(sender As Object, e As EventArgs) Handles ContextMenuLabel.Click, NotifMenuLabel.Click
ContextMenu1.Show()
ContextMenu1.Location = New Point(MousePosition.X - 2, MousePosition.Y - 2)
ContextMenu1.BringToFront()
ContextMenu1.Timer1.Start()
End Sub
Private Sub OpenFileLabel_Click(sender As Object, e As EventArgs)
If Not ((OpenFileDialog.FileName = "") And (TextArea.Text = "")) Then
DialogBoxResult = MsgBox("Save changes to current file?", MsgBoxStyle.YesNoCancel)
' Yes = 6
' No = 7
' Cancel = 2
Else
DialogBoxResult = 7
End If
If Not (DialogBoxResult = 2) Then
If DialogBoxResult = 6 Then
SaveFileDialog.ShowDialog()
End If
OpenFileDialog.InitialDirectory = Environment.GetEnvironmentVariable("USERPROFILE")
OpenFileDialog.ShowDialog()
End If
End Sub
Private Sub OpenFileDialog_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog.FileOk
Timer1.Start()
NewProgressBar.Show()
TextArea.ReadOnly = True
Try
FileContent = File.ReadAllText(OpenFileDialog.FileName)
TextArea.Text = FileContent
Me.Text = OpenFileDialog.FileName & " - Nano IDE"
Catch ex As Exception
MsgBox("An error occurred while trying to open " & OpenFileDialog.FileName & vbCrLf & vbCrLf & ex.ToString, vbCritical)
End Try
TextArea.ReadOnly = False
Me.Cursor = Cursors.Default
NewProgressBar.Hide()
Timer1.Stop()
End Sub
Private Sub SaveFileDialog_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog.FileOk
Timer1.Start()
NewProgressBar.Show()
TextArea.ReadOnly = True
Try
File.WriteAllText(SaveFileDialog.FileName, TextArea.Text)
Catch ex As Exception
MsgBox("Couldn't save file!" & vbCrLf & vbCrLf & ex.ToString, vbCritical)
End Try
Me.Cursor = Cursors.Default
TextArea.ReadOnly = False
NewProgressBar.Hide()
Timer1.Stop()
End Sub
Private Sub SaveFileLabel_Click(sender As Object, e As EventArgs)
SaveFileDialog.InitialDirectory = OpenFileDialog.FileName
SaveFileDialog.ShowDialog()
End Sub
Private Sub NewFileLabel_Click(sender As Object, e As EventArgs)
Me.Cursor = Cursors.WaitCursor
If Not ((OpenFileDialog.FileName = "") And (TextArea.Text = "")) Then
DialogBoxResult = MsgBox("Save changes to current file?", MsgBoxStyle.YesNoCancel)
' Yes = 6
' No = 7
' Cancel = 2
Else
DialogBoxResult = 7
End If
If Not (DialogBoxResult = 2) Then
If DialogBoxResult = 6 Then
SaveFileDialog.ShowDialog()
End If
TextArea.Text = ""
End If
Me.Cursor = Cursors.Default
End Sub
Private Sub Editor_FormClosing(sender As Object, e As FormClosingEventArgs) Handles MyBase.FormClosing
If Not ((OpenFileDialog.FileName = "") And (TextArea.Text = "")) Then
DialogBoxResult = MsgBox("Save changes to current file?", MsgBoxStyle.YesNoCancel)
' Yes = 6
' No = 7
' Cancel = 2
Else
DialogBoxResult = 7
End If
If DialogBoxResult = 2 Then
e.Cancel = True
Else
If DialogBoxResult = 6 Then
SaveFileDialog.ShowDialog()
End If
e.Cancel = False
End If
End Sub
Private Sub Editor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
' Check for updates and render themes
Timer1.Start()
NewProgressBar.Show()
NotifPanel.Hide()
NotifyIcon.Visible = True
Me.Show()
Application.DoEvents()
TextArea.Font = My.Settings.Font
If My.Settings.UseLightTheme Then
TextArea.ForeColor = Color.Black
TextArea.BackColor = Color.FromArgb(234, 234, 236)
ContextMenuLabel.ForeColor = Color.Black
TopMenu.BackColor = Color.White
NewProgressBar.BackColor = Color.White
Me.BackColor = Color.FromArgb(234, 234, 236)
End If
If My.Settings.CheckUpdatesOnLaunch Then
Try
Dim Client As WebClient = New WebClient()
Client.Headers.Add("User-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2;)")
Dim CheckReleases As String = Client.DownloadString("https://api.github.com/repos/Nanomotion/Nano-IDE/releases?per_page=1")
Dim ReleaseObj = JsonConvert.DeserializeObject(Of List(Of Release))(CheckReleases)
Dim LatestRelease = ReleaseObj.First()
If Not ("v" + My.Application.Info.Version.ToString).StartsWith(LatestRelease.tag_name) Then
If My.Settings.ShowUpdateNotifs Then
NotifPanel.BackColor = Color.FromArgb(67, 181, 129)
NotifLabel.Text = "A new update for NanoIDE is available"
AddHandler NotifLabel.Click, AddressOf UpdateNoticeClick
NotifPanel.Show()
End If
Debug.Print("A new update is available")
End If
Catch ex As Exception
If My.Settings.ShowUpdateNotifs Then
NotifPanel.BackColor = Color.FromArgb(240, 71, 71)
NotifLabel.Text = "Failed to check for updates"
UpdateError = ex
AddHandler NotifLabel.Click, AddressOf UpdateCheckFailed
NotifPanel.Show()
End If
Debug.Print(ex.ToString)
End Try
End If
FirstTick = True
NewProgressBar.Hide()
Timer1.Stop()
End Sub
Private Sub TextArea_KeyDown(sender As Object, e As KeyEventArgs) Handles TextArea.KeyDown, Me.KeyDown
HandleKeyEvent(e)
End Sub
Private Sub SettingsIcon_Click(sender As Object, e As EventArgs)
Settings.Show()
End Sub
Private Sub Label1_Click(sender As Object, e As EventArgs) Handles Label1.Click
NotifPanel.Hide()
NotifPanel.BackColor = Color.FromArgb(250, 166, 26)
End Sub
Private Sub UpdateNoticeClick(sender As Object, e As EventArgs)
Process.Start("https://github.com/Nanomotion/Nano-IDE/releases")
NotifPanel.Hide()
RemoveHandler NotifLabel.Click, AddressOf UpdateNoticeClick
End Sub
Private Sub UpdateCheckFailed(sender As Object, e As EventArgs)
NotifPanel.Hide()
MsgBox("An error occurred while trying to check for updates:" & vbCrLf & vbCrLf &
UpdateError.ToString & vbCrLf & vbCrLf &
"This feature can be optionally disabled in Settings under the Updates section.")
RemoveHandler NotifLabel.Click, AddressOf UpdateCheckFailed
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
ProgressValue.Location = New Point(ProgressValue.Location.X + 5, -1)
If ProgressValue.Location.X > NewProgressBar.Width Then
ProgressValue.Location = New Point(ProgressValue.Width * -1, -1)
End If
End Sub
End Class
Public Class Author
Public Property login As String
Public Property id As Integer
Public Property avatar_url As String
Public Property gravatar_id As String
Public Property url As String
Public Property html_url As String
Public Property followers_url As String
Public Property following_url As String
Public Property gists_url As String
Public Property starred_url As String
Public Property subscriptions_url As String
Public Property organizations_url As String
Public Property repos_url As String
Public Property events_url As String
Public Property received_events_url As String
Public Property type As String
Public Property site_admin As Boolean
End Class
Public Class Release
Public Property url As String
Public Property assets_url As String
Public Property upload_url As String
Public Property html_url As String
Public Property id As Integer
Public Property tag_name As String
Public Property target_commitish As String
Public Property name As String
Public Property draft As Boolean
Public Property author As Author
Public Property prerelease As Boolean
Public Property created_at As DateTime
Public Property published_at As DateTime
Public Property assets As Object()
Public Property tarball_url As String
Public Property zipball_url As String
Public Property body As String
End Class
|
Imports System.IO
Imports System.Security.Cryptography
Imports System.Text
Public Class Security
#Region " EncryptString() "
Public Shared Function encryptString(ByVal textToBeEncrypted As String, ByVal encryptionKey As String) As Byte()
Dim bytValue() As Byte
Dim bytKey() As Byte
Dim bytEncoded() As Byte = Nothing
Dim bytIV() As Byte = {121, 241, 10, 1, 132, 74, 11, 39, 255, 91, 45, 78, 14, 211, 22, 62}
Dim intLength As Integer
Dim intRemaining As Integer
Dim objMemoryStream As New MemoryStream
Dim objCryptoStream As CryptoStream
Dim objRijndaelManaged As RijndaelManaged
' **********************************************************************
' ****** Strip any null character from string to be encrypted ******
' **********************************************************************
textToBeEncrypted = StripNullCharacters(textToBeEncrypted)
' **********************************************************************
' ****** Value must be within ASCII range (i.e., no DBCS chars) ******
' **********************************************************************
bytValue = Encoding.ASCII.GetBytes(textToBeEncrypted.ToCharArray)
intLength = Len(encryptionKey)
' ********************************************************************
' ****** Encryption Key must be 256 bits long (32 bytes) ******
' ****** If it is longer than 32 bytes it will be truncated. ******
' ****** If it is shorter than 32 bytes it will be padded ******
' ****** with upper-case Xs. ******
' ********************************************************************
If intLength >= 32 Then
encryptionKey = Left(encryptionKey, 32)
Else
intLength = Len(encryptionKey)
intRemaining = 32 - intLength
encryptionKey = encryptionKey & StrDup(intRemaining, "X")
End If
bytKey = Encoding.ASCII.GetBytes(encryptionKey.ToCharArray)
objRijndaelManaged = New RijndaelManaged
' ***********************************************************************
' ****** Create the encryptor and write value to it after it is ******
' ****** converted into a byte array ******
' ***********************************************************************
Try
objCryptoStream = New CryptoStream(objMemoryStream, objRijndaelManaged.CreateEncryptor(bytKey, bytIV), CryptoStreamMode.Write)
objCryptoStream.Write(bytValue, 0, bytValue.Length)
objCryptoStream.FlushFinalBlock()
bytEncoded = objMemoryStream.ToArray
objMemoryStream.Close()
Catch
End Try
' ***********************************************************************
' ****** Return encryptes value (converted from byte Array to ******
' ****** a base64 string). Base64 is MIME encoding) ******
' ***********************************************************************
Return bytEncoded
End Function
#End Region
#Region " DecryptString() "
Public Shared Function decryptString(ByVal bytDataToBeDecrypted As Byte(), ByVal decryptionKey As String) As String
Dim bytTemp() As Byte
Dim bytIV() As Byte = {121, 241, 10, 1, 132, 74, 11, 39, 255, 91, 45, 78, 14, 211, 22, 62}
Dim objRijndaelManaged As New RijndaelManaged
Dim objMemoryStream As MemoryStream
Dim objCryptoStream As CryptoStream
Dim bytDecryptionKey() As Byte
Dim intLength As Integer
Dim intRemaining As Integer
'Dim intCtr As Integer
Dim strReturnString As String = String.Empty
' ********************************************************************
' ****** Encryption Key must be 256 bits long (32 bytes) ******
' ****** If it is longer than 32 bytes it will be truncated. ******
' ****** If it is shorter than 32 bytes it will be padded ******
' ****** with upper-case Xs. ******
' ********************************************************************
intLength = Len(decryptionKey)
If intLength >= 32 Then
decryptionKey = Left(decryptionKey, 32)
Else
intLength = Len(decryptionKey)
intRemaining = 32 - intLength
decryptionKey = decryptionKey & StrDup(intRemaining, "X")
End If
bytDecryptionKey = Encoding.ASCII.GetBytes(decryptionKey.ToCharArray)
ReDim bytTemp(bytDataToBeDecrypted.Length)
objMemoryStream = New MemoryStream(bytDataToBeDecrypted)
' ***********************************************************************
' ****** Create the decryptor and write value to it after it is ******
' ****** converted into a byte array ******
' ***********************************************************************
Try
objCryptoStream = New CryptoStream(objMemoryStream, objRijndaelManaged.CreateDecryptor(bytDecryptionKey, bytIV), CryptoStreamMode.Read)
objCryptoStream.Read(bytTemp, 0, bytTemp.Length)
objCryptoStream.FlushFinalBlock()
objMemoryStream.Close()
Catch
End Try
' *****************************************
' ****** Return decypted value ******
' *****************************************
Return StripNullCharacters(Encoding.ASCII.GetString(bytTemp))
End Function
#End Region
#Region " StripNullCharacters() "
Private Shared Function StripNullCharacters(ByVal vstrStringWithNulls As String) As String
Dim intPosition As Integer
Dim strStringWithOutNulls As String
intPosition = 1
strStringWithOutNulls = vstrStringWithNulls
Do While intPosition > 0
intPosition = InStr(intPosition, vstrStringWithNulls, vbNullChar)
If intPosition > 0 Then
strStringWithOutNulls = Left$(strStringWithOutNulls, intPosition - 1) &
Right$(strStringWithOutNulls, Len(strStringWithOutNulls) - intPosition)
End If
If intPosition > strStringWithOutNulls.Length Then
Exit Do
End If
Loop
Return strStringWithOutNulls
End Function
#End Region
#Region " getSHA1Hash "
Public Shared Function getSHA1Hash(ByVal data As String) As Byte()
Dim hashBytes As Byte() = Encoding.UTF8.GetBytes(data)
Dim sha1 As New SHA1CryptoServiceProvider()
Return sha1.ComputeHash(hashBytes)
End Function
#End Region
End Class
|
Imports Route4MeSDKLibrary.Route4MeSDK
Imports Route4MeSDKLibrary.Route4MeSDK.DataTypes
Imports Route4MeSDKLibrary.Route4MeSDK.QueryTypes
Namespace Route4MeSDKTest.Examples
Partial Public NotInheritable Class Route4MeExamples
''' <summary>
''' Reoptimize a route
''' </summary>
''' <param name="routeId">Route Id</param>
Public Sub ReoptimizeRoute(ByVal Optional routeId As String = Nothing)
' Create the manager with the api key
Dim route4Me = New Route4MeManager(ActualApiKey)
Dim isInnerExample As Boolean = If(routeId Is Nothing, True, False)
If isInnerExample Then
RunOptimizationSingleDriverRoute10Stops()
OptimizationsToRemove = New List(Of String)() From {
SD10Stops_optimization_problem_id
}
routeId = SD10Stops_route_id
End If
Dim routeParameters = New RouteParametersQuery() With {
.RouteId = routeId,
.ReOptimize = True
}
Dim errorString As String = Nothing
Dim dataObject As DataObjectRoute = route4Me.UpdateRoute(routeParameters, errorString)
PrintExampleRouteResult(dataObject, errorString)
If isInnerExample Then RemoveTestOptimizations()
End Sub
End Class
End Namespace
|
Imports RTIS.CommonVB
Public Class clsWorkOrderHandler
Private pWorkOrder As dmWorkOrder
Public Sub New(ByRef rWorkOrder As dmWorkOrder)
pWorkOrder = rWorkOrder
End Sub
Public Shared Function CreateInternalWorkOrder(ByVal vProductType As eProductType) As dmWorkOrder
Dim mRetVal As dmWorkOrder
mRetVal = New dmWorkOrder
mRetVal.isInternal = True
mRetVal.ProductTypeID = vProductType
mRetVal.DateCreated = Now.Date
mRetVal.Product = clsProductSharedFuncs.NewProductInstance(mRetVal.ProductTypeID)
mRetVal.PlannedStartDate = Now.Date
Return mRetVal
End Function
Public Shared Function CreateFromSalesOrderPhaseItems(ByRef rSalesOrderPhaseItems As List(Of clsSalesOrderPhaseItemInfo), ByVal vProductType As eProductType) As dmWorkOrder
Dim mRetVal As dmWorkOrder
Dim mWOA As dmWorkOrderAllocation
mRetVal = New dmWorkOrder
mRetVal.DateCreated = Now.Date
mRetVal.Product = clsProductSharedFuncs.NewProductInstance(vProductType)
mRetVal.ProductTypeID = vProductType
mRetVal.isInternal = True
If rSalesOrderPhaseItems IsNot Nothing Then
If rSalesOrderPhaseItems.Count > 0 Then
mRetVal.Product = rSalesOrderPhaseItems(0).Product
End If
End If
For Each mSalesOrderPhaseItem In rSalesOrderPhaseItems
mWOA = New dmWorkOrderAllocation
mWOA.SalesOrderPhaseItemID = mSalesOrderPhaseItem.SalesOrderPhaseItemID
mWOA.QuantityRequired = mSalesOrderPhaseItem.Qty
mRetVal.WorkOrderAllocations.Add(mWOA)
Next
Return mRetVal
End Function
End Class
|
Imports System
Imports System.Windows
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Imports DevExpress.Xpf.Charts
Imports DevExpress.Xpf.DemoBase
Namespace ChartsDemo
Public Class ChartsDemoModule
Inherits DemoModule
Private Shared ReadOnly ActualChartPropertyKey As DependencyPropertyKey = DependencyProperty.RegisterReadOnly("ActualChart", GetType(ChartControlBase), GetType(ChartsDemoModule), New PropertyMetadata(Nothing))
Public Shared ReadOnly ActualChartProperty As DependencyProperty = ActualChartPropertyKey.DependencyProperty
Public Property ActualChart() As ChartControlBase
Get
Return CType(GetValue(ActualChartProperty), ChartControlBase)
End Get
Protected Set(ByVal value As ChartControlBase)
SetValue(ActualChartPropertyKey, value)
End Set
End Property
Public Sub New()
End Sub
Protected Overrides Sub Show()
MyBase.Show()
If ActualChart IsNot Nothing AndAlso ActualChart.Palette IsNot Nothing Then
ActualChart.Palette.ColorCycleLength = 10
End If
End Sub
End Class
End Namespace
Namespace CommonChartsDemo
Public Class CommonChartsDemoModule
Inherits ChartsDemo.ChartsDemoModule
End Class
End Namespace
|
'
' DotNetNuke® - http://www.dotnetnuke.com
' Copyright (c) 2002-2010
' by DotNetNuke Corporation
'
' 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.
'
Imports DotNetNuke.Services.Tokens
Namespace DotNetNuke.Modules.Feedback
Public Class FeedbackInfo
Inherits Entities.BaseEntityInfo
Implements Entities.Modules.IHydratable
Implements Services.Tokens.IPropertyAccess
Enum FeedbackStatusType As Integer
StatusPending = 0
StatusPrivate
StatusPublic
StatusArchive
StatusDelete
StatusSpam
End Enum
#Region "Private Members"
Private _feedbackID As Integer
Private _status As FeedbackStatusType
Private _publishedOnDate As Date
Private _senderStreet As String
Private _senderCity As String
Private _senderRegion As String
Private _senderCountry As String
Private _senderPostalCode As String
Private _senderEmail As String
Private _senderTelephone As String
Private _senderRemoteAddr As String
Private _approvedBy As Integer
Private _moduleID As Integer
Private _categoryID As String
Private _totalRecords As Integer
Private _message As String
Private _subject As String
Private _portalID As Integer
Private _senderName As String
Private _categoryValue As String
Private _categoryName As String
Private _referrer As String
Private _userAgent As String
Private _contextKey As String
Private _displayCreatedOnDate As DateTime
#End Region
#Region "Public Properties"
Public Property FeedbackID() As Integer
Get
Return _feedbackID
End Get
Set(ByVal value As Integer)
_feedbackID = Value
End Set
End Property
Public Property ModuleID() As Integer
Get
Return _moduleID
End Get
Set(ByVal value As Integer)
_moduleID = Value
End Set
End Property
Public Property PortalID() As Integer
Get
Return _portalID
End Get
Set(ByVal value As Integer)
_portalID = value
End Set
End Property
Public Property CategoryID() As String
Get
Return _categoryID
End Get
Set(ByVal value As String)
_categoryID = Value
End Set
End Property
Public Property CategoryValue() As String
Get
Return _categoryValue
End Get
Set(ByVal value As String)
_categoryValue = Value
End Set
End Property
Public Property CategoryName() As String
Get
Return _categoryName
End Get
Set(ByVal value As String)
_categoryName = value
End Set
End Property
Public Property Status() As FeedbackStatusType
Get
Return _status
End Get
Set(ByVal value As FeedbackStatusType)
_status = Value
End Set
End Property
Public Property Subject() As String
Get
Return _subject
End Get
Set(ByVal value As String)
_subject = Value
End Set
End Property
Public Property Message() As String
Get
Return _message
End Get
Set(ByVal value As String)
_message = Value
End Set
End Property
Public Property PublishedOnDate() As Date
Get
Return _publishedOnDate
End Get
Set(ByVal value As Date)
_publishedOnDate = Value
End Set
End Property
Public Property SenderName() As String
Get
Return _senderName
End Get
Set(ByVal value As String)
_senderName = value
End Set
End Property
Public Property SenderStreet() As String
Get
Return _senderStreet
End Get
Set(ByVal value As String)
_senderStreet = Value
End Set
End Property
Public Property SenderCity() As String
Get
Return _senderCity
End Get
Set(ByVal value As String)
_senderCity = Value
End Set
End Property
Public Property SenderRegion() As String
Get
Return _senderRegion
End Get
Set(ByVal value As String)
_senderRegion = Value
End Set
End Property
Public Property SenderCountry() As String
Get
Return _senderCountry
End Get
Set(ByVal value As String)
_senderCountry = Value
End Set
End Property
Public Property SenderPostalCode() As String
Get
Return _senderPostalCode
End Get
Set(ByVal value As String)
_senderPostalCode = Value
End Set
End Property
Public Property SenderEmail() As String
Get
Return _senderEmail
End Get
Set(ByVal value As String)
_senderEmail = Value
End Set
End Property
Public Property SenderTelephone() As String
Get
Return _senderTelephone
End Get
Set(ByVal value As String)
_senderTelephone = Value
End Set
End Property
Public Property SenderRemoteAddr() As String
Get
Return _senderRemoteAddr
End Get
Set(ByVal value As String)
_senderRemoteAddr = value
End Set
End Property
Public Property ApprovedBy() As Integer
Get
Return _approvedBy
End Get
Set(ByVal value As Integer)
_approvedBy = Value
End Set
End Property
Public Property TotalRecords() As Integer
Get
Return _totalRecords
End Get
Set(ByVal value As Integer)
_totalRecords = Value
End Set
End Property
Public Property Referrer() As String
Get
Return _referrer
End Get
Set(ByVal value As String)
_referrer = value
End Set
End Property
Public Property UserAgent() As String
Get
Return _userAgent
End Get
Set(ByVal value As String)
_userAgent = value
End Set
End Property
Public Property ContextKey() As String
Get
Return _contextKey
End Get
Set(ByVal value As String)
_contextKey = value
End Set
End Property
Public Property DisplayCreatedOnDate() As DateTime
Get
Return Utilities.ConvertServerTimeToUserTime(CreatedOnDate)
End Get
Set(ByVal value As DateTime)
_displayCreatedOnDate = value
End Set
End Property
#End Region
#Region "IHydratable Implementation"
Public Sub Fill(ByVal dr As IDataReader) Implements Entities.Modules.IHydratable.Fill
FillInternal(dr) 'Read audit fields
With dr
ModuleID = Null.SetNullInteger(dr("ModuleID"))
FeedbackID = Null.SetNullInteger(dr("FeedbackID"))
PortalID = Null.SetNullInteger(dr("PortalID"))
Status = CType(If(Null.IsNull(dr("Status")), 0, dr("Status")), FeedbackStatusType)
CategoryID = Null.SetNullString(dr("CategoryID"))
CategoryValue = Null.SetNullString(dr("CategoryValue"))
CategoryName = Null.SetNullString(dr("CategoryName"))
Subject = Null.SetNullString(dr("Subject"))
Message = Null.SetNullString(dr("Message"))
SenderName = Null.SetNullString(dr("SenderName"))
SenderStreet = Null.SetNullString(dr("SenderStreet"))
SenderCity = Null.SetNullString(dr("SenderCity"))
SenderRegion = Null.SetNullString(dr("SenderRegion"))
SenderPostalCode = Null.SetNullString(dr("SenderPostalCode"))
SenderCountry = Null.SetNullString(dr("SenderCountry"))
SenderEmail = Null.SetNullString(dr("SenderEmail"))
SenderTelephone = Null.SetNullString(dr("SenderTelephone"))
SenderRemoteAddr = Null.SetNullString(dr("SenderRemoteAddr"))
ApprovedBy = Null.SetNullInteger(dr("ApprovedBy"))
PublishedOnDate = Null.SetNullDateTime(dr("PublishedOnDate"))
TotalRecords = Null.SetNullInteger(dr("TotalRecords"))
Referrer = Null.SetNullString(dr("Referrer"))
UserAgent = Null.SetNullString(dr("UserAgent"))
ContextKey = Null.SetNullString(dr("ContextKey"))
End With
End Sub
Public Property KeyID() As Integer Implements Entities.Modules.IHydratable.KeyID
Get
Return FeedbackID
End Get
Set(ByVal value As Integer)
FeedbackID = value
End Set
End Property
#End Region
#Region "IPropertyAccess Implementation"
Public ReadOnly Property Cacheability() As Services.Tokens.CacheLevel Implements Services.Tokens.IPropertyAccess.Cacheability
Get
Return CacheLevel.fullyCacheable
End Get
End Property
Public Function GetProperty(ByVal strPropertyName As String, ByVal strFormat As String, ByVal formatProvider As Globalization.CultureInfo, ByVal accessingUser As Entities.Users.UserInfo, ByVal accessLevel As Services.Tokens.Scope, ByRef propertyNotFound As Boolean) As String Implements Services.Tokens.IPropertyAccess.GetProperty
Dim outputFormat As String
If strFormat = String.Empty Then
outputFormat = "g"
Else
outputFormat = strFormat
End If
'Content locked for NoSettings
If accessLevel = Scope.NoSettings Then PropertyNotFound = True : Return PropertyAccess.ContentLocked
Dim result As String = String.Empty
Dim publicProperty As Boolean = True
Select Case strPropertyName.ToLowerInvariant
Case "feedbackid"
publicProperty = True : PropertyNotFound = False : result = FeedbackID.ToString(outputFormat, formatProvider)
Case "category", "categoryvalue"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(CategoryValue, strFormat)
Case "categoryname"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(CategoryName, strFormat)
Case "categoryid"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(CategoryID, strFormat) 'note that CategoryID is System.Type.String
Case "status"
publicProperty = True : PropertyNotFound = False : result = Localization.GetString(Status.ToString, Configuration.SharedResources)
Case "subject"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(Subject, strFormat)
Case "message"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(Message, strFormat)
Case "sendername"
If String.IsNullOrEmpty(SenderName) Then
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(Localization.GetString("Anonymous", Configuration.SharedResources), strFormat)
Else
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderName, strFormat)
End If
Case "senderstreet"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderStreet, strFormat)
Case "sendercity"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderCity, strFormat)
Case "senderregion"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderRegion, strFormat)
Case "sendercountry"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderCountry, strFormat)
Case "senderpostalcode"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderPostalCode, strFormat)
Case "sendertelephone"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderTelephone, strFormat)
Case "senderremoteaddr"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderRemoteAddr, strFormat)
Case "senderemail"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(SenderEmail, strFormat)
Case "createdondateutc", "datecreated"
publicProperty = True
PropertyNotFound = False
If CreatedOnDate <> DateTime.MinValue Then
result = Utilities.ConvertServerTimeToUserTime(CreatedOnDate).ToString(outputFormat, formatProvider)
End If
Case "publishedondate"
publicProperty = True
propertyNotFound = False
If PublishedOnDate <> DateTime.MinValue Then
result = Utilities.ConvertServerTimeToUserTime(PublishedOnDate).ToString(outputFormat, formatProvider)
End If
Case "lastmodifiedondate"
publicProperty = True
propertyNotFound = False
If LastModifiedOnDate <> DateTime.MinValue Then
result = Utilities.ConvertServerTimeToUserTime(LastModifiedOnDate).ToString(outputFormat, formatProvider)
End If
Case "referrer"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(Referrer, strFormat)
Case "useragent"
publicProperty = True : PropertyNotFound = False : result = PropertyAccess.FormatString(UserAgent, strFormat)
Case Else
PropertyNotFound = True
End Select
If Not publicProperty And accessLevel <> Scope.Debug Then
PropertyNotFound = True
result = PropertyAccess.ContentLocked
End If
Return result
End Function
#End Region
End Class
End Namespace |
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Data
Imports System.Text.RegularExpressions '引入正则表达式命名空间
Imports System.IO.IsolatedStorage
Public Class Form1
'定义了一个到处函数
Public Function daochu(ByVal x As DataGridView, ByVal filename As String, ByVal n As Integer) As Boolean '导出到Excel函数
Try
If x.Rows.Count <= 0 Then '判断记录数,如果没有记录就退出
MessageBox.Show("没有记录可以导出", "没有可以导出的项目", MessageBoxButtons.OK, MessageBoxIcon.Information)
Return False
Else '如果有记录就导出到Excel
Dim xx As Object : Dim yy As Object
xx = CreateObject("Excel.Application") '创建Excel对象
yy = xx.workbooks.add()
Dim i As Integer, u As Integer = 0, v As Integer = 0 '定义循环变量,行列变量
For i = 1 To x.Columns.Count '把表头写入Excel
yy.worksheets(n).cells(1, i) = x.Columns(i - 1).HeaderCell.Value
Next
Dim str(x.Rows.Count - 1, x.Columns.Count - 1) '定义一个二维数组
For u = 1 To x.Rows.Count '行循环
For v = 1 To x.Columns.Count '列循环
If x.Item(v - 1, u - 1).Value.GetType.ToString <> "System.Guid" Then
str(u - 1, v - 1) = x.Item(v - 1, u - 1).Value
Else
str(u - 1, v - 1) = x.Item(v - 1, u - 1).Value.ToString
End If
Next
Next
yy.worksheets(n).range("A2").Resize(x.Rows.Count, x.Columns.Count).Value = str '把数组一起写入Excel
yy.worksheets(n).Cells.EntireColumn.AutoFit() '自动调整Excel列
'yy.worksheets(1).name = x.TopLeftHeaderCell.Value.ToString '表标题写入作为Excel工作表名称
xx.visible = False '设置Excel可见
Select Case xx.Workbooks(1).worksheets(1).UsedRange.Columns.Count
Case 4
xx.Workbooks(1).worksheets(1).UsedRange.font.size = 17
xx.Workbooks(1).worksheets(1).UsedRange.Borders(1).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(2).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(3).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(4).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.EntireColumn.AutoFit()
xx.Workbooks(1).worksheets(1).Columns("A:A").HorizontalAlignment = 3
xx.Workbooks(1).worksheets(1).Columns("A:A").NumberFormatLocal = "000000"
xx.Workbooks(1).worksheets(1).Columns("C:C").HorizontalAlignment = 3
xx.Workbooks(1).worksheets(1).Columns("C:C").NumberFormatLocal = "000000"
Case 2
xx.Workbooks(1).worksheets(1).UsedRange.font.size = 12
xx.Workbooks(1).worksheets(1).UsedRange.Borders(1).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(2).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(3).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.Borders(4).LineStyle = 1
xx.Workbooks(1).worksheets(1).UsedRange.EntireColumn.AutoFit()
End Select
xx.Workbooks(1).SaveCopyAs(filename) '保存
yy = Nothing '销毁组建释放资源
xx = Nothing '销毁组建释放资源
End If
Return True
Catch ex As Exception '错误处理
MessageBox.Show(Err.Description.ToString, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error) '出错提示
Return False
End Try
End Function
'定义一个VIN码计算函数
Public Function VIN(ByVal q8 As String, ByVal h8 As String)
' 定义a(17)为加权系数
Dim a() As Integer = {8, 7, 6, 5, 4, 3, 2, 10, 0, 9, 8, 7, 6, 5, 4, 3, 2}
Dim b(17) As String ' 定义b(17)为16各种字母加加权位
Dim z As String
z = ""
If q8 <> "" And h8 <> "" Then
Dim str17 As String
str17 = q8 + "X" + h8
For i = 0 To 16
b(i) = Mid(str17, i + 1, 1)
Next
Dim c() As String = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F", "G", "H", "J", "K", "L", "M", "N", "P", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
Dim d() As Integer = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7, 8, 1, 2, 3, 4, 5, 7, 9, 2, 3, 4, 5, 6, 7, 8, 9}
Dim f() As Integer = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
For p = 0 To 16
For q = 0 To 32
If b(p) = c(q) Then
f(p) = d(q)
End If
Next
Next
Dim sum, x As Integer
sum = 0
x = 0
For i = 0 To 16
sum = sum + a(i) * f(i)
Next
x = sum Mod 11
If x = 10 Then
z = q8 + "X" + h8
Else
z = q8 + x.ToString + h8
End If
End If
Return z
LabelState.Text = "行:0"
TLabel2.Text = ""
End Function
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
'首先清空datagrid
DataGridView1.Columns.Clear()
'Dim myStream As System.IO.Stream
OpenFileDialog1.InitialDirectory = My.Computer.FileSystem.CurrentDirectory
OpenFileDialog1.Filter = "Excel 2003(*.xls)|*.xls|Excel 2007(*.xlsa)|*.xlsa|所有文件 (*.*)|*.*"
OpenFileDialog1.FilterIndex = 1
OpenFileDialog1.Title = "请选择VIN码导入文件"
OpenFileDialog1.RestoreDirectory = True
OpenFileDialog1.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory
OpenFileDialog1.FileName = ""
If OpenFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Dim fileName As String
fileName = Me.OpenFileDialog1.FileName
'建立EXCEL连接,读入数据
Dim myDataset As New DataSet
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & fileName & "'; Extended Properties='Excel 8.0;HDR=YES;IMEX=2'"
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$A:D] where len(trim(物料编码))>0", strConn)
Try
da.Fill(myDataset)
Me.DataGridView1.DataSource = myDataset.Tables(0)
ToolStripButton4.Enabled = True '可以计算
'******载入后对列宽度进行重新规定*****'
DataGridView1.Columns(0).Width = 140
DataGridView1.Columns(1).Width = 103
DataGridView1.Columns(2).Width = 165
DataGridView1.Columns(3).Width = 165
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End If
End Sub
Private Sub DT1_CtMStrip1_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs)
End Sub
Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
End Sub
Private Sub DataGridView1_Resize(sender As Object, e As EventArgs) Handles DataGridView1.Resize
End Sub
Private Sub DataGridView1_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LabelState.Text = "欢迎使用VIN码编制软件!技术支持:工艺科范建鹏,电话:83388352。"
ToolStripTextBox2.Width = WebBrowser1.Width - ToolStripButton20.Width - 20
WebBrowser1.Url = New Uri("file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString.Replace("\", "/") + "res/shouce/首页.html")
End Sub
Private Sub 复制CToolStripMenuItem_Click(sender As Object, e As EventArgs)
System.Windows.Forms.Clipboard.Clear()
System.Windows.Forms.Clipboard.SetDataObject(DataGridView1.CurrentCell.Value)
End Sub
Private Sub ToolStripButton9_Click(sender As Object, e As EventArgs)
Dim i, j As Integer
Dim pRow, pCol As Integer
Dim selectedCellCount As Integer
Dim startRow, startCol, endRow, endCol As Integer
Dim pasteText, strline, strVal As String
Dim strlines, vals As String()
Dim pasteData(,) As String
Dim flag As Boolean = False
' 当前单元格是否选择的判断
If DataGridView1.CurrentCell Is Nothing Then
Return
End If
Dim insertRowIndex As Integer = DataGridView1.CurrentCell.RowIndex
' 获取DataGridView选择区域,并计算要复制的行列开始、结束位置
startRow = 9999
startCol = 9999
endRow = 0
endCol = 0
selectedCellCount = DataGridView1.GetCellCount(DataGridViewElementStates.Selected)
For i = 0 To selectedCellCount - 1
startRow = Math.Min(DataGridView1.SelectedCells(i).RowIndex, startRow)
startCol = Math.Min(DataGridView1.SelectedCells(i).ColumnIndex, startCol)
endRow = Math.Max(DataGridView1.SelectedCells(i).RowIndex, endRow)
endCol = Math.Max(DataGridView1.SelectedCells(i).ColumnIndex, endCol)
Next
' 获取剪切板的内容,并按行分割
pasteText = Clipboard.GetText()
If String.IsNullOrEmpty(pasteText) Then
Return
End If
pasteText = pasteText.Replace(vbCrLf, vbLf)
ReDim strlines(0)
strlines = pasteText.Split(vbLf)
pRow = strlines.Length '行数
pCol = 0
For Each strline In strlines
ReDim vals(0)
vals = strline.Split(New Char() {vbTab, vbCr, vbNullChar, vbNullString}, 256, StringSplitOptions.RemoveEmptyEntries) ' 按Tab分割数据
pCol = Math.Max(vals.Length, pCol) '列数
Next
ReDim pasteData(pRow, pCol)
pasteText = Clipboard.GetText()
pasteText = pasteText.Replace(vbCrLf, vbLf)
ReDim strlines(0)
strlines = pasteText.Split(vbLf)
i = 1
For Each strline In strlines
j = 1
ReDim vals(0)
strline.TrimEnd(New Char() {vbLf})
vals = strline.Split(New Char() {vbTab, vbCr, vbNullChar, vbNullString}, 256, StringSplitOptions.RemoveEmptyEntries)
For Each strVal In vals
pasteData(i, j) = strVal
j = j + 1
Next
i = i + 1
Next
flag = False
For j = 1 To pCol
If pasteData(pRow, j) <> "" Then
flag = True
Exit For
End If
Next
If flag = False Then
pRow = Math.Max(pRow - 1, 0)
End If
For i = 1 To endRow - startRow + 1
Dim row As DataGridViewRow = DataGridView1.Rows(i + startRow - 1)
If i <= pRow Then
For j = 1 To endCol - startCol + 1
If j <= pCol Then
row.Cells(j + startCol - 1).Value = pasteData(i, j)
Else
Exit For
End If
Next
Else
Exit For
End If
Next
'清除剪切板原有内容,将表格数据复制到剪切板
System.Windows.Forms.Clipboard.Clear()
System.Windows.Forms.Clipboard.SetDataObject(DataGridView1.GetClipboardContent())
End Sub
Private Sub ToolStripButton6_Click(sender As Object, e As EventArgs) Handles ToolStripButton6.Click
DataGridView1.Rows.Remove(DataGridView1.CurrentRow)
Try
TLabel2.Text = "(第" + (DataGridView1.CurrentCell.RowIndex + 1).ToString + "行,第" + (DataGridView1.CurrentCell.ColumnIndex + 1).ToString + "列)" + DataGridView1.CurrentCell.ErrorText
TLabel2.Text = TLabel2.Text.Replace(Microsoft.VisualBasic.Constants.vbCrLf, "@")
Catch ex As Exception
End Try
End Sub
Private Sub 删除DToolStripMenuItem_Click(sender As Object, e As EventArgs)
DataGridView1.Rows.Remove(DataGridView1.CurrentRow)
Try
TLabel2.Text = "(第" + (DataGridView1.CurrentCell.RowIndex + 1).ToString + "行,第" + (DataGridView1.CurrentCell.ColumnIndex + 1).ToString + "列)" + DataGridView1.CurrentCell.ErrorText
TLabel2.Text = TLabel2.Text.Replace(Microsoft.VisualBasic.Constants.vbCrLf, "@")
Catch ex As Exception
End Try
End Sub
Private Sub ToolStripButton4_Click(sender As Object, e As EventArgs) Handles ToolStripButton4.Click
DataGridView2.Rows.Clear() '每次计算前先清空datagridview2 普通
DataGridView3.Rows.Clear() '每次计算前先清空datagridview3 MES
DataGridView4.Rows.Clear() '每次计算前先清空datagridview4 打印
For i = 0 To DataGridView1.RowCount - 1
Dim cx As String = "" '车型
Dim VIN8 As String = "" 'VIN码前8位
Dim nfbh As String '年份编号
Dim lsh_s As Integer '流水号开始
Dim lsh_o As Integer '流水号结束
Dim rwh As String = "" '任务号
'首先判断改行是否为空
If DataGridView1.Rows(i).Cells(0).Value.ToString <> "" And DataGridView1.Rows(i).Cells(1).Value.ToString <> "" And DataGridView1.Rows(i).Cells(2).Value.ToString <> "" And DataGridView1.Rows(i).Cells(3).Value.ToString <> "" Then
nfbh = Mid(DataGridView1.Rows(i).Cells(2).Value.ToString, 1, 2) '取得年份编号“DG”等
rwh = Trim(DataGridView1.Rows(i).Cells(3).Value.ToString)
If Len(Trim(DataGridView1.Rows(i).Cells(2).Value.ToString)) = 17 Then
lsh_s = Val(Mid(DataGridView1.Rows(i).Cells(2).Value.ToString, 3, 6)) '取得流水号串中第一个流水号
lsh_o = Val(Mid(DataGridView1.Rows(i).Cells(2).Value.ToString, 12, 6)) '取得流水号串中最后一个流水号
Else
lsh_s = Val(Mid(DataGridView1.Rows(i).Cells(2).Value.ToString, 3, 6)) '取得流水号串中第一个流水号
lsh_o = Val(Mid(DataGridView1.Rows(i).Cells(2).Value.ToString, 3, 6)) '取得流水号串中最后一个流水号
End If
cx = DataGridView1.Rows(i).Cells(0).Value.ToString & "/" & (lsh_o - lsh_s + 1).ToString & "辆" '取得车型
VIN8 = DataGridView1.Rows(i).Cells(1).Value.ToString '取得VIN码前8位
Dim lsh(lsh_o - lsh_s + 1), lsh3(lsh_o - lsh_s + 1) As String
Dim VIN18(lsh_o - lsh_s + 1), VIN183(lsh_o - lsh_s + 1) As String
Dim cxx As New DataGridViewRow
'定义车型、数量行
cxx.CreateCells(DataGridView2)
cxx.Cells(0).Value = ""
cxx.Cells(1).Value = cx
cxx.Cells(2).Value = ""
cxx.Cells(3).Value = rwh
DataGridView2.Rows.Add(cxx)
For q = lsh_s To lsh_o
'定义流水号、VIN码列
Dim sj1 As New DataGridViewRow
Dim sj2 As New DataGridViewRow
sj1.CreateCells(DataGridView3)
sj2.CreateCells(DataGridView4)
lsh3(q - lsh_s) = nfbh + StrDup(8 - 2 - Len(q.ToString), "0") + q.ToString '算出每一个流水号
If VIN8 <> "" And lsh(q - lsh_s) <> "0" Then
VIN183(q - lsh_s) = VIN(VIN8, lsh3(q - lsh_s)) '算出每一个VIN码
End If
sj1.Cells(0).Value = lsh3(q - lsh_s)
sj1.Cells(1).Value = VIN183(q - lsh_s)
sj2.Cells(0).Value = VIN183(q - lsh_s)
sj2.Cells(1).Value = rwh
DataGridView3.Rows.Add(sj1)
DataGridView4.Rows.Add(sj2)
Next
'实验()
'实验()
For p = lsh_s To lsh_o Step 2
'定义流水号、VIN码列
Dim sj As New DataGridViewRow
sj.CreateCells(DataGridView2)
lsh(p - lsh_s) = nfbh + StrDup(8 - 2 - Len(p.ToString), "0") + p.ToString '算出每一个流水号
If VIN8 <> "" And lsh(p - lsh_s) <> "0" Then
VIN18(p - lsh_s) = VIN(VIN8, lsh(p - lsh_s)) '算出每一个VIN码
End If
sj.Cells(0).Value = StrDup(8 - 2 - Len(p.ToString), "0") + p.ToString
sj.Cells(1).Value = VIN18(p - lsh_s)
If p <= lsh_o - 1 Then
lsh(p + 1 - lsh_s) = nfbh + StrDup(8 - 2 - Len((p + 1).ToString), "0") + (p + 1).ToString '算出每一个流水号
If VIN8 <> "" And lsh(p + 1 - lsh_s) <> "0" Then
VIN18(p + 1 - lsh_s) = VIN(VIN8, lsh(p + 1 - lsh_s)) '算出每一个VIN码
End If
sj.Cells(2).Value = StrDup(8 - 2 - Len((p + 1).ToString), "0") + (p + 1).ToString
sj.Cells(3).Value = VIN18(p + 1 - lsh_s)
Else
sj.Cells(2).Value = ""
sj.Cells(3).Value = ""
End If
DataGridView2.Rows.Add(sj)
Next
End If
Next
End Sub
Private Sub ToolStripButton8_Click(sender As Object, e As EventArgs) Handles ToolStripButton8.Click
'导出普通上传格式
If DataGridView2.Rows.Count <= 0 Then '判断记录数,如果没有记录就退出
MessageBox.Show("没有记录可以导出", "没有可以导出的项目", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim saveExcel As SaveFileDialog
saveExcel = New SaveFileDialog
saveExcel.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
saveExcel.Filter = "Excel文件(.xlsx)|*.xlsx"
saveExcel.FileName = "VIN导出"
Dim filename As String
If saveExcel.ShowDialog = System.Windows.Forms.DialogResult.Cancel Then Exit Sub
filename = saveExcel.FileName
Try
daochu(DataGridView2, filename, 1)
TLabel2.Text = "保存成功!位置:" + filename.ToString
openbt.Visible = True
Catch ex As Exception
End Try
End If
'Dim i As Integer
'Dim proc As Process()
''判断excel进程是否存在
'If System.Diagnostics.Process.GetProcessesByName("excel").Length > 0 Then
' proc = Process.GetProcessesByName("excel")
' '得到名为excel进程个数,全部关闭
' For i = 0 To proc.Length - 1
' proc(i).Kill()
' Next
'End If
'proc = Nothing
End Sub
Private Sub ToolStripButton10_Click(sender As Object, e As EventArgs)
AboutBox1.Show()
End Sub
Private Sub ToolStripButton11_Click(sender As Object, e As EventArgs)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs)
End Sub
Private Sub DataGridView1_CellValueChanged(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellValueChanged
End Sub
Private Sub DataGridView1_CellStateChanged(sender As Object, e As DataGridViewCellStateChangedEventArgs) Handles DataGridView1.CellStateChanged
Dim cx, qd, Vqd As String
cx = ""
qd = ""
Try
For i = 0 To DataGridView1.RowCount - 1
DataGridView1.Rows(i).Cells(1).ErrorText = ""
cx = Trim(DataGridView1.Rows(i).Cells(0).Value.ToString)
Dim num As String = Regex.Replace(cx, "[\D]", "") '取出数字
If Len(num) > 5 Then '是否大于5
If IsNumeric(Microsoft.VisualBasic.Mid(cx, 7, 1)) Then '如果时数字
qd = Microsoft.VisualBasic.Mid(num, 8, 1)
Else
qd = Microsoft.VisualBasic.Mid(num, 7, 1)
End If
Else
'进行特殊车型判断
Select Case Microsoft.VisualBasic.Mid(cx, 1, 6)
Case "SX2110"
qd = "2"
Case "SX2180"
qd = "2"
Case "SX2150"
qd = "5"
Case "SX2160"
qd = "2"
Case "SX2151"
qd = "2"
Case "SX2153"
qd = "5"
Case "SX2180"
qd = "2"
Case "SX2190"
qd = "5"
Case "SX2300"
qd = "7"
Case "SX4260"
qd = "5"
Case "SX4323"
qd = "5"
Case "SX4400"
qd = "7"
Case "SX1380"
qd = "6"
Case "1291.2"
qd = "2"
Case "1491.2"
qd = "4"
End Select
End If
If Len(Trim(DataGridView1.Rows(i).Cells(1).Value.ToString)) = 8 Then
Vqd = ""
Vqd = Microsoft.VisualBasic.Right(Trim(DataGridView1.Rows(i).Cells(1).Value.ToString), 1)
If qd <> Vqd Then
DataGridView1.Rows(i).Cells(1).ErrorText = Microsoft.VisualBasic.Constants.vbCrLf + "车型驱动位为" + qd + ",VIN码驱动位为" + Vqd
End If
End If
Next
Catch ex As Exception
End Try
End Sub
Private Sub ComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripButton5_Click(sender As Object, e As EventArgs)
Dim fileName As String
fileName = Me.OpenFileDialog1.FileName
'建立EXCEL连接,读入数据
Dim myDataset As New DataSet
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='" & fileName & "'; Extended Properties='Excel 8.0;HDR=YES;IMEX=2'"
Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$A:C] where len(trim(物料编码))>0", strConn)
Try
da.Fill(myDataset)
Dim dr As DataRow = myDataset.Tables(0).NewRow
For i = 0 To DataGridView1.RowCount - 1
dr(i) = ""
Next
myDataset.Tables(0).Rows.Add(dr)
Me.DataGridView1.DataSource = Nothing
Me.DataGridView1.DataSource = myDataset.Tables(0)
ToolStripButton4.Enabled = True '可以计算
'******载入后对列宽度进行重新规定*****'
DataGridView1.Columns(0).Width = 140
DataGridView1.Columns(1).Width = 103
DataGridView1.Columns(2).Width = 165
Catch ex As Exception
MsgBox(ex.Message.ToString)
End Try
End Sub
Private Sub 插入IToolStripMenuItem_Click(sender As Object, e As EventArgs)
End Sub
Private Sub datagridview1_cellerrortextneeded(sender As Object, e As DataGridViewCellErrorTextNeededEventArgs) Handles DataGridView1.CellErrorTextNeeded
'错误判断()
'1、车型前两位为SX
'2、VIN码前3为必须为lzg;
'3、第4位必须为c或者j
'4、长度为8
'5、VIN中不会包含 I、O、Q 三个英文字母*******重要
'************************高级判断**************************************
'6、如果第4位为C,第5位位2或3
'8、驱动判断
' 8.1、如果车型第三位不为2或5,取第11位与第8位比较、
' 8.2、如果车型第三位为2,拿SX2190、2150、2151、2110、2153、2300、4323、4260、等进行判断
' 8.3 如果车型第三位为5,第2个字幕组后3比较
Dim dgv As DataGridView = CType(sender, DataGridView)
Dim cellVal As Object = dgv(e.ColumnIndex, e.RowIndex).Value
'1、车型前两位为SX
If e.ColumnIndex = 0 And Microsoft.VisualBasic.Left(Trim(cellVal.ToString), 2) <> "SX" Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "车型前应该有" & """" & "SX" & """"
End If
'2、VIN码前3为必须为lzg;
If e.ColumnIndex = 1 And Microsoft.VisualBasic.Left(Trim(cellVal.ToString), 3) <> "LZG" Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN码前3位应为" & """" & "LZG" & """"
End If
'3、第4位必须为c或者j
'4、长度为8
If e.ColumnIndex = 1 And Microsoft.VisualBasic.Len(Trim(cellVal.ToString)) > 8 Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN码大于8位,应为8位"
End If
If e.ColumnIndex = 1 And Microsoft.VisualBasic.Len(Trim(cellVal.ToString)) < 8 Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN码小于8位,应为8位"
End If
'5、VIN中不会包含 I、O、Q 三个英文字母*******重要
If e.ColumnIndex = 1 And InStr(Trim(cellVal.ToString), "I") Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN中不会包含 I、O、Q 三个英文字母"
End If
If e.ColumnIndex = 1 And InStr(Trim(cellVal.ToString), "O") Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN中不会包含 I、O、Q 三个英文字母"
End If
If e.ColumnIndex = 1 And InStr(Trim(cellVal.ToString), "Q") Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "VIN中不会包含 I、O、Q 三个英文字母"
End If
'6、如果第4位为C,第6位位2或3
If e.ColumnIndex = 1 And Microsoft.VisualBasic.Mid(Trim(cellVal.ToString), 4, 1) = "C" Then
If e.ColumnIndex = 1 And InStr("23", Microsoft.VisualBasic.Mid(Trim(cellVal.ToString), 6, 1)) Then
Else
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + "非完整车辆VIN码第6位应为" & """" & "2或3" & """"
End If
End If
'7、任务号前3位为Z2F
If e.ColumnIndex = 3 And Microsoft.VisualBasic.Mid(Trim(cellVal.ToString), 1, 3) <> "Z2F" Then
e.ErrorText += Microsoft.VisualBasic.Constants.vbCrLf + cellVal.ToString + "开头非事业部任务号"
End If
'8、驱动判断 驱动的判读是一个粗略的判断,因为车型编码规则在陕汽执行不是很严格。——范建鹏 2013年8月29日
'8.1先从车型中将数字全部提取出来,然后判断位数(小于5,则为特殊车型,不然)车型第7位是否为数字,如果是,取8,不然,取7
End Sub
Private Sub DataGridView1_CellValidating(sender As Object, e As DataGridViewCellValidatingEventArgs) Handles DataGridView1.CellValidating
'单元格错误显示
Try
'With Me.DataGridView1
' If e.ColumnIndex = 0 Then
' If Microsoft.VisualBasic.Left(Trim(e.FormattedValue), 2) <> "SX" Then
' Dim myerrot As String = "车型不正确"
' .Rows(e.RowIndex).ErrorText = myerrot
' e.Cancel = True
' End If
' End If
'End With
Catch ex As Exception
MessageBox.Show(ex.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Try
End Sub
Private Sub DataGridView1_CellEndEdit(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
With Me.DataGridView1
If e.ColumnIndex = 0 Then
.Rows(e.RowIndex).ErrorText = ""
End If
End With
End Sub
Private Sub ToolStripButton12_Click(sender As Object, e As EventArgs)
Me.DataGridView1.Rows.Clear()
Me.DataGridView1.Rows.Add(10)
End Sub
Private Sub DataGridView1_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DataGridView1.CellFormatting
Try
e.Value = e.Value.ToString.Trim
Catch ex As Exception
End Try
End Sub
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs)
End Sub
Private Sub 粘贴ToolStripMenuItem_Click(sender As Object, e As EventArgs)
End Sub
Private Sub DataGridView1_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseUp
End Sub
Private Sub DataGridView1_RowStateChanged(sender As Object, e As DataGridViewRowStateChangedEventArgs) Handles DataGridView1.RowStateChanged
LabelState.Text = "共" + DataGridView1.RowCount.ToString + "行"
End Sub
Private Sub DataGridView1_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseClick
Try
TLabel2.Text = "(第" + (DataGridView1.CurrentCell.RowIndex + 1).ToString + "行,第" + (DataGridView1.CurrentCell.ColumnIndex + 1).ToString + "列)" + DataGridView1.CurrentCell.ErrorText
TLabel2.Text = TLabel2.Text.Replace(Microsoft.VisualBasic.Constants.vbCrLf, "@")
Catch ex As Exception
End Try
End Sub
Private Sub ToolStripButton3_Click(sender As Object, e As EventArgs)
End Sub
Private Sub DataGridView1_CellContextMenuStripNeeded(sender As Object, e As DataGridViewCellContextMenuStripNeededEventArgs) Handles DataGridView1.CellContextMenuStripNeeded
End Sub
Private Sub ToolStripButton7_Click(sender As Object, e As EventArgs) Handles ToolStripButton7.Click
'导出MES格式
If DataGridView3.Rows.Count <= 0 Then '判断记录数,如果没有记录就退出
MessageBox.Show("没有记录可以导出", "没有可以导出的项目", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim saveExcel As SaveFileDialog
saveExcel = New SaveFileDialog
saveExcel.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
saveExcel.Filter = "Excel文件(.xlsx)|*.xlsx"
saveExcel.FileName = "VIN(MES)导出"
Dim filename As String
If saveExcel.ShowDialog = System.Windows.Forms.DialogResult.Cancel Then Exit Sub
filename = saveExcel.FileName
Try
daochu(DataGridView3, filename, 1)
TLabel2.Text = "保存成功!位置:" + filename.ToString
openbt.Visible = True
Catch ex As Exception
End Try
End If
'Dim i As Integer
'Dim proc As Process()
''判断excel进程是否存在
'If System.Diagnostics.Process.GetProcessesByName("excel").Length > 0 Then
' proc = Process.GetProcessesByName("excel")
' '得到名为excel进程个数,全部关闭
' For i = 0 To proc.Length - 1
' proc(i).Kill()
' Next
'End If
'proc = Nothing
End Sub
Private Sub Label_LZG_Click(sender As Object, e As EventArgs)
End Sub
Private Sub Label_LZG_MouseHover(sender As Object, e As EventArgs)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs)
End Sub
Private Sub Button_C_Click(sender As Object, e As EventArgs)
' Create an instance of the ListBox.
Dim listBox1 As New System.Windows.Forms.ListBox
' Set the size and location of the ListBox.
listBox1.Size = New System.Drawing.Size(200, 100)
listBox1.Location = New System.Drawing.Point(10, 10)
' Add the ListBox to the form.
Me.TabControl1.TabPages(1).Controls.Add(listBox1)
Me.TabControl1.TabPages(0).Controls.Add(listBox1)
Me.Controls.Add(listBox1)
' Set the ListBox to display items in multiple columns.
listBox1.MultiColumn = True
' Set the selection mode to multiple and extended.
listBox1.SelectionMode = SelectionMode.MultiExtended
' Shutdown the painting of the ListBox as items are added.
listBox1.BeginUpdate()
' Loop through and add 50 items to the ListBox.
Dim x As Integer
For x = 1 To 50
listBox1.Items.Add("Item " & x.ToString())
Next x
' Allow the ListBox to repaint and display the new items.
listBox1.EndUpdate()
' Select three items from the ListBox.
listBox1.SetSelected(1, True)
listBox1.SetSelected(3, True)
listBox1.SetSelected(5, True)
' Display the second selected item in the ListBox to the console.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedItems(1).ToString())
' Display the index of the first selected item in the ListBox.
System.Diagnostics.Debug.WriteLine(listBox1.SelectedIndices(0).ToString())
End Sub
Private Sub ListBox_4_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Private Sub Button_5_Click(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripComboBox1_Click(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripComboBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripComboBox1_TextChanged(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripButton5_Click_1(sender As Object, e As EventArgs)
End Sub
Private Sub ComboBox1_SelectedIndexChanged_1(sender As Object, e As EventArgs)
End Sub
Private Sub ToolStripDropDownButton1_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton3.Click
End Sub
Private Sub ToolStripDropDownButton1_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton3.DropDownItemClicked
ToolStripDropDownButton3.Text = Microsoft.VisualBasic.Left(Trim(ToolStripDropDownButton3.DropDownItems(ToolStripDropDownButton3.DropDownItems.IndexOf(e.ClickedItem)).Text), 1)
End Sub
Private Sub ToolStripDropDownButton2_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton2.Click
End Sub
Private Sub ToolStripDropDownButton2_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton2.DropDownItemClicked
ToolStripDropDownButton2.Text = Microsoft.VisualBasic.Left(Trim(ToolStripDropDownButton2.DropDownItems(ToolStripDropDownButton2.DropDownItems.IndexOf(e.ClickedItem)).Text), 1)
End Sub
Private Sub ToolStripDropDownButton4_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton4.Click
End Sub
Private Sub ToolStripDropDownButton4_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton4.DropDownItemClicked
ToolStripDropDownButton4.Text = Microsoft.VisualBasic.Left(Trim(ToolStripDropDownButton4.DropDownItems(ToolStripDropDownButton4.DropDownItems.IndexOf(e.ClickedItem)).Text), 1)
End Sub
Private Sub ToolStripDropDownButton5_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton5.Click
End Sub
Private Sub ToolStripDropDownButton5_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton5.DropDownItemClicked
ToolStripDropDownButton5.Text = Microsoft.VisualBasic.Left(Trim(ToolStripDropDownButton5.DropDownItems(ToolStripDropDownButton5.DropDownItems.IndexOf(e.ClickedItem)).Text), 1)
End Sub
Private Sub ToolStripDropDownButton6_Click(sender As Object, e As EventArgs) Handles ToolStripDropDownButton6.Click
End Sub
Private Sub ToolStripDropDownButton6_DropDownItemClicked(sender As Object, e As ToolStripItemClickedEventArgs) Handles ToolStripDropDownButton6.DropDownItemClicked
ToolStripDropDownButton6.Text = Microsoft.VisualBasic.Left(Trim(ToolStripDropDownButton6.DropDownItems(ToolStripDropDownButton6.DropDownItems.IndexOf(e.ClickedItem)).Text), 1)
End Sub
Private Sub ToolStripButton14_Click(sender As Object, e As EventArgs) Handles ToolStripButton14.Click
Dim q8, h8, x9 As String
h8 = ""
If ToolStripTextBox1.Text = "" Then
MsgBox("请输入流水号")
Else
If Len(Trim(ToolStripTextBox1.Text)) <> 8 Then
MsgBox("流水号应该为8位")
Else
h8 = Trim(ToolStripTextBox1.Text)
q8 = ToolStripButton5.Text + ToolStripDropDownButton2.Text + ToolStripDropDownButton3.Text + ToolStripDropDownButton4.Text + ToolStripDropDownButton5.Text + ToolStripDropDownButton6.Text
x9 = Microsoft.VisualBasic.Mid(Trim(VIN(q8, h8)), 9, 1)
ToolStripButton12.Text = x9
ToolStripLabel3.Text = "*" + Trim(VIN(q8, h8)) + "*"
ToolStripLabel2.Text = "计算结果:"
ToolStripButton5.Visible = False
ToolStripDropDownButton2.Visible = False
ToolStripDropDownButton3.Visible = False
ToolStripDropDownButton4.Visible = False
ToolStripDropDownButton5.Visible = False
ToolStripDropDownButton6.Visible = False
ToolStripButton12.Visible = False
ToolStripTextBox1.Visible = False
ToolStripLabel3.Visible = True
ToolStripButton14.Visible = False
ToolStripButton18.Visible = True '返回按钮
End If
End If
End Sub
Private Sub TabPage2_Click(sender As Object, e As EventArgs) Handles TabPage2.Click
End Sub
Private Sub ToolStripTextBox1_Click(sender As Object, e As EventArgs) Handles ToolStripTextBox1.Click
End Sub
Private Sub ToolStripTextBox1_TextChanged(sender As Object, e As EventArgs) Handles ToolStripTextBox1.TextChanged
ToolStripTextBox1.Text = ToolStripTextBox1.Text.ToUpper
End Sub
Private Sub ToolStripButton17_Click(sender As Object, e As EventArgs) Handles ToolStripButton17.Click
AboutBox1.Show()
End Sub
Private Sub ToolStripLabel3_Click(sender As Object, e As EventArgs) Handles ToolStripLabel3.Click
End Sub
Private Sub ToolStripButton18_Click(sender As Object, e As EventArgs) Handles ToolStripButton18.Click
ToolStripLabel2.Text = "代码选择:"
ToolStripButton5.Visible = True
ToolStripDropDownButton2.Visible = True
ToolStripDropDownButton3.Visible = True
ToolStripDropDownButton4.Visible = True
ToolStripDropDownButton5.Visible = True
ToolStripDropDownButton6.Visible = True
ToolStripButton12.Visible = True
ToolStripTextBox1.Visible = True
ToolStripLabel3.Visible = False
ToolStripButton14.Visible = True
ToolStripButton18.Visible = False
ToolStripButton12.Text = "?" '检验位
ToolStripTextBox1.Text = "" '流水号归0
End Sub
Private Sub ToolStripButton20_Click(sender As Object, e As EventArgs) Handles ToolStripButton20.Click
Try
If ToolStripTextBox2.Text <> "" Then
If Microsoft.VisualBasic.Left(Trim(ToolStripTextBox2.Text), 7) <> "http://" And Microsoft.VisualBasic.Left(Trim(ToolStripTextBox2.Text), 7) <> "file://" Then
WebBrowser1.Url = New Uri("http://" + ToolStripTextBox2.Text)
Else
WebBrowser1.Url = New Uri(ToolStripTextBox2.Text)
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
ToolStripTextBox2.Width = WebBrowser1.Width - ToolStripButton20.Width - 20
End Sub
Private Sub ListView2_ItemChecked(sender As Object, e As ItemCheckedEventArgs)
End Sub
Private Sub ListView2_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect
End Sub
Private Sub TreeView1_MouseClick(sender As Object, e As MouseEventArgs) Handles TreeView1.MouseClick
End Sub
Private Sub TreeView1_NodeMouseClick(sender As Object, e As TreeNodeMouseClickEventArgs) Handles TreeView1.NodeMouseClick
Try
Dim startPath As String
startPath = "file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString.Replace("\", "/")
Select Case e.Node.Name.ToString
Case "节点0"
ToolStripTextBox2.Text = "首页.html"
Case "节点1"
ToolStripTextBox2.Text = "1.装配计划的查询,导出.htm"
Case "节点2"
ToolStripTextBox2.Text = "2、VIN码及技术参数的编制.html"
Case "节点3"
ToolStripTextBox2.Text = "3、VIN及技术参数发放流程.htm"
Case "节点4"
ToolStripTextBox2.Text = "4、更改单发放流程.htm"
Case "节点5"
ToolStripTextBox2.Text = "5、注意事项.htm"
End Select
Dim urll As String
urll = startPath + "res/shouce/" + ToolStripTextBox2.Text
Try
If ToolStripTextBox2.Text <> "" Then
If Microsoft.VisualBasic.Left(Trim(urll), 7) <> "http://" And Microsoft.VisualBasic.Left(Trim(urll), 7) <> "file://" Then
WebBrowser1.Url = New Uri("http://" + urll)
Else
WebBrowser1.Url = New Uri(urll)
End If
End If
Catch ex As Exception
End Try
Catch ex As Exception
End Try
End Sub
Private Sub ToolStripTextBox2_Click(sender As Object, e As EventArgs) Handles ToolStripTextBox2.Click
End Sub
Private Sub ToolStripTextBox2_KeyUp(sender As Object, e As KeyEventArgs) Handles ToolStripTextBox2.KeyUp
If e.KeyCode = Keys.Enter Then
Try
If ToolStripTextBox2.Text <> "" Then
If Microsoft.VisualBasic.Left(Trim(ToolStripTextBox2.Text), 7) <> "http://" And Microsoft.VisualBasic.Left(Trim(ToolStripTextBox2.Text), 7) <> "file://" Then
WebBrowser1.Url = New Uri("http://" + ToolStripTextBox2.Text)
Else
WebBrowser1.Url = New Uri(ToolStripTextBox2.Text)
End If
End If
Catch ex As Exception
End Try
End If
End Sub
Private Sub ToolStripButton15_Click(sender As Object, e As EventArgs) Handles ToolStripButton15.Click
If ToolStripButton15.Text = "隐藏" Then
ToolStripButton15.Text = "显示"
SplitContainer3.SplitterDistance = "50"
Panel2.Dock = DockStyle.Fill
ToolStrip2.Dock = DockStyle.Left
'隐藏按钮和treeview
'ToolStripButton13.Visible = False
'ToolStripButton11.Visible = False
'ToolStripButton10.Visible = False
'ToolStripButton3.Visible = False
TreeView1.Visible = False
Else
ToolStripButton15.Text = "隐藏"
SplitContainer3.SplitterDistance = "262"
'ToolStripButton13.Visible = True
'ToolStripButton11.Visible = True
'ToolStripButton10.Visible = True
'ToolStripButton3.Visible = True
Panel2.Dock = DockStyle.Top
Panel2.Height = 41
ToolStrip2.Dock = DockStyle.Top
TreeView1.Visible = True
End If
End Sub
Private Sub ToolStripButton13_Click(sender As Object, e As EventArgs) Handles ToolStripButton13.Click
WebBrowser1.GoBack()
End Sub
Private Sub ToolStripButton11_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton11.Click
WebBrowser1.GoForward()
End Sub
Private Sub ToolStripButton10_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton10.Click
WebBrowser1.Url = New Uri("file:///" + AppDomain.CurrentDomain.BaseDirectory.ToString.Replace("\", "/") + "res/shouce/首页.html")
End Sub
Private Sub 清除内容NToolStripMenuItem_Click(sender As Object, e As EventArgs)
End Sub
Private Sub openbt_Click(sender As Object, e As EventArgs) Handles openbt.Click
Dim lujing As String
lujing = TLabel2.Text.Replace("保存成功!位置:", "")
Shell("explorer.exe /select," & Chr(34) & lujing & Chr(34), 1)
End Sub
Private Sub ToolStripButton2_Click_1(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
'导出MES格式
If DataGridView4.Rows.Count <= 0 Then '判断记录数,如果没有记录就退出
MessageBox.Show("没有记录可以导出", "没有可以导出的项目", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Dim saveExcel As SaveFileDialog
saveExcel = New SaveFileDialog
saveExcel.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
saveExcel.Filter = "Excel文件(.xlsx)|*.xlsx"
saveExcel.FileName = "VIN(打印)导出"
Dim filename As String
If saveExcel.ShowDialog = System.Windows.Forms.DialogResult.Cancel Then Exit Sub
filename = saveExcel.FileName
Try
daochu(DataGridView4, filename, 1)
TLabel2.Text = "保存成功!位置:" + filename.ToString
openbt.Visible = True
Catch ex As Exception
End Try
End If
End Sub
End Class
|
' Developer Express Code Central Example:
' How to generate and assign a sequential number for a business object within a database transaction, while being a part of a successful saving process (XAF)
'
' This version of the http://www.devexpress.com/scid=E2620 example is primarily
' intended for XAF applications, because all the required operations to generate
' sequences are managed within the base persistent class. However, this code can
' be used in a regular non-XAF application based on XPO, as well.
' For more
' convenience, this solution is organized as a reusable module -
' GenerateUserFriendlyId.Module, which you may want to copy into your project 'as
' is' and then add it as required via the Module or Application designers
' (http://documentation.devexpress.com/#Xaf/CustomDocument2828). This module
' consists of several key parts:
' 1. Sequence, SequenceGenerator, and
' SequenceGeneratorInitializer - auxiliary classes that take the main part in
' generating user-friendly identifiers.
' Take special note that the last two
' classes need to be initialized in the ModuleUpdater and ModuleBase descendants
' of your real project.
'
' 2. UserFriendlyIdPersistentObject - a base persistent
' class that subscribes to XPO's Session events and delegates calls to the core
' classes above.
'
' 3. IUserFriendlyIdDomainComponent - a base domain component
' that should be implemented by all domain components that require the described
' functionality. Take special note that such derived components must still use the
' BasePersistentObject as a base class during the registration, e.g.:
' XafTypesInfo.Instance.RegisterEntity("Document", typeof(IDocument),
' typeof(BasePersistentObject)); 4. Address, Contact, and IDocument are business
' objects that demonstrate the use of the described functionality for XPO and DC
' respectively.
' Take special note that a required format for the user-friendly
' identifier property in these end classes is defined within an aliased property
' (AddressId in the example below) by concatenation of a required constant or
' dynamic value with the <i>SequentialNumber</i> property provided by the base
' <i>UserFriendlyIdPersistentObject</i> class. So, if you need to have a different
' format, modify the PersistentAliasAttribute expression as your business needs
' dictate: [PersistentAlias("concat('A', ToStr(SequentialNumber))")] public
' string AddressId { get { return
' Convert.ToString(EvaluateAlias("AddressId")); } }
'
'
'
' IMPORTANT NOTES
' 1.
' If your connection string contains the Password parameter, then rework the
' SequenceGeneratorInitializer.Initialize method to not use the
' <i>XafApplication.ConnectionString</i> or
' <i>XafApplication.Connection.ConnectionString</i> properties, because XAF
' encrypts the specified password for safety reasons. Instead, either specify the
' connection string directly or read it from the configuration file.
' 2. The
' sequential number functionality shown in this example does not work with shared
' parts
' (http://documentation.devexpress.com/#Xaf/DevExpressExpressAppDCITypesInfo_RegisterSharedParttopic)
' (a part of the Domain Components (DC) technology) in the current version,
' because it requires a custom base class, which is not allowed for shared
' parts.
' 3. This solution is not yet tested in the middle-tier and
' SecuredObjectSpaceProvider scenario and most likely, it will have to be modified
' to support its specifics.
' 4. As an alternative, you can use a more simple
' solution that is using the <i>DistributedIdGeneratorHelper.Generate</i> method
' as shown in the FeatureCenter demo (<i>"%Public%\Documents\DXperience 13.X
' Demos\eXpressApp
' Framework\FeatureCenter\CS\FeatureCenter.Module\KeyProperty\GuidKeyPropertyObject.cs"</i>
' ) or at http://www.devexpress.com/scid=E4904
'
' You can find sample updates and versions for different programming languages here:
' http://www.devexpress.com/example=E2829
Imports DevExpress.Xpo
Imports System.ComponentModel
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports AcurXAF.UFId.Data.BOs
'Imports Acur.XAF.BC.UFId.BusinessObjects
'Imports Acur.XAF.BC.UFId.Data.BOs
'Namespace BOs
<DefaultClassOptions, DefaultProperty("FullName"), ImageName("BO_Person")>
Public Class TestClassComplex
Inherits UFIdBOBase
'INSTANT VB NOTE: The variable firstName was renamed since Visual Basic does not allow class members with the same name:
Private firstName_Renamed As String
'INSTANT VB NOTE: The variable lastName was renamed since Visual Basic does not allow class members with the same name:
Private lastName_Renamed As String
'INSTANT VB NOTE: The variable sex was renamed since Visual Basic does not allow class members with the same name:
'INSTANT VB NOTE: The variable age was renamed since Visual Basic does not allow class members with the same name:
Private age_Renamed As Integer
'INSTANT VB NOTE: The variable address was renamed since Visual Basic does not allow class members with the same name:
Private address_Renamed As Address
'<PersistentAlias("concat('C', ToStr(UFId))")> _
'Public ReadOnly Property ContactId() As String
' Get
' Return Convert.ToString(EvaluateAlias("ContactId"))
' End Get
'End Property
'Private _UFId As String
'Public Property UFId() As String
' Get
' Return _UFId
' End Get
' Set(ByVal value As String)
' SetPropertyValue("UFId", _UFId, value)
' End Set
'End Property
'Private _UFIdXdate As Date
'Public Property UFIdXdate() As Date
' Get
' Return _UFIdXdate
' End Get
' Set(ByVal value As Date)
' SetPropertyValue("UFIdXdate", _UFIdXdate, value)
' End Set
'End Property
Public Property FirstName() As String
Get
Return firstName_Renamed
End Get
Set(ByVal value As String)
SetPropertyValue("FirstName", firstName_Renamed, value)
End Set
End Property
Public Property LastName() As String
Get
Return lastName_Renamed
End Get
Set(ByVal value As String)
SetPropertyValue("LastName", lastName_Renamed, value)
End Set
End Property
Public Property Age() As Integer
Get
Return age_Renamed
End Get
Set(ByVal value As Integer)
SetPropertyValue("Age", age_Renamed, value)
End Set
End Property
'Public Property Sex() As Sex
' Get
' Return sex_Renamed
' End Get
' Set(ByVal value As Sex)
' SetPropertyValue("Sex", sex_Renamed, value)
' End Set
'End Property
<PersistentAlias("concat(FirstName, LastName)")> _
Public ReadOnly Property FullName() As String
Get
Return ObjectFormatter.Format("{FirstName} {LastName}", Me, EmptyEntriesMode.RemoveDelimiterWhenEntryIsEmpty)
End Get
End Property
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
End Class
'Public Enum Sex
' Male
' Female
'End Enum
'End Namespace
|
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Imports System.Data.Entity.Spatial
<Table("tblNOISubmissionAcceptedPDF")>
Public Class NOISubmissionAcceptedPDF
Implements IEntity
<Key>
<DatabaseGenerated(DatabaseGeneratedOption.Identity)>
Public Property NOIAcceptedPDFID As Integer
Public Property SubmissionID As Integer
Public Property AcceptedReportPDF As Byte()
Public Overridable Property NOISubmission As NOISubmission
Public Property EntityState As EntityState = NoticeOfIntent.EntityState.Unchanged Implements IEntity.EntityState
End Class |
Imports System.Collections.Generic
Imports System.Collections.ObjectModel
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Controls.Primitives
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 devDept.Eyeshot
Imports devDept.Graphics
Imports devDept.Eyeshot.Entities
Imports devDept.Geometry
Imports WpfApplication1.WpfApplication1
Imports ToolBar = devDept.Eyeshot.ToolBar
''' <summary>
''' Interaction logic for MainWindow.xaml
''' </summary>
Partial Public Class MainWindow
Private Const Pictures As String = "../../../../../../dataset/Assets/Pictures/"
Private _myViewModel As MyViewModel
Private _rand As New Random(123)
Public Sub New()
InitializeComponent()
' model1.Unlock("") ' For more details see 'Product Activation' topic in the documentation.
_myViewModel = DirectCast(DataContext, MyViewModel)
_myViewModel.Lighting = False
For Each value As colorThemeType In [Enum].GetValues(GetType(colorThemeType))
colorThemeTypes.Items.Add(value)
Next
For Each value As displayType In [Enum].GetValues(GetType(displayType))
displayTypes.Items.Add(value)
Next
For Each value As backgroundStyleType In [Enum].GetValues(GetType(backgroundStyleType))
styles.Items.Add(value)
Next
For Each value As coordinateSystemPositionType In [Enum].GetValues(GetType(coordinateSystemPositionType))
csiPositionTypes.Items.Add(value)
Next
For Each value As originSymbolStyleType In [Enum].GetValues(GetType(originSymbolStyleType))
osStyleTypes.Items.Add(value)
Next
For Each value As ToolBar.positionType In [Enum].GetValues(GetType(ToolBar.positionType))
tbPositionTypes.Items.Add(value)
Next
actionTypes.Items.Add(actionType.None)
actionTypes.Items.Add(actionType.SelectByPick)
actionTypes.Items.Add(actionType.SelectByBox)
actionTypes.Items.Add(actionType.SelectVisibleByPick)
actionTypes.Items.Add(actionType.SelectVisibleByBox)
colors.SelectedIndex = 1
End Sub
Private Sub BtnAddEntity_OnClick(sender As Object, e As RoutedEventArgs)
Dim randomColor = System.Drawing.Color.FromArgb(255, CByte(_rand.[Next](255)), CByte(_rand.[Next](255)), CByte(_rand.[Next](255)))
Dim translateX = _rand.[Next](100) * -5
Dim translateY = _rand.[Next](100) * -5
Dim translateZ = _rand.[Next](100) * -5
#If STANDARD Then
Dim faces = GetBoxFaces()
For Each entity As Entity In faces
entity.Color = randomColor
entity.ColorMethod = colorMethodType.byEntity
entity.Translate(translateX, translateY, translateZ)
Next
_myViewModel.EntityList.AddRange(faces)
#Else
Dim m As Mesh = Mesh.CreateBox(50, 50, 50)
m.Color = randomColor
m.ColorMethod = colorMethodType.byEntity
m.Translate(translateX, translateY, translateZ)
_myViewModel.EntityList.Add(m)
#End If
model1.ZoomFit()
End Sub
#If STANDARD Then
Private Function GetBoxFaces() As List(Of Entity)
Dim boxWidth As Double = 50
Dim boxDepth As Double = 50
Dim boxHeight As Double = 50
Dim boxBottom As New Quad(0, boxDepth, 0, boxWidth, boxDepth, 0, _
boxWidth, 0, 0, 0, 0, 0)
Dim boxTop As New Quad(0, boxDepth, boxHeight, boxWidth, boxDepth, boxHeight, _
boxWidth, 0, boxHeight, 0, 0, boxHeight)
Dim boxFront As New Quad(0, 0, 0, boxWidth, 0, 0, _
boxWidth, 0, boxHeight, 0, 0, boxHeight)
Dim boxRight As New Quad(boxWidth, 0, 0, boxWidth, boxDepth, 0, _
boxWidth, boxDepth, boxHeight, boxWidth, 0, boxHeight)
Dim boxRear As New Quad(boxWidth, boxDepth, 0, 0, boxDepth, 0, _
0, boxDepth, boxHeight, boxWidth, boxDepth, boxHeight)
Dim boxLeft As New Quad(0, boxDepth, 0, 0, 0, 0, _
0, 0, boxHeight, 0, boxDepth, boxHeight)
Return New List(Of Entity)() From { _
boxBottom, _
boxTop, _
boxFront, _
boxRight, _
boxRear, _
boxLeft _
}
End Function
#End If
Private Sub BtnRemoveEntities_OnClick(sender As Object, e As RoutedEventArgs)
_myViewModel.EntityList.RemoveRange(_myViewModel.EntityList.Where(Function(x) x.Selected).ToList())
End Sub
Private Sub BtnImage_OnClick(sender As Object, e As RoutedEventArgs)
Dim b As ToggleButton = DirectCast(sender, ToggleButton)
Dim isChecked As Boolean = b.IsChecked.Value
Dim image As Controls.Image = DirectCast(b.Content, Controls.Image)
_myViewModel.MyBackgroundSettings.Image = image.Source
btnImage1.IsChecked = False
btnImage2.IsChecked = False
btnImage3.IsChecked = False
b.IsChecked = isChecked
End Sub
Private Sub Colors_OnSelectionChanged(sender As Object, e As SelectionChangedEventArgs)
Select Case DirectCast(colors.SelectedItem, ObservableCollection(Of Media.Brush)).Count
Case 9
If True Then
_myViewModel.LegendItemSize = "10,30"
Exit Select
End If
Case 17
If True Then
_myViewModel.LegendItemSize = "10,25"
Exit Select
End If
Case 33
If True Then
_myViewModel.LegendItemSize = "10,15"
Exit Select
End If
End Select
End Sub
#Region "ViewCube Images"
Private Sub BtnVcImage_OnClick(sender As Object, e As RoutedEventArgs)
Dim b As ToggleButton = DirectCast(sender, ToggleButton)
Dim isChecked As Boolean = b.IsChecked.Value
btnVcResetImages.IsChecked = False
btnVcImage1.IsChecked = False
btnVcImage2.IsChecked = False
b.IsChecked = isChecked
End Sub
Private Sub BtnVcResetImages_OnChecked(sender As Object, e As RoutedEventArgs)
If _myViewModel IsNot Nothing Then
_myViewModel.VcFaceImages = Nothing
End If
End Sub
Private Sub BtnVcImage1_OnChecked(sender As Object, e As RoutedEventArgs)
If _myViewModel IsNot Nothing Then
_myViewModel.VcFaceImages = New ImageSource() {RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Front.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Back.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Top.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Bottom.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Left.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Spongebob_Right.jpg"))}
End If
End Sub
Private Sub BtnVcImage2_OnChecked(sender As Object, e As RoutedEventArgs)
If _myViewModel IsNot Nothing Then
_myViewModel.VcFaceImages = New ImageSource() {RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Front.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Back.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Top.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Bottom.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Left.jpg")),RenderContextUtility.ConvertImage(new Bitmap(Pictures+"Noel_Right.jpg"))}
End If
End Sub
#End Region
End Class
|
Imports System.Text
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports MatthewSnaith.MatthewSnaith.Models
Imports System.Web.Mvc
<TestClass()> Public Class AboutControllerTest
<TestMethod()> Public Sub About_Controller_Returns_About_View()
Dim controller As New AboutController
Dim result As ViewResult = controller.About()
Assert.AreEqual("About", result.ViewName)
End Sub
End Class |
Imports ControlsDemo.Helpers
Imports DevExpress.DemoData.Models
Imports DevExpress.Mvvm.DataAnnotations
Imports DevExpress.Mvvm.POCO
Imports DevExpress.Xpf.Core
Imports System.Collections.Generic
Imports System.Linq
Imports System.Windows.Media
Namespace ControlsDemo.TabControl.ColorizedTabs
Public Class MainViewModel
Public Shared Function Create() As MainViewModel
Return ViewModelSource.Create(Function() New MainViewModel())
End Function
Protected Sub New()
If Me.IsInDesignMode() Then
Return
End If
InitDataSource()
End Sub
Public Overridable Property Employees() As List(Of EmployeeWrapper)
Private Sub InitDataSource()
Employees = NWindContext.Create().Employees.ToList().Select(Function(x) EmployeeWrapper.Create(x)).ToList()
Dim i As Integer = 0
For Each employee In Employees
employee.BackgroundColor = ColorPalette.GetColor(i, 100)
employee.BackgroundColor = ColorHelper.Brightness(employee.BackgroundColor, 0.3)
employee.BackgroundColorOpacity = 180
i += 1
Next employee
End Sub
End Class
Public Class EmployeeWrapper
Public Shared Function Create(ByVal employee As Employee) As EmployeeWrapper
Return ViewModelSource.Create(Function() New EmployeeWrapper(employee))
End Function
Protected Sub New(ByVal employee As Employee)
Me.Employee = employee
End Sub
Private privateEmployee As Employee
Public Property Employee() As Employee
Get
Return privateEmployee
End Get
Private Set(ByVal value As Employee)
privateEmployee = value
End Set
End Property
<BindableProperty(OnPropertyChangedMethodName := "UpdateColors")>
Public Overridable Property BackgroundColor() As Color
<BindableProperty(OnPropertyChangedMethodName := "UpdateColors")>
Public Overridable Property BackgroundColorOpacity() As Byte
Protected Sub UpdateColors()
Dim background = BackgroundColor
background.A = BackgroundColorOpacity
BackgroundColor = background
End Sub
End Class
End Namespace
|
Imports System.Windows.Forms
Namespace std_ez
''' <summary>
''' 自定义控件:DataGridView,向其中增加了:插入行、删除行、显示行号等功能
''' </summary>
''' <remarks></remarks>
Public Class eZDataGridView
Inherits System.Windows.Forms.DataGridView
Private components As System.ComponentModel.IContainer
Private WithEvents ToolStripMenuItemInsert As System.Windows.Forms.ToolStripMenuItem
Private WithEvents ToolStripMenuItemRemove As System.Windows.Forms.ToolStripMenuItem
Private WithEvents CMS_DeleteRows As System.Windows.Forms.ContextMenuStrip
Private WithEvents ToolStripMenuItemRemoveRows As System.Windows.Forms.ToolStripMenuItem
Private WithEvents CMS_RowHeader As System.Windows.Forms.ContextMenuStrip
#Region " --- 控件的初始属性"
Public Sub New()
Call InitializeComponent()
End Sub
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.CMS_RowHeader = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ToolStripMenuItemInsert = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItemRemove = New System.Windows.Forms.ToolStripMenuItem()
Me.CMS_DeleteRows = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.ToolStripMenuItemRemoveRows = New System.Windows.Forms.ToolStripMenuItem()
Me.CMS_RowHeader.SuspendLayout()
Me.CMS_DeleteRows.SuspendLayout()
CType(Me, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'CMS_RowHeader
'
Me.CMS_RowHeader.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItemInsert, Me.ToolStripMenuItemRemove})
Me.CMS_RowHeader.Name = "CMS_RowHeader"
Me.CMS_RowHeader.ShowImageMargin = False
Me.CMS_RowHeader.Size = New System.Drawing.Size(76, 48)
'
'ToolStripMenuItemInsert
'
Me.ToolStripMenuItemInsert.Name = "ToolStripMenuItemInsert"
Me.ToolStripMenuItemInsert.Size = New System.Drawing.Size(75, 22)
Me.ToolStripMenuItemInsert.Text = "插入"
'
'ToolStripMenuItemRemove
'
Me.ToolStripMenuItemRemove.Name = "ToolStripMenuItemRemove"
Me.ToolStripMenuItemRemove.Size = New System.Drawing.Size(75, 22)
Me.ToolStripMenuItemRemove.Text = "移除"
'
'CMS_DeleteRows
'
Me.CMS_DeleteRows.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.ToolStripMenuItemRemoveRows})
Me.CMS_DeleteRows.Name = "CMS_RowHeader"
Me.CMS_DeleteRows.ShowImageMargin = False
Me.CMS_DeleteRows.Size = New System.Drawing.Size(112, 26)
'
'ToolStripMenuItemRemoveRows
'
Me.ToolStripMenuItemRemoveRows.Name = "ToolStripMenuItemRemoveRows"
Me.ToolStripMenuItemRemoveRows.Size = New System.Drawing.Size(111, 22)
Me.ToolStripMenuItemRemoveRows.Text = "删除所选行"
'
'myDataGridView
'
Me.ColumnHeadersHeight = 25
Me.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.DisableResizing
Me.RowTemplate.Height = 23
Me.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
Me.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.Size = New System.Drawing.Size(346, 110)
Me.CMS_RowHeader.ResumeLayout(False)
Me.CMS_DeleteRows.ResumeLayout(False)
CType(Me, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
#Region " --- 显示行号"
''' <summary>
''' 行数改变时的事件:显示行号
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub myDataGridView_RowsNumberChanged(sender As Object, e As Object) Handles Me.RowsAdded, Me.RowsRemoved
Dim longRow As Long
For longRow = e.RowIndex + e.RowCount - 1 To Me.Rows.GetLastRow(DataGridViewElementStates.Displayed)
Me.Rows(longRow).HeaderCell.Value = (longRow + 1).ToString
Next
End Sub
''' <summary>
''' 设置新添加的一行的Resizable属性为False
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RowsResizable(sender As Object, e As DataGridViewRowsAddedEventArgs) Handles Me.RowsAdded
Me.Rows.Item(e.RowIndex).Resizable = DataGridViewTriState.False
End Sub
Private Sub myDataGridView_RowStateChanged(sender As Object, e As DataGridViewRowStateChangedEventArgs) Handles Me.RowStateChanged
e.Row.HeaderCell.Value = (e.Row.Index + 1).ToString
End Sub
#End Region
#Region " --- 右键菜单的关联与显示"
Private Sub myDataGridView_RowHeaderMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles Me.RowHeaderMouseClick
'如果是右击
If e.Button = Windows.Forms.MouseButtons.Right Then
If e.RowIndex <> Me.Rows.Count Then
'如果行数只有一行
With Me.ToolStripMenuItemRemove
If Me.Rows.Count <= 1 Then
.Enabled = False
Else
.Enabled = True
End If
End With
'选择右击项的那一行
Me.ClearSelection()
Me.Rows.Item(e.RowIndex).Selected = True
'显示菜单栏
With CMS_RowHeader
.Show()
.Left = MousePosition.X
.Top = MousePosition.Y
End With
End If
End If
End Sub
Private Sub myDataGridView_CellMouseClick(sender As Object, e As DataGridViewCellMouseEventArgs) Handles Me.CellMouseClick
If e.Button = Windows.Forms.MouseButtons.Right Then
Dim R As Integer = e.RowIndex
Dim C As Integer = e.ColumnIndex
If R >= 0 And C >= 0 Then
'显示菜单栏
If Me.SelectedRows.Count = 0 OrElse Me.Rows.Count < 2 Then
Me.ToolStripMenuItemRemoveRows.Enabled = False
Else
Me.ToolStripMenuItemRemoveRows.Enabled = True
End If
With CMS_DeleteRows
.Show()
.Left = MousePosition.X
.Top = MousePosition.Y
End With
End If
End If
End Sub
#End Region
#Region " --- 行的插入与删除"
''' <summary>
''' 插入一行
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub InsertRow(sender As Object, e As EventArgs) Handles ToolStripMenuItemInsert.Click
With Me
Dim SelectedIndex As Integer = .SelectedRows(0).Index
.Rows.Insert(SelectedIndex, 1)
End With
End Sub
''' <summary>
''' 移除一行
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub RemoveRow(sender As Object, e As EventArgs) Handles ToolStripMenuItemRemove.Click
With Me
Dim Row = .SelectedRows.Item(0)
If Row.Index < .Rows.Count - 1 Then
'当删除最后一行(不带数据,自动添加的行)时会报错:无法删除未提交的新行。
.Rows.Remove(Row)
End If
End With
End Sub
''' <summary>
''' 移除多行
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
''' <remarks></remarks>
Private Sub ToolStripMenuItemRemoveRows_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItemRemoveRows.Click
With Me
'下面的 For Each 是从下往上索引的,即前面的Row对象的index的值大于后面的Index的值
For Each Row As DataGridViewRow In .SelectedRows
If Row.Index < .Rows.Count - 1 Then
'当删除最后一行(不带数据,自动添加的行)时会报错:无法删除未提交的新行。
.Rows.Remove(Row)
End If
Next
End With
End Sub
#End Region
#Region " --- 数据的复制与粘贴"
''' <summary>
''' 如下按下Ctrl+V,则将表格中的数据粘贴到DataGridView控件中
''' </summary>
''' <remarks>DataGridView表格的索引:行号:表头为-1,第一行为0,列号:表示行编号的列为-1,第一个数据列的列号为0.
''' DataGridView.Rows.Count与DataGridView.Columns.Count均只计算数据区域,而不包含表头与列头。</remarks>
Private Sub myDataGridView_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Delete Then
' 删除选择的单元格中的数据
For Each c As DataGridViewCell In Me.SelectedCells
c.Value = Nothing
Next
ElseIf e.Control And e.KeyCode = Keys.V Then
Dim a = Me.SelectedCells
Dim count = a.Count
'Dim s As String = "行号" & vbTab & "列号" & vbCrLf
'For i = 0 To count - 1
' s = s & a.Item(i).RowIndex & vbTab & a.Item(i).ColumnIndex & vbCrLf
'Next
'MessageBox.Show(s)
If count <> 1 Then
MessageBox.Show("请选择某一个单元格,来作为粘贴的起始位置。", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Exit Sub
End If
Dim c As DataGridViewCell = Me.SelectedCells.Item(0)
Dim rownum As Integer = c.RowIndex
Call PasteFromTable(c.RowIndex, c.ColumnIndex)
End If
End Sub
''' <summary> 将表格中的数据粘贴到DataGridView控件中 </summary>
''' <param name="startRow">粘贴的起始单元格的行位置</param>
''' <param name="startCol">粘贴的起始单元格的列位置</param>
''' <remarks>DataGridView表格的索引:行号:表头为-1,第一行为0,列号:表示行编号的列为-1,第一个数据列的列号为0.
''' DataGridView.Rows.Count与DataGridView.Columns.Count均只计算数据区域,而不包含表头与列头。总行数包括最后一行空数据行。</remarks>
Private Sub PasteFromTable(startRow As Integer, startCol As Integer)
Dim pastTest As String = Clipboard.GetText
If String.IsNullOrEmpty(pastTest) Then Exit Sub
'excel中是以"空格"和"换行"来当做字段和行,所以用"\r\n"来分隔,即"回车+换行"
Dim lines As String() = pastTest.Split(New Char() {Chr(13), Chr(10)}, _
StringSplitOptions.RemoveEmptyEntries)
Try
'For Each line As String In lines
' '在每一行的单元格间,作为单元格的分隔的字符为"\t",即水平换行符
' Dim strs As String() = line.Split(Chr(9))
' Me.Rows.Add(strs)
'Next
' MessageBox.Show(startRow & startCol & Me.Rows.Count & Me.Columns.Count)
'
Dim WriteRowsCount As Integer = lines.Length '要写入多少行数据
Dim WriteColsCount As Integer = lines(0).Split(Chr(9)).Length '要写入的每一行数据中有多少列
'
Dim endRow As Integer = startRow + WriteRowsCount - 1 ' 要修改的最后一行的行号
If endRow > Me.Rows.Count - 2 Then ' 说明要额外添加这么多行才能放置要粘贴进来的数据
Me.Rows.Add(endRow + 2 - Me.Rows.Count)
End If
Dim endCol As Integer ' 要修改的最后面的那一列的列号
endCol = If(startCol + WriteColsCount <= Me.Columns.Count, startCol + WriteColsCount - 1, Me.Columns.Count - 1)
'
Dim strline As String
Dim strs As String()
For r As Integer = startRow To endRow
strline = lines(r - startRow)
strs = strline.Split(Chr(9)) '在每一行的单元格间,作为单元格的分隔的字符为"\t",即水平换行符
For c As Integer = startCol To endCol
Me.Rows(r).Cells(c).Value = strs(c - startCol)
Next
Next
Catch ex As Exception
End Try
End Sub
#End Region
End Class
End Namespace |
Imports MongoDB.Bson
Imports MongoDB.Driver
Namespace Utilities.DBUtil.MongoDB
Public Class MongoDBContext
Protected _mongo As MongoServer
Protected _db As MongoDatabase
Protected _dbName As String
Protected ReadOnly _connStr As String
Protected ReadOnly _mapper As MongoTableMapper
'Protected _collectionName As String
'Protected _coll As MongoCollection
'Protected Shared ReadOnly defaultConnStr As String = "mongodb://localhost"
'Protected Shared ReadOnly defaultDBName As String = "mainDB"
''Protected Shared ReadOnly defaultCollection As String = "mainCollection"
'Public Sub New(ByVal connStr As String, ByVal dbName As String, ByVal collectionName As String)
' If String.IsNullOrEmpty(connStr) Or String.IsNullOrEmpty(dbName) Then
' Throw New ArgumentNullException
' End If
' _connStr = connStr
' _dbName = dbName
' _collectionName = collectionName
'End Sub
Public Sub New(ByVal connStr As String, ByVal dbName As String, ByVal mapper As MongoTableMapper)
If String.IsNullOrEmpty(connStr) Or String.IsNullOrEmpty(dbName) Then
Throw New ArgumentNullException
End If
_connStr = connStr
_dbName = dbName
_mapper = mapper
'_collectionName = mapper.GetTableName(GetType(T))
End Sub
'Public Sub New()
' Me.New(defaultConnStr, defaultDBName, defaultCollection)
'End Sub
'Public Shared Function GetAllCollections(ByVal connStr As String, ByVal db As String) As Dictionary(Of String, MongoCollection)
' If String.IsNullOrEmpty(connStr) Or String.IsNullOrEmpty(db) Then
' Throw New ArgumentNullException
' End If
' Dim server As MongoServer = MongoServer.Create(connStr)
' Dim myDB As MongoDatabase = server.GetDatabase(db)
' Dim collectionsHash As Dictionary(Of String, MongoCollection) = New Dictionary(Of String, MongoCollection)
' Dim collections() As String = myDB.GetCollectionNames.ToArray
' If collections IsNot Nothing Then
' If collections.Length > 0 Then
' For Each collName As String In collections
' collectionsHash.Add(collName, myDB.GetCollection(collName))
' Next
' End If
' End If
' Return collectionsHash
'End Function
Public ReadOnly Property ConnStr As String
Get
Return _connStr
End Get
End Property
Public ReadOnly Property MongoInstance As MongoServer
Get
If _mongo Is Nothing Then
_mongo = MongoServer.Create(ConnStr)
End If
Return _mongo
End Get
End Property
Public ReadOnly Property DB As MongoDatabase
Get
If _db Is Nothing Then
_db = MongoInstance.GetDatabase(_dbName)
End If
Return _db
End Get
End Property
Public Function GetCollection(ByVal name As String) As MongoCollection
If String.IsNullOrEmpty(name) Then
Throw New ArgumentNullException
Else
Return DB.GetCollection(name)
End If
End Function
Public Function GetCollection(ByVal type As Type, ByVal flag As Boolean)
If type Is Nothing Then
Throw New ArgumentNullException
Else
Return DB.GetCollection(_mapper.GetTableName(type))
End If
End Function
'Public ReadOnly Property Collection As MongoCollection
' Get
' If _coll Is Nothing Then
' _coll = DB.GetCollection(_collectionName)
' End If
' Return _coll
' End Get
'End Property
End Class
End Namespace
|
Imports DCS.mPosEngine.Core.Domain.Sales.Fulfillment
Imports DCS.mPosEngine.Data.Infrastructure
Imports NUnit.Framework
Imports DCS.mPosEngine.Core.Domain.Sales
Imports DCS.mPosEngine.Core.Domain.Sales.Payment
Namespace Domain
<TestFixture()>
Public Class PaymentTests
<Test()> _
Public Sub CannotPayInvalidPaymentAmount()
Dim mPosTransaction As MPosTransaction
Dim currency As DCS.PlaycardBase.Core.PosDomain.Currency
currency = GetCurrency(1)
mPosTransaction = GetCardRechargeTransaction()
Try
'_purchasingServices.CommitTransaction(command)
mPosTransaction.Pay(New PaymentData(New PayItem(currency, mPosTransaction.GetTotals.TotalToPay - 1, New CashPaymodeData())))
Assert.Fail("Expecting Exception and didn't happened")
Catch ex As DCS.mPosEngine.Core.Domain.Sales.InvalidPaymentAmountException
End Try
End Sub
Private Function GetCurrency(ByVal currencyId As Integer) As DCS.PlaycardBase.Core.PosDomain.Currency
Dim currency As DCS.PlaycardBase.Core.PosDomain.Currency
Dim currencyDao As DCS.PlaycardBase.Core.DataInterfaces.ICurrencyDao = (New DCS.PlaycardBase.Data.NHibernateDaoFactory).GetCurrencyDao
currency = currencyDao.FindById(currencyId)
Return currency
End Function
<Test()> _
Public Sub TransactionIsNotFullyPaid()
Dim mPosTransaction As MPosTransaction
mPosTransaction = GetCardRechargeTransaction()
Assert.IsFalse(mPosTransaction.IsFullyPaid)
End Sub
<Test()> _
Public Sub TransactionIsFullyPaidTest()
Dim mPosTransaction As MPosTransaction
Dim currency As DCS.PlaycardBase.Core.PosDomain.Currency
currency = GetCurrency(1)
mPosTransaction = GetCardRechargeTransaction()
mPosTransaction.Pay(New PaymentData(New PayItem(currency, mPosTransaction.GetTotals.TotalToPay, New CashPaymodeData())))
Assert.IsTrue(mPosTransaction.IsFullyPaid)
End Sub
<Test()> _
Public Sub TransactionIsFullyPaidMultipleCashTest()
Dim mPosTransaction As MPosTransaction
Dim currency As DCS.PlaycardBase.Core.PosDomain.Currency
Dim paymentData As New PaymentData
currency = GetCurrency(1)
mPosTransaction = GetCardRechargeTransaction()
paymentData.AddPayitem(currency, mPosTransaction.GetTotals.TotalToPay / 2, New CashPaymodeData())
paymentData.AddPayitem(currency, mPosTransaction.GetTotals.TotalToPay / 2, New CashPaymodeData())
mPosTransaction.Pay(paymentData)
Assert.IsTrue(mPosTransaction.IsFullyPaid)
End Sub
Private Function GetCardRechargeTransaction() As MPosTransaction
Dim retVal As New MPosTransaction(15, "VERUGO", 1)
Dim productDao As DCS.mPosEngine.Data.Dao.ProductDao = (New DCS.mPosEngine.Data.Dao.NHibernateDaoFactory).GetProductDao
Dim product As Product
product = productDao.FindByID(71)
retVal.AddLineitem(product.ProductData.Price, 50, product.ProductData, GetSoldCard)
Return retVal
End Function
Private Function GetSoldCard() As CardInfo
Dim cardManager As New PlaycardBaseCardManager
Dim cardNumber As Long = 26955373
'Set preconditions***************
If Not cardManager.IsCardSold(cardNumber) Then
cardManager.SellCard(cardNumber)
End If
'********************************
Return CardManagerFactory.GetCardManager().GetCardInfo(cardNumber)
End Function
End Class
End Namespace |
Public Class ReemplazoEnNombre
Inherits Operacion
Public Overrides Property Nombre As String = Operaciones.ReemplazoEnNombre_Nombre
Public origen As String
Public destino As String
Public Overrides Function ToString() As String
Dim txt As String = Operaciones.ReemplazoEnNombre_ToString
txt = txt.Replace("{1}", origen)
txt = txt.Replace("{2}", destino)
Return txt
End Function
Public Overrides Sub Armar(ByRef form As RenombrarPage)
origen = form.txt_src_reemp.Text
destino = form.txt_dest_reemp.Text
End Sub
Public Overrides Function Operar(ByVal path As String) As String
Dim index As Integer = path.LastIndexOf(".")
If index > 0 Then
Dim nombre As String = path.Substring(0, index)
Dim extension As String = path.Substring(index)
Return (nombre.Replace(origen, destino) & extension)
Else
Return (path.Replace(origen, destino))
End If
End Function
Public Overrides Sub AcomodarFormulario(ByRef form As RenombrarPage)
form.lbl_op1.Visibility = Visibility.Visible
form.lbl_op2.Visibility = Visibility.Visible
form.lbl_op1.Content = Language.renombrar_reemplazar
form.lbl_op2.Content = Language.renombrar_por
form.txt_src_reemp.Visibility = Visibility.Visible
form.txt_dest_reemp.Visibility = Visibility.Visible
End Sub
Public Overrides Function GetDescripcion() As String
Return Operaciones.ReemplazoEnNombre_Descripcion
End Function
Public Overrides Function GetNewInstance() As Operacion
Return New ReemplazoEnNombre
End Function
End Class
|
Public Class BaseInput
Inherits Grid
#Region "Properties"
Public BaseTextBox As TextBox
Public Enum ShowFlare
Show
Hide
End Enum
Public Enum FontSz
Small '8pt font
Smaller '10pt font
Standard '12pt font
Medium '16pt font
Large '18pt font
VeryLarge '24pt font
End Enum
Private _flare As Boolean
Public Property Flare As Boolean
Get
Return _flare
End Get
Set(value As Boolean)
_flare = value
If value = False Then
Me.Children(0).Visibility = Visibility.Hidden
Me.Children(1).Opacity = 1
Else
Me.Children(0).Visibility = Visibility.Visible
Me.Children(1).Opacity = 0.9
End If
End Set
End Property
#End Region
#Region "Constructor"
Public Sub New(ByVal FieldWidth As Integer, ByVal v As VerticalAlignment, ByVal h As HorizontalAlignment, FontSize As FontSz, Optional ta As TextAlignment = TextAlignment.Left, Optional ByVal s As String = "", Optional ByVal tw As TextWrapping = TextWrapping.Wrap)
HorizontalAlignment = h
VerticalAlignment = v
Width = FieldWidth
Dim errorflare As New Effects.BlurEffect With {.KernelType = Effects.KernelType.Gaussian, .Radius = 10,
.RenderingBias = Effects.RenderingBias.Performance}
Dim myrct As New Rectangle With {.Name = "ErrorRectangle", .Fill = Brushes.Red, .Opacity = 0.33, .StrokeThickness = 1,
.Effect = errorflare, .Visibility = Visibility.Hidden}
BaseTextBox = New TextBox With {.Name = "TextBox", .BorderBrush = Brushes.LightGray, .Text = s, .TextAlignment = ta,
.TextWrapping = tw, .HorizontalAlignment = h, .VerticalAlignment = v}
Select Case FontSize
Case FontSz.Small
Height = 24
With BaseTextBox
.Height = 16
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 8
End With
Case FontSz.Smaller
Height = 26
With BaseTextBox
.Height = 18
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 10
End With
Case FontSz.Standard
Height = 28
With BaseTextBox
.Height = 20
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 12
End With
Case FontSz.Medium
Height = 34
With BaseTextBox
.Height = 26
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 16
End With
Case FontSz.Large
Height = 36
With BaseTextBox
.Height = 28
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 18
End With
Case FontSz.VeryLarge
Height = 44
With BaseTextBox
.Height = 36
.Width = FieldWidth - 8
.Margin = New Thickness(4, 4, 0, 0)
.FontSize = 24
End With
End Select
With Children
.Add(myrct)
.Add(BaseTextBox)
End With
End Sub
#End Region
#Region "Public Methods"
Public Sub UserFocus()
BaseTextBox.Focus()
BaseTextBox.SelectAll()
End Sub
#End Region
End Class
|
Imports RTIS.CommonVB
Imports RTIS.CommonVB.libDateTime
Public Class fccPhaseManagement
Private pDBConn As RTIS.DataLayer.clsDBConnBase
Private pSalesOrderPhaseInfos As colSalesOrderPhaseInfos
Public ReadOnly Property SalesOrderPhaseInfos As colSalesOrderPhaseInfos
Get
Return pSalesOrderPhaseInfos
End Get
End Property
Public Sub New(ByRef rDBConn As RTIS.DataLayer.clsDBConnBase)
pDBConn = rDBConn
pSalesOrderPhaseInfos = New colSalesOrderPhaseInfos
End Sub
Public Property DBConn As RTIS.DataLayer.clsDBConnBase
Get
Return pDBConn
End Get
Set(value As RTIS.DataLayer.clsDBConnBase)
pDBConn = value
End Set
End Property
Public Sub LoadObject()
Dim mdso As dsoSalesOrder
Dim mDateString As String
Dim mWhere As String
Try
mdso = New dsoSalesOrder(pDBConn)
pSalesOrderPhaseInfos = New colSalesOrderPhaseInfos
''mDateString = Format(DateAdd(DateInterval.Month, -3, Date.Now), "yyyyMMdd")
mWhere = String.Format("IsNull(ProjectName,'') <>'' and OrderStatusENUM not in ({0},{1}) and OrderTypeID in ({2},{3},{4},{5})", CInt(eSalesOrderstatus.Cancelada), CInt(eSalesOrderstatus.Completed), CInt(eOrderType.Sales), CInt(eOrderType.Furnitures), CInt(eOrderType.Interno), CInt(eOrderType.InternalFurniture))
'String.Format("SpecStatus <> {0} AND DespatchStatus < {1}", CInt(eSpecificationStatus.Cancelled), CInt(eDespatchStatus.All))
mdso.LoadSalesOrderPhaseInfoWithMilestones(pSalesOrderPhaseInfos, mWhere)
Catch ex As Exception
If clsErrorHandler.HandleError(ex, clsErrorHandler.PolicyDomainModel) Then Throw
End Try
End Sub
Public Sub ReloadMilestonesForSalesOrderPhase(ByRef rSalesOrderPhaseInfo As clsSalesOrderPhaseInfo)
Dim mdso As dsoSalesOrder
Try
mdso = New dsoSalesOrder(pDBConn)
rSalesOrderPhaseInfo.SalesOrderPhaseMilestoneStatuss.Clear()
mdso.LoadSalesOrderPhaseInfoMilestones(rSalesOrderPhaseInfo)
Catch ex As Exception
If clsErrorHandler.HandleError(ex, clsErrorHandler.PolicyDomainModel) Then Throw
End Try
End Sub
Public Sub UpdateOrderReceivedDate(ByVal vOrderReceivedDate As Date, ByVal vSalesOrderPhaseID As Integer)
Dim mdsoSalesOrder As New dsoSalesOrder(pDBConn)
mdsoSalesOrder.UpdateOrderReceivedDate(vSalesOrderPhaseID, vOrderReceivedDate)
End Sub
Public Function GetCurrentTargetScheduleApprovedColumnInfo(ByVal vSalesOrderPhaseID As Integer) As String
Dim mTargetDate As Date
Dim mSOPMSs As colSalesOrderPhaseMilestoneStatuss
Dim mScheduleApproved As dmSalesOrderPhaseMilestoneStatus
Dim mRetval As String
mSOPMSs = pSalesOrderPhaseInfos.ItemBySalesOrderPhaseID(vSalesOrderPhaseID).SalesOrderPhaseMilestoneStatuss
If mSOPMSs IsNot Nothing Then
mScheduleApproved = mSOPMSs.ItemFromMilestoneENUM(eSalesOrderPhaseMileStone.Metales)
If mScheduleApproved IsNot Nothing Then
If mScheduleApproved.ActualDate = Date.MinValue Then
mTargetDate = mScheduleApproved.TargetDate
mRetval = mTargetDate.ToString("dd-MMM")
ElseIf mScheduleApproved.ActualDate <> Date.MinValue And mScheduleApproved.TargetDate = Date.MinValue Then
mTargetDate = mScheduleApproved.ActualDate
mRetval = mTargetDate.ToString("dd-MMM")
ElseIf mScheduleApproved.ActualDate <> Date.MinValue And mScheduleApproved.TargetDate <> Date.MinValue Then
mTargetDate = mScheduleApproved.ActualDate
mRetval = mTargetDate.ToString("dd-MMM")
End If
End If
End If
Return mRetval
End Function
Public Sub SaveSalesOrderPhaseMileStone(ByRef rSalesOrderPhaseMilestoneStatus As dmSalesOrderPhaseMilestoneStatus)
Dim mdso As New dsoSalesOrder(pDBConn)
Try
mdso.SaveSalesOrderPhaseMilestoneStatus(rSalesOrderPhaseMilestoneStatus)
Catch ex As Exception
If clsErrorHandler.HandleError(ex, clsErrorHandler.PolicyDomainModel) Then Throw
End Try
End Sub
End Class
|
Imports System.Data
Imports SNProcotiza
Partial Class aspx_manejaTiposOperacion
Inherits System.Web.UI.Page
Dim strErr As String = ""
Dim strPersonas As String = ""
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Dim objUsuFirma As New SNProcotiza.clsUsuariosSistema(Val(Session("cveAcceso")), Val(Session("cveUsu")))
If objUsuFirma.ErrorUsuario = "Sesion Terminada" Then
Response.Redirect("../login.aspx", True)
End If
LimpiaError()
If Not IsPostBack Then
CargaCombos(1)
If Val(Request("tipOpId")) > 0 Then
CargaInfo()
Else
HabilitaDeshabilita(1)
HabilitaDeshabilita(2)
HabilitaDeshabilita(3)
End If
End If
End Sub
Public Sub LimpiaError()
lblMensaje.Text = ""
End Sub
Public Sub MensajeError(ByVal strMsj As String)
strMsj = Replace(strMsj, "'", "")
strMsj = Replace(strMsj, """", "")
strMsj = Replace(strMsj, "(", "")
strMsj = Replace(strMsj, ")", "")
lblMensaje.Text = "<script>alert('" & strMsj & "')</script>"
End Sub
Public Sub CierraPantalla(ByVal strPant As String)
lblMensaje.Text += "<script>alert('El registro se guardó con éxito'); document.location.href='" & strPant & "';</script>"
End Sub
Private Sub CargaInfo()
Try
Dim intTipOp As Integer = Val(Request("tipOpId"))
Dim objTO As New clsTiposOperacion(intTipOp)
If objTO.IDTipoOperacion > 0 Then
lblId.Text = objTO.IDTipoOperacion
txtNom.Text = objTO.Nombre
txtClave.Text = objTO.Clave
cmbTipEsq.SelectedValue = objTO.IDTipoEsquemaFinanciamiento
cmbEstatus.SelectedValue = objTO.IDEstatus
chkOpcComp.Checked = IIf(objTO.PideOpcionCompra = 1, True, False)
chkCapIncIva.Checked = IIf(objTO.CapitalFinaciarIncluyeIVA = 1, True, False)
chkValResid.Checked = IIf(objTO.PideValorResidual = 1, True, False)
txtLeyValRes.Text = objTO.LeyendaValorResidual
HabilitaDeshabilita(1)
chkDepGar.Checked = IIf(objTO.PideDepositoGarantia = 1, True, False)
txtLeyDepGar.Text = objTO.LeyendaDepositoGarantia
HabilitaDeshabilita(2)
chkGtosExt.Checked = IIf(objTO.CobraGastosExtra = 1, True, False)
HabilitaDeshabilita(3)
cmbGtoExt.SelectedValue = objTO.IDTipoGastoExtra
chkPagoIni.Checked = IIf(objTO.PermitecalculoPagoInicial = 1, True, False)
HabilitaDeshabilita(4)
cmbForPagIni.SelectedValue = objTO.IDTipoFormulaPagoInicial
Else
MensajeError("No se localizó información para el el tipo de operación.")
End If
Catch ex As Exception
MensajeError(ex.Message)
End Try
End Sub
Private Function CargaCombos(ByVal intOpc As Integer) As Boolean
Dim objCombo As New clsProcGenerales
Dim dtsRes As New DataSet
Try
CargaCombos = False
'combo de estatus
dtsRes = objCombo.ObtenInfoParametros(1, strErr)
If Trim$(strErr) = "" Then
objCombo.LlenaCombos(dtsRes, "TEXTO", "ID_PARAMETRO", cmbEstatus, strErr)
If Trim$(strErr) <> "" Then
MensajeError(strErr)
Exit Function
End If
Else
MensajeError(strErr)
Exit Function
End If
'combo de tipos esquemas de financiamiento
dtsRes = objCombo.ObtenInfoParametros(46, strErr)
If Trim$(strErr) = "" Then
objCombo.LlenaCombos(dtsRes, "TEXTO", "ID_PARAMETRO", cmbTipEsq, strErr)
If Trim$(strErr) <> "" Then
MensajeError(strErr)
Exit Function
End If
Else
MensajeError(strErr)
Exit Function
End If
'combo de tipos de gasto
dtsRes = objCombo.ObtenInfoParametros(91, strErr)
If Trim$(strErr) = "" Then
objCombo.LlenaCombos(dtsRes, "TEXTO", "ID_PARAMETRO", cmbGtoExt, strErr, True)
If Trim$(strErr) <> "" Then
MensajeError(strErr)
Exit Function
End If
Else
MensajeError(strErr)
Exit Function
End If
'combo fórmulas pago inicial
dtsRes = objCombo.ObtenInfoParametros(108, strErr)
If Trim$(strErr) = "" Then
objCombo.LlenaCombos(dtsRes, "TEXTO", "ID_PARAMETRO", cmbForPagIni, strErr, True)
If Trim$(strErr) <> "" Then
MensajeError(strErr)
Exit Function
End If
Else
MensajeError(strErr)
Exit Function
End If
'grid personalidad jurídica
Dim objPJ As New SNProcotiza.clsTiposOperacion
objPJ.IDTipoOperacion = Val(Request("tipOpId"))
dtsRes = objPJ.ManejaTipoOperacion(10)
If Trim$(objPJ.ErrorTipoOperacion) = "" Then
gdvPerJur.DataSource = dtsRes
gdvPerJur.DataBind()
gdvPerJur.Columns(3).Visible = False
Else
MensajeError(objPJ.ErrorTipoOperacion)
Exit Function
End If
CargaCombos = True
Catch ex As Exception
MensajeError(ex.Message)
End Try
End Function
Protected Sub btnGuardar_Click(sender As Object, e As System.EventArgs) Handles btnGuardar.Click
Try
strPersonas = ""
If ValidaCampos() Then
Dim intTipOp As Integer = Val(Request("tipOpId"))
Dim objTO As New clsTiposOperacion
Dim intOpc As Integer = 2
objTO.CargaSession(Val(Session("cveAcceso")))
If intTipOp > 0 Then
objTO.CargaTipoOperacion(intTipOp)
intOpc = 3
End If
'guardamos la info del tipo de operación
objTO.IDTipoEsquemaFinanciamiento = Val(cmbTipEsq.SelectedValue)
objTO.Nombre = Trim(txtNom.Text)
objTO.Clave = Trim(txtClave.Text)
objTO.IDEstatus = Val(cmbEstatus.SelectedValue)
objTO.PideValorResidual = IIf(chkValResid.Checked, 1, 0)
objTO.PideOpcionCompra = IIf(chkOpcComp.Checked, 1, 0)
objTO.PideDepositoGarantia = IIf(chkDepGar.Checked, 1, 0)
objTO.CobraGastosExtra = IIf(chkGtosExt.Checked, 1, 0)
objTO.IDTipoGastoExtra = IIf(chkGtosExt.Checked, Val(cmbGtoExt.SelectedValue), 0)
objTO.CapitalFinaciarIncluyeIVA = IIf(chkCapIncIva.Checked, 1, 0)
objTO.PermitecalculoPagoInicial = IIf(chkPagoIni.Checked, 1, 0)
objTO.IDTipoFormulaPagoInicial = IIf(chkPagoIni.Checked, Val(cmbForPagIni.SelectedValue), 0)
objTO.LeyendaDepositoGarantia = Trim(txtLeyDepGar.Text)
objTO.LeyendaValorResidual = Trim(txtLeyValRes.Text)
objTO.UsuarioRegistro = objTO.UserNameAcceso
objTO.ManejaTipoOperacion(intOpc)
If objTO.ErrorTipoOperacion = "" Then
If GuardaCobroIVA(objTO.IDTipoOperacion) Then
CierraPantalla("./consultaTiposOperacion.aspx")
End If
Else
MensajeError(objTO.ErrorTipoOperacion)
End If
Else
MensajeError("Todos los campos marcados con * son obligatorios.")
End If
Catch ex As Exception
MensajeError(ex.Message)
End Try
End Sub
Private Function ValidaCampos() As Boolean
ValidaCampos = False
If cmbTipEsq.SelectedValue = "" Then Exit Function
If cmbEstatus.SelectedValue = "" Then Exit Function
If Trim(txtNom.Text) = "" Then Exit Function
If Trim(txtClave.Text) = "" Then Exit Function
If chkValResid.Checked Then
If Trim(txtLeyValRes.Text) = "" Then Exit Function
End If
If chkDepGar.Checked Then
If Trim(txtLeyDepGar.Text) = "" Then Exit Function
End If
If chkGtosExt.Checked Then
If cmbGtoExt.SelectedValue = "" Then Exit Function
End If
If chkPagoIni.Checked Then
If cmbForPagIni.SelectedValue = "" Then Exit Function
End If
ValidaCampos = True
End Function
Private Sub HabilitaDeshabilita(ByVal sngOpc As Single)
Try
Select Case sngOpc
Case 1 'valor residual
If chkValResid.Checked Then
txtLeyValRes.Enabled = True
Else
txtLeyValRes.Text = ""
txtLeyValRes.Enabled = False
End If
Case 2 'deposito en garantia
If chkDepGar.Checked Then
txtLeyDepGar.Enabled = True
Else
txtLeyDepGar.Text = ""
txtLeyDepGar.Enabled = False
End If
Case 3 'gastos
If chkGtosExt.Checked Then
cmbGtoExt.Enabled = True
Else
cmbGtoExt.SelectedValue = ""
cmbGtoExt.Enabled = False
End If
Case 4 'pagoinicial
If chkPagoIni.Checked Then
cmbForPagIni.Enabled = True
Else
cmbForPagIni.SelectedValue = ""
cmbForPagIni.Enabled = False
End If
End Select
Catch ex As Exception
MensajeError(ex.Message)
End Try
End Sub
Function GuardaCobroIVA(ByVal intCveTO As Integer) As Boolean
GuardaCobroIVA = False
Try
Dim objRow As GridViewRow
Dim objChk As CheckBox
Dim objTO As New SNProcotiza.clsTiposOperacion(intCveTO)
'primero borramos la información que ya existe
objTO.ManejaTipoOperacion(8)
If objTO.ErrorTipoOperacion <> "" Then
MensajeError(objTO.ErrorTipoOperacion)
Else
'guardamos las personalidades
For Each objRow In gdvPerJur.Rows
If objRow.RowType = DataControlRowType.DataRow Then
objTO.IDPersonalidadJuridica = Val(objRow.Cells(3).Text)
'iva sobre interés
objChk = objRow.Cells(1).Controls(1)
objTO.CobraIVASobreInteres = IIf(objChk.Checked, 1, 0)
'iva sobre capital
objChk = objRow.Cells(2).Controls(1)
objTO.CobraIVASobreCapital = IIf(objChk.Checked, 1, 0)
objTO.ManejaTipoOperacion(9)
If objTO.ErrorTipoOperacion <> "" Then
MensajeError(objTO.ErrorTipoOperacion)
Exit Function
End If
End If
Next
GuardaCobroIVA = True
End If
Catch ex As Exception
MensajeError(ex.Message)
End Try
End Function
Protected Sub btnRegresar_Click(sender As Object, e As System.EventArgs) Handles btnRegresar.Click
Response.Redirect("./consultaTiposOperacion.aspx")
End Sub
Protected Sub chkGtosExt_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkGtosExt.CheckedChanged
HabilitaDeshabilita(3)
End Sub
Protected Sub chkDepGar_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkDepGar.CheckedChanged
HabilitaDeshabilita(2)
End Sub
Protected Sub chkValResid_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkValResid.CheckedChanged
HabilitaDeshabilita(1)
End Sub
Protected Sub chkPagoIni_CheckedChanged(sender As Object, e As System.EventArgs) Handles chkPagoIni.CheckedChanged
HabilitaDeshabilita(4)
End Sub
Protected Sub gdvPerJur_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gdvPerJur.RowDataBound
Try
If Val(Request("tipOpId")) > 0 Then
If e.Row.RowType = DataControlRowType.DataRow Then
Dim intPerJur = Val(e.Row.Cells(3).Text)
Dim objTO As New SNProcotiza.clsTiposOperacion
Dim objChk As New CheckBox
objTO.IDTipoOperacion = Val(Request("tipOpId"))
objTO.IDPersonalidadJuridica = intPerJur
Dim dtsRes As DataSet = objTO.ManejaTipoOperacion(10)
If Trim(objTO.ErrorTipoOperacion) = "" Then
If dtsRes.Tables.Count > 0 Then
If dtsRes.Tables(0).Rows.Count > 0 Then
objChk = e.Row.Cells(1).Controls(1)
If dtsRes.Tables(0).Rows(0).Item("IVA_SOBRE_INTERES") = 1 Then
objChk.Checked = True
End If
objChk = e.Row.Cells(2).Controls(1)
If dtsRes.Tables(0).Rows(0).Item("IVA_SOBRE_CAPITAL") = 1 Then
objChk.Checked = True
End If
End If
End If
End If
End If
End If
Catch ex As Exception
End Try
End Sub
End Class
|
Namespace MenuProject
Class MenuItemForChildForm
Inherits ToolStripMenuItem
Shadows Parent As mainForm
Private _childForm As Type
Public Sub New(ByVal inputMainForm As mainForm, ByVal inputChildForm As Type)
Parent = inputMainForm
_childForm = inputChildForm
'set the menuItem properties
Me.Name = inputChildForm.Name
Me.Text = inputChildForm.Name
AddHandler Me.Click, AddressOf childFormToolStripMenuItem_Click
End Sub
Public ReadOnly Property childForm() As Type
Get
Return _childForm
End Get
End Property
Private Sub childFormToolStripMenuItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim menuItem As ToolStripMenuItem = TryCast(sender, ToolStripMenuItem)
Dim child = Activator.CreateInstance(Me._childForm)
child.MdiParent = Parent
child.Show()
End Sub
End Class
End Namespace
|
Public Class frmMainMenu1
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 PictureBox2 As System.Windows.Forms.PictureBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents btnTransaction As System.Windows.Forms.Button
Friend WithEvents btnReport As System.Windows.Forms.Button
Friend WithEvents btnQuit As System.Windows.Forms.Button
Friend WithEvents btnLogOff As System.Windows.Forms.Button
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMainMenu1))
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.btnTransaction = New System.Windows.Forms.Button()
Me.btnReport = New System.Windows.Forms.Button()
Me.btnQuit = New System.Windows.Forms.Button()
Me.btnLogOff = New System.Windows.Forms.Button()
Me.PictureBox1 = New System.Windows.Forms.PictureBox()
Me.SuspendLayout()
'
'PictureBox2
'
Me.PictureBox2.Image = CType(resources.GetObject("PictureBox2.Image"), System.Drawing.Bitmap)
Me.PictureBox2.Name = "PictureBox2"
Me.PictureBox2.Size = New System.Drawing.Size(792, 64)
Me.PictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox2.TabIndex = 13
Me.PictureBox2.TabStop = False
'
'Label1
'
Me.Label1.Font = New System.Drawing.Font("Arial Black", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.ForeColor = System.Drawing.Color.FromArgb(CType(64, Byte), CType(64, Byte), CType(64, Byte))
Me.Label1.Image = CType(resources.GetObject("Label1.Image"), System.Drawing.Bitmap)
Me.Label1.Location = New System.Drawing.Point(232, 8)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(368, 40)
Me.Label1.TabIndex = 14
Me.Label1.Text = "POWERCOM Point Of Sale"
Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'btnTransaction
'
Me.btnTransaction.BackColor = System.Drawing.Color.White
Me.btnTransaction.Font = New System.Drawing.Font("Courier New", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnTransaction.ForeColor = System.Drawing.Color.Black
Me.btnTransaction.Image = CType(resources.GetObject("btnTransaction.Image"), System.Drawing.Bitmap)
Me.btnTransaction.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnTransaction.Location = New System.Drawing.Point(320, 200)
Me.btnTransaction.Name = "btnTransaction"
Me.btnTransaction.Size = New System.Drawing.Size(152, 40)
Me.btnTransaction.TabIndex = 15
Me.btnTransaction.Text = " Transaction"
'
'btnReport
'
Me.btnReport.BackColor = System.Drawing.Color.White
Me.btnReport.Font = New System.Drawing.Font("Courier New", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnReport.ForeColor = System.Drawing.Color.Black
Me.btnReport.Image = CType(resources.GetObject("btnReport.Image"), System.Drawing.Bitmap)
Me.btnReport.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnReport.Location = New System.Drawing.Point(320, 320)
Me.btnReport.Name = "btnReport"
Me.btnReport.Size = New System.Drawing.Size(152, 40)
Me.btnReport.TabIndex = 16
Me.btnReport.Text = "Report"
'
'btnQuit
'
Me.btnQuit.BackColor = System.Drawing.Color.Transparent
Me.btnQuit.Font = New System.Drawing.Font("Courier New", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnQuit.ForeColor = System.Drawing.Color.Black
Me.btnQuit.Image = CType(resources.GetObject("btnQuit.Image"), System.Drawing.Bitmap)
Me.btnQuit.ImageAlign = System.Drawing.ContentAlignment.TopLeft
Me.btnQuit.Location = New System.Drawing.Point(656, 488)
Me.btnQuit.Name = "btnQuit"
Me.btnQuit.Size = New System.Drawing.Size(112, 40)
Me.btnQuit.TabIndex = 17
Me.btnQuit.Text = " Quit"
'
'btnLogOff
'
Me.btnLogOff.Font = New System.Drawing.Font("Courier New", 9.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnLogOff.Image = CType(resources.GetObject("btnLogOff.Image"), System.Drawing.Bitmap)
Me.btnLogOff.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
Me.btnLogOff.Location = New System.Drawing.Point(536, 488)
Me.btnLogOff.Name = "btnLogOff"
Me.btnLogOff.Size = New System.Drawing.Size(104, 40)
Me.btnLogOff.TabIndex = 18
Me.btnLogOff.Text = " Log Off"
'
'PictureBox1
'
Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Bitmap)
Me.PictureBox1.Location = New System.Drawing.Point(0, 552)
Me.PictureBox1.Name = "PictureBox1"
Me.PictureBox1.Size = New System.Drawing.Size(792, 24)
Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.PictureBox1.TabIndex = 19
Me.PictureBox1.TabStop = False
'
'frmMainMenu1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.BackColor = System.Drawing.Color.White
Me.BackgroundImage = CType(resources.GetObject("$this.BackgroundImage"), System.Drawing.Bitmap)
Me.ClientSize = New System.Drawing.Size(792, 573)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.PictureBox1, Me.btnLogOff, Me.btnQuit, Me.btnReport, Me.btnTransaction, Me.Label1, Me.PictureBox2})
Me.Name = "frmMainMenu1"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Main Menu"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTransaction.Click
cur = New frmTransaction1()
cur.Show()
Me.Dispose()
End Sub
Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
intResponse = MessageBox.Show("Are you sure want to quit ?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If intResponse = MsgBoxResult.Yes Then
End
Else
Exit Sub
End If
End Sub
Private Sub frmMainMenu1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
intResponse = MessageBox.Show("Are you sure want to quit ?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If intResponse = MsgBoxResult.Yes Then
End
Else
Exit Sub
End If
End Sub
Private Sub btnLogOff_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogOff.Click
intResponse = MessageBox.Show("Are you sure want to log off ?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
If intResponse = MsgBoxResult.Yes Then
cur = New frmLogin()
cur.Show()
Me.Dispose()
Else
Exit Sub
End If
End Sub
Private Sub btnReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReport.Click
cur = New frmReport_Item1()
cur.Show()
Me.Dispose()
End Sub
End Class
|
Module SoldiersSoulSave
Public Class Savedata
Public Const EXPECTEDFILESIZE As Integer = 25336
Public Const PLAYABLECHARACTERCOUNT As Integer = 147
Public Const PLAYABLESTAGECOUNT As Integer = 40
Public Shared Content() As Byte = Nothing
Public Shared IsLittleEndian As Boolean
Public Shared Function LoadFromFile(ByVal file As String, ByVal flagPC As Boolean) As Boolean
' it's called from form1, so file probably exists...
Try
Dim b() As Byte = IO.File.ReadAllBytes(file)
If BitConverter.ToInt32(b, 0) <> &H56415323 Then
Dim strMsg As String = "Missing #SAV identifier."
' make sure the part about decrypting the file only appears if the file is supposed to be from PS3
If Not flagPC Then strMsg &= vbCrLf & vbCrLf & "If you think this is the correct file, make sure it has been decrypted first."
MessageBox.Show(strMsg, "Invalid file", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return False
End If
If b.Length <> EXPECTEDFILESIZE Then
MessageBox.Show("Read filesize = " & b.Length & vbCrLf & "Expected filesize = " & EXPECTEDFILESIZE, "Invalid file", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Return False
End If
Content = b
Return True
Catch ex As Exception
MessageBox.Show("Exception in LoadFromFile" & vbCrLf & vbCrLf & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End Try
End Function
Public Shared Function SaveToFile(ByVal file As String) As Boolean
Try
IO.File.WriteAllBytes(file, Content)
Return True
Catch ex As Exception
MessageBox.Show("Exception in SaveToFile" & vbCrLf & vbCrLf & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
Return False
End Try
End Function
Public Shared Function GetInt32(ByVal Index As Integer) As Integer
Dim tempValue As Integer = BitConverter.ToInt32(Content, Index)
If IsLittleEndian Then Return tempValue
Dim bytes() As Byte = BitConverter.GetBytes(tempValue)
Array.Reverse(bytes)
Return BitConverter.ToInt32(bytes, 0)
End Function
Public Shared Sub SetInt32(ByVal Index As Integer, ByVal Value As Integer)
Dim bytes() As Byte = BitConverter.GetBytes(Value)
If IsLittleEndian Then
Content(Index) = bytes(0)
Content(Index + 1) = bytes(1)
Content(Index + 2) = bytes(2)
Content(Index + 3) = bytes(3)
Else
Content(Index) = bytes(3)
Content(Index + 1) = bytes(2)
Content(Index + 2) = bytes(1)
Content(Index + 3) = bytes(0)
End If
End Sub
Public Shared Function GetCosmoPoints() As Integer
Return GetInt32(&H6190)
End Function
Public Shared Sub SetCosmoPoints(ByVal value As Integer)
SetInt32(&H6190, value)
SetInt32(&H6194, value)
End Sub
Public Shared Sub LockPlayableCharacter(ByVal index As Integer)
SetInt32(index * 4 + &HF4, 0)
End Sub
Public Shared Sub UnlockPlayableCharacter(ByVal index As Integer)
SetInt32(index * 4 + &HF4, 1)
End Sub
Public Shared Function IsLockedPlayableCharacter(ByVal index As Integer) As Boolean
Return GetInt32(index * 4 + &HF4) = 0
End Function
Public Shared Sub LockPlayableStage(ByVal index As Integer)
SetInt32(index * 4 + &H1614, 0)
End Sub
Public Shared Sub UnlockPlayableStage(ByVal index As Integer)
SetInt32(index * 4 + &H1614, 1)
End Sub
Public Shared Function IsLockedPlayableStage(ByVal index As Integer) As Boolean
Return GetInt32(index * 4 + &H1614) = 0
End Function
End Class
' XHashtable = Hashtable + List
' Hashtable by itself doesn't care about order of items
' KeyList will keep track of the order
Public Class XHashtable
Inherits Hashtable
Public KeysList As List(Of Object)
Public Sub New()
KeysList = New List(Of Object)
End Sub
Public Overrides Sub Add(key As Object, value As Object)
MyBase.Add(key, value)
KeysList.Add(key)
End Sub
End Class
'http://blog.codinghorror.com/determining-build-date-the-hard-way/
Public Function RetrieveAppLinkerTimestampString() As String
Const PeHeaderOffset As Integer = 60
Const LinkerTimestampOffset As Integer = 8
Dim b(2047) As Byte
Dim s As IO.Stream
Try
s = New IO.FileStream(Application.ExecutablePath, IO.FileMode.Open, IO.FileAccess.Read)
s.Read(b, 0, 2048)
Finally
If Not s Is Nothing Then s.Close()
End Try
Dim i As Integer = BitConverter.ToInt32(b, PeHeaderOffset)
Dim SecondsSince1970 As Integer = BitConverter.ToInt32(b, i + LinkerTimestampOffset)
Dim dt As New DateTime(1970, 1, 1, 0, 0, 0)
dt = dt.AddSeconds(SecondsSince1970)
Return dt.ToString("MMM d yyyy HH:mm:ss UTC")
End Function
End Module
|
Namespace Helpers
Public Module MatrixMath
Public Function Mult(ByRef m1 As Integer(,), ByRef m2 As Integer()) As Integer()
If (m1.GetLength(0) <> m2.Length) Then
Throw New ArgumentException("Number of rows and/or columns of matrices do not match")
End If
Dim result = New Integer(m2.Length - 1) {}
For i = 0 To m1.GetLength(0) - 1
Dim row = 0
For j = 0 To m1.GetLength(1) - 1
Dim temp = m1(i, j) * (m2(j))
row = temp Xor row
Next j
result(i) = row
Next i
Return result
End Function
Public Function Mult(ByRef m1 As Integer(,), ByRef m2 As Integer(,)) As Integer(,)
If (m1.GetLength(0) <> m2.GetLength(1)) Then
Throw New ArgumentException("Number of rows and/or columns of matrices do not match")
End If
Dim result = New Integer(m1.GetLength(0) - 1, m2.GetLength(1) - 1) {}
For i = 0 To m1.GetLength(0) - 1
For j = 0 To m1.GetLength(1) - 1
For k = 0 To m1.GetLength(1) - 1
result(i, j) = result(i, j) Xor (m1(i, k) * m2(k, j))
Next k
Next j
Next i
Return result
End Function
Public Function Pow(ByVal matrix As Integer(,), ByVal power As Integer) As Integer(,)
Dim result = matrix
For i = 1 To power - 1
result = MatrixMath.Mult(result, matrix)
Next
Return result
End Function
Public Function XorVector(ByVal vector1 As Integer(), ByVal vector2 As Integer()) As Integer()
If (vector1.Length <> vector2.Length) Then
Throw New ArgumentException("Vectors length do not match")
End If
Dim result = New Integer(vector1.Length - 1) {}
For i = 0 To vector1.Length - 1
result(i) = vector1(i) Xor vector2(i)
Next
Return result
End Function
End Module
End Namespace
|
Imports Route4MeSDKLibrary.Route4MeSDK
Imports Route4MeSDKLibrary.Route4MeSDK.DataTypes
Imports Route4MeSDKLibrary.Route4MeSDK.QueryTypes
Namespace Route4MeSDKTest.Examples
Partial Public NotInheritable Class Route4MeExamples
''' <summary>
''' Search for Specified Text, Show Specified Fields
''' </summary>
Public Sub GetSpecifiedFieldsSearchText()
Dim route4Me = New Route4MeManager(ActualApiKey)
CreateTestContacts()
Dim addressBookParameters = New AddressBookParameters With {
.Query = "Test FirstName",
.Fields = "address_id,first_name,address_email,address_group,first_name,cached_lat,schedule",
.Offset = 0,
.Limit = 20
}
Dim contactsFromObjects As List(Of AddressBookContact) = Nothing
Dim errorString As String = Nothing
Dim response = route4Me.SearchAddressBookLocation(addressBookParameters, contactsFromObjects, errorString)
PrintExampleContact(contactsFromObjects.ToArray(), (If(contactsFromObjects IsNot Nothing, CUInt(contactsFromObjects.Count), 0)), errorString)
RemoveTestContacts()
End Sub
End Class
End Namespace
|
Imports ACS.Form1
Public Class TooltipMgr
Public VENDOR_ENTRY As String = "NPC Entry, must be unique."
Public VENDOR_MODEL As String = "NPC Model id, usually it is taken from existing creatures. Use the button to browse them."
Public VENDOR_SIZE As String = "NPC Size, 1 = normal size, 0.5 = half size, 2 = double size, ..."
Public VENDOR_FACTION As String = "NPC Faction id, taken from faction.dbc, click to browse them."
Public VENDOR_CREPAIR As String = "Check to allow this NPC to repair equipment."
Public VENDOR_ITEMID As String = "Id of the item to sell. Click to browse items."
Public VENDOR_ITEMCOST As String = "Id of the item cost (if any), leave it blank or 0 to sell it using Golds (buyprice). Click to browse the extended costs"
Public Sub initializeVendorTooltip()
VendorForm.tooltip.SetToolTip(VendorForm.numEntry, VENDOR_ENTRY)
VendorForm.tooltip.SetToolTip(VendorForm.lblEntry, VENDOR_ENTRY)
VendorForm.tooltip.SetToolTip(VendorForm.numModel, VENDOR_MODEL)
VendorForm.tooltip.SetToolTip(VendorForm.lblModel, VENDOR_MODEL)
VendorForm.tooltip.SetToolTip(VendorForm.numSize, VENDOR_SIZE)
VendorForm.tooltip.SetToolTip(VendorForm.lblSize, VENDOR_SIZE)
VendorForm.tooltip.SetToolTip(VendorForm.numFaction, VENDOR_FACTION)
VendorForm.tooltip.SetToolTip(VendorForm.lblFaction, VENDOR_FACTION)
VendorForm.tooltip.SetToolTip(VendorForm.checkRepair, VENDOR_CREPAIR)
VendorForm.tooltip.SetToolTip(VendorForm.numItemId, VENDOR_ITEMID)
VendorForm.tooltip.SetToolTip(VendorForm.lblItemId, VENDOR_ITEMID)
VendorForm.tooltip.SetToolTip(VendorForm.numItemCost, VENDOR_ITEMCOST)
VendorForm.tooltip.SetToolTip(VendorForm.lblItemCost, VENDOR_ITEMCOST)
End Sub
Public Sub initializeQuestTooltip()
End Sub
End Class
|
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Xml.Serialization
Namespace ChartsDemo
<XmlRoot("CountryPopulationData")>
Public Class CountryPopulationData
Inherits List(Of CountryPopulation)
Private Shared data_Renamed As List(Of CountryPopulation) = Nothing
Public Shared ReadOnly Property Data() As List(Of CountryPopulation)
Get
If data_Renamed Is Nothing Then
Dim s = New XmlSerializer(GetType(CountryPopulationData))
data_Renamed = DirectCast(s.Deserialize(DataLoader.LoadFromResources("/Data/CountryPopulationData.xml")), List(Of CountryPopulation))
End If
Return data_Renamed
End Get
End Property
End Class
Public Class CountryPopulation
Public Property Country() As String
Public Property Population() As Integer
End Class
End Namespace
|
' Inspired from http://www.codeproject.com/KB/cs/enumdatabinding.aspx
Imports System.Reflection
Imports Solution1.Module.Win.XEnums
'Imports XApp.XEnums
'Imports XFW.XEnums
<AttributeUsage(AttributeTargets.Enum Or AttributeTargets.Field, AllowMultiple:=False)>
Public NotInheritable Class EnumDescriptionAttribute
Inherits Attribute
Private _Localized As Boolean
Public ReadOnly Property Localized As Boolean
Get
Return _Localized
End Get
End Property
'Public Property LocalizedDescription() As String
Private _Description As String
Public ReadOnly Property Description() As String
Get
Return _Description
End Get
End Property
Private _ImageInfo As String
Public ReadOnly Property ImageInfo() As String
Get
Return _ImageInfo
End Get
End Property
Private _ImageFrom As ImageFromEnum
Public ReadOnly Property ImageFrom() As ImageFromEnum
Get
Return _ImageFrom
End Get
End Property
Private _RessourceType As RessourceType = RessourceType.Running
Public ReadOnly Property RessourceType As RessourceType
Get
Return _RessourceType
End Get
End Property
Private _ResourceManager As Resources.ResourceManager
Public ReadOnly Property ResourceManager As Resources.ResourceManager
Get
Return _ResourceManager
End Get
End Property
Public Sub New()
End Sub
Public Sub New(ByVal ressourceType As RessourceType)
Me.New("", , , , ressourceType)
End Sub
Public Sub New(ByVal desc As String,
Optional ByVal imgInfo As String = "",
Optional ByVal imgFrom As ImageFromEnum = ImageFromEnum.None,
Optional ByVal localized As Boolean = True, Optional ByVal ressourceType As RessourceType = RessourceType.Running)
MyBase.New()
Me.GetType()
_Description = desc
_ImageInfo = imgInfo
_ImageFrom = imgFrom
_RessourceType = ressourceType
Select Case ressourceType
Case XEnums.RessourceType.Running
Try
Dim ass As Assembly = Assembly.GetEntryAssembly
_ResourceManager = New Resources.ResourceManager(String.Format("{0}.Resources", ass.FullName.Split({","}, System.StringSplitOptions.RemoveEmptyEntries)(0).Trim), ass)
Catch
End Try
Case XEnums.RessourceType.Self
_ResourceManager = My.Resources.ResourceManager
Case XEnums.RessourceType.Inhirit
_ResourceManager = Nothing
End Select
_Localized = localized
End Sub
Public Function GetDescription(Optional ByVal localized As Boolean = True) As String
If Not _Localized Then Return _Description
If localized Then
If _ResourceManager Is Nothing Then
Return _Description
Else
Dim desc As String = _ResourceManager.GetString(_Description.Replace(" ", "_"))
If desc Is Nothing Then
Return _Description
End If
Return desc
End If
Else
Return _Description
End If
End Function
End Class
'Namespace XFW.XAttributes
'End Namespace
|
Public Class Ship
Implements ShipCombat
Public Shared Function Generate(ByVal size As ShipSize) As Ship
Dim ship As New Ship
With ship
.Name = ShipGenerator.GetName
.Size = size
Select Case size
Case ShipSize.Sloop
.Quadrants.Add(Directions.Fore, New Quadrant(ship, Directions.Fore, 3, 0))
.Quadrants.Add(Directions.Starboard, New Quadrant(ship, Directions.Starboard, 3, 1))
.Quadrants.Add(Directions.Aft, New Quadrant(ship, Directions.Aft, 3, 0))
.Quadrants.Add(Directions.Port, New Quadrant(ship, Directions.Port, 3, 1))
.Inventory = New Inventory(20)
.SailingMax = 2000
.ManeuverMax = 5
Case ShipSize.Schooner
.Quadrants.Add(Directions.Fore, New Quadrant(ship, Directions.Fore, 4, 1))
.Quadrants.Add(Directions.Starboard, New Quadrant(ship, Directions.Starboard, 4, 1))
.Quadrants.Add(Directions.Aft, New Quadrant(ship, Directions.Aft, 4, 0))
.Quadrants.Add(Directions.Port, New Quadrant(ship, Directions.Port, 4, 1))
.Inventory = New Inventory(30)
.SailingMax = 2000
.ManeuverMax = 4
Case ShipSize.Brig
.Quadrants.Add(Directions.Fore, New Quadrant(ship, Directions.Fore, 5, 1))
.Quadrants.Add(Directions.Starboard, New Quadrant(ship, Directions.Starboard, 5, 2))
.Quadrants.Add(Directions.Aft, New Quadrant(ship, Directions.Aft, 5, 0))
.Quadrants.Add(Directions.Port, New Quadrant(ship, Directions.Port, 5, 2))
.Inventory = New Inventory(50)
.SailingMax = 2000
.ManeuverMax = 3
Case ShipSize.Frigate
.Quadrants.Add(Directions.Fore, New Quadrant(ship, Directions.Fore, 6, 1))
.Quadrants.Add(Directions.Starboard, New Quadrant(ship, Directions.Starboard, 6, 3))
.Quadrants.Add(Directions.Aft, New Quadrant(ship, Directions.Aft, 6, 1))
.Quadrants.Add(Directions.Port, New Quadrant(ship, Directions.Port, 6, 3))
.Inventory = New Inventory(70)
.SailingMax = 1600
.ManeuverMax = 2
Case ShipSize.Manowar
.Quadrants.Add(Directions.Fore, New Quadrant(ship, Directions.Fore, 7, 1))
.Quadrants.Add(Directions.Starboard, New Quadrant(ship, Directions.Starboard, 7, 4))
.Quadrants.Add(Directions.Aft, New Quadrant(ship, Directions.Aft, 7, 1))
.Quadrants.Add(Directions.Port, New Quadrant(ship, Directions.Port, 7, 4))
.Inventory = New Inventory(80)
.SailingMax = 1500
.ManeuverMax = 1
End Select
End With
Return ship
End Function
Private Property Name As String Implements ShipCombat.Name
Private Size As ShipSize
Private Property CurrentFacing As Directions Implements ShipCombat.CurrentFacing
Private Inventory As Inventory
Public Function Add(ByVal item As Item) As String
Return Inventory.Add(item)
End Function
Public Function Remove(ByVal item As Item) As String
Return Inventory.Remove(item)
End Function
#Region "Combat"
Private Property Sailing As Integer Implements ShipCombat.Sailing
Private Property SailingMax As Integer Implements ShipCombat.SailingMax
Private ReadOnly Property SailingIncome As Integer
Get
Dim total As Integer = 0
Dim sails As List(Of Section) = GetSections({"type=sails"})
For Each s In sails
Dim ss As SectionSails = CType(s, SectionSails)
total += ss.SpeedTotal
Next
Return total
End Get
End Property
Private Property Maneuver As Integer Implements ShipCombat.Maneuver
Private Property ManeuverMax As Integer Implements ShipCombat.ManeuverMax
Private Sub CombatTick(ByVal battlefield As Battlefield) Implements ShipCombat.Tick
Sailing += SailingIncome
While Sailing >= SailingMax
Sailing -= SailingMax
Maneuver += 1
End While
If Maneuver > ManeuverMax Then Maneuver = ManeuverMax
For Each section In GetSections({"type=gun"})
Dim gun As SectionGun = CType(section, SectionGun)
gun.CombatTick()
Next
End Sub
Private Sub CombatAttack(ByVal target As ShipCombat, ByVal gun As SectionGun) Implements ShipCombat.Attack
End Sub
#End Region
Private Property Quadrants As New Dictionary(Of Directions, Quadrant) Implements ShipCombat.Quadrants
Public Function Add(ByVal section As Section, ByVal facing As Directions) As String
Dim q As Quadrant = Quadrants(facing)
Return q.Add(section)
End Function
Public Function Remove(ByVal section As Section, ByVal facing As Directions) As String
Dim q As Quadrant = Quadrants(facing)
Return q.Remove(section)
End Function
Public Function GetSections(ByVal param As String()) As List(Of Section)
Dim total As New List(Of Section)
For Each q In Quadrants.Values
Dim qs As List(Of Section) = q.GetSections(param)
If qs Is Nothing = False AndAlso qs.Count > 0 Then total.AddRange(qs)
Next
Return total
End Function
Public Function GetCrews(ByVal param As String()) As List(Of Crew)
Dim total As New List(Of Crew)
For Each q In Quadrants.Values
Dim qs As List(Of Crew) = q.GetCrews(param)
If qs Is Nothing = False AndAlso qs.Count > 0 Then total.AddRange(qs)
Next
Return total
End Function
Public Function ConsoleReport(ByVal id As Integer) As String
Dim total As String = vbIndent(id) & "The " & Size.ToString & " '" & Name & "'" & vbCrLf
total &= vbIndent(id + 1) & vbTabb("Cargo:", 12) & Inventory.Size & "/" & Inventory.SizeMax & vbCrLf
total &= vbIndent(id + 1) & vbTabb("Sailgauge:", 12) & SailingMax & vbCrLf
total &= vbIndent(id + 1) & vbTabb("Maneuvers:", 12) & Maneuver & "/" & ManeuverMax & vbCrLf
total &= vbIndent(id + 1) & "Quadrants:" & vbCrLf
For n As Directions = 1 To 4
total &= vbIndent(id + 2) & Quadrants(n).ConsoleReportBrief() & vbCrLf
Next
Return total
End Function
Public Function ConsoleReportInventory(ByVal id As Integer) As String
Return Inventory.ConsoleReport(id)
End Function
Public Function ConsoleReportQuadrant(ByVal ind As Integer, ByVal d As Directions) As String
Return Quadrants(d).ConsoleReport(ind)
End Function
End Class
Public Enum ShipSize
Sloop = 1
Schooner
Brig
Frigate
Manowar
End Enum
Public Enum Directions
Fore = 1
Starboard
Aft
Port
End Enum
Public Class ShipGenerator
Private Shared Prefixes As New List(Of String)
Private Shared Suffixes As New List(Of String)
Public Shared Function GetName() As String
If Prefixes.Count = 0 Then Prefixes = IO.ImportTextList("data/shipPrefixes.txt")
If Suffixes.Count = 0 Then Suffixes = IO.ImportTextList("data/shipSuffixes.txt")
Return GrabRandom(Prefixes) & " " & GrabRandom(Suffixes)
End Function
End Class |
Imports System.ComponentModel.DataAnnotations
Public Class clsUser
<Required>
<EmailAddress>
Property email As String
Property id As String
Property shop_connections As New List(Of String)
Property eskimo_operator_id As String
End Class
Class clsAppPermission
Property PermissionDescription As String
End Class |
Public Interface IProject
Inherits IProjectFile
ReadOnly Property FilesExtension() As String
ReadOnly Property Files() As IEnumerable(Of IProjectFile)
End Interface
|
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Imports System.Collections.Generic
Namespace Entities
Public Class Invoice
<Key> _
<MaxLength(15)> _
<Display(Name:="Invoice No.")> _
Public Property InvoiceID As String
Public Property InvoicedTo As String
<MaxLength(3)> _
Public Property ProductID As String
Public Property ProductTermNumber As Integer?
<MaxLength(20)> _
Public Property ProductTermPeriod As String
<DisplayFormat(DataFormatString:="{0:#,##0.##}")> _
Public Property ProductPrice As Double
<DisplayFormat(DataformatString:="{0:#,##0.##}")> _
Public Property ProductDiscount As Double?
<MaxLength(15)> _
Public Property DomainRegID As String
Public Property DomainRegTermNumber As Integer?
<MaxLength(20)> _
Public Property DomainRegTermPeriod As String
<DisplayFormat(DataformatString:="{0:#,##0.##}")> _
Public Property DomainRegPrice As Double
<DisplayFormat(DataformatString:="{0:#,##0.##}")> _
Public Property DomainRegDiscount As Double?
<Display(Name:="Create Date")> _
<DisplayFormat(DataFormatString:="{0:dd-MMMM-yyyy}")> _
Public Property CreateDate As Date?
<Display(Name:="Document is complete")> _
Public Property DocumentIsComplete As Boolean
<Display(Name:="Document verified by")> _
<MaxLength(20)> _
Public Property DocumentVerifiedBy As String
<DisplayFormat(DataFormatString:="{0:dd-MMMM-yyyy}")> _
Public Property DocumentVerifiedDate As Date?
<Display(Name:="Document verification remark")> _
<MaxLength(500)> _
Public Property DocumentVerificationRemark As String
<Display(Name:="Payment Due Date")> _
<DisplayFormat(DataFormatString:="{0:dd-MMMM-yyyy}")> _
Public Property PaymentDueDate As Date
<Display(Name:="Payment Method")> _
<MaxLength(20)>
Public Property PaymentMethod As String
<MaxLength(30)> _
Public Property Bank As String
<Display(Name:="Bank Account Number")> _
<MaxLength(30)> _
Public Property BankAccountNo As String
<Display(Name:="Account Name")> _
<MaxLength(50)> _
Public Property BankAccountName As String
<Display(Name:="Pay to")> _
Public Property BankAccountID As String
<Display(Name:="Payment Date")> _
<DisplayFormat(DataFormatString:="{0:dd-MMMM-yyyy}")> _
Public Property PaymentDate As Date?
<Display(Name:="Payment Amount")> _
<DisplayFormat(DataformatString:="{0:#,##0.##}")> _
Public Property PaymentAmount As Double
<Display(Name:="Validation Number")> _
<MaxLength(20)> _
Public Property ValidationNo As String
<Display(Name:="Payment is complete")> _
Public Property PaymentIsComplete As Boolean
<Display(Name:="Payment verified by")> _
<MaxLength(20)> _
Public Property PaymentVerifiedBy As String
<DisplayFormat(DataFormatString:="{0:dd-MMMM-yyyy}")> _
Public Property PaymentVerifiedDate As Date?
<Display(Name:="Payment verification remark")> _
<MaxLength(500)> _
Public Property PaymentVerificationRemark As String
Public Overridable Property Product As Product
Public Overridable Property Domain As Domain
Public Overridable Property InvoiceAttachments As ICollection(Of InvoiceAttachment)
Public Overridable Property BankAccount As BankAccount
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FrmUser
Inherits DevExpress.XtraEditors.XtraForm
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
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.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FrmUser))
Me.gboCondition = New System.Windows.Forms.GroupBox()
Me.txtPhone = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.txtPCNo = New System.Windows.Forms.TextBox()
Me.Label4 = New System.Windows.Forms.Label()
Me.txtGlobalPass = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.txtGlobalID = New System.Windows.Forms.TextBox()
Me.Label2 = New System.Windows.Forms.Label()
Me.txtSection = New System.Windows.Forms.TextBox()
Me.txtPassword = New System.Windows.Forms.TextBox()
Me.txtFullName = New System.Windows.Forms.TextBox()
Me.txtUserName = New System.Windows.Forms.TextBox()
Me.txtUserID = New System.Windows.Forms.TextBox()
Me.Label1 = New System.Windows.Forms.Label()
Me.ckoPass = New System.Windows.Forms.CheckBox()
Me.lblFullName = New System.Windows.Forms.Label()
Me.lblUserName = New System.Windows.Forms.Label()
Me.lblUserID = New System.Windows.Forms.Label()
Me.mnuTrainning = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.mnuGroupOfSiteStock = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuGroupOfWT = New System.Windows.Forms.ToolStripMenuItem()
Me.GroupOfTrainingToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuSPC = New System.Windows.Forms.ToolStripMenuItem()
Me.tlsMenu = New System.Windows.Forms.ToolStrip()
Me.mnuNew = New System.Windows.Forms.ToolStripButton()
Me.mnuSave = New System.Windows.Forms.ToolStripButton()
Me.mnuShowAll = New System.Windows.Forms.ToolStripButton()
Me.mnuDelete = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.mnuExport = New System.Windows.Forms.ToolStripButton()
Me.mnuExportInfo = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.mnuCopyRight = New System.Windows.Forms.ToolStripButton()
Me.mnuAddRight = New System.Windows.Forms.ToolStripButton()
Me.mnuEdit = New System.Windows.Forms.ToolStripButton()
Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator()
Me.container = New System.Windows.Forms.SplitContainer()
Me.GridControl1 = New DevExpress.XtraGrid.GridControl()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.tvwRight = New System.Windows.Forms.TreeView()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.DataGridViewAutoFilterTextBoxColumn1 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn2 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn3 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn4 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn5 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn6 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn7 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn8 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn9 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn10 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn11 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn12 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn13 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn14 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn15 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn16 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewAutoFilterTextBoxColumn17 = New DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.mnuKillAll = New System.Windows.Forms.ToolStripButton()
Me.gboCondition.SuspendLayout()
Me.mnuTrainning.SuspendLayout()
Me.tlsMenu.SuspendLayout()
CType(Me.container, System.ComponentModel.ISupportInitialize).BeginInit()
Me.container.Panel1.SuspendLayout()
Me.container.Panel2.SuspendLayout()
Me.container.SuspendLayout()
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'gboCondition
'
Me.gboCondition.Controls.Add(Me.txtPhone)
Me.gboCondition.Controls.Add(Me.Label5)
Me.gboCondition.Controls.Add(Me.txtPCNo)
Me.gboCondition.Controls.Add(Me.Label4)
Me.gboCondition.Controls.Add(Me.txtGlobalPass)
Me.gboCondition.Controls.Add(Me.Label3)
Me.gboCondition.Controls.Add(Me.txtGlobalID)
Me.gboCondition.Controls.Add(Me.Label2)
Me.gboCondition.Controls.Add(Me.txtSection)
Me.gboCondition.Controls.Add(Me.txtPassword)
Me.gboCondition.Controls.Add(Me.txtFullName)
Me.gboCondition.Controls.Add(Me.txtUserName)
Me.gboCondition.Controls.Add(Me.txtUserID)
Me.gboCondition.Controls.Add(Me.Label1)
Me.gboCondition.Controls.Add(Me.ckoPass)
Me.gboCondition.Controls.Add(Me.lblFullName)
Me.gboCondition.Controls.Add(Me.lblUserName)
Me.gboCondition.Controls.Add(Me.lblUserID)
Me.gboCondition.Dock = System.Windows.Forms.DockStyle.Top
Me.gboCondition.Location = New System.Drawing.Point(0, 0)
Me.gboCondition.Name = "gboCondition"
Me.gboCondition.Size = New System.Drawing.Size(940, 61)
Me.gboCondition.TabIndex = 0
Me.gboCondition.TabStop = False
'
'txtPhone
'
Me.txtPhone.Location = New System.Drawing.Point(798, 30)
Me.txtPhone.Name = "txtPhone"
Me.txtPhone.Size = New System.Drawing.Size(125, 20)
Me.txtPhone.TabIndex = 17
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(801, 15)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(43, 13)
Me.Label5.TabIndex = 18
Me.Label5.Text = "Hotline:"
'
'txtPCNo
'
Me.txtPCNo.Location = New System.Drawing.Point(733, 30)
Me.txtPCNo.Name = "txtPCNo"
Me.txtPCNo.Size = New System.Drawing.Size(59, 20)
Me.txtPCNo.TabIndex = 15
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(736, 15)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(35, 13)
Me.Label4.TabIndex = 16
Me.Label4.Text = "PCNo"
'
'txtGlobalPass
'
Me.txtGlobalPass.Location = New System.Drawing.Point(625, 30)
Me.txtGlobalPass.Name = "txtGlobalPass"
Me.txtGlobalPass.Size = New System.Drawing.Size(102, 20)
Me.txtGlobalPass.TabIndex = 13
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(628, 15)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(62, 13)
Me.Label3.TabIndex = 14
Me.Label3.Text = "GloballPass"
'
'txtGlobalID
'
Me.txtGlobalID.Location = New System.Drawing.Point(517, 30)
Me.txtGlobalID.Name = "txtGlobalID"
Me.txtGlobalID.Size = New System.Drawing.Size(102, 20)
Me.txtGlobalID.TabIndex = 11
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(520, 15)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(48, 13)
Me.Label2.TabIndex = 12
Me.Label2.Text = "GlobalID"
'
'txtSection
'
Me.txtSection.Location = New System.Drawing.Point(306, 30)
Me.txtSection.Name = "txtSection"
Me.txtSection.ReadOnly = True
Me.txtSection.Size = New System.Drawing.Size(108, 20)
Me.txtSection.TabIndex = 9
'
'txtPassword
'
Me.txtPassword.Location = New System.Drawing.Point(414, 30)
Me.txtPassword.MaxLength = 50
Me.txtPassword.Name = "txtPassword"
Me.txtPassword.Size = New System.Drawing.Size(97, 20)
Me.txtPassword.TabIndex = 4
Me.txtPassword.UseSystemPasswordChar = True
'
'txtFullName
'
Me.txtFullName.Location = New System.Drawing.Point(138, 30)
Me.txtFullName.Name = "txtFullName"
Me.txtFullName.Size = New System.Drawing.Size(168, 20)
Me.txtFullName.TabIndex = 3
'
'txtUserName
'
Me.txtUserName.Location = New System.Drawing.Point(70, 30)
Me.txtUserName.Name = "txtUserName"
Me.txtUserName.Size = New System.Drawing.Size(67, 20)
Me.txtUserName.TabIndex = 2
'
'txtUserID
'
Me.txtUserID.BackColor = System.Drawing.Color.FromArgb(CType(CType(255, Byte), Integer), CType(CType(255, Byte), Integer), CType(CType(192, Byte), Integer))
Me.txtUserID.Location = New System.Drawing.Point(13, 30)
Me.txtUserID.Name = "txtUserID"
Me.txtUserID.Size = New System.Drawing.Size(57, 20)
Me.txtUserID.TabIndex = 1
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(303, 14)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(43, 13)
Me.Label1.TabIndex = 10
Me.Label1.Text = "Section"
'
'ckoPass
'
Me.ckoPass.AutoSize = True
Me.ckoPass.Location = New System.Drawing.Point(414, 12)
Me.ckoPass.Name = "ckoPass"
Me.ckoPass.Size = New System.Drawing.Size(72, 17)
Me.ckoPass.TabIndex = 4
Me.ckoPass.Text = "Password"
Me.ckoPass.UseVisualStyleBackColor = True
'
'lblFullName
'
Me.lblFullName.AutoSize = True
Me.lblFullName.Location = New System.Drawing.Point(141, 15)
Me.lblFullName.Name = "lblFullName"
Me.lblFullName.Size = New System.Drawing.Size(52, 13)
Me.lblFullName.TabIndex = 8
Me.lblFullName.Text = "Full name"
'
'lblUserName
'
Me.lblUserName.AutoSize = True
Me.lblUserName.Location = New System.Drawing.Point(67, 13)
Me.lblUserName.Name = "lblUserName"
Me.lblUserName.Size = New System.Drawing.Size(58, 13)
Me.lblUserName.TabIndex = 6
Me.lblUserName.Text = "User name"
'
'lblUserID
'
Me.lblUserID.AutoSize = True
Me.lblUserID.Location = New System.Drawing.Point(10, 14)
Me.lblUserID.Name = "lblUserID"
Me.lblUserID.Size = New System.Drawing.Size(43, 13)
Me.lblUserID.TabIndex = 1
Me.lblUserID.Text = "User ID"
'
'mnuTrainning
'
Me.mnuTrainning.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuGroupOfSiteStock, Me.mnuGroupOfWT, Me.GroupOfTrainingToolStripMenuItem, Me.mnuSPC})
Me.mnuTrainning.Name = "ContextMenuStrip1"
Me.mnuTrainning.Size = New System.Drawing.Size(177, 92)
'
'mnuGroupOfSiteStock
'
Me.mnuGroupOfSiteStock.Name = "mnuGroupOfSiteStock"
Me.mnuGroupOfSiteStock.Size = New System.Drawing.Size(176, 22)
Me.mnuGroupOfSiteStock.Text = "Group of SiteStock"
'
'mnuGroupOfWT
'
Me.mnuGroupOfWT.Name = "mnuGroupOfWT"
Me.mnuGroupOfWT.Size = New System.Drawing.Size(176, 22)
Me.mnuGroupOfWT.Text = "Group of Worktime"
'
'GroupOfTrainingToolStripMenuItem
'
Me.GroupOfTrainingToolStripMenuItem.Name = "GroupOfTrainingToolStripMenuItem"
Me.GroupOfTrainingToolStripMenuItem.Size = New System.Drawing.Size(176, 22)
Me.GroupOfTrainingToolStripMenuItem.Text = "Group of Training"
'
'mnuSPC
'
Me.mnuSPC.Name = "mnuSPC"
Me.mnuSPC.Size = New System.Drawing.Size(176, 22)
Me.mnuSPC.Text = "Group of SPC"
'
'tlsMenu
'
Me.tlsMenu.AutoSize = False
Me.tlsMenu.GripStyle = System.Windows.Forms.ToolStripGripStyle.Hidden
Me.tlsMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuNew, Me.mnuSave, Me.mnuShowAll, Me.mnuDelete, Me.ToolStripSeparator1, Me.mnuExport, Me.mnuExportInfo, Me.ToolStripSeparator2, Me.mnuCopyRight, Me.mnuAddRight, Me.mnuEdit, Me.ToolStripSeparator3, Me.mnuKillAll})
Me.tlsMenu.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.HorizontalStackWithOverflow
Me.tlsMenu.Location = New System.Drawing.Point(0, 0)
Me.tlsMenu.Name = "tlsMenu"
Me.tlsMenu.Size = New System.Drawing.Size(1244, 58)
Me.tlsMenu.TabIndex = 2
Me.tlsMenu.Text = "ToolStrip1"
'
'mnuNew
'
Me.mnuNew.AutoSize = False
Me.mnuNew.ForeColor = System.Drawing.Color.Black
Me.mnuNew.Image = CType(resources.GetObject("mnuNew.Image"), System.Drawing.Image)
Me.mnuNew.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuNew.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuNew.Name = "mnuNew"
Me.mnuNew.Size = New System.Drawing.Size(60, 50)
Me.mnuNew.Text = "New"
Me.mnuNew.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuNew.ToolTipText = "New (Ctrl+N)"
'
'mnuSave
'
Me.mnuSave.AutoSize = False
Me.mnuSave.ForeColor = System.Drawing.Color.Black
Me.mnuSave.Image = CType(resources.GetObject("mnuSave.Image"), System.Drawing.Image)
Me.mnuSave.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuSave.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuSave.Name = "mnuSave"
Me.mnuSave.Size = New System.Drawing.Size(60, 50)
Me.mnuSave.Text = "Save"
Me.mnuSave.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuSave.ToolTipText = "Save (Ctrl+S)"
'
'mnuShowAll
'
Me.mnuShowAll.AutoSize = False
Me.mnuShowAll.ForeColor = System.Drawing.Color.Black
Me.mnuShowAll.Image = CType(resources.GetObject("mnuShowAll.Image"), System.Drawing.Image)
Me.mnuShowAll.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuShowAll.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuShowAll.Name = "mnuShowAll"
Me.mnuShowAll.Size = New System.Drawing.Size(60, 50)
Me.mnuShowAll.Text = "Show all"
Me.mnuShowAll.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuShowAll.ToolTipText = "Show all ( F5 )"
'
'mnuDelete
'
Me.mnuDelete.AutoSize = False
Me.mnuDelete.ForeColor = System.Drawing.Color.Black
Me.mnuDelete.Image = CType(resources.GetObject("mnuDelete.Image"), System.Drawing.Image)
Me.mnuDelete.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuDelete.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuDelete.Name = "mnuDelete"
Me.mnuDelete.Size = New System.Drawing.Size(60, 50)
Me.mnuDelete.Text = "Delete"
Me.mnuDelete.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuDelete.ToolTipText = "Delete (Ctrl +D)"
'
'ToolStripSeparator1
'
Me.ToolStripSeparator1.ForeColor = System.Drawing.Color.Black
Me.ToolStripSeparator1.Name = "ToolStripSeparator1"
Me.ToolStripSeparator1.Size = New System.Drawing.Size(6, 58)
'
'mnuExport
'
Me.mnuExport.AutoSize = False
Me.mnuExport.ForeColor = System.Drawing.Color.Black
Me.mnuExport.Image = CType(resources.GetObject("mnuExport.Image"), System.Drawing.Image)
Me.mnuExport.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuExport.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuExport.Name = "mnuExport"
Me.mnuExport.Size = New System.Drawing.Size(60, 50)
Me.mnuExport.Text = "Export"
Me.mnuExport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuExport.ToolTipText = "Export"
'
'mnuExportInfo
'
Me.mnuExportInfo.AutoSize = False
Me.mnuExportInfo.ForeColor = System.Drawing.Color.Black
Me.mnuExportInfo.Image = CType(resources.GetObject("mnuExportInfo.Image"), System.Drawing.Image)
Me.mnuExportInfo.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuExportInfo.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuExportInfo.Name = "mnuExportInfo"
Me.mnuExportInfo.Size = New System.Drawing.Size(60, 50)
Me.mnuExportInfo.Text = "Export Info"
Me.mnuExportInfo.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuExportInfo.ToolTipText = "Export Info"
'
'ToolStripSeparator2
'
Me.ToolStripSeparator2.ForeColor = System.Drawing.Color.Black
Me.ToolStripSeparator2.Name = "ToolStripSeparator2"
Me.ToolStripSeparator2.Size = New System.Drawing.Size(6, 58)
'
'mnuCopyRight
'
Me.mnuCopyRight.AutoSize = False
Me.mnuCopyRight.ForeColor = System.Drawing.Color.Black
Me.mnuCopyRight.Image = CType(resources.GetObject("mnuCopyRight.Image"), System.Drawing.Image)
Me.mnuCopyRight.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuCopyRight.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuCopyRight.Name = "mnuCopyRight"
Me.mnuCopyRight.Size = New System.Drawing.Size(60, 50)
Me.mnuCopyRight.Text = "CopyRight"
Me.mnuCopyRight.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuCopyRight.ToolTipText = "CopyRight"
'
'mnuAddRight
'
Me.mnuAddRight.AutoSize = False
Me.mnuAddRight.ForeColor = System.Drawing.Color.Black
Me.mnuAddRight.Image = CType(resources.GetObject("mnuAddRight.Image"), System.Drawing.Image)
Me.mnuAddRight.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuAddRight.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuAddRight.Name = "mnuAddRight"
Me.mnuAddRight.Size = New System.Drawing.Size(60, 50)
Me.mnuAddRight.Text = "AddRight"
Me.mnuAddRight.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuAddRight.ToolTipText = "CopyRight"
'
'mnuEdit
'
Me.mnuEdit.AutoSize = False
Me.mnuEdit.ForeColor = System.Drawing.Color.Black
Me.mnuEdit.Image = CType(resources.GetObject("mnuEdit.Image"), System.Drawing.Image)
Me.mnuEdit.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuEdit.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuEdit.Name = "mnuEdit"
Me.mnuEdit.Size = New System.Drawing.Size(60, 50)
Me.mnuEdit.Text = "Edit"
Me.mnuEdit.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
Me.mnuEdit.ToolTipText = "Edit"
'
'ToolStripSeparator3
'
Me.ToolStripSeparator3.ForeColor = System.Drawing.Color.Black
Me.ToolStripSeparator3.Name = "ToolStripSeparator3"
Me.ToolStripSeparator3.Size = New System.Drawing.Size(6, 58)
'
'container
'
Me.container.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.container.Location = New System.Drawing.Point(0, 61)
Me.container.Name = "container"
'
'container.Panel1
'
Me.container.Panel1.Controls.Add(Me.GridControl1)
Me.container.Panel1.Controls.Add(Me.gboCondition)
'
'container.Panel2
'
Me.container.Panel2.Controls.Add(Me.tvwRight)
Me.container.Size = New System.Drawing.Size(1244, 414)
Me.container.SplitterDistance = 940
Me.container.TabIndex = 3
'
'GridControl1
'
Me.GridControl1.ContextMenuStrip = Me.mnuTrainning
Me.GridControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.GridControl1.Location = New System.Drawing.Point(0, 61)
Me.GridControl1.MainView = Me.GridView1
Me.GridControl1.Name = "GridControl1"
Me.GridControl1.Size = New System.Drawing.Size(940, 353)
Me.GridControl1.TabIndex = 21
Me.GridControl1.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
'GridView1
'
Me.GridView1.GridControl = Me.GridControl1
Me.GridView1.Name = "GridView1"
Me.GridView1.OptionsClipboard.CopyColumnHeaders = DevExpress.Utils.DefaultBoolean.[False]
Me.GridView1.OptionsFind.AlwaysVisible = True
Me.GridView1.OptionsSelection.MultiSelect = True
Me.GridView1.OptionsSelection.MultiSelectMode = DevExpress.XtraGrid.Views.Grid.GridMultiSelectMode.CellSelect
Me.GridView1.OptionsView.ColumnAutoWidth = False
Me.GridView1.OptionsView.ColumnHeaderAutoHeight = DevExpress.Utils.DefaultBoolean.[True]
Me.GridView1.OptionsView.ShowFooter = True
Me.GridView1.OptionsView.ShowGroupPanel = False
'
'tvwRight
'
Me.tvwRight.BackColor = System.Drawing.Color.WhiteSmoke
Me.tvwRight.CheckBoxes = True
Me.tvwRight.Dock = System.Windows.Forms.DockStyle.Fill
Me.tvwRight.ImageIndex = 0
Me.tvwRight.ImageList = Me.ImageList1
Me.tvwRight.ItemHeight = 20
Me.tvwRight.Location = New System.Drawing.Point(0, 0)
Me.tvwRight.Name = "tvwRight"
Me.tvwRight.SelectedImageIndex = 0
Me.tvwRight.Size = New System.Drawing.Size(300, 414)
Me.tvwRight.TabIndex = 0
'
'ImageList1
'
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
Me.ImageList1.Images.SetKeyName(0, "Home.png")
Me.ImageList1.Images.SetKeyName(1, "Home.png")
Me.ImageList1.Images.SetKeyName(2, "User group.png")
Me.ImageList1.Images.SetKeyName(3, "Folder.png")
Me.ImageList1.Images.SetKeyName(4, "Forward.png")
'
'DataGridViewAutoFilterTextBoxColumn1
'
Me.DataGridViewAutoFilterTextBoxColumn1.DataPropertyName = "GroupID"
Me.DataGridViewAutoFilterTextBoxColumn1.Frozen = True
Me.DataGridViewAutoFilterTextBoxColumn1.HeaderText = "GroupID"
Me.DataGridViewAutoFilterTextBoxColumn1.Name = "DataGridViewAutoFilterTextBoxColumn1"
Me.DataGridViewAutoFilterTextBoxColumn1.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn1.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn1.Visible = False
Me.DataGridViewAutoFilterTextBoxColumn1.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn2
'
Me.DataGridViewAutoFilterTextBoxColumn2.DataPropertyName = "UserID"
Me.DataGridViewAutoFilterTextBoxColumn2.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn2.Frozen = True
Me.DataGridViewAutoFilterTextBoxColumn2.HeaderText = "User ID"
Me.DataGridViewAutoFilterTextBoxColumn2.Name = "DataGridViewAutoFilterTextBoxColumn2"
Me.DataGridViewAutoFilterTextBoxColumn2.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn2.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn2.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn3
'
Me.DataGridViewAutoFilterTextBoxColumn3.DataPropertyName = "UserName"
Me.DataGridViewAutoFilterTextBoxColumn3.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn3.Frozen = True
Me.DataGridViewAutoFilterTextBoxColumn3.HeaderText = "User name"
Me.DataGridViewAutoFilterTextBoxColumn3.Name = "DataGridViewAutoFilterTextBoxColumn3"
Me.DataGridViewAutoFilterTextBoxColumn3.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn3.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn3.Width = 60
'
'DataGridViewAutoFilterTextBoxColumn4
'
Me.DataGridViewAutoFilterTextBoxColumn4.DataPropertyName = "FullName"
Me.DataGridViewAutoFilterTextBoxColumn4.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn4.Frozen = True
Me.DataGridViewAutoFilterTextBoxColumn4.HeaderText = "Full name"
Me.DataGridViewAutoFilterTextBoxColumn4.Name = "DataGridViewAutoFilterTextBoxColumn4"
Me.DataGridViewAutoFilterTextBoxColumn4.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn4.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn4.Width = 69
'
'DataGridViewAutoFilterTextBoxColumn5
'
Me.DataGridViewAutoFilterTextBoxColumn5.DataPropertyName = "Observation"
Me.DataGridViewAutoFilterTextBoxColumn5.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn5.HeaderText = "Observation"
Me.DataGridViewAutoFilterTextBoxColumn5.Name = "DataGridViewAutoFilterTextBoxColumn5"
Me.DataGridViewAutoFilterTextBoxColumn5.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn5.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn6
'
Me.DataGridViewAutoFilterTextBoxColumn6.DataPropertyName = "GroupName"
Me.DataGridViewAutoFilterTextBoxColumn6.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn6.HeaderText = "GroupName"
Me.DataGridViewAutoFilterTextBoxColumn6.Name = "DataGridViewAutoFilterTextBoxColumn6"
Me.DataGridViewAutoFilterTextBoxColumn6.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn6.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn6.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn7
'
Me.DataGridViewAutoFilterTextBoxColumn7.DataPropertyName = "PR"
Me.DataGridViewAutoFilterTextBoxColumn7.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn7.HeaderText = "PR"
Me.DataGridViewAutoFilterTextBoxColumn7.Name = "DataGridViewAutoFilterTextBoxColumn7"
Me.DataGridViewAutoFilterTextBoxColumn7.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn7.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn7.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn8
'
Me.DataGridViewAutoFilterTextBoxColumn8.DataPropertyName = "Email"
Me.DataGridViewAutoFilterTextBoxColumn8.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn8.HeaderText = "Email"
Me.DataGridViewAutoFilterTextBoxColumn8.Name = "DataGridViewAutoFilterTextBoxColumn8"
Me.DataGridViewAutoFilterTextBoxColumn8.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn8.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn8.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn9
'
Me.DataGridViewAutoFilterTextBoxColumn9.DataPropertyName = "Sex"
Me.DataGridViewAutoFilterTextBoxColumn9.HeaderText = "Sex"
Me.DataGridViewAutoFilterTextBoxColumn9.Name = "DataGridViewAutoFilterTextBoxColumn9"
Me.DataGridViewAutoFilterTextBoxColumn9.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn9.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn9.Visible = False
Me.DataGridViewAutoFilterTextBoxColumn9.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn10
'
Me.DataGridViewAutoFilterTextBoxColumn10.DataPropertyName = "Note"
Me.DataGridViewAutoFilterTextBoxColumn10.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn10.HeaderText = "Note"
Me.DataGridViewAutoFilterTextBoxColumn10.Name = "DataGridViewAutoFilterTextBoxColumn10"
Me.DataGridViewAutoFilterTextBoxColumn10.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn10.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn10.Width = 30
'
'DataGridViewAutoFilterTextBoxColumn11
'
Me.DataGridViewAutoFilterTextBoxColumn11.DataPropertyName = "CreateUser"
Me.DataGridViewAutoFilterTextBoxColumn11.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn11.HeaderText = "Create user"
Me.DataGridViewAutoFilterTextBoxColumn11.Name = "DataGridViewAutoFilterTextBoxColumn11"
Me.DataGridViewAutoFilterTextBoxColumn11.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn11.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn11.Width = 70
'
'DataGridViewAutoFilterTextBoxColumn12
'
Me.DataGridViewAutoFilterTextBoxColumn12.DataPropertyName = "CreateDate"
Me.DataGridViewAutoFilterTextBoxColumn12.FillWeight = 329.9492!
Me.DataGridViewAutoFilterTextBoxColumn12.HeaderText = "Create date"
Me.DataGridViewAutoFilterTextBoxColumn12.Name = "DataGridViewAutoFilterTextBoxColumn12"
Me.DataGridViewAutoFilterTextBoxColumn12.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn12.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn12.Visible = False
Me.DataGridViewAutoFilterTextBoxColumn12.Width = 60
'
'DataGridViewAutoFilterTextBoxColumn13
'
Me.DataGridViewAutoFilterTextBoxColumn13.DataPropertyName = "Sex"
Me.DataGridViewAutoFilterTextBoxColumn13.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn13.HeaderText = "Sex"
Me.DataGridViewAutoFilterTextBoxColumn13.Name = "DataGridViewAutoFilterTextBoxColumn13"
Me.DataGridViewAutoFilterTextBoxColumn13.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn13.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn13.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn14
'
Me.DataGridViewAutoFilterTextBoxColumn14.DataPropertyName = "Note"
Me.DataGridViewAutoFilterTextBoxColumn14.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn14.HeaderText = "Note"
Me.DataGridViewAutoFilterTextBoxColumn14.Name = "DataGridViewAutoFilterTextBoxColumn14"
Me.DataGridViewAutoFilterTextBoxColumn14.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn14.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn14.Width = 69
'
'DataGridViewAutoFilterTextBoxColumn15
'
Me.DataGridViewAutoFilterTextBoxColumn15.DataPropertyName = "CreateUser"
Me.DataGridViewAutoFilterTextBoxColumn15.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn15.HeaderText = "Create user"
Me.DataGridViewAutoFilterTextBoxColumn15.Name = "DataGridViewAutoFilterTextBoxColumn15"
Me.DataGridViewAutoFilterTextBoxColumn15.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn15.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn15.Width = 48
'
'DataGridViewAutoFilterTextBoxColumn16
'
Me.DataGridViewAutoFilterTextBoxColumn16.DataPropertyName = "CreateDate"
Me.DataGridViewAutoFilterTextBoxColumn16.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn16.HeaderText = "Create date"
Me.DataGridViewAutoFilterTextBoxColumn16.Name = "DataGridViewAutoFilterTextBoxColumn16"
Me.DataGridViewAutoFilterTextBoxColumn16.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn16.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn16.Width = 50
'
'DataGridViewAutoFilterTextBoxColumn17
'
Me.DataGridViewAutoFilterTextBoxColumn17.DataPropertyName = "CreateDate"
Me.DataGridViewAutoFilterTextBoxColumn17.FillWeight = 80.83756!
Me.DataGridViewAutoFilterTextBoxColumn17.HeaderText = "Create date"
Me.DataGridViewAutoFilterTextBoxColumn17.Name = "DataGridViewAutoFilterTextBoxColumn17"
Me.DataGridViewAutoFilterTextBoxColumn17.ReadOnly = True
Me.DataGridViewAutoFilterTextBoxColumn17.Resizable = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridViewAutoFilterTextBoxColumn17.Width = 80
'
'DataGridViewTextBoxColumn1
'
Me.DataGridViewTextBoxColumn1.DataPropertyName = "No"
Me.DataGridViewTextBoxColumn1.HeaderText = "No."
Me.DataGridViewTextBoxColumn1.Name = "DataGridViewTextBoxColumn1"
Me.DataGridViewTextBoxColumn1.ReadOnly = True
Me.DataGridViewTextBoxColumn1.Visible = False
Me.DataGridViewTextBoxColumn1.Width = 20
'
'DataGridViewTextBoxColumn2
'
Me.DataGridViewTextBoxColumn2.DataPropertyName = "Password"
Me.DataGridViewTextBoxColumn2.HeaderText = "Password"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
Me.DataGridViewTextBoxColumn2.Visible = False
'
'mnuKillAll
'
Me.mnuKillAll.AutoSize = False
Me.mnuKillAll.ForeColor = System.Drawing.Color.Black
Me.mnuKillAll.Image = CType(resources.GetObject("mnuKillAll.Image"), System.Drawing.Image)
Me.mnuKillAll.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None
Me.mnuKillAll.ImageTransparentColor = System.Drawing.Color.Magenta
Me.mnuKillAll.Name = "mnuKillAll"
Me.mnuKillAll.Size = New System.Drawing.Size(60, 50)
Me.mnuKillAll.Text = "KillAll"
Me.mnuKillAll.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
'
'FrmUser
'
Me.Appearance.Options.UseFont = True
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1244, 476)
Me.Controls.Add(Me.container)
Me.Controls.Add(Me.tlsMenu)
Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.KeyPreview = True
Me.Name = "FrmUser"
Me.ShowInTaskbar = False
Me.Tag = "0006"
Me.Text = "User Management"
Me.gboCondition.ResumeLayout(False)
Me.gboCondition.PerformLayout()
Me.mnuTrainning.ResumeLayout(False)
Me.tlsMenu.ResumeLayout(False)
Me.tlsMenu.PerformLayout()
Me.container.Panel1.ResumeLayout(False)
Me.container.Panel2.ResumeLayout(False)
CType(Me.container, System.ComponentModel.ISupportInitialize).EndInit()
Me.container.ResumeLayout(False)
CType(Me.GridControl1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
Friend WithEvents gboCondition As System.Windows.Forms.GroupBox
Friend WithEvents tlsMenu As System.Windows.Forms.ToolStrip
Friend WithEvents mnuNew As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuSave As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuShowAll As System.Windows.Forms.ToolStripButton
Friend WithEvents mnuDelete As System.Windows.Forms.ToolStripButton
Friend WithEvents txtFullName As System.Windows.Forms.TextBox
Friend WithEvents lblFullName As System.Windows.Forms.Label
Friend WithEvents txtUserName As System.Windows.Forms.TextBox
Friend WithEvents lblUserName As System.Windows.Forms.Label
Friend WithEvents txtUserID As System.Windows.Forms.TextBox
Friend WithEvents lblUserID As System.Windows.Forms.Label
Friend WithEvents txtPassword As System.Windows.Forms.TextBox
Friend WithEvents container As System.Windows.Forms.SplitContainer
Friend WithEvents tvwRight As System.Windows.Forms.TreeView
Friend WithEvents mnuExport As System.Windows.Forms.ToolStripButton
Friend WithEvents DataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn1 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn2 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn3 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn4 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn5 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn6 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn7 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn8 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn9 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn10 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn11 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn12 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents ToolStripSeparator1 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mnuExportInfo As System.Windows.Forms.ToolStripButton
Friend WithEvents DataGridViewAutoFilterTextBoxColumn13 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn14 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn15 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents DataGridViewAutoFilterTextBoxColumn16 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents mnuTrainning As System.Windows.Forms.ContextMenuStrip
Friend WithEvents mnuGroupOfSiteStock As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuGroupOfWT As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents GroupOfTrainingToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents mnuSPC As System.Windows.Forms.ToolStripMenuItem
Friend WithEvents ckoPass As System.Windows.Forms.CheckBox
Friend WithEvents ToolStripSeparator2 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mnuCopyRight As System.Windows.Forms.ToolStripButton
Friend WithEvents ToolStripSeparator3 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mnuEdit As System.Windows.Forms.ToolStripButton
Friend WithEvents txtSection As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents txtGlobalPass As TextBox
Friend WithEvents Label3 As Label
Friend WithEvents txtGlobalID As TextBox
Friend WithEvents Label2 As Label
Friend WithEvents txtPCNo As TextBox
Friend WithEvents Label4 As Label
Friend WithEvents txtPhone As TextBox
Friend WithEvents Label5 As Label
Friend WithEvents DataGridViewAutoFilterTextBoxColumn17 As DataGridViewAutoFilter.DataGridViewAutoFilterTextBoxColumn
Friend WithEvents mnuAddRight As ToolStripButton
Friend WithEvents GridControl1 As DevExpress.XtraGrid.GridControl
Friend WithEvents GridView1 As DevExpress.XtraGrid.Views.Grid.GridView
Friend WithEvents mnuKillAll As ToolStripButton
End Class
|
Imports System
Imports System.Data.Entity.Migrations
Imports Microsoft.VisualBasic
Namespace Migrations
Public Partial Class ModifDu16042019AjoutTableAgiosClient
Inherits DbMigration
Public Overrides Sub Up()
CreateTable(
"dbo.AgiosClient",
Function(c) New With
{
.Id = c.Long(nullable := False, identity := True),
.ClientId = c.Long(nullable := False),
.HistoriqueCalculAjoutId = c.Long(nullable := False),
.TotalCollect = c.Double(nullable := False),
.Frais = c.Double(nullable := False),
.Mois = c.Long(nullable := False),
.Annee = c.Long(nullable := False),
.Libelle = c.String(),
.Etat = c.Boolean(nullable := False),
.DateCreation = c.DateTime(nullable := False)
}) _
.PrimaryKey(Function(t) t.Id) _
.ForeignKey("dbo.HistoriqueCalculAjout", Function(t) t.HistoriqueCalculAjoutId) _
.ForeignKey("dbo.Client", Function(t) t.ClientId) _
.Index(Function(t) t.ClientId) _
.Index(Function(t) t.HistoriqueCalculAjoutId)
End Sub
Public Overrides Sub Down()
DropForeignKey("dbo.AgiosClient", "ClientId", "dbo.Client")
DropForeignKey("dbo.AgiosClient", "HistoriqueCalculAjoutId", "dbo.HistoriqueCalculAjout")
DropIndex("dbo.AgiosClient", New String() { "HistoriqueCalculAjoutId" })
DropIndex("dbo.AgiosClient", New String() { "ClientId" })
DropTable("dbo.AgiosClient")
End Sub
End Class
End Namespace
|
Module Module_Pci8158TrMoveFor2Axis
Const card8158 As Short = 0
' winmm.dll is better than dateTime in the donet framwork
Private Declare Function timeGetTime Lib "winmm.dll" Alias "timeGetTime" () As Long
' QueryPerformance as the more accurate timer
Declare Function QueryPerformanceCounter Lib "Kernel32" (ByRef x As Long) As Short
Declare Function QueryPerformanceFrequency Lib "Kernel32" (ByRef x As Long) As Short
Public Enum M_MODE
VELOCITY
POSITION
End Enum
''' <summary>
''' initial 8158 card
''' </summary>
Sub initial_PCI8158()
Dim card8158 As Short = 0
Dim result As Short = B_8158_initial(card8158, 0)
If result <> 0 Then
MsgBox("initial 8158 card failed")
Exit Sub
End If
'set axis num 0
B_8158_set_pls_outmode(0, 4)
B_8158_set_move_ratio(0, 1)
B_8158_set_servo(0, 1)
'configure the input mode of external feedback pulse
B_8158_set_pls_iptmode(0, 2, 0)
'set counter input source
B_8158_set_feedback_src(0, 0)
'set axis num 1
'set palse out mode
B_8158_set_pls_outmode(1, 0)
B_8158_set_alm(1, 1, 0)
B_8158_set_inp(1, 0, 1)
B_8158_set_move_ratio(1, 0)
End Sub
''' <summary>
''' only for e-teknet 2D platform motion control
''' </summary>
''' <remarks></remarks>
'''
Sub Start_2Axis_tr_move(ByVal axis As Short, ByVal dist() As Double, ByVal strVal() As Double, ByVal maxVal() As Double, ByVal Tacc() As Double, ByVal Tdec() As Double)
'axis=0 , only axis 0 is selected;
'axis=1 , only axis 1 is selected;
'axis=2 , both axis selected.
Dim axisArray(1) As Short
axisArray(0) = 0
axisArray(1) = 1
'mm/s to palse
dist(0) = dist(0) * 1000
strVal(0) = strVal(0) * 1000
maxVal(0) = maxVal(0) * 1000
'deg/s to palse
dist(1) = dist(1) * 18000 / 360
strVal(1) = strVal(1) * 18000 / 360
maxVal(1) = maxVal(1) * 18000 / 360
If axis = 0 Then
' only linear motion
B_8158_start_tr_move(0, dist(0), strVal(0), maxVal(0), Tacc(0), Tdec(0))
ElseIf axis = 1 Then
' only rotary motion
B_8158_start_tr_move(1, dist(1), strVal(1), maxVal(1), Tacc(1), Tdec(1))
Else
' two axis motion start at the sime time
B_8158_set_tr_move_all(2, axisArray, dist, strVal, maxVal, Tacc, Tdec)
B_8158_start_move_all(0)
End If
End Sub
Sub Start_1Axis_tv_move(ByVal axisNo As Short, ByVal strVel As Double, ByVal maxVel As Double, ByVal Tacc As Double, ByVal TUnif As Double, ByVal Tdec As Double)
Dim slpTime As Double = Tacc * 1000 + TUnif * 1000
Select Case axisNo
Case 1
'deg/s to palse
strVel = strVel * 18000 / 360
maxVel = maxVel * 18000 / 360
Case Else
'mm/s to palse
strVel = strVel * 1000
maxVel = maxVel * 1000
End Select
B_8158_tv_move(axisNo, strVel, maxVel, Tacc)
B_8158_set_motion_int_factor(axisNo, 0) 'waitting for inturrupt
B_8158_int_control(card8158, 0)
'sleep unit as millisecond
System.Threading.Thread.Sleep(slpTime)
'stop axis with decelerate instead of immediately
'WARNING: when Tdec is 1 seconde, the decelerate time actully is 0.5 seconde, half if the special value ,
'I have not get this reason, if necssary ,connect supplier to get the answer .
B_8158_sd_stop(axisNo, Tdec)
End Sub
Sub Start_1Axis_tr_move(ByVal axisNo As Short, ByVal dist As Double, ByVal strVel As Double, ByVal maxVel As Double, ByVal Tacc As Double, ByVal Tdec As Double)
Select Case axisNo
Case 1
'deg/s to palse
dist = dist * 18000 / 360
strVel = strVel * 18000 / 360
maxVel = maxVel * 18000 / 360
Case Else
'mm/s to palse
dist = dist * 1000
strVel = strVel * 1000
maxVel = maxVel * 1000
End Select
B_8158_start_tr_move(axisNo, dist, strVel, maxVel, Tacc, Tdec)
End Sub
Function isStopMotion() As Boolean
Dim bolStop As Boolean
bolStop = True
For i = 0 To 1
If B_8158_motion_done(i) <> 0 Then
bolStop = False
Exit For
End If
Next
Return bolStop
End Function
Function isStopAxe0() As Boolean
'Linear aixs
Dim bolStop As Boolean
bolStop = True
Dim i = 0
If B_8158_motion_done(i) <> 0 Then
bolStop = False
End If
Return bolStop
End Function
Function isStopAxe1() As Boolean
'Rotation aixs
Dim bolStop As Boolean
bolStop = True
Dim i = 1
If B_8158_motion_done(i) <> 0 Then
bolStop = False
End If
Return bolStop
End Function
Function CurLPos() As Double
Dim pos As Double
B_8158_get_position(0, pos)
Return Pluse2MM(pos)
End Function
Function CurRPos() As Double
Dim pos As Double
B_8158_get_position(1, pos)
Return Pluse2deg(pos)
End Function
Sub ResetLPos()
B_8158_set_position(0, 0)
End Sub
Sub ResetRPos()
B_8158_set_position(1, 0)
End Sub
Function CurSpeed() As Double()
Dim speed(1) As Double
B_8158_get_current_speed(0, speed(0))
B_8158_get_current_speed(1, speed(1))
speed(0) = speed(0) / 1000
speed(1) = speed(1) / 18000 * 360
Return speed
End Function
Function Pluse2MM(ByVal pluse As Double) As Double
Dim mm As Double = pluse / 1000
Return mm
End Function
Function MM2Pluse(ByVal mm As Double) As Double
Dim pluse As Double = mm * 1000
Return pluse
End Function
Function Pluse2deg(ByVal pluse As Double) As Double
Dim deg As Double = pluse / 18000 * 360
Return deg
End Function
Function FeedbackSpeed(ByRef preTime As Long, ByRef prePos As Double) As Double
Dim nowTime As Long = timeGetTime
Dim curPos As Double
'get the value of the feedback position counter
B_8158_get_position(0, curPos)
Dim speedPluse As Double = (curPos - prePos) / (nowTime - preTime) * 1000
Dim speedFeedback As Double = Pluse2MM(speedPluse)
preTime = nowTime
prePos = curPos
Return speedFeedback
End Function
Function FeedbackSpeed2(ByRef preCount As Long, ByRef prePos As Long, ByVal freq As Long) As Double
Dim nowCount As Long
Dim curPos As Double
QueryPerformanceCounter(nowCount)
B_8158_get_position(0, curPos)
Dim speedPluse As Double = (curPos - prePos) / ((nowCount - preCount) / freq)
Dim speedFeedback As Double = Pluse2MM(speedPluse)
preCount = nowCount
prePos = curPos
Return speedFeedback
End Function
End Module
|
Imports System.Data.Entity
Imports System.Net
Imports PagedList
Imports Microsoft.AspNet.Identity
Imports System.Data.Entity.Validation
Namespace TeamCollect
Public Class GrilleController
Inherits BaseController
Private db As New ApplicationDbContext
Private Function getCurrentUser() As ApplicationUser
Dim id = User.Identity.GetUserId
Dim aspuser = db.Users.Find(id)
Return aspuser
End Function
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Index(sortOrder As String, currentFilter As String, searchString As String, page As Integer?) As ActionResult
'Dim exercices = db.Exercices.Include(Function(e) e.User)
'Return View(exercices.ToList())
ViewBag.CurrentSort = sortOrder
If Not String.IsNullOrEmpty(searchString) Then
page = 1
Else
searchString = currentFilter
End If
ViewBag.CurrentFilter = searchString
Dim entities = From e In db.Grilles.OfType(Of Grille)().ToList
If Not String.IsNullOrEmpty(searchString) Then
entities = entities.Where(Function(e) e.Libelle.ToUpper.Contains(searchString.ToUpper))
End If
ViewBag.EnregCount = entities.Count
Dim pageSize As Integer = ConfigurationManager.AppSettings("PageSize")
Dim pageNumber As Integer = If(page, 1)
Return View(entities.ToPagedList(pageNumber, pageSize))
End Function
' GET: /Societe/Details/5
Function Details(ByVal id As Long?) As ActionResult
If IsNothing(id) Then
Return New HttpStatusCodeResult(HttpStatusCode.BadRequest)
End If
Dim societe As Societe = db.Societes.Find(id)
If IsNothing(societe) Then
Return HttpNotFound()
End If
Return View(societe)
End Function
' GET: /Societe/Create
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Create() As ActionResult
Dim gVM As New GrilleViewModel
Return View(gVM)
End Function
' POST: /Societe/Create
'Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour
'plus de détails, voir http://go.microsoft.com/fwlink/?LinkId=317598.
<HttpPost()>
<ValidateAntiForgeryToken()>
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Create(ByVal gVM As GrilleViewModel) As ActionResult
If ModelState.IsValid Then
Dim scte = From e In db.Societes.OfType(Of Societe).ToList
gVM.Etat = False
gVM.SocieteId = scte.First.Id
gVM.DateCreation = Now.Date
Dim grille = gVM.getEntity()
grille.UserId = getCurrentUser.Id
db.Grilles.Add(grille)
Try
db.SaveChanges()
Return RedirectToAction("Index")
Catch ex As DbEntityValidationException
Util.GetError(ex, ModelState)
Catch ex As Exception
Util.GetError(ex, ModelState)
End Try
End If
Return View(gVM)
End Function
' GET: /Societe/Edit/5
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Edit(ByVal id As Long?) As ActionResult
If IsNothing(id) Then
Return New HttpStatusCodeResult(HttpStatusCode.BadRequest)
End If
Dim grille As Grille = db.Grilles.Find(id)
If IsNothing(grille) Then
Return HttpNotFound()
End If
Dim gVM = New GrilleViewModel(grille)
Return View(gVM)
End Function
' POST: /Societe/Edit/5
'Afin de déjouer les attaques par sur-validation, activez les propriétés spécifiques que vous voulez lier. Pour
'plus de détails, voir http://go.microsoft.com/fwlink/?LinkId=317598.
<HttpPost()>
<ValidateAntiForgeryToken()>
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Edit(ByVal gVM As GrilleViewModel) As ActionResult
If ModelState.IsValid Then
Dim entity = gVM.getEntity()
entity.UserId = getCurrentUser.Id
db.Entry(entity).State = EntityState.Modified
Try
db.SaveChanges()
Return RedirectToAction("Index")
Catch ex As DbEntityValidationException
Util.GetError(ex, ModelState)
Catch ex As Exception
Util.GetError(ex, ModelState)
End Try
End If
Return View(gVM)
End Function
' GET: /Societe/Delete/5
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function Delete(ByVal id As Long?) As ActionResult
If IsNothing(id) Then
Return New HttpStatusCodeResult(HttpStatusCode.BadRequest)
End If
Dim grille As Grille = db.Grilles.Find(id)
If IsNothing(grille) Then
Return HttpNotFound()
End If
Return View(grille)
End Function
' POST: /Societe/Delete/5
<HttpPost()>
<ActionName("Delete")>
<ValidateAntiForgeryToken()>
<LocalizedAuthorize(Roles:="SA,ADMINISTRATEUR")>
Function DeleteConfirmed(ByVal id As Long) As ActionResult
Dim grille As Grille = db.Grilles.Find(id)
db.Grilles.Remove(grille)
Try
db.SaveChanges()
Return RedirectToAction("Index")
Catch ex As DbEntityValidationException
Util.GetError(ex, ModelState)
Catch ex As Exception
Util.GetError(ex, ModelState)
End Try
Return View()
End Function
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If (disposing) Then
db.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
End Class
End Namespace
|
Public Interface IParkingLot
Property PrecioPorHora As Integer
Property CapacidadTotal As Integer
ReadOnly Property CantidadEstacionados As Integer
ReadOnly Property EspaciosDisponibles As Integer
ReadOnly Property TotalFacturado As Double
Sub IngresoDetectado(patente As String)
Sub EgresoDetectado(patente As String)
Function VehiculosEstacionados() As IList(Of String)
End Interface
|
Namespace MB.TheBeerHouse.UI
Partial Class Template
Inherits System.Web.UI.MasterPage
Private _enablePersonalization As Boolean = False
Public Property EnablePersonalization() As Boolean
Get
Return _enablePersonalization
End Get
Set(ByVal value As Boolean)
_enablePersonalization = value
PersonalizationManager1.Visible = ( _
Me.Page.User.Identity.IsAuthenticated And value)
End Set
End Property
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.Page.User.Identity.IsAuthenticated Then _
PersonalizationManager1.Visible = False
End Sub
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: Account
'* /Description: Account Object - account information class
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Namespace Framework.Modules
<Serializable>
Public Class Account
<Flags>
Public Enum ArcEmuFlag
EXPANSION_CLASSIC = 0
EXPANSION_TBC = 8
EXPANSION_WOTLK = 16
EXPANSION_WOTLK_TBC = 24
EXPANSION_CATA = 32
End Enum
Public Id As Integer
Public Name As String
Public SetIndex As Integer
Public Transcharlist As ArrayList
Public ArcEmuPass As String
Public PassHash As String
Public ArcEmuFlags As ArcEmuFlag
Public Locale As Integer
Public ArcEmuGmLevel As String
Public SessionKey As String
Public LastLogin As DateTime
Public LastIp As String
Public Locked As Integer
Public Email As String
Public JoinDate As DateTime
Public Expansion As Integer
Public V As String
Public S As String
Public Core As Core
Public SourceExpansion As Integer
'Account Access
Public GmLevel As Integer
Public RealmId As Integer
'Misc
Public Characters As List(Of Character)
Public IsArmory As Boolean = False
End Class
End Namespace |
Imports Neurotec.Licensing
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Friend Class Program
Private Shared Function Usage() As Integer
Console.WriteLine("usage:")
Console.WriteLine(vbTab & "{0} [serial file name] [id file name]", TutorialUtils.GetAssemblyName())
Console.WriteLine()
Return 1
End Function
Shared Function Main(ByVal args() As String) As Integer
TutorialUtils.PrintTutorialHeader(args)
If args.Length <> 2 Then
Return Usage()
End If
Try
' Load serial file (generated using LicenseManager API or provided either by Neurotechnology or its distributor)
Dim serial As String = File.ReadAllText(args(0))
' Either point to correct place for id_gen.exe, or pass NULL or use method without idGenPath parameter in order to search id_gen.exe in current folder
Dim id As String = NLicense.GenerateId(serial)
' Write generated id to file
File.WriteAllText(args(1), id)
Console.WriteLine("id saved to file {0}, it can now be activated (using LicenseActivation tutorial, web page and etc.)", args(1))
Return 0
Catch ex As Exception
Return TutorialUtils.PrintException(ex)
End Try
End Function
End Class
|
Imports AMC.DNN.Modules.CertRecert.Business.Controller
Imports System.Web.UI.WebControls
Imports System.IO
Imports System.Text.RegularExpressions
Imports TIMSS.API.User.CertificationInfo
Imports TIMSS.API.User.UserDefinedInfo
Namespace Helpers
Public Class CommonHelper
#Region "Singleton"
''' <summary>
''' Gets the instance.
''' </summary>
'''
Public Shared ReadOnly Instance As New CommonHelper
Private Sub New()
End Sub
#End Region
#Region "Private Member"
#End Region
#Region "Public Methods"
''' <summary>
''' Chops the unused decimal.
''' </summary>
''' <param name="input">The input.</param>
''' <returns></returns>
Public Shared Function ChopUnusedDecimal(ByVal input As String) As String
Dim result = "0"
Dim resultDecimal As Decimal = 0
If Not String.IsNullOrEmpty(input) Then
If Decimal.TryParse(input, resultDecimal) Then
resultDecimal = Math.Round(resultDecimal, 2, MidpointRounding.AwayFromZero)
Dim regex = New Regex("(\.[1-9]*)0+$")
result = regex.Replace(resultDecimal.ToString(), "$1") '"(\.[1-9]*)0+$" => "(\.[1-9]*)"
regex = New Regex("\.$")
result = regex.Replace(result, "")
End If
End If
Return result
End Function
''' <summary>
''' Writes the XML.
''' </summary>
''' <param name="filepath">The filepath.</param>
''' <param name="val">The val.</param>
Public Sub WriteXML(ByVal filepath As String, ByVal val As String)
Dim file As FileStream = Nothing
Dim writer As StreamWriter = Nothing
Try
file = New FileStream(filepath, FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)
file.SetLength(0)
file.Flush()
writer = New StreamWriter(file)
writer.Write(val)
writer.Flush()
Catch ex As Exception
Throw
Finally
If writer IsNot Nothing Then
writer.Close()
End If
If file IsNot Nothing Then
file.Close()
End If
End Try
'File.WriteAllText(filepath, val)
End Sub
Public Shared Sub BindCEType(ByVal ddlName As DropDownList, ByVal programType As String, ByVal amcController As AmcCertRecertController)
Dim ceTypeList = amcController.GetCETypesByProgramType(programType)
ddlName.DataTextField = "Description"
ddlName.DataValueField = "Code"
ddlName.DataSource = ceTypeList
ddlName.DataBind()
End Sub
''' <summary>
''' Get CEWeight of CETypeCode when selected value on dropdown CEType
''' </summary>
''' <param name="cETypeCode"> CETypeCode of Item is selected on dropdown </param>
Public Shared Function GetCEWeight(ByVal cETypeCode As String,
ByVal cEWeightList As UserDefinedCertificationCEWeights,
ByVal isHaveCEType As Boolean, ByVal defaultCEWeight As String) As String
Dim weight As String = "1"
If isHaveCEType = True Then '' have CEType => get weight
If cEWeightList IsNot Nothing Then
If cEWeightList.Count > 0 Then
For Each ceWeightObject As UserDefinedCertificationCEWeight In cEWeightList
If ceWeightObject.CEType.Code = cETypeCode Then
weight = ceWeightObject.Weight.ToString()
Exit For
End If
Next
End If
End If
Else
weight = defaultCEWeight
End If
'' if don't have CEType , set weight = 1 (default value)
Return weight
End Function
Public Shared Sub BindIssuingBodyType(ByVal ddlIssuingBodyType As DropDownList,
ByVal documentationTypeString As String)
Dim customerExternalDocumentation =
(New UserDefinedCustomerExternalDocumentations()).CreateNew()
customerExternalDocumentation.DocumentationTypeString = documentationTypeString
customerExternalDocumentation.IssuingBody.FillList()
ddlIssuingBodyType.DataTextField = "Description"
ddlIssuingBodyType.DataValueField = "Code"
ddlIssuingBodyType.DataSource = customerExternalDocumentation.IssuingBody.List
ddlIssuingBodyType.DataBind()
End Sub
Public Shared Sub BindPrefContactMethod(ByVal ddlName As DropDownList)
Dim userDefinedCustomerExternalContactList As UserDefinedCustomerExternalContacts =
New UserDefinedCustomerExternalContacts()
Dim userDefinedCustomerExternalContact As IUserDefinedCustomerExternalContact
userDefinedCustomerExternalContact = userDefinedCustomerExternalContactList.CreateNew()
ddlName.DataTextField = "Description"
ddlName.DataValueField = "Code"
ddlName.DataSource = userDefinedCustomerExternalContact.PrefContactMethod.List
ddlName.DataBind()
End Sub
Public Shared Sub BindContactClassType(ByVal contactClassControl As ListControl)
Dim userDefinedCustomerExternalContactList As UserDefinedCustomerExternalContacts =
New UserDefinedCustomerExternalContacts()
Dim userDefinedCustomerExternalContact As IUserDefinedCustomerExternalContact
userDefinedCustomerExternalContact = userDefinedCustomerExternalContactList.CreateNew()
contactClassControl.DataTextField = "Description"
contactClassControl.DataValueField = "Code"
contactClassControl.DataSource = userDefinedCustomerExternalContact.ContactClassType.List
contactClassControl.DataBind()
End Sub
Public Shared Sub BindCertificationType(ByVal certificationTypeCtrl As ListControl)
Dim customerCertification =
(New CertificationCustomerCertifications).CreateNew()
certificationTypeCtrl.DataTextField = "Description"
certificationTypeCtrl.DataValueField = "Code"
certificationTypeCtrl.DataSource = customerCertification.CertificationTypeCode.List
certificationTypeCtrl.DataBind()
End Sub
Public Shared Function CheckIsNumber(ByVal strInput As String) As Boolean
Dim Num As Double
Dim isNum As Boolean = Double.TryParse(strInput, Num)
If isNum Then
Return True
End If
Return False
End Function
Public Shared Function CalculatorTotalCE(ByVal organizationId As String, ByVal organizationUnitId As String,
ByVal masterCustomerId As String, ByVal subCustomerId As Integer,
ByVal programTypeCEActivity As String, ByVal certificationId As Integer,
ByVal factorIndex As String) As Decimal
Dim amcCertRecertController As AmcCertRecertController = New AmcCertRecertController(organizationId,
organizationUnitId,
certificationId, String.Empty, masterCustomerId, subCustomerId)
Dim total As Decimal = 0
If CheckIsNumber(factorIndex) Then
total =
amcCertRecertController.GetCETotal(masterCustomerId, subCustomerId, programTypeCEActivity,
certificationId) * Decimal.Parse(factorIndex)
total = Math.Round(total, 2, MidpointRounding.AwayFromZero)
End If
Return total
End Function
Public Shared Function CalculatorCEItem(ByVal CEHours As String, ByVal factorIndex As String) As Decimal
If CheckIsNumber(CEHours) AndAlso CheckIsNumber(factorIndex) Then
Return Math.Round((Decimal.Parse(CEHours) * Decimal.Parse(factorIndex)), 2, MidpointRounding.AwayFromZero)
End If
Return 0
End Function
#End Region
End Class
End Namespace |
Public Class clsBeTrans_re_det_parametros
Implements ICloneable
Private mIdParametroDet As Integer = 0
Private mIdRecepcionDet As Integer = 0
Private mIdParametro As Integer = 0
Private mValor_texto As String = ""
Private mValor_numerico As Double = 0.0
Private mValor_fecha As Date = Date.Now
Private mValor_logico As Boolean = False
Private mUser_agr As String = ""
Private mFec_agr As Date = Date.Now
Public Property IdParametroDet() As Integer
Get
Return mIdParametroDet
End Get
Set(ByVal Value As Integer)
mIdParametroDet = Value
End Set
End Property
Public Property IdRecepcionDet() As Integer
Get
Return mIdRecepcionDet
End Get
Set(ByVal Value As Integer)
mIdRecepcionDet = Value
End Set
End Property
Public Property IdParametro() As Integer
Get
Return mIdParametro
End Get
Set(ByVal Value As Integer)
mIdParametro = Value
End Set
End Property
Public Property Valor_texto() As String
Get
Return mValor_texto
End Get
Set(ByVal Value As String)
mValor_texto = Value
End Set
End Property
Public Property Valor_numerico() As Double
Get
Return mValor_numerico
End Get
Set(ByVal Value As Double)
mValor_numerico = Value
End Set
End Property
Public Property Valor_fecha() As Date
Get
Return mValor_fecha
End Get
Set(ByVal Value As Date)
mValor_fecha = Value
End Set
End Property
Public Property Valor_logico() As Boolean
Get
Return mValor_logico
End Get
Set(ByVal Value As Boolean)
mValor_logico = Value
End Set
End Property
Public Property User_agr() As String
Get
Return mUser_agr
End Get
Set(ByVal Value As String)
mUser_agr = Value
End Set
End Property
Public Property Fec_agr() As Date
Get
Return mFec_agr
End Get
Set(ByVal Value As Date)
mFec_agr = Value
End Set
End Property
Sub New()
End Sub
Sub New(ByRef IdParametroDet As Integer, ByVal IdRecepcionDet As Integer, ByVal IdParametro As Integer, ByVal valor_texto As String, ByVal valor_numerico As Double, ByVal valor_fecha As Date, ByVal valor_logico As Boolean, ByVal user_agr As String, ByVal fec_agr As Date)
mIdParametroDet = IdParametroDet
mIdRecepcionDet = IdRecepcionDet
mIdParametro = IdParametro
mValor_texto = Valor_texto
mValor_numerico = Valor_numerico
mValor_fecha = Valor_fecha
mValor_logico = Valor_logico
mUser_agr = User_agr
mFec_agr = Fec_agr
End Sub
Public Function Clone() As Object Implements System.ICloneable.Clone
Return MyBase.MemberwiseClone()
End Function
End Class
|
'Jemika Smith
'RCET0265
'Spring2020
'Math Contest
'https://github.com/smitjemi/JKS-VS-S20
Public Class MathContestForm
Dim userMessage As String
Dim randomNumber As Integer
Dim studentAnswer As Integer
Dim correctAnswer As Integer
Dim firstNumber As Integer
Dim secondNumber As Integer
Dim numbersCorrect As Integer
Dim numberOfProblems As Integer
Dim ageNumber As Integer
Dim gradeNumber As Integer
Dim gradeValidated As Boolean = False
Private Sub StudentInfoGroupBox_Validate(sender As Object, e As EventArgs) Handles StudentInfoGroupBox.Validated, GradeTextBox.TextChanged, AgeTextBox.Validated
'Checks to see if student information is correct/eligable.
Try
ageNumber = CInt(AgeTextBox.Text)
If ageNumber < 7 Or ageNumber > 11 Then
MsgBox("Student is not eligble to compete.")
End If
Catch ex As Exception
MsgBox("Please enter a valid age.")
AgeTextBox.Text = ""
End Try
If GradeTextBox.Text <> "" Then
Try
gradeNumber = CInt(GradeTextBox.Text)
If gradeNumber < 1 Or gradeNumber > 4 Then
MsgBox("Student is not eligble to compete.")
Else
gradeValidated = True
End If
Catch ex As Exception
MsgBox("Please enter a valid grade.")
GradeTextBox.Text = ""
End Try
End If
End Sub
Private Sub MathContestForm_Load(sender As Object, e As EventArgs) Handles Me.Load
'Random Number Generator
randomNumber = CInt(Int((20 * Rnd()) + 0))
firstNumberTextBox.Text = Str(Int((20 * Rnd()) + 0))
secondNumberTextBox.Text = Str(Int((20 * Rnd()) + 0))
firstNumberTextBox.Enabled = False
secondNumberTextBox.Enabled = False
SummaryButton.Enabled = False
AddRadioButton.Checked = True
End Sub
Private Sub SubmitButton_Click(sender As Object, e As EventArgs) Handles SubmitButton.Click
'This sub is validating the math answers.
'This sub is also calculating correct answers.
'This sub is saving and resetting for next set of questions.
If gradeValidated = True Then
firstNumber = CInt(firstNumberTextBox.Text)
secondNumber = CInt(secondNumberTextBox.Text)
studentAnswer = studentAnswerTextBox.Text
If AddRadioButton.Checked = True Then
correctAnswer = firstNumber + secondNumber
ElseIf SubtractRadioButton.Checked = True Then
correctAnswer = firstNumber - secondNumber
ElseIf DivideRadioButton.Checked = True Then
correctAnswer = firstNumber / secondNumber
ElseIf MultiplyRadioButton.Checked = True Then
correctAnswer = firstNumber * secondNumber
End If
If studentAnswer = correctAnswer Then
userMessage = "Good job, that is correct!"
numbersCorrect += 1
End If
If studentAnswer <> correctAnswer Then
userMessage = "Sorry, that is not correct. The correct answer was " & correctAnswer & "."
End If
MsgBox(userMessage)
SummaryButton.Enabled = True
numberOfProblems += 1
randomNumber = CInt(Int((20 * Rnd()) + 0))
firstNumberTextBox.Text = Str(Int((20 * Rnd()) + 0))
secondNumberTextBox.Text = Str(Int((20 * Rnd()) + 0))
studentAnswerTextBox.Text = ""
Else
MsgBox("Please enter a grade or correct grade.")
End If
End Sub
Private Sub SummaryButton_Click(sender As Object, e As EventArgs) Handles SummaryButton.Click
'Displays summary
MsgBox("You got " & numbersCorrect & " answers correct out of " & numberOfProblems & " problems.")
End Sub
Private Sub ClearButton_Click(sender As Object, e As EventArgs) Handles ClearButton.Click
'Dim ResetAllControls
NameTextBox.Text = ""
GradeTextBox.Text = ""
AgeTextBox.Text = ""
studentAnswerTextBox.Text = ""
AddRadioButton.Enabled = True
numbersCorrect = 0
numberOfProblems = 0
End Sub
Private Sub ExitButton_Click(sender As Object, e As EventArgs) Handles ExitButton.Click
'Ends Program
Me.Close()
End Sub
End Class
|
Imports System.IO
Imports Snarl
Module mdl_Globals
' Locale Settings
Public strLocaleDecimal As String = Mid(CStr(11 / 10), 2, 1)
Public strLocaleComma As String = Chr(90 - Asc(strLocaleDecimal))
' OS Information
Public str_OSFullName As String = My.Computer.Info.OSFullName
Public str_OSVersion As String = My.Computer.Info.OSVersion
Public str_OSArchitecture As String = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE")
' Application Information
Public arr_RequiredComponents() As String = {"ffmpeg.exe", "mediainfo.dll", "AtomicParsley.Exe", "MP4Box.Exe", "JS32.DLL", "ZLib1.DLL"}
Public str_AppFolder As String = My.Application.Info.DirectoryPath
Public str_LogFolder As String = Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "EncodeHD Log Files")
Public str_LogFile As String = Path.Combine(str_LogFolder, My.Resources.App_Title & "_" & Date.Today.Year & Right("0" & Date.Today.Month, 2) & Right("0" & Date.Today.Day, 2) & ".Log")
Public bln_SnarlInstalledAndWorking As Boolean = False
Public str_SnarlIconPath As String = Path.Combine(str_AppFolder, My.Resources.App_Title & ".ICO")
Public fvi_AppVersion As FileVersionInfo = FileVersionInfo.GetVersionInfo(Application.ExecutablePath)
Public bln_AppStartup As Boolean = False
' Supported Formats List
Public arrSupportedMediaFormats() As String = {".ASF", ".AVI", ".DIVX", ".DVR-MS", ".FLV", ".M2V", ".M4V", ".MKV", ".MOV", ".MP4", ".MPG", ".MPEG", ".MTS", ".M2T", ".M2TS", ".OGM", ".OGG", ".RM", ".RMVB", ".TS", ".VOB", ".WMV", ".XVID"}
' Object Setup
Public obj_LogFile As System.IO.TextWriter
' Get Settings from .Exe.Settings file
Public bln_SettingsDebugMode As Boolean = My.Settings.SettingsDebugMode
Public bln_SettingsUIH264EncodingChecked As Boolean = My.Settings.SettingsUIH264EncodingChecked
Public bln_SettingsUIOutputForTVChecked As Boolean = My.Settings.SettingsUIOutputForTVChecked
Public bln_SettingsUIAC3PassthroughChecked As Boolean = My.Settings.SettingsUIAC3PassthroughChecked
Public int_SettingsUIConversionDevice As Integer = My.Settings.SettingsUIConversionDevice
Public str_SettingsUIOutputFolder As String = My.Settings.SettingsUIOutputFolder
Public bln_SettingsUIAutoSplitChecked As Boolean = My.Settings.SettingsUIAutoSplitChecked
Public bln_SettingsUIAdvancedFFmpegFlagsChecked As Boolean = My.Settings.SettingsUIAdvancedFFmpegFlagsChecked
Public str_SettingsUIAdvancedFFmpegFlags As String = My.Settings.SettingsUIAdvancedFFmpegFlags
Public str_SettingsUIAdvancedPreferredAudioLanguage As String = My.Settings.SettingsUIAdvancedPreferredAudioLanguage
Public bln_SettingsUIAdvancedSoftSubsChecked As Boolean = My.Settings.SettingsUIAdvancedSoftSubsChecked
' Global Variables
Public bln_EncodingInProgress As Boolean = False
' Session Settings
Public bln_SettingsSessionAutoMode As Boolean = False
Public bln_SettingsSessionStitchMode As Boolean = False
Public str_SettingsSessionStitchFile As String = Nothing
Public bln_SettingsSessionQuitOnFinishMode As Boolean = False
Public bln_SettingsSessionShutdownOnFinishMode As Boolean = False
Public str_SettingsSessionOutputFile As String = Nothing
Public str_SettingsSessionPriority As String = "Normal"
Public Sub sub_DebugMessage(Optional ByVal str_DebugMessage As String = Nothing, Optional ByVal bln_DisplayError As Boolean = False, Optional ByVal mbs_Style As MsgBoxStyle = MsgBoxStyle.Information, Optional ByVal bln_BugReport As Boolean = False)
' If we are to display an error message...
If bln_DisplayError = True Then
MsgBox(str_DebugMessage, CType(mbs_Style + MsgBoxStyle.OkOnly + MsgBoxStyle.MsgBoxSetForeground, MsgBoxStyle), My.Resources.App_Title)
' And make sure to cancel any automation
bln_SettingsSessionAutoMode = False
bln_SettingsSessionQuitOnFinishMode = False
End If
' Write to the external logfile if running in Debug Mode
If bln_SettingsDebugMode And Not obj_LogFile Is Nothing Then
obj_LogFile.WriteLine(str_DebugMessage)
obj_LogFile.Flush()
Else
Exit Sub
End If
' Output to the Console
Console.WriteLine(str_DebugMessage)
End Sub
Public Sub sub_SnarlRegister(ByVal str_RegType As String)
' Initialise Defaults
Dim int_IntPtr As Integer = 0
Dim int_SnarlTimeout As Integer = 10
Dim ptr_SnarlClient As New IntPtr(int_IntPtr)
Dim int_SnarlReturn As M_RESULT = Nothing
Select Case str_RegType.ToUpper
Case "REGISTER"
int_SnarlReturn = SnarlConnector.RegisterConfig(ptr_SnarlClient, "EncodeHD", WindowsMessage.WM_ACTIVATEAPP, Path.Combine(str_AppFolder, My.Resources.App_Title & ".PNG"))
Case "UNREGISTER"
int_SnarlReturn = SnarlConnector.RevokeConfig(ptr_SnarlClient)
End Select
End Sub
Public Sub sub_SnarlMessage(ByVal strMessage As String)
' Initialise Defaults
Dim int_IntPtr As Integer = 0
Dim int_SnarlTimeout As Integer = 10
Dim ptr_SnarlClient As New IntPtr(int_IntPtr)
' Display Snarl Message
Dim int_SnarlReturn As Integer = SnarlConnector.ShowMessage(My.Resources.App_Title, strMessage, int_SnarlTimeout, str_SnarlIconPath, ptr_SnarlClient, WindowsMessage.WM_ACTIVATEAPP)
End Sub
Public Sub sub_AppInitialise()
sub_DebugMessage()
sub_DebugMessage("* Application Initialisation *")
' Create the logfile if in Debug mode, otherwise, just output to the console...
If bln_SettingsDebugMode Then
sub_DebugMessage("Running in Debug Mode")
Try
' Verify the Log Folder Exists, if not, create it
If Not My.Computer.FileSystem.DirectoryExists(str_LogFolder) Then
My.Computer.FileSystem.CreateDirectory(str_LogFolder)
End If
' Connect to the logfile
Try
sub_DebugMessage("Initialising logfile...")
obj_LogFile = My.Computer.FileSystem.OpenTextFileWriter(str_LogFile, True)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
Catch ex As Exception
MessageBox.Show("Unable to create Debug log file: " & ex.Message & ". Debugging switched off", My.Resources.App_Title, MessageBoxButtons.OK, MessageBoxIcon.Warning)
bln_SettingsDebugMode = False
End Try
End If
' Register Snarl
sub_SnarlRegister("Register")
sub_DebugMessage("----------------------------------------------------------------------------------")
sub_DebugMessage(My.Resources.App_Title & " " & fvi_AppVersion.FileVersion & " - " & My.Resources.App_Company)
frm_Main.Text = My.Resources.App_Title & " " & fvi_AppVersion.FileVersion
sub_DebugMessage()
sub_DebugMessage("* Debug Info *")
sub_DebugMessage("OS Full Name: " & str_OSFullName)
sub_DebugMessage("OS Version: " & str_OSVersion)
sub_DebugMessage("OS Architecture: " & str_OSArchitecture)
sub_DebugMessage("Regional Decimal: " & strLocaleDecimal)
sub_DebugMessage("Regional Comma: " & strLocaleComma)
End Sub
Public Sub sub_AppShutdown(ByVal int_ExitCode As Integer)
sub_DebugMessage()
sub_DebugMessage("* Application Shutdown *")
' Save Settings
sub_DebugMessage("Saving Settings...")
My.Settings.SettingsUIH264EncodingChecked = bln_SettingsUIH264EncodingChecked
My.Settings.SettingsUIOutputForTVChecked = bln_SettingsUIOutputForTVChecked
My.Settings.SettingsUIAC3PassthroughChecked = bln_SettingsUIAC3PassthroughChecked
My.Settings.SettingsUIConversionDevice = int_SettingsUIConversionDevice
My.Settings.SettingsUIOutputFolder = str_SettingsUIOutputFolder
My.Settings.SettingsUIAutoSplitChecked = bln_SettingsUIAutoSplitChecked
My.Settings.SettingsUIAdvancedFFmpegFlagsChecked = bln_SettingsUIAdvancedFFmpegFlagsChecked
My.Settings.SettingsUIAdvancedFFmpegFlags = str_SettingsUIAdvancedFFmpegFlags
My.Settings.SettingsUIAdvancedPreferredAudioLanguage = str_SettingsUIAdvancedPreferredAudioLanguage
My.Settings.Save()
' Close the logfile
If bln_SettingsDebugMode Then
sub_DebugMessage("Closing Logfile...")
sub_DebugMessage()
obj_LogFile.Close()
obj_LogFile = Nothing
End If
' UnRegister Snarl
sub_SnarlRegister("UnRegister")
sub_DebugMessage("Exiting Application with Exit Code: " & int_ExitCode, False, CType(True, MsgBoxStyle))
System.Environment.Exit(int_ExitCode)
End Sub
End Module
|
Public Class frmViewRequest
Private Enum GridColumIndex
RequestId = 0
RequestUserId
Requester
Phone
RequestDate
RequestSubject
RequestDescription
Status
Technician
TechnicianPhone
CompletionDate
TEchnicalComment
End Enum
Private Sub frmViewRequest_Load(sender As Object, e As EventArgs) Handles Me.Load
FillGrid()
End Sub
Private Sub FillGrid()
Try
dgview.AutoGenerateColumns = False
Dim dbobj As New DBOpeartions()
Dim Ds As DataSet
Ds = dbobj.GetRequestByCriteria(Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)
dgview.DataSource = Ds.Tables(0)
'Add two columns
Dim ColEditlink As DataGridViewLinkColumn = New DataGridViewLinkColumn()
ColEditlink.UseColumnTextForLinkValue = True
ColEditlink.HeaderText = "Edit"
ColEditlink.DataPropertyName = "RequestId"
ColEditlink.LinkBehavior = LinkBehavior.SystemDefault
ColEditlink.Text = "Edit"
dgview.Columns.Add(ColEditlink)
Dim ColDeletelink As DataGridViewLinkColumn = New DataGridViewLinkColumn()
ColDeletelink.UseColumnTextForLinkValue = True
ColDeletelink.HeaderText = "delete"
ColDeletelink.DataPropertyName = "RequestId"
ColDeletelink.LinkBehavior = LinkBehavior.SystemDefault
ColDeletelink.Text = "Delete"
dgview.Columns.Add(ColDeletelink)
Catch ex As Exception
Throw
End Try
End Sub
Private Sub dgview_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles dgview.CellContentClick
Try
Dim actionName As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(e.ColumnIndex).Value.ToString()
Dim RequestId As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.RequestId).Value.ToString()
Dim status As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.Status).Value.ToString.Trim()
Dim Requester As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.Requester).Value.ToString.Trim()
Dim RequestSubject As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.RequestSubject).Value.ToString.Trim()
Dim RequestDescription As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.RequestDescription).Value.ToString.Trim()
Dim RequestPhone As String = CType(sender, System.Windows.Forms.DataGridView).Rows(e.RowIndex).Cells(GridColumIndex.Phone).Value.ToString.Trim()
If actionName.Trim().ToUpper() = "EDIT" Then
If lblUserType.Text.Trim() = UserTypeConstants.STAFF.ToString() Then
If status.Trim().ToUpper() = "PENDING" Then
Dim frmStaff As New frmAddRequest()
frmStaff.lblRequestUserId.Text = CType(Me.MdiParent, frmMain).lblUserId.Text.Trim()
frmStaff.txtFname.Text = Requester.Split(",").GetValue(0)
frmStaff.txtLName.Text = Requester.Split(",").GetValue(1)
frmStaff.txtPhone.Text = RequestPhone.Trim()
frmStaff.txtDescription.Text = RequestDescription
frmStaff.txtSubject.Text = RequestSubject
frmStaff.btnSave.Text = "UPDATE"
frmStaff.lblRequestId.Text = RequestId
frmStaff.MdiParent = Me.MdiParent
frmStaff.Show()
Me.Hide()
Else
MessageBox.Show(MessagesConstant.YOU_CAN_EDIT_ONLY_PENDING_REQUEST)
End If
Else
MessageBox.Show(MessagesConstant.YOU_DO_NOT_HAVE_PERMISSION_HERE_ONLY_STAFF_CAN_EDIT)
End If
ElseIf actionName.Trim().ToUpper() = "DELETE" Then
If (lblUserType.Text.Trim() = UserTypeConstants.MANAGER) Then
If (MessageBox.Show(MessagesConstant.ARE_YOU_SURE_WANT_TO_DELETE, "HelpDesk", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes) Then
If (DeleteRecord(RequestId)) Then
End If
End If
Else
MessageBox.Show(MessagesConstant.YOU_DO_NOT_HAVE_PERMISSION_DELETE)
End If
End If
Catch ex As Exception
End Try
End Sub
Private Function DeleteRecord(ByVal bv_RequestId As Integer) As Boolean
Try
Dim blnDelete As Boolean = True
Dim objDB As New DBOpeartions()
objDB.DeleteRequest(bv_RequestId)
Return True
Catch ex As Exception
Throw
Return False
End Try
End Function
End Class
|
Imports System.ComponentModel.DataAnnotations
Public Class CartItem
<Key> _
Public Property ItemId() As String
Public Property CartId() As String
Public Property Quantity() As Integer
Public Property DateCreated() As DateTime
Public Property ProductId() As Integer
Public Overridable Property Product() As Product
End Class |
Imports System.Data.OleDb
Public Class ClienteRepositorio
Public Sub Inserir(cliente As Impacta.Dominio.Cliente)
Dim caminho = "C:\Users\Vitor\Documents\Aulas\Impacta\CSharp\II\Pedido.accdb"
Using con As New OleDbConnection(String.Format("Provider=Microsoft.ACE.OLEDB.12.0;DataSource={0};", caminho))
con.Open()
Using cmd As New OleDbCommand
cmd.CommandText = "Insert Cliente (Nome, DataNascimento, Email) values(?, ?, ?)"
cmd.Parameters.AddWithValue("@p1", cliente.Nome)
cmd.Parameters.AddWithValue("@p2", cliente.DataNascimento)
cmd.Parameters.AddWithValue("@p3", cliente.Email)
cmd.ExecuteNonQuery()
End Using
End Using
End Sub
End Class |
Imports System.IO
Imports System.Drawing.Printing
Imports System.Runtime.InteropServices
Public Class RawPrinterHelper
' Structure and API declarions:
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Unicode)> _
Structure DOCINFOW
<MarshalAs(UnmanagedType.LPWStr)> Public pDocName As String
<MarshalAs(UnmanagedType.LPWStr)> Public pOutputFile As String
<MarshalAs(UnmanagedType.LPWStr)> Public pDataType As String
End Structure
<DllImport("winspool.Drv", EntryPoint:="OpenPrinterW", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function OpenPrinter(ByVal src As String, ByRef hPrinter As IntPtr, ByVal pd As Long) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="ClosePrinter", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function ClosePrinter(ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="StartDocPrinterW", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function StartDocPrinter(ByVal hPrinter As IntPtr, ByVal level As Int32, ByRef pDI As DOCINFOW) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="EndDocPrinter", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EndDocPrinter(ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="StartPagePrinter", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function StartPagePrinter(ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="EndPagePrinter", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function EndPagePrinter(ByVal hPrinter As IntPtr) As Boolean
End Function
<DllImport("winspool.Drv", EntryPoint:="WritePrinter", _
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, CallingConvention:=CallingConvention.StdCall)> _
Public Shared Function WritePrinter(ByVal hPrinter As IntPtr, ByVal pBytes As IntPtr, ByVal dwCount As Int32, ByRef dwWritten As Int32) As Boolean
End Function
' When the function is given a string and a printer name,
' the function sends the string to the printer as raw bytes.
Public Shared Sub SendStringToPrinter(ByVal szPrinterName As String, ByVal szString As String)
Dim pBytes As IntPtr
Dim dwCount As Int32
' How many characters are in the string?
dwCount = szString.Length()
' Assume that the printer is expecting ANSI text, and then convert
' the string to ANSI text.
pBytes = Marshal.StringToCoTaskMemAnsi(szString)
' Send the converted ANSI string to the printer.
SendBytesToPrinter(szPrinterName, pBytes, dwCount)
Marshal.FreeCoTaskMem(pBytes)
End Sub
' SendBytesToPrinter()
' When the function is given a printer name and an unmanaged array of
' bytes, the function sends those bytes to the print queue.
' Returns True on success or False on failure.
Public Shared Function SendBytesToPrinter(ByVal szPrinterName As String, ByVal pBytes As IntPtr, ByVal dwCount As Int32) As Boolean
Dim hPrinter As IntPtr ' The printer handle.
Dim dwError As Int32 ' Last error - in case there was trouble.
Dim di As DOCINFOW ' Describes your document (name, port, data type).
Dim dwWritten As Int32 ' The number of bytes written by WritePrinter().
Dim bSuccess As Boolean ' Your success code.
' Set up the DOCINFO structure.
With di
.pDocName = "My Visual Basic .NET RAW Document"
.pDataType = "RAW"
End With
' Assume failure unless you specifically succeed.
bSuccess = False
If OpenPrinter(szPrinterName, hPrinter, 0) Then
If StartDocPrinter(hPrinter, 1, di) Then
If StartPagePrinter(hPrinter) Then
' Write your printer-specific bytes to the printer.
bSuccess = WritePrinter(hPrinter, pBytes, dwCount, dwWritten)
EndPagePrinter(hPrinter)
End If
EndDocPrinter(hPrinter)
End If
ClosePrinter(hPrinter)
End If
' If you did not succeed, GetLastError may give more information
' about why not.
If bSuccess = False Then
dwError = Marshal.GetLastWin32Error()
End If
Return bSuccess
End Function ' SendBytesToPrinter()
End Class
|
Public Class PhieuThu_DTO
Private strMaPhieuThuTien As String
Private strMaDaiLy As String
Private dateNgayThuTien As Date
Private iSoTienThu As Integer
Public Sub New()
End Sub
Public Sub New(strMaPhieuThuTien As String, strMaDaiLy As String, dateNgayThuTien As Date, iSoTienThu As Integer)
Me.strMaPhieuThuTien = strMaPhieuThuTien
Me.strMaDaiLy = strMaDaiLy
Me.dateNgayThuTien = dateNgayThuTien
Me.iSoTienThu = iSoTienThu
End Sub
Property MaPhieuThuTien() As String
Get
Return strMaPhieuThuTien
End Get
Set(ByVal Value As String)
strMaPhieuThuTien = Value
End Set
End Property
Property MaDaiLy() As String
Get
Return strMaDaiLy
End Get
Set(ByVal Value As String)
strMaDaiLy = Value
End Set
End Property
Property NgayThuTien() As Date
Get
Return dateNgayThuTien
End Get
Set(ByVal Value As Date)
dateNgayThuTien = Value
End Set
End Property
Property SoTienThu() As Integer
Get
Return iSoTienThu
End Get
Set(ByVal Value As Integer)
iSoTienThu = Value
End Set
End Property
End Class
|
Imports System.Data.SqlClient
Imports SecurityLib
Imports System.Text
Public Class Checkout
Inherits System.Web.UI.Page
Private customerID As Integer
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'Protected WithEvents txtUserName As System.Web.UI.WebControls.Label
'Protected WithEvents logOutButton As System.Web.UI.WebControls.Button
'Protected WithEvents Label1 As System.Web.UI.WebControls.Label
'Protected WithEvents grid As System.Web.UI.WebControls.DataGrid
'Protected WithEvents totalAmountLabel As System.Web.UI.WebControls.Label
'Protected WithEvents lblCreditCardNote As System.Web.UI.WebControls.Label
'Protected WithEvents lblAddress As System.Web.UI.WebControls.Label
'Protected WithEvents changeDetailsButton As System.Web.UI.WebControls.Button
'Protected WithEvents addCreditCardButton As System.Web.UI.WebControls.Button
'Protected WithEvents addAddressButton As System.Web.UI.WebControls.Button
'Protected WithEvents placeOrderButton As System.Web.UI.WebControls.Button
'Protected WithEvents cancelOrderButton As System.Web.UI.WebControls.Button
'Protected WithEvents pageContentsCell As System.Web.UI.HtmlControls.HtmlTableCell
'Protected WithEvents viewCartButton As System.Web.UI.WebControls.ImageButton
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
If Context.Session("JokePoint_CustomerID") Is Nothing Then
Response.Redirect("CustomerLogin.aspx?ReturnPage=Checkout.aspx")
Else
customerID =
Convert.ToInt32(Context.Session("JokePoint_CustomerID"))
End If
BindShoppingCart()
BindUserDetails()
Else
customerID = Convert.ToInt32(Context.Session("JokePoint_CustomerID"))
End If
End Sub
Private Sub BindShoppingCart()
' Populate the data grid and set its DataKey field
Dim cart As New ShoppingCart
grid.DataSource = cart.GetProducts
grid.DataKeyField = "ProductID"
grid.DataBind()
' Set the total amount label using the Currency format
totalAmountLabel.Text = String.Format("{0:c}", cart.GetTotalAmount())
End Sub
Private Sub BindUserDetails()
' Create Instance of Connection and Command Object
Dim connection As SqlConnection =
New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"))
Dim command As SqlCommand = New SqlCommand("GetCustomer", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.Add("@CustomerID", customerID)
' get customer details
connection.Open()
Dim customerReader As SqlDataReader = command.ExecuteReader()
If customerReader.Read = False Then
Response.Redirect("CustomerLogin.aspx?returnPage=Checkout.aspx")
End If
' set customer data display
txtUserName.Text = customerReader("Name")
If customerReader("CreditCard").GetType() Is GetType(DBNull) Then
lblCreditCardNote.Text = "No credit card details stored."
placeOrderButton.Visible = False
Else
Dim cardDetails As SecureCard =
New SecureCard(customerReader("CreditCard"))
lblCreditCardNote.Text = "Credit card to use: " & cardDetails.CardType _
& ", Card number: " & cardDetails.CardNumberX()
addCreditCardButton.Text = "Change Credit Card"
End If
If customerReader("Address1").GetType() Is GetType(DBNull) Then
lblAddress.Text = "Shipping address required to place order."
placeOrderButton.Visible = False
Else
Dim addressBuilder As StringBuilder = New StringBuilder
addressBuilder.Append("Shipping address:<br><br>")
addressBuilder.Append(customerReader("Address1"))
addressBuilder.Append("<br>")
If Not customerReader("Address2").GetType() Is GetType(DBNull) Then
If customerReader("Address2") <> "" Then
addressBuilder.Append(customerReader("Address2"))
addressBuilder.Append("<br>")
End If
End If
addressBuilder.Append(customerReader("City"))
addressBuilder.Append("<br>")
addressBuilder.Append(customerReader("Region"))
addressBuilder.Append("<br>")
addressBuilder.Append(customerReader("PostalCode"))
addressBuilder.Append("<br>")
addressBuilder.Append(customerReader("Country"))
lblAddress.Text = addressBuilder.ToString()
addAddressButton.Text = "Change Address"
End If
connection.Close()
End Sub
Private Sub addCreditCardButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles addCreditCardButton.Click
Response.Redirect("CustomerCreditCard.aspx?ReturnPage=Checkout.aspx")
End Sub
Private Sub addAddressButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles addAddressButton.Click
Response.Redirect("CustomerAddress.aspx?ReturnPage=Checkout.aspx")
End Sub
Private Sub changeDetailsButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles changeDetailsButton.Click
Response.Redirect("CustomerEdit.aspx?ReturnPage=Checkout.aspx")
End Sub
Private Sub logOutButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles logOutButton.Click
Context.Session("JokePoint_CustomerID") = Nothing
Response.Redirect("default.aspx")
End Sub
Private Sub cancelOrderButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles cancelOrderButton.Click
Response.Redirect("default.aspx")
End Sub
Private Sub placeOrderButton_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles placeOrderButton.Click
' The Shopping Cart object
Dim cart As New ShoppingCart
' We need to store the total amount because the shopping cart
' is emptied when creating the order
Dim amount As Decimal = cart.GetTotalAmount()
' Create the order and store the order ID
Dim orderId As String = cart.CreateOrder()
' After saving the order into our database, we need to
' redirect to a page where the customer can pay for the
' order. Please take a look at the "Single Item Purcases"
' section of the PayPal appendix to see how you can
' integrate PayPal here
' Right now we redirect to default.aspx
Response.Redirect("default.aspx")
End Sub
End Class
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.