text stringlengths 43 2.01M |
|---|
Imports System.ComponentModel
Namespace Settings
<Serializable()>
Public Class Settings
<Category("MPG"), DisplayName("device ID"), BrowsableAttribute(True)>
Public Property MpgDeviceId As String = "MPG"
<Category("Printer"), DisplayName("Print Layout"), BrowsableAttribute(True)>
Public Property PrinterLayoutOption As PrinterLayoutOptionT
<Category("Harness"), DisplayName("Default Harness N1"), Browsable(True)>
Public Property HarnessDefaultN1 As Integer
<Category("Harness"), DisplayName("Default Harness N2"), Browsable(True)>
Public Property HarnessDefaultN2 As Integer
<Category("Measurement"), DisplayName("Default density [g/dm³]"), Browsable(True)>
Public Property DensityDefault As Double = 7650
<Category("Measurement"), DisplayName("Default frequency [Hz]"), Browsable(True)>
Public Property FrequencyDefault As Double = 60
<Category("Measurement"), DisplayName("Weight range +- [%]"), Browsable(True)>
Public Property WeightRange As Double = 4
<Category("Measurement"), DisplayName("Toroid default stacking factor"), Browsable(True)>
Public Property ToroidDefaultStackingFactor As Double = 1
<Category("Measurement"), DisplayName("Low loss warning percentage of green limit"), Browsable(True)>
Public Property LowLossWarningPercentageOfGreenLimit As Double = 80
<Category("Grade color"), DisplayName("Passed"), Browsable(True), Xml.Serialization.XmlIgnore()>
Public Property ColorPassed As Color
<Category("Grade color"), DisplayName("Green"), Browsable(True), Xml.Serialization.XmlIgnore()>
Public Property ColorGreen As Color
<Category("Grade color"), DisplayName("Yellow"), Browsable(True), Xml.Serialization.XmlIgnore()>
Public Property ColorYellow As Color
<Category("Grade color"), DisplayName("Red"), Browsable(True), Xml.Serialization.XmlIgnore()>
Public Property ColorRed As Color
<Category("Grade color"), DisplayName("Blue"), Browsable(True), Xml.Serialization.XmlIgnore()>
Public Property ColorRejected As Color
<Category("SQL credentials"), DisplayName("Server"), BrowsableAttribute(True)>
Public Property DataSource As String = "121COGENTS9K"
<Category("SQL credentials"), DisplayName("UserID"), BrowsableAttribute(True)>
Public Property UserID As String = "SYSADM"
<Category("SQL credentials"), DisplayName("Password"), PasswordPropertyText(True), BrowsableAttribute(True)>
Public Property Password As String = "COPOW05"
<Browsable(False)>
Public Property ColorPssedSerializable As Integer
Set(value As Integer)
ColorPassed = Drawing.Color.FromArgb(value)
End Set
Get
Return ColorPassed.ToArgb
End Get
End Property
<Browsable(False)>
Public Property ColorGreenSerializable As Integer
Set(value As Integer)
ColorGreen = Drawing.Color.FromArgb(value)
End Set
Get
Return ColorGreen.ToArgb
End Get
End Property
<Browsable(False)>
Public Property ColorYellowSerializable As Integer
Set(value As Integer)
ColorYellow = Drawing.Color.FromArgb(value)
End Set
Get
Return ColorYellow.ToArgb()
End Get
End Property
<Browsable(False)>
Public Property ColorRedSerializable As Integer
Set(value As Integer)
ColorRed = Drawing.Color.FromArgb(value)
End Set
Get
Return ColorRed.ToArgb
End Get
End Property
<Browsable(False)>
Public Property ColorRejectedSerializable As Integer
Set(value As Integer)
ColorRejected = Drawing.Color.FromArgb(value)
End Set
Get
Return ColorRejected.ToArgb
End Get
End Property
End Class
Public Enum PrinterLayoutOptionT
Full
[Partial]
Off
End Enum
End Namespace
|
Imports System.ComponentModel.DataAnnotations
Imports System.Runtime.InteropServices
Public Interface iSaleItem
''' <summary>
''' Unit Price * Qty after discounts
''' </summary>
''' <returns></returns>
<Required>
Property LinePrice As Decimal
End Interface
Public MustInherit Class clsSaleItemBase
Implements iSaleItem
Public MustOverride Function Validate(validationContext As ValidationContext) As IEnumerable(Of ValidationResult) 'Implements IValidatableObject.Validate
Friend Function BaseValidation() As IEnumerable(Of ValidationResult)
Dim lst As New List(Of ValidationResult)
Return lst
End Function
Enum CustomerActionEnum
''' <summary>
''' The customer has taken this item. Nothing further to action.
''' </summary>
NoCustomerAction = -1
''' <summary>
''' There is not enough stock to fulfil this item. The customer has placed an order for it. They will come back in to collect when available.
''' </summary>
CustomerOrderItem = 0
'CustomerSale = 1
''' <summary>
''' Item has been ordered via a website and needs to be either collected or dispatched.
''' </summary>
WebSalesItem = 2
''' <summary>
''' This is for items that will be fulfilled from a different location (perhaps a warehouse)
''' </summary>
MailOrderItem = 3
''' <summary>
''' Order has been generated and entered via eBay.
''' </summary>
eBayItem = 4
''' <summary>
''' Order has been generated and entered via Amazon. This is an FBM order. FBA orders come in as No Customer Action as there is no dispatching to perform on these.
''' </summary>
AmazonItem = 5
'''' <summary>
'''' There is enough stock of this item but the customer might not have actually come into the shop. This is used to reserve the item for the customer until such time as they do.
'''' </summary>
'ReserveItem = 6
'''' <summary>
'''' This is for a product that needs to have something done to it before the customer can return to collect it. i.e. Dry Cleaning, Key Cutting, Embroidery
'''' </summary>
'CustomisationItem = 7
End Enum
''' <summary>
''' Kits refer to a product that, when sold, deduct stock for a bill of materials. These kits fall into two categories, Static - where the components are fixed and Variable - where the components could vary within a range. An example of the variable kit might be a child's school uniform kit (bundle). The child could be male or female and different sizes so the components might be a skirt or trousers, shirt or blouse etc.
''' </summary>
Enum ItemKitTypeEnum
''' <summary>
''' The Header PLU of a fixed kit. This is the one that will be scanned into the till
''' </summary>
FixedHeader = 1
''' <summary>
''' The Header PLU of a variable kit. This is the one that will be scanned into the till
''' </summary>
VariableHeader = 2
''' <summary>
''' This is a component PLU of a fixed kit. The operator does need to see this in the front-end necessarily, but the stock for this item will be reduced as the kit it sold.
''' </summary>
FixedComponent = 3
''' <summary>
''' This is a component PLU of a variable kit. The operator will need to choose which components they want to buy when the header PLU is being sold.
''' </summary>
VariableComponent = 4
''' <summary>
''' This is a PLU being sold outside of the scope of a kit. It is possible for this PLU to be a component of a kit, but in this instance, it is being sold on its own.
''' </summary>
NormalItem = 5
End Enum
''' <summary>
''' PLU number of the product
''' </summary>
''' <returns></returns>
<StringLength(35)>
<Required>
Property PLU As String
''' <summary>
''' The quantity being ordered
''' </summary>
''' <returns></returns>
<Required>
Property Qty As Integer = 1
''' <summary>
''' Readonly. The UnitPrice of the product after discounts
''' </summary>
''' <returns></returns>
ReadOnly Property UnitPrice As Decimal
Get
If Me.Qty = 0 Then Throw New Exception("Qty cannot be zero")
Dim decReturn As Decimal = Me.LinePrice / Me.Qty
If decReturn < 0 Then decReturn = decReturn * -1 'unit price must always be positive
Return decReturn
End Get
End Property
Function OriginalUnitPrice() As Decimal
Return (Me.LinePrice + Me.LineDiscountPromo + Me.LineDiscount) / Me.Qty
End Function
Function TotalDiscount() As Decimal
Return Me.LineDiscount + Me.LineDiscountPromo
End Function
''' <summary>
''' Any personalisation for this item, for example the name to be printed on the back of a garment.
''' </summary>
''' <returns></returns>
Property FreeText As String
<Range(0, Decimal.MaxValue)>
Property LineDiscount As Decimal
<Range(0, Decimal.MaxValue)>
Property LineDiscountPromo As Decimal
''' <summary>
'''ReadOnly. Not required for inserting
''' </summary>
''' <returns></returns>
Property Description As String
Property GiftCardDetails As clsGiftCardItemDetails
''' <summary>
''' Certain products are not permitted to be discounted. This flag records if that is the case or not.
''' </summary>
''' <returns></returns>
Property NoDiscountAllowed As Boolean
''' <summary>
''' Unit Price * Qty after discounts
''' </summary>
''' <returns></returns>
Public Property LinePrice As Decimal Implements iSaleItem.LinePrice
End Class
'Public Class clsTillSaleItem
' Inherits clsSaleItemBase
' Property ProductOptions As IEnumerable(Of clsSaleItemBase)
'End Class
Public Class clsSalesItemRefundDetails
Property OriginalSalesRef As String
Property OriginalSalesLine As Integer
End Class
Public Class clsSalesItem
Inherits clsSaleItemBase
Implements IValidatableObject
Public Overrides Function Validate(validationContext As ValidationContext) As IEnumerable(Of ValidationResult) Implements IValidatableObject.Validate
Dim results As New List(Of ValidationResult)
Dim tmpResults As List(Of ValidationResult) = MyBase.BaseValidation
If tmpResults.Any Then results.AddRange(tmpResults)
'If Me.DepositAmount IsNot Nothing And Me.CustomerAction = CustomerActionEnum.NoCustomerAction Then
' results.Add(New ValidationResult("Cannot specify deposit amount when there is no Customer Action"))
'End If
If Me.KitParentLine Is Nothing AndAlso Me.IsKitComponent Then
results.Add(New ValidationResult("Must specify the Kit Parent Line property when an item is marked as a kit component"))
End If
If Me.KitParentLine IsNot Nothing AndAlso Not Me.IsKitComponent Then
results.Add(New ValidationResult("The Kit Parent Line property should be null when an item is not marked as a kit component"))
End If
If Me.RefundDetails IsNot Nothing AndAlso Me.Qty >= 0 Then
results.Add(New ValidationResult($"RefundDetails present on line {Me.LineID} where the quantity is positive"))
End If
If Me.Qty < 0 And Me.LinePrice > 0 Then
results.Add(New ValidationResult($"Item line {Me.LineID} has a negative qty, but the line price is positive"))
End If
If Me.Qty > 0 And Me.LinePrice < 0 Then
results.Add(New ValidationResult($"Item line {Me.LineID} has a positive qty, but the line price is negative"))
End If
If Me.Qty = 0 Then
results.Add(New ValidationResult($"Item line {Me.LineID} has a qty of zero, this is not allowed"))
End If
Return results
End Function
''' <summary>
''' If the item is being ordered (not taken away at POS), then this is the amount they are paying for it now.
''' </summary>
''' <returns></returns>
<Range(0, Integer.MaxValue)>
Property DepositAmount As Decimal?
''' <summary>
''' The Sales Channel. See api/Sales/Channels
''' </summary>
''' <returns></returns>
Property CustomerAction As Integer = -1
''' <summary>
''' A record of any functions that were authorised by a manager and when
''' </summary>
''' <returns></returns>
Property AdminOverrides As IEnumerable(Of clsAdminOverride)
Function PaidAmount() As Decimal
If Me.DepositAmount IsNot Nothing Then
Return Me.DepositAmount
Else
Return Me.LinePrice
End If
'Select Case Me.CustomerAction
' Case CustomerActionEnum.CustomerOrderItem
' Return Me.DepositAmount
' Case Else
' Return Me.LinePrice
'End Select
End Function
''' <summary>
''' A unique number for each line in the sale. Start at 1 and increment.
''' </summary>
''' <returns></returns>
<Required>
<Key>
Property LineID As Integer
<EnumDataType(GetType(ItemKitTypeEnum))>
Property KitProductType As ItemKitTypeEnum = ItemKitTypeEnum.NormalItem
Function KitSequence() As Long?
If Me.KitParentLine IsNot Nothing Then
Return Me.KitParentLine
ElseIf Me.IsKitHeader Then
Return Me.LineID
Else
Return Nothing
End If
End Function
''' <summary>
''' If this item is a kit component, then this property determines which item in the sale is the kit header
''' </summary>
''' <returns></returns>
Property KitParentLine As Long?
Function IsKitHeader() As Boolean
Select Case Me.KitProductType
Case ItemKitTypeEnum.FixedHeader, ItemKitTypeEnum.VariableHeader
Return True
End Select
Return False
End Function
Property RefundDetails As clsSalesItemRefundDetails
Function IsKitComponent() As Boolean
Select Case Me.KitProductType
Case ItemKitTypeEnum.FixedComponent, ItemKitTypeEnum.VariableComponent
Return True
End Select
Return False
End Function
''' <summary>
''' Optional. If omitted, the VAT ID assigned to the product will be used. If the goods are being exported outside of the UK for instance, the VAT ID might be different to what is assigned on the product. See api/TaxCodes/All for a list of the possible values
''' </summary>
''' <returns></returns>
Property VatID As Integer?
'may come online later
'Property ProductOptions As IEnumerable(Of clsSaleItemBase)
End Class
Public Class clsSalesItemExt
Inherits clsSalesItem
Implements IValidatableObject
Property ColourID As String
Property ColourName As String
Property ColourCode As String
Property Size As String
Property StyleID As String
Property InvoiceID As Integer?
Property AccountsNominalCode As String
End Class
'Public Class clsTillSaleItems
' Inherits EskimoBaseClass
' ''' <summary>
' ''' A collection of the items being ordered
' ''' </summary>
' ''' <returns></returns>
' Property Items As IEnumerable(Of clsTillSaleItem)
' ''' <summary>
' ''' Running in Waitress mode?
' ''' </summary>
' ''' <returns></returns>
' <Required>
' Property Hospitality As Boolean
' ''' <summary>
' ''' The date of the sale/table creation.
' ''' </summary>
' ''' <returns></returns>
' <Required>
' Property ActionDate As Date
' ''' <summary>
' ''' Optional. If passed, then the order is to be paid for, otherwise a Table Tab is created or appended to when running in waitress mode, or a layaway is created when running in retail mode.
' ''' </summary>
' ''' <returns></returns>
' Property Tenders As IEnumerable(Of clsTenderEntry)
' ''' <summary>
' ''' The Table Number
' ''' </summary>
' ''' <returns></returns>
' Property ScopeID As Integer?
' ''' <summary>
' ''' The ID of the Area the table is in. Shoud match an ID from api/TillMenu/Areas
' ''' </summary>
' ''' <returns></returns>
' Property AreaID As Integer?
'End Class
Public Class clsGiftCardItemDetails
Inherits clsGiftCardBase
''' <summary>
''' If the card was a new card (i.e. not activated before this sale) then pass True, but if the card was already activated and was just having extra money added to it, then pass False
''' </summary>
''' <returns></returns>
<Required>
Property Activated As Boolean
End Class |
Imports BVSoftware.Bvc5.Core
Imports System.Collections.ObjectModel
Partial Class BVAdmin_Catalog_InventoryBatchEdit
Inherits BaseAdminPage
Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
Me.PageTitle = "Inventory Batch Editing"
Me.CurrentTab = AdminTabType.Catalog
ValidateCurrentUserHasPermission(Membership.SystemPermissions.CatalogView)
End Sub
Protected Sub ViewImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ViewImageButton.Click
If Page.IsValid Then
Dim criteria As New Catalog.ProductSearchCriteria()
criteria.ShowProductCombinations = ChoiceCombinationsCheckBox.Checked
ProductFilter1.LoadCriteria(criteria)
Dim products As Collection(Of Catalog.Product) = Catalog.InternalProduct.FindByCriteria(criteria)
Dim inventories As New Collection(Of Catalog.ProductInventory)()
For Each item As Catalog.Product In products
If item.Inventory IsNot Nothing AndAlso item.Inventory.Bvin <> String.Empty Then
inventories.Add(item.Inventory)
End If
Next
If inventories.Count > 0 Then
For Each item As Catalog.ProductInventory In inventories
InventoryModifications1.PostChanges(item)
Next
Dim inventoriesToBind As New Collection(Of Catalog.ProductInventory)
Dim limit As Integer = 9
If inventories.Count < limit Then
limit = (inventories.Count - 1)
AdditionalProductsLabel.Visible = False
Else
AdditionalProductsLabel.Visible = True
AdditionalProductsLabel.Text = "An additional " & CStr(inventories.Count - 10) & " items will also be changed"
End If
For i As Integer = 0 To limit
inventoriesToBind.Add(inventories(i))
Next
ProductsGridView.DataSource = inventoriesToBind
ProductsGridView.DataKeyNames = New String() {"bvin"}
ProductsGridView.DataBind()
ViewState("inventories") = inventories
BatchEditMultiView.ActiveViewIndex = 1
Else
MessageBox1.ShowError("No inventory data was returned based on the parameters you specified")
MessageBox2.ShowError("No inventory data was returned based on the parameters you specified")
End If
End If
End Sub
Protected Sub SaveImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles SaveImageButton.Click
If Page.IsValid Then
Dim inventories As Collection(Of Catalog.ProductInventory) = DirectCast(ViewState("inventories"), Collection(Of Catalog.ProductInventory))
If inventories IsNot Nothing Then
For Each inventory As Catalog.ProductInventory In inventories
Catalog.ProductInventory.Update(inventory)
Next
MessageBox1.ShowOk("Inventory changes have been saved to the database")
MessageBox2.ShowOk("Inventory changes have been saved to the database")
Else
MessageBox1.ShowError("An error has occurred while trying to retrieve the list of inventory items")
MessageBox2.ShowError("An error has occurred while trying to retrieve the list of inventory items")
End If
BatchEditMultiView.ActiveViewIndex = 0
End If
End Sub
Protected Sub CancelImageButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles CancelImageButton.Click
BatchEditMultiView.ActiveViewIndex = 0
End Sub
Protected Sub ProductsGridView_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles ProductsGridView.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) AndAlso (e.Row.DataItem IsNot Nothing) Then
Dim Inv As Catalog.ProductInventory = DirectCast(e.Row.DataItem, Catalog.ProductInventory)
Dim productBvin As String = e.Row.Cells(0).Text
Dim p As Catalog.Product = Catalog.InternalProduct.FindByBvin(productBvin)
e.Row.Cells(0).Text = p.ProductName
If p.ParentId <> String.Empty Then
Dim pairs As Collection(Of Catalog.ProductChoiceAndChoiceOptionPair) = Catalog.ProductChoiceAndChoiceOptionPair.FindByCombinationBvin(p.Bvin)
Dim sb As New StringBuilder()
For Each pair As Catalog.ProductChoiceAndChoiceOptionPair In pairs
sb.Append(pair.ChoiceName)
sb.Append(":")
sb.Append(pair.ChoiceOptionName)
sb.Append(", ")
Next
sb.Remove(sb.Length - 2, 2)
e.Row.Cells(0).Text += sb.ToString()
End If
End If
End Sub
End Class
|
Imports System
Imports System.Type
Imports System.Activator
Imports System.Runtime.InteropServices
Imports Inventor
Imports BeyazitTest
Imports BeyazitTest.Vertices
Imports System.Windows.Vector
Imports System.IO
Public Class Form1
' App variables.
Dim _invApp As Inventor.Application
Private m_partDoc As PartDocument
Dim _started As Boolean = False
Dim _initialized As Boolean = False
Private m_PolyLines As New List(Of Polygon)()
Private m_InputPolygonVertices As New BeyazitTest.Vertices
Private m_InputPolygon As Polygon
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Try
_invApp = Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
Try
Dim invAppType As Type = _
GetTypeFromProgID("Inventor.Application")
_invApp = CreateInstance(invAppType)
_invApp.Visible = True
_started = True
Catch ex2 As Exception
MsgBox(ex2.ToString())
MsgBox("Unable to start Inventor")
End Try
End Try
End Sub
Private Function Init() As Boolean
' Make sure a part is active.
If _invApp.ActiveDocumentType <> DocumentTypeEnum.kPartDocumentObject Then
MsgBox("A part document must be active.")
Init = False
Exit Function
End If
' Get a reference to the active part.
m_partDoc = _invApp.ActiveDocument
Init = True
End Function
Private Sub Form1_FormClosed(sender As Object, e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
If _started Then
_invApp.Quit()
End If
_invApp = Nothing
End Sub
' Allocate the first Bitmap.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.ResizeRedraw = True
End Sub
Private Sub ExtractSketchBtn_Click(sender As System.Object, e As System.EventArgs) Handles ExtractSketchBtn.Click
' set active part
If _initialized = False Then
_initialized = Init()
End If
If _initialized = False Then
Exit Sub
End If
'find first extrude feature
Dim extrudes As Inventor.ExtrudeFeatures
extrudes = m_partDoc.ComponentDefinition.Features.ExtrudeFeatures
If extrudes.Count > 0 Then
Dim extFeature As Inventor.ExtrudeFeature = extrudes.Item(1) ' YOGESH: Should go thru ALL extrudes not just FIRST
If Not extFeature.Profile Is Nothing Then
Dim pathIndex As Integer = 0
For Each path As Inventor.ProfilePath In extFeature.Profile
'YOGESH: path.Count is 0 for profile created by TEXT command. Not yet implemeneted by Inventor APIs (wishlist)
If Not path Is Nothing And path.Count > 0 Then
Dim pathVertices As BeyazitTest.Vertices = New BeyazitTest.Vertices ' these are for this individual profile-path, outer or inner
'YOGESH: Its assumed that curves in the path are connected end-to-end, if not following logic wont work
For Each profile_entity As Inventor.ProfileEntity In path
Dim entity As SketchEntity = profile_entity.SketchEntity
Dim singleEntityVertices As BeyazitTest.Vertices = New BeyazitTest.Vertices ' these are just for this individual curves
' Every sketch entity has start and end, so caching them before, needed for 'reverse' logic later
Dim startpt As Inventor.Point2d = entity.StartSketchPoint.Geometry
Dim endpt As Inventor.Point2d = entity.EndSketchPoint.Geometry
Dim v1 As System.Windows.Vector = New System.Windows.Vector(startpt.X, startpt.Y)
Dim v2 As System.Windows.Vector = New System.Windows.Vector(endpt.X, endpt.Y)
If TypeOf entity Is SketchPoint Then
' do nothing
ElseIf TypeOf entity Is SketchLine Then
' Add already cached start and end point, nothing else is needed
If (singleEntityVertices.Index(v1) = -1) Then
singleEntityVertices.Add(v1)
End If
If (singleEntityVertices.Index(v2) = -1) Then
singleEntityVertices.Add(v2)
End If
Else ' curved entities, generically get sample points
' Get the evaluator from the associate geometry.
Dim curveEval As Curve2dEvaluator = entity.Geometry.Evaluator
Dim minU As Double
Dim maxU As Double
curveEval.GetParamExtents(minU, maxU)
' Get the curve length.
Dim length As Double
curveEval.GetLengthAtParam(minU, maxU, length)
' Determine the length between segments.
Dim segmentCount As Integer = 12 ' Adjust to resolution needed
Dim offset As Double
offset = length / segmentCount
Dim currentLength As Double = 0
For i As Integer = 0 To segmentCount
Dim currentParam As Double
curveEval.GetParamAtLength(minU, currentLength, _
currentParam)
currentLength = currentLength + offset
Dim params(0) As Double
params(0) = currentParam
Dim coords() As Double = {}
curveEval.GetPointAtParam(params, coords)
singleEntityVertices.Add(New System.Windows.Vector(coords(0), coords(1)))
Next
End If
' Individual entities may be connected in 'reverse' directions, correct it
If pathVertices.Index(singleEntityVertices(singleEntityVertices.Count - 1)) = 0 Then
pathVertices.Reverse()
singleEntityVertices.Reverse()
ElseIf pathVertices.Index(singleEntityVertices(singleEntityVertices.Count - 1)) = 1 Then
singleEntityVertices.Reverse()
End If
' Add sample points from this singleEntity to path vertices
For j As Integer = 0 To singleEntityVertices.Count - 1
Dim v As System.Windows.Vector = singleEntityVertices(j)
If (pathVertices.Index(v) = -1) Then
pathVertices.Add(v)
End If
Next
Next
'if there are holes, meaning more than one path, then add first vertex again to close it
If extFeature.Profile.Count > 1 Then
If pathIndex = 0 Then ' first profile should be CCW
pathVertices.Add(pathVertices.Vertex(0))
pathVertices.ForceCounterClockWise()
Else
If Not pathVertices.IsCounterClockWise() Then
m_InputPolygonVertices.Add(pathVertices.Vertex(pathVertices.Count - 1))
Else
pathVertices.Add(pathVertices.Vertex(0))
pathVertices.ForceClockWise() ' make it clockwise!!!!!!!!!!!!!
End If
End If
For Each vp As System.Windows.Vector In pathVertices
m_InputPolygonVertices.Add(vp)
Next
Else ' Single path, no holes
pathVertices.ForceCounterClockWise()
For Each vp As System.Windows.Vector In pathVertices
m_InputPolygonVertices.Add(vp)
Next
End If
End If
pathIndex = pathIndex + 1
Next
' DEBUG
Dim myDebug As Boolean = True
If myDebug = True And m_InputPolygonVertices.Count > 0 Then
Dim w As StreamWriter = New StreamWriter("my.dat")
For Each v As System.Windows.Vector In m_InputPolygonVertices
w.WriteLine(String.Format("{0} {1}", v.X, v.Y))
Next
w.Close()
End If
' All profile curves are done now, fill points list for display
Dim ii As Integer = 0
Dim ppoints(m_InputPolygonVertices.Count - 1) As PointF
For Each v As System.Windows.Vector In m_InputPolygonVertices
ppoints(ii) = New PointF(v.X, v.Y)
ii = ii + 1
Next
m_InputPolygon = New Polygon(ppoints)
End If
End If
Me.Invalidate()
End Sub
Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias
e.Graphics.Clear(Me.BackColor)
e.Graphics.ResetTransform()
e.Graphics.ScaleTransform(0.5, 0.5, System.Drawing.Drawing2D.MatrixOrder.Append)
If (Not (m_InputPolygon Is Nothing)) Then
m_InputPolygon.Draw(e.Graphics, System.Drawing.Pens.Blue)
End If
For Each lines As Polygon In m_PolyLines
lines.Draw(e.Graphics, System.Drawing.Pens.Red)
Next lines
End Sub
' Map a drawing coordinate rectangle to a graphics object rectangle.
Private Sub MapDrawing(ByVal gr As Graphics, ByVal _
drawing_rect As RectangleF, ByVal target_rect As _
RectangleF, Optional ByVal stretch As Boolean = False)
gr.ResetTransform()
' Center the drawing area at the origin.
Dim drawing_cx As Single = (drawing_rect.Left + _
drawing_rect.Right) / 2
Dim drawing_cy As Single = (drawing_rect.Top + _
drawing_rect.Bottom) / 2
gr.TranslateTransform(-drawing_cx, -drawing_cy)
' Scale.
' Get scale factors for both directions.
Dim scale_x As Single = target_rect.Width / _
drawing_rect.Width
Dim scale_y As Single = target_rect.Height / _
drawing_rect.Height
If (Not stretch) Then
' To preserve the aspect ratio, use the smaller
' scale factor.
scale_x = Math.Min(scale_x, scale_y)
scale_y = scale_x
End If
gr.ScaleTransform(scale_x, scale_y, _
System.Drawing.Drawing2D.MatrixOrder.Append)
' Translate to center over the drawing area.
Dim graphics_cx As Single = (target_rect.Left + _
target_rect.Right) / 2
Dim graphics_cy As Single = (target_rect.Top + _
target_rect.Bottom) / 2
gr.TranslateTransform(graphics_cx, graphics_cy, _
System.Drawing.Drawing2D.MatrixOrder.Append)
End Sub
Private Sub MidcurvesBtn_Click(sender As System.Object, e As System.EventArgs) Handles MidcurvesBtn.Click
Dim resultsWithTriangulation As List(Of BeyazitTest.Vertices)
resultsWithTriangulation = YogeshBayazitDecomposer.ConvexPartition(m_InputPolygonVertices)
'Dim polygonList As List(Of BeyazitTest.Vertices)
'polygonList = Triangulator.TriagnulateQuadPlusPolygons(resultsWithTriangulation)
Dim midcurves As List(Of BeyazitTest.Vertices)
midcurves = MidcurveGenerator.GenerateMidcurves(resultsWithTriangulation)
For ii As Integer = 0 To midcurves.Count - 1
Dim vertices As BeyazitTest.Vertices = midcurves(ii)
Dim iipoints(1) As PointF
Dim v1 As System.Windows.Vector = vertices.Vertex(0)
Dim v2 As System.Windows.Vector = vertices.Vertex(1)
iipoints(0) = New PointF(v1.X, v1.Y)
iipoints(1) = New PointF(v2.X, v2.Y)
Dim line As Polygon = New Polygon(iipoints)
m_PolyLines.Add(line)
Next
Me.Invalidate()
End Sub
End Class
|
'GLC: This class is just a placeholder for common classes and methods
'Author: Apollo8 Dec, 2014
'
'Include in this module any 'generally accessible methods' (math etc...) required by the all other modules
'All methods are declared "Public Shared" (this used to be vb modules, but now it is apparently a 'bad practice' to use modules). Oh well...
'
Option Explicit On
Option Strict On
Imports OpenTK.Graphics.OpenGL
Imports OpenTK
Imports System
Friend Class GLC 'just a holder for many common methods and classes
Public Shared glPerFt As Single = 1 / 50 '(gl/ft) global scaler (hires water as reference) (1.0 GLunit/50 ft)
Public Shared AppPath As String = My.Application.Info.DirectoryPath
Public Shared SupportsVBO As Boolean = False
Public Shared SupportsShaders As Boolean = False
Public Shared G As Single = 32.3 'ft/s2 - universal gravity constant
Public Shared PIover180 As Single = Math.PI / 180
Public Shared PI As Single = Math.PI
Public Shared PI2 As Single = 2 * PI
Public Shared Densw As Single = 62.4F 'water density
Public Shared enableVBO As Boolean = False
Public Shared enableShaders As Boolean = False
Public Shared enableShadows As Boolean = False
Public Shared enableBumps As Boolean = False
Public Shared MVP As Matrix4 'Model View Projection Matrix (see In_Frustum). Changes as you rotate view. See SetMatrices
Public Shared Function IsExtensionSupported(ByVal szTargetExtension As String) As Boolean
Dim pszExtensions As String
pszExtensions = GL.GetString(StringName.Extensions).ToLower.Trim
'Debug.Print(pszExtensions)
Console.Write(pszExtensions.Replace(" ", vbCrLf))
Return pszExtensions.Contains(szTargetExtension.ToLower.Trim)
End Function
Public Shared Function GetCardInfoAndTestVBO() As String
'Only need to do this once per app
Dim tmp As String = ""
Try
SupportsVBO = IsExtensionSupported("GL_ARB_vertex_buffer_object")
SupportsShaders = IsExtensionSupported("GL_ARB_shader_objects")
tmp = GL.GetString(StringName.Vendor) + " " + _
GL.GetString(StringName.Renderer) + " " + _
GL.GetString(StringName.Version)
Catch ex As Exception
Throw New Exception(ex.Message)
End Try
Return tmp
End Function
Public Shared Function CacuRotationMatrix(ByVal Angle As Vector3) As Matrix4
'Angle in radians = (pitch,yaw,roll)
Dim rx As Matrix4 = Matrix4.CreateRotationX(Angle.X) 'pitch
Dim ry As Matrix4 = Matrix4.CreateRotationY(Angle.Y) 'yaw
Dim rz As Matrix4 = Matrix4.CreateRotationZ(Angle.Z) 'roll
Dim rzxy As Matrix4 = (rz * rx) * ry 'rotation tranformation matrix (in this order: roll, pitch, yaw)
Return rzxy
End Function
Public Shared Function SameDirection(ByVal a As Vector3, ByVal b As Vector3) As Boolean
Return Vector3.Dot(a, b) >= 0
End Function
Public Shared Function Log2(ByVal x As Single) As Single
'loga(x) = logb(x)/logb(a)
Return CSng((System.Math.Log(x) / System.Math.Log(2.0F)))
End Function
Public Shared Function getPolar(ByVal c As Vector3) As polar
'WILL EVENTUALLY OBSOLETE!
Dim p As New polar()
p.Mag = c.Length
p.Theta = CSng(Math.Atan2(c.Z, c.X))
If c.X < 0 Then p.Theta += (PI)
p.Phi = CSng((Math.Asin(c.Y / p.Mag)))
If Single.IsNaN(p.Phi) Then
p.Phi = PI / 2 : If c.Y < 0 Then p.Phi = -p.Phi
End If
Return p
End Function
Public Shared Function getAngle(ByVal c As Vector2) As Single
Return CSng(Math.Atan2(c.Y, c.X)) 'handles the c.x=0
End Function
Public Shared Function getVector(ByVal Angle As Single) As Vector2
Return New Vector2(CSng(Math.Sin(Angle)), CSng(Math.Cos(Angle)))
End Function
Public Shared Function setMag(ByVal v As Vector3, ByVal Mag As Single) As Vector3
Dim ret As Vector3 = v
ret = Vector3.Normalize(ret)
ret = Vector3.Multiply(ret, Mag)
Return ret
End Function
Public Shared Function setMag(ByVal v As Vector2, ByVal Mag As Single) As Vector2
Dim ret As Vector2 = v
ret = Vector2.Normalize(ret)
ret = Vector2.Multiply(ret, Mag)
Return ret
End Function
Public Shared Function Multiply(ByVal v1 As Vector3, ByVal v2 As Vector3) As Vector3
'This is usefull for scaling when the scaling facgtor is different X vs Y vs Z
Return New Vector3(v1.X * v2.X, v1.Y * v2.Y, v1.Z * v2.Z)
End Function
Public Shared Function In_Frustum(ByVal m As Matrix4, ByVal p As Vector3) As Boolean
'you have a point p which is vec3, and a model view projection matrix, M, then
Dim v As Vector4 = New Vector4(p, 1)
Dim PClip As Vector4 = Vector4.Transform(v, m) ' same as m * v (matrix multiplies a vector)
Return Math.Abs(PClip.X) < PClip.W And Math.Abs(PClip.Y) < PClip.W And 0 < PClip.Z And PClip.Z < PClip.W
End Function
Public Shared Function IsVisible(ByVal mLocGL As Vector3, ByRef mModel As MyModel, ByVal EyeGL As Vector3) As Boolean
'Warning: do not use +/- Size/2 as model's origin may not be centered, but when camera too close there would still
'be some 'blind spots' if only checking min/max Vec... so, in general, if 'close enough' return True:
If (mLocGL - EyeGL).LengthFast < 2.0 * (mModel.Size.LengthFast * mModel.GLperMdl.X) Then Return True : Exit Function
Dim minVec As Vector3 = Multiply(mModel.minVert, mModel.GLperMdl) + mLocGL
Dim maxVec As Vector3 = Multiply(mModel.maxVert, mModel.GLperMdl) + mLocGL
Return IsVisible(minVec, maxVec, EyeGL)
End Function
Public Shared Function IsVisible(ByVal minVecGL As Vector3, ByVal maxVecGL As Vector3, ByVal EyeGL As Vector3) As Boolean
'Test if within view...in the simplest, if all of the obj is behind the camera, or TOO far, it is not visible
'(see In_Frustum) NOTE: The time this takes to execute is insignificant (< 0.2 microsecs)
'But if it is a large terrain ... just always show
Dim vis As Boolean
'On large objs corners may be invisible but maybe E is between the two corners that define the BOX. In that case assume visible:
If Not vis Then
vis = IsBetween(EyeGL, minVecGL, maxVecGL)
If Not vis Then
'Is the center visible?
Dim center As Vector3 = (minVecGL + maxVecGL) / 2
vis = In_Frustum(MVP, center)
If Not vis Then
'Are the min and max vertices that define the 'box' visible?
vis = In_Frustum(MVP, minVecGL)
If Not vis Then
vis = In_Frustum(MVP, maxVecGL)
If Not vis Then
'Finally...The two complementary vertices
SWAP(minVecGL.X, maxVecGL.X)
vis = In_Frustum(MVP, minVecGL)
If Not vis Then
vis = In_Frustum(MVP, maxVecGL)
End If
End If
End If
End If
End If
End If
Return vis
End Function
Public Shared Sub SWAP(ByRef a As String, ByRef b As String)
'Swap array pointers
Dim tmp As String
tmp = a
a = b
b = tmp
End Sub
Public Shared Sub SWAP(ByRef x(,) As Double, ByRef s(,) As Double)
'Swap array pointers
Dim tmp(,) As Double
tmp = x
x = s
s = tmp
End Sub
Public Shared Sub SWAP(ByRef a As Single, ByRef b As Single)
'Swap array pointers
Dim tmp As Single
tmp = a
a = b
b = tmp
End Sub
Public Shared Function IsBetween(ByVal v As Single, ByVal v1 As Single, ByVal v2 As Single) As Boolean
If v1 > v2 Then SWAP(v1, v2)
Return (v >= v1) And (v <= v2)
End Function
Public Shared Function IsBetween(ByVal v As Vector2, ByVal v1 As Vector2, ByVal v2 As Vector2) As Boolean
If v1.X > v2.X Then SWAP(v1.X, v2.X)
If v1.Y > v2.Y Then SWAP(v1.Y, v2.Y)
Return (v.X >= v1.X) And (v.X <= v2.X) And
(v.Y >= v1.Y) And (v.Y <= v2.Y)
End Function
Public Shared Function IsBetween(ByVal v As Vector3, ByVal v1 As Vector3, ByVal v2 As Vector3) As Boolean
If v1.X > v2.X Then SWAP(v1.X, v2.X)
If v1.Y > v2.Y Then SWAP(v1.Y, v2.Y)
If v1.Z > v2.Z Then SWAP(v1.Z, v2.Z)
Return (v.X >= v1.X) And (v.X <= v2.X) And
(v.Y >= v1.Y) And (v.Y <= v2.Y) And
(v.Z >= v1.Z) And (v.Z <= v2.Z)
End Function
Public Shared Sub ForceBetween(ByRef Val As Single, ByVal min As Single, ByVal max As Single)
If Val < min Then Val = min
If Val > max Then Val = max
End Sub
'Creates a rectangular mesh of a surface with random ripples (0...r)
Public Shared Sub cRandomSurf(ByVal ripples As Single, ByVal rows As Integer, ByVal columns As Integer, ByVal cellLength As Single, ByRef mesh(,) As Vector3, ByRef RW(,) As Single)
For r As Integer = 0 To rows - 1
For c As Integer = 0 To columns - 1
mesh(r, c).X = cellLength * r
mesh(r, c).Z = cellLength * c
RW(r, c) = 2 * ripples * (Rnd() - 0.5F)
Next
Next
End Sub
Public Shared Sub LimitChange(ByRef befNafter As Single, ByVal target As Single, ByVal N As Integer)
If N < 1 Then N = 1
befNafter = befNafter + (target - befNafter) / N
End Sub
Public Shared Sub LimitChange(ByRef befNafter As Single, ByVal target As Single, ByVal dT_sec As Single, ByVal Tao_sec As Single)
'if dt_sec=Tao_sec ==> adjust by (1-1/e)=0.63
befNafter = befNafter + 0.63F * (target - befNafter) * dT_sec / Tao_sec
End Sub
Public Shared Sub LimitChange(ByRef befNafter As Vector3, ByVal target As Vector3, ByVal dT_sec As Single, ByVal Tao_sec As Single)
'Smooth vector change as per time constant tao
'if dt_sec=Tao_sec ==> adjust by (1-1/e)=0.63
befNafter = befNafter + 0.63F * (target - befNafter) * dT_sec / Tao_sec
End Sub
Public Shared Function ToEuler(ByVal q As Quaternion) As Vector3
'Convert to Euler angles (degrees) (from wikipedea)
Dim Pitch As Single = CSng(Math.Atan2(2 * (q.W * q.X + q.Y * q.Z), 1 - 2 * (q.X ^ 2 + q.Y ^ 2))) / PIover180 'X
Dim Yaw As Single = CSng(Math.Asin(2 * (q.W * q.Y - q.Z * q.X))) / PIover180 'Y
Dim Roll As Single = CSng(Math.Atan2(2 * (q.W * q.Z + q.X * q.Y), 1 - 2 * (q.Y ^ 2 + q.Z ^ 2))) / PIover180 'Z
Return New Vector3(Pitch, Yaw, Roll)
End Function
Public Shared Function ToEuler2(ByVal q As Quaternion) As Vector3
'Convert to Euler angles (degrees) Found this somewhere but it is not working right.
Dim q1 As Single = q.X
Dim q2 As Single = q.Y
Dim q3 As Single = q.Z
Dim q4 As Single = q.W
Dim Phi As Single = CSng(Math.Atan2(q1 * q3 + q2 * q4, q1 * q4 - q2 * q3)) / PIover180 'X
Dim Theta As Single = CSng(Math.Acos(-q1 ^ 2 - q2 ^ 2 + q3 ^ 2 + q4 ^ 2)) / PIover180 'Y
Dim Lambda As Single = CSng(Math.Atan2(q1 * q3 - q3 * q4, q2 * q3 + q1 * q4)) / PIover180 'Z
Return New Vector3(Phi, Theta, Lambda)
End Function
Public Shared Function fromEuler(ByVal Angle As Vector3) As Quaternion
Return fromEuler(Angle.X, Angle.Y, Angle.Z)
End Function
Public Shared Function fromEuler(ByVal pitch As Single, ByVal yaw As Single, ByVal roll As Single) As Quaternion
'angles in degrees
'http://content.gpwiki.org/index.php/OpenGL:Tutorials:Using_Quaternions_to_represent_rotation
'// Basically we create 3 Quaternions, one for pitch, one for yaw, one for roll
'// and multiply those together.
'// the calculation below does the same, just shorter
Dim y As Single = CSng(yaw * PIover180 / 2.0)
Dim r As Single = CSng(roll * PIover180 / 2.0)
Dim p As Single = CSng(pitch * PIover180 / 2.0)
Dim sinp As Single = CSng(Math.Sin(y))
Dim siny As Single = CSng(Math.Sin(r))
Dim sinr As Single = CSng(Math.Sin(p))
Dim cosp As Single = CSng(Math.Cos(y))
Dim cosy As Single = CSng(Math.Cos(r))
Dim cosr As Single = CSng(Math.Cos(p))
Dim q As Quaternion
q.X = sinr * cosp * cosy - cosr * sinp * siny
q.Y = cosr * sinp * cosy + sinr * cosp * siny
q.Z = cosr * cosp * siny - sinr * sinp * cosy
q.W = cosr * cosp * cosy + sinr * sinp * siny
q.Normalize()
Return q
End Function
Public Shared Function CacuNormal(ByVal v2 As Vector3, ByVal v1_common As Vector3, ByVal v0 As Vector3) As Vector3
'Common vertix is v1. This is = (v2-v1) X (v0-v1) and then normalize
Return Vector3.Normalize(Vector3.Cross((v2 - v1_common), (v0 - v1_common)))
End Function
Public Shared Sub ProjABtoXZplane(ByVal a As Vector3, ByVal b As Vector3, ByVal planeY As Single, ByRef retp As Vector3, ByRef pBetweenAB As Boolean)
'Finds the point of intersection of b - a on the XZ (y=0) plane returns the point in retp
'if plane is between a and b, returns true in IsBetween
Const zero As Single = 0.0000000001
retp = Vector3.Zero
Dim v As New Vector3((b - a))
pBetweenAB = False
If Math.Abs(v.Y) > zero Then 'NOTE: if zero==>parallel no intercept retp=0 and return false
Dim xz As Single = v.Xz.LengthFast
Dim c1 As Single = -(a.Y - b.Y) * xz / v.Y
Dim c2 As Single = -(b.Y - planeY) * xz / v.Y
retp = a
retp.Y = planeY
v.Y = 0
If v.LengthSquared > zero Then
v = GLC.setMag(v, c1 + c2)
End If
retp = (retp + v)
pBetweenAB = GLC.IsBetween(retp, a, b)
End If
End Sub
Public Shared Sub ProjABtoPlane(ByVal a As Vector3, ByVal b As Vector3, ByVal pLoc As Vector3, ByVal pAngle As Vector3, ByRef retp As Vector3, ByRef pBetweenAB As Boolean)
'pAngle in DEGREES
'planeLoc is one point of an infinite plane and pNormal is the normal of that plane at planeLoc
Dim q As Quaternion = GLC.fromEuler(pAngle)
Dim qc As Quaternion = Quaternion.Conjugate(q)
Dim aq As New Quaternion(a - pLoc, 0)
Dim bq As New Quaternion(b - pLoc, 0)
aq = q * aq * qc
bq = q * bq * qc
a = New Vector3(aq.X, aq.Y, aq.Z)
b = New Vector3(bq.X, bq.Y, bq.Z)
ProjABtoXZplane(a, b, 0, retp, pBetweenAB)
Dim q2 As Quaternion = GLC.fromEuler(-pAngle)
Dim q2c As Quaternion = Quaternion.Conjugate(q2)
Dim pq As New Quaternion(retp, 0) 'rotate back
pq = q2 * pq * q2c
retp = New Vector3(pq.X, pq.Y, pq.Z) + pLoc
End Sub
Public Shared Sub viewOrtho(ByVal UsingShaders As Boolean)
GL.MatrixMode(MatrixMode.Projection)
GL.PushMatrix()
GL.LoadIdentity()
If UsingShaders Then
GL.Ortho(0, 1, 0, 1, -1, 100) 'NOTICE zNear CAN be negative only in Ortho
Else 'for some reason I must reverse ortho view when not using shaders TODO: why?
GL.Ortho(0, 1, 1, 0, -1, 100)
End If
GL.MatrixMode(MatrixMode.Modelview)
GL.PushMatrix()
GL.LoadIdentity()
End Sub
Public Shared Sub SetMatrices(ByVal fovY As Single, ByVal aspect_ratio As Single, ByVal Near As Single, ByVal Far As Single, ByVal camera As Vector3, ByVal target As Vector3, ByVal up As Vector3)
'FOV = deg Field Of View in the Y (vertical)
Try
Dim projection As Matrix4 = Matrix4.CreatePerspectiveFieldOfView(fovY * GLC.PIover180, aspect_ratio, Near, Far)
GL.MatrixMode(MatrixMode.Projection)
GL.LoadMatrix(projection)
'Flip textures (using bmps) needed when not using shaders
If Not GLC.enableShaders Then
GL.MatrixMode(MatrixMode.Texture)
GL.LoadIdentity()
GL.Scale(1, -1, 1)
End If
GL.MatrixMode(MatrixMode.Modelview)
'Viewing tranformation
'*********************
GL.LoadIdentity()
Dim view As Matrix4
view = Matrix4.LookAt(camera, target, up)
GL.LoadMatrix(view)
'*********************
GLC.MVP = Matrix4.Mult(view, projection)
Catch ex As Exception
Throw New Exception("Error setting view port and matrix" & vbCrLf & ex.Message)
End Try
'
End Sub
Public Shared Sub viewPerspective()
GL.MatrixMode(MatrixMode.Projection)
GL.PopMatrix()
GL.MatrixMode(MatrixMode.Modelview)
GL.PopMatrix()
End Sub
Public Shared Function CleanAngle(ByVal Deg As Vector3) As Vector3
'Reduce angle to 0 to 360 only
Deg.X = (Deg.X + 360) Mod 360
Deg.Y = (Deg.Y + 360) Mod 360
Deg.Z = (Deg.Z + 360) Mod 360
Return Deg
End Function
Public Shared Function RndScaler(ByVal x As Single) As Single
Return x * (Rnd() - 0.5F)
End Function
Public Shared Sub SetV(ByRef v() As Single, ByVal i As Integer, ByVal q As Vector3)
v(i) = (q.X)
v(i + 1) = (q.Y)
v(i + 2) = (q.Z)
End Sub
Public Shared Function GetV(ByVal v() As Single, ByVal i As Integer) As Vector3
Dim q As New Vector3(v(i), v(i + 1), v(i + 2))
Return q
End Function
Public Shared Sub SmoothNormAvrg(ByRef vn() As Single, ByVal i1 As Integer, ByVal i2 As Integer, ByVal i3 As Integer, ByVal i4 As Integer)
'Will give the appearance of a 'smooth' surface rather than 'flat' quads or triangles.
'Valid ONLY for rectangular mesh. Normals must be "normalized" (mag=1)
' c
' i1 | i2
'r ---------
' i3 | i4
'Add 4 normals to average
vn(i1 * 3) += vn(i2 * 3) + vn(i3 * 3) + vn(i4 * 3) 'x
vn(i1 * 3 + 1) += vn(i2 * 3 + 1) + vn(i3 * 3 + 1) + vn(i4 * 3 + 1) 'y
vn(i1 * 3 + 2) += vn(i2 * 3 + 2) + vn(i3 * 3 + 2) + vn(i4 * 3 + 2) 'z
'To normalize I just need to divide by 4 as vectors above had magnitude=1
vn(i1 * 3) /= 4 'x
vn(i1 * 3 + 1) /= 4 'y
vn(i1 * 3 + 2) /= 4 'z
'Set all the same
vn(i2 * 3) = vn(i1 * 3) : vn(i2 * 3 + 1) = vn(i1 * 3 + 1) : vn(i2 * 3 + 2) = vn(i1 * 3 + 2)
vn(i3 * 3) = vn(i1 * 3) : vn(i3 * 3 + 1) = vn(i1 * 3 + 1) : vn(i3 * 3 + 2) = vn(i1 * 3 + 2)
vn(i4 * 3) = vn(i1 * 3) : vn(i4 * 3 + 1) = vn(i1 * 3 + 1) : vn(i4 * 3 + 2) = vn(i1 * 3 + 2)
End Sub
#Region "LightsAndView"
Public Structure LightsProperties
Dim LightsOn As Boolean
Dim Infinity As Boolean
Dim ambient As Single
Dim diffuse As Single
Dim specular As Single
Dim shine As Single
Dim position As Vector4
End Structure
Public Shared Sub LightsOnOff(ByVal props As LightsProperties, ByVal RGB As Vector4)
'For efficiency, you don't always have to 'reset lights', only when something related to lights changed:
'=================================
If props.LightsOn Then
Dim a As Single = props.ambient
Dim d As Single = props.diffuse
Dim s As Single = props.specular
Dim ambL As OpenTK.Vector4 = New Vector4(a * RGB.X, a * RGB.Y, a * RGB.Z, 1)
Dim difL As OpenTK.Vector4 = New Vector4(d, d, d, 1)
Dim speL As OpenTK.Vector4 = New Vector4(s, s, s, 1)
Dim w As Single = 1.0 'when w=0 light position is in infinity (parallel rays)
If props.Infinity Then w = 0 'directional light. In that case lightL vector is the DIRECTION.
'******************
Dim posL As Vector4 = New Vector4(props.position.X, props.position.Y, props.position.Z, w) 'light positive left of the object (- X)
'Dim spotDir() As Single = {0, 0, -1}
'******************
GL.Light(LightName.Light0, LightParameter.Ambient, ambL)
GL.Light(LightName.Light0, LightParameter.Diffuse, difL)
GL.Light(LightName.Light0, LightParameter.Specular, speL)
GL.Light(LightName.Light0, LightParameter.Position, posL)
'GL.Light(LightName.Light0, LightParameter.SpotDirection, -posL)
GL.Enable(EnableCap.Lighting)
GL.Enable(EnableCap.Light0)
GL.Enable(EnableCap.DepthTest)
'
GL.ShadeModel(ShadingModel.Smooth)
GL.Material(MaterialFace.Front, MaterialParameter.AmbientAndDiffuse, Color.White) 'all the object will be white
GL.Material(MaterialFace.Front, MaterialParameter.Shininess, props.shine) 'from 0 to 128 (0 is the MAX)
GL.Disable(EnableCap.ColorMaterial)
Else ' Lights are off
GL.Disable(EnableCap.ColorMaterial)
GL.Disable(EnableCap.Lighting)
GL.Disable(EnableCap.Light0)
GL.Disable(EnableCap.DepthTest)
End If
End Sub
#End Region
End Class
|
' Author: Keith Smith
' Date: 7 November 2018
' Description: This file holds class information for a student book sale that reflects a 15% discount
' compared to a standard book sale object
Public Class StudentBookSale
Inherits BookSale
' Student Discount %
Const STUDENT_DISCOUNT_PERCENT_Decimal As Decimal = 0.15D
' Create shared accumulator variable to hold total discount amount
Private Shared TotalStudentDiscountDecimal As Decimal
' Create shared read-only property so that accumulator property can be accessed
' to show in summary window. Needs to be shared so that property can be accessed
' at the OBJECT level, not at the individual INSTANTIATED level
Public Shared ReadOnly Property TotalStudentDiscountPrice() As Decimal
Get
Return TotalStudentDiscountDecimal
End Get
End Property
Public Sub New(ByVal _TitleIn As String, ByVal _QuantityIn As Integer, ByVal _PriceIn As Decimal)
' Assign the property Values.
MyBase.New(_TitleIn, _QuantityIn, _PriceIn)
End Sub
Protected Overrides Sub CalculateExtendedPrice()
' Calculate extended price using base class...
MyBase.CalculateExtendedPrice()
' ...apply student discount
MyBase.ExtendedPrice -= CalculateStudentDiscount()
End Sub
' This function calculates the student discount, adds it to the shared accumulator property,
' and returns the calculated value for use in logic
Private Function CalculateStudentDiscount() As Decimal
' Create variable to hold calculated discount amount
Dim DiscountAmountDecimal As Decimal
' Calculate student discount
DiscountAmountDecimal = MyBase.ExtendedPrice * STUDENT_DISCOUNT_PERCENT_Decimal
' Update shared accumulator
TotalStudentDiscountDecimal += DiscountAmountDecimal
' Return discount amount
Return DiscountAmountDecimal
End Function
End Class
|
Imports System.Collections.ObjectModel
Imports System.ComponentModel
Imports System.Runtime.CompilerServices
Public Class ViewModel
Implements INotifyPropertyChanged
<DebuggerBrowsable(DebuggerBrowsableState.Never)>
Private Shared _Instance As ViewModel = New ViewModel()
Public Shared ReadOnly Property Instance As ViewModel
Get
Return (_Instance)
End Get
End Property
<DebuggerBrowsable(DebuggerBrowsableState.Never)>
Private _Blocks As BlockCollection = New BlockCollection()
Public ReadOnly Property Blocks As BlockCollection
Get
Return (Me._Blocks)
End Get
End Property
<DebuggerBrowsable(DebuggerBrowsableState.Never)>
Private _DragDrop As DragDrop = New DragDrop()
Public ReadOnly Property DragDrop As DragDrop
Get
Return (Me._DragDrop)
End Get
End Property
Public Sub Init()
Dim width As Double = 65
Dim height As Double = 65
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector1.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector2.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector3.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector4.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector5.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector6.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector7.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector8.png")
Me.Blocks.AddItem("/WpfDragAndDrop;component/Resources/Hector9.png")
End Sub
#Region "Property Changed Stuff"
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Private Sub NotifyPropertyChanged(propertyName As String)
RaiseEvent PropertyChanged(Me, New PropertyChangedEventArgs(propertyName))
End Sub
#End Region
End Class |
Imports System.Runtime.Serialization.Formatters.Binary
Imports System.IO
Public Class DeepCopy
Public Shared Function Make(Of T)(ByVal objToClone As Object) As T
Using ms As New MemoryStream
Dim bf As New BinaryFormatter
bf.Serialize(ms, objToClone)
ms.Position = 0
Return CType(bf.Deserialize(ms), T)
End Using
End Function
End Class
|
Imports BVSoftware.Bvc5.Core
Imports BvLicensing
Imports System.IO
Imports System.Collections.ObjectModel
Partial Class BVAdmin_Configuration_License
Inherits System.Web.UI.Page
Protected Sub Page_PreInit1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
Me.Page.Title = "License"
Session("ActiveAdminTab") = AdminTabType.Configuration
ValidateCurrentUserHasPermission(Membership.SystemPermissions.SettingsView)
End Sub
Public Sub ValidateCurrentUserHasPermission(ByVal p As String)
Dim l As New Collection(Of String)
l.Add(p)
ValidateCurrentUserHasPermissions(l)
End Sub
Public Sub ValidateCurrentUserHasPermissions(ByVal p As Collection(Of String))
If SessionManager.IsUserAuthenticated = False Then
' Send to Login Page
Response.Redirect("~/BVAdmin/Login.aspx?ReturnUrl=" & HttpUtility.UrlEncode(Me.Request.RawUrl))
Else
If Membership.UserAccount.DoesUserHaveAllPermissions(SessionManager.GetCurrentUserId, p) = False Then
' Send to no permissions page
Response.Redirect("~/nopermissions.aspx")
End If
End If
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
If Membership.UserAccount.DoesUserHavePermission(SessionManager.GetCurrentUserId, Membership.SystemPermissions.SettingsEdit) = False Then
Me.btnUploadLicense.Enabled = False
End If
CheckLicense()
End If
End Sub
Private Sub CheckLicense()
Dim data As String = WebAppSettings.LicenseData
If data.Trim.Length < 1 Then
msg.ShowInformation("No license is installed. Please upload your license using the form below.")
Exit Sub
End If
Dim l As New LicenseKey
l.LoadFromString(WebAppSettings.LicenseData)
If l.LicenseVersion = String.Empty Then
Me.LicenseVersionField.Text = "Invalid Data"
Else
Me.LicenseVersionField.Text = l.LicenseVersion
End If
If l.ProductName = String.Empty Then
Me.ProductNameField.Text = "Invalid Data"
Else
Me.ProductNameField.Text = TaskLoader.Brand.ApplicationName
End If
If l.ProductVersion = String.Empty Then
Me.ProductVersionField.Text = "Invalid Data"
Else
Me.ProductVersionField.Text = l.ProductVersion
End If
If l.ProductType = String.Empty Then
Me.ProductTypeField.Text = "Invalid Data"
Else
Me.ProductTypeField.Text = l.ProductType
End If
If l.CustomerName = String.Empty Then
Me.CustomerNameField.Text = "Invalid Data"
Else
Me.CustomerNameField.Text = l.CustomerName
End If
If l.CustomerEmail = String.Empty Then
Me.CustomerEmailField.Text = "Invalid Data"
Else
Me.CustomerEmailField.Text = l.CustomerEmail
End If
If l.WebSite = String.Empty Then
Me.WebSiteField.Text = ""
Else
Me.WebSiteField.Text = l.WebSite
End If
If l.SerialNumber = String.Empty Then
Me.SerialNumberField.Text = "Invalid Data"
Else
Me.SerialNumberField.Text = l.SerialNumber
End If
If l.Perpetual = True Then
Me.lblExpires.Text = "Never"
Else
Me.lblExpires.Text = l.Expires.ToString
End If
If l.IsValid = True Then
msg.ShowOk("License appears to be valid.")
Else
If l.IsExpired = True Then
msg.ShowError(String.Format("License has expired. <a href=""{0}"">Contact BV Commerce</a> for assistance.", TaskLoader.Brand().SupportWebSite))
Else
msg.ShowError(String.Format("License does not appear to be valid. Contact <a href=""{0}"">BV Commerce</a> for assistance.", TaskLoader.Brand().SupportWebSite))
End If
End If
End Sub
Protected Sub btnUploadLicense_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUploadLicense.Click
If Me.FileUpload1.FileName.Trim.Length > 0 Then
Dim sr As New StreamReader(Me.FileUpload1.PostedFile.InputStream)
Dim output As String = sr.ReadToEnd()
WebAppSettings.LicenseData = output
Response.Redirect("~/BVAdmin/Configuration/License.aspx")
End If
End Sub
End Class
|
''Class Definition - CostBook (to CostBook)'Generated from Table:CostBook
Imports RTIS.CommonVB
Public Class dmCostBook : Inherits dmBase
Implements iValueItem
Private pCostBookID As Int32
Private pCostBookName As String
Private pCostBookDate As DateTime
Private pIsDefault As Boolean
Private pDirectLabourCost As Decimal
Private pDirectLabourMarkUp As Decimal
Private pOverheadperItem As Decimal
Private pCostBookEntrys As colCostBookEntrys
Public Sub New()
MyBase.New()
End Sub
Protected Overrides Sub NewSetup()
''Add object/collection instantiations here
pCostBookEntrys = New colCostBookEntrys
End Sub
Protected Overrides Sub AddSnapshotKeys()
''Add PrimaryKey, Rowversion and ParentKeys properties here:
''AddSnapshotKey("PropertyName")
End Sub
Protected Overrides Sub Finalize()
pCostBookEntrys = Nothing
MyBase.Finalize()
End Sub
Public Overrides ReadOnly Property IsAnyDirty() As Boolean
Get
Dim mAnyDirty = IsDirty
'' Check Objects and Collections
If mAnyDirty = False Then mAnyDirty = pCostBookEntrys.IsDirty
IsAnyDirty = mAnyDirty
End Get
End Property
Public Overrides Sub ClearKeys()
'Set Key Values = 0
CostBookID = 0
End Sub
Public Overrides Sub CloneTo(ByRef rNewItem As dmBase)
With CType(rNewItem, dmCostBook)
.CostBookID = CostBookID
.CostBookName = CostBookName
.CostBookDate = CostBookDate
.IsDefault = IsDefault
.DirectLabourCost = DirectLabourCost
.DirectLabourMarkUp = DirectLabourMarkUp
.OverheadperItem = OverheadperItem
.CostBookEntrys = CostBookEntrys
'Add entries here for each collection and class property
'Entries for object management
.IsDirty = IsDirty
End With
End Sub
Public Property CostBookID() As Int32 Implements iValueItem.ItemValue
Get
Return pCostBookID
End Get
Set(ByVal value As Int32)
If pCostBookID <> value Then IsDirty = True
pCostBookID = value
End Set
End Property
Public Property CostBookName() As String Implements iValueItem.DisplayValue
Get
Return pCostBookName
End Get
Set(ByVal value As String)
If pCostBookName <> value Then IsDirty = True
pCostBookName = value
End Set
End Property
Public Property CostBookDate() As DateTime
Get
Return pCostBookDate
End Get
Set(ByVal value As DateTime)
If pCostBookDate <> value Then IsDirty = True
pCostBookDate = value
End Set
End Property
Public Property IsDefault() As Boolean
Get
Return pIsDefault
End Get
Set(ByVal value As Boolean)
If pIsDefault <> value Then IsDirty = True
pIsDefault = value
End Set
End Property
Public Property DirectLabourCost() As Decimal
Get
Return pDirectLabourCost
End Get
Set(ByVal value As Decimal)
If pDirectLabourCost <> value Then IsDirty = True
pDirectLabourCost = value
End Set
End Property
Public Property DirectLabourMarkUp() As Decimal
Get
Return pDirectLabourMarkUp
End Get
Set(ByVal value As Decimal)
If pDirectLabourMarkUp <> value Then IsDirty = True
pDirectLabourMarkUp = value
End Set
End Property
Public Property OverheadperItem() As Decimal
Get
Return pOverheadperItem
End Get
Set(ByVal value As Decimal)
If pOverheadperItem <> value Then IsDirty = True
pOverheadperItem = value
End Set
End Property
Public Property CostBookEntrys As colCostBookEntrys
Get
Return pCostBookEntrys
End Get
Set(value As colCostBookEntrys)
pCostBookEntrys = value
End Set
End Property
Public Property ArchiveOnly As Boolean Implements iValueItem.ArchiveOnly
Get
End Get
Set(value As Boolean)
End Set
End Property
End Class
''Collection Definition - CostBook (to CostBook)'Generated from Table:CostBook
'Private pCostBooks As colCostBooks
'Public Property CostBooks() As colCostBooks
' Get
' Return pCostBooks
' End Get
' Set(ByVal value As colCostBooks)
' pCostBooks = value
' End Set
'End Property
' pCostBooks = New colCostBooks 'Add to New
' pCostBooks = Nothing 'Add to Finalize
' .CostBooks = CostBooks.Clone 'Add to CloneTo
' CostBooks.ClearKeys 'Add to ClearKeys
' If Not mAnyDirty Then mAnyDirty = CostBooks.IsDirty 'Add to IsAnyDirty
Public Class colCostBooks : Inherits colBase(Of dmCostBook)
Public Overrides Function IndexFromKey(ByVal vCostBookID As Integer) As Integer
Dim mItem As dmCostBook
Dim mIndex As Integer = -1
Dim mCount As Integer = -1
For Each mItem In MyBase.Items
mCount += 1
If mItem.CostBookID = vCostBookID Then
mIndex = mCount
Exit For
End If
Next
Return mIndex
End Function
Public Sub New()
MyBase.New()
End Sub
Public Sub New(ByVal vList As List(Of dmCostBook))
MyBase.New(vList)
End Sub
End Class
|
Imports System.Net
Imports System.Web.Script.Serialization
Public Class GoogleBookAPI
Public Shared Function GetBookInfos(isbn As String) As GBookInfos
Dim result As GBookInfos = Nothing
Dim url As String = "https://www.googleapis.com/books/v1/volumes?q=isbn:" & isbn & "&key=AIzaSyB3Z8f544fCYBe7eElVJUoh4N-RIZWAi3k"
Dim json As String
Dim booksInfos As GBooksInfos
Using client As New WebClient()
json = client.DownloadString(url)
booksInfos = (New JavaScriptSerializer()).Deserialize(Of GBooksInfos)(json)
End Using
If (booksInfos.Items IsNot Nothing) AndAlso (booksInfos.Items.Count > 0) Then
result = booksInfos.Items(0)
End If
Return result
End Function
End Class
|
Public NotInheritable Class Splash
Private Sub Splash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Application title
'If My.Application.Info.Title <> "" Then
' ApplicationTitle.Text = My.Application.Info.Title
'Else
'If the application title is missing, use the application name, without the extension
ApplicationTitle.Text = "Templos"
' End If
Version.Text = System.String.Format(Version.Text, My.Application.Info.Version.Major, My.Application.Info.Version.Minor)
'Copyright info
Copyright.Text = My.Application.Info.Copyright
'MarcaDataInstala()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Frm_Login.Show()
' Me.Visible = False
End Sub
End Class
|
'
' Copyright (C) 2009 SpeedCS Team
' http://streamboard.gmc.to
'
' This Program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to
' the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
' http://www.gnu.org/copyleft/gpl.html
'
'
'Imports System
'Imports System.Net
'Imports System.Net.Sockets
'Imports System.Text
'Imports System.Threading
'Imports Microsoft.VisualBasic
'Public Class AsynchronousSocketListener
' ' Thread signal.
' Public Shared allDone As New ManualResetEvent(False)
' ' This server waits for a connection and then uses asychronous operations to
' ' accept the connection, get data from the connected client,
' ' echo that data back to the connected client.
' ' It then disconnects from the client and waits for another client.
' Public Shared Sub Main()
' ' Data buffer for incoming data.
' Dim bytes() As Byte = New [Byte](1023) {}
' ' Establish the local endpoint for the socket.
' Dim ipHostInfo As IPHostEntry = Dns.Resolve(Dns.GetHostName())
' Dim ipAddress As IPAddress = ipHostInfo.AddressList(0)
' Dim localEndPoint As New IPEndPoint(ipAddress, 11000)
' ' Create a TCP/IP socket.
' Dim listener As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)
' ' Bind the socket to the local endpoint and listen for incoming connections.
' listener.Bind(localEndPoint)
' listener.Listen(100)
' While True
' ' Set the event to nonsignaled state.
' allDone.Reset()
' ' Start an asynchronous socket to listen for connections.
' Console.WriteLine("Waiting for a connection...")
' listener.BeginAccept(New AsyncCallback(AddressOf AcceptCallback), listener)
' ' Wait until a connection is made and processed before continuing.
' allDone.WaitOne()
' End While
' End Sub 'Main
' Public Shared Sub AcceptCallback(ByVal ar As IAsyncResult)
' ' Get the socket that handles the client request.
' Dim listener As Socket = CType(ar.AsyncState, Socket)
' ' End the operation.
' Dim handler As Socket = listener.EndAccept(ar)
' ' Create the state object for the async receive.
' Dim state As New StateObject
' state.workSocket = handler
' handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReadCallback), state)
' End Sub 'AcceptCallback
' Public Shared Sub ReadCallback(ByVal ar As IAsyncResult)
' Dim content As String = String.Empty
' ' Retrieve the state object and the handler socket
' ' from the asynchronous state object.
' Dim state As StateObject = CType(ar.AsyncState, StateObject)
' Dim handler As Socket = state.workSocket
' ' Read data from the client socket.
' Dim bytesRead As Integer = handler.EndReceive(ar)
' If bytesRead > 0 Then
' ' There might be more data, so store the data received so far.
' state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead))
' ' Check for end-of-file tag. If it is not there, read
' ' more data.
' content = state.sb.ToString()
' If content.IndexOf("<EOF>") > -1 Then
' ' All the data has been read from the
' ' client. Display it on the console.
' Console.WriteLine("Read {0} bytes from socket. " + vbLf + " Data : {1}", content.Length, content)
' ' Echo the data back to the client.
' Send(handler, content)
' Else
' ' Not all data received. Get more.
' handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, New AsyncCallback(AddressOf ReadCallback), state)
' End If
' End If
' End Sub 'ReadCallback
' Private Shared Sub Send(ByVal handler As Socket, ByVal data As String)
' ' Convert the string data to byte data using ASCII encoding.
' Dim byteData As Byte() = Encoding.ASCII.GetBytes(data)
' ' Begin sending the data to the remote device.
' handler.BeginSend(byteData, 0, byteData.Length, 0, New AsyncCallback(AddressOf SendCallback), handler)
' End Sub 'Send
' Private Shared Sub SendCallback(ByVal ar As IAsyncResult)
' ' Retrieve the socket from the state object.
' Dim handler As Socket = CType(ar.AsyncState, Socket)
' ' Complete sending the data to the remote device.
' Dim bytesSent As Integer = handler.EndSend(ar)
' Console.WriteLine("Sent {0} bytes to client.", bytesSent)
' handler.Shutdown(SocketShutdown.Both)
' handler.Close()
' ' Signal the main thread to continue.
' allDone.Set()
' End Sub 'SendCallback
'End Class 'AsynchronousSocketListener
|
Namespace SwatInc
Public Class logHandler
Public Sub New(ByVal LogClassification As String, ByVal ExLogDateTime As DateTime, ByVal TargetSite As String, ByVal GetExType As String, ByVal ExMessage As String, ByVal StackTrace As String, Optional HelpLink As String = Nothing)
Log_Classification = LogClassification
Ex_Log_DateTime = ExLogDateTime
Target_Site = TargetSite
Get_Ex_Type = GetExType
Ex_Message = ExMessage
Stack_Trace = StackTrace
Help_Link = HelpLink
End Sub
Public Property Log_Classification() As String
Public Property Ex_Log_DateTime() As DateTime
Public Property Target_Site() As String
Public Property Get_Ex_Type() As String
Public Property Ex_Message() As String
Public Property Stack_Trace() As String
Public Property Help_Link() As String
End Class
End Namespace
|
Class spLotes1
inherits BasesParaCompatibilidad.sp
Public Sub New()
MyBase.New("[dbo].[Lotes1Select]", "[dbo].[Lotes1Insert]", "[dbo].[Lotes1Update]", _
"[dbo].[Lotes1Delete]", "OrdenesEnvasados2SelectDgv", String.Empty)
End Sub
Public Function Select_Record(ByVal LoteID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As DBO_Lotes1
dtb.Conectar()
Dim DBO_Lotes1 As New DBO_Lotes1
Dim selectProcedure As String = "[dbo].[Lotes1Select]"
Dim selectCommand As System.Data.SqlClient.SqlCommand = dtb.comando(selectProcedure)
selectCommand.CommandType = CommandType.StoredProcedure
selectCommand.Parameters.AddWithValue("@LoteID", LoteID)
Try
Dim reader As System.Data.SqlClient.SqlDataReader = selectCommand.ExecuteReader(CommandBehavior.SingleRow)
If reader.Read Then
DBO_Lotes1.LoteID = If(reader("LoteID") Is Convert.DBNull, 0, Convert.ToInt32(reader("LoteID")))
DBO_Lotes1.Referencia = If(reader("Referencia") Is Convert.DBNull, 0, Convert.ToInt32(reader("Referencia")))
DBO_Lotes1.Descripcion = If(reader("Descripcion") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Descripcion")))
DBO_Lotes1.Fecha = If(reader("Fecha") Is Convert.DBNull, System.DateTime.Now.Date, CDate(reader("Fecha")))
DBO_Lotes1.CantidadRestante = System.Convert.ToDouble(If(reader("CantidadRestante") Is Convert.DBNull, 0, reader("CantidadRestante")))
DBO_Lotes1.Observacion = If(reader("Observacion") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Observacion")))
DBO_Lotes1.LoteProveedor = If(reader("LoteProveedor") Is Convert.DBNull, String.Empty, Convert.ToString(reader("LoteProveedor")))
DBO_Lotes1.Botellas = If(reader("Botellas") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Botellas")))
DBO_Lotes1.CantidadID = If(reader("CantidadID") Is Convert.DBNull, 0, Convert.ToInt32(reader("CantidadID")))
DBO_Lotes1.MedidaID = If(reader("MedidaID") Is Convert.DBNull, 0, Convert.ToInt32(reader("MedidaID")))
DBO_Lotes1.EspecificacionID = If(reader("EspecificacionID") Is Convert.DBNull, 0, Convert.ToInt32(reader("EspecificacionID")))
DBO_Lotes1.TipoLoteID = If(reader("TipoLoteID") Is Convert.DBNull, 0, Convert.ToInt32(reader("TipoLoteID")))
DBO_Lotes1.TipoProductoID = If(reader("TipoProductoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("TipoProductoID")))
DBO_Lotes1.CorredorID = If(reader("CorredorID") Is Convert.DBNull, 0, Convert.ToInt32(reader("CorredorID")))
DBO_Lotes1.ProveedorID = If(reader("ProveedorID") Is Convert.DBNull, 0, Convert.ToInt32(reader("ProveedorID")))
DBO_Lotes1.LoteConjuntoCompraID = If(reader("LoteConjuntoCompraID") Is Convert.DBNull, 0, Convert.ToInt32(reader("LoteConjuntoCompraID")))
DBO_Lotes1.CodigoLote = If(reader("CodigoLote") Is Convert.DBNull, String.Empty, Convert.ToString(reader("CodigoLote")))
DBO_Lotes1.DepositoID = If(reader("DepositoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("DepositoID")))
DBO_Lotes1.DepositoPrevioID = If(reader("DepositoPrevioID") Is Convert.DBNull, 0, Convert.ToInt32(reader("DepositoPrevioID")))
DBO_Lotes1.Revisar = If(reader("Revisar") Is Convert.DBNull, False, Convert.ToBoolean(reader("Revisar")))
DBO_Lotes1.RecipienteSalidaID = If(reader("RecipienteSalidaID") Is Convert.DBNull, 0, Convert.ToInt32(reader("RecipienteSalidaID")))
DBO_Lotes1.FechaModificacion = If(reader("FechaModificacion") Is Convert.DBNull, System.DateTime.Now.Date, CDate(reader("FechaModificacion")))
DBO_Lotes1.UsuarioModificacion = If(reader("UsuarioModificacion") Is Convert.DBNull, 0, Convert.ToInt32(reader("UsuarioModificacion")))
DBO_Lotes1.Identificador = If(reader("Identificador") Is Convert.DBNull, "", Convert.ToString(reader("Identificador")))
If Convert.IsDBNull(reader("Caducidad")) Then
DBO_Lotes1.Caducidad = Nothing
Else
DBO_Lotes1.Caducidad = CType(reader("Caducidad"), Date)
End If
Else
DBO_Lotes1 = Nothing
End If
reader.Close()
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
Return DBO_Lotes1
End Function
Public Function Select_Record(ByVal codigoLote As String, ByRef dtb As BasesParaCompatibilidad.DataBase) As DBO_Lotes1
dtb.Conectar()
Dim DBO_Lotes1 As New DBO_Lotes1
Dim selectProcedure As String = "[dbo].[Lotes1SelectPorCodigoLote]"
Dim selectCommand As System.Data.SqlClient.SqlCommand = dtb.comando(selectProcedure)
selectCommand.CommandType = CommandType.StoredProcedure
selectCommand.Parameters.AddWithValue("@codigoLote", codigoLote)
Try
Dim reader As System.Data.SqlClient.SqlDataReader = selectCommand.ExecuteReader()
If reader.Read Then
DBO_Lotes1.LoteID = If(reader("LoteID") Is Convert.DBNull, 0, Convert.ToInt32(reader("LoteID")))
DBO_Lotes1.Referencia = If(reader("Referencia") Is Convert.DBNull, 0, Convert.ToInt32(reader("Referencia")))
DBO_Lotes1.Descripcion = If(reader("Descripcion") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Descripcion")))
DBO_Lotes1.Fecha = If(reader("Fecha") Is Convert.DBNull, System.DateTime.Now.Date, CDate(reader("Fecha")))
DBO_Lotes1.CantidadRestante = System.Convert.ToDouble(If(reader("CantidadRestante") Is Convert.DBNull, 0, reader("CantidadRestante")))
DBO_Lotes1.Observacion = If(reader("Observacion") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Observacion")))
DBO_Lotes1.LoteProveedor = If(reader("LoteProveedor") Is Convert.DBNull, String.Empty, Convert.ToString(reader("LoteProveedor")))
DBO_Lotes1.Botellas = If(reader("Botellas") Is Convert.DBNull, String.Empty, Convert.ToString(reader("Botellas")))
DBO_Lotes1.CantidadID = If(reader("CantidadID") Is Convert.DBNull, 0, Convert.ToInt32(reader("CantidadID")))
DBO_Lotes1.MedidaID = If(reader("MedidaID") Is Convert.DBNull, 0, Convert.ToInt32(reader("MedidaID")))
DBO_Lotes1.EspecificacionID = If(reader("EspecificacionID") Is Convert.DBNull, 0, Convert.ToInt32(reader("EspecificacionID")))
DBO_Lotes1.TipoLoteID = If(reader("TipoLoteID") Is Convert.DBNull, 0, Convert.ToInt32(reader("TipoLoteID")))
DBO_Lotes1.TipoProductoID = If(reader("TipoProductoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("TipoProductoID")))
DBO_Lotes1.CorredorID = If(reader("CorredorID") Is Convert.DBNull, 0, Convert.ToInt32(reader("CorredorID")))
DBO_Lotes1.ProveedorID = If(reader("ProveedorID") Is Convert.DBNull, 0, Convert.ToInt32(reader("ProveedorID")))
DBO_Lotes1.LoteConjuntoCompraID = If(reader("LoteConjuntoCompraID") Is Convert.DBNull, 0, Convert.ToInt32(reader("LoteConjuntoCompraID")))
DBO_Lotes1.CodigoLote = If(reader("CodigoLote") Is Convert.DBNull, String.Empty, Convert.ToString(reader("CodigoLote")))
DBO_Lotes1.DepositoID = If(reader("DepositoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("DepositoID")))
DBO_Lotes1.DepositoPrevioID = If(reader("DepositoPrevioID") Is Convert.DBNull, 0, Convert.ToInt32(reader("DepositoPrevioID")))
DBO_Lotes1.Revisar = If(reader("Revisar") Is Convert.DBNull, False, Convert.ToBoolean(reader("Revisar")))
DBO_Lotes1.RecipienteSalidaID = If(reader("RecipienteSalidaID") Is Convert.DBNull, 0, Convert.ToInt32(reader("RecipienteSalidaID")))
DBO_Lotes1.FechaModificacion = If(reader("FechaModificacion") Is Convert.DBNull, System.DateTime.Now.Date, CDate(reader("FechaModificacion")))
DBO_Lotes1.UsuarioModificacion = If(reader("UsuarioModificacion") Is Convert.DBNull, 0, Convert.ToInt32(reader("UsuarioModificacion")))
DBO_Lotes1.Identificador = If(reader("Identificador") Is Convert.DBNull, "", Convert.ToString(reader("Identificador")))
If Convert.IsDBNull(reader("Caducidad")) Then
DBO_Lotes1.Caducidad = Nothing
Else
DBO_Lotes1.Caducidad = CType(reader("Caducidad"), Date)
End If
Else
DBO_Lotes1 = Nothing
End If
reader.Close()
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
Return DBO_Lotes1
End Function
Public Function Lotes1Insert(ByVal dbo_Lotes1 As DBO_Lotes1, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim insertProcedure As String = "[dbo].[Lotes1Insert]"
Dim insertCommand As System.Data.SqlClient.SqlCommand = dtb.comando(insertProcedure)
insertCommand.CommandType = CommandType.StoredProcedure
insertCommand.Parameters.AddWithValue("@Referencia", If(dbo_Lotes1.Referencia.HasValue, dbo_Lotes1.Referencia, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@Descripcion", If(String.IsNullOrEmpty(dbo_Lotes1.Descripcion), Convert.DBNull, dbo_Lotes1.Descripcion))
insertCommand.Parameters.AddWithValue("@Fecha", If(dbo_Lotes1.Fecha.HasValue, dbo_Lotes1.Fecha, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@CantidadRestante", dbo_Lotes1.CantidadRestante)
insertCommand.Parameters.AddWithValue("@Observacion", If(String.IsNullOrEmpty(dbo_Lotes1.Observacion), Convert.DBNull, dbo_Lotes1.Observacion))
insertCommand.Parameters.AddWithValue("@LoteProveedor", If(String.IsNullOrEmpty(dbo_Lotes1.LoteProveedor), Convert.DBNull, dbo_Lotes1.LoteProveedor))
insertCommand.Parameters.AddWithValue("@Botellas", If(String.IsNullOrEmpty(dbo_Lotes1.Botellas), Convert.DBNull, dbo_Lotes1.Botellas))
insertCommand.Parameters.AddWithValue("@CantidadID", If(dbo_Lotes1.CantidadID.HasValue, dbo_Lotes1.CantidadID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@MedidaID", If(dbo_Lotes1.MedidaID.HasValue, dbo_Lotes1.MedidaID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@EspecificacionID", If(dbo_Lotes1.EspecificacionID.HasValue, dbo_Lotes1.EspecificacionID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@TipoLoteID", If(dbo_Lotes1.TipoLoteID.HasValue, dbo_Lotes1.TipoLoteID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@TipoProductoID", If(dbo_Lotes1.TipoProductoID.HasValue, dbo_Lotes1.TipoProductoID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@CorredorID", If(dbo_Lotes1.CorredorID.HasValue, dbo_Lotes1.CorredorID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@ProveedorID", If(dbo_Lotes1.ProveedorID.HasValue, dbo_Lotes1.ProveedorID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@LoteConjuntoCompraID", If(dbo_Lotes1.LoteConjuntoCompraID.HasValue, dbo_Lotes1.LoteConjuntoCompraID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@CodigoLote", dbo_Lotes1.CodigoLote)
insertCommand.Parameters.AddWithValue("@DepositoID", If(dbo_Lotes1.DepositoID.HasValue, dbo_Lotes1.DepositoID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@DepositoPrevioID", If(dbo_Lotes1.DepositoPrevioID.HasValue, dbo_Lotes1.DepositoPrevioID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@Revisar", If(dbo_Lotes1.Revisar.HasValue, dbo_Lotes1.Revisar, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@RecipienteSalidaID", If(dbo_Lotes1.RecipienteSalidaID.HasValue, dbo_Lotes1.RecipienteSalidaID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@FechaModificacion", dbo_Lotes1.FechaModificacion)
insertCommand.Parameters.AddWithValue("@UsuarioModificacion", dbo_Lotes1.UsuarioModificacion)
insertCommand.Parameters.AddWithValue("@Identificador", dbo_Lotes1.Identificador)
insertCommand.Parameters.AddWithValue("@Caducidad", If(dbo_Lotes1.Caducidad.Value = Nothing, Convert.DBNull, dbo_Lotes1.Caducidad))
insertCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
insertCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
insertCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(insertCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
End Function
Public Function Lotes1Update(ByVal newDBO_Lotes1 As DBO_Lotes1, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim updateProcedure As String = "[dbo].[Lotes1Update]"
Dim updateCommand As System.Data.SqlClient.SqlCommand = dtb.comando(updateProcedure)
updateCommand.CommandType = CommandType.StoredProcedure
'<Tag=[Three][Start]> -- please do not remove this line
updateCommand.Parameters.AddWithValue("@NewReferencia", If(newDBO_Lotes1.Referencia.HasValue, newDBO_Lotes1.Referencia, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewDescripcion", If(String.IsNullOrEmpty(newDBO_Lotes1.Descripcion), Convert.DBNull, newDBO_Lotes1.Descripcion))
updateCommand.Parameters.AddWithValue("@NewFecha", If(newDBO_Lotes1.Fecha.HasValue, newDBO_Lotes1.Fecha, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewCantidadRestante", newDBO_Lotes1.CantidadRestante)
updateCommand.Parameters.AddWithValue("@NewObservacion", If(String.IsNullOrEmpty(newDBO_Lotes1.Observacion), Convert.DBNull, newDBO_Lotes1.Observacion))
updateCommand.Parameters.AddWithValue("@NewLoteProveedor", If(String.IsNullOrEmpty(newDBO_Lotes1.LoteProveedor), Convert.DBNull, newDBO_Lotes1.LoteProveedor))
updateCommand.Parameters.AddWithValue("@NewBotellas", If(String.IsNullOrEmpty(newDBO_Lotes1.Botellas), Convert.DBNull, newDBO_Lotes1.Botellas))
updateCommand.Parameters.AddWithValue("@NewCantidadID", If(newDBO_Lotes1.CantidadID.HasValue, newDBO_Lotes1.CantidadID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewMedidaID", If(newDBO_Lotes1.MedidaID.HasValue, newDBO_Lotes1.MedidaID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewEspecificacionID", If(newDBO_Lotes1.EspecificacionID.HasValue, newDBO_Lotes1.EspecificacionID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewTipoLoteID", If(newDBO_Lotes1.TipoLoteID.HasValue, newDBO_Lotes1.TipoLoteID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewTipoProductoID", If(newDBO_Lotes1.TipoProductoID.HasValue, newDBO_Lotes1.TipoProductoID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewCorredorID", If(newDBO_Lotes1.CorredorID.HasValue, newDBO_Lotes1.CorredorID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewProveedorID", If(newDBO_Lotes1.ProveedorID.HasValue, newDBO_Lotes1.ProveedorID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewLoteConjuntoCompraID", If(newDBO_Lotes1.LoteConjuntoCompraID.HasValue, newDBO_Lotes1.LoteConjuntoCompraID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewCodigoLote", newDBO_Lotes1.CodigoLote)
updateCommand.Parameters.AddWithValue("@NewDepositoID", If(newDBO_Lotes1.DepositoID.HasValue, newDBO_Lotes1.DepositoID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewDepositoPrevioID", If(newDBO_Lotes1.DepositoPrevioID.HasValue, newDBO_Lotes1.DepositoPrevioID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewRevisar", If(newDBO_Lotes1.Revisar.HasValue, newDBO_Lotes1.Revisar, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewRecipienteSalidaID", If(newDBO_Lotes1.RecipienteSalidaID.HasValue, newDBO_Lotes1.RecipienteSalidaID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewFechaModificacion", newDBO_Lotes1.FechaModificacion)
updateCommand.Parameters.AddWithValue("@NewUsuarioModificacion", newDBO_Lotes1.UsuarioModificacion)
updateCommand.Parameters.AddWithValue("@OldLoteID", newDBO_Lotes1.LoteID)
updateCommand.Parameters.AddWithValue("@Identificador", newDBO_Lotes1.Identificador)
updateCommand.Parameters.AddWithValue("@Caducidad", If(newDBO_Lotes1.Caducidad.Value = Nothing, Convert.DBNull, newDBO_Lotes1.Caducidad))
'<Tag=[Three][End]> -- please do not remove this line
updateCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
updateCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
updateCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(updateCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
MessageBox.Show("Error en UpdateLotes1" & Environment.NewLine & Environment.NewLine & ex.Message, Convert.ToString(ex.GetType))
Return False
Finally
dtb.Desconectar()
End Try
End Function
Public Function Lotes1UpdateCantidadRestante(ByVal NewLoteID As Integer, ByVal NewCantidadRestante As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim updateProcedure As String = "[dbo].[Lotes1UpdateCantidadRestante]"
Dim updateCommand As System.Data.SqlClient.SqlCommand = dtb.comando(updateProcedure)
updateCommand.CommandType = CommandType.StoredProcedure
'<Tag=[Three][Start]> -- please do not remove this line
updateCommand.Parameters.AddWithValue("@NewCantidadRestante", NewCantidadRestante)
updateCommand.Parameters.AddWithValue("@NewFechaModificacion", System.DateTime.Now)
updateCommand.Parameters.AddWithValue("@NewUsuarioModificacion", BasesParaCompatibilidad.Config.User)
updateCommand.Parameters.AddWithValue("@OldLoteID", NewLoteID)
'<Tag=[Three][End]> -- please do not remove this line
updateCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
updateCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
updateCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(updateCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
MessageBox.Show("Error en Lotes1UpdateCantidadRestante" & Environment.NewLine & Environment.NewLine & ex.Message, Convert.ToString(ex.GetType))
Return False
Finally
dtb.Desconectar()
End Try
End Function
Public Function Lotes1Delete(ByVal LoteID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim deleteProcedure As String = "[dbo].[Lotes1Delete]"
Dim deleteCommand As System.Data.SqlClient.SqlCommand = dtb.comando(deleteProcedure)
deleteCommand.CommandType = CommandType.StoredProcedure
'<Tag=[Four][Start]> -- please do not remove this line
deleteCommand.Parameters.AddWithValue("@OldLoteID", LoteID)
'<Tag=[Four][End]> -- please do not remove this line
deleteCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
deleteCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
deleteCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(deleteCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
End Function
Public Function GrabarLotes1(ByVal dbo_Lotes1 As DBO_Lotes1, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dbo_Lotes1.FechaModificacion = System.DateTime.Now.date
dbo_Lotes1.UsuarioModificacion = BasesParaCompatibilidad.Config.User
If dbo_Lotes1.LoteID = 0 Then
Return Lotes1Insert(dbo_Lotes1, dtb)
Else
Return Lotes1Update(dbo_Lotes1, dtb)
End If
End Function
Public Function CountLotesTerminadosPorTipoProducto(ByVal m_Producto As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As Integer
dtb.PrepararConsulta("LotesByTipoProducto @pro, @otro")
dtb.AņadirParametroConsulta("@pro", m_Producto)
dtb.AņadirParametroConsulta("@otro", 0)
Return dtb.Consultar().Rows.Count
End Function
Public Function DgvFillLotesTodosPorTipoProducto(ByVal m_Producto As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As System.Data.DataTable
dtb.PrepararConsulta("LotesAllByTipoProducto @pro")
dtb.AņadirParametroConsulta("@pro", m_Producto)
Return dtb.Consultar()
End Function
Public Function DgvFillLotesTerminadosPorTipoProducto(ByVal m_Producto As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As System.Data.DataTable
dtb.PrepararConsulta("LotesByTipoProducto @pro, @otro")
dtb.AņadirParametroConsulta("@pro", m_Producto)
dtb.AņadirParametroConsulta("@otro", 0)
Return dtb.Consultar
End Function
Public Function DgvFillLotesTerminadosPorTipoProductoYLote(ByVal m_Producto As Integer, ByVal LoteId As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As System.Data.DataTable
dtb.PrepararConsulta("LotesByTipoProducto @pro, @lote")
dtb.AņadirParametroConsulta("@pro", m_Producto)
dtb.AņadirParametroConsulta("@lote", LoteId)
Return dtb.Consultar()
End Function
Public Function calcularDensidad(ByVal m_LoteID As Integer, ByRef dtb As BasesParaCompatibilidad.DataBase) As Double
dtb.PrepararConsulta("LotesSelectDensidadByLoteID @id")
dtb.AņadirParametroConsulta("@id", m_LoteID)
Return dtb.Consultar().Rows(0).Item(0)
End Function
Function devolverproximocodigoLote(ByVal codigoSinLetra As String, ByRef dtb As BasesParaCompatibilidad.DataBase) As String
Dim codigo As String
Dim letra As Char
Dim letraAsc As Integer
dtb.Conectar()
Dim selectProcedure As String = "[dbo].[LotesSelectUltimoCodigo]"
Dim selectCommand As System.Data.SqlClient.SqlCommand = dtb.comando(selectProcedure)
selectCommand.CommandType = CommandType.StoredProcedure
selectCommand.Parameters.AddWithValue("@codigoLote", codigoSinLetra)
Dim reader As System.Data.SqlClient.SqlDataReader = selectCommand.ExecuteReader(CommandBehavior.SingleRow)
If reader.Read Then
codigo = (If(reader("codigoLote") Is Convert.DBNull, codigoSinLetra, reader("codigoLote"))).ToString
Else
codigo = codigoSinLetra + "0"
End If
reader.Close()
dtb.Desconectar()
letra = codigo.Substring(14, 1)
letraAsc = Asc(letra) + 1
If letraAsc = 58 Then
letraAsc = 64
ElseIf letraAsc = 90 Then
letraAsc = 97
End If
letra = ChrW(letraAsc)
codigo = codigo.Substring(0, 14) + letra
Return codigo
End Function
Public Function GuardarLoteDiferencias(ByVal m_dbo As DBO_Lotes1, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
Dim retorno As Boolean = True
Dim loteProcedencia As Integer = m_dbo.LoteID
Dim deposito As Integer
Dim spCompuestoPor As New spCompuestoPor
Dim spMovimientos1 As New spMovimientos1
'Dim codigoLote As String = m_dbo.CodigoLote
Dim cantidad As String = m_dbo.CantidadRestante
Dim m_compuestoPor As New DBO_CompuestoPor
Dim m_movimiento As New DBO_Movimientos1
Dim m_lote As DBO_Lotes1 = Me.Select_Record(m_dbo.LoteID, dtb)
m_dbo.CodigoLote = GenerarCodigoDiferencias(m_dbo.Fecha, m_dbo.CodigoLote.Substring(8, 3))
If existeLote(dtb, m_dbo.CodigoLote) Then
'seleccionar registro lote
'update cantidad = cantidad+nuevacantidad
dtb.PrepararConsulta("select LoteID, cantidadRestante from Lotes where codigoLote= @cod")
dtb.AņadirParametroConsulta("@cod", m_dbo.CodigoLote)
Dim tabla As DataTable = dtb.Consultar
Dim cantidadOriginal As Integer = tabla.Rows(0).Item(1)
m_dbo.LoteID = tabla.Rows(0).Item(0)
Me.Lotes1UpdateCantidadRestante(m_dbo.LoteID, cantidadOriginal + Convert.ToInt32(cantidad), dtb)
Else
'insertar lote
'insertar compuesto por
m_dbo.CantidadRestante = cantidad
m_dbo.TipoLoteID = 42
m_dbo.TipoProductoID = m_lote.TipoProductoID
m_dbo.LoteID = Nothing
m_dbo.UsuarioModificacion = BasesParaCompatibilidad.Config.User
m_dbo.FechaModificacion = Today.Date
retorno = retorno And Me.Lotes1Insert(m_dbo, dtb)
'm_dbo = spLotes1.Select_Record(codigoLote,dtb)
dtb.PrepararConsulta("select max(LoteID) from Lotes")
m_dbo.LoteID = dtb.Consultar().Rows(0).Item(0)
End If
deposito = m_lote.DepositoID
m_movimiento.Cantidad = cantidad
m_movimiento.ProcesoID = 11
m_movimiento.Fecha = Today
m_movimiento.SaleDepositoID = deposito
m_movimiento.UsuarioModificacion = BasesParaCompatibilidad.Config.User
m_movimiento.FechaModificacion = Today.Date
retorno = retorno And spMovimientos1.Movimientos1Insert(m_movimiento, dtb)
m_compuestoPor.Cantidad = cantidad
m_compuestoPor.LotePartida = loteProcedencia
m_compuestoPor.LoteFinal = m_dbo.LoteID
dtb.PrepararConsulta("select max(MovimientoID) from Movimientos")
m_compuestoPor.MovimientoID = dtb.Consultar().Rows(0).Item(0)
m_compuestoPor.UsuarioModificacion = BasesParaCompatibilidad.Config.User
m_compuestoPor.FechaModificacion = Today.Date
retorno = retorno And spCompuestoPor.CompuestoPorInsert(m_compuestoPor, dtb)
Me.Lotes1UpdateCantidadRestante(loteProcedencia, 0, dtb)
Return retorno
End Function
Public Function existeLote(ByRef dtb As BasesParaCompatibilidad.DataBase, ByVal lote As String) As Boolean
dtb.PrepararConsulta("select count(*) from Lotes where codigoLote= @cod")
dtb.AņadirParametroConsulta("@cod", lote)
Dim tabla As DataTable = dtb.Consultar
Return If(tabla.Rows(0).Item(0) > 0, True, False)
'dtb.Conectar
'Dim cuenta As Integer
'Dim connection As System.Data.SqlClient.SqlConnection = BasesParaCompatibilidad.BD.Cnx
'Dim selectProcedure As String = "[dbo].[Lotes1SelectCountByCodigoLote]"
'Dim selectCommand As System.Data.SqlClient.SqlCommand= dtb.comando(selectProcedure)
'selectCommand.CommandType = CommandType.StoredProcedure
'
'selectCommand.Parameters.AddWithValue("@codigoLote", lote)
'Dim reader As System.Data.SqlClient.SqlDataReader = selectCommand.ExecuteReader(CommandBehavior.SingleRow)
'If reader.Read Then
' cuenta = if(reader("cuenta") Is Convert.DBNull, 0, reader("cuenta")))
'Else
' Throw New Exception("No se pudo leer los datos")
'End If
'reader.Close()
'dtb.Desconectar
'Return if(cuenta > 0, True, False)
End Function
Public Function GenerarCodigoDiferencias(ByVal m_fecha As Date, ByVal m_Articulo As String) As String
Dim dia, mes As String
'If m_fecha.Day < 10 Then
' dia = "0" & m_fecha.Day
'Else
' dia = m_fecha.Day
'End If
dia = "01"
If m_fecha.Month < 10 Then
mes = "0" & m_fecha.Month
Else
mes = m_fecha.Month
End If
Return m_fecha.Year & mes & dia & m_Articulo & "Dif" & "1"
End Function
Public Function ActualizarCantidad(ByVal loteId As Integer, ByVal p2 As String, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.PrepararConsulta("update lotes set cantidadrestante = @can where loteID = @id")
dtb.AņadirParametroConsulta("@can", p2)
dtb.AņadirParametroConsulta("@id", loteId)
Return dtb.Execute
End Function
Public Function comprobar(ByRef dtb As BasesParaCompatibilidad.DataBase, ByVal dbo As DBO_Lotes1) As Boolean
Dim dbo_actual As DBO_Lotes1 = Me.Select_Record(dbo.LoteID, dtb)
If dbo_actual.LoteID <> dbo.LoteID Then Return False
If dbo_actual.Referencia <> dbo.Referencia Then Return False
If dbo_actual.Descripcion <> dbo.Descripcion Then Return False
If dbo_actual.Fecha <> dbo.Fecha Then Return False
If dbo_actual.CantidadRestante <> dbo.CantidadRestante Then Return False
If dbo_actual.Observacion <> dbo.Observacion Then Return False
If dbo_actual.LoteProveedor <> dbo.LoteProveedor Then Return False
If dbo_actual.Botellas <> dbo.Botellas Then Return False
If dbo_actual.CantidadID <> dbo.CantidadID Then Return False
If dbo_actual.MedidaID <> dbo.MedidaID Then Return False
If dbo_actual.EspecificacionID <> dbo.EspecificacionID Then Return False
If dbo_actual.TipoLoteID <> dbo.TipoLoteID Then Return False
If dbo_actual.TipoProductoID <> dbo.TipoProductoID Then Return False
If dbo_actual.CorredorID <> dbo.CorredorID Then Return False
If dbo_actual.ProveedorID <> dbo.ProveedorID Then Return False
If dbo_actual.LoteConjuntoCompraID <> dbo.LoteConjuntoCompraID Then Return False
If dbo_actual.CodigoLote <> dbo.CodigoLote Then Return False
If dbo_actual.DepositoID <> dbo.DepositoID Then Return False
If dbo_actual.DepositoPrevioID <> dbo.DepositoPrevioID Then Return False
If dbo_actual.Revisar <> dbo.Revisar Then Return False
If dbo_actual.RecipienteSalidaID <> dbo.RecipienteSalidaID Then Return False
If dbo_actual.Identificador <> dbo.Identificador Then Return False
If dbo_actual.Caducidad <> dbo.Caducidad Then Return False
Return True
End Function
End Class
|
Imports Microsoft.VisualBasic
Imports System
Imports System.Xml
Imports Talent.Common
Imports System.Collections.Generic
Namespace Talent.TradingPortal
Public Class XmlExternalSmartcardReprintRequest
Inherits XmlRequest
Private _productCode As String = String.Empty
Private _smartCardProperties As DESmartcard
Public Overrides Function AccessDatabase(ByVal xmlResp As XmlResponse) As XmlResponse
Dim xmlAction As XmlExternalSmartcardReprintResponse = CType(xmlResp, XmlExternalSmartcardReprintResponse)
Dim smartCardInterface As New TalentSmartcard
_smartCardProperties = New DESmartcard
_smartCardProperties.ExternalReprintRequests = New List(Of DESmartcardExternalReprint)()
Dim err As ErrorObj = Nothing
Select Case MyBase.DocumentVersion
Case Is = "1.0"
err = LoadXmlV1()
Case Else
err = New ErrorObj
With err
.ErrorMessage = "Invalid document version " & MyBase.DocumentVersion
.ErrorStatus = "XmlExternalSmartcardReprintRequest Error - Invalid Doc Version " & MyBase.DocumentVersion
.ErrorNumber = "SCEXTPRT-02"
.HasError = True
End With
End Select
If err.HasError Then
xmlResp.Err = err
Else
smartCardInterface.Settings = Settings
smartCardInterface.DE = _smartCardProperties
err = smartCardInterface.ExternalSmartcardReprintRequest
If err.HasError Or Not err Is Nothing Then
xmlResp.Err = err
End If
End If
xmlAction.ResultDataSet = smartCardInterface.ResultDataSet
xmlResp.SenderID = Settings.SenderID
xmlResp.DocumentVersion = MyBase.DocumentVersion
xmlResp.CreateResponse()
Return CType(xmlAction, XmlResponse)
End Function
Private Function LoadXmlV1() As ErrorObj
Const ModuleName As String = "LoadXmlV1"
Dim err As New ErrorObj
Dim Node1, Node2, Node3 As XmlNode
Try
For Each Node1 In xmlDoc.SelectSingleNode("//ExternalSmartcardReprintRequest").ChildNodes
Select Case Node1.Name
Case Is = "TransactionHeader"
Case Is = "SmartcardReprints"
For Each Node2 In Node1.ChildNodes
Select Case Node2.Name
Case Is = "SmartcardReprint"
Dim externalReprintReq As New DESmartcardExternalReprint
With externalReprintReq
For Each Node3 In Node2.ChildNodes
Select Case Node3.Name
Case Is = "CustomerNumber"
.PrefixedCustomerNumber = Node3.InnerText
Case Is = "RealCustomerNumber"
.CustomerNumber = Node3.InnerText
Case Is = "SmartcardNumber"
.SmartcardNumber = Node3.InnerText
Case Is = "OldCardNumber"
.OldSmartcardNumber = Node3.InnerText
Case Is = "ProductCode"
.ProductCode = Node3.InnerText
Case Is = "StadiumCode"
.StadiumCode = Node3.InnerText
Case Is = "StandCode"
.StandCode = Node3.InnerText
Case Is = "AreaCode"
.AreaCode = Node3.InnerText
Case Is = "Row"
.Row = Node3.InnerText
Case Is = "SeatNumber"
.Seat = Node3.InnerText
Case Is = "SeatSuffix"
.AlphaSeat = Node3.InnerText
End Select
Next Node3
End With
_smartCardProperties.ExternalReprintRequests.Add(externalReprintReq)
End Select
Next Node2
End Select
Next Node1
Catch ex As Exception
With err
.ErrorMessage = ex.Message
.ErrorStatus = ModuleName & " Error"
.ErrorNumber = "SCEXTPRT-01"
.HasError = True
End With
End Try
Return err
End Function
End Class
End Namespace |
Imports Microsoft.VisualBasic
Namespace TrainingV2
Public Class TrainingDelegate
Public Sub New()
End Sub
Public Sub New(ByVal name As String, ByVal company As String, ByVal yearsExperience As Integer, ByVal feePaid As Double)
_name = name
_company = company
_yearsExperience = yearsExperience
_feePaid = feePaid
End Sub
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Property Company() As String
Get
Return _company
End Get
Set(ByVal value As String)
_company = value
End Set
End Property
Public Property YearsExperience() As Integer
Get
Return _yearsExperience
End Get
Set(ByVal value As Integer)
_yearsExperience = value
End Set
End Property
Public Property FeePaid() As Double
Get
Return _feePaid
End Get
Set(ByVal value As Double)
_feePaid = value
End Set
End Property
Private _name As String
Private _company As String
Private _yearsExperience As Integer
Private _feePaid As Double
End Class
End Namespace
|
Imports System.Xml
Imports System.Configuration
Imports System.Collections.Specialized
Imports System.Configuration.ConfigurationManager
Public Class clsAppconfiguration
#Region "Objetos globales a la clase"
Private ConfigAppSettings As ConfigXmlDocument
Private Node As XmlNode = Nothing
Private mNombreArchivo As String
#End Region
#Region "Propiedades"
Public Property NombreArchivo() As String
Get
Return mNombreArchivo
End Get
Set(ByVal value As String)
mNombreArchivo = value
End Set
End Property
#End Region
''' <summary>
''' Retorna la configuración definida en la sección appSettings del archivo appconfig.
''' </summary>
''' <returns></returns>
''' <remarks></remarks>
Public Function GetAppSettings() As NameValueCollection
Try
Return AppSettings
Catch ex As Exception
Throw
End Try
End Function
''' <summary>
''' Obtiene el valor asociado a la llave especificada
''' </summary>
''' <param name="key"></param>
''' <returns></returns>
''' <remarks></remarks>
Public Function Getkey(ByVal key As String) As String
Try
Return AppSettings.Get(key)
Catch ex As Exception
Throw
End Try
End Function
''' <summary>
''' Establece el valor a la llave especificada
''' </summary>
''' <param name="key"></param>
''' <param name="Value"></param>
''' <remarks></remarks>
Public Sub Setkey(ByVal key As String, ByVal Value As String)
Dim Elemento As XmlElement
Try
Me.ConfigAppSettings.Load(Me.NombreArchivo)
Me.Node = Me.ConfigAppSettings.SelectSingleNode("//appSettings")
'--- Obtener el elemento a actualizar
Elemento = CType(Me.Node.SelectSingleNode("//add[@key='" + key + "']"), XmlElement)
'--- sí el elemnto ya existe, actualizar su valor
If Not Elemento Is Nothing Then
Elemento.SetAttribute("value", Value)
Else
'--- Crear el elemento
Elemento = Me.ConfigAppSettings.CreateElement("add")
Elemento.SetAttribute("key", key)
Elemento.SetAttribute("value", Value)
End If
'--- Actualizar el appconfig
Me.Node.AppendChild(Elemento)
Me.ConfigAppSettings.Save(Me.NombreArchivo)
'---------------
Catch ex As Exception
Throw
End Try
End Sub
End Class
|
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Namespace JhonyLopez.EmetraApp2017090.Model
Public Class SanctionType
#Region "Campos"
Private _RemissionID As Integer
Private _Description As String
Private _Import As Decimal
Private _Recurrent As String
#End Region
#Region "Llaves"
Public Overridable Property Remissions() As ICollection(Of Remission)
#End Region
#Region "Propiedades"
<Key>
Public Property RemissionID As Integer
Get
Return _RemissionID
End Get
Set(value As Integer)
_RemissionID = value
End Set
End Property
Public Property Description As String
Get
Return _Description
End Get
Set(value As String)
_Description = value
End Set
End Property
Public Property Import As Decimal
Get
Return _Import
End Get
Set(value As Decimal)
_Import = value
End Set
End Property
Public Property Recurrent As String
Get
Return _Recurrent
End Get
Set(value As String)
_Recurrent = value
End Set
End Property
#End Region
End Class
End Namespace
|
Imports LaboratorioIDR.Datos
Imports LaboratorioIDR.Negocio
Public Class FormLogIn
Private myServicioLogin As LoginService
Sub New()
InitializeComponent()
InicializarDependencias()
End Sub
Private Sub InicializarDependencias()
myServicioLogin = New LoginService(New UsuarioRepositorio())
End Sub
Private Sub BtnIngresar_Click(sender As Object, e As EventArgs) Handles BtnIngresar.Click
ControlBox = False
If TxtUsuario.Text = Nothing Or TxtContraseña.Text = Nothing Then
MessageBox.Show("Debe completar los campos Usuario y Contraseña", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
If myServicioLogin.EsUsuarioValido(TxtUsuario.Text, TxtContraseña.Text) Then
Me.Hide()
Else
MessageBox.Show("Usuario y/o Contraseña Incorrectos." & vbCrLf & " Por favor intente de nuevo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
End If
End Sub
Private Sub frm_inicioSesion_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TxtContraseña.Text = Nothing
TxtUsuario.Text = Nothing
End Sub
Private Sub BtnCancelar_Click(sender As Object, e As EventArgs) Handles BtnCancelar.Click
FormMenu.Close()
Close()
End Sub
Private Sub TextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TxtUsuario.KeyPress, TxtContraseña.KeyPress
e.Handled = SiEsEnterTab(e.KeyChar)
End Sub
End Class |
Imports System.Security.Permissions
Imports System.Runtime.Serialization
''' <summary>
''' An error prevented an event from being written to an event stream
''' </summary>
Public Class EventStreamWriteException
Inherits EventStreamExceptionBase
'TODO - Add any additional properties for write specific exceptions
Public Sub New(ByVal DomainNameIn As String,
ByVal AggregateNameIn As String,
ByVal AggregateKeyIn As String,
ByVal SequenceNumberIn As Long,
Optional ByVal MessageIn As String = "",
Optional ByVal innerExceptionIn As Exception = Nothing)
MyBase.New(DomainNameIn,
AggregateNameIn,
AggregateKeyIn,
SequenceNumberIn,
MessageIn,
innerExceptionIn)
End Sub
End Class
|
'
' Description: This main class for connecting and disconneting the
' add-in, to build and tear down the custom menu in Excel.
'
' Authors: Dennis Wallentin, www.excelkb.com
'
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Imported namespaces
'
Imports Extensibility
Imports System.Runtime.InteropServices
Imports System.IO
Imports System.Reflection
Imports Office = Microsoft.Office.Core
Imports Excel = Microsoft.Office.Interop.Excel
#Region " Read me for Add-in installation and setup information. "
' When run, the Add-in wizard prepared the registry for the Add-in.
' At a later time, if the Add-in becomes unavailable for reasons such as:
' 1) You moved this project to a computer other than which is was originally created on.
' 2) You chose 'Yes' when presented with a message asking if you wish to remove the Add-in.
' 3) Registry corruption.
' you will need to re-register the Add-in by building the $SAFEOBJNAME$Setup project,
' right click the project in the Solution Explorer, then choose install.
#End Region
<GuidAttribute("9D5657E0-301C-40F6-8D72-B4F9F003C2A2"), _
ProgIdAttribute("PETRASReportTool.Connect")> _
Public Class Connect
#Region "Implements"
Implements IDTExtensibility2
Implements Office.IRibbonExtensibility
#End Region
#Region "Module-wide variables"
#End Region
#Region "Connection and Disconnection"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: This function connect the add-in to Excel.
'
' Arguments:
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/11/08 Dennis Wallentin Ch25 Initial version
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, _
ByVal addInInst As Object, _
ByRef custom As System.Array) Implements IDTExtensibility2.OnConnection
'This is used upon checking if right version of Excel is installed or not.
Const sMESSAGEWRONGVERSION As String = "Version 2007 and later of Excel must" + vbNewLine + _
"be installed in order to proceed."
'Customized error message.
Const sERROR_MESSAGE As String = _
"An unexpected error has occured."
'Create and instantiate a new instance of the class.
Dim cMethods As New CCommonMethods()
Try
'Get a reference to Excel.
swXLApp = (CType(application, Excel.Application))
'Check to see that Excel 2007 or later is installed on the computer.
Dim shInstalled As Short = cMethods.shCheck_Excel_Version_Installed
If shInstalled = xlVersion.WrongVersion Then
'Customized message that the wrong Excel version is installed.
MessageBox.Show(text:=sMESSAGEWRONGVERSION, _
caption:=swsCaption, _
buttons:=MessageBoxButtons.OK, _
icon:=MessageBoxIcon.Stop)
End If
Catch Generalex As Exception
'Show the customized message.
MessageBox.Show(text:=sERROR_MESSAGE, _
caption:=swsCaption, _
buttons:=MessageBoxButtons.OK, _
icon:=MessageBoxIcon.Stop)
Finally
'Prepare the object for GC.
If Not IsNothing(Expression:=cMethods) Then cMethods = Nothing
End Try
End Sub
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: This function disconnect the add-in from Excel.
'
' Arguments:
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/11/08 Dennis Wallentin Ch25 Initial version
Public Sub OnDisconnection(ByVal RemoveMode As ext_DisconnectMode, _
ByRef custom As System.Array) Implements IDTExtensibility2.OnDisconnection
'Prepare the object for GC.
swXLApp = Nothing
End Sub
#End Region
#Region "Ribbon UI Handling"
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: This function read the RibbonCustom.xml file
' and is required by the IRibbonExtensibility interface.
'
' Arguments: ribbonID
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/22/08 Dennis Wallentin Ch25 Initial version
Public Function GetCustomUI(ByVal ribbonID As String) As String _
Implements Office.IRibbonExtensibility.GetCustomUI
'The resource we want to retrieve the XML markup from.
Const sResourceName As String = "RibbonCustom.xml"
'Variable for iterating the collection of resources.
Dim sName As String = Nothing
'Set a reference to this assembly during runtime.
Dim asm As Assembly = Assembly.GetExecutingAssembly()
'Get the collection of resource names in this assembly.
Dim ResourceNames() As String = asm.GetManifestResourceNames()
'Iterate through the collection until it finds the resource
'named RibbonCustom.xml.
For Each sName In ResourceNames
If sName.EndsWith(sResourceName) Then
'Create an instance of the StremReader object that
'reads the embedded file containing the XML markup.
Dim srResourceReader As StreamReader = _
New StreamReader(asm.GetManifestResourceStream(sName))
'Reads the content of the resource file.
Dim sResource As String = srResourceReader.ReadToEnd()
'Close the StreamReader.
srResourceReader.Close()
'Returns the XML to the Ribbon UI.
Return sResource
End If
Next
Return Nothing
End Function
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Comments: This subroutine handle all buttons click event
' in our custom menu.
' Arguments: None
'
' Date Developers Chap Action
' --------------------------------------------------------------
' 09/22/08 Dennis Wallentin Ch25 Initial version
Public Sub Reports_Click(ByVal control As Office.IRibbonControl)
'Variables for the two buttons on the custom menu.
Const sABOUT As String = "&About"
Const sREPORT As String = "&Report"
'Create and instantiate a new instance of the class.
Dim cCMethods As New CCommonMethods
Select Case control.Id
'User selected to show the Report form.
Case "rxbtnReport" : cCMethods.Load_Form(sForm:=sREPORT)
'User select to show the About form.
Case "rxbtnAbout" : cCMethods.Load_Form(sForm:=sABOUT)
End Select
'Prepare object for GC.
If (cCMethods IsNot Nothing) Then cCMethods = Nothing
End Sub
#End Region
#Region "Necessary Procedures"
Public Sub OnBeginShutdown(ByRef custom As System.Array) _
Implements IDTExtensibility2.OnBeginShutdown
'This procedure is required.
End Sub
Public Sub OnAddInsUpdate(ByRef custom As System.Array) _
Implements IDTExtensibility2.OnAddInsUpdate
'This procedure is required.
End Sub
Public Sub OnStartupComplete(ByRef custom As System.Array) _
Implements IDTExtensibility2.OnStartupComplete
'This procedure is required.
End Sub
#End Region
End Class
|
Imports System.Data.Entity.ModelConfiguration
Public Class InfoCompensationCfg
Inherits EntityTypeConfiguration(Of InfoCompensation)
Public Sub New()
Me.ToTable("InfoCompensation")
Me.Property(Function(p) p.Libelle).IsRequired()
Me.Property(Function(p) p.MontantVerse).IsRequired()
Me.Property(Function(p) p.Etat).IsRequired()
Me.Property(Function(p) p.DateCreation).IsRequired()
End Sub
End Class
|
Imports Microsoft.VisualBasic
Imports System
Imports System.IO
Imports Neurotec.Biometrics
Imports Neurotec.Biometrics.Client
Imports Neurotec.ComponentModel
Imports Neurotec.Devices
Imports Neurotec.Licensing
Imports Neurotec.Plugins
Friend Class Program
Private Shared Function Usage() As Integer
Console.WriteLine("usage:")
Console.WriteLine(Constants.vbTab & "{0} [image] [template]", TutorialUtils.GetAssemblyName())
Console.WriteLine(Constants.vbTab & "{0} [image] [template] [-u url](optional)", TutorialUtils.GetAssemblyName())
Console.WriteLine(Constants.vbTab & "{0} [image] [template] [-f filename](optional)", TutorialUtils.GetAssemblyName())
Console.WriteLine()
Console.WriteLine(Constants.vbTab & "[image] - image filename to store face image.")
Console.WriteLine(Constants.vbTab & "[template] - filename to store face template.")
Console.WriteLine(Constants.vbTab & "[-u url] - (optional) url to RTSP stream")
Console.WriteLine(Constants.vbTab & "[-f filename] - (optional) video file containing a face")
Console.WriteLine(Constants.vbTab & "If url(-u) or filename(-f) attribute is not specified first attached camera will be used")
Console.WriteLine()
Return 1
End Function
Shared Function Main(ByVal args() As String) As Integer
Dim components As String = "Biometrics.FaceExtraction,Devices.Cameras"
Const AdditionalComponents As String = "Biometrics.FaceSegmentsDetection"
TutorialUtils.PrintTutorialHeader(args)
If args.Length <> 2 AndAlso args.Length <> 4 Then
Return Usage()
End If
Try
If (Not NLicense.ObtainComponents("/local", 5000, components)) Then
Throw New ApplicationException(String.Format("Could not obtain licenses for components: {0}", components))
End If
If NLicense.ObtainComponents("/local", 5000, AdditionalComponents) Then
components &= "," & AdditionalComponents
End If
Using biometricClient = New NBiometricClient With {.UseDeviceManager = True}
Using deviceManager = biometricClient.DeviceManager
Using subject = New NSubject()
Using face = New NFace()
' Set type of the device used
deviceManager.DeviceTypes = NDeviceType.Camera
' Initialize the NDeviceManager
deviceManager.Initialize()
' Create camera from filename or RTSP stram if attached
Dim camera As NCamera
If args.Length = 4 Then
camera = CType(ConnectDevice(deviceManager, args(3), args(2).Equals("-u")), NCamera)
Else
' Get count of connected devices
Dim count As Integer = deviceManager.Devices.Count
If count = 0 Then
Console.WriteLine("no cameras found, exiting ..." & Constants.vbLf)
Return -1
End If
'select the first available camera
camera = CType(deviceManager.Devices(0), NCamera)
End If
' Set the selected camera as NBiometricClient Face Capturing Device
biometricClient.FaceCaptureDevice = camera
Console.WriteLine("Capturing from {0}. Please turn camera to face.", biometricClient.FaceCaptureDevice.DisplayName)
' Define that the face source will be a stream
face.CaptureOptions = NBiometricCaptureOptions.Stream
' Add NFace to NSubject
subject.Faces.Add(face)
' Set face template size (recommended, for enroll to database, is large) (optional)
biometricClient.FacesTemplateSize = NTemplateSize.Large
' Detect all faces features
Dim isAdditionalComponentActivated As Boolean = NLicense.IsComponentActivated(AdditionalComponents)
biometricClient.FacesDetectAllFeaturePoints = isAdditionalComponentActivated
' Start capturing
Dim status As NBiometricStatus = biometricClient.Capture(subject)
If status = NBiometricStatus.Ok Then
Console.WriteLine("Capturing succeeded")
Else
Console.WriteLine("Failed to capture: {0}", status)
Return -1
End If
' Get face detection details if face was detected
For Each nface In subject.Faces
For Each attributes In nface.Objects
Console.WriteLine("face:")
Console.WriteLine(Constants.vbTab & "location = ({0}, {1}), width = {2}, height = {3}", attributes.BoundingRect.X, attributes.BoundingRect.Y, attributes.BoundingRect.Width, attributes.BoundingRect.Height)
If attributes.RightEyeCenter.Confidence > 0 OrElse attributes.LeftEyeCenter.Confidence > 0 Then
Console.WriteLine(Constants.vbTab & "found eyes:")
If attributes.RightEyeCenter.Confidence > 0 Then
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Right: location = ({0}, {1}), confidence = {2}", attributes.RightEyeCenter.X, attributes.RightEyeCenter.Y, attributes.RightEyeCenter.Confidence)
End If
If attributes.LeftEyeCenter.Confidence > 0 Then
Console.WriteLine(Constants.vbTab + Constants.vbTab & "Left: location = ({0}, {1}), confidence = {2}", attributes.LeftEyeCenter.X, attributes.LeftEyeCenter.Y, attributes.LeftEyeCenter.Confidence)
End If
End If
If isAdditionalComponentActivated AndAlso attributes.NoseTip.Confidence > 0 Then
Console.WriteLine(Constants.vbTab & "found nose:")
Console.WriteLine(Constants.vbTab + Constants.vbTab & "location = ({0}, {1}), confidence = {2}", attributes.NoseTip.X, attributes.NoseTip.Y, attributes.NoseTip.Confidence)
End If
If isAdditionalComponentActivated AndAlso attributes.MouthCenter.Confidence > 0 Then
Console.WriteLine(Constants.vbTab & "found mouth:")
Console.WriteLine(Constants.vbTab + Constants.vbTab & "location = ({0}, {1}), confidence = {2}", attributes.MouthCenter.X, attributes.MouthCenter.Y, attributes.MouthCenter.Confidence)
End If
Next attributes
Next nface
' Save image to file
Using image = subject.Faces(0).Image
image.Save(args(0))
Console.WriteLine("image saved successfully")
End Using
' Save template to file
File.WriteAllBytes(args(1), subject.GetTemplateBuffer().ToArray())
Console.WriteLine("template saved successfully")
End Using
End Using
End Using
End Using
Return 0
Catch ex As Exception
Return TutorialUtils.PrintException(ex)
Finally
NLicense.ReleaseComponents(components)
End Try
End Function
Private Shared Function ConnectDevice(ByVal deviceManager As NDeviceManager, ByVal url As String, ByVal isUrl As Boolean) As NDevice
Dim plugin As NPlugin = NDeviceManager.PluginManager.Plugins("Media")
If plugin.State = NPluginState.Plugged AndAlso NDeviceManager.IsConnectToDeviceSupported(plugin) Then
Dim parameters() As NParameterDescriptor = NDeviceManager.GetConnectToDeviceParameters(plugin)
Dim bag = New NParameterBag(parameters)
If isUrl Then
bag.SetProperty("DisplayName", "IP Camera")
bag.SetProperty("Url", url)
Else
bag.SetProperty("DisplayName", "Video file")
bag.SetProperty("FileName", url)
End If
Return deviceManager.ConnectToDevice(plugin, bag.ToPropertyBag())
End If
Throw New Exception("Failed to connect specified device!")
End Function
End Class
|
Public Class Syntax
'Keywords, such as Def...
Public Shared commandList As New List(Of String)
Public Shared commandColor As Color = Color.OrangeRed
'Functions, these can be built in, or custom
Public Shared functionList As New List(Of String)
Public Shared functionColor As Color = Color.Purple
'Operators, such as + or -
Public Shared opList As New List(Of Char)
'Special variables
Public Shared svList As New List(Of String)
Public Shared svlList As New List(Of String)
Public Shared svColor As Color = Color.Red
'Class variables
Public Shared classVar As New List(Of String)
Public Shared classVarColor As Color = Color.Magenta
'Add more
'Things
Public Shared lineStarter As Char = ":"
Public Shared lineEnder As Char = ";"
Public Shared delStr As String = "|DELETE|"
'Other theme things - move to theme class later
Public Shared bgColor As Color = Color.White
Public Shared fgColor As Color = Color.Black
Public Shared uiColor As Color = Color.FromName("Control")
Public Shared doHighlightning As Boolean = True
End Class
|
Imports HighslideControls
Imports HighslideControls.SharedHighslideVariables
''' <summary>
''' simple control to display image with click-to-enlarge capability
''' </summary>
''' <remarks></remarks>
#If DEBUG Then
Public Class ImageThumb
Inherits Highslider
#Else
<ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
Public Class ImageThumb
Inherits Highslider
#End If
Private _imageId As Integer = -1
Public Property ImageId() As Integer
Get
Return _imageId
End Get
Set(ByVal value As Integer)
_imageId = value
End Set
End Property
Private _thumbSize As Integer = 120
Public Property ThumbSize() As Integer
Get
Return _thumbSize
End Get
Set(ByVal value As Integer)
_thumbSize = value
End Set
End Property
Private _maxWidth As Integer = _thumbSize
Public Property MaxThumbWidth() As Integer
Get
Return _maxWidth
End Get
Set(ByVal value As Integer)
_maxWidth = value
End Set
End Property
Private _maxHeight As Integer = _thumbSize
Public Property MaxThumbHeight() As Integer
Get
Return _maxHeight
End Get
Set(ByVal value As Integer)
_maxHeight = value
End Set
End Property
Private _refreshImage As Boolean = False
Public Property RefreshImage() As Boolean
Get
Return _refreshImage
End Get
Set(ByVal value As Boolean)
_refreshImage = value
End Set
End Property
Public Overrides Property ExpandURL() As String
Get
If MyBase.ExpandURL = "" Then
MyBase.ExpandURL = "~/res/DTIImageManager/ViewImage.aspx?Id=" & ImageId
End If
Return MyBase.ExpandURL
End Get
Set(ByVal value As String)
MyBase.ExpandURL = value
End Set
End Property
Public Overrides Property ThumbURL() As String
Get
If MyBase.ThumbURL = "" Then
MyBase.ThumbURL = "~/res/DTIImageManager/ViewImage.aspx?Id=" & ImageId & _
"&maxHeight=" & MaxThumbHeight & "&maxWidth=" & MaxThumbWidth
End If
Dim rdm As New Random
If RefreshImage Then
MyBase.ThumbURL &= "&r=" & rdm.Next(1000)
End If
Return MyBase.ThumbURL
End Get
Set(ByVal value As String)
MyBase.ThumbURL = value
End Set
End Property
Public Overrides Property HighslideDisplayMode() As HighslideDisplayModes
Get
Return HighslideDisplayModes.Image
End Get
Set(ByVal value As HighslideDisplayModes)
End Set
End Property
End Class |
Imports BDList_DAO_BO.BO
Imports BDList_TOOLS
Namespace DAO
Public Interface IDaoBObject
Inherits IDao
Function GetNew() As IdBObject
Function GetNew(id As Long) As IdBObject
Function GetById(id As Long?) As IdBObject
Function GetAll() As List(Of IdBObject)
Function GetAllSortedById() As List(Of IdBObject)
Function GetCount() As Integer
Function GetChanged(fromDate As DateTime) As List(Of IdBObject)
End Interface
End Namespace |
Public Class clsAlphabet
Public Shared Sub LoadAlphabetData()
' Letter (alphabet) https://en.wikipedia.org/wiki/Letter_(alphabet)
Dim DataItem As DataStructure.Alphabet
DataItem = New DataStructure.Alphabet("English", "., 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z")
modVar.Coll.Alphabet.Add(DataItem)
End Sub
End Class |
'Joseph Oudemolen
'11/29/2019
'CIS 125.2148
'Final Project
Public Class Form1
'variables and arrays
Dim subTotal As Double
Dim salesTax As Double
Dim shipping As Double
Dim totalCost As Double
Dim numberOfItems As Integer = 0
Dim movieTitles = New String() {"A Beautiful Day in the Neighborhood",
"Dolemite Is My Name",
"Hustlers",
"Knives Out",
"Little Women",
"Marriage Story",
"Once Upon a Time…in Hollywood",
"Pain & Glory",
"Parasite",
"The Irishman"}
Dim moviePrices = New Double() {19.99,
15.99,
16.99,
3.99,
7.96,
19.99,
16.52,
10.99,
1.0,
0.01}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'fills DVD inventory listbox
Dim i As Integer
While i < movieTitles.Length
lstDVDs.Items.Add(movieTitles(i))
i += 1
End While
lstDVDs.SelectedItem = movieTitles(0)
End Sub
Private Sub btnAddToCart_Click(sender As Object, e As EventArgs) Handles btnAddToCart.Click
Dim dvdIndex As Integer
Dim selectedItem As String
'adds items to cart
numberOfItems += 1
dvdIndex = lstDVDs.SelectedIndex
lblSubtotal.Text = moviePrices(dvdIndex)
Dim priceString As String = moviePrices(dvdIndex)
selectedItem = lstDVDs.SelectedItem + priceString.PadLeft(50)
lstCart.Items.Add(selectedItem)
'adjusts prices
subTotal += moviePrices(dvdIndex)
lblSubtotal.Text = subTotal.ToString("C2")
salesTax = (subTotal * 0.04)
lblSalesTax.Text = salesTax.ToString("C2")
'verifies the shipping price
If shipping < 5 Then
shipping += 1
End If
lblShipping.Text = shipping.ToString("C2")
totalCost = subTotal + salesTax + shipping
lblTotalCost.Text = totalCost.ToString("C2")
End Sub
Private Sub btnRemoveFromCart_Click(sender As Object, e As EventArgs) Handles btnRemoveFromCart.Click
If lstCart.SelectedIndex >= 0 Then
numberOfItems -= 1
Dim parseNumber As Double
Dim extractNumber As Double
'finds price of movie thats removed
extractNumber = lstCart.SelectedItem.Substring(lstCart.SelectedItem.Length - 5)
Double.TryParse(extractNumber, parseNumber)
'adjusts cart total after removal
subTotal -= parseNumber
lblSubtotal.Text = subTotal.ToString("C2")
salesTax = (subTotal * 0.04)
lblSalesTax.Text = salesTax.ToString("C2")
'verifies the shipping price
If numberOfItems < 5 Then
shipping -= 1
End If
lblShipping.Text = shipping.ToString("C2")
totalCost = subTotal + salesTax + shipping
lblTotalCost.Text = totalCost.ToString("C2")
'item removed
lstCart.Items.RemoveAt(lstCart.SelectedIndex)
End If
End Sub
Private Sub btnClearCart_Click(sender As Object, e As EventArgs) Handles btnClearCart.Click
'clears all
lstCart.Items.Clear()
lblSalesTax.ResetText()
lblShipping.ResetText()
lblSubtotal.ResetText()
lblTotalCost.ResetText()
subTotal = 0
shipping = 0
salesTax = 0
totalCost = 0
numberOfItems = 0
End Sub
Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click
Me.Close()
End Sub
End Class
|
Imports ESRI.ArcGIS.Framework
Imports ESRI.ArcGIS.ArcMapUI
Imports System.Windows.Forms
Imports ESRI.ArcGIS.Geometry
'**
'Nom de la composante : cmdDessinerErreur.vb
'
'''<summary>
''' Commande qui permet de dessiner les erreurs de précision, d'adjacence et d'attribut présentent aux limites communes de découpage.
'''</summary>
'''
'''<remarks>
'''Ce traitement est utilisable en mode interactif à l'aide de ses interfaces graphiques et doit être
'''utilisé dans ArcMap (ArcGisESRI).
'''
'''Auteur : Michel Pothier
'''Date : 21 juillet 2011
'''</remarks>
'''
Public Class cmdDessinerErreur
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Dim gpApp As IApplication = Nothing 'Interface ESRI contenant l'application ArcMap
Dim gpMxDoc As IMxDocument = Nothing 'Interface ESRI contenant un document ArcMap
Public Sub New()
Try
'Vérifier si l'application est définie
If Not Hook Is Nothing Then
'Définir l'application
gpApp = CType(Hook, IApplication)
'Vérifier si l'application est ArcMap
If TypeOf Hook Is IMxApplication Then
'Rendre active la commande
Enabled = True
'Définir le document
gpMxDoc = CType(gpApp.Document, IMxDocument)
Else
'Rendre désactive la commande
Enabled = False
End If
End If
Catch erreur As Exception
MsgBox(erreur.ToString)
End Try
End Sub
Protected Overrides Sub OnClick()
Try
'Dessiner la géométrie et le texte des erreurs de précision, d'adjacence et d'attribut
Call DessinerErreurs()
Catch erreur As Exception
MessageBox.Show(erreur.ToString, "", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Sub
Protected Overrides Sub OnUpdate()
'Vérifier si aucune erreur
If m_ErreurFeature Is Nothing Then
'Désactiver la commande
Enabled = False
Else
'Vérifier si aucune erreur
If m_ErreurFeature.Count = 0 Then
'Désactiver la commande
Enabled = False
Else
'Activer la commande
Enabled = True
End If
End If
End Sub
End Class
|
''' <summary>Shows details for a Contractus Contract</summary>
Public Class ConDetails
'--------------------------------[Variables]--------------------------------
Private ReadOnly MyUser As User
Private ReadOnly MyContract As Contract
Private ReadOnly FormMode As DetailsFormMode
Private ContractDetails As String
Public Enum DetailsFormMode
Available = 0
Active = 1
End Enum
'--------------------------------[Initialization]--------------------------------
Public Sub New(User As User, Contract As Contract, FormMode As DetailsFormMode)
InitializeComponent()
MyUser = User
MyContract = Contract
Me.FormMode = FormMode
NameTXB.Text = ""
DetailsTXB.Text = ""
End Sub
Private Sub LoadingTime() Handles Me.Load
NameTXB.Text = MyContract.Name
FromLBL.Text = MyContract.FromName & " (" & MyContract.FromID & ")"
If MyContract.TopBid = -1 Then
TopBidLBL.Text = " - "
TopBidderLBL.Text = " - "
Else
TopBidLBL.Text = MyContract.TopBid
TopBidderLBL.Text = MyContract.TopBidName & " (" & MyContract.TopBidID & ")"
End If
If FormMode = DetailsFormMode.Available Then
'Available
EndAuctionBTN.Visible = (MyContract.FromID = MyUser.ID)
PlaceBidBTN.Enabled = Not (MyContract.FromID = MyUser.ID)
Else
'Active
EndAuctionBTN.Visible = False
PlaceBidBTN.Enabled = False
End If
End Sub
Sub HelloDetailsTime() Handles Me.Shown
RefreshNotice.Show()
LoadDetails.RunWorkerAsync()
End Sub
'--------------------------------[Buttons]--------------------------------
Private Sub ClickOKtoOk() Handles OKBtn.Click
Close()
End Sub
Private Sub PlaceBid() Handles PlaceBidBTN.Click
Dim AddBid As ConBid = New ConBid(MyUser, MyContract)
AddBid.ShowDialog()
Close()
End Sub
Private Sub EndAuction() Handles EndAuctionBTN.Click
If MsgBox("Are you sure you wish to end the auction?", MsgBoxStyle.Question + MsgBoxStyle.YesNo) = MsgBoxResult.Yes And FormMode = DetailsFormMode.Available Then
Select Case MoveToUser(MyContract.ID, MyContract.TopBidID)
Case "E"
MsgBox("A serverside error occurred", vbInformation)
Case "S"
MsgBox(MyContract.TopBidID & " Has been awarded the contract. It is now in their active contracts, and they shall send you a bill upon its completion", vbInformation)
Close()
End Select
Else
MsgBox("The lemon has prevented this transaction", vbInformation)
End If
End Sub
'--------------------------------[Background Worker]--------------------------------
Private Sub GetDetails() Handles LoadDetails.DoWork
ContractDetails = ContractusCommands.ConDetails(MyContract.ID)
End Sub
Sub GotDetails() Handles LoadDetails.RunWorkerCompleted
DetailsTXB.Text = ContractDetails
RefreshNotice.Close()
End Sub
End Class |
'==========================================================================
'
' File: GimTran.vb
' Location: Firefly.Examples <Visual Basic .Net>
' Description: GIM/MIG操作实例
' Version: 2013.02.26.
' Author: F.R.C.
' Copyright(C) Public Domain
'
'==========================================================================
Imports System
Imports System.Math
Imports System.Collections.Generic
Imports System.Linq
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO
Imports Firefly
Imports Firefly.Streaming
Imports Firefly.Imaging
Public Module GimTran
Public Function Main() As Integer
If System.Diagnostics.Debugger.IsAttached Then
Return MainInner()
Else
Try
Return MainInner()
Catch ex As Exception
Console.WriteLine(ExceptionInfo.GetExceptionInfo(ex))
Return -1
End Try
End If
End Function
Public Function MainInner() As Integer
Dim argv = CommandLine.GetCmdLine.Arguments
For Each f In argv
Dim FileName = GetFileName(f)
Dim FileDir = GetFileDirectory(f)
If IsMatchFileMask(FileName, "*.mig") OrElse IsMatchFileMask(FileName, "*.gim") Then
Dim Data As Byte()
Using s = Streams.OpenReadable(f)
Data = s.Read(s.Length)
End Using
Dim m As New GIM(Data)
Dim Images = m.Images.ToArray
For n = 0 To Images.Length - 1
Dim Image As GIM.ImageBlock = Images(n)
Dim Bitmaps = Image.Bitmap
Dim Palettes = Image.Palette
If Palettes Is Nothing AndAlso Bitmaps.NeedPalette Then Throw New InvalidDataException
Dim Width = Bitmaps.Width
Dim Height = Bitmaps.Height
If Bitmaps.Indices.Length > 1 Then
Height = ((Height + 7) \ 8) * 8
End If
If Bitmaps.NeedPalette Then
Dim BitsPerPixel = CUS(Bitmaps.BitsPerPixel)
If BitsPerPixel > 8 Then
BitsPerPixel = Ceiling(Log(Enumerable.Range(0, Bitmaps.Indices.Length).Select(Function(i) Palettes.PaletteData(Palettes.Indices(i)).First.Length).Max, 2))
End If
If BitsPerPixel > 8 Then Throw New InvalidDataException
Using bmp As New Bmp(Width, Height, BitsPerPixel)
Using png As New Bitmap(bmp.Width, bmp.Height * Bitmaps.Indices.Length, PixelFormat.Format32bppArgb)
For i = 0 To Bitmaps.Indices.Length - 1
Dim Rectangle = Bitmaps.BitmapData(Bitmaps.Indices(i)).First
Dim Palette = Palettes.PaletteData(Palettes.Indices(i)).First
Dim p = New Int32((1 << BitsPerPixel) - 1) {}
Array.Copy(Palette, p, Min(Palette.Length, p.Length))
bmp.Palette = p
bmp.SetRectangle(0, 0, Rectangle)
png.SetRectangle(0, Height * i, bmp.GetRectangleAsARGB(0, 0, bmp.Width, bmp.Height))
png.Save(GetPath(FileDir, "{0}.{1}.png".Formats(FileName, n)))
Next
End Using
End Using
Else
Using png As New Bitmap(Width, Height, PixelFormat.Format32bppArgb)
For i = 0 To Bitmaps.Indices.Length - 1
Dim Rectangle = Bitmaps.BitmapData(Bitmaps.Indices(i)).First
png.SetRectangle(0, Height * i, Rectangle)
png.Save(GetPath(FileDir, "{0}.{1}.png".Formats(FileName, n)))
Next
End Using
End If
Next
ElseIf IsMatchFileMask(FileName, "*.mig.*.png") OrElse IsMatchFileMask(FileName, "*.gim.*.png") Then
Dim GimName = GetMainFileName(GetMainFileName(f))
Dim GimPath = GetPath(GetFileDirectory(f), GimName)
Dim Data As Byte()
Using s = Streams.OpenReadable(GimPath)
Data = s.Read(s.Length)
End Using
Dim m As New GIM(Data)
Dim Images = m.Images.ToArray
Dim n = GetExtendedFileName(GetMainFileName(f))
Dim Image As GIM.ImageBlock = Images(n)
Dim Bitmaps = Image.Bitmap
Dim Palettes = Image.Palette
If Palettes Is Nothing AndAlso Bitmaps.NeedPalette Then Throw New InvalidDataException
Dim Width = Bitmaps.Width
Dim Height = Bitmaps.Height
If Bitmaps.Indices.Length > 1 Then
Height = ((Height + 7) \ 8) * 8
End If
Dim ab As AbstractBitmap(Of Int32)
Using png As New Bitmap(f)
ab = New AbstractBitmap(Of Int32)(png.Width, png.Height)
If png.PixelFormat = PixelFormat.Format32bppArgb Then
ab.SetRectangle2(0, 0, png.GetRectangle(0, 0, png.Width, png.Height))
Else
Using b As New Bitmap(png.Width, png.Height, PixelFormat.Format32bppArgb)
Using g = Graphics.FromImage(b)
g.DrawImage(png, 0, 0)
ab.SetRectangle2(0, 0, png.GetRectangle(0, 0, png.Width, png.Height))
End Using
End Using
End If
End Using
Dim GuassianKernel4x4 = New Integer() {1, 3, 3, 1, 3, 9, 9, 3, 3, 9, 9, 3, 1, 3, 3, 1}
For i = 0 To Bitmaps.Indices.Length - 1
Dim RectangleInMipmap = ab.GetRectangle2(0, Height * i, Width, Height)
Dim WidthInMipmap As Integer = Width
Dim HeightInMipmap As Integer = Height
For k = 0 To Bitmaps.NumMipmap - 1
Dim r = New Int32(WidthInMipmap - 1, HeightInMipmap - 1) {}
If Bitmaps.NeedPalette Then
Dim Palette = Palettes.PaletteData(Palettes.Indices(i))(k)
Dim Fun =
Sub(xy)
Dim x = xy Mod WidthInMipmap
Dim y = xy \ WidthInMipmap
r(x, y) = Quantizer.QuantizeOnPalette(RectangleInMipmap(x, y), Palette, AddressOf ColourDistanceARGB)
End Sub
Enumerable.Range(0, WidthInMipmap * HeightInMipmap).AsParallel().ForAll(Fun)
Else
For y = 0 To HeightInMipmap - 1
For x = 0 To WidthInMipmap - 1
r(x, y) = RectangleInMipmap(x, y)
Next
Next
End If
Bitmaps.BitmapData(Bitmaps.Indices(i))(k) = r
If k < Bitmaps.NumMipmap - 1 Then
WidthInMipmap = (WidthInMipmap + 1) \ 2
HeightInMipmap = (HeightInMipmap + 1) \ 2
Dim Small = New Int32(WidthInMipmap - 1, HeightInMipmap - 1) {}
Dim Fun =
Sub(xy)
Dim x = xy Mod WidthInMipmap
Dim y = xy \ WidthInMipmap
Dim Pixels = New List(Of KeyValuePair(Of Int32, Integer))()
Dim Index = 0
For yy = y * 2 - 1 To y * 2 + 2
For xx = x * 2 - 1 To x * 2 + 2
If xx >= 0 AndAlso xx < RectangleInMipmap.GetLength(0) AndAlso yy >= 0 AndAlso yy < RectangleInMipmap.GetLength(1) Then
Pixels.Add(CreatePair(RectangleInMipmap(xx, yy), GuassianKernel4x4(Index)))
End If
Index += 1
Next
Next
Dim SumWeight = Pixels.Select(Function(c) c.Value).Sum
Dim ColorAddOffset = (SumWeight - 1) \ 2
Dim cA = (Pixels.Select(Function(c) c.Key.Bits(31, 24) * c.Value).Sum() + ColorAddOffset) \ SumWeight
Dim cR = (Pixels.Select(Function(c) c.Key.Bits(23, 16) * c.Value).Sum() + ColorAddOffset) \ SumWeight
Dim cG = (Pixels.Select(Function(c) c.Key.Bits(15, 8) * c.Value).Sum() + ColorAddOffset) \ SumWeight
Dim cB = (Pixels.Select(Function(c) c.Key.Bits(7, 0) * c.Value).Sum() + ColorAddOffset) \ SumWeight
Small(x, y) = cA.ConcatBits(cR, 8).ConcatBits(cG, 8).ConcatBits(cB, 8)
End Sub
Enumerable.Range(0, WidthInMipmap * HeightInMipmap).AsParallel().ForAll(Fun)
RectangleInMipmap = Small
End If
Next
Next
Data = m.ToBytes
Using s = Streams.CreateResizable(GimPath)
s.Write(Data)
End Using
End If
Next
Return 0
End Function
End Module
|
Imports System.Text
Namespace DataAccess.Providers
Public MustInherit Class SQL92DialectProvider
Implements IDialectProvider
Private _UseSPsForCRUD As Boolean
Private ReadOnly Property UseSPsForCRUD() As Boolean
Get
Return _UseSPsForCRUD
End Get
End Property
Public Sub New(ByVal pUseSPsForCRUD As Boolean)
_UseSPsForCRUD = pUseSPsForCRUD
End Sub
#Region "Interface Methods"
Public Function Get_SELECTBYID_Statement(ByVal pSchema As ActiveRecord.Schema) As String Implements IDialectProvider.Get_SELECTBYID_Statement
Return GetSelectByIdStatement(pSchema, Me.UseSPsForCRUD)
End Function
Public Function Get_INSERT_Statement(ByVal pSchema As ActiveRecord.Schema) As String Implements IDialectProvider.Get_INSERT_Statement
Return GetInsertStatement(pSchema, Me.UseSPsForCRUD)
End Function
Public Function Get_DELETE_Statement(ByVal pSchema As ActiveRecord.Schema) As String Implements IDialectProvider.Get_DELETE_Statement
Return GetDeletetStatement(pSchema, Me.UseSPsForCRUD)
End Function
Public Function Get_UPDATE_Statement(ByVal pSchema As ActiveRecord.Schema) As String Implements IDialectProvider.Get_UPDATE_Statement
Return GetUpdateStatement(pSchema, Me.UseSPsForCRUD)
End Function
Public Function Get_ParameterName(ByVal pColumn As ActiveRecord.SchemaColumn) As String Implements IDialectProvider.Get_ParameterName
Return String.Format("@{0}", pColumn.ColumnName)
End Function
Public Function Get_ParameterName(ByVal pParameterName As String) As String Implements IDialectProvider.Get_ParameterName
Return String.Format("@{0}", pParameterName)
End Function
Public Function Get_QueryBuilderStatement(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String Implements IDialectProvider.Get_QueryBuilderStatement
Return BuildSELECTStatement(pQuery)
End Function
#End Region
#Region "Column Formatters"
Public Overridable Function GetBracketedColumnName(ByVal pColumn As ActiveRecord.SchemaColumn) As String
Return String.Format("[{0}]", pColumn.ColumnName)
End Function
Public Overridable Function GetQualifiedColumnName(ByVal pColumn As ActiveRecord.SchemaColumn) As String
Return String.Format("[{0}].[{1}]", pColumn.Schema.TableName, pColumn.ColumnName)
End Function
'Public Overridable Function GetColumnJoinFieldName(ByVal pColumn As ActiveRecord.SchemaColumn) As String
' Return String.Format("[{0}].[{1}]", pColumn.Schema.TableName, pColumn.ColumnName)
'End Function
Public Overridable Function GetColumnJoinAlias(ByVal pColumn As ActiveRecord.SchemaColumn) As String
Return String.Format("[{0}.{1}]", pColumn.Schema.TableName, pColumn.ColumnName)
End Function
Public Overridable Function GetQualifiedTableName(ByVal pSchema As ActiveRecord.Schema) As String
Return String.Format("[{0}]", pSchema.TableName)
End Function
Public Overridable Function GetLastInsertedIdStatement() As String
Return "SELECT @@IDENTITY"
End Function
Public Overridable Function Get_INSERT_Procedure(ByVal pSchema As ActiveRecord.Schema) As String
Return String.Format("{0}_SP_INSERT", pSchema.TableName.ToUpper)
End Function
Public Overridable Function Get_UPDATE_Procedure(ByVal pSchema As ActiveRecord.Schema) As String
Return String.Format("{0}_SP_UPDATE", pSchema.TableName.ToUpper)
End Function
Public Overridable Function Get_DELETE_Procedure(ByVal pSchema As ActiveRecord.Schema) As String
Return String.Format("{0}_SP_DELETE", pSchema.TableName.ToUpper)
End Function
Public Overridable Function Get_SELECT_Procedure(ByVal pSchema As ActiveRecord.Schema) As String
Return String.Format("{0}_SP_SELECT", pSchema.TableName.ToUpper)
End Function
#End Region
#Region "Misc Statements"
Public Enum ColumnFormat
ColumnName
ParameterName
ValueToParameterAssignment
JoinAlias
End Enum
Public Enum JoinFormats
JustDescriptions
All
End Enum
Public Overridable Function GetCommaSeparatedColumns(ByVal pList As List(Of ActiveRecord.SchemaColumn), ByVal pFormat As ColumnFormat) As String
Dim SB As New StringBuilder
Dim lFirst As Boolean = True
For Each lColumn As ActiveRecord.SchemaColumn In pList
If (lFirst) Then
SB.Append(GetFormattedColumn(lColumn, pFormat))
lFirst = False
Else
SB.AppendFormat(", {0}", GetFormattedColumn(lColumn, pFormat))
End If
Next
Return SB.ToString
End Function
''' <summary>
''' Obtiene la lista de columnas en una cadena
''' </summary>
''' <param name="pSchema">El esquema que contiene la lista de columnas</param>
''' <param name="pIncludeIdentity">Determina si se debe incluir el campo identidad</param>
''' <param name="pFormat">Determina él formato de la lista de parametros</param>
''' <returns>Devuelve la lista de columnas en una cadena</returns>
Public Overridable Function GetCommaSeparatedColumns(ByVal pSchema As ActiveRecord.Schema, ByVal pIncludeIdentity As Boolean, ByVal pFormat As ColumnFormat) As String
Dim SB As New StringBuilder
Dim lColumn As ActiveRecord.SchemaColumn
Dim lFirst As Boolean = True
Dim lHasToAppend As Boolean
Dim lStringToAppend As String = ""
Dim lFormattedColumn As String = ""
For Each lkey As String In pSchema.AllColumns
lColumn = pSchema(lkey)
lHasToAppend = False
If (lColumn.IsPrimaryKey) Then
If (pIncludeIdentity) Then
lHasToAppend = True
End If
Else
lHasToAppend = True
End If
If (lHasToAppend) Then
'Obtener la cadena formateada:
lFormattedColumn = GetFormattedColumn(lColumn, pFormat)
'Agregar valores separados por coma
If (lFirst) Then
lStringToAppend = lFormattedColumn
lFirst = False
Else
lStringToAppend = String.Format(", {0}", lFormattedColumn)
End If
SB.Append(lStringToAppend)
End If
Next
Return SB.ToString
End Function
Public Overridable Function GetFormattedColumn(ByVal pColumn As ActiveRecord.SchemaColumn, ByVal pFormat As ColumnFormat) As String
Dim lFormattedColumn As String = String.Empty
lFormattedColumn = String.Empty
Select Case (pFormat)
Case ColumnFormat.ColumnName
lFormattedColumn = Me.GetBracketedColumnName(pColumn)
Case ColumnFormat.ParameterName
lFormattedColumn = Me.Get_ParameterName(pColumn)
Case ColumnFormat.ValueToParameterAssignment
lFormattedColumn = String.Format("{0} = {1}", Me.GetQualifiedColumnName(pColumn), Me.Get_ParameterName(pColumn))
Case ColumnFormat.JoinAlias
lFormattedColumn = String.Format("{0} AS {1}", Me.GetQualifiedColumnName(pColumn), Me.GetColumnJoinAlias(pColumn))
End Select
Return lFormattedColumn
End Function
#End Region
#Region "Construcción de Sentencias CRUD"
Public Overridable Function GetInsertStatement(ByVal pSchema As ActiveRecord.Schema, Optional ByVal pUseStoredProceduresForCRUD As Boolean = False) As String
Dim lResult As String = String.Empty
If Not (pUseStoredProceduresForCRUD) Then
If (pSchema.IdIsAutoGenerated) Then
lResult = String.Format("INSERT INTO {0} ({1}) VALUES ({2}) {3}", _
Me.GetQualifiedTableName(pSchema), _
GetCommaSeparatedColumns(pSchema, False, ColumnFormat.ColumnName), _
GetCommaSeparatedColumns(pSchema, False, ColumnFormat.ParameterName), _
GetLastInsertedIdStatement())
Else
lResult = String.Format("INSERT INTO {0} ({1}) VALUES ({2}) ", _
Me.GetQualifiedTableName(pSchema), _
GetCommaSeparatedColumns(pSchema, True, ColumnFormat.ColumnName), _
GetCommaSeparatedColumns(pSchema, True, ColumnFormat.ParameterName))
End If
Else
lResult = Get_INSERT_Procedure(pSchema)
End If
Return lResult
End Function
Public Overridable Function GetDeletetStatement(ByVal pSchema As ActiveRecord.Schema, Optional ByVal pUseStoredProceduresForCRUD As Boolean = False) As String
Dim lResult As String = String.Empty
If Not (pUseStoredProceduresForCRUD) Then
lResult = String.Format("DELETE FROM {0} WHERE {1} = {2} ", _
Me.GetQualifiedTableName(pSchema), _
Me.GetQualifiedColumnName(pSchema.PKColumn), _
Me.Get_ParameterName(pSchema.PKColumn))
Else
lResult = Get_DELETE_Procedure(pSchema)
End If
Return lResult
End Function
Public Overridable Function GetSelectByIdStatement(ByVal pSchema As ActiveRecord.Schema, Optional ByVal pUseStoredProceduresForCRUD As Boolean = False) As String
Dim lResult As String = String.Empty
If Not (pUseStoredProceduresForCRUD) Then
lResult = String.Format("SELECT {0} FROM {1} WHERE {2} = {3}", _
GetCommaSeparatedColumns(pSchema, True, ColumnFormat.JoinAlias), _
Me.GetQualifiedTableName(pSchema), _
Me.GetQualifiedColumnName(pSchema.PKColumn), _
Me.Get_ParameterName(pSchema.PKColumn))
Else
lResult = Get_SELECT_Procedure(pSchema)
End If
Return lResult
End Function
Public Overridable Function GetUpdateStatement(ByVal pSchema As ActiveRecord.Schema, Optional ByVal pUseStoredProceduresForCRUD As Boolean = False) As String
Dim lResult As String = String.Empty
If Not (pUseStoredProceduresForCRUD) Then
lResult = String.Format("UPDATE {0} SET {1} WHERE {2} = {3}", _
Me.GetQualifiedTableName(pSchema), _
GetCommaSeparatedColumns(pSchema, False, ColumnFormat.ValueToParameterAssignment), _
Me.GetQualifiedColumnName(pSchema.PKColumn), _
Me.Get_ParameterName(pSchema.PKColumn))
Else
lResult = Get_UPDATE_Procedure(pSchema)
End If
Return lResult
End Function
#End Region
#Region "QueryBuilder Strings"
#Region "Sentencia SELECT "
#End Region
Public Overridable Function BuildSELECTStatement(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String
Dim lResult As String = String.Empty
lResult = String.Format(" SELECT {0} {1} FROM {2} {3} {4} {5} ", _
TopStatement(pQuery), _
GetColumnList(pQuery), _
Me.GetQualifiedTableName(pQuery.Schema), _
Me.GetJoinList(pQuery), _
Get_WHERE_Statement(pQuery), _
GetOrderByStatement(pQuery))
Return lResult
End Function
#Region "ORDER BY"
Private Sub RecursiveFillOrderByList(ByVal pParentQuery As ActiveRecord.Query.QueryBuilder, ByVal pOrderByList As List(Of ActiveRecord.Query.OrderBy))
For Each lOrderByStatement As ActiveRecord.Query.OrderBy In pParentQuery.OrderByList
pOrderByList.Add(lOrderByStatement)
Next
For Each lKey As String In pParentQuery.Joins.Keys
RecursiveFillOrderByList(pParentQuery.Joins(lKey).ForeignQuery, pOrderByList)
Next
End Sub
Public Overridable Function GetOrderByStatement(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String
Dim lReturnValue As String = String.Empty
Dim lOrderByList As New List(Of ActiveRecord.Query.OrderBy)
RecursiveFillOrderByList(pQuery, lOrderByList)
If (lOrderByList.Count > 0) Then
Dim lSB As New StringBuilder
Dim First As Boolean = True
For Each lOrder As ActiveRecord.Query.OrderBy In lOrderByList
If (First) Then
lSB.AppendFormat("{0} {1}", Me.GetQualifiedColumnName(lOrder.Column), GetOrderByDirection(lOrder))
First = False
Else
lSB.AppendFormat(",{0} {1}", Me.GetQualifiedColumnName(lOrder.Column), GetOrderByDirection(lOrder))
End If
Next
lReturnValue = String.Format("ORDER BY {0}", lSB.ToString)
End If
Return lReturnValue
End Function
Public Overridable Function GetOrderByDirection(ByVal pOrder As ActiveRecord.Query.OrderBy) As String
Dim lResult As String = "ASC"
Select Case pOrder.DirectionOrder
Case ActiveRecord.Query.OrderBy.OrderByDirections.ASC
lResult = "ASC"
Case ActiveRecord.Query.OrderBy.OrderByDirections.DESC
lResult = "DESC"
End Select
Return lResult
End Function
#End Region
#Region "TOP/LIMIT"
Public Overridable Function TopStatement(ByVal pQueryBuilder As ActiveRecord.Query.QueryBuilder) As String
If (pQueryBuilder.Limit <> 0) Then
Return String.Format("TOP {0}", pQueryBuilder.Limit)
End If
Return String.Empty
End Function
#End Region
Private Sub GetRecursiveJoinList(ByVal pQuery As ActiveRecord.Query.QueryBuilder, ByRef pJoinTables As List(Of String))
For Each lKey As String In pQuery.Joins.Keys
pJoinTables.Add(String.Format("LEFT JOIN {0} ON {1} = {2}", _
Me.GetQualifiedTableName(pQuery.Joins(lKey).ForeignQuery.Schema), _
Me.GetQualifiedColumnName(pQuery.Joins(lKey).JoinColumn), _
Me.GetQualifiedColumnName(pQuery.Joins(lKey).ForeignQuery.Schema.PKColumn)))
GetRecursiveJoinList(pQuery.Joins(lKey).ForeignQuery, pJoinTables)
Next
End Sub
Private Function GetJoinList(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String
Dim lReturnValue As String = String.Empty
Dim lFirst As Boolean = True
Dim lSB As New StringBuilder
If (pQuery.Joins.Count > 0) Then
Dim lJoinList As New List(Of String)
GetRecursiveJoinList(pQuery, lJoinList)
For Each lJoin As String In lJoinList
lSB.AppendFormat(" {0} ", lJoin)
Next
lReturnValue = lSB.ToString
End If
Return lReturnValue
End Function
Private Sub RecursiveSelectList(ByVal pQuery As ActiveRecord.Query.QueryBuilder, ByRef pSelectList As List(Of ActiveRecord.SchemaColumn))
For Each lColumn As ActiveRecord.SchemaColumn In pQuery.ColumnsList
pSelectList.Add(lColumn)
Next
For Each lkey As String In pQuery.Joins.Keys
Dim lQuery As ActiveRecord.Query.QueryBuilder = pQuery.Joins(lkey).ForeignQuery
RecursiveSelectList(lQuery, pSelectList)
Next
End Sub
#Region "GetColumnList"
Public Overridable Function GetColumnList(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String
Dim lReturnValue As String = String.Empty
Dim lList As New List(Of ActiveRecord.SchemaColumn)
RecursiveSelectList(pQuery, lList)
If (lList.Count > 0) Then
lReturnValue = Me.GetCommaSeparatedColumns(lList, ColumnFormat.JoinAlias)
Else
lReturnValue = Me.GetCommaSeparatedColumns(pQuery.Schema, True, ColumnFormat.JoinAlias)
End If
Return lReturnValue
End Function
#End Region
#Region "Get_WHERE_Statement"
Private Sub RecursiveWhereStatement(ByVal pQuery As ActiveRecord.Query.QueryBuilder, ByRef pComparisons As List(Of ActiveRecord.Query.Comparison))
For Each lComparison As ActiveRecord.Query.Comparison In pQuery.Comparisons
pComparisons.Add(lComparison)
Next
For Each lJoin As String In pQuery.Joins.Keys
RecursiveWhereStatement(pQuery.Joins(lJoin).ForeignQuery, pComparisons)
Next
End Sub
Public Overridable Function Get_WHERE_Statement(ByVal pQuery As ActiveRecord.Query.QueryBuilder) As String
Dim lReturnValue As String = String.Empty
Dim lTotalComparisons As New List(Of ActiveRecord.Query.Comparison)
RecursiveWhereStatement(pQuery, lTotalComparisons)
If (lTotalComparisons.Count > 0) Then
Dim lSB As New StringBuilder
Dim First As Boolean = True
For Each lComparison As ActiveRecord.Query.Comparison In lTotalComparisons
If (First) Then
lSB.AppendFormat(" WHERE {0} ", GetComparisonString(lComparison, False))
First = False
Else
lSB.Append(GetComparisonString(lComparison, True))
End If
Next
lReturnValue = lSB.ToString
End If
Return lReturnValue
End Function
''' <summary>
''' Obtiene la cadena de comparación en SQL
''' </summary>
''' <param name="pIncludeOperator">Determina si debe incluir el operador lógico o no</param>
Public Function GetComparisonString(ByVal pComparison As ActiveRecord.Query.Comparison, ByVal pIncludeOperator As Boolean) As String
Dim lResult As String = String.Empty
If (pIncludeOperator) Then
lResult = String.Format(" {0} ({1}) ", GetLogicalOperatorString(pComparison), GetComparisonStatement(pComparison))
Else
lResult = String.Format(" ({0}) ", GetComparisonStatement(pComparison))
End If
Return lResult
End Function
Public Function GetLogicalOperatorString(ByVal pComparison As ActiveRecord.Query.Comparison) As String
Dim lResult As String = String.Empty
Select Case (pComparison.LogicalOperator)
Case ActiveRecord.Query.Comparison.LogicalOperatorType._AND_, ActiveRecord.Query.Comparison.LogicalOperatorType._UNDEFINED_
lResult = "AND"
Case ActiveRecord.Query.Comparison.LogicalOperatorType._AND_NOT_
lResult = "AND NOT"
Case ActiveRecord.Query.Comparison.LogicalOperatorType._OR_
lResult = "OR"
Case ActiveRecord.Query.Comparison.LogicalOperatorType._OR_NOT_
lResult = "OR NOT"
End Select
Return lResult
End Function
Public Overridable Function GetComparisonStatement(ByVal pComparison As ActiveRecord.Query.Comparison) As String
Dim lResult As String = String.Empty
Select Case (pComparison.ComparisonType)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueEqualsTo
lResult = String.Format(" {0} = {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsBetween, ActiveRecord.Query.Comparison.ComparisonOperation.DateIsBetween
lResult = String.Format(" {0} BETWEEN {1} AND {2} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name, _
pComparison.Parameters(1).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.TextIsLike
lResult = String.Format(" {0} LIKE {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsGreaterThan
lResult = String.Format(" {0} > {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsGreaterThanOrEqualsTo
lResult = String.Format(" {0} >= {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsLessThan
lResult = String.Format(" {0} < {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsLessThanOrEqualsTo
lResult = String.Format(" {0} <= {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
Case ActiveRecord.Query.Comparison.ComparisonOperation.ValueIsDifferentFrom
lResult = String.Format(" {0} <> {1} ", _
Me.GetQualifiedColumnName(pComparison.Column), _
pComparison.Parameters(0).Name)
End Select
Return lResult
End Function
#End Region
#End Region
End Class
End Namespace
|
Public Class WTFC_StandardUnitSub_TE
Public GroupCode As String
Public ProductCode_K As String
Public RevisionCode As String
Public ComponentCode_K As String
Public ProcessNumber_K As String
Public ProcessCode As String
Public ProcessName As String
Public SubProcessCode_K As String
Public SubProcessName As String
Public FactoryCode As String
Public FactoryName As String
Public ChildComponent As String
Public UnitCode As String
Public UnitName As String
Public ComponentShapeFlag As String
Public CustomerCode As String
Public CustomerName As String
Public Method As String
Public StdWTSHT As Decimal
Public StdWTPC As Decimal
Public MachineCount As Integer
Public Person As Integer
Public LotCount As Integer
Public StdRate As Decimal
Public Note As String
Public StandardLotSize As Decimal
Public ComponentWidth As Decimal
Public ComponentLength As Decimal
Public ConversionValue1 As Decimal
Public ConversionValue2 As Decimal
End Class
|
'---------------------------------------------------------------------------
' Author : Nguyễn Khánh Tùng
' Company : Thiên An ESS
' Created Date : Tuesday, April 22, 2008
'---------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OracleClient
Imports ESS.Machine
Imports ESS.Entity.Entity
Namespace DBManager
Public Class DoiTuongTroCap_DAL
#Region "Constructor"
Public Sub New()
End Sub
#End Region
#Region "Function"
Public Function Load_DanhSachTroCap(ByVal Hoc_ky As Integer, ByVal Nam_hoc As String, ByVal dsID_lop As String) As DataTable
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@Hoc_ky", Hoc_ky)
para(1) = New SqlParameter("@Nam_hoc", Nam_hoc)
para(2) = New SqlParameter("@dsID_lop", dsID_lop)
Return UDB.SelectTableSP("STU_DanhSachTroCap_Load_List", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":Hoc_ky", Hoc_ky)
para(1) = New OracleParameter(":Nam_hoc", Nam_hoc)
para(2) = New OracleParameter(":dsID_lop", dsID_lop)
Return UDB.SelectTableSP("STU_DanhSachTroCap_Load_List", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Load_DoiTuongTroCap(ByVal ID_lops As String) As DataTable
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(0) As SqlParameter
para(0) = New SqlParameter("@ID_lops", ID_lops)
Return UDB.SelectTableSP("STU_DoiTuongHocBong_Load", para)
Else
Dim para(0) As OracleParameter
para(0) = New OracleParameter(":ID_lops", ID_lops)
Return UDB.SelectTableSP("STU_DoiTuongHocBong_Load", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
' Load danh mục đối tượng học bổng
Public Function Load_DoiTuong() As DataTable
Try
Return UDB.SelectTableSP("STU_DoiTuongHocBong_Load_List")
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Insert_DoiTuongTroCap(ByVal obj As DoiTuongTroCap) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@Ma_dt_hb", obj.Ma_dt_hb)
para(1) = New SqlParameter("@Ten_dt_hb", obj.Ten_dt_hb)
para(2) = New SqlParameter("@Sotien_trocap", obj.Sotien_trocap)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Insert", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":Ma_dt_hb", obj.Ma_dt_hb)
para(1) = New OracleParameter(":Ten_dt_hb", obj.Ten_dt_hb)
para(2) = New OracleParameter(":Sotien_trocap", obj.Sotien_trocap)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Insert", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Update_DoiTuongTroCap(ByVal obj As DoiTuongTroCap, ByVal ID_dt_hb As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(3) As SqlParameter
para(0) = New SqlParameter("@ID_dt_hb", ID_dt_hb)
para(1) = New SqlParameter("@Ma_dt_hb", obj.Ma_dt_hb)
para(2) = New SqlParameter("@Ten_dt_hb", obj.Ten_dt_hb)
para(3) = New SqlParameter("@Sotien_trocap", obj.Sotien_trocap)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Update", para)
Else
Dim para(3) As OracleParameter
para(0) = New OracleParameter(":ID_dt_hb", ID_dt_hb)
para(1) = New OracleParameter(":Ma_dt_hb", obj.Ma_dt_hb)
para(2) = New OracleParameter(":Ten_dt_hb", obj.Ten_dt_hb)
para(3) = New OracleParameter(":Sotien_trocap", obj.Sotien_trocap)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Update", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Delete_DoiTuongTroCap(ByVal ID_dt_hb As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(0) As SqlParameter
para(0) = New SqlParameter("@ID_dt_hb", ID_dt_hb)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Delete", para)
Else
Dim para(0) As OracleParameter
para(0) = New OracleParameter(":ID_dt_hb", ID_dt_hb)
Return UDB.ExecuteSP("STU_DoiTuongHocBong_Delete", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Check_DoiTuongTroCap(ByVal Ma_dt_hb As String) As Boolean
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(0) As SqlParameter
para(0) = New SqlParameter("@Ma_dt_hb", Ma_dt_hb)
If UDB.SelectTableSP("STU_DoiTuongHocBong_Check", para).Rows.Count > 0 Then
Return True
Else
Return False
End If
Else
Dim para(0) As OracleParameter
para(0) = New OracleParameter(":Ma_dt_hb", Ma_dt_hb)
If UDB.SelectTableSP("STU_DoiTuongHocBong_Check", para).Rows.Count > 0 Then
Return True
Else
Return False
End If
End If
Catch ex As Exception
Throw ex
End Try
End Function
#Region "Danh sách xác định tiền trợ cập"
Public Function Check_DanhSachTroCap(ByVal obj As DanhSachTroCap) As Boolean
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@ID_sv", obj.ID_sv)
para(1) = New SqlParameter("@Hoc_ky", obj.Hoc_ky)
para(2) = New SqlParameter("@Nam_hoc", obj.Nam_hoc)
If UDB.SelectTableSP("STU_DanhSachTroCap_Check", para).Rows.Count > 0 Then
Return True
Else
Return False
End If
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":ID_sv", obj.ID_sv)
para(1) = New OracleParameter(":Hoc_ky", obj.Hoc_ky)
para(2) = New OracleParameter(":Nam_hoc", obj.Nam_hoc)
If UDB.SelectTableSP("STU_DanhSachTroCap_Check", para).Rows.Count > 0 Then
Return True
Else
Return False
End If
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Insert_DanhSachTroCap(ByVal obj As DanhSachTroCap) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(4) As SqlParameter
para(0) = New SqlParameter("@Hoc_ky", obj.Hoc_ky)
para(1) = New SqlParameter("@Nam_hoc", obj.Nam_hoc)
para(2) = New SqlParameter("@Sotien_trocap", obj.Sotien_trocap)
para(3) = New SqlParameter("@ID_sv", obj.ID_sv)
para(4) = New SqlParameter("@Ghi_chu", obj.Ghi_chu)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Insert", para)
Else
Dim para(4) As OracleParameter
para(0) = New OracleParameter(":Hoc_ky", obj.Hoc_ky)
para(1) = New OracleParameter(":Nam_hoc", obj.Nam_hoc)
para(2) = New OracleParameter(":Sotien_trocap", obj.Sotien_trocap)
para(3) = New OracleParameter(":ID_sv", obj.ID_sv)
para(4) = New OracleParameter(":Ghi_chu", obj.Ghi_chu)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Insert", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Update_DanhSachTroCap(ByVal obj As DanhSachTroCap) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(4) As SqlParameter
para(0) = New SqlParameter("@ID_sv", obj.ID_sv)
para(1) = New SqlParameter("@Hoc_ky", obj.Hoc_ky)
para(2) = New SqlParameter("@Nam_hoc", obj.Nam_hoc)
para(3) = New SqlParameter("@Sotien_trocap", obj.Sotien_trocap)
para(4) = New SqlParameter("@Ghi_chu", obj.Ghi_chu)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Update", para)
Else
Dim para(4) As OracleParameter
para(0) = New OracleParameter(":ID_sv", obj.ID_sv)
para(1) = New OracleParameter(":Hoc_ky", obj.Hoc_ky)
para(2) = New OracleParameter(":Nam_hoc", obj.Nam_hoc)
para(3) = New OracleParameter(":Sotien_trocap", obj.Sotien_trocap)
para(4) = New OracleParameter(":Ghi_chu", obj.Ghi_chu)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Update", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Delete_DanhSachTroCap(ByVal ID_sv As Integer, ByVal Hoc_ky As Integer, ByVal Nam_hoc As String) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@ID_sv", ID_sv)
para(1) = New SqlParameter("@Hoc_ky", Hoc_ky)
para(2) = New SqlParameter("@Nam_hoc", Nam_hoc)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Delete", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":ID_sv", ID_sv)
para(1) = New OracleParameter(":Hoc_ky", Hoc_ky)
para(2) = New OracleParameter(":Nam_hoc", Nam_hoc)
Return UDB.ExecuteSP("STU_DanhSachTroCap_Delete", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
#End Region
End Class
End Namespace
|
Imports DevExpress.Mvvm
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Linq.Expressions
Imports System.Text
Imports System.Threading.Tasks
Imports System.Windows.Media.Imaging
Imports DevExpress.SalesDemo.Model
Namespace ProductsDemo
Public MustInherit Class NavigationModule
Inherits ViewModelBase
Public Sub New()
IsActive = True
End Sub
Public MustOverride ReadOnly Property Caption() As String
Public MustOverride ReadOnly Property Description() As String
Public MustOverride ReadOnly Property Glyph() As BitmapImage
Private isActive_Renamed As Boolean = False
Public Property IsActive() As Boolean
Get
Return isActive_Renamed
End Get
Set(ByVal value As Boolean)
SetProperty(isActive_Renamed, value, "IsActive", AddressOf OnIsActiveChanged)
End Set
End Property
Private privateDataProvider As IDataProvider
Public Property DataProvider() As IDataProvider
Get
Return privateDataProvider
End Get
Private Set(ByVal value As IDataProvider)
privateDataProvider = value
End Set
End Property
Private isDataLoading_Renamed As Boolean = False
Public Property IsDataLoading() As Boolean
Get
Return isDataLoading_Renamed
End Get
Private Set(ByVal value As Boolean)
SetProperty(isDataLoading_Renamed, value, "IsDataLoading")
End Set
End Property
Private isDataLoaded_Renamed As Boolean = False
Public Property IsDataLoaded() As Boolean
Get
Return isDataLoaded_Renamed
End Get
Private Set(ByVal value As Boolean)
SetProperty(isDataLoaded_Renamed, value, "IsDataLoaded")
End Set
End Property
Protected MustOverride Sub SaveAndClearData()
Protected MustOverride Sub RestoreData()
Protected MustOverride Sub InitializeData()
Protected Sub SaveAndClearPropertyValue(Of T)(ByRef storage As T, ByVal propName As String, Optional ByVal nullValue As T = Nothing)
Dim storageValue As T = storage
Dim resultValue As T = Nothing
If PropertyCache Is Nothing Then
PropertyCache = New Dictionary(Of String, Object)()
End If
If PropertyCache.ContainsKey(propName) Then
PropertyCache.Remove(propName)
End If
PropertyCache.Add(propName, storageValue)
resultValue = nullValue
storage = resultValue
RaisePropertyChanged(propName)
End Sub
Protected Sub SavePropertyValue(Of T)(ByVal storage As T, ByVal propName As String)
If PropertyCache Is Nothing Then
PropertyCache = New Dictionary(Of String, Object)()
End If
If PropertyCache.ContainsKey(propName) Then
PropertyCache.Remove(propName)
End If
PropertyCache.Add(propName, storage)
End Sub
Protected Sub RestorePropertyValue(Of T)(<System.Runtime.InteropServices.Out()> ByRef storage As T, ByVal propName As String, ByVal doRaisePropertyChanged As Boolean)
Dim resultValue As T = Nothing
If PropertyCache IsNot Nothing AndAlso PropertyCache.ContainsKey(propName) Then
resultValue = DirectCast(PropertyCache(propName), T)
PropertyCache.Remove(propName)
End If
storage = resultValue
If doRaisePropertyChanged Then
RaisePropertyChanged(propName)
End If
End Sub
Protected Overrides Sub OnInitializeInDesignMode()
MyBase.OnInitializeInDesignMode()
DataProvider = New SampleDataProvider()
InitializeData()
End Sub
Protected Overrides Sub OnInitializeInRuntime()
MyBase.OnInitializeInRuntime()
DataProvider = DataSource.GetDataProvider()
End Sub
Private Sub OnIsActiveChanged()
If ViewModelBase.IsInDesignMode Then
Return
End If
If IsDataLoading Then
Return
End If
If IsActive AndAlso (Not IsDataLoaded) Then
InitializeInBackground()
Return
End If
If IsActive = False Then
SaveAndClearData()
Else
RestoreData()
End If
End Sub
Private Sub InitializeInBackground()
If IsDataLoading OrElse IsDataLoaded Then
Return
End If
IsDataLoading = True
Dim t = DoInBackground(AddressOf InitializeData)
t.ContinueWith(Sub(x)
IsDataLoading = False
IsDataLoaded = True
End Sub)
t.Start()
End Sub
Private Function DoInBackground(ByVal action As Action) As Task
Return New Task(action)
End Function
Private PropertyCache As Dictionary(Of String, Object)
End Class
End Namespace
|
Class spProveedores_ProveedoresTipos
inherits BasesParaCompatibilidad.sp
Public Sub New()
MyBase.New("[dbo].[Proveedores_ProveedoresTiposSelect]", "[dbo].[Proveedores_ProveedoresTiposInsert2]", _
"[dbo].[Proveedores_ProveedoresTiposUpdate2]", "[dbo].[Proveedores_ProveedoresTiposDeleteByProveedorID2]", _
"Proveedores_ProveedoresTiposSelectDgv", "Proveedores_ProveedoresTiposSelectDgvByID")
End Sub
Public Function Select_Record(ByVal Proveedor_ProveedorTipoID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As DBO_Proveedores_ProveedoresTipos
dtb.Conectar()
Dim DBO_Proveedores_ProveedoresTipos As New DBO_Proveedores_ProveedoresTipos
Dim selectProcedure As String = "[dbo].[Proveedores_ProveedoresTiposSelect]"
Dim selectCommand As System.Data.SqlClient.SqlCommand = dtb.comando(selectProcedure)
selectCommand.CommandType = CommandType.StoredProcedure
selectCommand.Parameters.AddWithValue("@Proveedor_ProveedorTipoID", Proveedor_ProveedorTipoID)
Try
Dim reader As System.Data.SqlClient.SqlDataReader = selectCommand.ExecuteReader(CommandBehavior.SingleRow)
If reader.Read Then
DBO_Proveedores_ProveedoresTipos.Proveedor_ProveedorTipoID = If(reader("Proveedor_ProveedorTipoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("Proveedor_ProveedorTipoID")))
DBO_Proveedores_ProveedoresTipos.ProveedorID = If(reader("ProveedorID") Is Convert.DBNull, 0, Convert.ToInt32(reader("ProveedorID")))
DBO_Proveedores_ProveedoresTipos.ProveedorTipoID = If(reader("ProveedorTipoID") Is Convert.DBNull, 0, Convert.ToInt32(reader("ProveedorTipoID")))
DBO_Proveedores_ProveedoresTipos.FechaModificacion = If(reader("FechaModificacion") Is Convert.DBNull, System.DateTime.Now.Date, CDate(reader("FechaModificacion")))
DBO_Proveedores_ProveedoresTipos.UsuarioModificacion = If(reader("UsuarioModificacion") Is Convert.DBNull, 0, Convert.ToInt32(reader("UsuarioModificacion")))
Else
DBO_Proveedores_ProveedoresTipos = Nothing
End If
reader.Close()
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
Return DBO_Proveedores_ProveedoresTipos
End Function
Public Function Proveedores_ProveedoresTiposInsert(ByVal dbo_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim insertProcedure As String = "[dbo].[Proveedores_ProveedoresTiposInsert]"
Dim insertCommand As System.Data.SqlClient.SqlCommand = dtb.comando(insertProcedure)
insertCommand.CommandType = CommandType.StoredProcedure
insertCommand.Parameters.AddWithValue("@ProveedorID", If(dbo_Proveedores_ProveedoresTipos.ProveedorID.HasValue, dbo_Proveedores_ProveedoresTipos.ProveedorID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@ProveedorTipoID", If(dbo_Proveedores_ProveedoresTipos.ProveedorTipoID.HasValue, dbo_Proveedores_ProveedoresTipos.ProveedorTipoID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@FechaModificacion", dbo_Proveedores_ProveedoresTipos.FechaModificacion)
insertCommand.Parameters.AddWithValue("@UsuarioModificacion", dbo_Proveedores_ProveedoresTipos.UsuarioModificacion)
insertCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
insertCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
insertCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(insertCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
End Function
Public Function Proveedores_ProveedoresTiposUpdate(ByVal newDBO_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim updateProcedure As String = "[dbo].[Proveedores_ProveedoresTiposUpdate]"
Dim updateCommand As System.Data.SqlClient.SqlCommand = dtb.comando(updateProcedure)
updateCommand.CommandType = CommandType.StoredProcedure
updateCommand.Parameters.AddWithValue("@NewProveedorID", If(newDBO_Proveedores_ProveedoresTipos.ProveedorID.HasValue, newDBO_Proveedores_ProveedoresTipos.ProveedorID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewProveedorTipoID", If(newDBO_Proveedores_ProveedoresTipos.ProveedorTipoID.HasValue, newDBO_Proveedores_ProveedoresTipos.ProveedorTipoID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewFechaModificacion", newDBO_Proveedores_ProveedoresTipos.FechaModificacion)
updateCommand.Parameters.AddWithValue("@NewUsuarioModificacion", newDBO_Proveedores_ProveedoresTipos.UsuarioModificacion)
updateCommand.Parameters.AddWithValue("@OldProveedor_ProveedorTipoID", newDBO_Proveedores_ProveedoresTipos.Proveedor_ProveedorTipoID)
updateCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
updateCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
updateCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(updateCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
MessageBox.Show("Error en UpdateProveedores_ProveedoresTipos" & Environment.NewLine & Environment.NewLine & ex.Message, Convert.ToString(ex.GetType))
Return False
Finally
dtb.Desconectar()
End Try
End Function
Public Function Proveedores_ProveedoresTiposInsertSinTransaccion(ByVal dbo_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
Try
Dim insertProcedure As String = "[dbo].[Proveedores_ProveedoresTiposInsert2]"
Dim insertCommand As System.Data.SqlClient.SqlCommand = dtb.comando(insertProcedure)
insertCommand.CommandType = CommandType.StoredProcedure
insertCommand.Parameters.AddWithValue("@ProveedorID", If(dbo_Proveedores_ProveedoresTipos.ProveedorID.HasValue, dbo_Proveedores_ProveedoresTipos.ProveedorID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@ProveedorTipoID", If(dbo_Proveedores_ProveedoresTipos.ProveedorTipoID.HasValue, dbo_Proveedores_ProveedoresTipos.ProveedorTipoID, Convert.DBNull))
insertCommand.Parameters.AddWithValue("@FechaModificacion", dbo_Proveedores_ProveedoresTipos.FechaModificacion)
insertCommand.Parameters.AddWithValue("@UsuarioModificacion", dbo_Proveedores_ProveedoresTipos.UsuarioModificacion)
insertCommand.ExecuteNonQuery()
Return True
Catch ex As System.Data.SqlClient.SqlException
Return False
End Try
End Function
Public Function Proveedores_ProveedoresTiposUpdateSinTransaccion(ByVal newDBO_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
Try
Dim updateProcedure As String = "[dbo].[Proveedores_ProveedoresTiposUpdate2]"
Dim updateCommand As System.Data.SqlClient.SqlCommand = dtb.comando(updateProcedure)
updateCommand.CommandType = CommandType.StoredProcedure
updateCommand.Parameters.AddWithValue("@NewProveedorID", If(newDBO_Proveedores_ProveedoresTipos.ProveedorID.HasValue, newDBO_Proveedores_ProveedoresTipos.ProveedorID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewProveedorTipoID", If(newDBO_Proveedores_ProveedoresTipos.ProveedorTipoID.HasValue, newDBO_Proveedores_ProveedoresTipos.ProveedorTipoID, Convert.DBNull))
updateCommand.Parameters.AddWithValue("@NewFechaModificacion", newDBO_Proveedores_ProveedoresTipos.FechaModificacion)
updateCommand.Parameters.AddWithValue("@NewUsuarioModificacion", newDBO_Proveedores_ProveedoresTipos.UsuarioModificacion)
updateCommand.Parameters.AddWithValue("@OldProveedor_ProveedorTipoID", newDBO_Proveedores_ProveedoresTipos.Proveedor_ProveedorTipoID)
updateCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
updateCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
updateCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(updateCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Return False
MessageBox.Show("Error en UpdateProveedores_ProveedoresTipos" & Environment.NewLine & Environment.NewLine & ex.Message, Convert.ToString(ex.GetType))
End Try
End Function
Public Function Proveedores_ProveedoresTiposDelete(ByVal Proveedor_ProveedorTipoID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim deleteProcedure As String = "[dbo].[Proveedores_ProveedoresTiposDelete]"
Dim deleteCommand As System.Data.SqlClient.SqlCommand = dtb.comando(deleteProcedure)
deleteCommand.CommandType = CommandType.StoredProcedure
deleteCommand.Parameters.AddWithValue("@OldProveedor_ProveedorTipoID", Proveedor_ProveedorTipoID)
deleteCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
deleteCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
Try
deleteCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(deleteCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
End Function
Public Function Proveedores_ProveedoresTiposDeleteByProveedorID(ByVal ProveedorID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
dtb.Conectar()
Dim deleteProcedure As String = "[dbo].[Proveedores_ProveedoresTiposDeleteByProveedorID3]"
Dim deleteCommand As System.Data.SqlClient.SqlCommand = dtb.comando(deleteProcedure)
deleteCommand.CommandType = CommandType.StoredProcedure
deleteCommand.Parameters.AddWithValue("@OldProveedorID", ProveedorID)
Try
deleteCommand.ExecuteNonQuery()
Return True
Catch ex As System.Data.SqlClient.SqlException
Throw
Finally
dtb.Desconectar()
End Try
End Function
Public Function Proveedores_ProveedoresTiposDeleteByProveedorIDSinTransaccion(ByVal ProveedorID As Int32, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
Try
Dim deleteProcedure As String = "[dbo].[Proveedores_ProveedoresTiposDeleteByProveedorID2]"
Dim deleteCommand As System.Data.SqlClient.SqlCommand = dtb.Comando(deleteProcedure)
deleteCommand.CommandType = CommandType.StoredProcedure
deleteCommand.Parameters.AddWithValue("@OldProveedorID", ProveedorID)
deleteCommand.Parameters.Add("@ReturnValue", System.Data.SqlDbType.Int)
deleteCommand.Parameters("@ReturnValue").Direction = ParameterDirection.Output
deleteCommand.ExecuteNonQuery()
Dim count As Integer = System.Convert.ToInt32(deleteCommand.Parameters("@ReturnValue").Value)
If count > 0 Then
Return True
Else
Return False
End If
Catch ex As System.Data.SqlClient.SqlException
Return False
Throw
End Try
End Function
Public Sub GrabarProveedores_ProveedoresTipos(ByVal dbo_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase)
If dbo_Proveedores_ProveedoresTipos.Proveedor_ProveedorTipoID = 0 Then
Proveedores_ProveedoresTiposInsert(dbo_Proveedores_ProveedoresTipos, dtb)
Else
Proveedores_ProveedoresTiposUpdate(dbo_Proveedores_ProveedoresTipos, dtb)
End If
End Sub
Public Function GrabarProveedores_ProveedoresTiposSinTransaccion(ByVal dbo_Proveedores_ProveedoresTipos As DBO_Proveedores_ProveedoresTipos, ByRef dtb As BasesParaCompatibilidad.DataBase) As Boolean
If dbo_Proveedores_ProveedoresTipos.Proveedor_ProveedorTipoID = 0 Then
Return Proveedores_ProveedoresTiposInsertSinTransaccion(dbo_Proveedores_ProveedoresTipos, dtb)
Else
Return Proveedores_ProveedoresTiposUpdateSinTransaccion(dbo_Proveedores_ProveedoresTipos, dtb)
End If
End Function
End Class
|
Imports CraalDatabase
Imports System.Data.SqlClient
Imports System.Collections.ObjectModel
Public Class index
Inherits System.Web.UI.Page
Private pDatabaseConnection As SqlConnection
Private pDatabase As Database
Private pDataset As New DataSet
Private Const DATASOURCE_SELECT_STATEMENT As String = "SELECT * FROM DataSources"
Private Const CONTENT_SELECT_STATEMENT As String = "SELECT TOP 1000 (SELECT Name FROM DataSources WHERE ID = DataSource) As DataSource, SourceURL, Hash, Keywords, CollectedTime, DATALENGTH(Data) As ContentSize FROM [Content] ORDER BY CollectedTime DESC"
Private Const CONTENT_KEYWORD_SELECT_STATEMENT As String = "SELECT TOP 1000 (SELECT Name FROM DataSources WHERE ID = DataSource) As DataSource, SourceURL, Hash, Keywords, CollectedTime, DATALENGTH(Data) As ContentSize FROM [Content] WHERE CONTAINS(Keywords, @Keyword) ORDER BY CollectedTime DESC"
Private pDataSources As Collection(Of DataSource)
Public Structure DataSource
Dim ID As Integer
Dim Name As String
End Structure
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
pDatabaseConnection = New SqlConnection(Application("ConnectionString"))
pDatabase = New Database(Application("ConnectionString"))
Call pDatabaseConnection.Open()
Dim TableStats As Database.TableSizeStatistics = pDatabase.GetContentTableSize()
Try
ContentTableSize.Text = TableStats.RowCount & " rows, " & TableStats.DataSize
Catch ex As NullReferenceException
ContentTableSize.Text = "Couldn't get Content table size"
End Try
If Not Page.IsPostBack Then
Session("LastRefresh") = Now.AddSeconds(1)
Call cmdSearch_Click(Nothing, Nothing)
End If
End Sub
Public Function GetDataSources() As Collection(Of DataSource)
If pDatabaseConnection.State <> ConnectionState.Open Then
Return New Collection(Of DataSource)
End If
Dim DataSources As New Collection(Of DataSource)
Dim SelectCommand As New SqlCommand(DATASOURCE_SELECT_STATEMENT, pDatabaseConnection)
Dim DatabaseAdaptor As New SqlDataAdapter(SelectCommand)
Dim DatabaseTable As New DataTable
If DatabaseAdaptor.Fill(DatabaseTable) > 0 Then
Dim Source As New DataSource
For i = 0 To DatabaseTable.Rows.Count - 1
Source.ID = DatabaseTable.Rows(i).Item("ID")
Source.Name = DatabaseTable.Rows(i).Item("Name")
Call DataSources.Add(Source)
Next
End If
Return DataSources
End Function
Private Sub DataGrid_PageIndexChanged(source As Object, e As DataGridPageChangedEventArgs) Handles DataGrid.PageIndexChanged
DataGrid.CurrentPageIndex = e.NewPageIndex
End Sub
Private Sub DataGrid_ItemDataBound(sender As Object, e As DataGridItemEventArgs) Handles DataGrid.ItemDataBound
If Not e.Item.DataItem Is Nothing Then
If e.Item.DataItem.Row.ItemArray(4) > Session("LastRefresh") Then
e.Item.BackColor = Drawing.Color.Green
End If
End If
End Sub
Public Shared Function GetDataSize(ByVal SizeInBytes As Object) As String
If IsDBNull(SizeInBytes) Then
Return "0 B"
End If
Dim Measurements() As String = {" B", " KB", " MB", " GB", " TB"}
Dim Divisions As Integer = 0
While SizeInBytes > 900 And Divisions < 5
SizeInBytes /= 1024
Divisions += 1
End While
Return SizeInBytes & Measurements(Divisions)
End Function
Private Sub cmdSubmitContainer_Click(sender As Object, e As EventArgs) Handles cmdSubmitContainer.Click
' Check to make sure there's a Bucket name
If txtBucketName.Text <> "" Then
' Insert the Bucket name (and AWS authentication data if any) and redirect to the index upon success
If pDatabase.InsertPendingContainer(txtBucketName.Text, txtClientKey.Text, txtSecretKey.Text, Database.ContainerType.S3Bucket) Then
txtBucketName.Text = ""
txtClientKey.Text = ""
txtSecretKey.Text = ""
End If
End If
End Sub
Private Sub cmdSubmitDNS_Click(sender As Object, e As EventArgs) Handles cmdSubmitDNS.Click
''TODO
End Sub
Private Sub cmdSearchTab_Click(sender As Object, e As EventArgs) Handles cmdSearchTab.Click
pnlSearch.Visible = True
pnlQueueContainer.Visible = False
pnlProcessDNSLogs.Visible = False
End Sub
Private Sub cmdQueueContainerTab_Click(sender As Object, e As EventArgs) Handles cmdQueueContainerTab.Click
pnlSearch.Visible = False
pnlQueueContainer.Visible = True
pnlProcessDNSLogs.Visible = False
End Sub
Private Sub cmdProcessDNSLogsTab_Click(sender As Object, e As EventArgs) Handles cmdProcessDNSLogsTab.Click
pnlSearch.Visible = False
pnlQueueContainer.Visible = False
pnlProcessDNSLogs.Visible = True
End Sub
Private Sub cmdSearch_Click(sender As Object, e As EventArgs) Handles cmdSearch.Click
Dim WhereClause As String = ""
If Not (chkDataSources.Items(0).Selected And chkDataSources.Items(1).Selected And chkDataSources.Items(2).Selected) Then
DataGrid.Visible = False
If chkDataSources.Items(0).Selected Then
WhereClause = "WHERE DataSource = 1 "
Else
WhereClause = "WHERE DataSource <> 1 "
End If
If chkDataSources.Items(1).Selected Then
If WhereClause = "" Then
WhereClause = "WHERE "
Else
WhereClause &= "OR "
End If
WhereClause &= "DataSource = 2 "
Else
If WhereClause = "" Then
WhereClause = "WHERE "
Else
WhereClause &= "OR "
End If
WhereClause &= "DataSource <> 2 "
End If
If chkDataSources.Items(2).Selected Then
If WhereClause = "" Then
WhereClause = "WHERE "
Else
WhereClause &= "OR "
End If
WhereClause &= "DataSource = 3 "
Else
If WhereClause = "" Then
WhereClause = "WHERE "
Else
WhereClause &= "OR "
End If
WhereClause &= "DataSource <> 3 "
End If
End If
Dim DataAdaptor As SqlDataAdapter
If txtKeywords.Text = "" Then
DataAdaptor = New SqlDataAdapter(New SqlCommand(CONTENT_SELECT_STATEMENT & " " & WhereClause, pDatabaseConnection))
Else
Dim SelectStatement As New SqlCommand(CONTENT_KEYWORD_SELECT_STATEMENT & " " & WhereClause, pDatabaseConnection)
SelectStatement.Parameters.Add(New SqlParameter("Keyword", txtKeywords.Text))
DataAdaptor = New SqlDataAdapter(SelectStatement)
End If
Call DataAdaptor.Fill(pDataset)
DataGrid.DataSource = pDataset
Call DataGrid.DataBind()
End Sub
End Class |
'
' Copyright (C) 2009 SpeedCS Team
' http://streamboard.gmc.to
'
' This Program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 2, 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 GNU Make; see the file COPYING. If not, write to
' the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
' http://www.gnu.org/copyleft/gpl.html
'
'
Imports System.IO
Imports System.Text.RegularExpressions
Public Class clsCWlog
Public cwLogChannels As New SortedList(Of UInt32, clsLogChannel)
Public Sub WriteCWlog(ByVal Message() As Byte)
Dim key As UInt32
Using ms As New MemoryStream
ms.Write(Message, 8, 8)
key = BitConverter.ToUInt32(clsCRC32.CRC32OfByte(ms.ToArray), 0)
End Using
Dim logChannel As clsLogChannel
If cwLogChannels.ContainsKey(key) Then
logChannel = TryCast(cwLogChannels(key), clsLogChannel)
Else
Dim iSRVID As UInt16 = GetLittleEndian(BitConverter.ToUInt16(Message, 8))
Dim iCAID As UInt16 = GetLittleEndian(BitConverter.ToUInt16(Message, 10))
Dim iPROVID As UInt32
Using ms As New MemoryStream
ms.Write(Message, 12, 4)
Dim byteTmp() As Byte = ms.ToArray
Array.Reverse(byteTmp)
iPROVID = BitConverter.ToUInt32(byteTmp, 0)
End Using
logChannel = New clsLogChannel(iSRVID, iCAID, iPROVID) 'Moved variables to Constructor
cwLogChannels.Add(key, logChannel)
End If
logChannel.ResolveCMD1(Message)
End Sub
End Class
Public Class clsLogChannel
Private filepath As String
Private lastOddChecksum As UInt32
Private lastOddTimestamp As Date
Private isFirstOdd As Boolean = True
Private lastEvenChecksum As UInt32
Private lastEvenTimestamp As Date
Private isFirstEven As Boolean = True
Private actualFilePath As String
Private actualFileName As String
Private _iSRVID As UInt16
Private _iCAID As UInt16
Private _iPROVID As UInt32
Public Sub New(ByVal iSRVID As UInt16, ByVal iCAID As UInt16, ByVal iPROVID As UInt32)
filepath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), _
Application.ProductName)
_iSRVID = iSRVID
_iCAID = iCAID
_iPROVID = iPROVID
SetEnv()
End Sub
Private Sub SetEnv()
Dim d As Date = Date.Now
actualFilePath = Path.Combine(filepath, "CWL-" & d.Year & d.Month & d.Day)
If Not Directory.Exists(actualFilePath) Then
Directory.CreateDirectory(actualFilePath)
Dim serviceName As String = Services.GetServiceInfo(_iCAID.ToString("X4") & ":" & _iSRVID.ToString("X4")).Name
serviceName = Regex.Replace(serviceName.Trim, "[^A-Za-z0-9]", "_")
actualFileName = d.Year.ToString.Substring(2, 2) & d.Month.ToString.PadLeft(2, CChar("0")) & d.Day.ToString.PadLeft(2, CChar("0")) _
& "-C" & _iCAID.ToString("X4") _
& "-I" & _iSRVID.ToString("X4") _
& "-P" & _iPROVID.ToString("X6") _
& "-" & serviceName _
& ".cwl"
actualFileName = Path.Combine(actualFilePath, actualFileName)
WriteHeaderToFile()
End If
If Not File.Exists(actualFileName) Then
Dim serviceName As String = Services.GetServiceInfo(_iCAID.ToString("X4") & ":" & _iSRVID.ToString("X4")).Name
serviceName = Regex.Replace(serviceName.Trim, "[^A-Za-z0-9]", "_")
actualFileName = d.Year.ToString.Substring(2, 2) & d.Month.ToString.PadLeft(2, CChar("0")) & d.Day.ToString.PadLeft(2, CChar("0")) _
& "-C" & _iCAID.ToString("X4") _
& "-I" & _iSRVID.ToString("X4") _
& "-P" & _iPROVID.ToString("X6") _
& "-" & serviceName _
& ".cwl"
actualFileName = Path.Combine(actualFilePath, actualFileName)
WriteHeaderToFile()
End If
End Sub
Public Sub ResolveCMD1(ByVal Message() As Byte)
Using ms As New MemoryStream
ms.Write(Message, 20, 8)
Dim actOddChecksum As UInt32 = BitConverter.ToUInt32(clsCRC32.CRC32OfByte(ms.ToArray), 0)
If Not actOddChecksum = lastOddChecksum Then
If Not isFirstOdd Then WriteCWtoFile(0, ms.ToArray)
lastOddChecksum = actOddChecksum
isFirstOdd = False
End If
End Using
Using ms As New MemoryStream
ms.Write(Message, 28, 8)
Dim actEvenChecksum As UInt32 = BitConverter.ToUInt32(clsCRC32.CRC32OfByte(ms.ToArray), 0)
If Not actEvenChecksum = lastEvenChecksum Then
If Not isFirstEven Then WriteCWtoFile(1, ms.ToArray)
lastEvenChecksum = actEvenChecksum
isFirstEven = False
End If
End Using
End Sub
Private Sub WriteHeaderToFile()
Dim strOut As String = String.Empty
'# CWlog V1.0 - logging of ORF1 started at: 01/06/09 21:32:55
strOut &= "# CWlog V1.0 - logging of "
strOut &= Services.GetServiceInfo(_iCAID.ToString("X4") & ":" & _iSRVID.ToString("X4")).Name
strOut &= " started at: " & Date.Now.ToString & " logged by speedCS"
Using fw As New StreamWriter(actualFileName, True)
fw.WriteLine(strOut)
End Using
'# CAID 0x0D05, PID 0x00C9, PROVIDER 0x000004
strOut = "# CAID 0x" & _iCAID.ToString("X4") & ","
strOut &= " PID 0x" & _iSRVID.ToString("X4") & ","
strOut &= " PROVIDER 0x" & _iPROVID.ToString("X6")
Using fw As New StreamWriter(actualFileName, True)
fw.WriteLine(strOut)
End Using
End Sub
Private Sub WriteCWtoFile(ByVal parity As Byte, ByVal Message() As Byte)
Dim strOut As String = String.Empty
For i As Integer = 0 To Message.Length - 1
strOut &= Message(i).ToString("X2") & " "
Next
If Not File.Exists(actualFileName) Then SetEnv()
Using fw As New StreamWriter(actualFileName, True)
fw.WriteLine(parity & " " & strOut & "# " & Date.Now.ToLongTimeString)
End Using
End Sub
End Class
|
Imports System.Security.Cryptography
Public Class Encriptador
Private salt As Byte()
Public Function Encriptar(contrasena As String) As String
ObtenerSalt()
Return CombinarSaltYHash(ObtenerHash(contrasena))
End Function
Public Function ObtenerHashBytes(contrasena As String, contrasenaHash As String) As ContrasenasHash
Dim hashBytes As Byte() = Convert.FromBase64String(contrasenaHash)
Dim salt As Byte() = New Byte(15) {}
Array.Copy(hashBytes, 0, salt, 0, 16)
Dim pbkdf2 = New Rfc2898DeriveBytes(contrasena, salt, 10000)
Dim hash As Byte() = pbkdf2.GetBytes(20)
Return New ContrasenasHash With
{
.HashBytesContrasenaAlmacenada = hashBytes,
.HashBytesUsuarioContrasena = hash
}
End Function
Private Sub ObtenerSalt()
salt = New Byte(15) {}
Dim rng = New RNGCryptoServiceProvider()
rng.GetBytes(salt)
End Sub
Private Function ObtenerHash(password As String) As Byte()
Dim pbkdf2 = New Rfc2898DeriveBytes(password, salt, 10000)
Dim hash = pbkdf2.GetBytes(20)
Return hash
End Function
Private Function CombinarSaltYHash(hash As Byte()) As String
Dim hashBytes As Byte() = New Byte(36) {}
Array.Copy(salt, 0, hashBytes, 0, 16)
Array.Copy(hash, 0, hashBytes, 16, 20)
Dim savedPasswordHash As String = Convert.ToBase64String(hashBytes)
Return savedPasswordHash
End Function
End Class
|
Public Class MovingPiece
Inherits GamePiece
Dim WithEvents objTimer As Timer = New Timer
Dim objPlayerObj As Player, objListOfBlocksObj As List(Of GamePiece)
Public Event Score()
Public Event Out()
Public Enum MovementTypeEnum
None
Diagonal
Horizontal
Vertical
Random
End Enum
Dim nMovementType As MovementTypeEnum = MovementTypeEnum.None
Dim nOutOfBoundsTopEffect As EffectEnum = EffectEnum.None
Dim nOutOfBoundsBottomEffect As EffectEnum = EffectEnum.None
Dim nOutOfBoundsRightEffect As EffectEnum = EffectEnum.None
Dim nOutOfBoundsLeftEffect As EffectEnum = EffectEnum.None
Dim nOutOfBoundsTopAction As ActionEnum = ActionEnum.None
Dim nOutOfBoundsBottomAction As ActionEnum = ActionEnum.None
Dim nOutOfBoundsRightAction As ActionEnum = ActionEnum.None
Dim nOutOfBoundsLeftAction As ActionEnum = ActionEnum.None
Public Sub New()
With Me
.Width = 25
.Height = .Width
End With
End Sub
Public Property TimerOn As Boolean
Get
Return objTimer.Enabled
End Get
Set(value As Boolean)
objTimer.Enabled = value
End Set
End Property
Public Property ListOfGamePieces As List(Of GamePiece)
Get
Return objListOfBlocksObj
End Get
Set(value As List(Of GamePiece))
objListOfBlocksObj = value
End Set
End Property
Public Property Player As Player
Get
Return objPlayerObj
End Get
Set(value As Player)
objPlayerObj = value
End Set
End Property
Private Sub objTimer_Tick(sender As Object, e As EventArgs) Handles objTimer.Tick
Me.MoveBall(0, objPlayerObj, objListOfBlocksObj)
End Sub
Private Sub MoveBall(MinTopValue As Integer, PlayerObj As Player, ListOfBlocksObj As List(Of GamePiece))
Static nLeftDirection As Integer = 1
Static nTopDirection As Integer = 1
Static objRandom As Random = New Random
Dim nRandomChance As Integer = 8
Dim objParentControl As Control = Me.Parent
If objParentControl Is Nothing Then Exit Sub
With Me
If nMovementType = MovementTypeEnum.Random Then
'horizontal
If .Left > 0 And .Right < objParentControl.Width Then
Dim n As Integer = objRandom.Next(1, 11)
If n > nRandomChance Then
nLeftDirection = -nLeftDirection
End If
End If
'vertical
If .Top > 0 And .Bottom <= objParentControl.Height Then
Dim n As Integer = objRandom.Next(1, 11)
If n > nRandomChance Then
nTopDirection = -nTopDirection
End If
End If
End If
'move ball
Select Case nMovementType
Case MovementTypeEnum.Diagonal, MovementTypeEnum.Horizontal, MovementTypeEnum.Random
.Left = .Left + (.Width * nLeftDirection)
End Select
Select Case nMovementType
Case MovementTypeEnum.Diagonal, MovementTypeEnum.Vertical, MovementTypeEnum.Random
.Top = .Top + (.Height * nTopDirection)
End Select
Dim bLeftOutofBounds As Boolean = .Left <= 0
Dim bRightOutofBounds As Boolean = .Right >= objParentControl.Width
Dim bTopOutOfBounds As Boolean = .Top <= MinTopValue
Dim bBottomOutOfBounds As Boolean = .Bottom >= objParentControl.Height
'check action
Dim bDisappear As Boolean = False
If bLeftOutofBounds = True Then
Select Case nOutOfBoundsLeftAction
Case ActionEnum.None
nLeftDirection = 1
Case ActionEnum.Disappear
bDisappear = True
End Select
End If
If bRightOutofBounds = True Then
Select Case nOutOfBoundsRightAction
Case ActionEnum.None
nLeftDirection = -1
Case ActionEnum.Disappear
bDisappear = True
End Select
End If
If bTopOutOfBounds = True Then
Select Case nOutOfBoundsTopAction
Case ActionEnum.None
nTopDirection = 1
Case ActionEnum.Disappear
bDisappear = True
End Select
End If
If bBottomOutOfBounds = True Then
Select Case nOutOfBoundsBottomAction
Case ActionEnum.None
nTopDirection = -1
Case Else
bDisappear = True
End Select
End If
If CheckOverlap(Me, PlayerObj) = True Then
Select Case PlayerObj.HitEffect
Case EffectEnum.Score
RaiseEvent Score()
Case EffectEnum.Out
RaiseEvent Out()
End Select
nTopDirection = -nTopDirection
End If
'check out
If bBottomOutOfBounds = True Then
Select Case nOutOfBoundsBottomEffect
Case EffectEnum.Out
RaiseEvent Out()
Case EffectEnum.Score
RaiseEvent Score()
End Select
End If
If bTopOutOfBounds = True Then
Select Case nOutOfBoundsTopEffect
Case EffectEnum.Out
RaiseEvent Out()
Case EffectEnum.Score
RaiseEvent Score()
End Select
End If
If bLeftOutofBounds = True Then
Select Case nOutOfBoundsLeftEffect
Case EffectEnum.Out
RaiseEvent Out()
Case EffectEnum.Score
RaiseEvent Score()
End Select
End If
If bRightOutofBounds = True Then
Select Case nOutOfBoundsRightEffect
Case EffectEnum.Out
RaiseEvent Out()
Case EffectEnum.Score
RaiseEvent Score()
End Select
End If
'check overlap of blocks in list and score
For Each objGamePiece As GamePiece In ListOfBlocksObj
With objGamePiece
If .Visible = True And CheckOverlap(Me, objGamePiece) = True Then
nTopDirection = 1
Select Case .HitEffect
Case EffectEnum.Score
RaiseEvent Score()
Case EffectEnum.Out
RaiseEvent Out()
End Select
.Visible = False
Exit For
End If
End With
Next
If bDisappear = True Then
.Disappear()
Exit Sub
End If
End With
End Sub
Private Function CheckOverlap(SourceLabel As Label, TargetLabel As GamePiece) As Boolean
Dim bOverlap As Boolean = False
Dim bLeft As Boolean = False
Dim bTop As Boolean = False
With SourceLabel
If IsBetween(.Left, TargetLabel.Left, TargetLabel.Right) = True Then
bLeft = True
ElseIf IsBetween(.Right, TargetLabel.Left, TargetLabel.Right) Then
bLeft = True
ElseIf IsBetween(TargetLabel.Left, .Left, .Right) = True Then
bLeft = True
ElseIf IsBetween(TargetLabel.Right, .Left, .Right) Then
bLeft = True
End If
If IsBetween(.Top, TargetLabel.Top, TargetLabel.Bottom) = True Then
bTop = True
ElseIf IsBetween(.Bottom, TargetLabel.Top, TargetLabel.Bottom) Then
bTop = True
ElseIf IsBetween(TargetLabel.Top, .Top, .Bottom) = True Then
bTop = True
ElseIf IsBetween(TargetLabel.Bottom, .Top, .Bottom) Then
bTop = True
End If
End With
If bLeft = True And bTop = True Then
bOverlap = True
End If
Return bOverlap
End Function
Private Function IsBetween(SourceValue As Integer, MinValue As Integer, MaxValue As Integer) As Boolean
Dim b As Boolean = False
If SourceValue >= MinValue And SourceValue <= MaxValue Then
b = True
End If
Return b
End Function
#Region "Properties"
Public Property MovementType As MovementTypeEnum
Get
Return nMovementType
End Get
Set(value As MovementTypeEnum)
nMovementType = value
End Set
End Property
Public Property OutofBoundsTopEffect As EffectEnum
Get
Return nOutOfBoundsTopEffect
End Get
Set(value As EffectEnum)
nOutOfBoundsTopEffect = value
End Set
End Property
Public Property OutofBoundsBottomEffect As EffectEnum
Get
Return nOutOfBoundsBottomEffect
End Get
Set(value As EffectEnum)
nOutOfBoundsBottomEffect = value
End Set
End Property
Public Property OutofBoundsRightEffect As EffectEnum
Get
Return nOutOfBoundsRightEffect
End Get
Set(value As EffectEnum)
nOutOfBoundsRightEffect = value
End Set
End Property
Public Property OutofBoundsLeftEffect As EffectEnum
Get
Return nOutOfBoundsLeftEffect
End Get
Set(value As EffectEnum)
nOutOfBoundsLeftEffect = value
End Set
End Property
Public Property OutofBoundsTopAction As ActionEnum
Get
Return nOutOfBoundsTopAction
End Get
Set(value As ActionEnum)
nOutOfBoundsTopAction = value
End Set
End Property
Public Property OutofBoundsBottomAction As ActionEnum
Get
Return nOutOfBoundsBottomAction
End Get
Set(value As ActionEnum)
nOutOfBoundsBottomAction = value
End Set
End Property
Public Property OutofBoundsRightAction As ActionEnum
Get
Return nOutOfBoundsRightAction
End Get
Set(value As ActionEnum)
nOutOfBoundsRightAction = value
End Set
End Property
Public Property OutofBoundsLeftAction As ActionEnum
Get
Return nOutOfBoundsLeftAction
End Get
Set(value As ActionEnum)
nOutOfBoundsLeftAction = value
End Set
End Property
#End Region
End Class
|
#Region "Microsoft.VisualBasic::777138c3cbf842414a1b8c702c717233, mzkit\Rscript\Library\mzkit\assembly\NMR.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: 64
' Code Lines: 37
' Comment Lines: 18
' Blank Lines: 9
' File Size: 2.03 KB
' Module NMRTool
'
' Function: acquisition, FourierTransform, GetMatrix, readSmall, spectrumData
' spectrumList
'
' /********************************************************************************/
#End Region
Imports BioNovoGene.Analytical.MassSpectrometry.Assembly.MarkupData
Imports BioNovoGene.Analytical.MassSpectrometry.Assembly.MarkupData.nmrML
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Spectra
Imports BioNovoGene.Analytical.NMRFidTool
Imports BioNovoGene.Analytical.NMRFidTool.fidMath.FFT
Imports Microsoft.VisualBasic.CommandLine.Reflection
Imports Microsoft.VisualBasic.Scripting.MetaData
<Package("NMR")>
Module NMRTool
<ExportAPI("read.nmrML")>
Public Function readSmall(file As String) As nmrML.XML
Return file.LoadXml(Of nmrML.XML)
End Function
''' <summary>
''' get all acquisition data in the raw data file
''' </summary>
''' <param name="nmrML"></param>
''' <returns></returns>
<ExportAPI("acquisition")>
Public Function acquisition(nmrML As nmrML.XML) As acquisition()
Return nmrML.acquisition
End Function
''' <summary>
''' Read Free Induction Decay data matrix
''' </summary>
''' <param name="data"></param>
''' <returns></returns>
<ExportAPI("FID")>
Public Function GetMatrix(data As acquisition) As Fid
Return Fid.Create(data)
End Function
<ExportAPI("nmr_dft")>
Public Function FourierTransform(fidData As Fid) As Spectrum
Return New FastFourierTransform1D(New Spectrum(fidData)).computeFFT
End Function
<ExportAPI("spectrumList")>
Public Function spectrumList(nmrML As nmrML.XML) As spectrumList()
Return nmrML.spectrumList
End Function
''' <summary>
'''
''' </summary>
''' <param name="spectrum"></param>
''' <param name="nmrML"></param>
''' <returns>
''' a matrix of [ppm => intensity]
''' </returns>
<ExportAPI("spectrum")>
Public Function spectrumData(spectrum As spectrumList, nmrML As nmrML.XML) As LibraryMatrix
Dim data = spectrum.spectrum1D(Scan0)
Dim sw = nmrML.acquisition.First.acquisition1D.SW
Dim matrix = data.ParseMatrix(SW:=sw)
Return matrix
End Function
End Module
|
'---------------------------------------------------------------------------
' Author : Nguyễn Khánh Tùng
' Company : Thiên An ESS
' Created Date : Tuesday, August 12, 2008
'---------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OracleClient
Imports ESS.Machine
Imports ESS.Entity.Entity
Namespace DBManager
Public Class MonDangKy_DAL
#Region "Constructor"
Public Sub New()
End Sub
#End Region
#Region "Function"
Public Function Insert_MonDangKy(ByVal obj As MonDangKy) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(5) As SqlParameter
para(0) = New SqlParameter("@Hoc_ky", obj.Hoc_ky)
para(1) = New SqlParameter("@Nam_hoc", obj.Nam_hoc)
para(2) = New SqlParameter("@ID_sv", obj.ID_sv)
para(3) = New SqlParameter("@ID_mon", obj.ID_mon)
para(4) = New SqlParameter("@So_hoc_trinh", obj.So_hoc_trinh)
para(5) = New SqlParameter("@ID_dt", obj.ID_dt)
Return UDB.ExecuteSP("PLAN_MonDangKy_Insert", para)
Else
Dim para(5) As OracleParameter
para(0) = New OracleParameter(":Hoc_ky", obj.Hoc_ky)
para(1) = New OracleParameter(":Nam_hoc", obj.Nam_hoc)
para(2) = New OracleParameter(":ID_sv", obj.ID_sv)
para(3) = New OracleParameter(":ID_mon", obj.ID_mon)
para(4) = New OracleParameter(":So_hoc_trinh", obj.So_hoc_trinh)
para(5) = New OracleParameter(":ID_dt", obj.ID_dt)
Return UDB.ExecuteSP("PLAN_MonDangKy_Insert", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Delete_MonDangKy(ByVal Hoc_ky As Integer, ByVal Nam_hoc As String, ByVal ID_sv As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@Hoc_ky", Hoc_ky)
para(1) = New SqlParameter("@Nam_hoc", Nam_hoc)
para(2) = New SqlParameter("@ID_sv", ID_sv)
Return UDB.ExecuteSP("PLAN_MonDangKy_Delete", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":Hoc_ky", Hoc_ky)
para(1) = New OracleParameter(":Nam_hoc", Nam_hoc)
para(2) = New OracleParameter(":ID_sv", ID_sv)
Return UDB.ExecuteSP("PLAN_MonDangKy_Delete", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
End Class
End Namespace
|
#Region "Copyright (C) 2005-2011 Team MediaPortal"
' Copyright (C) 2005-2011 Team MediaPortal
' http://www.team-mediaportal.com
'
' MediaPortal is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 2 of the License, or
' (at your option) any later version.
'
' MediaPortal 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 MediaPortal. If not, see <http://www.gnu.org/licenses/>.
#End Region
Imports System.IO
Imports SQLite.NET
Imports System.Runtime.CompilerServices
Imports MediaPortal.Database
Imports TvDatabase
Namespace Database
Public Class myVideos
#Region "Member"
Private Shared _movie_InfoCoulumns As String = "idMovie, strTitle, IMDBID, (SELECT strPath FROM path INNER JOIN files ON path.idPath = files.idPath WHERE files.idMovie = movieinfo.idMovie) as FilePath, (SELECT strFilename FROM files WHERE idMovie = movieinfo.idMovie) as Filename, strPictureURL, strFanartURL, (SELECT watched from movie WHERE idMovie = movieinfo.idMovie) as watched, strPlot, fRating, iYear"
Private Shared _SqlMovPicConstructor As String = String.Format("Select {0} FROM movieinfo", _movie_InfoCoulumns)
#End Region
#Region "Properties"
#Region "Values"
Private m_idMyVid As Integer
Private m_Title As String
Private m_imdb_id As String
'Private m_AlternateTitles As String
'Private m_TitleByFileName As String
Private m_Filename As String
Private m_year As String
Private m_Rating As Integer
'Private m_Certification As Integer
Private m_FanArt As String
Private m_Cover As String
Private m_summary As String
Private m_watched As Boolean
#End Region
Public Property idMyVid() As Integer
Get
Return m_idMyVid
End Get
Set(ByVal value As Integer)
m_idMyVid = value
End Set
End Property
Public Property Title() As String
Get
Return m_Title
End Get
Set(ByVal value As String)
m_Title = value
End Set
End Property
Public Property imdb_id() As String
Get
Return m_imdb_id
End Get
Set(ByVal value As String)
m_imdb_id = value
End Set
End Property
'Public Property AlternateTitles() As String
' Get
' Return m_AlternateTitles
' End Get
' Set(ByVal value As String)
' m_AlternateTitles = value
' End Set
'End Property
'Public Property TitleByFileName()
' Get
' Return m_TitleByFileName
' End Get
' Set(ByVal value)
' m_TitleByFileName = value
' End Set
'End Property
Public Property FileName() As String
Get
Return m_Filename
End Get
Set(ByVal value As String)
m_Filename = value
End Set
End Property
Public Property year() As String
Get
Return m_year
End Get
Set(ByVal value As String)
m_year = value
End Set
End Property
Public Property Rating() As Integer
Get
Return m_Rating
End Get
Set(ByVal value As Integer)
m_Rating = value
End Set
End Property
'Public Property Certification() As Integer
' Get
' Return m_Certification
' End Get
' Set(ByVal value As Integer)
' m_Certification = value
' End Set
'End Property
Public Property FanArt() As String
Get
Return m_FanArt
End Get
Set(ByVal value As String)
m_FanArt = value
End Set
End Property
Public Property Cover() As String
Get
Return m_Cover
End Get
Set(ByVal value As String)
m_Cover = value
End Set
End Property
Public Property summary() As String
Get
Return m_summary
End Get
Set(ByVal value As String)
m_summary = value
End Set
End Property
Public Property watched() As Boolean
Get
Return m_watched
End Get
Set(ByVal value As Boolean)
m_watched = value
End Set
End Property
#End Region
#Region "Retrieval"
''' <summary>
''' Alle Filme aus MovPic Db laden, ORDER BY Title ASC
''' </summary>
Public Shared Function ListAll() As IList(Of myVideos)
Dim _SqlString As String = String.Format("{0} ORDER BY strTitle", _
_SqlMovPicConstructor)
Return Helper.GetMovies(_SqlString)
End Function
#End Region
#Region "Class ConnectDB"
Public Class ConnectDB
Implements IDisposable
#Region "Members"
Private _disposed As Boolean = False
Private _SqlString As String = String.Empty
Private m_db As SQLiteClient = Nothing
#End Region
#Region "Constructors"
Public Sub New(ByVal SQLstring As String)
_SqlString = SQLstring
OpenMovingPicturesDB()
End Sub
<MethodImpl(MethodImplOptions.Synchronized)> _
Private Sub OpenMovingPicturesDB()
Try
' Maybe called by an exception
If m_db IsNot Nothing Then
Try
m_db.Close()
m_db.Dispose()
MyLog.Debug("enrichEPG: [MyVideos]: Disposing current instance..")
Catch generatedExceptionName As Exception
End Try
End If
' Open database
If File.Exists(MySettings.MpDatabasePath & "\VideoDatabaseV5.db3") = True Then
m_db = New SQLiteClient(MySettings.MpDatabasePath & "\VideoDatabaseV5.db3")
' Retry 10 times on busy (DB in use or system resources exhausted)
m_db.BusyRetries = 20
' Wait 100 ms between each try (default 10)
m_db.BusyRetryDelay = 1000
DatabaseUtility.SetPragmas(m_db)
Else
MyLog.[Error]("enrichEPG: [MyVideos]: MyVideos Database not found: {0}", MySettings.MpDatabasePath & "\VideoDatabaseV5.db3")
End If
Catch ex As Exception
MyLog.[Error]("enrichEPG: [MyVideos]: MyVideos Database exception err:{0} stack:{1}", ex.Message, ex.StackTrace)
OpenMovingPicturesDB()
End Try
'Mylog.Info("picture database opened")
End Sub
#End Region
#Region "Functions"
Public Function Execute() As SQLiteResultSet
Try
Return m_db.Execute(_SqlString)
Catch ex As Exception
MyLog.Error("[MyVideos]: [Execute]: exception err:{0} stack:{1}", ex.Message, ex.StackTrace)
Return Nothing
End Try
End Function
#End Region
#Region " IDisposable Support "
' Dieser Code wird von Visual Basic hinzugefügt, um das Dispose-Muster richtig zu implementieren.
Public Sub Dispose() Implements IDisposable.Dispose
If Not _disposed Then
_disposed = True
If m_db IsNot Nothing Then
Try
m_db.Close()
m_db.Dispose()
Catch generatedExceptionName As Exception
End Try
m_db = Nothing
End If
End If
End Sub
#End Region
End Class
#End Region
#Region "Class Helper"
Public Class Helper
Public Shared Function allowedSigns(ByVal expression As String) As String
Return Replace(Replace(System.Text.RegularExpressions.Regex.Replace(expression, "[\?]", "_"), "|", ""), "'", "''")
End Function
''' <summary>
''' Daten aus table movie_Info laden
''' </summary>
Public Shared Function GetMovies(ByVal SQLstring As String) As IList(Of myVideos)
'Daten aus TvSeriesDB laden
Dim _con As New ConnectDB(SQLstring)
Dim _Result As SQLiteResultSet = _con.Execute
_con.Dispose()
Return ConvertToMyMovingPicturesList(_Result)
End Function
Public Shared Function GetActors(ByVal SQLstring As String) As IList(Of myActors)
'Daten aus TvSeriesDB laden
Dim _con As New ConnectDB(SQLstring)
Dim _Result As SQLiteResultSet = _con.Execute
_con.Dispose()
Return ConvertToMyActorsList(_Result)
End Function
Private Shared Function ConvertToMyMovingPicturesList(ByVal Result As SQLiteResultSet) As IList(Of myVideos)
Return Result.Rows.ConvertAll(Of myVideos)(New Converter(Of SQLiteResultSet.Row, myVideos)(Function(c As SQLiteResultSet.Row) New myVideos() With { _
.idMyVid = c.fields(0), _
.Title = c.fields(1), _
.imdb_id = c.fields(2), _
.FileName = c.fields(3) & c.fields(4), _
.Cover = c.fields(5), _
.FanArt = c.fields(6), _
.watched = If(Not String.IsNullOrEmpty(c.fields(7)), c.fields(7), False), _
.m_summary = c.fields(8), _
.Rating = c.fields(9), _
.year = c.fields(10)}))
End Function
Private Shared Function ConvertToMyActorsList(ByVal Result As SQLiteResultSet) As IList(Of myActors)
Return Result.Rows.ConvertAll(Of myActors)(New Converter(Of SQLiteResultSet.Row, myActors)(Function(c As SQLiteResultSet.Row) New myActors() With { _
.idActor = c.fields(0), _
.strActor = c.fields(1), _
.thumbURL = c.fields(2) _
}))
End Function
End Class
#End Region
#Region "myActors"
Public Class myActors
#Region "Member"
Private Shared _movie_InfoCoulumns As String = "idActor, strActor, (SELECT thumbURL FROM actorinfo where actorinfo.idActor = actors.idActor) as thumbURL"
Private Shared _SqlMovPicConstructor As String = String.Format("Select {0} FROM actors", _movie_InfoCoulumns)
#End Region
#Region "Properties"
Private m_idActor As Integer
Public Property idActor As Integer
Get
Return m_idActor
End Get
Set(ByVal Value As Integer)
m_idActor = Value
End Set
End Property
Private m_strActor As String
Public Property strActor As String
Get
Return m_strActor
End Get
Set(ByVal Value As String)
m_strActor = Value
End Set
End Property
Private m_thumbURL As String
Public Property thumbURL As String
Get
Return m_thumbURL
End Get
Set(ByVal Value As String)
m_thumbURL = Value
End Set
End Property
#End Region
#Region "Retrieval"
''' <summary>
''' Alle Filme aus MovPic Db laden, ORDER BY Title ASC
''' </summary>
Public Shared Function ListAll() As IList(Of myActors)
Dim _SqlString As String = String.Format("{0} ORDER BY strActor", _
_SqlMovPicConstructor)
Return Helper.GetActors(_SqlString)
End Function
#End Region
End Class
#End Region
End Class
End Namespace
|
Public Enum eRuleWeaponTypes As Integer
notapplicable = 0
bow = 1
crossbow = 2
atlan = 3
sword = 4
ua = 5
axe = 6
mace = 7
dagger = 8
staff = 9
spear = 10
twohanded = 11
mage = 12
End Enum
Public Class rule
Public Function EmptyRule() As Boolean
Return Not (minarmorlevel > 0 Or maxburden > 0 Or maxcraft > 0 Or keywords <> String.Empty Or weapontype <> eRuleWeaponTypes.notapplicable Or anyset Or (Specificset IsNot Nothing AndAlso Specificset.Count > 0) Or (spells IsNot Nothing AndAlso spells.Count > 0))
End Function
'general
Public appliesToFlag As Integer
Public name As String
Public info As String
Public enabled As Boolean
Public maxburden As Integer
Public maxcraft As Integer
Public maxvalue As Integer
Public keywords As String
Public keywordsnot As String
Public tradebotonly As Boolean
Public tradebot As Boolean
Public wavfile As String
'weapon
Public weapontype As eRuleWeaponTypes
Public weaponsubtype As Integer
Public minmcmodattackbonus As Integer
Public minmeleebonus As Integer
Public minmagicdbonus As Double
Public damage As damagerange()
Public damagetypeFlag As Integer
'armor
Public minarmorlevel As Integer
Public armorcoverageFlag As Integer
Public armortypeFlag As Integer
'requirements
Public spellmatches As Integer
Public spells As Integerlist
Public Specificset As Integerlist
Public anyset As Boolean
Public ivoryable As Boolean
Structure minmax
Public min As Integer
Public max As Integer
End Structure
Structure damagerange
Public enabled As Boolean
Public minwield As Integer
Public maxwield As Integer
Public mindamage As Double
Public maxdamage As Double
End Structure
Private Sub initnew()
enabled = True
name = String.Empty
info = String.Empty
maxburden = -1
keywords = String.Empty
maxvalue = -1
spellmatches = 1
maxcraft = -1
weapontype = eRuleWeaponTypes.notapplicable
minmagicdbonus = -1
minmeleebonus = -1
minmcmodattackbonus = -1
ReDim damage(3)
damage(3).maxdamage = -1
damage(3).maxwield = -1
damage(3).mindamage = -1
damage(3).minwield = -1
damage(3).enabled = True
damage(2).maxdamage = -1
damage(2).maxwield = -1
damage(2).mindamage = -1
damage(2).minwield = -1
damage(2).enabled = True
damage(1).maxdamage = -1
damage(1).maxwield = -1
damage(1).mindamage = -1
damage(1).minwield = -1
damage(1).enabled = True
damage(0).maxdamage = -1
damage(0).maxwield = -1
damage(0).mindamage = -1
damage(0).minwield = -1
damage(0).enabled = True
minarmorlevel = -1
End Sub
Public Sub New()
initnew()
End Sub
Public Sub New(ByVal rname As String, ByVal rinfo As String, ByVal rweapontype As eRuleWeaponTypes, ByVal rweaponsubtype As Integer, ByVal rminmeleebonus As Integer, ByVal rminmcmodattackbonus As Integer)
initnew()
name = rname
info = rinfo
weapontype = rweapontype
weaponsubtype = rweaponsubtype
minmeleebonus = rminmeleebonus
minmcmodattackbonus = rminmcmodattackbonus
End Sub
End Class
Public Class RulesCollection
Inherits CollectionBase
Public Overridable Sub Insert(ByVal index As Integer, ByVal value As Rule)
If MyBase.List.Contains(value) = False Then
If index > Me.Count - 1 Then
MyBase.List.Add(value)
Else
MyBase.List.Insert(index, value)
End If
End If
End Sub
Public Overridable Function Add(ByVal value As Rule) As Integer
If MyBase.List.Contains(value) = False Then
Return MyBase.List.Add(value)
End If
End Function
Public Overridable Function Contains(ByVal value As Rule) As Boolean
Return MyBase.List.Contains(value)
End Function
Public Overridable Sub Remove(ByVal value As Rule)
If MyBase.List.Contains(value) Then
MyBase.List.Remove(value)
End If
End Sub
Default Public Overridable Property Item(ByVal index As Integer) As Rule
Get
Return DirectCast(MyBase.List.Item(index), Rule)
End Get
Set(ByVal value As Rule)
MyBase.List.Item(index) = value
End Set
End Property
End Class |
Imports Sangis_FinderTools.Globals
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.Framework
Public Class btnZoomCounty
Inherits ESRI.ArcGIS.Desktop.AddIns.Button
Public Sub New()
End Sub
Protected Overrides Sub OnClick()
Try
My.ArcMap.Application.CurrentTool = Nothing
'make sure the county is in the dataframe and make it active
If Not ActivateLayerFrame("SANGIS.JUR_COUNTY") Then
Exit Sub
End If
Dim pActiveView As IActiveView
pActiveView = My.ArcMap.Document.FocusMap
'Reset the extent of the Focus Map to the county boundary
LoopThroughLayersAndZoomToExtent(pActiveView.FocusMap, "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}", "SANGIS.JUR_COUNTY")
'Refresh view and TOC
pActiveView.Refresh()
My.ArcMap.Document.UpdateContents()
'Set map to save
Dim pDocDirty As IDocumentDirty
pDocDirty = My.ArcMap.Document
pDocDirty.SetDirty()
Catch ex As Exception
Windows.Forms.Cursor.Current = Windows.Forms.Cursors.Default
Windows.Forms.MessageBox.Show(ex.Source + " " + ex.Message + " " + ex.StackTrace + " ")
End Try
End Sub
Protected Overrides Sub OnUpdate()
Enabled = My.ArcMap.Application IsNot Nothing
End Sub
End Class
|
Imports System.Web
Namespace Web
''' <summary>
''' Request操作类
''' </summary>
Public Class LSWRequest
''' <summary>
''' 判断当前页面是否接收到了Post请求
''' </summary>
''' <returns>是否接收到了Post请求</returns>
Public Shared Function IsPost() As Boolean
Return HttpContext.Current.Request.HttpMethod.Equals("POST")
End Function
''' <summary>
''' 判断当前页面是否接收到了Get请求
''' </summary>
''' <returns>是否接收到了Get请求</returns>
Public Shared Function IsGet() As Boolean
Return HttpContext.Current.Request.HttpMethod.Equals("GET")
End Function
''' <summary>
''' 返回指定的服务器变量信息
''' </summary>
''' <param name="strName">服务器变量名</param>
''' <returns>服务器变量信息</returns>
Public Shared Function GetServerString(ByVal strName As String) As String
'
If HttpContext.Current.Request.ServerVariables(strName) Is Nothing Then
Return ""
End If
Return HttpContext.Current.Request.ServerVariables(strName).ToString()
End Function
''' <summary>
''' 返回上一个页面的地址
''' </summary>
''' <returns>上一个页面的地址</returns>
Public Shared Function GetUrlReferrer() As String
Dim retVal As String = Nothing
Try
retVal = HttpContext.Current.Request.UrlReferrer.ToString()
Catch
End Try
If retVal Is Nothing Then
Return ""
End If
Return retVal
End Function
''' <summary>
''' 得到当前完整主机头
''' </summary>
''' <returns></returns>
Public Shared Function GetCurrentFullHost() As String
Dim request As HttpRequest = System.Web.HttpContext.Current.Request
If Not request.Url.IsDefaultPort Then
Return String.Format("{0}:{1}", request.Url.Host, request.Url.Port.ToString())
End If
Return request.Url.Host
End Function
''' <summary>
''' 得到主机头
''' </summary>
''' <returns></returns>
Public Shared Function GetHost() As String
Return HttpContext.Current.Request.Url.Host
End Function
''' <summary>
''' 获取当前请求的原始 URL(URL 中域信息之后的部分,包括查询字符串(如果存在))
''' </summary>
''' <returns>原始 URL</returns>
Public Shared Function GetRawUrl() As String
Return HttpContext.Current.Request.RawUrl
End Function
''' <summary>
''' 判断当前访问是否来自浏览器软件
''' </summary>
''' <returns>当前访问是否来自浏览器软件</returns>
Public Shared Function IsBrowserGet() As Boolean
Dim BrowserName As String() = {"ie", "opera", "netscape", "mozilla", "konqueror", "firefox"}
Dim curBrowser As String = HttpContext.Current.Request.Browser.Type.ToLower()
For i As Integer = 0 To BrowserName.Length - 1
If curBrowser.IndexOf(BrowserName(i)) >= 0 Then
Return True
End If
Next
Return False
End Function
''' <summary>
''' 判断是否来自搜索引擎链接
''' </summary>
''' <returns>是否来自搜索引擎链接</returns>
Public Shared Function IsSearchEnginesGet() As Boolean
If HttpContext.Current.Request.UrlReferrer Is Nothing Then
Return False
End If
Dim SearchEngine As String() = {"google", "yahoo", "msn", "baidu", "sogou", "sohu", _
"sina", "163", "lycos", "tom", "yisou", "iask", _
"soso", "gougou", "zhongsou"}
Dim tmpReferrer As String = HttpContext.Current.Request.UrlReferrer.ToString().ToLower()
For i As Integer = 0 To SearchEngine.Length - 1
If tmpReferrer.IndexOf(SearchEngine(i)) >= 0 Then
Return True
End If
Next
Return False
End Function
''' <summary>
''' 获得当前完整Url地址
''' </summary>
''' <returns>当前完整Url地址</returns>
Public Shared Function GetUrl() As String
Return HttpContext.Current.Request.Url.ToString()
End Function
''' <summary>
''' 获得指定Url参数的值
''' </summary>
''' <param name="strName">Url参数</param>
''' <returns>Url参数的值</returns>
Public Shared Function GetQueryString(ByVal strName As String) As String
If HttpContext.Current.Request.QueryString(strName) Is Nothing Then
Return ""
End If
Return HttpContext.Current.Request.QueryString(strName)
End Function
''' <summary>
''' 获得当前页面的名称
''' </summary>
''' <returns>当前页面的名称</returns>
Public Shared Function GetPageName() As String
Dim urlArr As String() = HttpContext.Current.Request.Url.AbsolutePath.Split("/"c)
Return urlArr(urlArr.Length - 1).ToLower()
End Function
''' <summary>
''' 返回表单或Url参数的总个数
''' </summary>
''' <returns></returns>
Public Shared Function GetParamCount() As Integer
Return HttpContext.Current.Request.Form.Count + HttpContext.Current.Request.QueryString.Count
End Function
''' <summary>
''' 获得指定表单参数的值
''' </summary>
''' <param name="strName">表单参数</param>
''' <returns>表单参数的值</returns>
Public Shared Function GetFormString(ByVal strName As String) As String
If HttpContext.Current.Request.Form(strName) Is Nothing Then
Return ""
End If
Return HttpContext.Current.Request.Form(strName)
End Function
''' <summary>
''' 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值
''' </summary>
''' <param name="strName">参数</param>
''' <returns>Url或表单参数的值</returns>
Public Shared Function GetString(ByVal strName As String) As String
If "".Equals(GetQueryString(strName)) Then
Return GetFormString(strName)
Else
Return GetQueryString(strName)
End If
End Function
''' <summary>
''' 获得指定Url参数的int类型值
''' </summary>
''' <param name="strName">Url参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>Url参数的int类型值</returns>
Public Shared Function GetQueryInt(ByVal strName As String, ByVal defValue As Integer) As Integer
Return Utils.StrToInt(HttpContext.Current.Request.QueryString(strName), defValue)
End Function
''' <summary>
''' 获得指定表单参数的int类型值
''' </summary>
''' <param name="strName">表单参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>表单参数的int类型值</returns>
Public Shared Function GetFormInt(ByVal strName As String, ByVal defValue As Integer) As Integer
Return Utils.StrToInt(HttpContext.Current.Request.Form(strName), defValue)
End Function
''' <summary>
''' 获得指定Url或表单参数的int类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
''' </summary>
''' <param name="strName">Url或表单参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>Url或表单参数的int类型值</returns>
Public Shared Function GetInt(ByVal strName As String, ByVal defValue As Integer) As Integer
If GetQueryInt(strName, defValue) = defValue Then
Return GetFormInt(strName, defValue)
Else
Return GetQueryInt(strName, defValue)
End If
End Function
''' <summary>
''' 获得指定Url参数的float类型值
''' </summary>
''' <param name="strName">Url参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>Url参数的int类型值</returns>
Public Shared Function GetQueryFloat(ByVal strName As String, ByVal defValue As Single) As Single
Return Utils.StrToFloat(HttpContext.Current.Request.QueryString(strName), defValue)
End Function
''' <summary>
''' 获得指定表单参数的float类型值
''' </summary>
''' <param name="strName">表单参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>表单参数的float类型值</returns>
Public Shared Function GetFormFloat(ByVal strName As String, ByVal defValue As Single) As Single
Return Utils.StrToFloat(HttpContext.Current.Request.Form(strName), defValue)
End Function
''' <summary>
''' 获得指定Url或表单参数的float类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
''' </summary>
''' <param name="strName">Url或表单参数</param>
''' <param name="defValue">缺省值</param>
''' <returns>Url或表单参数的int类型值</returns>
Public Shared Function GetFloat(ByVal strName As String, ByVal defValue As Single) As Single
If GetQueryFloat(strName, defValue) = defValue Then
Return GetFormFloat(strName, defValue)
Else
Return GetQueryFloat(strName, defValue)
End If
End Function
''' <summary>
''' 获得当前页面客户端的IP
''' </summary>
''' <returns>当前页面客户端的IP</returns>
Public Shared Function GetIP() As String
Dim result As String = [String].Empty
result = HttpContext.Current.Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If String.IsNullOrEmpty(result) Then
result = HttpContext.Current.Request.ServerVariables("REMOTE_ADDR")
End If
If String.IsNullOrEmpty(result) Then
result = HttpContext.Current.Request.UserHostAddress
End If
If String.IsNullOrEmpty(result) OrElse Not Utils.IsIP(result) Then
Return "127.0.0.1"
End If
Return result
End Function
''' <summary>
''' 保存用户上传的文件
''' </summary>
''' <param name="path">保存路径</param>
Public Shared Sub SaveRequestFile(ByVal path As String)
If HttpContext.Current.Request.Files.Count > 0 Then
HttpContext.Current.Request.Files(0).SaveAs(path)
End If
End Sub
End Class
End Namespace |
Imports System.ComponentModel
Imports MasterworkDwarfFortress.globals
Imports MasterworkDwarfFortress.fileWorking
Imports System.Text.RegularExpressions
Imports System.ComponentModel.Design
<DisplayNameAttribute("Override Files"), _
DescriptionAttribute("Specify which file(s) to change this option's tags in. Files will not be searched for the tags."), _
CategoryAttribute("~RAW Options"), _
TypeConverterAttribute(GetType(fileManagerConverter))> _
Public Class fileListManager
Public Sub New()
End Sub
Private m_fileNames As New List(Of String)
Private m_files As New List(Of IO.FileInfo)
Private m_currentPattern As Regex
'EditorAttribute(GetType(fileListConverter), GetType(System.ComponentModel.Design.MultilineStringEditor)), _
<DescriptionAttribute("Specify which file(s) to change this option's tags in. Files will not be searched for the tags."), _
Editor("System.Windows.Forms.Design.StringCollectionEditor, System.Design", "System.Drawing.Design.UITypeEditor, System.Drawing"), _
TypeConverter(GetType(fileListConverter))> _
Public Property fileNames As List(Of String)
Get
Return m_fileNames
End Get
Set(value As List(Of String))
m_fileNames = value
End Set
End Property
Private Function findFiles(ByVal optm As optionManager, ByVal tokens As rawTokenCollection) As List(Of IO.FileInfo)
Dim start As DateTime = Now
Dim results As New List(Of IO.FileInfo)
'if we have an override specified, then just find those files
If m_fileNames.Count > 0 Then
results = findSpecificFiles()
Else
'loading from the init files is handled differently, we don't need to search raws
If optm.loadFromDInit Or optm.loadFromInit Or optm.loadFromWorldGen Then Return results
If tokens.Count <= 0 Then Return results
Dim blnContinue As Boolean = False
For Each t As rawToken In tokens
If t.optionOnValue <> "" Or t.optionOffValue <> "" Then blnContinue = True : Exit For
Next
If Not blnContinue Then Return results
For Each fi As KeyValuePair(Of IO.FileInfo, String) In globals.m_dfRaws '.Where(AddressOf gameRawFilter)
For Each t As rawToken In tokens
If Not singleValueToken(t) Then
If fi.Value.Contains(t.optionOnValue) OrElse fi.Value.Contains(t.optionOffValue) Then
results.Add(fi.Key) : m_fileNames.Add(fi.Key.Name) : Exit For
End If
Else
If fi.Value.Contains(String.Format("[{0}:", t.tokenName)) Then results.Add(fi.Key) : m_fileNames.Add(fi.Key.Name) : Exit For
End If
Next
Next
addGraphicFiles(results)
End If
Dim elapsed As TimeSpan = Now - start
Debug.WriteLine("took " & elapsed.TotalMilliseconds & " ms to find the files for tokens " & tokens.ToString)
Return results
End Function
Private Function findFiles(ByVal optm As optionManager, ByVal pattern As String) As List(Of IO.FileInfo)
'Dim start As DateTime = Now
Dim results As New List(Of IO.FileInfo)
'if we have an override specified, then just find those files
If m_fileNames.Count > 0 Then
results = findSpecificFiles()
Else
If optm.loadFromDInit Or optm.loadFromInit Or optm.loadFromWorldGen Then Return results
Dim rx As New Regex(pattern)
If pattern = "" Then Return results
For Each fi As KeyValuePair(Of IO.FileInfo, String) In globals.m_dfRaws '.Where(AddressOf gameRawFilter)
If rx.IsMatch(fi.Value) Then results.Add(fi.Key) : m_fileNames.Add(fi.Key.Name)
Next
addGraphicFiles(results)
End If
'Dim elapsed As TimeSpan = Now - start
'Debug.WriteLine("took " & elapsed.TotalMilliseconds & " ms to find the files for pattern " & pattern)
Return results
End Function
Private Function findSpecificFiles() As List(Of IO.FileInfo)
Dim results As New List(Of IO.FileInfo)
Dim tmpFiles As New List(Of KeyValuePair(Of IO.FileInfo, String))
For Each fName As String In m_fileNames
tmpFiles.AddRange(globals.m_dfRaws.Where(Function(raw As KeyValuePair(Of IO.FileInfo, String)) raw.Key.Name.Equals(fName, StringComparison.CurrentCultureIgnoreCase)))
tmpFiles.AddRange(globals.m_mwRaws.Where(Function(raw As KeyValuePair(Of IO.FileInfo, String)) raw.Key.Name.Equals(fName, StringComparison.CurrentCultureIgnoreCase)))
Next
For Each raw As KeyValuePair(Of IO.FileInfo, String) In tmpFiles
results.Add(raw.Key)
Next
Return results
End Function
Private Sub addGraphicFiles(ByVal raws As List(Of IO.FileInfo))
If raws.Count <= 0 Then Exit Sub
For Each fi As KeyValuePair(Of IO.FileInfo, String) In globals.m_mwRaws.Where(Function(raw As KeyValuePair(Of IO.FileInfo, String)) (m_fileNames.Contains(raw.Key.Name))).ToList 'm_dfRaws.Where(AddressOf graphicRawFilter)
If Not raws.Contains(fi.Key) Then raws.Add(fi.Key)
Next
End Sub
Private Function gameRawFilter(ByVal item As KeyValuePair(Of IO.FileInfo, String)) As Boolean
Return (Not item.Key.FullName.Contains(globals.m_graphicsDir))
End Function
Private Function graphicRawFilter(ByVal item As KeyValuePair(Of IO.FileInfo, String)) As Boolean
Return (item.Key.FullName.Contains(globals.m_graphicsDir) AndAlso m_fileNames.Contains(item.Key.Name))
End Function
Private Function singleValueToken(ByVal token As rawToken) As Boolean
Return (token.optionOffValue = "" And token.optionOnValue <> "")
End Function
Public Function loadFiles(ByVal optm As optionManager, ByVal tokens As rawTokenCollection) As List(Of IO.FileInfo)
If m_files.Count <= 0 Then
m_files = findFiles(optm, tokens)
End If
Return m_files
End Function
Public Function loadFiles(ByVal optm As optionManager, ByVal pattern As String) As List(Of IO.FileInfo)
If m_files.Count <= 0 Then
m_files = findFiles(optm, pattern)
End If
Return m_files
End Function
<Browsable(False), _
EditorBrowsable(EditorBrowsableState.Advanced), _
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)> _
Public ReadOnly Property files(Optional ByVal mwRawsOnly As Boolean = False) As List(Of IO.FileInfo)
Get
If mwRawsOnly Then
Return m_files.Where(Function(fi As IO.FileInfo) (fi.FullName.Contains(globals.m_graphicsDir))).ToList
Else
Return m_files.Where(Function(fi As IO.FileInfo) (fi.FullName.Contains(globals.m_graphicsDir) = False)).ToList
End If
End Get
End Property
End Class
Public Class fileManagerConverter
Inherits ExpandableObjectConverter
Public Overrides Function CanConvertTo(context As ITypeDescriptorContext, destinationType As Type) As Boolean
If destinationType Is GetType(fileListManager) Then
Return True
End If
Return MyBase.CanConvertTo(context, destinationType)
End Function
Public Overrides Function ConvertTo(context As ITypeDescriptorContext, culture As Globalization.CultureInfo, value As Object, destinationType As Type) As Object
If destinationType Is GetType(String) AndAlso TypeOf value Is fileListManager Then
Dim flm As fileListManager = CType(value, fileListManager)
Return String.Join(", ", flm.fileNames)
End If
Return MyBase.ConvertTo(context, culture, value, destinationType)
End Function
End Class
|
Imports System.Globalization
Public Class TimeAndData
Private _timestamp As DateTime
Public Property timestamp() As DateTime
Get
Return _timestamp
End Get
Set(value As DateTime)
_timestamp = value
End Set
End Property
Private _dataForThatTimeStamp As New List(Of Integer)
Public Property dataForThatTimeStamp() As List(Of Integer)
Get
Return _dataForThatTimeStamp
End Get
Set(value As List(Of Integer))
_dataForThatTimeStamp = value
End Set
End Property
Public Sub New(value As DateTime)
timestamp = value
End Sub
Public Sub insertVal(ByVal value As Integer, ByVal position As Integer) ' this sub places the data at the specified position in the list, if the given position is larger than the list the data is added to the end of the list
If position < _dataForThatTimeStamp.Count Then
_dataForThatTimeStamp.Insert(position, value)
Else
_dataForThatTimeStamp.Add(value)
End If
End Sub
Public Function printLine() As String ' prints the timestamp and the data
Dim values As String = ""
For Each item In dataForThatTimeStamp
Dim i As Integer
values += "," + item.ToString()
For i = 0 To 7 - item.ToString.Length() Step +1 ' this adds whitespace after the data, to make the file easier to read
values += " "
Next
Next
Return timestamp.ToString("yyyy/MM/dd,HH:mm", CultureInfo.CreateSpecificCulture("en-US")) + ",1 " + values
End Function
End Class
|
Imports System.ComponentModel
Imports System.Configuration
Imports System.IO
Imports System.Text
Imports System.Web
Imports System.Web.Caching
Imports System.Web.SessionState
Imports System.Xml
Imports Core.ExceptionManagement
Imports Core.Framework
Imports Core.Framework.Core.Framework
Imports Core.Globalization.Core.Globalization
Imports Core.Windows.UI.Core.Windows
Imports Core.Windows.UI.Core.Windows.UI
Imports System.Data.OracleClient
Imports System.Data.SqlClient
Imports Core.DataAccess.Oracle
Imports Core.DataAccess.SqlServer
Namespace Core.Windows
''' ----------------------------------------------------------------------------
'''
''' Class : BaseClassWeb
'''
''' ----------------------------------------------------------------------------
''' <summary>
''' Summary of BaseClassWeb.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Class BaseClassControl 'MenuOptionWeb
Inherits BaseClass 'BaseMenuOption
Dim g_recordCount As Integer = 0
<EditorBrowsable(EditorBrowsableState.Advanced)> Private ReadOnly _
m_LogFile As StringBuilder = New StringBuilder("")
<EditorBrowsable(EditorBrowsableState.Advanced)> Private ReadOnly _
m_ClassParameters As StringBuilder = New StringBuilder("")
<EditorBrowsable(EditorBrowsableState.Advanced)> Private ReadOnly _
m_GlobalParameters As StringBuilder = New StringBuilder("")
<EditorBrowsable(EditorBrowsableState.Advanced)> Private ReadOnly _
m_Error As StringBuilder = New StringBuilder("")
<EditorBrowsable(EditorBrowsableState.Advanced)> Public Subtotal_Files As ArrayList = New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Public InializesFile As ArrayList = New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_SortOrder As String
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_intParrallelOccurrence As Integer = 0
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_blnNoRecords As Boolean
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_strNoRecordsLevel As String = String.Empty
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_SortFileOrder As String
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_intSortOrder As Integer = 0
<EditorBrowsable(EditorBrowsableState.Advanced)> Public dtSortOrder As New DataTable
<EditorBrowsable(EditorBrowsableState.Advanced)> Public arrSortOrder As New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Public dtSorted As New DataTable
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected strSortOrder As String = String.Empty
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend arrFileInRequests As ArrayList = New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend arrFilesProcessed As ArrayList = New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend arrSubFiles As ArrayList = New ArrayList
Friend arrReadInRequests As ArrayList = New ArrayList
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_hsFileInOutput As SortedList = New SortedList
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_hsFileInRequests As Hashtable = New Hashtable
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_hsFilesProcessed As Hashtable = New Hashtable
<EditorBrowsable(EditorBrowsableState.Advanced)> Public intSorted As Integer = 0
<EditorBrowsable(EditorBrowsableState.Advanced)> Public QTPRequest As Boolean = False
<EditorBrowsable(EditorBrowsableState.Advanced)> Public blnQTPSubFile As Boolean = False
<EditorBrowsable(EditorBrowsableState.Advanced)> Private blnAppendSubFile As Boolean = False
<EditorBrowsable(EditorBrowsableState.Advanced)> Public strFileNoRecords As String = String.Empty
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected strFileSortName As String = String.Empty
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected m_reportsPath As String = String.Empty
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strUserID As String
Public hsSubConverted As Hashtable = New Hashtable
Private NoDataSubfile As ArrayList = New ArrayList
Private m_strDEFAULT_BATCH_FILE_DIRECTORY As String = ""
Private hsAverage As Hashtable = New Hashtable
Private hsAverageCount As Hashtable = New Hashtable
Private blInaverage = False
Private blnOver5000Records = False
Private hsMaximum As Hashtable = New Hashtable
Private hsMinimum As Hashtable = New Hashtable
Private blnIsInInitialize As Boolean = False
Private strStartParrallel As String = String.Empty
Private intTransactions As Integer = 0
Private ReadOnly m_blnDidLock As Boolean = False
Private NoSubFileData As Boolean = False
Private ReadOnly m_strUniqueSessionID As String
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property UniqueSessionID As String
Get
Return m_strUniqueSessionID
End Get
End Property
Private intTotalSkippedRecords As Integer
Public Property TotalSkippedRecords() As Integer
Get
Return intTotalSkippedRecords
End Get
Set(ByVal Value As Integer)
intTotalSkippedRecords = Value
End Set
End Property
Private intRecordsProcessed As Integer
Public Property RecordsProcessed() As Integer
Get
Return intRecordsProcessed
End Get
Set(ByVal Value As Integer)
intRecordsProcessed = Value
End Set
End Property
Public ReadOnly Property IsAxiant As Boolean
Get
If IsNothing(ConfigurationManager.AppSettings("Axiant")) Then
Return False
End If
Return ConfigurationManager.AppSettings("Axiant").ToUpper() = "TRUE"
End Get
End Property
Public Property CancelQTPs As Boolean
Get
Return Session("CancelQTPs")
End Get
Set(value As Boolean)
Session("CancelQTPs") = value
End Set
End Property
Private CurrentQTPCancel As Boolean
Public m_hsFileWhere As New Hashtable
Public m_blnUseMemory As Boolean = False
Public arrTempTables As ArrayList
Public WhereElementColumn As String = ""
Public m_blnIsAt As Boolean = False
Protected dcSysDate As Decimal = 0
Protected dcSysTime As Decimal = 0
Protected dcSysDateTime As Decimal = 0
Protected arrKeepFile As New ArrayList
Public blnDeleteSubFile As Boolean = False
Public blnDeletedSubFile As Boolean = False
Public blnHasSort As Boolean = False
Public blnHasBeenSort As Boolean = False
Public blnHasRunSubfile As Boolean = False
Private blnAtInitial As BooleanTypes = BooleanTypes.NotSet
Private Shared m_strParmPrompts As String
Protected Friend Shared m_htParmPrompts As Hashtable
Public alSubTempText As New ArrayList
Public intFirstFileRecordCount As Integer = 0
Private intSortCount As Integer = 0
Public blnIsInSelectIf As Boolean = False
Public blnGlobalUseTableSelectIf As BooleanTypes = BooleanTypes.NotSet
Public intFirstRecordCount As Integer = 0
Public intFirstOverrideOccurs As Integer = 0
#If TARGET_DB = "INFORMIX" Then
Public m_arrSelectifColumn As ArrayList
Public cnnQUERY As IfxConnection
Public cnnTRANS_UPDATE As IfxConnection
Public trnTRANS_UPDATE As IfxTransaction
#Else
Public m_arrSelectifColumn As New ArrayList
#End If
Public blnGotSQL As BooleanTypes = BooleanTypes.NotSet
Public hsSQL As New Hashtable
Public hsSQLEnum As New Hashtable
Public strFromTables As String = ""
Public blnOneFile As Boolean = True
Public blnRunForMissing As Boolean = False
Public m_dtbDataTable As DataTable
Public m_blnGetSQL As Boolean = False
Public m_strQTPOrderBy As String = ""
Public m_blnInChoose As Boolean = False
Private intRecordLimit As Integer = 0
Private hsSubFileSize As Hashtable
Private ReadOnly m_htLockTimes As New Hashtable
Protected Friend Shared HasParallel As Boolean = False
Public blnTrans As Boolean = False
Private m_fleJoinFile As IFileObject
Private m_strJoinColumn As String = String.Empty
Private m_strSqlValDB As String = String.Empty
Private m_strDelimiter As String = "§" 'ALT 0167
'-----------------------------------------------------------------------------------------------------------
' In order to handle OldValue, and the fact that PowerHouse changes any reference to the
' item on which the EDIT procedure is executing to either FIELDTEXT or FIELDVALUE, we are
' storing OLDVALUE in this array prior to calling the edit procedure. We then assign FIELDTEXT/FIELDVALUE
' to the record buffer so that we don't have to worry about changing the item to FIELDTEXT/FIELDVALUE.
' OldValue will be stored using the following structure: ITEM in position 0
' FIELDTEXT in Position 1
' FIELDVALUE in Position 2
''' --- sOldValue ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of sOldValue.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Structure sOldValue
''' --- Field --------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Field.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim Field As String
''' --- FieldText ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Contains the most recent value in the field.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim FieldText As String
''' --- FieldValue ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Contains the most recent numeric or date value in the field.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim FieldValue As Decimal
End Structure
''' --- m_OldValue ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_OldValue.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_OldValue As sOldValue _
' Array used to store OldValue.
''' --- m_htFileInfo -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_htFileInfo.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_htFileInfo As Hashtable _
' Stores the RowId and CheckSum_Value for files that performed a PUT.
''' --- m_intRecordsToFillInFindOrDetailFind -------------------------------
''' <exclude />
''' <summary>
''' Used to determine whether GetData has been issued from Find Or DetailFind.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected Friend _
m_intRecordsToFillInFindOrDetailFind As Integer = -1 '
''' --- m_blnPromptOK ------------------------------------------------------
''' <summary>
''' Indicates that a value was entered in a field when prompted using the
''' Accept or RequestPrompt methods.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)> Protected m_blnPromptOK As Boolean
''' --- stcFileInfo --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of stcFileInfo.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Serializable, EditorBrowsable(EditorBrowsableState.Advanced)>
Private Structure stcFileInfo
''' --- RowId --------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RowId.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim RowId As String
''' --- CheckSum -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CheckSum.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim CheckSum As Decimal
''' --- AlteredRecord -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of AlteredRecord.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim AlteredRecord As Boolean
''' --- NewRecord -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of NewRecord.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim NewRecord As Boolean
''' --- DeletedRecord -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of DeletedRecord.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Dim DeletedRecord As Boolean
End Structure
''' --- m_intCountIntoSequence ---------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intRunScreenSequence.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_intCountIntoSequence As Integer = 0 _
' Indicates the sequence of the CountInto. This ensure that we don't call this function each time we post back.
''' --- m_strCountIntoCalled ---------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strCountIntoCalled.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strCountIntoCalled As String = String.Empty _
' Stores "Y" values for each count into that is called.
''' --- m_blnOracle --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_blnOracle.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 6/29/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_blnOracle As Boolean = True
Private m_strcommandseverity As String
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property commandseverity As String
Get
Return m_strcommandseverity
End Get
Set(Value As String)
m_strcommandseverity = Value
End Set
End Property
''' --- ScreenSession ------------------------------------------------------
''' <exclude />
''' <summary>
''' Set or return screen specific session information for a given key.
''' </summary>
''' <remarks>
''' This property sets/returns session information for a specific key.
''' This value can only be retrieved from the screen that set the value.
''' </remarks>
''' <example>
''' ScreenSession(UniqueSessionID + "T_TEMP") = T_TEMP.Value <br />
''' T_TEMP.Value = ScreenSession(UniqueSessionID + "T_TEMP")
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Property CountIntoCalled As Boolean
Get
m_intCountIntoSequence += 1
Return MethodWasExecuted(m_intCountIntoSequence, "COUNT_INTO")
End Get
Set(Value As Boolean)
If Value Then SetMethodExecutedFlag(m_strCountIntoCalled, "COUNT_INTO", m_intCountIntoSequence)
End Set
End Property
'--------------------------
' Find Activity property.
'--------------------------
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets or sets a value indicating that the current screen has no actions.
''' </summary>
''' <value>True if the screen has no activities.</value>
''' <remarks>
''' Use the NoAction property to indicate that the screen has no actions specified.
''' <br /><br />
''' </remarks>
''' <history>
''' [Chris] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property NoAction As Boolean
Get
Return False
End Get
Set(Value As Boolean)
End Set
End Property
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_NoDBConnect As Boolean = False
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets or sets a value indicating that the current menu should not connect to the database.
''' </summary>
''' <value>True if the menu should not connect to a DB.</value>
''' <remarks>
''' Use the NoDBConnect property to indicate that the screen has no actions specified.
''' <br /><br />
''' </remarks>
''' <history>
''' [GlennA] 30-oct-2007 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property NoDBConnect As Boolean
Get
Return m_NoDBConnect
End Get
Set(Value As Boolean)
m_NoDBConnect = Value
End Set
End Property
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property IsInitial As Boolean
Get
Return intSorted = 1
End Get
End Property
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property RecordCount As Integer
Get
Return intSortCount
End Get
End Property
''' -----------------------------------------------------------------------------
''' <summary>
''' Gets or sets a value indicating to use AutoUpdate.
''' </summary>
''' <value>True if AutoUpdate is turned on.</value>
''' <remarks>
''' </remarks>
''' <history>
''' [Chris] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<Bindable(False),
Browsable(True),
EditorBrowsable(EditorBrowsableState.Always)>
Public Property AutoUpdate As Boolean
Get
Return Session(UniqueSessionID + "AutoUpdate")
End Get
Set(Value As Boolean)
Session(UniqueSessionID + "AutoUpdate") = Value
End Set
End Property
''' --- IncrementCountIntoSequence ------------------------------------------------------
''' <exclude />
''' <summary>
''' Added due to the fact that when hovering over the CountIntoCalled method in debug
''' caused this counter to increment.
''' </summary>
''' <remarks>
''' This value can only be retrieved from the screen that set the value.
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Sub IncrementCountIntoSequence()
m_intCountIntoSequence += 1
End Sub
''' --- m_intRunScreenSequence ---------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intRunScreenSequence.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_intRunScreenSequence As Integer = 0 _
' Indicates the sequence of run screen calls.
''' --- m_strRunScreenFolder -----------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strRunScreenFolder.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strRunScreenFolder As String _
' The sub-directory from which to call the run screen.
''' --- m_intRunScreenFolderLength -----------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intRunScreenFolderLength.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_intRunScreenFolderLength As Short = -1 _
' RunScreenFolderLength is used in a call to Run Screen to identify folder based on Run Screen Name
''' --- m_strRunScreenFolderLength -----------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strRunScreenFolderLength.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private Shared m_strRunScreenFolderLength As String _
' strRunScreenFolderLength is used to get initial value from config file
''' --- m_intPutSequence ---------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intPutSequence.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_intPutSequence As Integer = 0 _
' Indicates the sequence of put calls.
''' --- m_intGetSequence ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intGetSequence.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_intGetSequence As Integer = 0
''' --- m_strRunScreen -----------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strRunScreen.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected m_strRunScreen As String = ""
' Push verb.
''' --- m_strPush ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strPush.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strPush As String = String.Empty
''' --- m_intLevel ---------------------------------------------------------
''' <summary>
''' Indicates the number of levels the current screen has traversed.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)> Protected m_intLevel As Integer = 1
Public NumberedSessionID As New CoreInteger("NumberedSessionID", 8, Me)
Public QTPSessionID As String = String.Empty
''' --- m_blnIsUsingSqlServer -------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_blnIsUsingSqlServer.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_blnIsUsingSqlServer As TriState = TriState.UseDefault
''' --- m_strRunFlag -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strRunFlag.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strRunFlag As String = "" _
' The RUN_FLAG value from SESSION.
''' --- m_strRunFlag -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strPutFlag.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strPutFlag As String = "" _
' The PUT_FLAG value from SESSION.
''' --- m_strGetFlag -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strGetFlag.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strGetFlag As String = String.Empty
''' --- m_strScreenKey -----------------------------------------------------
''' <exclude />
''' <summary>
''' Indicates the current level of the screen.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected m_strScreenKey As String
''' --- m_strExternalFlag -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strRunFlag.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strExternalFlag As String = "" _
' The EXTERNAL_FLAG value from SESSION.
''' --- m_intRunScreenMode -------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intRunScreenMode.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected m_intRunScreenMode As PageModeTypes
''' --- GlobalizationManager -----------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GlobalizationManager.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private GlobalizationManager As GlobalizationManager
''' --- m_strPageId --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strPageId.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private ReadOnly m_strPageId As String
''' --- m_pmtMode ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_pmtMode.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_pmtMode As PageModeTypes
''' --- ObjectStateMedium --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of ObjectStateMedium.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected _
ObjectStateMedium As StateMedium = StateMedium.SessionOnServer
''' --- m_hstInternalStateInfo ---------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_hstInternalStateInfo.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_hstInternalStateInfo As Hashtable _
' To store the state of Temporary and File Objects
''' --- m_colMessages ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_colMessages.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_colMessages As New Collection
''' --- m_blnHasError ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_blnHasError.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_blnHasError As Boolean = False
''' --- m_bfoFileForRecordStatus -------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_bfoFileForRecordStatus.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_bfoFileForRecordStatus As BaseFileObject _
' m_bfoFileForRecordStatus is used in DeletedRecord, AlteredRecord and NewRecord method
''' --- m_bfoPrimaryFile ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_bfoPrimaryFile.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Friend m_bfoPrimaryFile As BaseFileObject _
' m_bfoPrimaryFile is used to store Primary File Object
''' --- m_strPrimaryFile ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strPrimaryFile.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strPrimaryFile As String = ""
''' --- m_intMaxRecordsToRetrieve ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intMaxRecordsToRetrieve.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 6/29/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected Friend Shared _
m_intMaxRecordsToRetrieve As Integer = -1
''' --- m_intProcessLimit ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_intProcessLimit.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 6/29/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Protected Friend Shared m_intProcessLimit As Integer = -1
#Region " Events "
''' --- InitializeInternalValues -------------------------------------------
''' <exclude />
''' <summary>
''' Summary of InitializeInternalValues.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event InitializeInternalValues()
''' --- LoadPageState ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of LoadPageState.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event LoadPageState(Sender As Object, e As PageStateEventArgs, blnFromAppend As Boolean)
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event SetOverRideOccurrence(value As Integer, FileName As String)
''' --- SavePageState ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SavePageState.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event SavePageState(Sender As Object, e As PageStateEventArgs)
''' --- Reset ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Reset.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event ResetFile(Sender As Object)
''' --- SaveTempFile ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SavePageState.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event SaveTempFile(Sender As Object, e As PageStateEventArgs)
''' --- ClearFiles ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of ClearFiles.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Event ClearFiles(Sender As Object, e As PageStateEventArgs)
#End Region
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New()
MyBase.New()
End Sub
''' --- New ----------------------------------------------------------------
''' <summary>
''' Instantiates a New instance of BaseClassWeb.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New(UniqueID As String)
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
m_blnOracle = True
Else
m_blnOracle = False
End If
SetRunScreenFolderLength()
m_strUniqueSessionID = UniqueID
End Sub
''' --- New ----------------------------------------------------------------
''' <summary>
''' Instantiates a New instance of BaseClassWeb.
''' </summary>
''' <param name="Name">A String holding the name of the screen.</param>
''' <param name="Level">An Integer representing the screen level of the screen.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New(Name As String, Level As Integer)
MyBase.New()
m_intLevel = Level
Me.Name = Name
'Set PageId that can be used to store and retrieve Internal Session
m_strPageId = Name + "_" + Level.ToString
SetGlobalizationManager()
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
m_blnOracle = True
Else
m_blnOracle = False
End If
SetRunScreenFolderLength()
m_strUniqueSessionID = ""
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New(Name As String, Level As Integer, UniqueID As String)
MyBase.New()
m_intLevel = Level
Me.Name = Name
'Set PageId that can be used to store and retrieve Internal Session
m_strPageId = Name + "_" + Level.ToString
m_strUniqueSessionID = UniqueID
SetGlobalizationManager()
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
m_blnOracle = True
Else
m_blnOracle = False
End If
SetRunScreenFolderLength()
End Sub
''' --- New ----------------------------------------------------------------
''' <summary>
''' Instantiates a New instance of BaseClassWeb.
''' </summary>
''' <param name="Name">A String holding the name of the screen.</param>
''' <param name="Level">An Integer representing the screen level of the screen.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New(Name As String, Level As Integer, Request As Boolean)
MyBase.New()
Me.QTPRequest = Request
If Request AndAlso ScreenType <> ScreenTypes.QUIZ Then
ScreenType = ScreenTypes.QTP
End If
m_intLevel = Level
Me.Name = Name
'Set PageId that can be used to store and retrieve Internal Session
m_strPageId = Name + "_" + Level.ToString
SetGlobalizationManager()
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
m_blnOracle = True
Else
m_blnOracle = False
End If
SetRunScreenFolderLength()
m_strUniqueSessionID = ""
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub New(Name As String, Level As Integer, Request As Boolean, UniqueID As String)
MyBase.New()
Me.QTPRequest = Request
If Request AndAlso ScreenType <> ScreenTypes.QUIZ Then
ScreenType = ScreenTypes.QTP
End If
m_intLevel = Level
Me.Name = Name
'Set PageId that can be used to store and retrieve Internal Session
m_strPageId = Name + "_" + Level.ToString
SetGlobalizationManager()
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
m_blnOracle = True
Else
m_blnOracle = False
End If
SetRunScreenFolderLength()
m_strUniqueSessionID = UniqueID
End Sub
#Region " Properties "
''' --- FormNameLevel ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of FormNameLevel.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property FormNameLevel As String
Get
If m_strScreenKey Is Nothing Then
m_strScreenKey = Me.FormName + "_" + Me.Level.ToString
End If
Return m_strScreenKey
End Get
End Property
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overridable ReadOnly Property MaxRecordsToRetrieve As Integer
Get
' If m_intMaxRecordsToRetrieve is -1, then read the value from web.config.
' If no value in web.config, set the value to 0 so we don't re-read each time.
If m_intMaxRecordsToRetrieve = -1 Then
If ConfigurationManager.AppSettings("MaxRecords") Is Nothing Then
m_intMaxRecordsToRetrieve = 0
Else
m_intMaxRecordsToRetrieve = CInt(ConfigurationManager.AppSettings("MaxRecords"))
End If
End If
Return m_intMaxRecordsToRetrieve
End Get
End Property
' Used for the State Manager Component.
''' --- ScreenSession ------------------------------------------------------
''' <summary>
''' Set or return screen specific session information for a given key.
''' </summary>
''' <param name="Key">The key used to retrieve the value.</param>
''' <remarks>
''' This property sets/returns session information for a specific key.
''' This value can only be retrieved from the screen that set the value.
''' </remarks>
''' <example>
''' ScreenSession(UniqueSessionID + "T_TEMP") = T_TEMP.Value <br />
''' T_TEMP.Value = ScreenSession(UniqueSessionID + "T_TEMP")
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Always)>
Public Property ScreenSession(Key As String) As Object
Get
Return Session(Me.FormNameLevel + "_" + Key)
End Get
Set(Value As Object)
Session(Me.FormNameLevel + "_" + Key) = Value
End Set
End Property
''' --- DeleteScreenSession -----------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of DeleteScreenSession.
''' </summary>
''' <param name="Key"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub DeleteScreenSession(Key As String)
Try
Session.Remove(Me.FormNameLevel + "_" + Key)
Catch ex As Exception
Throw ex
End Try
End Sub
''' --- GlobalSession ------------------------------------------------------
''' <summary>
''' Set or return session information for a given key.
''' </summary>
''' <param name="Key"></param>
''' <remarks>
''' This property sets/returns session information for a specific key.
''' This value can be retrieved from any screen regardless of which screen set
''' this value.
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Always)>
Public Property GlobalSession(Key As String) As Object
Get
Return Session(Key)
End Get
Set(Value As Object)
Session(Key) = Value
End Set
End Property
''' --- RemoveScreenSession ------------------------------------------------------
''' <exclude />
''' <summary>
''' Deletes the screen session key.
''' </summary>
''' <param name="Key"></param>
''' <remarks>
''' This property deletes the session information for a specific key.
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RemoveScreenSession(Key As String)
Session.Remove(Me.FormNameLevel + "_" + Key)
End Sub
''' --- RemoveGlobalSession ------------------------------------------------------
''' <exclude />
''' <summary>
''' Deletes the global session key.
''' </summary>
''' <param name="Key"></param>
''' <remarks>
''' This property sets/returns session information for a specific key.
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub RemoveGlobalSession(Key As String)
Session.Remove(Key)
End Sub
''' --- AccessOk -----------------------------------------------------------
''' <summary>
''' Summary of AccessOk.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overrides Property AccessOk As Boolean
'The AccessOk condition relates to a session and not to a specific screen.
Get
Return Session(UniqueSessionID + "AccessOK")
End Get
Set
Session(UniqueSessionID + "AccessOK") = Value
End Set
End Property
'' --- SshConnectionOpen -----------------------------------------------------------
''' <summary>
''' Summary of SshConnectionOpen.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
Private Property SshConnectionOpen As Boolean
Get
If Session(UniqueSessionID + "SshOpen") Is Nothing Then
Return False
Else
Return CBool(Session(UniqueSessionID + "SshOpen"))
End If
End Get
Set(value As Boolean)
Session(UniqueSessionID + "SshOpen") = value
End Set
End Property
Private Sub RemoveSshConnectionOpen()
Session.Remove(UniqueSessionID + "SshOpen")
End Sub
''' --- Language -----------------------------------------------------------
''' <exclude />
''' <summary>
''' This member supports the Renaissance Architect Framework infrastructure and
''' is not intended to be used directly from your code.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Updated summary from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property Language As String
Get
Return GlobalizationManager.SupportedLanguage
End Get
Set(Value As String)
Session.Add(UniqueSessionID + "Language", Value.ToLower)
End Set
End Property
''' --- Level --------------------------------------------------------------
''' <summary>
''' Retrieves the current Screen Level.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overrides Property Level As Integer
Get
Return m_intLevel
End Get
Set
m_intLevel = Value
End Set
End Property
''' --- Mode ---------------------------------------------------------------
''' <exclude />
''' <summary>
''' This member supports the Renaissance Architect Framework infrastructure and
''' is not intended to be used directly from your code.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Used summary from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overrides Property Mode As PageModeTypes
Get
Return m_pmtMode
End Get
Set(Value As PageModeTypes)
m_pmtMode = Value
End Set
End Property
''' -----------------------------------------------------------------------------
''' <exclude />
''' <summary>
''' This member supports the Renaissance Architect Framework infrastructure and
''' is not intended to be used directly from your code.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [Chris] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property SetAlteredFlag As Boolean
Get
' The AlteredRecord flag is not set to True if the value was changed when
' FindMode is true except when in the PostFind or DetailPostFind. If in
' NoMode (in our case we are in NoMode when searching for a record using FIND
' and no records are found, or by pressing the cancel button), the AlteredRecord flag
' should not be set to True, unless we are running the INITIALIZE procedure. In
' all other modes, the AlteredRecord status should change to True when the value changes.
If _
Mode = PageModeTypes.Change OrElse Mode = PageModeTypes.Entry OrElse Mode = PageModeTypes.Correct OrElse
Mode = PageModeTypes.NoMode OrElse
(Mode = PageModeTypes.Find AndAlso m_blnInPostFindOrDetailPostFind) OrElse m_blnInInitialize Then
Return True
Else
Return False
End If
End Get
End Property
''' --- PageSession --------------------------------------------------------
''' <summary>
''' Stores page specific values into the Session.
''' </summary>
''' <param name="PageSessionKey"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property PageSession(PageSessionKey As String) As Object
'This property is added to store page specific values into the Session
Get
Dim strPageSessionKey As String = Me.FormName + "_" + Me.Level.ToString + "_" + PageSessionKey
Return Session(UniqueSessionID + strPageSessionKey)
End Get
Set(Value As Object)
Dim strPageSessionKey As String = Me.FormName + "_" + Me.Level.ToString + "_" + PageSessionKey
Session(UniqueSessionID + strPageSessionKey) = Value
End Set
End Property
''' --- ScreenSequence -----------------------------------------------------
''' <summary>
''' Summary of ScreenSequence.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Property ScreenSequence As String
Get
Return Session(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence") & ""
End Get
Set(value As String)
Session(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence") = value
End Set
End Property
Private intTotalRecordsFound As Integer
Public Property TotalRecordsFound() As Integer
Get
Return intTotalRecordsFound
End Get
Set(ByVal Value As Integer)
intTotalRecordsFound = Value
End Set
End Property
Private intTotalRecordsProcessed As Integer
Public Overridable Property TotalRecordsProcessed() As Integer
'Note: Only to be used in While skipping records with an error in Find/DetailFind
Get
Return intTotalRecordsProcessed
End Get
Set(ByVal Value As Integer)
intTotalRecordsProcessed = Value
End Set
End Property
''' --- Session ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Session.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property Session As Hashtable
Get
If ApplicationState.Current.Session Is Nothing Then
ApplicationState.Current.Session = New Hashtable
End If
Return ApplicationState.Current.Session
End Get
Set(value As Hashtable)
ApplicationState.Current.Session = value
End Set
End Property
''' --- Application --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Application.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property Application As Hashtable
Get
Return ApplicationState.Current.Application
End Get
Set(value As Hashtable)
ApplicationState.Current.Application = value
End Set
End Property
''' --- IsInAppendOrEntry --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of IsInAppendOrEntry.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend ReadOnly Property IsInAppendOrEntry As Boolean
Get
Return m_blnIsInAppendOrEntry
End Get
End Property
''' --- PrimaryFile --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of PrimaryFile.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property PrimaryFile As String
Get
Return m_strPrimaryFile
End Get
Set(Value As String)
m_strPrimaryFile = Value
End Set
End Property
''' --- InFind -------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of InFind.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend ReadOnly Property InFind As Boolean
Get
Return m_blnInFind
End Get
End Property
''' --- InFindOrDetailFind -------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of InFindOrDetailFind.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend ReadOnly Property InFindOrDetailFind As Boolean
Get
Return m_blnInFindOrDetailFind
End Get
End Property
''' --- CalledPageSession --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CalledPageSession.
''' </summary>
''' <param name="CalledScreenName"></param>
''' <param name="CalledScreenLevel"></param>
''' <param name="PageSessionKey"></param>
''' <remarks>
''' CalledPageSession property uses Session Collection, however to make it
''' readable and maitainable it adds prefix "PageName_Level_" to SessionKey passed,
''' which mimics a Page-Specific Session.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property CalledPageSession(CalledScreenName As String, CalledScreenLevel As Integer,
PageSessionKey As String) As Object
Get
Dim strPageSessionKey As String = CalledScreenName + "_" + CalledScreenLevel.ToString + "_" +
m_intRunScreenSequence.ToString + "_" + PageSessionKey
Return Session(UniqueSessionID + strPageSessionKey)
End Get
Set(Value As Object)
Dim strPageSessionKey As String = CalledScreenName + "_" + CalledScreenLevel.ToString + "_" +
m_intRunScreenSequence.ToString + "_" + PageSessionKey
Session(UniqueSessionID + strPageSessionKey) = Value
End Set
End Property
#End Region
#Region " Methods "
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub PurgeFile(FileName As String)
SessionInformation.Remove(FileName, Session("SessionID"))
End Sub
''' --- RunSshShellCommand ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RunCommand.
''' </summary>
''' <param name="Command"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function RunSshShellCommand(Command As String) As String
Return SessionInformation.RunSshCommand(Command.TrimEnd)
End Function
'----------------------------------------
' CodeExecuted property.
'----------------------------------------
''' -----------------------------------------------------------------------------
''' <exclude />
''' <summary>
''' Internal function.
''' </summary>
''' <value>True if the screen is called from the menu tree.</value>
''' <remarks>
''' </remarks>
''' <history>
''' [Chris] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Property CodeExecuted As Boolean
Get
If ScreenSession(UniqueSessionID + "CodeExecuted") Is Nothing Then
Return False
Else
Return ScreenSession(UniqueSessionID + "CodeExecuted")
End If
End Get
Set(Value As Boolean)
ScreenSession(UniqueSessionID + "CodeExecuted") = Value
End Set
End Property
''' <summary>
''' Places one or more commands on the screen's pending buffer.
''' </summary>
''' <example>
''' Push(PushTypes.Find)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub Push(Name As PushTypes)
Push(Name.ToString)
End Sub
''' --- Push ---------------------------------------------------------------
''' <summary>
''' Places one or more commands on the screen's pending buffer.
''' </summary>
''' <param name="Designer">The designer procedure to place on the screen's pending buffer.</param>
''' <remarks>
''' This method puts one or more commands on the pending buffer. Once the
''' user has finished executing a specific procedure, the pending buffer is checked
''' for the commands to execute.
''' <note>
''' The Push method has a First In First Out configuration. The following will be executed as follows: <br />
''' Push(PushTypes.NextRecord)<br />
''' Push(PushTypes.Find)<br />
''' <br />
''' In the example listed above, the Find will be executed first, then the NextRecord command.
''' </note>
''' </remarks>
''' <example>
''' Push(dsrDesigner_BAT)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub Push(Designer As Designer)
'Push(Designer.ID)
End Sub
''' --- Push ---------------------------------------------------------------
''' <exclude />
''' <summary>
''' Places one or more commands on the screen's pending buffer.
''' </summary>
''' <param name="Name"></param>
''' <example>
''' Push(dsrDesigner_BAT)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Sub Push(Name As String)
Dim strSeparator As String = ","
If m_strPush.Length = 0 Then strSeparator = String.Empty
m_strPush = Name + strSeparator + m_strPush
End Sub
''' <summary>
''' Places one or more commands on the screen's pending buffer.
''' </summary>
''' <param name="Name">The designer procedures to place on the screen's pending buffer.</param>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub Push(ByVal ParamArray Name() As Designer)
'Dim intCount As Integer
'Dim strSeparator As String = ","
'For intCount = 0 To UBound(Name)
' If m_strPush.Length = 0 Then
' m_strPush = m_strPush + Name(intCount).ID
' Else
' m_strPush = m_strPush + strSeparator + Name(intCount).ID
' End If
'Next
End Sub
''' <summary>
''' Places one or more commands on the screen's pending buffer.
''' </summary>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub Push(ByVal ParamArray Name() As PushTypes)
Dim intCount As Integer
Dim strSeparator As String = ","
For intCount = 0 To UBound(Name)
If m_strPush.Length = 0 Then
m_strPush = m_strPush + Name(intCount).ToString
Else
m_strPush = m_strPush + strSeparator + Name(intCount).ToString
End If
Next
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' Compares a string to a pattern.
''' </summary>
''' <param name="Value">A string of characters to compare against a pattern.</param>
''' <param name="Pattern">A string representing a specific pattern to match against the passed in value.</param>
''' <returns>A Boolean</returns>
''' <remarks>
''' Will return True, if the pattern matches the string and False, if not.
''' </remarks>
''' <history>
''' [Campbell] 4/5/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function MatchPattern(Value As String, Pattern As String) As Boolean
Try
'Added the following because !0 means nothing is PH and regular expressions can not duplicate this
If (Pattern = "!0" OrElse Pattern.IndexOf("|!0") >= 0) AndAlso Value.Trim.Length = 0 Then
Return True
End If
Return EvalRegularExpressionAsPowerHousePattern(Value, GetRegularExpresssionPattern(Pattern))
Catch ex As CustomApplicationException
If ex.Message.Equals("Invalid pattern!") Then 'IM.InvalidPattern
Warning("Invalid pattern!") 'IM.InvalidPattern
Return True
Else
Throw ex
End If
End Try
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overridable Function Prompt(intArr As Integer) As Object
Dim strTmp As String = ""
Dim arrTemp() As Object = Session(UniqueSessionID + "Prompt")
If IsNothing(arrTemp) OrElse arrTemp.Length = 0 OrElse arrTemp.Length < intArr Then
arrTemp = Common.Parms
If IsNothing(arrTemp) OrElse arrTemp.Length = 0 OrElse arrTemp.Length < intArr Then
Return ""
End If
End If
Select Case arrTemp(intArr - 1).GetType.ToString
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreCharacter"
If m_blnInChoose Then
Return CType(arrTemp(intArr - 1), CoreCharacter).Value.Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), CoreCharacter).Value
Case "CORE.WINDOWS.CoreVarChar"
If m_blnInChoose Then
Return CType(arrTemp(intArr - 1), CoreVarChar).Value.Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), CoreVarChar).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDecimal"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), CoreDecimal).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreInteger"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), CoreInteger).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDate"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), CoreDate).Value
Case "Core.Framework.Core.Framework.DCharacter"
If m_blnInChoose Then
Return CType(arrTemp(intArr - 1), DCharacter).Value.Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), DCharacter).Value
Case "Core.Framework.Core.Framework.DVarChar"
If m_blnInChoose Then
Return CType(arrTemp(intArr - 1), DVarChar).Value.Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), DVarChar).Value
Case "Core.Framework.Core.Framework.DDecimal"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), DDecimal).Value
Case "Core.Framework.Core.Framework.DInteger"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), DInteger).Value
Case "Core.Framework.Core.Framework.DDate"
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), DDate).Value
Case "System.String"
If m_blnInChoose Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return CType(arrTemp(intArr - 1), String)
Case Else
If m_blnInChoose AndAlso CType(arrTemp(intArr - 1), String).IndexOf(CORE_DELIMITER) > -1 Then
Return CType(arrTemp(intArr - 1), String).Replace(CORE_DELIMITER, ",")
End If
Return arrTemp(intArr - 1)
End Select
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overridable Function RunQTP() As Boolean
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Overridable Function RunQUIZ() As Boolean
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function RunBaseJOB(JobNumber As Integer, SessionID As String, Parms() As Object) As Boolean
Return RunQTPBase(JobNumber, SessionID, Parms)
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function RunQTPBase(JobNumber As Integer, SessionID As String, Parms() As Object) As Boolean
Dim blnSuccess As Boolean = False
Try
Session(UniqueSessionID + "Prompt") = Parms
Session(UniqueSessionID + "NumberedSessionID") = JobNumber
Session(UniqueSessionID + "QTPSessionID") = SessionID
RegisterStateFlag()
Dim strUser As String = Session(UniqueSessionID + "UserID") & ""
If strUser.Length = 0 Then
strUser = Session(UniqueSessionID + "m_strUser") & ""
End If
If Not ConfigurationManager.AppSettings("InputCenturyFrom") Is Nothing Then
m_intDefaultInputCentury =
ConfigurationManager.AppSettings("InputCenturyFrom").ToString.Split(",")(0)
' If we have a 2 digit century, multiply by 100 to give us
' the century that we add to the year entered. (ie. 19 becomes 1900)
If m_intDefaultInputCentury.ToString.Length = 2 Then
m_intDefaultInputCentury *= 100
End If
Session(UniqueSessionID + "DefaultInputCentury") = m_intDefaultInputCentury
m_intInputFromYear = ConfigurationManager.AppSettings("InputCenturyFrom").ToString.Split(",")(1)
Session(UniqueSessionID + "InputFromYear") = m_intInputFromYear
Else
m_intDefaultInputCentury = (CInt(Now.Year.ToString.Substring(0, 2)) - 1) * 100
Session(UniqueSessionID + "DefaultInputCentury") = m_intDefaultInputCentury
m_intInputFromYear = 50
Session(UniqueSessionID + "InputFromYear") = m_intInputFromYear
End If
If IsNothing(Session(UniqueSessionID + "StartFile")) Then
Session(UniqueSessionID + "StartFile") = Me.Name
If strUser.Length > 0 Then
Session(UniqueSessionID + "LogName") = strUser & "_" & Me.Name & "_" & Now.Year.ToString &
Now.Month.ToString.PadLeft(2, "0") &
Now.Day.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Hours.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Minutes.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Seconds.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Milliseconds.ToString.PadLeft(3, "0")
Else
Session(UniqueSessionID + "LogName") = Me.Name & "_" & Now.Year.ToString &
Now.Month.ToString.PadLeft(2, "0") &
Now.Day.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Hours.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Minutes.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Seconds.ToString.PadLeft(2, "0") &
Now.TimeOfDay.Milliseconds.ToString.PadLeft(3, "0")
End If
End If
#If TARGET_DB = "INFORMIX" Then
' Write the Process Id to the log file.
Dim sb As StringBuilder = New StringBuilder("ProcessID: ")
sb.Append(System.Diagnostics.Process.GetCurrentProcess.Id.ToString).Append(vbNewLine)
sb.Append("Program: ").Append(Me.Name).Append(vbNewLine)
WriteLogFile(sb.ToString)
#End If
If ScreenType = ScreenTypes.QUIZ Then
RunQUIZ()
Else
If IsAxiant() Then
Try
InitializeTransactionObjects()
Try
RunQTP()
Catch ex As CustomApplicationException
WriteError(ex)
Catch ex As Exception
WriteError(ex)
End Try
If CancelQTPs Then
TRANS_UPDATE(TransactionMethods.Rollback)
Else
TRANS_UPDATE(TransactionMethods.Commit)
End If
Catch ex As Exception
CancelQTPs = True
TRANS_UPDATE(TransactionMethods.Rollback)
m_LogFile.Append("Changes made since the last commit have been rolled back to a stable state. ")
m_LogFile.Append("Therefore, statistics reported may be incorrect. ")
WriteLogFile(m_LogFile.ToString)
End Try
Else
RunQTP()
If Not IsNothing(Session(UniqueSessionID + "hsSubfile")) AndAlso Not IsNothing(Session("TempFiles")) Then
Dim subkey As String
For Each subkey In DirectCast(Session("TempFiles"), ArrayList)
PutDataTextTable(subkey, Session(UniqueSessionID + "hsSubfile")(subkey),
Session(UniqueSessionID + "hsSubfileKeepText").Item(subkey),
Nothing)
Session(UniqueSessionID + "hsSubfile").Item(subkey).Clear()
Next
End If
Dim strDirectory As String = GetDEFAULT_BATCH_FILE_DIRECTORY()
Dim newFile As String = ""
If Not strDirectory.Trim = "" Then
If Not Directory.Exists(strDirectory) Then Directory.CreateDirectory(strDirectory)
If _
(Not ConfigurationManager.AppSettings("JobOutPut") Is Nothing AndAlso
ConfigurationManager.AppSettings("JobOutPut").ToUpper() = "TRUE") Then
newFile = strDirectory & "\" & Session("JobOutPut") & ".txt"
Else
newFile = strDirectory & "\" & Session(UniqueSessionID + "LogName") & ".txt"
End If
If File.Exists(newFile) Then
Dim sr As StreamReader = New StreamReader(newFile)
Dim line As String = sr.ReadLine
While Not IsNothing(line)
Console.WriteLine(line)
line = sr.ReadLine
End While
End If
End If
End If
End If
Try
CloseTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
If Me.Name = Session(UniqueSessionID + "StartFile") Then
If Not IsNothing(Session(UniqueSessionID + "hsSubfile")) Then
Dim Enumerator As IDictionaryEnumerator = Session("hsSubfile").GetEnumerator
While Enumerator.MoveNext
If _
Not _
(ScreenType = ScreenTypes.QUIZ AndAlso Enumerator.Key.ToString.ToUpper.EndsWith("_TEMP")) _
Then
If (ConfigurationManager.AppSettings("SubfileTEMPtoSQL") & "").ToUpper <> "TRUE" Then
SessionInformation.SetSession(Enumerator.Key.ToString, Enumerator.Value, SessionID)
End If
End If
End While
End If
If Not IsNothing(Session(UniqueSessionID + "hsSubfileKeepText")) Then
Dim Enumerator As IDictionaryEnumerator =
Session(UniqueSessionID + "hsSubfileKeepText").GetEnumerator
While Enumerator.MoveNext
If (ConfigurationManager.AppSettings("SubfileTEMPtoSQL") & "").ToUpper <> "TRUE" Then
SessionInformation.SetSession(Enumerator.Key.ToString & "_Length", Enumerator.Value,
SessionID)
End If
End While
End If
Session.Remove(UniqueSessionID + "hsSubfile")
Session.Remove(UniqueSessionID + "hsSubfileKeepText")
'Session.Remove(UniqueSessionID + "LogName")
If _
Not IsNothing(Session(UniqueSessionID + "alSubTempFile")) AndAlso
Session(UniqueSessionID + "alSubTempFile").Count > 0 Then
For i As Integer = 0 To Session(UniqueSessionID + "alSubTempFile").Count - 1
Dim strSQL As New StringBuilder("DROP TABLE ")
strSQL.Append(Session(UniqueSessionID + "alSubTempFile")(i))
#If TARGET_DB = "INFORMIX" Then
'Try
' InformixHelper.ExecuteNonQuery(GetInformixConnectionString(), CommandType.Text, strSQL.ToString)
'Catch ex As Exception
'End Try
#End If
Next
End If
Session.Remove(UniqueSessionID + "alSubTempFile")
End If
If _
Me.Name = Session(UniqueSessionID + "StartFile") AndAlso
Not IsNothing(Session(UniqueSessionID + "arrMoveFiles")) Then
End If
If Me.Name = Session(UniqueSessionID + "StartFile") Then
#If TARGET_DB = "INFORMIX" Then
cnnQUERY = Session(UniqueSessionID + "cnnQUERY")
cnnTRANS_UPDATE = Session(UniqueSessionID + "cnnTRANS_UPDATE")
trnTRANS_UPDATE = Session(UniqueSessionID + "trnTRANS_UPDATE")
Try
If Not trnTRANS_UPDATE Is Nothing Then trnTRANS_UPDATE.Commit()
Catch
End Try
If Not trnTRANS_UPDATE Is Nothing Then trnTRANS_UPDATE = Nothing
If Not cnnTRANS_UPDATE Is Nothing Then cnnTRANS_UPDATE.Close()
If Not cnnTRANS_UPDATE Is Nothing Then cnnTRANS_UPDATE.Dispose()
If Not cnnQUERY Is Nothing Then cnnQUERY.Close()
If Not cnnQUERY Is Nothing Then cnnQUERY.Dispose()
Session.Remove(UniqueSessionID + "cnnQUERY")
Session.Remove(UniqueSessionID + "cnnTRANS_UPDATE")
Session.Remove(UniqueSessionID + "trnTRANS_UPDATE")
#End If
Session.Remove(UniqueSessionID + "StartFile")
Session.Remove(UniqueSessionID + "Prompt")
Session.Remove(UniqueSessionID + "NumberedSessionID")
Session.Remove(UniqueSessionID + "QTPSessionID")
Session.Remove(UniqueSessionID + "hsSubFileSize")
End If
blnSuccess = True
Catch ex As Exception
If Me.Name = Session(UniqueSessionID + "StartFile") Then
#If TARGET_DB = "INFORMIX" Then
cnnQUERY = Session(UniqueSessionID + "cnnQUERY")
cnnTRANS_UPDATE = Session(UniqueSessionID + "cnnTRANS_UPDATE")
trnTRANS_UPDATE = Session(UniqueSessionID + "trnTRANS_UPDATE")
Try
If Not trnTRANS_UPDATE Is Nothing Then trnTRANS_UPDATE.Commit()
Catch
End Try
If Not trnTRANS_UPDATE Is Nothing Then trnTRANS_UPDATE = Nothing
If Not cnnTRANS_UPDATE Is Nothing Then cnnTRANS_UPDATE.Close()
If Not cnnTRANS_UPDATE Is Nothing Then cnnTRANS_UPDATE.Dispose()
If Not cnnQUERY Is Nothing Then cnnQUERY.Close()
If Not cnnQUERY Is Nothing Then cnnQUERY.Dispose()
Session.Remove(UniqueSessionID + "cnnQUERY")
Session.Remove(UniqueSessionID + "cnnTRANS_UPDATE")
Session.Remove(UniqueSessionID + "trnTRANS_UPDATE")
#End If
Session.Remove(UniqueSessionID + "StartFile")
Session.Remove(UniqueSessionID + "Prompt")
Session.Remove(UniqueSessionID + "NumberedSessionID")
Session.Remove(UniqueSessionID + "QTPSessionID")
Session.Remove(UniqueSessionID + "hsSubFileSize")
End If
' Write the exception to the event log.
ExceptionManager.Publish(ex)
Throw ex
End Try
Return blnSuccess
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function ParrallelForMissing(ParrallelFileObj As BaseFileObject) As Boolean
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Transaction() As Boolean
blnTrans = True
If blnAtInitial = BooleanTypes.NotSet Then
blnAtInitial = BooleanTypes.False
ElseIf blnAtInitial = BooleanTypes.False Then
blnAtInitial = BooleanTypes.True
End If
#If TARGET_DB = "INFORMIX" Then
If blnGotSQL = BooleanTypes.NotSet AndAlso blnRunForMissing Then
blnGotSQL = BooleanTypes.False
If m_blnGetSQL Then
Return True
End If
Return False
End If
#End If
If blnDeleteSubFile Then
blnHasRunSubfile = True
Return True
End If
If Not m_blnNoRecords Then
blnHasRunSubfile = True
intTransactions += 1
End If
Return Not m_blnNoRecords
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub Sort(ByVal ParamArray value() As Object)
#If TARGET_DB = "INFORMIX" Then
If Not blnGotSQL = BooleanTypes.True Then
Exit Sub
End If
#End If
strSortOrder = ""
blnHasSort = True
If blnDeleteSubFile Then
Exit Sub
End If
Dim dc As DataColumn
Dim rw As DataRow
If dtSortOrder.Columns.Count = 0 Then
dc = New DataColumn()
dc.ColumnName = "Sort"
dc.DataType = Type.GetType("System.String")
dtSortOrder.Columns.Add(dc)
For i As Integer = 0 To value.Length - 1
If value(i).GetType.ToString = "System.String" AndAlso value(i).IndexOf("~!Numeric!~") >= 0 Then
dc = New DataColumn()
dc.ColumnName = i.ToString
dc.DataType = Type.GetType("System.Decimal")
dtSortOrder.Columns.Add(dc)
ElseIf _
value(i).GetType.ToString = "System.String" AndAlso
value(i).IndexOf("~!NumericDescending!~") >= 0 Then
dc = New DataColumn()
dc.ColumnName = i.ToString
dc.DataType = Type.GetType("System.Decimal")
dtSortOrder.Columns.Add(dc)
Else
dc = New DataColumn()
dc.ColumnName = i.ToString
dc.DataType = Type.GetType("System.String")
dtSortOrder.Columns.Add(dc)
End If
Next
End If
Dim arrSort() As String = m_SortOrder.Split(",")
For i As Integer = 0 To arrSort.Length - 1
Try
arrSortOrder.Add((i + 1).ToString & "_" & arrSort(i).Trim)
Catch ex As Exception
End Try
Next
Dim strvalue As String = ""
Dim strdec As String = ""
rw = dtSortOrder.NewRow
rw.Item("Sort") = m_SortOrder
For i As Integer = 0 To value.Length - 1
strvalue = value(i)
If value(i).GetType.ToString = "System.Decimal" Then
If strvalue.IndexOf(".") >= 0 Then
strdec = strvalue.Substring(strvalue.IndexOf(".") + 1)
strvalue = strvalue.Substring(0, strvalue.IndexOf("."))
End If
strdec = strdec.PadRight(4, "0")
strvalue = strvalue.PadLeft(12, "0")
strvalue = strvalue & "." & strdec
End If
If strvalue.IndexOf("~!Descending!~") >= 0 Then
strvalue = strvalue.ToString.Replace("~!Descending!~", "")
strSortOrder = strSortOrder & i.ToString & " DESC,"
ElseIf strvalue.IndexOf("~!NumericDescending!~") >= 0 Then
strvalue = strvalue.ToString.Replace("~!NumericDescending!~", "")
strSortOrder = strSortOrder & i.ToString & " DESC,"
Else
If strvalue.IndexOf("~!Numeric!~") >= 0 Then
strvalue = strvalue.ToString.Replace("~!Numeric!~", "")
End If
strSortOrder = strSortOrder & i.ToString & " ASC,"
End If
rw.Item(i.ToString) = strvalue
Next
strSortOrder = strSortOrder.Substring(0, strSortOrder.Length - 1)
dtSortOrder.Rows.Add(rw)
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub Sorted(ByVal ParamArray value() As Object)
Sort(value)
End Sub
''' --- m_blnStartJobScript --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_blnStartJobScript.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_blnStartJobScript As Boolean
''' --- m_strJobParams --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_strJobParams.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Private m_strJobParams As String = String.Empty
''' --- m_blnStartJobScript --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of m_blnStartJobScript.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)> Public m_blnAppendJobScript As Boolean
Public m_strJobScriptPath As String = String.Empty
Protected Function JobScriptPath() As String
Try
If m_strJobScriptPath = "" Then
m_strJobScriptPath = ConfigurationManager.AppSettings("JobScriptPath") & "\"
End If
Return m_strJobScriptPath
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
Protected Sub StartJobScript()
Try
m_blnStartJobScript = True
Catch ex As Exception
End Try
End Sub
Protected Sub EndJobScript()
Try
m_blnStartJobScript = False
m_blnAppendJobScript = False
Session(UniqueSessionID + "dtNow") = Nothing
Session.Remove(UniqueSessionID + "RunJob")
Catch ex As Exception
End Try
End Sub
''' -----------------------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of ReadParmPrompts.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [mayur] 8/19/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub ReadParmPrompts()
m_htParmPrompts = New Hashtable
Dim strParmPromptsFileName As String = ConfigurationManager.AppSettings("ParmPrompts")
Dim intOccurs As Integer = 2
'Note: Using XmlTextReader, instead of XMLDocument to make the loading faster
'At present its not strictly observing the Encoding specifiec in the XML File,
'XmlTextReader always the default Encoding which is Windows-1252
Dim objParmPromptXML As XmlTextReader = Nothing
If (strParmPromptsFileName Is Nothing OrElse strParmPromptsFileName.Trim.Equals(String.Empty)) Then
Return
Else
If File.Exists(strParmPromptsFileName) Then
Try
objParmPromptXML = New XmlTextReader(strParmPromptsFileName)
With objParmPromptXML
Dim strJobName As String
While .Read
Select Case .NodeType
Case XmlNodeType.Element
If .Name.ToUpper.Equals("SCREEN") Then
Dim strParmPrompts(6) As String
strJobName = String.Empty
While .MoveToNextAttribute()
Select Case .Name.ToUpper
Case "JOB"
strJobName = .Value
Case "FIELD"
strParmPrompts(ParmPrompts.Field) = .Value
Case "TYPE"
strParmPrompts(ParmPrompts.Type) = .Value
Case "SIZE"
strParmPrompts(ParmPrompts.Size) = .Value
Case "LABEL"
strParmPrompts(ParmPrompts.Label) = .Value
Case "CHOOSE"
strParmPrompts(ParmPrompts.Prompt) = .Value
Case "VALUES"
strParmPrompts(ParmPrompts.Values) = .Value
Case "SHIFT"
strParmPrompts(ParmPrompts.ShiftType) = .Value
End Select
End While
If m_htParmPrompts.Contains(strJobName) Then
m_htParmPrompts(strJobName & "~occurs" & intOccurs & "~") =
strParmPrompts
intOccurs = intOccurs + 1
Else
m_htParmPrompts(strJobName) = strParmPrompts
intOccurs = 2
End If
End If
End Select
End While
End With
Catch ex As Exception
Throw ex
Finally
objParmPromptXML.Close()
objParmPromptXML = Nothing
End Try
End If
End If
Session(UniqueSessionID + "m_htParmPrompts") = m_htParmPrompts
End Sub
Public Function ExecuteMethod() As Boolean
Dim intSequence As Integer = 0
m_intRunScreenSequence += 1
intSequence = m_intRunScreenSequence
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(intSequence, "RUN_FLAG")
If blnMethodWasExecuted Then
Return False
Else
' Save the sequence information and set a flag indicating screen was run.
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", intSequence)
If _
Not IsNothing(Session(UniqueSessionID + "RunJob")) AndAlso
Session(UniqueSessionID + "RunJob") = False Then
Session.Remove(UniqueSessionID + "RunJob")
Return False
End If
Return True
End If
End Function
'Public Function WriteToJobScript(ScriptName As String, strName As String, Type As JobScriptType,
' ByVal ParamArray arrValue() As String) As Boolean
' Try
' Dim strValue As String = String.Empty
' Dim intSequence As Integer
' Dim strUserID As String = String.Empty
' Dim dtStartDate As Date
' Dim dtLastAccessTime As Date
' Dim blnIsActive As Boolean
' Dim intNumberedSessionID As Int32
' Dim strParm As String = String.Empty
' SessionInformation.GetSessionInformation(Session("SessionID"), strUserID, dtStartDate, dtLastAccessTime,
' blnIsActive, intNumberedSessionID, UniqueSessionID)
' m_htParmPrompts = Session(UniqueSessionID + "m_htParmPrompts")
' If IsNothing(m_htParmPrompts) Then ReadParmPrompts()
' If m_htParmPrompts.Contains(strName) AndAlso arrValue.Length = 1 Then
' Dim JOB As New CoreCharacter("JOB", 20, Me, ResetTypes.ResetAtStartup)
' Dim PARM1 As New CoreCharacter("PARM1", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM2 As New CoreCharacter("PARM2", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM3 As New CoreCharacter("PARM3", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM4 As New CoreCharacter("PARM4", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM5 As New CoreCharacter("PARM5", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM6 As New CoreCharacter("PARM6", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM7 As New CoreCharacter("PARM7", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM8 As New CoreCharacter("PARM8", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM9 As New CoreCharacter("PARM9", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM10 As New CoreCharacter("PARM10", 200, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM1TYPE As New CoreCharacter("PARM1TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM2TYPE As New CoreCharacter("PARM2TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM3TYPE As New CoreCharacter("PARM3TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM4TYPE As New CoreCharacter("PARM4TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM5TYPE As New CoreCharacter("PARM5TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM6TYPE As New CoreCharacter("PARM6TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM7TYPE As New CoreCharacter("PARM7TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM8TYPE As New CoreCharacter("PARM8TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM9TYPE As New CoreCharacter("PARM9TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' Dim PARM10TYPE As New CoreCharacter("PARM10TYPE", 300, Me, ResetTypes.ResetAtStartup, "")
' JOB.Value = strName
' Dim chooseFlag As String = String.Empty
' PARM1TYPE.Value = m_htParmPrompts(strName)(1).ToString.Trim & "~" &
' m_htParmPrompts(strName)(2).ToString.Trim & "~" &
' m_htParmPrompts(strName)(3).ToString.Trim & "~" &
' m_htParmPrompts(strName)(4).ToString.Trim & "~" &
' m_htParmPrompts(strName)(5).ToString.Trim & "~" &
' m_htParmPrompts(strName)(6).ToString.Trim
' If m_htParmPrompts.Contains(strName & "~occurs2~") Then
' PARM2TYPE.Value = m_htParmPrompts(strName & "~occurs2~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs2~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs2~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs2~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs2~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs2~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs3~") Then
' PARM3TYPE.Value = m_htParmPrompts(strName & "~occurs3~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs3~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs3~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs3~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs3~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs3~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs4~") Then
' PARM4TYPE.Value = m_htParmPrompts(strName & "~occurs4~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs4~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs4~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs4~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs4~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs4~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs5~") Then
' PARM5TYPE.Value = m_htParmPrompts(strName & "~occurs5~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs5~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs5~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs5~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs5~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs5~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs6~") Then
' PARM6TYPE.Value = m_htParmPrompts(strName & "~occurs6~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs6~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs6~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs6~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs6~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs6~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs7~") Then
' PARM7TYPE.Value = m_htParmPrompts(strName & "~occurs7~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs7~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs7~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs7~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs7~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs7~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs8~") Then
' PARM8TYPE.Value = m_htParmPrompts(strName & "~occurs8~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs8~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs8~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs8~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs8~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs8~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs9~") Then
' PARM9TYPE.Value = m_htParmPrompts(strName & "~occurs9~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs9~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs9~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs9~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs9~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs9~")(6).ToString.Trim
' End If
' If m_htParmPrompts.Contains(strName & "~occurs10~") Then
' PARM10TYPE.Value = m_htParmPrompts(strName & "~occurs10~")(1).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs10~")(2).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs10~")(3).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs10~")(4).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs10~")(5).ToString.Trim & "~" &
' m_htParmPrompts(strName & "~occurs10~")(6).ToString.Trim
' End If
' If Session(UniqueSessionID + "RunJob") Is Nothing Then Session(UniqueSessionID + "RunJob") = False
' RunScreen("JobControl/ParameterScreen", RunScreenModes.Entry, JOB, PARM1, PARM2, PARM3, PARM4, PARM5,
' PARM6, PARM7, PARM8, PARM9, PARM10, PARM1TYPE, PARM2TYPE, PARM3TYPE, PARM4TYPE, PARM5TYPE,
' PARM6TYPE, PARM7TYPE, PARM8TYPE, PARM9TYPE, PARM10TYPE)
' strParm = arrValue(0) &
' AddQuotes(PARM1.Value.Trim, PARM1TYPE.Value.Split("~")(0), PARM1TYPE.Value.Split("~")(3))
' If PARM2TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM2.Value.Trim, PARM2TYPE.Value.Split("~")(0),
' PARM2TYPE.Value.Split("~")(3))
' End If
' If PARM3TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM3.Value.Trim, PARM3TYPE.Value.Split("~")(0),
' PARM3TYPE.Value.Split("~")(3))
' End If
' If PARM4TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM4.Value.Trim, PARM4TYPE.Value.Split("~")(0),
' PARM4TYPE.Value.Split("~")(3))
' End If
' If PARM5TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM5.Value.Trim, PARM5TYPE.Value.Split("~")(0),
' PARM5TYPE.Value.Split("~")(3))
' End If
' If PARM6TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM6.Value.Trim, PARM6TYPE.Value.Split("~")(0),
' PARM6TYPE.Value.Split("~")(3))
' End If
' If PARM7TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM7.Value.Trim, PARM7TYPE.Value.Split("~")(0),
' PARM7TYPE.Value.Split("~")(3))
' End If
' If PARM8TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM8.Value.Trim, PARM8TYPE.Value.Split("~")(0),
' PARM8TYPE.Value.Split("~")(3))
' End If
' If PARM9TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM9.Value.Trim, PARM9TYPE.Value.Split("~")(0),
' PARM8TYPE.Value.Split("~")(3))
' End If
' If PARM10TYPE.Value.Trim.Length > 0 Then
' strParm = strParm & "," &
' AddQuotes(PARM10.Value.Trim, PARM10TYPE.Value.Split("~")(0),
' PARM10TYPE.Value.Split("~")(3))
' End If
' End If
' If m_blnStartJobScript Then
' strName = strName.TrimEnd
' m_intRunScreenSequence += 1
' intSequence = m_intRunScreenSequence
' Dim blnMethodWasExecuted As Boolean
' blnMethodWasExecuted = MethodWasExecuted(intSequence, "RUN_FLAG")
' If Not blnMethodWasExecuted Then
' ' Save the sequence information and set a flag indicating screen was run.
' SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", intSequence)
' If strParm.Length > 0 Then
' strValue = strParm
' Else
' For i As Integer = 0 To arrValue.Length - 1
' strValue = strValue & arrValue(i) & "~"
' Next
' strValue = strValue.Substring(0, strValue.Length - 1)
' End If
' Dim dtNow As String = String.Empty
' If IsNothing(Session(UniqueSessionID + "dtNow")) Then
' dtNow = ServerDateTimeValue()
' Session(UniqueSessionID + "dtNow") = dtNow
' Else
' dtNow = Session(UniqueSessionID + "dtNow")
' End If
' Dim strJobScriptPath As String = JobScriptPath()
' If Not Directory.Exists(strJobScriptPath) Then Directory.CreateDirectory(strJobScriptPath)
' Dim sw As StreamWriter =
' New StreamWriter(
' strJobScriptPath & ScriptName & "_" & Session("SessionID") & "_" & strUserID & "_" &
' dtNow & ".txt", m_blnAppendJobScript)
' m_blnAppendJobScript = True
' sw.Write("USER," & strUserID & vbNewLine)
' Select Case Type
' Case JobScriptType.Keep
' sw.Write("KEEP" & vbNewLine)
' Case JobScriptType.QTP
' sw.Write("QTP~" & strName & "~" & strValue & vbNewLine)
' Case JobScriptType.QUIZ
' sw.Write("QUIZ~PDF~" & strName & "~" & strValue & vbNewLine)
' Case JobScriptType.Screen
' sw.Write("SCREEN~" & strName & "~" & vbNewLine)
' Case JobScriptType.Job
' m_strJobParams = strName & "~" & strValue.Substring(arrValue(0).Length)
' sw.Write(strName & "~" & strValue & vbNewLine)
' Case JobScriptType.SetSystemval
' sw.Write("SetSystemval~" & strValue & vbNewLine)
' Case JobScriptType.LOG
' sw.Write("LOG~" & strName & "~" & strValue & vbNewLine)
' Case JobScriptType.MACRO
' sw.Write("MACRO~" & strName & "~" & strValue & vbNewLine)
' Case JobScriptType.TXT
' sw.Write("QUIZ~TXT~" & strName & "~" & strValue & vbNewLine)
' End Select
' sw.Close()
' End If
' Return True
' End If
' Return False
' Catch ex As CustomApplicationException
' Throw ex
' Catch ex As Exception
' ' Write the exception to the event log and throw an error.
' ExceptionManager.Publish(ex)
' Throw ex
' End Try
'End Function
' NOTE: This function also exists in Page.aspx.vb. If you update this function, also update the
' the one there.
Private Function AddQuotes(value As String, dataType As String, isChoose As String) As String
If isChoose = "Y" Then
If dataType = "CHR" Then
If value.IndexOf(",") > -1 Then
Dim ar() As String = value.Split(",")
For i As Integer = 0 To ar.Length - 1
ar(i) = StringToField(ar(i))
Next
value = Join(ar, CORE_DELIMITER)
Else
If GetSystemVal("CHOOSE") = "Y" Then
DeleteSystemVal("CHOOSE")
Else
value = StringToField(value)
End If
End If
Else
value = value.Replace(",", CORE_DELIMITER)
End If
End If
Return value
End Function
'----------------------------
' CalledPageSession property uses Session Collection, however to make it
' readable and maitainable it adds
' prefix "PageName_Level_" to SessionKey passed, which mimics
' a Page-Specific Session
'----------------------------
''' --- CalledPageSession --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CalledPageSession.
''' </summary>
''' <param name="CalledScreenName"></param>
''' <param name="CalledScreenLevel"></param>
''' <param name="PageSessionKey"></param>
''' <param name="strSequence"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<Bindable(False),
Browsable(False),
EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Property CalledPageSession(CalledScreenName As String, CalledScreenLevel As Integer,
PageSessionKey As String, strSequence As String) As Object
Get
Dim strPageSessionKey As String = CalledScreenName + "_" + CalledScreenLevel.ToString + "_" +
strSequence + "_" + PageSessionKey
Return Me.Session(UniqueSessionID + strPageSessionKey)
End Get
Set(Value As Object)
Dim strPageSessionKey As String = CalledScreenName + "_" + CalledScreenLevel.ToString + "_" +
strSequence + "_" + PageSessionKey
Me.Session(UniqueSessionID + strPageSessionKey) = Value
End Set
End Property
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function RunJobNow(RunJobName As String) As String
m_blnStartJobScript = False
m_blnAppendJobScript = False
Dim strUserID As String = String.Empty
Dim dtStartDate As Date
Dim dtLastAccessTime As Date
Dim blnIsActive As Boolean
Dim intNumberedSessionID As Int32
Dim dtNow As String = Session(UniqueSessionID + "dtNow")
If IsNothing(dtNow) OrElse dtNow = "" Then
dtNow = ServerDateTimeValue()
End If
SessionInformation.GetSessionInformation(Session("SessionID"), strUserID, dtStartDate, dtLastAccessTime,
blnIsActive, intNumberedSessionID, UniqueSessionID)
RunJobName = RunJobName.Trim & "_" & Session("SessionID") & "_" & strUserID & "_" & dtNow
Dim jobName As String = JobScriptPath() & RunJobName.Trim & ".txt"
Dim sr As New StreamReader(jobName)
Dim strText As String = sr.ReadToEnd
sr.Close()
sr.Dispose()
'strText = strText.Replace("QUIZ~", "QUIZ~PDF~")
Dim sw As New StreamWriter(jobName, False)
sw.Write(strText)
sw.Close()
sw.Dispose()
Session(UniqueSessionID + "dtNow") = Nothing
Session.Remove(UniqueSessionID + "RunJob")
Return jobName
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunJob(RunJobName As String)
m_blnStartJobScript = False
m_blnAppendJobScript = False
m_strRunScreenFolder = "JobControl"
m_strRunScreen = "JobControl"
m_intRunScreenSequence += 1
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(m_strRunFlag, m_intRunScreenSequence, "RUN_FLAG")
If Not blnMethodWasExecuted Then
Dim strUserID As String = String.Empty
Dim dtStartDate As Date
Dim dtLastAccessTime As Date
Dim blnIsActive As Boolean
Dim intNumberedSessionID As Int32
Dim dtNow As String = Session(UniqueSessionID + "dtNow")
If IsNothing(dtNow) OrElse dtNow = "" Then
dtNow = ServerDateTimeValue()
End If
Session(UniqueSessionID + "dtNow") = Nothing
SessionInformation.GetSessionInformation(Session("SessionID"), strUserID, dtStartDate, dtLastAccessTime,
blnIsActive, intNumberedSessionID, UniqueSessionID)
RunJobName = RunJobName.Trim & "_" & Session("SessionID") & "_" & strUserID & "_" & dtNow
' Save the sequence information and set a flag indicating screen was run.
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence)
' Save the parameters passed to the RUN SCREEN.
Me.CalledPageSession(m_strRunScreen, Me.Level + 1, "PARM1", m_intRunScreenSequence.ToString) =
RunJobName.Trim
Me.CalledPageSession(m_strRunScreen, Me.Level + 1, "PARM2", m_intRunScreenSequence.ToString) =
JobScriptPath() & RunJobName.Trim & ".txt"
' Track the total sessions, so we can remove these upon returning from the run screen.
Session(
UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString) = Session.Count
' Default: E for subscreen invoked during the standard entry procedure, otherwise NULL.
Session(UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence.ToString
Session(UniqueSessionID + "ScreenLevel") += 1
Session(UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_Mode") =
RunScreenModes.Entry
QDesign.ThrowCustomApplicationException(cRunScreenException)
End If
If blnMethodWasExecuted Then
' Decrement the ScreenLevel.
Session(UniqueSessionID + "ScreenLevel") = Me.Level
' Remove the Mode and ScreenSequence session information for the screen called.
Session.Remove(UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_Mode")
Session.Remove(UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_ScreenSequence")
DeleteSessions(
Session(
UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + m_strRunScreen + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
' Retrieve the parameters back from session.
' If a message was thrown on the previous screen, display it in the current screen.
'DisplayMessagesFromRunScreen(m_strRunScreen + "_" + (Me.Level + 1).ToString + "_" + strSequence.ToString)
End If
Session(UniqueSessionID + "dtNow") = Nothing
Session.Remove(UniqueSessionID + "RunJob")
End Sub
''' --- ServerDateTimeValue ------------------------------------------------------
''' <exclude />
''' <summary>
''' Returns the current time on the server.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function ServerDateTimeValue() As String
Return _
Now.Year.ToString & Now.Month.ToString.PadLeft(2, "0") & Now.Day.ToString.PadLeft(2, "0") &
Now.Hour.ToString.PadLeft(2, "0") & Now.Minute.ToString.PadLeft(2, "0") &
Now.Second.ToString.PadLeft(2, "0")
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function AtFinal() As Boolean
If blnHasBeenSort Then
If intSorted < intTransactions Then
Return False
Else
Return True
End If
Else
If intFirstOverrideOccurs < intFirstRecordCount - 1 Then
Return False
Else
Return True
End If
End If
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function AtInitial() As Boolean
If blnHasBeenSort Then
If intSorted = 1 Then
Return True
End If
Else
If blnAtInitial = BooleanTypes.False Then
Return True
End If
End If
Return False
End Function
#If TARGET_DB = "INFORMIX" Then
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
Public Function Sort(ByVal ParamArray arrFileobect() As IfxFileObject) As Boolean
Dim arrRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If (IsNothing(dtSortOrder) AndAlso IsNothing(dtSorted)) OrElse intSortCount <= 0 Then
If Me.ScreenType = ScreenTypes.QUIZ And Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
Return False
End If
If intSorted < intSortCount AndAlso (intRecordLimit = 0 OrElse intRecordLimit > intSorted) Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
If m_strQTPOrderBy.Length > 0 Then
dtSorted = dtSortOrder
Else
dtSortOrder.DefaultView.Sort = strSortOrder
dtSorted = dtSortOrder.DefaultView.ToTable
End If
dtSortOrder.Dispose()
dtSortOrder = Nothing
GC.Collect()
If intSortCount > intRecordLimit And intRecordLimit > 0 Then intSortCount = intRecordLimit
End If
arrRecNum = dtSorted.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
Next
If intSorted + 1 < intSortCount Then
arrRecNum = dtSorted.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
Next
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
Public Function Sorted(ByVal ParamArray arrFileobect() As IfxFileObject) As Boolean
Dim arrRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If IsNothing(dtSortOrder) OrElse dtSortOrder.Rows.Count <= 0 Then
If Me.ScreenType = ScreenTypes.QUIZ And Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
Return False
End If
If intSorted < dtSortOrder.Rows.Count Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
End If
arrRecNum = dtSortOrder.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
Next
If intSorted + 1 < dtSortOrder.Rows.Count Then
arrRecNum = dtSortOrder.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
Next
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
#Else
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Sort(ByVal ParamArray arrFileobect() As OracleFileObject) As Boolean
Dim arrRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If IsNothing(dtSortOrder) OrElse dtSortOrder.Rows.Count <= 0 Then
If Me.ScreenType = ScreenTypes.QUIZ And Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
Return False
End If
If intSorted < dtSortOrder.Rows.Count Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
dtSortOrder.DefaultView.Sort = strSortOrder
dtSorted = dtSortOrder.DefaultView.ToTable
End If
arrRecNum = dtSorted.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
Next
If intSorted + 1 < dtSortOrder.Rows.Count Then
arrRecNum = dtSorted.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
Next
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Sorted(ByVal ParamArray arrFileobect() As OracleFileObject) As Boolean
Dim arrRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If IsNothing(dtSortOrder) OrElse dtSortOrder.Rows.Count <= 0 Then
If Me.ScreenType = ScreenTypes.QUIZ And Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
Return False
End If
If intSorted < dtSortOrder.Rows.Count Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
End If
arrRecNum = dtSortOrder.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
Next
If intSorted + 1 < dtSortOrder.Rows.Count Then
arrRecNum = dtSortOrder.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
Next
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Sort(ByVal ParamArray arrFileobect() As SqlFileObject) As Boolean
Dim arrRecNum() As String
Dim arrNextRecNum() As String
Dim arrPrevRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If IsNothing(dtSortOrder) OrElse dtSortOrder.Rows.Count <= 0 AndAlso blnDeleteSubFile Then
If Not blnDeletedSubFile Then
blnDeletedSubFile = True
Return True
End If
Return False
ElseIf dtSortOrder.Rows.Count = 0 AndAlso Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
If intSorted < dtSortOrder.Rows.Count Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
dtSortOrder.DefaultView.Sort = strSortOrder
dtSorted = dtSortOrder.DefaultView.ToTable
End If
arrRecNum = dtSorted.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
If arrFileobect(i).m_HasAt = False Then
arrFileobect(i).m_Subtoal = New Hashtable
End If
Next
Dim sqlfile As SqlFileObject
For Each sqlfile In Subtotal_Files
If sqlfile.m_HasAt = False Then
sqlfile.m_Subtoal = New Hashtable
End If
Next
For Each sqlfile In InializesFile
sqlfile.IsInitialized = False
sqlfile.m_blnOutPutOutGet = True
Next
'If intSorted + 1 < dtSortOrder.Rows.Count Then
' arrRecNum = dtSorted.Rows(intSorted + 1).Item(0).ToString.Split(",")
' For i As Integer = 0 To arrRecNum.Length - 1
' arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
' Next
'End If
If intSorted <= dtSortOrder.Rows.Count - 1 Then
arrRecNum = dtSorted.Rows(intSorted).Item(0).ToString.Split(",")
If intSorted = 0 Then
If dtSortOrder.Rows.Count > 1 Then
arrNextRecNum = dtSorted.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrNextRecNum(i))
Next
End If
ElseIf intSorted < dtSortOrder.Rows.Count - 1 Then
arrNextRecNum = dtSorted.Rows(intSorted + 1).Item(0).ToString.Split(",")
arrPrevRecNum = dtSorted.Rows(intSorted - 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrNextRecNum(i))
arrFileobect(i).m_intSortPreviousOccurence = CInt(arrPrevRecNum(i))
Next
ElseIf intSorted = dtSortOrder.Rows.Count - 1 Then
arrPrevRecNum = dtSorted.Rows(intSorted - 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortPreviousOccurence = CInt(arrPrevRecNum(i))
Next
End If
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Sorted(ByVal ParamArray arrFileobect() As SqlFileObject) As Boolean
Dim arrRecNum() As String
blnHasBeenSort = True
If intSortCount = 0 AndAlso Not IsNothing(dtSortOrder) Then intSortCount = dtSortOrder.Rows.Count
If IsNothing(dtSortOrder) OrElse dtSortOrder.Rows.Count <= 0 AndAlso blnDeleteSubFile Then
If Not blnDeletedSubFile Then
blnDeleteSubFile = True
Return True
End If
Return False
End If
If intSorted < dtSortOrder.Rows.Count Then
strFileSortName = String.Empty
If intSorted = 0 Then
RaiseEvent ClearFiles(Me, New PageStateEventArgs("_"))
intTransactions = dtSortOrder.Rows.Count
arrReadInRequests = arrFileInRequests
GC.Collect()
End If
arrRecNum = dtSortOrder.Rows(intSorted).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).OverRideOccurrence = CInt(arrRecNum(i))
arrFileobect(i).m_intSortNextOccurence = -1
arrFileobect(i).SortOccurrence = -1
arrFileobect(i).m_arrOutPutColumns = Nothing
arrFileobect(i).m_arrOutPutValues = Nothing
If arrFileobect(i).AliasName <> "" Then
strFileSortName = strFileSortName & arrFileobect(i).AliasName & "~"
Else
strFileSortName = strFileSortName & arrFileobect(i).BaseName & "~"
End If
Next
If intSorted + 1 < dtSortOrder.Rows.Count Then
arrRecNum = dtSortOrder.Rows(intSorted + 1).Item(0).ToString.Split(",")
For i As Integer = 0 To arrRecNum.Length - 1
arrFileobect(i).m_intSortNextOccurence = CInt(arrRecNum(i))
Next
End If
intSorted = intSorted + 1
Return True
End If
Return False
End Function
Public Sub SubTotal(ByRef objFileObject As SqlFileObject, strColumn As String, value As Decimal,
ItemType As ItemType)
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As SqlFileObject, strColumn As String, value As Decimal)
Dim v As Decimal
If blnHasSort Then
If IsNothing(objFileObject.m_Subtoal) Then
objFileObject.m_Subtoal = New Hashtable
End If
If objFileObject.m_Subtoal.Contains(strColumn) Then
v = objFileObject.m_Subtoal(strColumn) + value
objFileObject.m_Subtoal(strColumn) = v
Else
objFileObject.m_Subtoal.Add(strColumn, objFileObject.GetDecimalValue(strColumn) + value)
v = objFileObject.GetDecimalValue(strColumn) + value
End If
objFileObject.SetValue(strColumn) = v
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As OracleFileObject, strColumn As String, value As Decimal,
ItemType As ItemType)
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As OracleFileObject, strColumn As String, value As Decimal)
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End Sub
'SubTotal AT
Public Sub SubTotal(ByRef objFileObject As SqlFileObject, strColumn As String, value As Decimal,
blnAt As Boolean, ItemType As ItemType)
If blnAt Then
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As SqlFileObject, strColumn As String, value As Decimal,
blnAt As Boolean)
If blnAt Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As OracleFileObject, strColumn As String, value As Decimal,
blnAt As Boolean, Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As SqlFileObject, strColumn As String, value As Decimal,
blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objFileObject As OracleFileObject, strColumn As String, value As Decimal,
blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - value
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + value
End If
End If
End Sub
#End If
Public Sub SubTotal(ByRef objVariable As CoreDecimal, value As Decimal, ItemType As ItemType)
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreDecimal, value As Decimal)
objVariable.Value = objVariable.Value + value
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal, ItemType As ItemType)
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal)
objVariable.Value = objVariable.Value + value
End Sub
Public Sub SubTotal(ByRef objVariable As CoreDecimal, value As Decimal, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreDecimal, value As Decimal, blnAt As Boolean,
blnCondition As Boolean, Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreDecimal, value As Decimal, blnAt As Boolean)
If blnAt Then
objVariable.Value = objVariable.Value + value
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal, blnAt As Boolean, ItemType As ItemType)
If blnAt Then
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal, blnAt As Boolean)
If blnAt Then
objVariable.Value = objVariable.Value + value
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal, blnAt As Boolean,
blnCondition As Boolean, ItemType As ItemType)
If blnAt AndAlso blnCondition Then
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - value
Else
objVariable.Value = objVariable.Value + value
End If
End If
End Sub
Public Sub SubTotal(ByRef objVariable As CoreInteger, value As Decimal, blnAt As Boolean,
blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
objVariable.Value = objVariable.Value + value
End If
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String, ItemType As ItemType)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - 1
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + 1
End If
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + 1
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String, ItemType As ItemType)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If ItemType = ItemType.Negative Then
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) - 1
Else
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + 1
End If
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
objFileObject.SetValue(strColumn) = objFileObject.GetDecimalValue(strColumn) + 1
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal, ItemType As ItemType)
Dim strName As String = objVariable.m_strVariableName
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - 1
Else
objVariable.Value = objVariable.Value + 1
End If
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal)
Dim strName As String = objVariable.m_strVariableName
objVariable.Value = objVariable.Value + 1
End Sub
Public Sub Count(ByRef objVariable As CoreInteger, ItemType As ItemType)
Dim strName As String = objVariable.m_strVariableName
If ItemType = ItemType.Negative Then
objVariable.Value = objVariable.Value - 1
Else
objVariable.Value = objVariable.Value + 1
End If
End Sub
Public Sub Count(ByRef objVariable As CoreInteger)
Dim strName As String = objVariable.m_strVariableName
objVariable.Value = objVariable.Value + 1
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String, blnAt As Boolean,
ItemType As ItemType)
If blnAt Then
Count(objFileObject, strColumn, ItemType)
End If
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String, blnAt As Boolean)
If blnAt Then
Count(objFileObject, strColumn)
End If
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String, blnAt As Boolean,
ItemType As ItemType)
If blnAt Then
Count(objFileObject, strColumn, ItemType)
End If
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String, blnAt As Boolean)
If blnAt Then
Count(objFileObject, strColumn)
End If
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean, ItemType As ItemType)
If blnAt AndAlso blnCondition Then
Count(objFileObject, strColumn, ItemType)
End If
End Sub
Public Sub Count(ByRef objFileObject As OracleFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Count(objFileObject, strColumn)
End If
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean, ItemType As ItemType)
If blnAt AndAlso blnCondition Then
Count(objFileObject, strColumn, ItemType)
End If
End Sub
Public Sub Count(ByRef objFileObject As SqlFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Count(objFileObject, strColumn)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal, blnAt As Boolean, ItemType As ItemType)
If blnAt Then
Count(objVariable, ItemType)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal, blnAt As Boolean)
If blnAt Then
Count(objVariable)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal, blnAt As Boolean, blnCondition As Boolean,
ItemType As ItemType)
If blnAt AndAlso blnCondition Then
Count(objVariable, ItemType)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreDecimal, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Count(objVariable)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreInteger, blnAt As Boolean, ItemType As ItemType)
If blnAt Then
Count(objVariable, ItemType)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreInteger, blnAt As Boolean)
If blnAt Then
Count(objVariable)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreInteger, blnAt As Boolean, blnCondition As Boolean,
ItemType As ItemType)
If blnAt AndAlso blnCondition Then
Count(objVariable, ItemType)
End If
End Sub
Public Sub Count(ByRef objVariable As CoreInteger, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Count(objVariable)
End If
End Sub
#If TARGET_DB = "INFORMIX" Then
''' -----------------------------------------------------------------------------
''' <summary>
''' Determines the system date from the database.
''' </summary>
''' <param name="cnnQUERY">An active connection to a Informix Database.</param>
''' <returns>The system date (in the format YYYYMMDD) from the database.</returns>
''' <remarks>
''' </remarks>
''' <example>
''' SysDate(cnnQUERY) returns "20050104"
''' </example>
''' <history>
''' [Campbell] 4/5/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
Public Function SysDate(ByRef cnnQUERY As IfxConnection) As Decimal
Dim dblDate As Decimal
Try
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
If dcSysDate = 0 Then
dblDate = QDesign.SysDate(cnnQUERY)
dcSysDate = dblDate
Else
dblDate = dcSysDate
End If
Else
dblDate = QDesign.SysDate(cnnQUERY)
End If
Return dblDate
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Determines the system time from the database.
''' </summary>
''' <param name="cnnQUERY">An active connection to a Informix Database.</param>
''' <returns>The system time (in the format HHMMSSMS) from the database.</returns>
''' <remarks>
''' </remarks>
''' <example>
''' SysTime(cnnQUERY) returns "13212200"
''' </example>
''' <history>
''' [Campbell] 4/5/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
Public Function SysTime(ByRef cnnQUERY As IfxConnection) As Decimal
Dim dblDate As Decimal
Try
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
If dcSysTime = 0 Then
dblDate = QDesign.SysTime(cnnQUERY)
dcSysTime = dblDate
Else
dblDate = dcSysTime
End If
Else
dblDate = QDesign.SysTime(cnnQUERY)
End If
Return dblDate
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Determines the system Date Time from a database.
''' </summary>
''' <param name="cnnQUERY">An active connection to an Informix Database.</param>
''' <returns>The system DateTime from the Database.</returns>
''' <remarks>The returned value's type is that of a Decimal. It represents an
''' instant in time, typically expressed as a date and time of day.
''' </remarks>
''' <example>
''' SysDateTimeAsDecimal(cnnQUERY) returns 20050115202449
''' </example>
''' <history>
''' [Campbell] 4/5/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
Public Function SysDateTime(ByRef cnnQUERY As IfxConnection) As Decimal
Dim dblDate As Decimal
Try
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
If dcSysDateTime = 0 Then
dblDate = QDesign.SysDateTime(cnnQUERY)
dcSysDateTime = dblDate
Else
dblDate = dcSysDateTime
End If
Else
dblDate = QDesign.SysDateTime(cnnQUERY)
End If
Return dblDate
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
#End If
Public Sub Average(ByRef objFileObject As BaseFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If hsAverage.ContainsKey(strName) Then
objFileObject.SetValue(strColumn) =
(hsAverage.Item(strName) + objFileObject.GetDecimalValue(strColumn)) / 2
hsAverage.Item(strName) = objFileObject.GetDecimalValue(strColumn)
Else
hsAverage.Add(strName, objFileObject.GetDecimalValue(strColumn))
End If
End Sub
Public Sub Average(ByRef objVariable As CoreDecimal)
Dim strName As String = objVariable.m_strVariableName
blInaverage = True
If hsAverage.ContainsKey(strName) Then
hsAverage.Item(strName) = hsAverage.Item(strName) + objVariable.Value
hsAverageCount.Item(strName) = hsAverageCount.Item(strName) + 1
Else
hsAverage.Add(strName, objVariable.Value)
hsAverageCount.Add(strName, 1)
End If
objVariable.Value = hsAverage.Item(strName) / hsAverageCount.Item(strName)
blInaverage = False
End Sub
Public Sub Average(ByRef objVariable As CoreInteger)
Dim strName As String = objVariable.m_strVariableName
If hsAverage.ContainsKey(strName) Then
objVariable.Value = (hsAverage.Item(strName) + objVariable.Value) / 2
hsAverage.Item(strName) = objVariable.Value
Else
hsAverage.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Average(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Average(objFileObject, strColumn)
End If
End Sub
Public Sub Average(ByRef objVariable As CoreDecimal, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Average(objVariable)
End If
End Sub
Public Sub Average(ByRef objVariable As CoreInteger, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Average(objVariable)
End If
End Sub
Public Sub Average(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean, Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Average(objFileObject, strColumn)
End If
End Sub
Public Sub Average(ByRef objVariable As CoreDecimal, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Average(objVariable)
End If
End Sub
Public Sub Average(ByRef objVariable As CoreInteger, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Average(objVariable)
End If
End Sub
Public Sub Maximum(ByRef objFileObject As BaseFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If hsMaximum.ContainsKey(strName) Then
If hsMaximum.Item(strName) > objFileObject.GetDecimalValue(strColumn) Then
objFileObject.SetValue(strColumn) = hsMaximum.Item(strName)
Else
hsMaximum.Item(strName) = objFileObject.GetDecimalValue(strColumn)
End If
Else
hsMaximum.Add(strName, objFileObject.GetDecimalValue(strColumn))
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreDate)
Dim strName As String = objVariable.m_strVariableName
If hsMaximum.ContainsKey(strName) Then
If hsMaximum.Item(strName) > objVariable.Value Then
objVariable.Value = hsMaximum.Item(strName)
Else
hsMaximum.Item(strName) = objVariable.Value
End If
Else
hsMaximum.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreDecimal)
Dim strName As String = objVariable.m_strVariableName
If hsMaximum.ContainsKey(strName) Then
If hsMaximum.Item(strName) > objVariable.Value Then
objVariable.Value = hsMaximum.Item(strName)
Else
hsMaximum.Item(strName) = objVariable.Value
End If
Else
hsMaximum.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreInteger)
Dim strName As String = objVariable.m_strVariableName
If hsMaximum.ContainsKey(strName) Then
If hsMaximum.Item(strName) > objVariable.Value Then
objVariable.Value = hsMaximum.Item(strName)
Else
hsMaximum.Item(strName) = objVariable.Value
End If
Else
hsMaximum.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Maximum(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Maximum(objFileObject, strColumn)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreDecimal, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Maximum(objVariable)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreInteger, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Maximum(objVariable)
End If
End Sub
Public Sub Maximum(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean, Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Maximum(objFileObject, strColumn)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreDecimal, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Maximum(objVariable)
End If
End Sub
Public Sub Maximum(ByRef objVariable As CoreInteger, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Maximum(objVariable)
End If
End Sub
Public Sub Minimum(ByRef objFileObject As BaseFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If hsMinimum.ContainsKey(strName) Then
If hsMinimum.Item(strName) < objFileObject.GetDecimalValue(strColumn) Then
objFileObject.SetValue(strColumn) = hsMinimum.Item(strName)
Else
hsMinimum.Item(strName) = objFileObject.GetDecimalValue(strColumn)
End If
Else
hsMinimum.Add(strName, objFileObject.GetDecimalValue(strColumn))
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreDecimal, objFileObject As BaseFileObject, strColumn As String)
Dim strName As String = String.Empty
If objFileObject.AliasName <> "" Then
strName = objFileObject.AliasName & "_" & strColumn
Else
strName = objFileObject.BaseName & "_" & strColumn
End If
If objVariable.Value > objFileObject.GetDecimalValue(strColumn) Then
objVariable.Value = objFileObject.GetDecimalValue(strColumn)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreDecimal, dd As DDecimal)
Dim strName As String = String.Empty
If objVariable.Value = 0 OrElse objVariable.Value > dd.Value Then
objVariable.Value = dd.Value
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreDecimal)
Dim strName As String = objVariable.m_strVariableName
If hsMinimum.ContainsKey(strName) Then
If hsMinimum.Item(strName) < objVariable.Value Then
objVariable.Value = hsMinimum.Item(strName)
Else
hsMinimum.Item(strName) = objVariable.Value
End If
Else
hsMinimum.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreInteger)
Dim strName As String = objVariable.m_strVariableName
If hsMinimum.ContainsKey(strName) Then
If hsMinimum.Item(strName) < objVariable.Value Then
objVariable.Value = hsMinimum.Item(strName)
Else
hsMinimum.Item(strName) = objVariable.Value
End If
Else
hsMinimum.Add(strName, objVariable.Value)
End If
End Sub
Public Sub Minimum(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Minimum(objFileObject, strColumn)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreDecimal, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Minimum(objVariable)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreInteger, blnAt As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt Then
Minimum(objVariable)
End If
End Sub
Public Sub Minimum(ByRef objFileObject As BaseFileObject, strColumn As String, blnAt As Boolean,
blnCondition As Boolean, Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Minimum(objFileObject, strColumn)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreDecimal, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Minimum(objVariable)
End If
End Sub
Public Sub Minimum(ByRef objVariable As CoreInteger, blnAt As Boolean, blnCondition As Boolean,
Optional ByVal ItemType As ItemType = ItemType.Positive)
If blnAt AndAlso blnCondition Then
Minimum(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As Object)
Select Case objVariable.GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER"
objVariable.Value = " "
Case "CORE.WINDOWS.COREVARCHAR"
objVariable.Value = " "
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL"
objVariable.Value = 0
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
objVariable.Value = 0
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
objVariable.Value = 0
End Select
Dim strName As String = objVariable.m_strVariableName
If hsAverage.ContainsKey(strName) Then
hsAverage.Remove(strName)
hsAverageCount.Remove(strName)
End If
End Sub
Public Sub Reset(ByRef objFileObject As SqlFileObject, column As String)
objFileObject.SetValue(column) = 0
End Sub
Public Sub Reset(ByRef objFileObject As SqlFileObject, column As String, objValue As Object)
objFileObject.SetValue(column) = objValue
End Sub
Public Sub Reset(ByRef objVariable As Object, objValue As Object)
Select Case objVariable.GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER"
objVariable.Value = CStr(objValue)
Case "CORE.WINDOWS.COREVARCHAR"
objVariable.Value = CStr(objValue)
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL"
objVariable.Value = CDec(objValue)
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
objVariable.Value = CInt(objValue)
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
objVariable.Value = CDec(objValue)
End Select
End Sub
Public Sub Reset(ByRef objFileObject As SqlFileObject, column As String, blnAt As Boolean)
If blnAt Then
Reset(objFileObject, column)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreCharacter, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreVarChar, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDecimal, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreInteger, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDate, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objFileObject As SqlFileObject, column As String, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objFileObject, column, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreCharacter, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreVarChar, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDecimal, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreInteger, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDate, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As Object, objValue As Object, blnAt As Boolean)
If blnAt Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreCharacter, objValue As Object, blnAt As Boolean,
blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreVarChar, objValue As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDecimal, objValue As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreInteger, objValue As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As CoreDate, objValue As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub Reset(ByRef objVariable As Object, objValue As Object, blnAt As Boolean, blnCondition As Boolean)
If blnAt AndAlso blnCondition Then
Reset(objVariable, objValue)
End If
End Sub
Public Sub NoReset(ByRef objFileObject As SqlFileObject, strColumn As String)
End Sub
Public Function At(objDefine As DDecimal) As Boolean
Dim CurrentValue As String = objDefine.Value
Dim blnReturn As Boolean = False
If intSortCount = intSorted Then
Return True
End If
m_blnIsAt = True
If CurrentValue <> objDefine.Value Then
blnReturn = True
End If
m_blnIsAt = False
Return blnReturn
End Function
Public Function At(objDefine As DCharacter) As Boolean
Dim CurrentValue As String = objDefine.Value
Dim blnReturn As Boolean = False
If intSortCount = intSorted Then
Return True
End If
m_blnIsAt = True
If CurrentValue <> objDefine.Value Then
blnReturn = True
End If
m_blnIsAt = False
Return blnReturn
End Function
Public Function At(objDefine As DInteger) As Boolean
Dim CurrentValue As String = objDefine.Value
Dim blnReturn As Boolean = False
If intSortCount = intSorted Then
Return True
End If
m_blnIsAt = True
If CurrentValue <> objDefine.Value Then
blnReturn = True
End If
m_blnIsAt = False
Return blnReturn
End Function
''' --- Dispose ------------------------------------------------------------
''' <summary>
''' Performs clean up of objects who have completed their function.
''' </summary>
''' <remarks>
''' <para>
''' This function is overridable so that the developer has the option
''' of coding their own procedure to suite the needs of the specific screen
''' they are working on. By doing so, the screens functionality is tied to the
''' Renaissance Architect Framework.
''' </para>
''' <para>
''' <note>This MUST be overridden in the GHOST screen.</note>
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Overridable Sub Dispose()
' NOTE: This MUST be overridden in the GHOST screen.
Try
CloseTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
hsAverage = Nothing
hsMaximum = Nothing
hsMinimum = Nothing
If Not IsNothing(dtSortOrder) Then
dtSortOrder.Dispose()
dtSortOrder = Nothing
End If
If Not IsNothing(dtSorted) Then
dtSorted.Dispose()
dtSorted = Nothing
End If
MyBase.Dispose()
GC.Collect()
End Sub
''' --- CloseTransactionObjects --------------------------------------------
''' <summary>
''' Closes all file objects and transaction/connection objects on the page.
''' </summary>
''' <remarks>
''' The CloseTransactionObjects method closes the file objects through the
''' call to CloseFiles and closes the transaction/connection objects.
''' <br /><br />
''' NOTE: This method will be overriden in the derived screen and is generated
''' by the Renaissance Architect Precompiler.
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub CloseTransactionObjects()
End Sub
''' --- CloseFiles ---------------------------------------------------------
''' <summary>
''' Closes all file objects on the page.
''' </summary>
''' <remarks>
''' The CloseFiles method closes disposes of the file objects.
''' <br /><br />
''' NOTE: This method will be overriden in the derived screen and is generated
''' by the Renaissance Architect Precompiler.
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub CloseFiles()
End Sub
''' --- InitializeFiles ----------------------------------------------------
''' <summary>
''' Assigns the transaction objects to the specified files.
''' </summary>
''' <remarks>
''' The InitializeFiles method is used to assign the transaction objects
''' (both the declared transactions and the default transactions) to the appropriate
''' File objects.
''' <br /><br />
''' NOTE: This method will be overriden in the derived screen and is generated
''' by the Renaissance Architect PreCompiler.
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub InitializeFiles()
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub CallInitializeInternalValues()
RaiseEvent InitializeInternalValues()
End Sub
''' --- InitializeVariables ------------------------------------------------
''' <summary>
''' Performs processing when the screen is initiated.
''' </summary>
''' <remarks>
''' Used to initialize variables.
''' <para>
''' This function is overridable so that the developer has the option
''' of coding their own procedure to suite the needs of the specific screen
''' they are working on. By doing so, the screens functionality is tied to the
''' Renaissance Architect Framework.
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub InitializeVariables()
End Sub
''' --- InitializeTransactionObjects ---------------------------------------
''' <summary>
''' Opens the connections and creates the transactions.
''' </summary>
''' <remarks>
''' The InitializeTransactionObjects method opens the connections and transactions
''' that are required by the default transactions as well as the declared transactions.
''' <br /><br />
''' NOTE: This method will be overriden in the derived screen and is generated
''' by the Renaissance Architect PreCompiler.
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub InitializeTransactionObjects()
End Sub
''' --- TRANS_UPDATE -------------------------------------------------------
'''
''' '''
''' <summary>
''' Default TRANS_UPDATE procedure.
''' </summary>
''' <param name="Method"></param>
''' <remarks>
''' <para>
''' This function is overridable so that the developer has the option
''' of coding their own procedure to suite the needs of the specific screen
''' they are working on. By doing so, the screens functionality is tied to the
''' Renaissance Architect Framework.
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Overridable Sub TRANS_UPDATE(Method As TransactionMethods)
End Sub
''' --- GetFieldText ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetFieldText.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetFieldText() As String
Return FieldText
End Function
''' --- GetFieldValue ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetFieldValue.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetFieldValue() As Decimal
Return FieldValue
End Function
''' --- GetRunScreenName ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetRunScreenName.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetRunScreenName() As String
Return m_strRunScreen
End Function
''' --- RegisterStateFlag --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RegisterStateFlag.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function RegisterStateFlag()
Session(UniqueSessionID + m_strPageId + "_IsMainState") = "True"
Return Nothing
End Function
''' --- IsStateAvailable ---------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of IsStateAvailable.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function IsStateAvailable() As Boolean
Return CBool(Session(UniqueSessionID + m_strPageId + "_IsMainState"))
Return Nothing
End Function
''' --- GetDictionaryItem --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetDictionaryItem.
''' </summary>
''' <param name="FieldId"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overloads Function GetDictionaryItem(FieldId As String) As CoreDictionaryItem
Return GetDictionaryItem(Session(UniqueSessionID + "Language"), FieldId)
End Function
''' --- RaiseSavePageState -------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RaiseSavePageState.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RaiseSavePageState()
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
RaiseEvent SavePageState(Me, New PageStateEventArgs("_", ObjectState.OnlyCoreBaseTypes))
Else
RaiseEvent SavePageState(Me, New PageStateEventArgs("_"))
End If
'Register a flag that can notify subsequent post back that, State exists
RegisterStateFlag()
End Sub
''' --- RaiseLoadPageState -------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RaiseLoadPageState.
''' </summary>
''' <param name="IncludeObjectState"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Sub RaiseLoadPageState(IncludeObjectState As ObjectState)
'Note: We are retrieving state only if we have persisted it
' We added this code to handle Run Screen from Initialize and similar methods
If Me.IsStateAvailable() Then
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
RaiseEvent LoadPageState(Me, New PageStateEventArgs("_", ObjectState.OnlyCoreBaseTypes), False)
Else
RaiseEvent LoadPageState(Me, New PageStateEventArgs("_", IncludeObjectState), False)
End If
End If
End Sub
''' --- CallRunDesigner ----------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CallRunDesigner.
''' </summary>
''' <param name="Designer"></param>
''' <param name="PageMode"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overrides Function CallRunDesigner(Designer As String, PageMode As PageModeTypes,
Optional ByVal blnExit As Boolean = False) As Boolean
Dim blnReturnValue As Boolean
Try
RetrieveFlags()
Me.Mode = PageMode
m_strGenericRetrievalCharacter = Application(cGenericRetrievalCharacter) & ""
If Not Application(cDefaultCentury) Is Nothing Then
m_intDefaultCentury = Application(cDefaultCentury)
' If we have a 2 digit century, multiply by 100 to give us
' the century that we add to the year entered. (ie. 19 becomes 1900)
If m_intDefaultCentury.ToString.Length = 2 Then
m_intDefaultCentury *= 100
End If
End If
If Not Application(cInputCenturyFrom) Is Nothing Then
m_intDefaultInputCentury = Application(cInputCenturyFrom).ToString.Split(",")(0)
m_intInputFromYear = Application(cInputCenturyFrom).ToString.Split(",")(1)
' If we have a 2 digit century, multiply by 100 to give us
' the century that we add to the year entered. (ie. 19 becomes 1900)
If m_intDefaultInputCentury.ToString.Length = 2 Then
m_intDefaultInputCentury *= 100
End If
End If
'If Menu has not turned off DB connections, initilaize the values
If NoDBConnect = False Then
Try
InitializeTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
Try
InitializeFiles()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
End If
RetrieveParamsReceived()
RetrieveInitalizeParamsReceived()
If Not ScreenSession(UniqueSessionID + "Initialize") Then
RaiseEvent InitializeInternalValues()
blnIsInInitialize = True
Initialize()
ScreenSession(UniqueSessionID + "Initialize") = True
Else
RaiseLoadPageState(ObjectState.FileObjectsAndCoreBaseTypes)
End If
SaveInitalizeParamsReceived()
If blnIsInInitialize Then
m_intRunScreenSequence = 0
m_strRunFlag = ""
RemoveFlags()
End If
blnIsInInitialize = False
If PageMode = PageModeTypes.Find Then
CallFind()
End If
blnReturnValue = RunDesigner(Designer, PageMode)
SaveParamsReceived()
RaiseSavePageState()
Try
CloseTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
If blnExit Then
RemoveFlags()
End If
Return blnReturnValue
Catch ex As CustomApplicationException
Me.RaiseSavePageState()
Throw ex
End Try
End Function
''' --- RetrieveFlags ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RetrieveFlags.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RetrieveFlags()
RetrieveFlagInformation(m_strCountIntoCalled, "COUNT_INTO")
RetrieveFlagInformation(m_strRunFlag, "RUN_FLAG")
RetrieveFlagInformation(m_strPutFlag, "PUT_FLAG")
RetrieveFlagInformation(m_strExternalFlag, "EXTERNAL_FLAG")
RetrieveFlagInformation(m_htFileInfo, "ROWIDCHECKSUM")
End Sub
''' --- RetrieveFlagInformation --------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RetrieveFlagInformation.
''' </summary>
''' <param name="Flag"></param>
''' <param name="FlagName"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub RetrieveFlagInformation(ByRef Flag As Hashtable, FlagName As String)
Flag = Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + FlagName)
If Flag Is Nothing Then Flag = New Hashtable
End Sub
''' --- RetrieveFlagInformation --------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RetrieveFlagInformation.
''' </summary>
''' <param name="Flag"></param>
''' <param name="FlagName"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub RetrieveFlagInformation(ByRef Flag As String, FlagName As String)
If FlagName = "PUT_FLAG" Then
Flag = Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + FlagName)
Else
Flag = Session(UniqueSessionID + m_Node + "_" + FormName + "_" + Level.ToString + "_" + FlagName)
End If
If Flag = Nothing Then Flag = ""
End Sub
''' --- RemoveFlags --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RemoveFlags.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RemoveFlags()
RemoveFlags(False)
End Sub
''' --- RemoveFlags --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RemoveFlags.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RemoveFlags(SaveState As Boolean)
RemoveFlagInformation("COUNT_INTO")
RemoveFlagInformation("RUN_FLAG")
RemoveFlagInformation("PUT_FLAG")
RemoveFlagInformation("EXTERNAL_FLAG")
RemoveFlagInformation("ROWIDCHECKSUM")
m_intPutSequence = 0
If SaveState Then
Me.RaiseSavePageState()
End If
End Sub
''' --- RemoveFlagInformation ----------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RemoveFlagInformation.
''' </summary>
''' <param name="FlagName"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub RemoveFlagInformation(FlagName As String)
If FlagName = "PUT_FLAG" Or FlagName = "ROWIDCHECKSUM" Then
Session.Remove(UniqueSessionID + FormName + "_" + Level.ToString + "_" + FlagName)
Else
Session.Remove(UniqueSessionID + m_Node + "_" + FormName + "_" + Level.ToString + "_" + FlagName)
End If
End Sub
''' --- SetMethodExecutedFlag ----------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SetMethodExecutedFlag.
''' </summary>
''' <param name="Flag"></param>
''' <param name="FlagName"></param>
''' <param name="Sequence"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub SetMethodExecutedFlag(ByRef Flag As String, FlagName As String, Sequence As Integer,
RunScreenName As String)
Flag = Flag.Substring(0, Sequence - 1) + "Y"
Session(UniqueSessionID + m_Node + "_" + RunScreenName + "_" + Level.ToString + "_" + FlagName) = Flag
End Sub
''' --- SetMethodExecutedFlag ----------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SetMethodExecutedFlag.
''' </summary>
''' <param name="Flag"></param>
''' <param name="FlagName"></param>
''' <param name="Sequence"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub SetMethodExecutedFlag(ByRef Flag As String, FlagName As String, Sequence As Integer)
Flag = Flag.Substring(0, Sequence - 1) + "Y"
If FlagName = "PUT_FLAG" Then
Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + FlagName) = Flag
Else
Session(UniqueSessionID + m_Node + "_" + FormName + "_" + Level.ToString + "_" + FlagName) = Flag
End If
End Sub
''' --- RemoveMethodExecutedFlag -------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RemoveMethodExecutedFlag.
''' </summary>
''' <param name="Flag"></param>
''' <param name="FlagName"></param>
''' <param name="Sequence"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub RemoveMethodExecutedFlag(ByRef Flag As String, FlagName As String, Sequence As Integer,
RunScreenName As String)
Flag = Flag.Substring(0, Sequence - 1) + " "
Session(UniqueSessionID + m_Node + "_" + RunScreenName + "_" + Level.ToString + "_" + FlagName) = Flag
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub UpdateCommand()
' Call the PreUpdate procedure.
PreUpdate()
' Call the Update procedure.
Update()
' Commit the default transaction (TRANS_UPDATE).
TRANS_UPDATE(TransactionMethods.Commit)
' Call the PostUpdate procedure.
PostUpdate()
'Save The Recieving list after the Update
SaveParamsReceived()
' Commit the default transaction (TRANS_UPDATE).
TRANS_UPDATE(TransactionMethods.Commit)
End Sub
''' --- CallInitialize -----------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CallInitialize.
''' </summary>
''' <param name="Mode"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overloads Overrides Function CallInitialize(Mode As PageModeTypes) As Boolean
Dim blnReturnValue As Boolean
Try
Me.Mode = Mode
Try
InitializeTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
Try
InitializeFiles()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
RetrieveParamsReceived()
RaiseEvent InitializeInternalValues()
Try
' this has to be added becuase the for was not executing if the mode was entry
m_blnInFindOrDetailFind = True
m_blnInInitialize = True
RetrieveFlags()
blnReturnValue = Initialize()
m_blnInInitialize = False
If Mode = PageModeTypes.Find Then
CallFind()
ElseIf Mode = PageModeTypes.Entry Then
CallEntry()
If AutoUpdate Then
CallUpdate()
End If
End If
If m_strPush.Length > 0 Then
If Me.Mode = PageModeTypes.Find Then Me.Mode = PageModeTypes.Change
If Me.Mode = PageModeTypes.Entry Then Me.Mode = PageModeTypes.Correct
Dim arrPush() As String = m_strPush.Split(",")
m_strPush = ""
For i As Integer = 0 To arrPush.Length - 1
Select Case arrPush(i)
Case "Update"
CallUpdate()
Case "Entry"
CallEntry()
Case "Find"
CallFind()
Case "Return"
Case Else
Try
Try
CallByName(Me, arrPush(i) + "_PreCommands", CallType.Method, Nothing,
Nothing)
Catch ex As Exception
End Try
CallByName(Me, arrPush(i), CallType.Method)
Try
CallByName(Me, arrPush(i) + "_PostCommands", CallType.Method, Nothing,
Nothing)
Catch ex As Exception
End Try
Catch ex As Exception
Try
Try
CallByName(Me, arrPush(i) + "_PreCommands", CallType.Method, Nothing,
Nothing)
Catch
End Try
CallByName(Me, arrPush(i) + "_Click", CallType.Method, Nothing, Nothing)
Try
CallByName(Me, arrPush(i) + "_PostCommands", CallType.Method, Nothing,
Nothing)
Catch
End Try
Catch
End Try
End Try
End Select
For j As Integer = i + 1 To arrPush.Length - 1
If m_strPush.Length > 0 Then m_strPush = m_strPush + ","
m_strPush = m_strPush + arrPush(j)
Next
If m_strPush.IndexOf(",Return") > 0 Then
m_strPush = m_strPush.Replace("Find", "").Replace("Entry", "")
If m_strPush.IndexOf(",") = 0 Then m_strPush = m_strPush.Substring(1)
Do While m_strPush.IndexOf(",,") >= 0
m_strPush.Replace(",,", ",")
Loop
End If
If m_strPush.Trim = "" Then Exit For
i = -1
arrPush = m_strPush.Split(",")
m_strPush = ""
Next
SaveParamsReceived()
End If
Catch ex As CustomApplicationException
If ex.Message <> cReturn.ToString Then
If ex.Message = cRunScreenException.ToString AndAlso Me.ScreenType = ScreenTypes.Ghost Then
If RunScreenFolderLength = 0 Then
GlobalSession(UniqueSessionID + "RunScreenName") = m_strRunScreenFolder & "/" &
m_strRunScreen
Else
GlobalSession(UniqueSessionID + "RunScreenName") = m_strRunScreen
End If
Else
m_blnInFindOrDetailFind = False
' Check if we need to pass back any messages.
Cleanup()
End If
Throw ex
End If
Catch ex As Exception
m_blnInFindOrDetailFind = False
Cleanup(False)
' Check if we need to pass back any messages.
AddMessage(ex.Message, MessageTypes.Error)
Throw ex
End Try
m_blnInFindOrDetailFind = False
Cleanup()
Return blnReturnValue
Catch ex As Exception
If ex.Message = cRunScreenException.ToString Then
QDesign.ThrowCustomApplicationException(cMenuRunScreenException)
End If
Throw ex
End Try
End Function
''' --- CallExit -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of CallExit.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overloads Overrides Function CallExit() As Boolean
Dim blnReturnValue As Boolean
Try
InitializeTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
Try
InitializeFiles()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
RetrieveParamsReceived()
RaiseEvent InitializeInternalValues()
Try
blnReturnValue = [Exit]()
Catch ex As CustomApplicationException
If ex.Message <> cReturn.ToString Then
Cleanup()
Throw ex
End If
Catch ex As Exception
Cleanup(False)
Throw ex
End Try
Cleanup()
Return blnReturnValue
End Function
''' --- Cleanup ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Cleanup.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function Cleanup()
Cleanup(True)
Return Nothing
End Function
''' --- Cleanup ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Cleanup.
''' </summary>
''' <param name="SaveState"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function Cleanup(SaveState As Boolean)
RemoveFlags(SaveState)
If SaveState Then
RaiseSavePageState()
End If
Try
CloseTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
Return Nothing
End Function
'----------------------------
' InternalPageState property can be used to persist the value of the
' Temporary and File Objects
' Note: We have declared this property as "Friend" to limit the usage of this property
' within CORE.WINDOWS.UI and In case in future, if we ever decide to change the medium of
' persistance we can change this method
'
' To reliably meet above requirement, InternalPageState should never be used to store
' value other than the Temporary and File Objects
'----------------------------
''' --- InternalPageState --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of InternalPageState.
''' </summary>
''' <param name="ObjectStateKey"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Property InternalPageState(ObjectStateKey As String) As Object
Get
Dim objValueFromState As Object
ObjectStateKey = m_strPageId + ObjectStateKey
Select Case ObjectStateMedium
Case StateMedium.SessionOnServer
objValueFromState = Session(UniqueSessionID + ObjectStateKey)
If _
(Not objValueFromState Is Nothing) AndAlso
objValueFromState.GetType.ToString = "System.String[]" Then
objValueFromState = CType(objValueFromState, Array).Clone
End If
Return objValueFromState
Case StateMedium.DatabaseOnServer
'TODO: m_hstInternalStateInfo Needs to be saved in Database
Return m_hstInternalStateInfo(ObjectStateKey)
Case StateMedium.DiskOnServer
'Needs an implementation
End Select
Return Nothing
End Get
Set(Value As Object)
ObjectStateKey = m_strPageId + ObjectStateKey
Select Case ObjectStateMedium
Case StateMedium.SessionOnServer
Session(UniqueSessionID + ObjectStateKey) = Value
Case StateMedium.DatabaseOnServer
'TODO: m_hstInternalStateInfo Needs to be saved in Database
m_hstInternalStateInfo(ObjectStateKey) = Value
Case StateMedium.DiskOnServer
'Needs an implementation
End Select
End Set
End Property
''' --- ProcessLocation ----------------------------------------------------
''' <summary>
''' Returns the ProcessLocation parameter defined in the Global.asax file.
''' </summary>
''' <returns>Returns a string representing the ProcessLocation value.</returns>
''' <remarks>
''' Use the ProcessLocation method to return the value for ProcessLocation
''' as specified in the web application's Global.asax file.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function ProcessLocation() As String
Dim strProcessLocation As String
If Application(cProcessLocation) Is Nothing Then
strProcessLocation = String.Empty
Else
strProcessLocation = Application(cProcessLocation)
End If
Return strProcessLocation
End Function
''' --- SysName ------------------------------------------------------------
''' <summary>
''' The dictionary title as specified in the Global.asax file.
''' </summary>
''' <returns>Returns a string representing the dictionary title.</returns>
''' <remarks>
''' Use the SysName method to return the dictionary title as specified in
''' the web application's Global.asax file.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function SysName() As String
Return (Application(cTitle).ToString + "").PadRight(40)
End Function
''' --- SetRunScreenMemberVariables -------------------------------------------------------
''' <exclude />
''' <summary>
''' Sets the m_strRunScreenFolder value and returns the name of the run screen.
''' </summary>
''' <param name="RunScreenName">The screen to run.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub SetRunScreenMemberVariables(ByRef RunScreenName As String)
' Remove/create the folder name for the runscreen.
If RunScreenName.IndexOf("/") > -1 Then
Dim intLastIndex As Integer = RunScreenName.LastIndexOf("/")
m_strRunScreenFolder = RunScreenName.Substring(0, intLastIndex)
If m_strRunScreenFolder.Substring(0, 1) = "/" Then _
m_strRunScreenFolder = m_strRunScreenFolder.Substring(1)
RunScreenName = RunScreenName.Substring(intLastIndex + 1)
Else
m_strRunScreenFolder = RunScreenName.Substring(0, Me.RunScreenFolderLength)
End If
End Sub
''' -----------------------------------------------------------------------------
''' <exclude />
''' <summary>
''' RunScreenFolderLength is used identify the folder of the Run Screen based on Run Screen Name
''' RunScreenFolderLength can be defined in "appSettings" section of web.Config
''' RunScreenFolderLength defined in web.config can be overrided in the page by assigning it in Init evenhandler of the
''' Derived Page.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [mayur] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub SetRunScreenFolderLength()
If m_intRunScreenFolderLength = -1 Then
If m_strRunScreenFolderLength Is Nothing Then
m_strRunScreenFolderLength = ConfigurationManager.AppSettings("RunScreenFolderLength")
If m_strRunScreenFolderLength Is Nothing Then
'RunScreenFolderLength is not defined in appSettings section of web.config
m_strRunScreenFolderLength = "2" 'Set the default RunScreenFolderLength to 2
End If
End If
m_intRunScreenFolderLength = CShort(m_strRunScreenFolderLength)
End If
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' RunScreenFolderLength is used identify the folder of the Run Screen based on Run Screen Name
''' RunScreenFolderLength can be defined in "appSettings" section of web.Config
''' RunScreenFolderLength defined in web.config can be overrided in the page by assigning it in Init evenhandler of the
''' Derived Page.
''' </summary>
''' <value></value>
''' <remarks>
''' </remarks>
''' <history>
''' [mayur] 05/04/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<Browsable(False), DefaultValue(2),
EditorBrowsable(EditorBrowsableState.Always)>
Public Property RunScreenFolderLength As Short
Get
Return m_intRunScreenFolderLength
End Get
Set(Value As Short)
m_intRunScreenFolderLength = Value
End Set
End Property
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(objRunScreen As BaseClassControl, RunScreenMode As RunScreenModes)
Dim arrRunscreen() As Object = Nothing
RunScreen(objRunScreen, RunScreenMode, arrRunscreen)
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(RunScreen As BaseClassControl, RunScreenMode As RunScreenModes, ByRef arrParm() As Object)
Dim blnMethodWasExecuted As Boolean
m_intRunScreenSequence += 1
blnMethodWasExecuted = MethodWasExecuted(m_strRunFlag, m_intRunScreenSequence, "RUN_FLAG")
If Not blnMethodWasExecuted Then
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence)
' Save the sequence information and set a flag indicating screen was run.
'TODO: At present we are not saving sequence
' Need to revisit for Run/Ghost Screen called from the specified Method on a specified Class
'SetScreenWasRunFlag(m_intRunScreenSequence)
' Save the parameters passed to the RUN SCREEN.
If Not IsNothing(arrParm) AndAlso arrParm.Length > 0 Then
For i As Integer = 0 To arrParm.Length - 1
If Not (arrParm(i) Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM" + (i + 1).ToString) =
GetParmValue(arrParm(i))
End If
Next
End If
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString) = Session.Count
'Commented from original Base Page
' Default: E for subscreen invoked during the standard entry procedure, otherwise NULL.
If RunScreenMode = RunScreenModes.NoneSelected Then
'If Me.Mode = PageModeTypes.Entry Then
' RunScreenMode = RunScreenModes.Entry
'End If
End If
If RunScreenMode = RunScreenModes.Same Then
' TODO: Test this scenario once we change the FIND and ENTRY mode code.
'RunScreenMode = Mode
End If
m_strRunScreen = RunScreen.Name
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_Mode") = RunScreenMode
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence
Session(UniqueSessionID + "ScreenLevel") = Me.Level + 1
'Treating RunScreen as the Ghost Screen, which is used in ReturnAndClose for not throwing an exception
RunScreen.ScreenType = ScreenTypes.Ghost
Try
RunScreen.CallInitialize(RunScreenMode)
Catch ex As CustomApplicationException
If ex.Message <> cReturn.ToString Then
Throw ex
End If
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
End Try
blnMethodWasExecuted = True
End If
If blnMethodWasExecuted Then
' Reset the m_strRunScreen variable.
m_strRunScreen = ""
' Decrement the ScreenLevel.
Session(UniqueSessionID + "ScreenLevel") = Me.Level
' Remove the Mode and ScreenSequence session information for the screen called.
If _
Not _
IsNothing(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence")) AndAlso
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence Then
Session.Remove(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_Mode")
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence")
End If
' Retrieve the parameters back from Session.
If Not IsNothing(arrParm) AndAlso arrParm.Length > 0 Then
For i As Integer = 0 To arrParm.Length - 1
If Not (arrParm(i) Is Nothing) Then
SetParmValue(arrParm(i),
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM" + (i + 1).ToString),
False)
End If
Next
End If
If Not blnIsInInitialize Then
' Delete the sessions that were created for this run screen.
If Session(UniqueSessionID + "Prev") = True Then
DeleteSessions(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
Session(UniqueSessionID + "Prev") = True
Else
DeleteSessions(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
End If
End If
End If
End Sub
''' --- RunScreen ----------------------------------------------------------
''' <summary>
''' Summary of RunScreen.
''' </summary>
''' <param name="RunScreenName"></param>
''' <param name="RunScreenMode"></param>
''' <param name="Parm1"></param>
''' <param name="Parm2"></param>
''' <param name="Parm3"></param>
''' <param name="Parm4"></param>
''' <param name="Parm5"></param>
''' <param name="Parm6"></param>
''' <param name="Parm7"></param>
''' <param name="Parm8"></param>
''' <param name="Parm9"></param>
''' <param name="Parm10"></param>
''' <param name="Parm11"></param>
''' <param name="Parm12"></param>
''' <param name="Parm13"></param>
''' <param name="Parm14"></param>
''' <param name="Parm15"></param>
''' <param name="Parm16"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(RunScreenName As String)
Dim arrRunscreen() As Object = Nothing
RunScreen(RunScreenName, RunScreenModes.Null, arrRunscreen)
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(RunScreenName As String, RunScreenMode As RunScreenModes)
Dim arrRunscreen() As Object = Nothing
RunScreen(RunScreenName, RunScreenMode, arrRunscreen)
End Sub
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(RunScreenName As String, RunScreenMode As RunScreenModes, ByRef arrParm() As Object)
Session(UniqueSessionID + "URL") = RunScreenName
SetRunScreenMemberVariables(RunScreenName)
m_intRunScreenSequence += 1
Dim blnMethodWasExecuted As Boolean
If blnIsInInitialize Then
blnMethodWasExecuted = MethodWasExecuted(m_intRunScreenSequence, RunScreenName, "RUN_FLAG")
Else
blnMethodWasExecuted = MethodWasExecuted(m_strRunFlag, m_intRunScreenSequence, "RUN_FLAG")
End If
If Not blnMethodWasExecuted Then
If blnIsInInitialize Then
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence, RunScreenName)
Else
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence)
End If
' Save the sequence information and set a flag indicating screen was run.
'TODO: At present we are not saving sequence
' Need to revisit for Run/Ghost Screen called from the specified Method on a specified Class
'SetScreenWasRunFlag(m_intRunScreenSequence)
' Save the parameters passed to the RUN SCREEN.
If Not IsNothing(arrParm) AndAlso arrParm.Length > 0 Then
For i As Integer = 0 To arrParm.Length - 1
If Not (arrParm(i) Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM" + (i + 1).ToString) =
GetParmValue(arrParm(i))
End If
Next
End If
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString) = Session.Count
'Commented from original Base Page
' Default: E for subscreen invoked during the standard entry procedure, otherwise NULL.
If RunScreenMode = RunScreenModes.NoneSelected Then
'If Me.Mode = PageModeTypes.Entry Then
' RunScreenMode = RunScreenModes.Entry
'End If
End If
If RunScreenMode = RunScreenModes.Same Then
' TODO: Test this scenario once we change the FIND and ENTRY mode code.
'RunScreenMode = Mode
End If
m_strRunScreen = RunScreenName
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_Mode") = RunScreenMode
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence
Session(UniqueSessionID + "ScreenLevel") = Me.Level + 1
If blnIsInInitialize Then
QDesign.ThrowCustomApplicationException(cMenuRunScreenException)
Else
QDesign.ThrowCustomApplicationException(cRunScreenException)
End If
Else
' Reset the m_strRunScreen variable.
m_strRunScreen = ""
' Decrement the ScreenLevel.
Session(UniqueSessionID + "ScreenLevel") = Me.Level
Session.Remove(UniqueSessionID + "URL")
' Remove the Mode and ScreenSequence session information for the screen called.
If _
Not _
IsNothing(
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence")) AndAlso
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence Then
Session.Remove(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_Mode")
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence")
End If
' Retrieve the parameters back from Session.
If Not IsNothing(arrParm) AndAlso arrParm.Length > 0 Then
For i As Integer = 0 To arrParm.Length - 1
If Not (arrParm(i) Is Nothing) Then
SetParmValue(arrParm(i),
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM" + (i + 1).ToString),
False)
End If
Next
End If
If Not blnIsInInitialize Then
' Delete the sessions that were created for this run screen.
If Session(UniqueSessionID + "Prev") = True Then
DeleteSessions(
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
Session(UniqueSessionID + "Prev") = True
Else
DeleteSessions(
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
End If
End If
If blnIsInInitialize AndAlso m_intRunScreenSequence > 0 Then
m_intRunScreenSequence -= 1
End If
End If
End Sub
''' --- RunScreen ----------------------------------------------------------
''' <summary>
''' Summary of RunScreen.
''' </summary>
''' <param name="RunScreenName"></param>
''' <param name="RunScreenMode"></param>
''' <param name="Parm1"></param>
''' <param name="Parm2"></param>
''' <param name="Parm3"></param>
''' <param name="Parm4"></param>
''' <param name="Parm5"></param>
''' <param name="Parm6"></param>
''' <param name="Parm7"></param>
''' <param name="Parm8"></param>
''' <param name="Parm9"></param>
''' <param name="Parm10"></param>
''' <param name="Parm11"></param>
''' <param name="Parm12"></param>
''' <param name="Parm13"></param>
''' <param name="Parm14"></param>
''' <param name="Parm15"></param>
''' <param name="Parm16"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(ByRef RunScreen As BaseClassControl, RunScreenMode As RunScreenModes, ByRef Parm1 As Object _
, Optional ByRef Parm2 As Object = Nothing, Optional ByRef Parm3 As Object = Nothing,
Optional ByRef Parm4 As Object = Nothing _
, Optional ByRef Parm5 As Object = Nothing, Optional ByRef Parm6 As Object = Nothing,
Optional ByRef Parm7 As Object = Nothing _
, Optional ByRef Parm8 As Object = Nothing, Optional ByRef Parm9 As Object = Nothing,
Optional ByRef Parm10 As Object = Nothing _
, Optional ByRef Parm11 As Object = Nothing, Optional ByRef Parm12 As Object = Nothing,
Optional ByRef Parm13 As Object = Nothing _
, Optional ByRef Parm14 As Object = Nothing, Optional ByRef Parm15 As Object = Nothing,
Optional ByRef Parm16 As Object = Nothing _
, Optional ByRef Parm17 As Object = Nothing, Optional ByRef Parm18 As Object = Nothing,
Optional ByRef Parm19 As Object = Nothing _
, Optional ByRef Parm20 As Object = Nothing, Optional ByRef Parm21 As Object = Nothing)
Dim blnMethodWasExecuted As Boolean
m_intRunScreenSequence += 1
blnMethodWasExecuted = MethodWasExecuted(m_strRunFlag, m_intRunScreenSequence, "RUN_FLAG")
If Not blnMethodWasExecuted Then
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence)
' Save the sequence information and set a flag indicating screen was run.
'TODO: At present we are not saving sequence
' Need to revisit for Run/Ghost Screen called from the specified Method on a specified Class
'SetScreenWasRunFlag(m_intRunScreenSequence)
' Save the parameters passed to the RUN SCREEN.
If Not (Parm1 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM1") = GetParmValue(Parm1)
End If
If Not (Parm2 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM2") = GetParmValue(Parm2)
End If
If Not (Parm3 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM3") = GetParmValue(Parm3)
End If
If Not (Parm4 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM4") = GetParmValue(Parm4)
End If
If Not (Parm5 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM5") = GetParmValue(Parm5)
End If
If Not (Parm6 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM6") = GetParmValue(Parm6)
End If
If Not (Parm7 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM7") = GetParmValue(Parm7)
End If
If Not (Parm8 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM8") = GetParmValue(Parm8)
End If
If Not (Parm9 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM9") = GetParmValue(Parm9)
End If
If Not (Parm10 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM10") = GetParmValue(Parm10)
End If
If Not (Parm11 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM11") = GetParmValue(Parm11)
End If
If Not (Parm12 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM12") = GetParmValue(Parm12)
End If
If Not (Parm13 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM13") = GetParmValue(Parm13)
End If
If Not (Parm14 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM14") = GetParmValue(Parm14)
End If
If Not (Parm15 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM15") = GetParmValue(Parm15)
End If
If Not (Parm16 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM16") = GetParmValue(Parm16)
End If
If Not (Parm17 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM17") = GetParmValue(Parm17)
End If
If Not (Parm18 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM18") = GetParmValue(Parm18)
End If
If Not (Parm19 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM19") = GetParmValue(Parm19)
End If
If Not (Parm20 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM20") = GetParmValue(Parm20)
End If
If Not (Parm21 Is Nothing) Then
Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM21") = GetParmValue(Parm21)
End If
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString) = Session.Count
'Commented from original Base Page
' Default: E for subscreen invoked during the standard entry procedure, otherwise NULL.
If RunScreenMode = RunScreenModes.NoneSelected Then
'If Me.Mode = PageModeTypes.Entry Then
' RunScreenMode = RunScreenModes.Entry
'End If
End If
If RunScreenMode = RunScreenModes.Same Then
' TODO: Test this scenario once we change the FIND and ENTRY mode code.
'RunScreenMode = Mode
End If
m_strRunScreen = RunScreen.Name
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_Mode") = RunScreenMode
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence
Session(UniqueSessionID + "ScreenLevel") = Me.Level + 1
'Treating RunScreen as the Ghost Screen, which is used in ReturnAndClose for not throwing an exception
RunScreen.ScreenType = ScreenTypes.Ghost
Try
RunScreen.CallInitialize(RunScreenMode)
Catch ex As CustomApplicationException
If ex.Message <> cReturn.ToString Then
Throw ex
End If
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
End Try
blnMethodWasExecuted = True
End If
If blnMethodWasExecuted Then
' Reset the m_strRunScreen variable.
m_strRunScreen = ""
' Decrement the ScreenLevel.
Session(UniqueSessionID + "ScreenLevel") = Me.Level
' Remove the Mode and ScreenSequence session information for the screen called.
If _
Not _
IsNothing(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence")) AndAlso
Session(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence Then
Session.Remove(UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_Mode")
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_ScreenSequence")
End If
' Retrieve the parameters back from Session.
If Not (Parm1 Is Nothing) Then
SetParmValue(Parm1, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM1"), False)
End If
If Not (Parm2 Is Nothing) Then
SetParmValue(Parm2, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM2"), False)
End If
If Not (Parm3 Is Nothing) Then
SetParmValue(Parm3, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM3"), False)
End If
If Not (Parm4 Is Nothing) Then
SetParmValue(Parm4, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM4"), False)
End If
If Not (Parm5 Is Nothing) Then
SetParmValue(Parm5, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM5"), False)
End If
If Not (Parm6 Is Nothing) Then
SetParmValue(Parm6, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM6"), False)
End If
If Not (Parm7 Is Nothing) Then
SetParmValue(Parm7, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM7"), False)
End If
If Not (Parm8 Is Nothing) Then
SetParmValue(Parm8, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM8"), False)
End If
If Not (Parm9 Is Nothing) Then
SetParmValue(Parm9, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM9"), False)
End If
If Not (Parm10 Is Nothing) Then
SetParmValue(Parm10, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM10"), False)
End If
If Not (Parm11 Is Nothing) Then
SetParmValue(Parm11, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM11"), False)
End If
If Not (Parm12 Is Nothing) Then
SetParmValue(Parm12, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM12"), False)
End If
If Not (Parm13 Is Nothing) Then
SetParmValue(Parm13, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM13"), False)
End If
If Not (Parm14 Is Nothing) Then
SetParmValue(Parm14, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM14"), False)
End If
If Not (Parm15 Is Nothing) Then
SetParmValue(Parm15, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM15"), False)
End If
If Not (Parm16 Is Nothing) Then
SetParmValue(Parm16, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM16"), False)
End If
If Not (Parm17 Is Nothing) Then
SetParmValue(Parm17, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM17"), False)
End If
If Not (Parm18 Is Nothing) Then
SetParmValue(Parm18, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM18"), False)
End If
If Not (Parm19 Is Nothing) Then
SetParmValue(Parm19, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM19"), False)
End If
If Not (Parm20 Is Nothing) Then
SetParmValue(Parm20, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM20"), False)
End If
If Not (Parm21 Is Nothing) Then
SetParmValue(Parm21, Me.CalledPageSession(RunScreen.Name, Me.Level + 1, "PARM21"), False)
End If
If Not blnIsInInitialize Then
' Delete the sessions that were created for this run screen.
If Session(UniqueSessionID + "Prev") = True Then
DeleteSessions(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
Session(UniqueSessionID + "Prev") = True
Else
DeleteSessions(
Session(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreen.Name + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
End If
End If
End If
End Sub
''' --- RunScreen ----------------------------------------------------------
''' <summary>
''' Summary of RunScreen.
''' </summary>
''' <param name="RunScreenName"></param>
''' <param name="RunScreenMode"></param>
''' <param name="Parm1"></param>
''' <param name="Parm2"></param>
''' <param name="Parm3"></param>
''' <param name="Parm4"></param>
''' <param name="Parm5"></param>
''' <param name="Parm6"></param>
''' <param name="Parm7"></param>
''' <param name="Parm8"></param>
''' <param name="Parm9"></param>
''' <param name="Parm10"></param>
''' <param name="Parm11"></param>
''' <param name="Parm12"></param>
''' <param name="Parm13"></param>
''' <param name="Parm14"></param>
''' <param name="Parm15"></param>
''' <param name="Parm16"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Sub RunScreen(RunScreenName As String, RunScreenMode As RunScreenModes, ByRef Parm1 As Object _
, Optional ByRef Parm2 As Object = Nothing, Optional ByRef Parm3 As Object = Nothing,
Optional ByRef Parm4 As Object = Nothing _
, Optional ByRef Parm5 As Object = Nothing, Optional ByRef Parm6 As Object = Nothing,
Optional ByRef Parm7 As Object = Nothing _
, Optional ByRef Parm8 As Object = Nothing, Optional ByRef Parm9 As Object = Nothing,
Optional ByRef Parm10 As Object = Nothing _
, Optional ByRef Parm11 As Object = Nothing, Optional ByRef Parm12 As Object = Nothing,
Optional ByRef Parm13 As Object = Nothing _
, Optional ByRef Parm14 As Object = Nothing, Optional ByRef Parm15 As Object = Nothing,
Optional ByRef Parm16 As Object = Nothing _
, Optional ByRef Parm17 As Object = Nothing, Optional ByRef Parm18 As Object = Nothing,
Optional ByRef Parm19 As Object = Nothing _
, Optional ByRef Parm20 As Object = Nothing, Optional ByRef Parm21 As Object = Nothing)
Session(UniqueSessionID + "URL") = RunScreenName
SetRunScreenMemberVariables(RunScreenName)
m_intRunScreenSequence += 1
Dim blnMethodWasExecuted As Boolean
If blnIsInInitialize Then
blnMethodWasExecuted = MethodWasExecuted(m_intRunScreenSequence, RunScreenName, "RUN_FLAG")
Else
blnMethodWasExecuted = MethodWasExecuted(m_strRunFlag, m_intRunScreenSequence, "RUN_FLAG")
End If
If Not blnMethodWasExecuted Then
If blnIsInInitialize Then
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence, RunScreenName)
Else
SetMethodExecutedFlag(m_strRunFlag, "RUN_FLAG", m_intRunScreenSequence)
End If
' Save the sequence information and set a flag indicating screen was run.
'TODO: At present we are not saving sequence
' Need to revisit for Run/Ghost Screen called from the specified Method on a specified Class
'SetScreenWasRunFlag(m_intRunScreenSequence)
' Save the parameters passed to the RUN SCREEN.
If Not (Parm1 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM1") = GetParmValue(Parm1)
End If
If Not (Parm2 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM2") = GetParmValue(Parm2)
End If
If Not (Parm3 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM3") = GetParmValue(Parm3)
End If
If Not (Parm4 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM4") = GetParmValue(Parm4)
End If
If Not (Parm5 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM5") = GetParmValue(Parm5)
End If
If Not (Parm6 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM6") = GetParmValue(Parm6)
End If
If Not (Parm7 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM7") = GetParmValue(Parm7)
End If
If Not (Parm8 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM8") = GetParmValue(Parm8)
End If
If Not (Parm9 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM9") = GetParmValue(Parm9)
End If
If Not (Parm10 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM10") = GetParmValue(Parm10)
End If
If Not (Parm11 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM11") = GetParmValue(Parm11)
End If
If Not (Parm12 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM12") = GetParmValue(Parm12)
End If
If Not (Parm13 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM13") = GetParmValue(Parm13)
End If
If Not (Parm14 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM14") = GetParmValue(Parm14)
End If
If Not (Parm15 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM15") = GetParmValue(Parm15)
End If
If Not (Parm16 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM16") = GetParmValue(Parm16)
End If
If Not (Parm17 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM17") = GetParmValue(Parm17)
End If
If Not (Parm18 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM18") = GetParmValue(Parm18)
End If
If Not (Parm19 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM19") = GetParmValue(Parm19)
End If
If Not (Parm20 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM20") = GetParmValue(Parm20)
End If
If Not (Parm21 Is Nothing) Then
Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM21") = GetParmValue(Parm21)
End If
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString) = Session.Count
'Commented from original Base Page
' Default: E for subscreen invoked during the standard entry procedure, otherwise NULL.
If RunScreenMode = RunScreenModes.NoneSelected Then
'If Me.Mode = PageModeTypes.Entry Then
' RunScreenMode = RunScreenModes.Entry
'End If
End If
If RunScreenMode = RunScreenModes.Same Then
' TODO: Test this scenario once we change the FIND and ENTRY mode code.
'RunScreenMode = Mode
End If
m_strRunScreen = RunScreenName
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_Mode") = RunScreenMode
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence
Session(UniqueSessionID + "ScreenLevel") = Me.Level + 1
If blnIsInInitialize Then
QDesign.ThrowCustomApplicationException(cMenuRunScreenException)
Else
QDesign.ThrowCustomApplicationException(cRunScreenException)
End If
Else
' Reset the m_strRunScreen variable.
m_strRunScreen = ""
' Decrement the ScreenLevel.
Session(UniqueSessionID + "ScreenLevel") = Me.Level
Session.Remove(UniqueSessionID + "URL")
' Remove the Mode and ScreenSequence session information for the screen called.
If _
Not _
IsNothing(
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence")) AndAlso
Session(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence") =
m_intRunScreenSequence Then
Session.Remove(UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_Mode")
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_ScreenSequence")
End If
' Retrieve the parameters back from Session.
If Not (Parm1 Is Nothing) Then
SetParmValue(Parm1, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM1"), False)
End If
If Not (Parm2 Is Nothing) Then
SetParmValue(Parm2, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM2"), False)
End If
If Not (Parm3 Is Nothing) Then
SetParmValue(Parm3, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM3"), False)
End If
If Not (Parm4 Is Nothing) Then
SetParmValue(Parm4, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM4"), False)
End If
If Not (Parm5 Is Nothing) Then
SetParmValue(Parm5, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM5"), False)
End If
If Not (Parm6 Is Nothing) Then
SetParmValue(Parm6, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM6"), False)
End If
If Not (Parm7 Is Nothing) Then
SetParmValue(Parm7, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM7"), False)
End If
If Not (Parm8 Is Nothing) Then
SetParmValue(Parm8, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM8"), False)
End If
If Not (Parm9 Is Nothing) Then
SetParmValue(Parm9, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM9"), False)
End If
If Not (Parm10 Is Nothing) Then
SetParmValue(Parm10, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM10"), False)
End If
If Not (Parm11 Is Nothing) Then
SetParmValue(Parm11, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM11"), False)
End If
If Not (Parm12 Is Nothing) Then
SetParmValue(Parm12, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM12"), False)
End If
If Not (Parm13 Is Nothing) Then
SetParmValue(Parm13, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM13"), False)
End If
If Not (Parm14 Is Nothing) Then
SetParmValue(Parm14, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM14"), False)
End If
If Not (Parm15 Is Nothing) Then
SetParmValue(Parm15, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM15"), False)
End If
If Not (Parm16 Is Nothing) Then
SetParmValue(Parm16, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM16"), False)
End If
If Not (Parm17 Is Nothing) Then
SetParmValue(Parm17, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM17"), False)
End If
If Not (Parm18 Is Nothing) Then
SetParmValue(Parm18, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM18"), False)
End If
If Not (Parm19 Is Nothing) Then
SetParmValue(Parm19, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM19"), False)
End If
If Not (Parm20 Is Nothing) Then
SetParmValue(Parm20, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM20"), False)
End If
If Not (Parm21 Is Nothing) Then
SetParmValue(Parm21, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM21"), False)
End If
If Not blnIsInInitialize Then
' Delete the sessions that were created for this run screen.
If Session(UniqueSessionID + "Prev") = True Then
DeleteSessions(
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
Session(UniqueSessionID + "Prev") = True
Else
DeleteSessions(
Session(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString))
Session.Remove(
UniqueSessionID + RunScreenName + "_" + (Me.Level + 1).ToString + "_" +
m_intRunScreenSequence.ToString)
End If
End If
If blnIsInInitialize AndAlso m_intRunScreenSequence > 0 Then
m_intRunScreenSequence -= 1
End If
End If
End Sub
''' --- Put ----------------------------------------------------------------
''' <exclude />
''' <summary>
''' PowerHouse PUT verb.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="Reset"></param>
''' <param name="PutType"></param>
''' <remarks>
''' </remarks>
''' <example>
''' PutData(fleTEST)<br />
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function PutData(ByRef FileObject As SqlFileObject) As Boolean
Dim blnReturnValue As Boolean
Dim strFileName As String
Dim stcFile As stcFileInfo
Dim Reset As ResetOptions = ResetOptions.NoReset
Dim PutType As PutTypes = PutTypes.None
m_intPutSequence += 1
' Get the file name (either Alias name or Base name).
If FileObject.AliasName.TrimEnd.Length > 0 Then
strFileName = FileObject.AliasName
Else
strFileName = FileObject.BaseName
End If
strFileName &= m_intPutSequence.ToString
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(m_strPutFlag, m_intPutSequence, "PUT_FLAG")
If Not blnMethodWasExecuted Then
' If the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus does not match, then don't do anything.
If FileObject.ContinuePut(PutType) Then
FileObject.PutData(CBool(Reset), PutType)
' Store the RowId and CheckSum_Value.
If m_htFileInfo Is Nothing Then m_htFileInfo = New Hashtable
stcFile.RowId = FileObject.RecordLocation
stcFile.CheckSum = FileObject.GetDecimalValue("CHECKSUM_VALUE")
stcFile.AlteredRecord = FileObject.AlteredRecord
stcFile.DeletedRecord = FileObject.DeletedRecord
stcFile.NewRecord = FileObject.NewRecord
m_htFileInfo.Add(strFileName, stcFile)
Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + "ROWIDCHECKSUM") = m_htFileInfo
End If
' Save the sequence information and set a flag indicating ACCEPT was run.
SetMethodExecutedFlag(m_strPutFlag, "PUT_FLAG", m_intPutSequence)
blnReturnValue = True
Else
' If the first time the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus did not match, then don't do anything since nothing was done
' the first time. Otherwise, set the appropriate values.
If FileObject.ContinuePut(PutType) Then
' Call the Reset option.
If CBool(Reset) Then
FileObject.CallReset()
FileObject.AlteredRecord = False
FileObject.DeletedRecord = False
Else
' Retrieve the RowId and CheckSum_Value.
stcFile = CType(m_htFileInfo.Item(strFileName), stcFileInfo)
FileObject.SetValue("ROW_ID") = stcFile.RowId
FileObject.SetValue("CHECKSUM_VALUE") = stcFile.CheckSum
FileObject.AlteredRecord = stcFile.AlteredRecord
FileObject.DeletedRecord = stcFile.DeletedRecord
FileObject.NewRecord = stcFile.NewRecord
FileObject.AcceptChanges()
End If
End If
blnReturnValue = True
End If
' Cleanup.
strFileName = Nothing
stcFile = Nothing
Return blnReturnValue
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function PutData(ByRef FileObject As BaseFileObject) As Boolean
Dim blnReturnValue As Boolean
Dim strFileName As String
Dim stcFile As stcFileInfo
Dim Reset As ResetOptions = ResetOptions.NoReset
Dim PutType As PutTypes = PutTypes.None
m_intPutSequence += 1
' Get the file name (either Alias name or Base name).
If FileObject.AliasName.TrimEnd.Length > 0 Then
strFileName = FileObject.AliasName
Else
strFileName = FileObject.BaseName
End If
strFileName &= m_intPutSequence.ToString
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(m_strPutFlag, m_intPutSequence, "PUT_FLAG")
If Not blnMethodWasExecuted Then
' If the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus does not match, then don't do anything.
If FileObject.ContinuePut(PutType) Then
FileObject.PutData(CBool(Reset), PutType)
' Store the RowId and CheckSum_Value.
If m_htFileInfo Is Nothing Then m_htFileInfo = New Hashtable
stcFile.RowId = FileObject.RecordLocation
stcFile.CheckSum = FileObject.GetDecimalValue("CHECKSUM_VALUE")
stcFile.AlteredRecord = FileObject.AlteredRecord
stcFile.DeletedRecord = FileObject.DeletedRecord
stcFile.NewRecord = FileObject.NewRecord
m_htFileInfo.Add(strFileName, stcFile)
Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + "ROWIDCHECKSUM") = m_htFileInfo
End If
' Save the sequence information and set a flag indicating ACCEPT was run.
SetMethodExecutedFlag(m_strPutFlag, "PUT_FLAG", m_intPutSequence)
blnReturnValue = True
Else
' If the first time the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus did not match, then don't do anything since nothing was done
' the first time. Otherwise, set the appropriate values.
If FileObject.ContinuePut(PutType) Then
' Call the Reset option.
If CBool(Reset) Then
FileObject.CallReset()
FileObject.AlteredRecord = False
FileObject.DeletedRecord = False
Else
' Retrieve the RowId and CheckSum_Value.
stcFile = CType(m_htFileInfo.Item(strFileName), stcFileInfo)
FileObject.SetValue("ROW_ID") = stcFile.RowId
FileObject.SetValue("CHECKSUM_VALUE") = stcFile.CheckSum
FileObject.AlteredRecord = stcFile.AlteredRecord
FileObject.DeletedRecord = stcFile.DeletedRecord
FileObject.NewRecord = stcFile.NewRecord
FileObject.AcceptChanges()
End If
End If
blnReturnValue = True
End If
' Cleanup.
strFileName = Nothing
stcFile = Nothing
Return blnReturnValue
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function PutData(ByRef FileObject As BaseFileObject, Reset As ResetOptions) As Boolean
PutData(FileObject, Reset, PutTypes.None)
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function PutData(ByRef FileObject As SqlFileObject, Reset As ResetOptions) As Boolean
PutData(FileObject, Reset, PutTypes.None)
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function PutData(ByRef FileObject As BaseFileObject, Reset As ResetOptions, PutType As PutTypes) _
As Boolean
Dim blnReturnValue As Boolean
Dim strFileName As String
Dim stcFile As stcFileInfo
m_intPutSequence += 1
' Get the file name (either Alias name or Base name).
If FileObject.AliasName.TrimEnd.Length > 0 Then
strFileName = FileObject.AliasName
Else
strFileName = FileObject.BaseName
End If
strFileName &= m_intPutSequence.ToString
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(m_strPutFlag, m_intPutSequence, "PUT_FLAG")
If Not blnMethodWasExecuted Then
' If the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus does not match, then don't do anything.
If FileObject.ContinuePut(PutType) Then
FileObject.PutData(CBool(Reset), PutType)
' Store the RowId and CheckSum_Value.
If m_htFileInfo Is Nothing Then m_htFileInfo = New Hashtable
stcFile.RowId = FileObject.RecordLocation
stcFile.CheckSum = FileObject.GetDecimalValue("CHECKSUM_VALUE")
stcFile.AlteredRecord = FileObject.AlteredRecord
stcFile.DeletedRecord = FileObject.DeletedRecord
stcFile.NewRecord = FileObject.NewRecord
m_htFileInfo.Add(strFileName, stcFile)
Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + "ROWIDCHECKSUM") = m_htFileInfo
End If
' Save the sequence information and set a flag indicating ACCEPT was run.
SetMethodExecutedFlag(m_strPutFlag, "PUT_FLAG", m_intPutSequence)
blnReturnValue = True
Else
' If the first time the PUT was called with the New, Deleted or NotDeleted option, and
' the recordstatus did not match, then don't do anything since nothing was done
' the first time. Otherwise, set the appropriate values.
If FileObject.ContinuePut(PutType) Then
' Call the Reset option.
If CBool(Reset) Then
FileObject.CallReset()
FileObject.AlteredRecord = False
FileObject.DeletedRecord = False
Else
' Retrieve the RowId and CheckSum_Value.
stcFile = CType(m_htFileInfo.Item(strFileName), stcFileInfo)
FileObject.SetValue("ROW_ID") = stcFile.RowId
FileObject.SetValue("CHECKSUM_VALUE") = stcFile.CheckSum
FileObject.AlteredRecord = stcFile.AlteredRecord
FileObject.DeletedRecord = stcFile.DeletedRecord
FileObject.NewRecord = stcFile.NewRecord
FileObject.AcceptChanges()
End If
End If
blnReturnValue = True
End If
' Cleanup.
strFileName = Nothing
stcFile = Nothing
Return blnReturnValue
End Function
'-------------------------------------------------------------------
' Name: DeleteSessions
' Function: Removes the sessions for a given screen or all sessions.
' Example: DeleteSessions(strScreen)
'-------------------------------------------------------------------
''' --- DeleteSessions -----------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of DeleteSessions.
''' </summary>
''' <param name="StartingAt"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Sub DeleteSessions(StartingAt As Integer)
Dim intTotalCount As Integer = Session.Count
Try
'If StartingAt > 0 Then
' ' Loop through the session variables.
' Do While intTotalCount > StartingAt
' If Session.Keys(intTotalCount - 1).IndexOf(UniqueSessionID) >= 0 Then
' Session.RemoveAt(intTotalCount - 1)
' End If
' intTotalCount -= 1
' Loop
'End If
Catch ex As Exception
Throw ex
End Try
End Sub
'-------------------------------------------------------------------
' Name: ScreenWasRun
' Function: This function determines if the run screen was already
' run based on the sequence of screens run within a given
' procedural path (ie. when updating a record).
' Example: ScreenWasRun(RunScreenName, Me.Level + 1,
' m_intRunScreenSequence) returns FALSE.
'-------------------------------------------------------------------
''' --- MethodWasExecuted -------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of MethodWasExecuted.
''' </summary>
''' <param name="RunScreenName"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function MethodWasExecuted(Sequence As Integer, RunScreenName As String, FlagName As String) As Boolean
Dim Flag As String
Flag = Session(UniqueSessionID + m_Node + "_" + RunScreenName + "_" + Level.ToString + "_" + FlagName) & ""
If Substring(Flag, Sequence, 1) = "Y" Then
Return True
Else
Return False
End If
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function MethodWasExecuted(Sequence As Integer, FlagName As String) As Boolean
Dim Flag As String
Flag = Session(UniqueSessionID + m_Node + "_" + FormName + "_" + Level.ToString + "_" + FlagName) & ""
If Substring(Flag, Sequence, 1) = "Y" Then
Return True
Else
Return False
End If
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function MethodWasExecuted(ByRef Flag As String, Sequence As Integer, FlagName As String) As Boolean
If FlagName = "PUT_FLAG" Then
Flag = Session(UniqueSessionID + FormName + "_" + Level.ToString + "_" + FlagName) & ""
Else
Flag = Session(UniqueSessionID + m_Node + "_" + FormName + "_" + Level.ToString + "_" + FlagName) & ""
End If
If Substring(Flag, Sequence, 1) = "Y" Then
Return True
Else
Return False
End If
End Function
''' --- GetParmValue -------------------------------------------------------
''' <exclude />
''' <summary>
''' Determines whether Object is a FILE or TEMPORARY.
''' </summary>
''' <param name="Parm">An Object which to determine its value.</param>
''' <remarks>
''' </remarks>
''' <example>CalledPageSession(RunScreenName, Me.Level + 1, "PARM1") = GetParmValue(Parm1)</example>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function GetParmValue(ByRef Parm As Object, Optional ByVal GetValues As Boolean = False) As Object
Select Case Parm.GetType.ToString
Case "CORE.WINDOWS.UI.CORE.WINDOWS.OracleFileObject", "CORE.WINDOWS.UI.CORE.WINDOWS.SqlFileObject",
"CORE.WINDOWS.UI.CORE.WINDOWS.IfxFileObject"
Return CType(Parm, IFileObject).GetInternalValues(True)
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreCharacter"
If GetValues AndAlso CType(Parm, CoreCharacter).Occurs > 1 Then
Return CType(Parm, CoreCharacter).Values
Else
Return CType(Parm, CoreCharacter).Value
End If
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreVarChar"
Return CType(Parm, CoreVarChar).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDecimal"
Return CType(Parm, CoreDecimal).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreInteger"
Return CType(Parm, CoreInteger).Value
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDate"
Return CType(Parm, CoreDate).Value
Case "Core.Framework.Core.Framework.DCharacter"
Return CType(Parm, DCharacter).Value
Case "Core.Framework.Core.Framework.DVarChar"
Return CType(Parm, DVarChar).Value
Case "Core.Framework.Core.Framework.DDecimal"
Return CType(Parm, DDecimal).Value
Case "Core.Framework.Core.Framework.DInteger"
Return CType(Parm, DInteger).Value
Case "Core.Framework.Core.Framework.DDate"
Return CType(Parm, DDate).Value
Case "System.String"
Return CType(Parm, String)
End Select
Return Nothing
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' This method handles reading the items received from a calling screen.
''' </summary>
''' <param name="ReceivedObjects">List of Objects received from the calling screen</param>
''' <example>
''' Receiving(fleEMPLOYEE, TEMP_NAME)
''' </example>
''' <remarks>
''' Receiving should only be used from overrided "RetrieveParamsReceived".
''' </remarks>
''' <history>
''' [mayur] 4/4/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub Receiving(ByVal ParamArray ReceivedObjects() As Object)
Dim intParamIndex As Integer
If IsNothing(Session(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence")) Then
Session.Remove(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence")
Session.Add(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence", "1")
ElseIf Session(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence").ToString.Length = 0 _
Then
Session.Remove(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence")
Session.Add(UniqueSessionID + FormName + "_" + Level.ToString + "_ScreenSequence", "1")
End If
Dim strKey As String = FormName + "_" + Level.ToString + "_" + ScreenSequence.ToString() + "_PARM"
For intParamIndex = 0 To ReceivedObjects.Length - 1
SetParmValue(ReceivedObjects(intParamIndex),
Session(UniqueSessionID + strKey + (intParamIndex + 1).ToString), True)
Next
End Sub
''' -----------------------------------------------------------------------------
''' <summary>
''' This method handles updating the values that are received by this screen.
''' </summary>
''' <param name="ReceivedObjects">List of Objects received from the calling screen</param>
''' <example>
''' SaveReceivingParams(fleEMPLOYEE, TEMP_NAME)
''' </example>
''' <remarks>
''' SaveReceivingParams should only be used from overrided "SaveParamsReceived".
''' </remarks>
''' <history>
''' [mayur] 4/4/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Sub SaveReceivingParams(ByVal ParamArray ReceivedObjects() As Object)
Dim intParamIndex As Integer
Dim strKey As String = FormName + "_" + Level.ToString + "_" + ScreenSequence.ToString() + "_PARM"
For intParamIndex = 0 To ReceivedObjects.Length - 1
Session(UniqueSessionID + strKey + (intParamIndex + 1).ToString) =
GetParmValue(ReceivedObjects(intParamIndex))
Next
End Sub
''' --- SetParmValue -------------------------------------------------------
''' <exclude />
''' <summary>
''' Sets the value of an object.
''' </summary>
''' <param name="Parm">An Object which to assign a value to.</param>
''' <param name="ReturnValue"></param>
''' <remarks>
''' <note>This method should only be called from RetrieveParamsReceived.</note>
''' </remarks>
''' <example>SetParmValue(Parm1, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM1"))</example>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Sub SetParmValue(ByRef Parm As Object, ReturnValue As Object)
'Note: This method should only be called from RetrieveParamsReceived
SetParmValue(Parm, ReturnValue, True)
End Sub
''' --- SetParmValue -------------------------------------------------------
''' <exclude />
''' <summary>
''' Sets the value of an object.
''' </summary>
''' <param name="Parm">An Object which to assign a value to.</param>
''' <param name="ReturnValue"></param>
''' <param name="CalledFromRetrieveParamsReceived"></param>
''' <remarks>
''' <note>This method should only be called from RetrieveParamsReceived.</note>
''' </remarks>
''' <example>SetParmValue(Parm1, Me.CalledPageSession(RunScreenName, Me.Level + 1, "PARM1"), True)</example>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Sub SetParmValue(ByRef Parm As Object, ReturnValue As Object,
CalledFromRetrieveParamsReceived As Boolean)
Select Case Parm.GetType.ToString
Case "CORE.WINDOWS.UI.CORE.WINDOWS.OracleFileObject", "CORE.WINDOWS.UI.CORE.WINDOWS.SqlFileObject",
"CORE.WINDOWS.UI.CORE.WINDOWS.IfxFileObject"
With CType(Parm, IFileObject)
Dim cnnPreviousConnection As IDbConnection
Dim trnPreviousTransaction As IDbTransaction
cnnPreviousConnection = .Connection
trnPreviousTransaction = .Transaction
.SetInternalValues(ReturnValue)
.Connection = cnnPreviousConnection
.Transaction = trnPreviousTransaction
End With
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreCharacter"
With CType(Parm, CoreCharacter)
If CalledFromRetrieveParamsReceived Then
.HasReceivedValue = True
.InitialValue = CStr(ReturnValue)
End If
.Value = CStr(ReturnValue)
End With
Case "CORE.WINDOWS.CoreVarChar"
With CType(Parm, CoreVarChar)
If CalledFromRetrieveParamsReceived Then
.HasReceivedValue = True
.InitialValue = CStr(ReturnValue)
End If
.Value = CStr(ReturnValue)
End With
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDecimal"
With CType(Parm, CoreDecimal)
If CalledFromRetrieveParamsReceived Then
.HasReceivedValue = True
.InitialValue = CDbl(ReturnValue)
End If
.Value = CDbl(ReturnValue)
End With
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreInteger"
With CType(Parm, CoreInteger)
If CalledFromRetrieveParamsReceived Then
.HasReceivedValue = True
.InitialValue = CDbl(ReturnValue)
End If
.Value = CDbl(ReturnValue)
End With
Case "CORE.WINDOWS.UI.CORE.WINDOWS.CoreDate"
With CType(Parm, CoreDate)
If CalledFromRetrieveParamsReceived Then
.HasReceivedValue = True
.InitialValue = CDbl(ReturnValue)
End If
.Value = CDbl(ReturnValue)
End With
End Select
End Sub
''' --- SetScreenWasRunFlag ------------------------------------------------
''' <exclude />
''' <summary>
''' Sets value indicating that the screen in a particular run screen sequence was run.
''' </summary>
''' <param name="ScreenSequence"></param>
''' <remarks>
''' This procedure sets the "Y" flag indicating that the screen at a particular run screen sequence was run.
''' </remarks>
''' <example>SetScreenWasRunFlag(m_intRunScreenSequence)</example>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Sub SetScreenWasRunFlag(ScreenSequence As Integer)
Session(Name + "_" + Level.ToString + "_RUN_FLAG") =
m_strRunFlag.Substring(0, m_intRunScreenSequence - 1) + "Y"
End Sub
''' --- AddMessage ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Adds a message to the messages collection.
''' </summary>
''' <param name="Message">A structure containing the message information.</param>
''' <remarks>
''' The message collection contains the list of messages to display in the message bar on the screen.
''' </remarks>
''' <example>AddMessage(Message)</example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend Sub AddMessage(Message As Common.stcMessage)
m_colMessages.Add(Message)
End Sub
''' --- AddMessage ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Adds messages to the current collection.
''' </summary>
''' <param name="Messages">A collection of Messages.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend Sub AddMessage(Messages As Collection)
Dim Message As stcMessage
' Loop through the messages in the collection and
' add it to the current collection.
For Each Message In Messages
AddMessage(Message)
Next
End Sub
''' --- AddMessage ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Adds a message to the current Message Collection.
''' </summary>
''' <param name="Message">A string containing a specific message.</param>
''' <param name="Type">A MessageType describing the type of message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend Sub AddMessage(Message As String, Type As MessageTypes, ByVal ParamArray Parameters() As Object)
Dim oMessage As stcMessage
Try
oMessage = ReturnMessage(Message, Type, Parameters)
AddMessage(oMessage)
oMessage.Type = MessageTypes.Warning
GlobalSession(UniqueSessionID + "PassedMessagesError") = True
If ScreenType <> ScreenTypes.QTP Then
If Not GlobalSession(UniqueSessionID + "PassedMessages") Is Nothing Then
oMessage.Text = CType(GlobalSession(UniqueSessionID + "PassedMessages"), stcMessage).Text &
vbNewLine & oMessage.Text
End If
End If
GlobalSession(UniqueSessionID + "PassedMessages") = oMessage
If Type = MessageTypes.Error OrElse Type = MessageTypes.Severe Then
' For SEVERE messages, run the BACKOUT procedure.
If Type = MessageTypes.Severe Then
Try
RaiseSavePageState()
' Set the mode to NoMode in order to clear the screen.
Mode = PageModeTypes.NoMode
RemoveFlags()
Catch ex As Exception
' Do Nothing
End Try
End If
QDesign.ThrowCustomApplicationException(cAddMessageError)
End If
Catch ex As CustomApplicationException
ex.MessageText = oMessage.Text
Throw ex
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
''' --- ErrorMessage -------------------------------------------------------
''' <summary>
''' Adds an Error message to the message collection.
''' </summary>
''' <param name="Message">A string containing a specific Error Message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' The ErrorMessage method stops execution and displays an error on the screen.
''' <note>
''' This method will stop code execution and will reprompt at the last executed Accept method if
''' applicable. A message will then be displayed in the messagebar area.
''' NOTE: The ErrorMessage method will cause the screen to close when called from the Intialize method.
''' </note>
''' </remarks>
''' <example>
''' ErrorMessage("The value you entered is not a valid status type.")<br />
''' ErrorMessage("The value at row " + Occurrence + " is incorrect.")<br /><br />
''' The following syntax is used when substituting values in error messages that are in the globalization dll:<br />
''' Globalization value is "Employee {0} has exceeded his allowable expense limit of {1}"<br />
''' ErrorMessage("MSG0001", fleEMPLOYEE.GetStringValue("EMPLOYEE_NAME"), T_TEMP.Value)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function ErrorMessage(Message As String, ByVal ParamArray Parameters() As Object)
AddMessage(Message, MessageTypes.Error, Parameters)
End Function
''' --- Information --------------------------------------------------------
''' <summary>
''' Adds an Information message to the message collection.
''' </summary>
''' <param name="Message">A string containing a specific Error Message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' The Information method displays a information message to the user.
''' </remarks>
''' <example>
''' Information("A record will be added to the Employee table.")<br />
''' Information("The value at row " + Occurrence + " will be used.")<br /><br />
''' The following syntax is used when substituting values in messages that are in the globalization dll:<br />
''' Globalization value is "Employee {0} has exceeded his allowable expense limit of {1}"<br />
''' Information("MSG0001", fleEMPLOYEE.GetStringValue("EMPLOYEE_NAME"), T_TEMP.Value)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Information(Message As String, ByVal ParamArray Parameters() As Object)
If Message.Trim.Length > 0 Then
AddMessage(Message, MessageTypes.Information, Parameters)
End If
Return Nothing
End Function
''' --- ReturnMessage ---------------------------------------------------------
''' <exclude />
''' <summary>
''' Returns the translated message.
''' </summary>
''' <param name="Message">A string containing a specific message.</param>
''' <param name="Type">A MessageType describing the type of message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function ReturnMessage(Message As String, Type As MessageTypes, ByVal ParamArray Parameters() As Object) _
As stcMessage
Dim oMessage As stcMessage
Dim strMessageNumber As String
Dim strNumber As String = String.Empty
Dim strMessage As String = String.Empty
Try
strMessage = Message
'' Retrieve the message number.
'If Message.IndexOf("MSG") > -1 Then
' strNumber = strMessageNumber.Substring(3)
'Else
' strNumber = strMessageNumber
'End If
'' Get the message from the resource file.
'If strMessageNumber.Trim.Length > 0 Then
' strMessage = Me.GetString(strMessageNumber,
' Global.Core.Globalization.Core.Globalization.ResourceTypes.Message)
' If strMessage Is Nothing Then strMessage = String.Empty
'Else
' 'To handle an empty error message
' strMessage = strMessageNumber
'End If
' Replace the substitution characters with the values.
If Not IsNothing(Parameters) Then
If strMessage.Length > 0 Then
Try
strMessage = String.Format(strMessage, Parameters)
Catch ex As FormatException
strMessage = "Wrong number of substitution parameters."
Catch ex As Exception
strMessage = ex.Message
End Try
Else
strMessage = String.Empty
End If
End If
' If the message doesn't exist in the globalization,
' the user must have hardcoded an overriden value.
If strMessage = "????" Or strMessage.Trim.Length = 0 Then
'Display an unknown error message or an empty error message
strMessage = strNumber
strNumber = String.Empty
End If
'Add Message whether it is
oMessage.Text = strMessage
oMessage.Number = strNumber
oMessage.Type = Type
Return oMessage
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
''' --- Severe -------------------------------------------------------------
''' <summary>
''' Adds an Severe message to the message collection and aborts processing.
''' </summary>
''' <param name="Message">A string containing a specific Sever message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' The Severe method stops execution, re-initializes the buffers, calls the Backout method and positions the cursor in
''' the field associated with the error message.
''' </remarks>
''' <example>
''' Severe("The value you entered is not a valid status type.")<br />
''' Severe("The value at row " + Occurrence + " is incorrect.")<br /><br />
''' The following syntax is used when substituting values in error messages that are in the globalization dll:<br />
''' Globalization value is "Employee {0} has exceeded his allowable expense limit of {1}"<br />
''' Sever("MSG0001", fleEMPLOYEE.GetStringValue("EMPLOYEE_NAME"), T_TEMP.Value)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Severe(Message As String, ByVal ParamArray Parameters() As Object)
AddMessage(Message, MessageTypes.Severe, Parameters)
Return Nothing
End Function
''' --- Warning ------------------------------------------------------------
''' <summary>
''' Adds a Warning message to the message collection.
''' </summary>
''' <param name="Message">A string containing a specific Error Message.</param>
''' <param name="Parameters">An array of message parameters.</param>
''' <remarks>
''' The Warning method displays a warning message to the user.
''' </remarks>
''' <example>
''' Information("A record will be added to the Employee table.")<br />
''' Information("The value at row " + Occurrence + " will be used.")<br /><br />
''' The following syntax is used when substituting values in messages that are in the globalization dll:<br />
''' Globalization value is "Employee {0} has exceeded his allowable expense limit of {1}"<br />
''' Information("MSG0001", fleEMPLOYEE.GetStringValue("EMPLOYEE_NAME"), T_TEMP.Value)
''' </example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Warning(Message As String, ByVal ParamArray Parameters() As Object)
AddMessage(Message, MessageTypes.Warning, Parameters)
Return Nothing
End Function
''' --- GetString ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Retrieves the string value of the key passed in.
''' </summary>
''' <param name="key">A String containing the name of the key to search for.</param>
''' <param name="ResourceType">A Resource Type which contains the desired key and corresponding value.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetString(key As String,
ResourceType As Global.Core.Globalization.Core.Globalization.ResourceTypes) As String
Return GlobalizationManager.GetString(key, ResourceType)
End Function
''' --- SetGlobalizationManager --------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SetGlobalizationManager.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Sub SetGlobalizationManager()
Dim strLanguage As String
If Session(UniqueSessionID + "Language") Is Nothing Then
'If m_objRequest.UserLanguages Is Nothing Then
strLanguage = "en-ca"
'Else
' strLanguage = m_objRequest.UserLanguages(0)
'End If
GlobalizationManager = New GlobalizationManager(strLanguage)
Language = strLanguage
Else
GlobalizationManager = New GlobalizationManager(Session(UniqueSessionID + "Language").ToString)
End If
End Sub
''' --- DeleteSystemVal ----------------------------------------------------
''' <summary>
''' Allows the deletion of values defined at the operating system level.
''' </summary>
''' <param name="Name">A String containing the name of the systemval to delete.</param>
''' <param name="Type">A String indicating the type of systemval.</param>
''' <param name="Table"></param>
''' <param name="SessionId"></param>
''' <remarks>
''' <example>
''' DeleteSystemVal("PARAMS")<br />
''' DeleteSystemVal("QUIZ_PARAMS", "0001", "LNM$JOB")
''' </example>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Function DeleteSystemVal(Name As String,
Optional ByVal Type As String = "0001") As Boolean
Select Case Type
Case "0001"
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
SessionInformation.Remove(Name + Type, QTPSessionID)
Else
SessionInformation.Remove(Name + Type, Session("SessionID"))
End If
Case "0002", "0003"
SessionInformation.RemoveApplication(Name + Type)
End Select
End Function
Private Const cApplicationScope As String = "0003"
''' <summary>
''' <exclude />
''' Determines whether the lock time was set (currently informix only).
''' </summary>
''' <param name="Transaction">A String indicating the named transaction.</param>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Property LockTimeSet(Transamenction As String) As Boolean
Get
If m_htLockTimes.Contains(Transaction) Then
Return m_htLockTimes(Transaction)
Else
Return False
End If
End Get
Set(value As Boolean)
m_htLockTimes.Add(Transaction, value)
End Set
End Property
''' --- GetSystemVal -------------------------------------------------------
''' <summary>
''' Retrieves values defined at the operating system level.
''' </summary>
''' <param name="Name"></param>
''' <param name="TypeCode"></param>
''' <remarks>
''' <example>
''' GetSystemVal("PARAMS") <br />
''' GetSystemVal("QUIZ_PARAMS", "0002", "LNM$JOB") Returns "ALL"
''' </example>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Function GetSystemVal(Name As String) As String
Return GetSystemVal(Name, "0001")
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Friend Function GetSystemVal(Name As String, TypeCode As String) As String
Dim strValue As String = Nothing
If TypeCode = "" Then
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
#If TARGET_DB = "INFORMIX" Then
strValue = Session(Name + "0001")
If strValue = Nothing Then strValue = UI.SessionInformation.GetSession(Name + "0001", QTPSessionID)
#Else
strValue = SessionInformation.GetSession(Name + "0001", QTPSessionID)
#End If
Else
strValue = SessionInformation.GetSession(Name + "0001", Session("SessionID"))
End If
If IsNothing(strValue) Then
strValue = SessionInformation.GetApplicationSession(Name + "0002")
End If
If IsNothing(strValue) Then
strValue = SessionInformation.GetApplicationSession(Name + "0003")
End If
Else
Select Case TypeCode
Case "0001"
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
#If TARGET_DB = "INFORMIX" Then
strValue = Session(UniqueSessionID + Name + "0001")
If strValue = Nothing Then strValue = UI.SessionInformation.GetSession(Name + "0001",
QTPSessionID)
#Else
strValue = SessionInformation.GetSession(Name + "0001", QTPSessionID)
#End If
Else
strValue = SessionInformation.GetSession(Name + "0001", Session("SessionID"))
If IsNothing(strValue) Then
strValue = SessionInformation.GetApplicationSession(Name + "0002")
End If
If IsNothing(strValue) Then
strValue = SessionInformation.GetApplicationSession(Name + "0003")
End If
End If
Case "0002", "0003"
strValue = SessionInformation.GetApplicationSession(Name + TypeCode)
End Select
End If
If IsNothing(strValue) Then strValue = String.Empty
Return strValue
End Function
''' --- SetSystemVal -------------------------------------------------------
''' <summary>
''' Assigns values at the operating system level.
''' </summary>
''' <param name="Name">A String containing the name of the systemval.</param>
''' <param name="Value">A String containing the value to be assigned to the systemval.</param>
''' <param name="Type">A String indicating the type of systemval.</param>
''' <remarks>
''' <example>
''' SetSystemVal("PARAMS", T_TEMP.Value) <br />
''' SetSystemValue("QUIZ_PARAMS", "ALL", "0001", "LNM$JOB") returns TRUE or FALSE.
''' </example>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function SetSystemVal(Name As String,
Value As String) As Boolean
Return SetSystemVal(Name, Value, "0001")
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function SetSystemVal(Name As String,
Value As String,
Type As String) As Boolean
If Type = "0001" Then
If ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ Then
#If TARGET_DB = "INFORMIX" Then
Session(UniqueSessionID + Name + Type) = Value
#Else
SessionInformation.SetSession(Name + Type, Value, QTPSessionID)
#End If
Else
SessionInformation.SetSession(Name + Type, Value, Session("SessionID"))
End If
Else
SessionInformation.SetApplicationSession(Name + Type, Value)
End If
Return True
End Function
''' --- ReturnAndClose -----------------------------------------------------
''' <summary>
''' Replaces the RETURN verb.
''' </summary>
''' <remarks>
''' Raises a RETURN error and sets the correct flags in order to
''' close the current screen.
''' </remarks>
''' <example>ReturnAndClose()</example>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Overrides Sub ReturnAndClose()
SaveParamsReceived()
MyBase.ReturnAndClose()
End Sub
#Region " AlteredRecord, DeletedRecord and NewRecord methods "
'AlteredRecord, DeletedRecord and NewRecord uses
'm_bfoFileForRecordStatus to return the primary file unless it is changed with the
'SET ASSUMED (Which we don't support at present) statement. If there is no assumed
'record-structure, the status is the same as that of the current record-structure,
'that gets set in GetData
''' --- DeletedRecord ------------------------------------------------------
''' <summary>
''' Returns a boolean indicating whether the current record in the File class (used in last GetData) has been marked
''' for deletion.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function DeletedRecord() As Boolean
If FileForRecordStatus Is Nothing Then
Return False
Else
Return FileForRecordStatus.DeletedRecord
End If
End Function
''' --- AlteredRecord ------------------------------------------------------
''' <summary>
''' Returns a boolean indicating whether the current record in the File class (used in last GetData) has been marked as
''' altered.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function AlteredRecord() As Boolean
If FileForRecordStatus Is Nothing Then
Return False
Else
Return FileForRecordStatus.AlteredRecord
End If
End Function
''' --- NewRecord ----------------------------------------------------------
''' <summary>
''' Returns a boolean indicating whether the current record in the File class (used in last GetData) has been marked as
''' new.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function NewRecord() As Boolean
If FileForRecordStatus Is Nothing Then
Return False
Else
Return FileForRecordStatus.NewRecord
End If
End Function
#End Region
'-------------------------------------------------------------------
' Name: FileForRecordStatus
' Function: AlteredRecord, DeletedRecord and NewRecord uses
' m_bfoFileForRecordStatus to return the primary file unless it is changed with the
' SET ASSUMED (Which we don't support at present) statement. If there is no assumed
' record-structure, the status is the same as that of the current record-structure,
' that gets set in GetData
' Example: FileForRecordStatus
'-------------------------------------------------------------------
''' --- FileForRecordStatus ------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of FileForRecordStatus.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Friend Property FileForRecordStatus As BaseFileObject
Get
If Me.PrimaryFileObject Is Nothing Then
Return m_bfoFileForRecordStatus
Else
Return Me.PrimaryFileObject
End If
End Get
Set(Value As BaseFileObject)
If Not Me.m_bfoFileForRecordStatus Is Nothing Then
m_bfoFileForRecordStatus.HasLastGetData = False
End If
m_bfoFileForRecordStatus = Value
End Set
End Property
''' --- PrimaryFileObject --------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of PrimaryFileObject.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public ReadOnly Property PrimaryFileObject As BaseFileObject
Get
Return m_bfoPrimaryFile
End Get
End Property
''' --- Finalize -----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of Finalize.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Overrides Sub Finalize()
'Remove the references to file objects
m_bfoPrimaryFile = Nothing
m_bfoFileForRecordStatus = Nothing
MyBase.Finalize()
End Sub
''' --- SetAccessOk --------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SetAccessOk.
''' </summary>
''' <param name="AccessOk"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overrides Sub SetAccessOk(AccessOk As Boolean)
'The ACCESSOK condition relates to a session and not to a specific screen.
Session(UniqueSessionID + "AccessOK") = AccessOk
End Sub
''' --- ErrorMessage -------------------------------------------------------
''' <summary>
''' Adds an Error Message to the Message Collection.
''' </summary>
''' <param name="Message">A string containing a specific Error Message.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function ErrorMessage(Message As String)
AddMessage(Message, MessageTypes.Error)
Return Nothing
End Function
''' --- Information --------------------------------------------------------
''' <summary>
''' Adds an Information Message to the Message Collection.
''' </summary>
''' <param name="Message">A string containing a specific Information Message.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Information(Message As String)
If Message.Trim.Length > 0 Then
AddMessage(Message, MessageTypes.Information)
End If
Return Nothing
End Function
''' --- Severe -------------------------------------------------------------
''' <summary>
''' Adds an Severe Message to the Message Collection.
''' </summary>
''' <param name="Message">A string containing a specific Severe Message.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Severe(Message As String)
AddMessage(Message, MessageTypes.Severe)
Return Nothing
End Function
''' --- Warning ------------------------------------------------------------
''' <summary>
''' Adds an Warning Message to the Message Collection.
''' </summary>
''' <param name="Message">A string containing a specific Warning Message.</param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function Warning(Message As String)
AddMessage(Message, MessageTypes.Warning)
Return Nothing
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function WriteMiniDictionaryFile(strFileName As String, dt As DataTable, hslenght As Hashtable,
ByVal ParamArray strSubFiles() As Object) As Boolean
Dim strFilePath As String = ""
Dim strFileText As New StringBuilder("")
Dim sw As StreamWriter
'If arrKeepFile.Contains(strFileName) OrElse alSubTempText.Contains(strFileName) Then
strFilePath = Directory.GetCurrentDirectory()
'Else
' strFilePath = System.Configuration.ConfigurationManager.AppSettings("FlatFilePath") & "\" & Session(UniqueSessionID + "m_strUser") & "_" & Session(UniqueSessionID + "m_strSessionID")
'End If
If Not Directory.Exists(strFilePath) Then
Directory.CreateDirectory(strFilePath)
End If
Dim strFileColumn As String = strFilePath
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".psd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".psd"
End If
ElseIf Not IsNothing(Session("DatFiles")) AndAlso DirectCast(Session("DatFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & strFileName & ".dfd"
Else
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & "\" & strFileName & ".dfd"
End If
ElseIf Not IsNothing(Session("TempFiles")) AndAlso DirectCast(Session("TempFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & strFileName & ".dfd"
Else
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & "\" & strFileName & ".dfd"
End If
Else
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".sfd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".sfd"
End If
End If
If Not File.Exists(strFileColumn) Then
For i As Integer = 0 To dt.Columns.Count - 1
If dt.Columns(i).ColumnName <> "ROW_ID" AndAlso dt.Columns(i).ColumnName <> "CHECKSUM_VALUE" Then
strFileText.Append(dt.Columns(i).ColumnName)
strFileText.Append(",")
strFileText.Append(dt.Columns(i).DataType.ToString)
strFileText.Append(",")
If dt.Columns(i).DataType.ToString = "System.DateTime" Then
strFileText.Append("8")
' GW2018. Added to treat System.Decical differently by adding 1 to the length to accomodate the +/- sign
ElseIf dt.Columns(i).DataType.ToString = "System.Decimal" Then
strFileText.Append(GetSubSize(hslenght.Item(dt.Columns(i).ColumnName.ToLower), dt.Columns(i).DataType.ToString) + 1)
ElseIf dt.Columns(i).DataType.ToString = "System.Integer" OrElse dt.Columns(i).DataType.ToString = "System.Int64" Then
strFileText.Append(GetSubSize(hslenght.Item(dt.Columns(i).ColumnName.ToLower), dt.Columns(i).DataType.ToString))
Else
strFileText.Append(hslenght.Item(dt.Columns(i).ColumnName.ToLower))
End If
strFileText.Append(vbNewLine)
End If
Next
'My.Computer.FileSystem.WriteAllText(strFileColumn, strFileText.ToString, False)
sw = New StreamWriter(strFileColumn, False)
sw.Write(strFileText.ToString)
sw.Flush()
sw.Close()
sw.Dispose()
End If
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function lookup_MiniDictionary(dt As DataTable, position As Integer, ByRef datatype As String, ByRef datatype_size As Integer)
Dim curr_position As Integer = 0
For Each row As DataRow In dt.Rows
curr_position = row("position")
If (curr_position = position) Then
datatype = row("Datatype")
datatype_size = Convert.ToInt32(row("datatypesize"))
Exit For
End If
Next row
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function PutDataTextTable(strFileName As String, dt As DataTable, hslenght As Hashtable,
ByVal ParamArray strSubFiles() As Object) As Boolean
Dim strFilePath As String = ""
Dim strFile As String = String.Empty
Dim strFileText As New StringBuilder("")
Dim sw As StreamWriter
Dim blnFileExists As Boolean = False
Dim strText As String = String.Empty
Dim strTextName As String = String.Empty
Dim intRowcount As Integer = 0
Dim strName As String = String.Empty
Dim blnWriteBlankFile As Boolean = True
Dim sfdexists As Boolean = True
Dim hsColumns As New Hashtable
Dim arrStructure() As String
strFileName = strFileName
' The Mini Dictionary will be used to hold the sfd/psd/dfd definitions
Dim MiniDictionary As DataTable
MiniDictionary = New DataTable()
MiniDictionary.Columns.Add("Position", GetType(System.Int32))
MiniDictionary.Columns.Add("ColumnName", GetType(System.String))
MiniDictionary.Columns.Add("Datatype", GetType(System.String))
MiniDictionary.Columns.Add("DatatypeSize", GetType(System.Int32))
Dim sw2 As StreamWriter
'If arrKeepFile.Contains(strFileName) OrElse alSubTempText.Contains(strFileName) Then
strFilePath = Directory.GetCurrentDirectory()
'Else
' strFilePath = System.Configuration.ConfigurationManager.AppSettings("FlatFilePath") & "\" & Session(UniqueSessionID + "m_strUser") & "_" & Session(UniqueSessionID + "m_strSessionID")
'End If
If Not Directory.Exists(strFilePath) Then
Directory.CreateDirectory(strFilePath)
End If
Dim strFileColumn As String = strFilePath
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".psd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".psd"
End If
ElseIf Not IsNothing(Session("DatFiles")) AndAlso DirectCast(Session("DatFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & strFileName & ".dfd"
Else
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & "\" & strFileName & ".dfd"
End If
ElseIf Not IsNothing(Session("TempFiles")) AndAlso DirectCast(Session("TempFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & strFileName & ".dfd"
Else
strFileColumn = System.Configuration.ConfigurationManager.AppSettings("FlatFileDictionary") & "\" & strFileName & ".dfd"
End If
Else
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".sfd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".sfd"
End If
End If
'GW2018. This code no longer needed as it was moved to WriteMiniDictionary
'
'If Not File.Exists(strFileColumn) Then
' For i As Integer = 0 To dt.Columns.Count - 1
' If dt.Columns(i).ColumnName <> "ROW_ID" AndAlso dt.Columns(i).ColumnName <> "CHECKSUM_VALUE" Then
' strFileText.Append(dt.Columns(i).ColumnName)
' strFileText.Append(",")
' strFileText.Append(dt.Columns(i).DataType.ToString)
' strFileText.Append(",")
' If dt.Columns(i).DataType.ToString = "System.DateTime" Then
' strFileText.Append("8")
' ElseIf dt.Columns(i).DataType.ToString = "System.Decimal" OrElse dt.Columns(i).DataType.ToString = "System.Integer" OrElse dt.Columns(i).DataType.ToString = "System.Int64" Then
' strFileText.Append(GetSubSize(hslenght.Item(dt.Columns(i).ColumnName.ToLower), dt.Columns(i).DataType.ToString))
' Else
' strFileText.Append(hslenght.Item(dt.Columns(i).ColumnName.ToLower))
' End If
' strFileText.Append(vbNewLine)
' End If
' Next
' 'My.Computer.FileSystem.WriteAllText(strFileColumn, strFileText.ToString, False)
' sw = New StreamWriter(strFileColumn, False)
' sw.Write(strFileText.ToString)
' sw.Flush()
' sw.Close()
' sw.Dispose()
'ElseIf (strFileColumn.EndsWith(".dfd")) Then
If (strFileColumn.EndsWith(".dfd")) Then
Dim sr = New StreamReader(strFileColumn)
Dim strtmp As String
strtmp = sr.ReadLine
hsColumns = New Hashtable
Do While Not IsNothing(strtmp)
If (strtmp.Trim.Length > 0) Then
arrStructure = strtmp.Split(",")
hsColumns.Add(arrStructure(0), arrStructure(1))
End If
strtmp = sr.ReadLine
Loop
ElseIf File.Exists(strFileColumn) Then
Dim sr As StreamReader = New StreamReader(strFileColumn)
Dim text As String = sr.ReadLine
Dim column_name As String
Dim position As Integer = 0
Dim datatype As String
Dim datatype_size As Integer
Dim found As Boolean
While (Not IsNothing(text))
column_name = text.Split(",")(0)
datatype = text.Split(",")(1)
datatype_size = text.Split(",")(2).ToLower
MiniDictionary.Rows.Add(position, column_name, datatype, datatype_size)
hslenght.Item(text.Split(",")(0).ToLower) = text.Split(",")(2)
position = position + 1
text = sr.ReadLine
End While
If Not hsSubConverted.Contains(strFileName) Then
hsSubConverted.Add(strFileName, strFileName)
End If
End If
strFileText.Remove(0, strFileText.Length)
Try
If IsNothing(Me.Session(UniqueSessionID + "strSubFileName")) Then
strTextName = strFileName
Else
strTextName = Me.Session(UniqueSessionID + "strSubFileName").ToString
If strTextName.IndexOf(".") >= 0 Then
strName = strTextName.Substring(0, strTextName.IndexOf("."))
strTextName = strTextName.Substring(strTextName.IndexOf(".") + 1)
strTextName = strTextName.Replace(".", "\") & "\" & strName
End If
End If
If strTextName.StartsWith("JS") Then
strTextName = strTextName.Replace("JS", "SD")
End If
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strFileName) Then
If strFilePath.EndsWith("\") Then
strFile = strFilePath & strTextName + ".ps"
Else
strFile = strFilePath & "\" & strTextName + ".ps"
End If
ElseIf Not IsNothing(Session("DatFiles")) AndAlso DirectCast(Session("DatFiles"), ArrayList).Contains(strFileName) Then
If strFilePath.EndsWith("\") Then
strFile = strFilePath & strTextName + ".dat"
Else
strFile = strFilePath & "\" & strTextName + ".dat"
End If
ElseIf Not IsNothing(Session("TempFiles")) AndAlso DirectCast(Session("TempFiles"), ArrayList).Contains(strFileName) Then
If strFilePath.EndsWith("\") Then
strFile = strFilePath & strTextName + ".dat"
Else
strFile = strFilePath & "\" & strTextName + ".dat"
End If
Else
If strFilePath.EndsWith("\") Then
strFile = strFilePath & strTextName + ".sf"
Else
strFile = strFilePath & "\" & strTextName + ".sf"
End If
End If
Dim aFileInfo As New FileInfo(strFile)
If File.Exists(strFile) Then
blnFileExists = True
If aFileInfo.Attributes And FileAttributes.ReadOnly Then
If m_blnDidLock = True Then
aFileInfo.Attributes -= FileAttributes.ReadOnly
Else
Err.Raise("This File is Locked!")
Return False
End If
End If
aFileInfo = Nothing
End If
Dim sr As StreamReader
Dim strread As String = String.Empty
Dim blnAppend As Boolean = True
Dim blnAddCarriage As Boolean = True
If blnFileExists Then
sr = New StreamReader(strFile)
strread = sr.ReadLine
blnAppend = Not IsNothing(strread) AndAlso strread.Length > 0
blnAddCarriage = blnAppend
Else
blnAppend = False
blnAddCarriage = False
End If
If Not IsNothing(sr) Then
sr.Close()
sr.Dispose()
sr = Nothing
End If
Dim tmpVal As String = ""
Dim tmpPlusMinus As String = ""
Dim datatype As String = ""
Dim datatype_size As Integer = 0
'If Not strFileColumn.EndsWith(".psd") Then
' For i As Integer = 0 To dt.Rows.Count - 1
' 'If strFileText.ToString.Length > 0 OrElse (blnFileExists AndAlso blnAddCarriage) Then
' ' Try
' ' strFileText.Append(LineTerminator)
' ' Catch ex As OutOfMemoryException
' ' GC.Collect()
' ' strFileText.Append(LineTerminator)
' ' End Try
' 'End If
' 'blnAddCarriage = True
' For j As Integer = 0 To dt.Columns.Count - 1
' If _
' dt.Columns(j).ColumnName.ToUpper <> "ROW_ID" AndAlso
' dt.Columns(j).ColumnName.ToUpper <> "CHECKSUM_VALUE" Then
' If dt.Columns(j).DataType.ToString = "System.Decimal" OrElse dt.Columns(j).DataType.ToString = "System.Integer" OrElse dt.Columns(j).DataType.ToString = "System.Int64" Then
' If (strFileColumn.EndsWith(".dfd")) Then
' tmpVal = dt.Rows(i)(j).ToString
' Dim tmpsize As Integer
' tmpsize = hslenght.Item(dt.Columns(j).ColumnName.ToLower)
' If (hsColumns(dt.Columns(j).ColumnName.ToUpper) = "System.Zoned.Signed") Then
' Dim ispos As Boolean = tmpVal.IndexOf("-") = -1
' tmpVal = tmpVal.Replace("-", "")
' tmpVal = tmpVal.Substring(0, tmpVal.Length - 1) + GetOverpunchDigit(tmpVal.Substring(tmpVal.Length - 1, 1), ispos)
' End If
' strFileText.Append(
' tmpVal.PadLeft(tmpsize, "0").Substring(0, tmpsize))
' Else
' tmpVal = dt.Rows(i)(j).ToString
' Dim tmpsize As Integer
' If hsSubConverted.Contains(strFileName) Then
' tmpsize = hslenght.Item(dt.Columns(j).ColumnName.ToLower)
' Else
' tmpsize = GetSubSize(hslenght.Item(dt.Columns(j).ColumnName.ToLower), dt.Columns(j).DataType.ToString)
' End If
' If tmpVal.Trim.StartsWith("-") Then
' tmpVal = tmpVal.Replace("-", "")
' tmpVal =
' tmpVal.PadLeft(tmpsize - 1, "0").
' Substring(0, tmpsize - 1)
' tmpVal = "-" & tmpVal
' Else
' tmpVal =
' tmpVal.PadLeft(tmpsize - 1, "0").
' Substring(0, tmpsize - 1)
' tmpVal = "+" & tmpVal
' End If
' strFileText.Append(
' tmpVal.PadLeft(tmpsize, "0").Substring(0, tmpsize))
' End If
' ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
' If IsNull(dt.Rows(i)(j)) OrElse dt.Rows(i)(j) = #12:00:00 AM# Then
' strFileText.Append(" ")
' Else
' Dim dateTimeInfo As DateTime = dt.Rows(i)(j)
' strFileText.Append(
' dateTimeInfo.Year.ToString & dateTimeInfo.Month.ToString.PadLeft(2, "0") &
' dateTimeInfo.Day.ToString.PadLeft(2, "0"))
' End If
' Else
' strFileText.Append(
' dt.Rows(i)(j).ToString.PadRight(hslenght.Item(dt.Columns(j).ColumnName.ToLower)).
' Substring(0, hslenght.Item(dt.Columns(j).ColumnName.ToLower)))
' End If
' End If
' Next
' intRowcount = intRowcount + 1
' If intRowcount = 499 Then
' intRowcount = 0
' If strFileText.ToString.Length > 0 Then
' 'My.Computer.FileSystem.WriteAllText(strFile, strFileText.ToString, True)
' sw = New StreamWriter(strFile, blnAppend)
' blnAppend = True
' blnFileExists = True
' sw.Write(strFileText.ToString)
' sw.Flush()
' sw.Close()
' sw.Dispose()
' sw = Nothing
' GC.Collect()
' strFileText.Remove(0, strFileText.Length)
' blnWriteBlankFile = False
' End If
' End If
' Next
' If strFileText.ToString.Length > 0 OrElse blnWriteBlankFile Then
' 'My.Computer.FileSystem.WriteAllText(strFile, strFileText.ToString, True)
' sw = New StreamWriter(strFile, blnAppend)
' sw.Write(strFileText.ToString)
' sw.Flush()
' sw.Close()
' sw.Dispose()
' sw = Nothing
' GC.Collect()
' strFileText.Remove(0, strFileText.Length)
' End If
' ''''''''''''''''''''''end sd
'End If
For i As Integer = 0 To dt.Rows.Count - 1
If strFileText.ToString.Length > 0 OrElse (blnFileExists AndAlso blnAddCarriage) Then
Try
strFileText.Append(LineTerminator)
Catch ex As OutOfMemoryException
GC.Collect()
strFileText.Append(LineTerminator)
End Try
End If
blnAddCarriage = True
For j As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns(j).ColumnName.ToUpper <> "ROW_ID" AndAlso
dt.Columns(j).ColumnName.ToUpper <> "CHECKSUM_VALUE" Then
If dt.Columns(j).DataType.ToString = "System.Decimal" OrElse dt.Columns(j).DataType.ToString = "System.Integer" OrElse dt.Columns(j).DataType.ToString = "System.Int64" Then
If (strFileColumn.EndsWith(".dfd")) Then
tmpVal = dt.Rows(i)(j).ToString
Dim tmpsize As Integer
tmpsize = hslenght.Item(dt.Columns(j).ColumnName.ToLower)
If (hsColumns(dt.Columns(j).ColumnName.ToUpper) = "System.Zoned.Signed") Then
Dim ispos As Boolean = tmpVal.IndexOf("-") = -1
tmpVal = tmpVal.Replace("-", "")
tmpVal = tmpVal.Substring(0, tmpVal.Length - 1) + GetOverpunchDigit(tmpVal.Substring(tmpVal.Length - 1, 1), ispos)
ElseIf tmpVal.Trim.StartsWith("-") Or tmpVal.Trim.StartsWith("+") Then
tmpPlusMinus = tmpVal.Trim.Substring(0, 1)
tmpVal = tmpVal.Replace("-", "").Replace("+", "")
tmpVal = tmpVal.PadLeft(tmpsize - 1, "0")
tmpVal = tmpPlusMinus & tmpVal
End If
strFileText.Append(
tmpVal.PadLeft(tmpsize, "0").Substring(0, tmpsize))
Else
tmpVal = dt.Rows(i)(j).ToString
Dim tmpsize As Integer
'If hsSubConverted.Contains(strFileName) Then
' tmpsize = hslenght.Item(dt.Columns(j).ColumnName.ToLower)
'Else
' tmpsize = GetSubSize(hslenght.Item(dt.Columns(j).ColumnName.ToLower), dt.Columns(j).DataType.ToString)
'End If
'If tmpVal.Trim.StartsWith("-") Then
' tmpVal = tmpVal.Replace("-", "")
' tmpVal =
' tmpVal.PadLeft(tmpsize - 1, "0").
' Substring(0, tmpsize - 1)
' tmpVal = "-" & tmpVal
'Else
' tmpVal =
' tmpVal.PadLeft(tmpsize - 1, "0").
' Substring(0, tmpsize - 1)
' tmpVal = "+" & tmpVal
'End If
'strFileText.Append(
' tmpVal.PadLeft(tmpsize, "0").Substring(0, tmpsize))
'If blnOver5000Records Then
'tmpsize = hslenght.Item(dt.Columns(j).ColumnName.ToLower)
'Else
' GW2018. Mar 10. Lookup on the mini-dirctionary for the column data type and size
' based on column position (j 0, 1, 2)....
lookup_MiniDictionary(MiniDictionary, j, datatype, datatype_size)
tmpsize = datatype_size
'tmpsize = GetSubSize(hslenght.Item(dt.Columns(j).ColumnName.ToLower), dt.Columns(j).DataType.ToString)
'End If
If tmpVal.Trim.StartsWith("-") Or tmpVal.Trim.StartsWith("+") Then
tmpPlusMinus = tmpVal.Trim.Substring(0, 1)
tmpVal = tmpVal.Replace("-", "").Replace("+", "")
tmpVal = tmpVal.PadLeft(tmpsize - 1, "0")
tmpVal = tmpPlusMinus & tmpVal
Else
tmpVal = tmpVal.PadLeft(tmpsize - 1, "0")
tmpVal = "+" & tmpVal
End If
Dim buf As String
' GW2018. Write debug info is field overflows.
If tmpVal.Length > tmpsize Then
sw2 = New StreamWriter("core_debug_overflow.txt", True)
buf = ">>>CoreWarning. MenuOptionWeb.PutDataTextTable. Subfile: " + strFileColumn + ". Column overflow on column " + j.ToString() _
+ " named: " + dt.Columns(j).ColumnName.ToUpper +
"Dictionary column size=" + tmpsize.ToString() + ", data value size = " + tmpVal.Length.ToString() + ", value=" + tmpVal
sw2.Write(buf.ToString)
sw2.Flush()
sw2.Close()
sw2.Dispose()
End If
strFileText.Append(tmpVal)
End If
ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
If IsNull(dt.Rows(i)(j)) OrElse dt.Rows(i)(j) = #12:00:00 AM# Then
strFileText.Append(" ")
Else
Dim dateTimeInfo As DateTime = dt.Rows(i)(j)
strFileText.Append(
dateTimeInfo.Year.ToString & dateTimeInfo.Month.ToString.PadLeft(2, "0") &
dateTimeInfo.Day.ToString.PadLeft(2, "0"))
End If
Else
strFileText.Append(
dt.Rows(i)(j).ToString.PadRight(hslenght.Item(dt.Columns(j).ColumnName.ToLower)).
Substring(0, hslenght.Item(dt.Columns(j).ColumnName.ToLower)))
End If
End If
Next
intRowcount = intRowcount + 1
If intRowcount > 4999 Then
intRowcount = 0
If strFileText.ToString.Length > 0 Then
'My.Computer.FileSystem.WriteAllText(strFile, strFileText.ToString, True)
'sw = New StreamWriter(strFile + "debug", blnAppend)
sw = New StreamWriter(strFile, blnAppend)
blnAppend = True
blnFileExists = True
sw.Write(strFileText.ToString)
sw.Flush()
sw.Close()
sw.Dispose()
sw = Nothing
GC.Collect()
strFileText.Remove(0, strFileText.Length)
blnWriteBlankFile = False
End If
End If
Next
If strFileText.ToString.Length > 0 OrElse blnWriteBlankFile Then
'My.Computer.FileSystem.WriteAllText(strFile, strFileText.ToString, True)
'If strFileColumn.EndsWith(".psd") Then
' sw = New StreamWriter(strFile + "", blnAppend)
'Else
' sw = New StreamWriter(strFile + "debug", blnAppend)
'End If
sw = New StreamWriter(strFile + "", blnAppend)
sw.Write(strFileText.ToString)
sw.Flush()
sw.Close()
sw.Dispose()
sw = Nothing
GC.Collect()
strFileText.Remove(0, strFileText.Length)
End If
If Not strFileName.ToUpper.EndsWith("_TEMP") AndAlso Not IsNothing(strSubFiles) AndAlso strSubFiles.Length > 0 Then
For i As Integer = 0 To strSubFiles.Length - 1
Dim strVariable As String = String.Empty
Dim strSubFile As String = String.Empty
Dim strSubFileName As String = String.Empty
Dim strSubFileGroup As String = String.Empty
Dim strSubFileAccount As String = String.Empty
Dim strFileStatement As String = String.Empty
Dim intRecordLength As Integer = 0
' Determine File Statement, Record Length, Variable Name and SubFileName.Group.Account
If strSubFiles(i).ToString.Contains("~"c) Then
strFileStatement = strSubFiles(i).ToString.Split("~"c)(0)
intRecordLength = strSubFiles(i).ToString.Split("~"c)(1)
If strFileStatement.Contains("="c) AndAlso intRecordLength > 0 Then
strVariable = strFileStatement.Split("="c)(0)
strSubFile = strFileStatement.Split("="c)(1)
Select Case strSubFile.Split("."c).Length
Case 1
strSubFileName = strSubFile.Split("."c)(0)
strSubFileGroup = Me.Session(UniqueSessionID + "m_strGROUP")
strSubFileAccount = Me.Session(UniqueSessionID + "m_strACCOUNT")
Case 2
strSubFileName = strSubFile.Split("."c)(0)
strSubFileGroup = strSubFile.Split("."c)(1)
strSubFileAccount = Me.Session(UniqueSessionID + "m_strACCOUNT")
Case 3
strSubFileName = strSubFile.Split("."c)(0)
strSubFileGroup = strSubFile.Split("."c)(1)
strSubFileAccount = strSubFile.Split("."c)(2)
End Select
If strVariable.Trim = strFileName.Trim Then
Dim arrMoveFiles As ArrayList
Dim strPass As String = strVariable & "~" & strSubFileName & "~" & strSubFileGroup &
"~" & strSubFileAccount & "~" & intRecordLength
arrMoveFiles = Session(UniqueSessionID + "arrMoveFiles")
If IsNothing(arrMoveFiles) Then
arrMoveFiles = New ArrayList
End If
If Not arrMoveFiles.Contains(strPass) Then
arrMoveFiles.Add(strPass)
End If
Session(UniqueSessionID + "arrMoveFiles") = arrMoveFiles
End If
End If
End If
Next
End If
aFileInfo = New FileInfo(strFile)
If m_blnDidLock AndAlso aFileInfo.Attributes Then
aFileInfo.Attributes = aFileInfo.Attributes Or FileAttributes.ReadOnly
End If
aFileInfo = Nothing
Catch ex As Exception
WriteError(ex)
Finally
dt.Dispose()
dt = Nothing
End Try
End Function
Private Function GetOverpunchDigit(value As String, positive As Boolean) As String
If positive Then
Select Case value.ToUpper()
Case "0"
Return "{"
Case "1"
Return "A"
Case "2"
Return "B"
Case "3"
Return "C"
Case "4"
Return "D"
Case "5"
Return "E"
Case "6"
Return "F"
Case "7"
Return "G"
Case "8"
Return "H"
Case "9"
Return "I"
End Select
Else
Select Case value.ToUpper()
Case "0"
Return "}"
Case "1"
Return "J"
Case "2"
Return "K"
Case "3"
Return "L"
Case "4"
Return "M"
Case "5"
Return "N"
Case "6"
Return "O"
Case "7"
Return "P"
Case "8"
Return "Q"
Case "9"
Return "R"
Case Else
Return 0
End Select
End If
End Function
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function DeleteDataTextTable(strFileName As String, Optional ByVal IsKeep As Boolean = False,
Optional ByVal blnDeleteSubFile As Boolean = False) As Boolean
Dim strFilePath As String = Directory.GetCurrentDirectory()
Dim strFilePath2 As String = Directory.GetCurrentDirectory() & "\" &
Session(UniqueSessionID + "m_strUser") & "_" &
Session(UniqueSessionID + "m_strSessionID")
Dim strFileColumn As String = strFilePath
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strFileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".psd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".psd"
End If
Else
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & strFileName & ".sfd"
Else
strFileColumn = strFilePath & "\" & strFileName & ".sfd"
End If
End If
Dim strFile As String = String.Empty
Dim strFileText As New StringBuilder("")
Dim strText As String = String.Empty
Dim strTextName As String = String.Empty
strFileText.Remove(0, strFileText.Length)
Dim intRowcount As Integer = 0
Dim strName As String = String.Empty
Try
If File.Exists(strFileColumn) Then
File.Delete(strFileColumn)
End If
If File.Exists(strFileColumn.Replace(strFilePath, strFilePath2)) Then
File.Delete(strFileColumn.Replace(strFilePath, strFilePath2))
End If
If IsNothing(Me.Session(UniqueSessionID + "strSubFileName")) Then
strTextName = strFileName
Else
strTextName = Me.Session(UniqueSessionID + "strSubFileName").ToString
If strTextName.IndexOf(".") >= 0 Then
strName = strTextName.Substring(0, strTextName.IndexOf("."))
strTextName = strTextName.Substring(strTextName.IndexOf(".") + 1)
strTextName = strTextName.Replace(".", "\") & "\" & strName
End If
End If
If strFile.EndsWith("\") Then
strFile = strFilePath & strTextName.Replace("JS", "SD")
Else
strFile = strFilePath & "\" & strTextName.Replace("JS", "SD")
End If
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strFileName) Then
strFile = strFile + ".ps"
Else
strFile = strFile + ".sf"
End If
If File.Exists(strFile) Then
File.Delete(strFile)
End If
If File.Exists(strFile + "debug") Then
File.Delete(strFile + "debug")
End If
If File.Exists(strFile.Replace(strFilePath, strFilePath2)) Then
File.Delete(strFile.Replace(strFilePath, strFilePath2))
End If
If blnDeleteSubFile Then
If IsKeep Then
File.CreateText(strFile)
End If
End If
hsSubConverted.Remove(strFileName)
Catch ex As Exception
End Try
End Function
Public Function Select_If() As Boolean
Try
Dim returnSelectIf As Boolean
If blnDeleteSubFile OrElse (m_blnGetSQL AndAlso blnGotSQL <> BooleanTypes.True) Then
Return True
Else
returnSelectIf = SelectIf()
End If
If Not returnSelectIf Then
intTransactions -= 1
If intTransactions = 0 Then
blnHasRunSubfile = False
End If
End If
Return returnSelectIf
Catch ex As CustomApplicationException
WriteError(ex)
Return False
Catch ex As Exception
WriteError(ex)
Return False
End Try
End Function
Public Overridable Function SelectIf() As Boolean
Return False
End Function
#If TARGET_DB = "INFORMIX" Then
#Else
Protected Sub TruncateTable(strSchema As String, strName As String)
Dim objReader As SqlDataReader = Nothing
Try
Dim strSQL As New StringBuilder("")
Dim connectionString As String = GetConnectionString()
'If Not strSchema.Contains(".dbo") Then
' strSchema = strSchema & ".dbo."
'End If
strSQL.Append("SELECT * FROM ").Append("").Append("sysobjects WHERE TYPE='U' AND NAME='").Append(
strName).Append("'")
objReader = SqlHelper.ExecuteReader(connectionString, CommandType.Text, strSQL.ToString)
If objReader.Read Then
strName = strSchema & strName
SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, "TRUNCATE TABLE " & strName.ToLower)
End If
Catch ex As Exception
WriteError(ex)
Finally
If Not IsNothing(objReader) Then
objReader.Close()
objReader = Nothing
End If
End Try
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As OracleTransaction, strName As String, blnCondition As Boolean,
SubType As SubFileType, ByVal ParamArray Include() As Object)
If blnCondition OrElse blnDeleteSubFile Then
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As OracleTransaction, strName As String, blnAt As Boolean,
blnCondition As Boolean, SubType As SubFileType, ByVal ParamArray Include() As Object)
If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, blnCondition As Boolean,
SubType As SubFileType, Mode As SubFileMode, ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
If blnCondition OrElse blnDeleteSubFile Then
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
End If
If Not Session(UniqueSessionID + "hsSubfileKeepText").Contains(strName) Then
Session(UniqueSessionID + "hsSubfileKeepText").add(strName,
SessionInformation.GetSession(
strName + "_Length", QTPSessionID))
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Remove(strName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
blnAppendSubFile = False
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, blnCondition As Boolean,
SubType As SubFileType, ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
If blnCondition OrElse blnDeleteSubFile Then
If Include(0).GetType.ToString = "Core.Framework.Core.Framework.SubFileMode" Then
If Include(0) = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
End If
ElseIf Include(0) = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Remove(strName)
End If
End If
If Include(0) = SubFileMode.Append Then blnAppendSubFile = True
End If
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
Else
' If the condition isn't met, ensure that we still save the table structure so that if used in another
' SubFile call (ie. with mode Append), that we don't get a Variable or object block variable not set error.
If _
SubType = SubFileType.Keep OrElse
SubType = SubFileType.Portable OrElse
SubType = SubFileType.KeepText AndAlso Not Session(UniqueSessionID + "hsSubFileKeepText") Is Nothing _
AndAlso
(Not CType(Session(UniqueSessionID + "hsSubFileKeepText"), Hashtable).Contains(strName) OrElse
CType(Session(UniqueSessionID + "hsSubFileKeepText"), Hashtable).Item(strName) Is Nothing) Then
SubFile(strName, SubType, Include)
End If
End If
End Sub
' This SubFile should only be called to create the structure that is stored and
' used by the Session(UniqueSessionID + "hsSubFileKeepText"). (COLONIAL - NPP20)
Public Sub SubFile(strName As String, SubType As SubFileType, ByVal ParamArray Include() As Object)
Dim objReader As SqlDataReader
Dim strSQL As New StringBuilder("")
Dim strCreateTableSQL As New StringBuilder("")
Dim strInsertRowSQL As New StringBuilder("")
Dim intTableCount As Integer = 0
Dim fleTemp As SqlFileObject
Dim strColumns As String = String.Empty
Dim strValues As String = String.Empty
Dim strDataValues As String = String.Empty
Dim strCreateTable As String = String.Empty
Dim strSchema As String = ConfigurationManager.AppSettings("SubFileSchema") & ""
Dim IsKeepText As Boolean = (ConfigurationManager.AppSettings("SubfileKEEPtoTEXT") & "").ToUpper = "TRUE"
Dim intSubFileRow As Integer = 0
Dim SubTotalValue As String = String.Empty
Dim hsLenght As New Hashtable
Dim hsSubfileKeepText As SortedList
hsSubfileKeepText = Session(UniqueSessionID + "hsSubfileKeepText")
Dim strCulture As String = ConfigurationManager.AppSettings("Culture") & ""
Dim strSubfileNumeric As String = ConfigurationManager.AppSettings("SubFileNumeric") & ""
Dim strConnect As String = GetConnectionString()
If strCulture.Length > 0 Then
strCulture = " COLLATE " & strCulture
End If
If SubType = SubFileType.KeepText Then
IsKeepText = True
SubType = SubFileType.Keep
End If
If strSchema.Length > 0 Then
strSchema = strSchema & "."
End If
Dim dt As DataTable
Dim dc As DataColumn
Dim rw As DataRow
Dim arrColumns() As String
Dim arrValues() As String
If IsKeepText AndAlso SubType <> SubFileType.Keep AndAlso SubType <> SubFileType.Portable Then
Session(UniqueSessionID + "alSubTempFile").Add(strName & "_" & Session("SessionID"))
End If
If SubType = SubFileType.Portable Then
If IsNothing(Session("PortableSubFiles")) Then
Session("PortableSubFiles") = New ArrayList
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
Else
If Not DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strName) Then
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
End If
End If
End If
' If we have a temp table that is kept in memory, store the INTEGER or DECIMAL columns in
' a hashtable to determine the decimal value decimal.
Dim htDecimals As Hashtable = Nothing
Dim hasItemCache As Boolean = False
If SubType = SubFileType.Temp Then
hasItemCache = Not Session(strName + "_DataTypes") Is Nothing
If Not hasItemCache Then htDecimals = New Hashtable
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
dt = Session(UniqueSessionID + "hsSubfile").Item(strName)
blnQTPSubFile = True
If IsNothing(dt) Then
intSubFileRow = 1
dt = New DataTable(strName)
Else
intSubFileRow = dt.Rows.Count + 1
blnAppendSubFile = False
End If
Else
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
DeleteDataTextTable(strName, False)
End If
dt = New DataTable(strName)
blnQTPSubFile = False
intSubFileRow = 1
End If
If blnDeleteSubFile Then
blnDeletedSubFile = True
End If
blnHasRunSubfile = True
Try
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("CREATE TABLE ")
If strSchema <> "" Then
strCreateTableSQL.Append(strSchema).Append(strName)
Else
strCreateTableSQL.Append(strName)
End If
End If
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' strInsertRowSQL.Append(" INSERT INTO ")
' If strSchema <> "" Then
' strInsertRowSQL.Append(strSchema).Append(strName)
' Else
' strInsertRowSQL.Append(strName)
' End If
'End If
'Find the tables and Colunms
For i As Integer = 0 To Include.Length - 1
Select Case Include(i).GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.SQLFILEOBJECT"
intTableCount = intTableCount + 1
fleTemp = Include(i)
If fleTemp.m_dtbDataTable Is Nothing Then
fleTemp.CreateDataStructure()
End If
If i = Include.Length - 1 OrElse Include(i + 1).GetType.ToString <> "System.String" Then
For j As Integer = 0 To fleTemp.Columns.Count - 1
If _
fleTemp.Columns.Item(j).ColumnName <> "ROW_ID" AndAlso
fleTemp.Columns.Item(j).ColumnName <> "CHECKSUM_VALUE" Then
Select Case fleTemp.GetObjectType(fleTemp.Columns.Item(j).ColumnName)
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(fleTemp.GetStringValue(fleTemp.Columns.Item(j).ColumnName)) & "~"
'strDataValues = strDataValues & fleTemp.GetStringValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString) _
Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(fleTemp.GetStringValue(fleTemp.Columns.Item(j).ColumnName)) & "~"
'strDataValues = strDataValues & fleTemp.GetStringValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName)) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName))), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName)) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName))), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(fleTemp.Columns.Item(j).ColumnName.ToUpper,
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName))
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(fleTemp.Columns.Item(j).ColumnName.ToUpper,
"18,0")
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Int64")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower, 10)
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) & "~"
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
End If
Next
End If
Case "SYSTEM.STRING"
'build the Values
Select Case fleTemp.GetObjectType(Include(i))
Case ""
Dim message As String = "Error on subfile : " + strName + ". Column '" + Include(i) + "' from Table '" + fleTemp.BaseName + "' does not exist."
Dim ex As CustomApplicationException = New CustomApplicationException(message)
Throw ex
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) & "~"
'strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) & "~"
'strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i)))), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i)))), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(Include(i)).ToString.Replace("12:00:00 AM", "NULL") & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(Include(i).ToString.ToUpper,
fleTemp.GetDecimalSize(Include(i).ToString))
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(Include(i).ToString.ToUpper, "18,0")
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Int64")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower, 10)
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & "~"
'strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DCHARACTER", "CORE.FRAMEWORK.CORE.FRAMEWORK.DVARCHAR",
"CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(Include(i).Value) & "~"
'strDataValues = strDataValues & Include(i).Value & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & StringToField(Include(i).Value) & "~"
'strDataValues = strDataValues & Include(i).Value & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
End Try
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & Include(i).Value & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & Include(i).Value.ToString.Replace("12:00:00 AM", "NULL") & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL", "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER",
"CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL", "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
Then
htDecimals.Add(Include(i).Name.ToString.ToUpper, "18,0")
Else
htDecimals.Add(Include(i).Name.ToString.ToUpper, "18,2")
End If
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") Then
dc.DataType = Type.GetType("System.Int64")
Else
dc.DataType = Type.GetType("System.Decimal")
End If
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
' AndAlso Include(i).IsSubtotal Then
' SubTotalValue = Include(i).SubTotalValue
' If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & SubTotalValue & "~"
' strDataValues = strDataValues & SubTotalValue & "~"
'Else
' If (Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso Include(i).IsMaximum Then
' SubTotalValue = Include(i).MaximumValue
' If SubType = SubFileType.Keep Then strValues = strValues & SubTotalValue & "~"
' strDataValues = strDataValues & SubTotalValue & "~"
' End If
' If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & Include(i).Value & "~"
' strDataValues = strDataValues & Include(i).Value & "~"
'End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
'AndAlso Include(i).IsSubtotal Then
' SubTotalValue = Include(i).SubTotalValue
' If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & SubTotalValue & "~"
' strDataValues = strDataValues & SubTotalValue & "~"
'Else
' If (Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso Include(i).IsMaximum Then
' SubTotalValue = Include(i).MaximumValue
' If SubType = SubFileType.Keep Then strValues = strValues & SubTotalValue & "~"
' strDataValues = strDataValues & SubTotalValue & "~"
' End If
' If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues & Include(i).Value & "~"
' strDataValues = strDataValues & Include(i).Value & "~"
'End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDATE", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
'strDataValues = strDataValues & Include(i).Value & "~"
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' strValues = strValues & GetDateFromYYYYMMDDDecimal(Include(i).Value).ToString.Replace("12:00:00 AM", "NULL") & "~"
' If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
' strValues = strValues & "Null"
' Else
' strValues = strValues & "CONVERT(DATETIME, " + StringToField(Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)), "yyyy-MM-dd HH:mm:ss")) + ", 120)"
' End If
' strValues = strValues & "~"
'End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
End Select
Next
'If Not strInsertRowSQL.ToString = "" Then
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then strValues = strValues.Substring(0, strValues.Length - 1)
'strDataValues = strDataValues.Substring(0, strDataValues.Length - 1)
strColumns = ""
For i As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns.Item(i).ColumnName.ToLower <> "row_id" AndAlso
dt.Columns.Item(i).ColumnName.ToLower <> "checksum_value" Then
strColumns = strColumns & dt.Columns(i).ColumnName & m_strDelimiter
End If
Next
strColumns = strColumns.Substring(0, strColumns.Length - 1)
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'create insert sql
'strInsertRowSQL.Append("(")
'strInsertRowSQL.Append(strColumns)
'strInsertRowSQL.Append(")")
'strInsertRowSQL.Append(" VALUES ")
'strInsertRowSQL.Append("(")
'strInsertRowSQL.Append(strValues)
'strInsertRowSQL.Append(")")
Else
If Not ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "CHECKSUM_VALUE"
dc.DataType = Type.GetType("System.Decimal")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "CHECKSUM_VALUE"
'strDataValues = strDataValues & "~" & "0"
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "ROW_ID"
dc.DataType = Type.GetType("System.String")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "ROW_ID"
'strDataValues = strDataValues & "~" & Now.TimeOfDay.TotalMilliseconds.ToString & (intSubFileRow).ToString
End If
arrColumns = strColumns.Split(m_strDelimiter)
'arrValues = strDataValues.Split("~")
'rw = dt.NewRow
'For j As Integer = 0 To dt.Columns.Count - 1
' If dt.Columns(j).DataType.ToString = "System.DateTime" AndAlso (arrValues(j) = "0" OrElse arrValues(j) = "") Then
' ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
' Dim dateTimeInfo As New DateTime(CInt(arrValues(j).ToString.PadRight(16, "0").Substring(0, 4)), CInt(arrValues(j).ToString.PadRight(16, "0").Substring(4, 2)), CInt(arrValues(j).ToString.PadRight(16, "0").Substring(6, 2)), CInt(arrValues(j).ToString.PadRight(16, "0").Substring(8, 2)), CInt(arrValues(j).ToString.PadRight(16, "0").Substring(10, 2)), CInt(arrValues(j).ToString.PadRight(16, "0").Substring(12, 4)))
' rw.Item(arrColumns(j)) = dateTimeInfo
' Else
' rw.Item(arrColumns(j)) = arrValues(j)
' End If
'Next
'dt.Rows.Add(rw)
strColumns = ""
End If
'End If
'Dim strConnect As String = GetConnectionString()
If Not blnQTPSubFile Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("(").Append(" ROWID uniqueidentifier NULL DEFAULT (newid()), ")
strCreateTableSQL.Append(strCreateTable).Append(" CHECKSUM_VALUE FLOAT DEFAULT 0 ").Append(")")
End If
'Check if table already exists
Dim blnKeepTable As Boolean
If IsNothing(ConfigurationManager.AppSettings("KeepSubFile")) Then
blnKeepTable = False
Else
blnKeepTable = ConfigurationManager.AppSettings("KeepSubFile").ToUpper = "TRUE"
End If
strSQL = New StringBuilder(String.Empty)
strSQL.Append("SELECT * FROM ").Append("").Append("sysobjects WHERE TYPE='U' AND NAME='").
Append(strName).Append("'")
objReader = SqlHelper.ExecuteReader(strConnect, CommandType.Text, strSQL.ToString)
If objReader.Read Then
strSQL.Remove(0, strSQL.Length)
If strSchema <> "" Then
strSQL.Append("DROP TABLE ").Append(strSchema).Append(strName)
Else
strSQL.Append("DROP TABLE ").Append(strName)
End If
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strSQL.ToString)
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'Table does not exists
'Create Table
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strCreateTableSQL.ToString)
End If
End If
'If (SubType = SubFileType.Keep AndAlso Not IsKeepText) Then
' SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strInsertRowSQL.ToString.Replace("~", ","))
'End If
If _
Not _
Session(UniqueSessionID + "hsSubfileKeepText").Contains(strName) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
ElseIf _
IsNothing(
Session(UniqueSessionID + "hsSubfileKeepText").Item(strName)) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Remove(strName)
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
End If
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not arrKeepFile.Contains(strName) Then
arrKeepFile.Add(strName)
End If
'If dt.Rows.Count > 399 Then
' PutDataTextTable(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
' dt.Clear()
'End If
End If
If SubType = SubFileType.Temp AndAlso Not hasItemCache AndAlso htDecimals.Count > 0 Then
Dim OnRemove As CacheItemRemovedCallback = Nothing
HttpContext.Current.Cache.Add(strName + "_DataTypes", htDecimals, Nothing, DateTime.Now.AddDays(1),
TimeSpan.Zero, CacheItemPriority.High, OnRemove)
End If
blnQTPSubFile = True
If (blnDeletedSubFile OrElse Not IsKeepText) AndAlso dt.Rows.Count > 0 Then
dt.Rows.RemoveAt(0)
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Item(strName) = dt
Else
Session(UniqueSessionID + "hsSubfile").Add(strName, dt)
End If
'AddRecordsRead(strName, 0, LogType.OutPut)
'AddRecordsRead(strName, 0, LogType.Added)
AddRecordsProcessed(strName, 0, LogType.Added)
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
Catch ex As Exception
WriteError(ex)
Finally
If Not IsNothing(objReader) Then
objReader.Close()
objReader = Nothing
End If
If Not IsNothing(dt) Then
dt.Dispose()
dt = Nothing
End If
If Not IsNothing(dc) Then
dc.Dispose()
dc = Nothing
End If
rw = Nothing
arrColumns = Nothing
arrValues = Nothing
hsLenght = Nothing
hsSubfileKeepText = Nothing
End Try
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, ByRef SubfileObject As SqlFileObject,
blnCondition As Boolean, SubType As SubFileType, ByVal ParamArray Include() As Object)
AddRecordsProcessed(SubfileObject.BaseName, SubfileObject.AliasName, 0, LogType.Added)
If blnCondition OrElse blnDeleteSubFile Then
If Include(0).GetType.ToString = "Core.Framework.Core.Framework.SubFileMode" Then
If Include(0) = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Include(0) = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Include(0) = SubFileMode.Append Then blnAppendSubFile = True
End If
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
Else
If Include(0).GetType.ToString = "Core.Framework.Core.Framework.SubFileMode" Then
If Include(0) = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Include(0) = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Include(0) = SubFileMode.Append Then blnAppendSubFile = True
End If
NoSubFileData = True
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
NoSubFileData = False
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, blnAt As Boolean,
blnCondition As Boolean, SubType As SubFileType, ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
If Include(0).GetType.ToString = "Core.Framework.Core.Framework.SubFileMode" Then
If Include(0) = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
End If
ElseIf Include(0) = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Remove(strName)
End If
End If
If Include(0) = SubFileMode.Append Then blnAppendSubFile = True
End If
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
Else
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, blnAt As Boolean,
blnCondition As Boolean, SubType As SubFileType, Mode As SubFileMode,
ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
'If Mode = SubFileMode.Append Then
' If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
' Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
' End If
'ElseIf Mode = SubFileMode.Overwrite Then
' If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
' Session(UniqueSessionID + "hsSubfile").Remove(strName)
' End If
'End If
'If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
' If Mode = SubFileMode.Append Then blnAppendSubFile = True
' SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
' blnAppendSubFile = False
'End If
If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Remove(strName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
blnAppendSubFile = False
Else
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, ByRef SubfileObject As SqlFileObject,
blnAt As Boolean, blnCondition As Boolean, SubType As SubFileType, Mode As SubFileMode,
ByVal ParamArray Include() As Object)
AddRecordsProcessed(SubfileObject.BaseName, SubfileObject.AliasName, 0, LogType.Added)
If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
blnAppendSubFile = False
Else
NoSubFileData = True
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
blnAppendSubFile = False
NoSubFileData = False
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, ByRef SubfileObject As SqlFileObject,
blnAt As Boolean, blnCondition As Boolean, SubType As SubFileType,
ByVal ParamArray Include() As Object)
AddRecordsProcessed(SubfileObject.BaseName, SubfileObject.AliasName, 0, LogType.Added)
If (blnCondition AndAlso blnAt) OrElse blnDeleteSubFile Then
If Include(0).GetType.ToString = "Core.Framework.Core.Framework.SubFileMode" Then
If Include(0) = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Include(0) = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Include(0) = SubFileMode.Append Then blnAppendSubFile = True
End If
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
Else
NoSubFileData = True
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
blnAppendSubFile = False
NoSubFileData = False
End If
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As OracleTransaction, strName As String, SubType As SubFileType,
ByVal ParamArray Include() As Object)
Dim objReader As OracleDataReader
Dim strSQL As New StringBuilder("")
Dim strCreateTableSQL As New StringBuilder("")
Dim strInsertRowSQL As New StringBuilder("")
Dim intTableCount As Integer = 0
Dim fleTemp As OracleFileObject
Dim strColumns As String = String.Empty
Dim strValues As String = String.Empty
Dim strDataValues As String = String.Empty
Dim strCreateTable As String = String.Empty
Dim strSchema As String = ConfigurationManager.AppSettings("SubFileSchema")
Dim IsKeepText As Boolean = (ConfigurationManager.AppSettings("SubfileKEEPtoTEXT") & "").ToUpper = "TRUE"
Dim intSubFileRow As Integer = 0
Dim SubTotalValue As String = String.Empty
Dim hsLenght As New Hashtable
Dim hsSubfileKeepText As SortedList
hsSubfileKeepText = Session(UniqueSessionID + "hsSubfileKeepText")
If NoSubFileData Then
If NoDataSubfile.Contains(strName) Then
Return
End If
NoDataSubfile.Add(strName)
End If
If SubType = SubFileType.KeepText Then
IsKeepText = True
SubType = SubFileType.Keep
End If
Dim dt As DataTable
Dim dc As DataColumn
Dim rw As DataRow
Dim arrColumns() As String
Dim arrValues() As String
If IsKeepText AndAlso SubType <> SubFileType.Keep AndAlso SubType <> SubFileType.Portable Then
Session(UniqueSessionID + "alSubTempFile").Add(strName & "_" & Session("SessionID"))
End If
If SubType = SubFileType.Portable Then
If IsNothing(Session("PortableSubFiles")) Then
Session("PortableSubFiles") = New ArrayList
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
Else
If Not DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strName) Then
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
End If
End If
End If
Dim strSubfileNumeric As String = ConfigurationManager.AppSettings("SubFileNumeric")
If IsNothing(strSubfileNumeric) Then
strSubfileNumeric = " FLOAT"
Else
strSubfileNumeric = " " & strSubfileNumeric.Trim.ToUpper()
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
dt = Session(UniqueSessionID + "hsSubfile").Item(strName)
blnQTPSubFile = True
If IsNothing(dt) Then
intSubFileRow = 1
dt = New DataTable(strName)
Else
intSubFileRow = dt.Rows.Count + 1
blnAppendSubFile = False
End If
Else
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
DeleteDataTextTable(strName, False)
End If
dt = New DataTable(strName)
blnQTPSubFile = False
intSubFileRow = 1
End If
If blnDeleteSubFile Then
blnDeletedSubFile = True
End If
blnHasRunSubfile = True
Try
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("CREATE TABLE ")
If strSchema <> "" Then
strCreateTableSQL.Append(strSchema).Append(strName)
Else
strCreateTableSQL.Append(strName)
End If
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strInsertRowSQL.Append(" INSERT INTO ")
If strSchema <> "" Then
strInsertRowSQL.Append(strSchema).Append(strName)
Else
strInsertRowSQL.Append(strName)
End If
End If
'Find the tables and Colunms
For i As Integer = 0 To Include.Length - 1
Select Case Include(i).GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.ORACLEFILEOBJECT"
intTableCount = intTableCount + 1
fleTemp = Include(i)
If i = Include.Length - 1 OrElse Include(i + 1).GetType.ToString <> "System.String" Then
For j As Integer = 0 To fleTemp.Columns.Count - 1
If _
fleTemp.Columns.Item(j).ColumnName <> "ROW_ID" AndAlso
fleTemp.Columns.Item(j).ColumnName <> "CHECKSUM_VALUE" Then
Select Case fleTemp.GetObjectType(fleTemp.Columns.Item(j).ColumnName)
Case "System.String"
Try
If Not blnQTPSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
" VARCHAR("
strCreateTable = strCreateTable &
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName) & "),"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString) _
Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString & " VARCHAR("
strCreateTable = strCreateTable &
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName) & "),"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
" DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Int32", "System.Int64",
"System.Single"
Try
If Not blnQTPSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
strSubfileNumeric & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso
Not IsKeepText Then
strCreateTable = strCreateTable &
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString & strSubfileNumeric & ","
End If
End Try
End Select
End If
Next
End If
Case "SYSTEM.STRING"
'build the Values
Select Case fleTemp.GetObjectType(Include(i))
Case ""
Dim message As String = "Error on subfile : " + strName + ". Column '" + Include(i) + "' from Table '" + fleTemp.BaseName + "' does not exist."
Dim ex As CustomApplicationException = New CustomApplicationException(message)
Throw ex
Case "System.String"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i)) Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & " VARCHAR("
strCreateTable = strCreateTable & fleTemp.GetObjectSize(Include(i)) & "),"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & intNextCol.ToString &
" VARCHAR("
strCreateTable = strCreateTable & fleTemp.GetObjectSize(Include(i)) & "),"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i)) Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & fleTemp.GetDateValue(Include(i)) & m_strDelimiter
strDataValues = fleTemp.GetNumericDateTimeValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & fleTemp.GetDateValue(Include(i)) & m_strDelimiter
strDataValues = fleTemp.GetNumericDateTimeValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & intNextCol.ToString &
" DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Int32", "System.Int64", "System.Single"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i)) Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & strSubfileNumeric & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText _
Then
strCreateTable = strCreateTable & Include(i) & intNextCol.ToString &
strSubfileNumeric & ","
End If
End Try
End Select
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DCHARACTER", "CORE.FRAMEWORK.CORE.FRAMEWORK.DVARCHAR",
"CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i).Name) Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & " VARCHAR("
strCreateTable = strCreateTable & Include(i).Size & "),"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & intNextCol.ToString &
" VARCHAR("
strCreateTable = strCreateTable & Include(i).Size & "),"
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL", "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER",
"CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL", "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i).Name) Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") Then
dc.DataType = Type.GetType("System.Int64")
Else
dc.DataType = Type.GetType("System.Decimal")
End If
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & strSubfileNumeric & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimaling")
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & intNextCol.ToString &
strSubfileNumeric & ","
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDATE", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile AndAlso Not dt.Columns.Contains(Include(i).Name) Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTable = strCreateTable & Include(i).Name & intNextCol.ToString &
" DATETIME,"
End If
End Try
End Select
Next
'If Not strInsertRowSQL.ToString = "" Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then _
strValues = strValues.Substring(0, strValues.Length - 1)
strDataValues = strDataValues.Substring(0, strDataValues.Length - 1)
strColumns = ""
For i As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns.Item(i).ColumnName.ToLower <> "row_id" AndAlso
dt.Columns.Item(i).ColumnName.ToLower <> "checksum_value" Then
strColumns = strColumns & dt.Columns(i).ColumnName & m_strDelimiter
End If
Next
strColumns = strColumns.Substring(0, strColumns.Length - 1)
strColumns.Remove(strColumns.Length - 1, 1)
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
'create insert sql
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strColumns)
strInsertRowSQL.Append(")")
strInsertRowSQL.Append(" VALUES ")
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strValues)
strInsertRowSQL.Append(")")
Else
If Not blnQTPSubFile Then
dc = New DataColumn()
dc.ColumnName = "CHECKSUM_VALUE"
dc.DataType = Type.GetType("System.Decimal")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "CHECKSUM_VALUE"
'strValues = strValues & "~" & "0" ' Not used
strDataValues = strDataValues & m_strDelimiter & "0"
If Not blnQTPSubFile Then
dc = New DataColumn()
dc.ColumnName = "ROW_ID"
dc.DataType = Type.GetType("System.String")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "ROW_ID"
'strValues = strValues & "~" & StringToField(Now.TimeOfDay.TotalMilliseconds.ToString & (intSubFileRow).ToString) ' Not used
strDataValues = strDataValues & m_strDelimiter & Now.TimeOfDay.TotalMilliseconds.ToString &
(intSubFileRow).ToString
arrColumns = strColumns.Split(m_strDelimiter)
arrValues = strDataValues.Split(m_strDelimiter)
rw = dt.NewRow
For j As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns(j).DataType.ToString = "System.DateTime" AndAlso
(arrValues(j) = "0" OrElse arrValues(j) = "") Then
ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
Dim _
dateTimeInfo As _
New DateTime(CInt(arrValues(j).ToString.PadRight(16, "0").Substring(0, 4)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(4, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(6, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(8, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(10, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(12, 4)))
rw.Item(arrColumns(j)) = dateTimeInfo
Else
rw.Item(arrColumns(j)) = arrValues(j)
End If
Next
dt.Rows.Add(rw)
'strValues = "" ' Not used
strColumns = ""
End If
'End If
If Not blnQTPSubFile Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
strCreateTableSQL.Append("(").Append(strCreateTable).Append(" CHECKSUM_VALUE NUMBER ").Append(
")")
End If
'Check if table already exists
Dim blnKeepTable As Boolean
If IsNothing(ConfigurationManager.AppSettings("KeepSubFile")) Then
blnKeepTable = False
Else
blnKeepTable = ConfigurationManager.AppSettings("KeepSubFile").ToUpper = "TRUE"
End If
strSQL = New StringBuilder(String.Empty)
If strSchema <> "" Then
strSQL.Append("SELECT * from ALL_TABLES WHERE TABLE_NAME = '").Append(strName).Append(
"' AND OWNER = ").Append(StringToField(strSchema))
Else
strSQL.Append("SELECT * from ALL_TABLES WHERE TABLE_NAME = '").Append(strName).Append(
"' AND OWNER = USER ")
End If
objReader = OracleHelper.ExecuteReader(m_trnTRANS_UPDATE, CommandType.Text, strSQL.ToString)
If objReader.Read Then
strSQL.Remove(0, strSQL.Length)
If strSchema <> "" Then
strSQL.Append("DROP TABLE ").Append(strSchema).Append(".").Append(strName)
Else
strSQL.Append("DROP TABLE ").Append(strName)
End If
OracleHelper.ExecuteNonQuery(m_trnTRANS_UPDATE, CommandType.Text, strSQL.ToString)
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
'Table does not exists
'Create Table
OracleHelper.ExecuteNonQuery(m_trnTRANS_UPDATE, CommandType.Text, strCreateTableSQL.ToString)
End If
End If
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText Then
OracleHelper.ExecuteNonQuery(m_trnTRANS_UPDATE, CommandType.Text,
strInsertRowSQL.ToString.Replace(m_strDelimiter, ","))
End If
If _
Not _
Session(UniqueSessionID + "hsSubfileKeepText").Contains(strName) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
ElseIf _
IsNothing(
Session(UniqueSessionID + "hsSubfileKeepText").Item(strName)) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Remove(strName)
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
End If
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not arrKeepFile.Contains(strName) Then
arrKeepFile.Add(strName)
End If
If dt.Rows.Count > 399 Then
PutDataTextTable(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
dt.Clear()
End If
End If
blnQTPSubFile = True
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Item(strName) = dt
Else
Session(UniqueSessionID + "hsSubfile").Add(strName, dt)
End If
'AddRecordsRead(strName, 0, LogType.OutPut)
If blnDeletedSubFile Then
'AddRecordsRead(strName, 0, LogType.Added)
AddRecordsProcessed(strName, 0, LogType.Added)
Else
'AddRecordsRead(strName, 1, LogType.Added)
AddRecordsProcessed(strName, 1, LogType.Added)
End If
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
Catch ex As Exception
End Try
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, SubType As SubFileType,
Mode As SubFileMode, ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Add(strName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Remove(strName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, strName, SubType, Include)
blnAppendSubFile = False
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, ByRef SubfileObject As SqlFileObject,
SubType As SubFileType, Mode As SubFileMode, ByVal ParamArray Include() As Object)
If Mode = SubFileMode.Append Then
If Not Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Add(SubfileObject.BaseName, Nothing)
End If
ElseIf Mode = SubFileMode.Overwrite Then
If Session(UniqueSessionID + "hsSubfile").Contains(SubfileObject.BaseName) Then
Session(UniqueSessionID + "hsSubfile").Remove(SubfileObject.BaseName)
End If
End If
If Mode = SubFileMode.Append Then blnAppendSubFile = True
SubFile(m_trnTRANS_UPDATE, SubfileObject, SubType, Include)
blnAppendSubFile = False
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, ByRef SubfileObject As SqlFileObject,
SubType As SubFileType, ByVal ParamArray Include() As Object)
AddRecordsProcessed(SubfileObject.BaseName, SubfileObject.AliasName, 0, LogType.Added)
Dim objReader As SqlDataReader
Dim strSQL As New StringBuilder("")
Dim strCreateTableSQL As New StringBuilder("")
Dim strInsertRowSQL As New StringBuilder("")
Dim intTableCount As Integer = 0
Dim fleTemp As SqlFileObject
Dim strColumns As String = String.Empty
Dim strValues As String = String.Empty
Dim strDataValues As String = String.Empty
Dim strCreateTable As String = String.Empty
Dim strSchema As String = ConfigurationManager.AppSettings("SubFileSchema") & ""
Dim IsKeepText As Boolean = (ConfigurationManager.AppSettings("SubfileKEEPtoTEXT") & "").ToUpper = "TRUE"
Dim intSubFileRow As Integer = 0
Dim SubTotalValue As String = String.Empty
Dim hsLenght As New Hashtable
Dim hsSubfileKeepText As SortedList
hsSubfileKeepText = Session(UniqueSessionID + "hsSubfileKeepText")
Dim strName As String = SubfileObject.BaseName
Dim strSubfileNumeric As String = ConfigurationManager.AppSettings("SubFileNumeric") & ""
Dim strCulture As String = ConfigurationManager.AppSettings("Culture") & ""
Dim strConnect As String = GetConnectionString()
If SubType = SubFileType.KeepSQL
SubType = SubFileType.Keep
IsKeepText = False
End If
If NoSubFileData Then
If SubfileObject.AliasName <> "" Then
If NoDataSubfile.Contains(SubfileObject.AliasName) Then
Return
End If
NoDataSubfile.Add(SubfileObject.AliasName)
Else
If NoDataSubfile.Contains(SubfileObject.BaseName) Then
Return
End If
NoDataSubfile.Add(SubfileObject.BaseName)
End If
End If
If strCulture.Length > 0 Then
strCulture = " COLLATE " & strCulture
End If
If SubType = SubFileType.KeepText Then
IsKeepText = True
SubType = SubFileType.Keep
End If
If strSchema.Length > 0 Then
strSchema = strSchema & "."
End If
Dim dt As DataTable
Dim dc As DataColumn
Dim rw As DataRow
Dim arrColumns() As String
Dim arrValues() As String
If IsKeepText AndAlso SubType <> SubFileType.Keep AndAlso SubType <> SubFileType.Portable Then
Session(UniqueSessionID + "alSubTempFile").Add(strName & "_" & Session("SessionID"))
End If
If SubType = SubFileType.Portable Then
If IsNothing(Session("PortableSubFiles")) Then
Session("PortableSubFiles") = New ArrayList
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
Else
If Not DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strName) Then
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
End If
End If
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
dt = Session(UniqueSessionID + "hsSubfile").Item(strName)
blnQTPSubFile = True
If IsNothing(dt) Then
intSubFileRow = 1
dt = New DataTable(strName)
Else
intSubFileRow = dt.Rows.Count + 1
blnAppendSubFile = False
End If
Else
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
DeleteDataTextTable(strName, False)
End If
dt = New DataTable(strName)
blnQTPSubFile = False
intSubFileRow = 1
End If
If blnDeleteSubFile Then
blnDeletedSubFile = True
End If
blnHasRunSubfile = True
Try
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("CREATE TABLE ")
If strSchema <> "" Then
strCreateTableSQL.Append(strSchema).Append(strName)
Else
strCreateTableSQL.Append(strName)
End If
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strInsertRowSQL.Append(" INSERT INTO ")
If strSchema <> "" Then
strInsertRowSQL.Append(strSchema).Append(strName)
Else
strInsertRowSQL.Append(strName)
End If
End If
'Find the tables and Colunms
For i As Integer = 0 To Include.Length - 1
Select Case Include(i).GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.SQLFILEOBJECT"
intTableCount = intTableCount + 1
fleTemp = Include(i)
If fleTemp.m_dtbDataTable Is Nothing Then
fleTemp.CreateDataStructure()
End If
If i = Include.Length - 1 OrElse Include(i + 1).GetType.ToString <> "System.String" Then
For j As Integer = 0 To fleTemp.Columns.Count - 1
If _
fleTemp.Columns.Item(j).ColumnName <> "ROW_ID" AndAlso
fleTemp.Columns.Item(j).ColumnName <> "CHECKSUM_VALUE" Then
Select Case fleTemp.GetObjectType(fleTemp.Columns.Item(j).ColumnName)
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString) _
Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName)) = cZeroDate _
Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).
ColumnName))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName)) = cZeroDate _
Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).
ColumnName))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Int64")
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).
Item(
fleTemp.Columns.Item(j).ColumnName.
ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(fleTemp.Columns.Item(j).ColumnName.ToLower,
10)
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
End If
Next
End If
Case "SYSTEM.STRING"
'build the Values
Select Case fleTemp.GetObjectType(Include(i))
Case ""
Dim message As String = "Error on subfile : " + strName + ". Column '" + Include(i) + "' from Table '" + fleTemp.BaseName + "' does not exist."
Dim ex As CustomApplicationException = New CustomApplicationException(message)
Throw ex
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) =
cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(Include(i)))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(Include(i)) &
m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) =
cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(Include(i)))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(Include(i)).ToString.Replace(
"12:00:00 AM", "NULL") & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Int64")
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower, 10)
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DCHARACTER", "CORE.FRAMEWORK.CORE.FRAMEWORK.DVARCHAR",
"CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
End Try
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value.ToString.Replace("12:00:00 AM", "NULL") &
m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL", "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER",
"CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL", "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") Then
dc.DataType = Type.GetType("System.Int64")
Else
dc.DataType = Type.GetType("System.Decimal")
End If
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) Then strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
Dim tmpsizeval As String = Include(i).Value
If Include(i).Size > 0 AndAlso tmpsizeval.Length > Include(i).Size Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & tmpsizeval.Substring(0, Include(i).Size) & m_strDelimiter
strDataValues = strDataValues & tmpsizeval.Substring(0, Include(i).Size) & m_strDelimiter
Else
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & tmpsizeval & m_strDelimiter
strDataValues = strDataValues & tmpsizeval & m_strDelimiter
End If
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) Then strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
Dim tmpsizeval As String = Include(i).Value
If Include(i).Size > 0 AndAlso tmpsizeval.Length > Include(i).Size Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & tmpsizeval.Substring(0, Include(i).Size) & m_strDelimiter
strDataValues = strDataValues & tmpsizeval.Substring(0, Include(i).Size) & m_strDelimiter
Else
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & tmpsizeval & m_strDelimiter
strDataValues = strDataValues & tmpsizeval & m_strDelimiter
End If
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDATE", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strValues = strValues &
GetDateFromYYYYMMDDDecimal(Include(i).Value).ToString.Replace(
"12:00:00 AM", "NULL") & m_strDelimiter
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
End Select
Next
'If Not strInsertRowSQL.ToString = "" Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues.Substring(0, strValues.Length - 1)
If strDataValues <> "" Then
strDataValues = strDataValues.Substring(0, strDataValues.Length - 1)
End If
strColumns = ""
For i As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns.Item(i).ColumnName.ToLower <> "row_id" AndAlso
dt.Columns.Item(i).ColumnName.ToLower <> "checksum_value" Then
strColumns = strColumns & dt.Columns(i).ColumnName & m_strDelimiter
End If
Next
If strColumns <> "" Then
strColumns = strColumns.Substring(0, strColumns.Length - 1)
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'create insert sql
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strColumns)
strInsertRowSQL.Append(")")
strInsertRowSQL.Append(" VALUES ")
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strValues)
strInsertRowSQL.Append(")")
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "CHECKSUM_VALUE"
dc.DataType = Type.GetType("System.Decimal")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "CHECKSUM_VALUE"
'strValues = strValues & "~" & "0" ' Not used
strDataValues = strDataValues & m_strDelimiter & "0"
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "ROW_ID"
dc.DataType = Type.GetType("System.String")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "ROW_ID"
'strValues = strValues & "~" & StringToField(Now.TimeOfDay.TotalMilliseconds.ToString & (intSubFileRow).ToString) ' Not used
strDataValues = strDataValues & m_strDelimiter & Now.TimeOfDay.TotalMilliseconds.ToString &
(intSubFileRow).ToString
arrColumns = strColumns.Split(m_strDelimiter)
arrValues = strDataValues.Split(m_strDelimiter)
rw = dt.NewRow
For j As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns(j).DataType.ToString = "System.DateTime" AndAlso
(arrValues(j) = "0" OrElse arrValues(j) = "") Then
ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
Dim _
dateTimeInfo As _
New DateTime(CInt(arrValues(j).ToString.PadRight(16, "0").Substring(0, 4)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(4, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(6, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(8, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(10, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(12, 4)))
rw.Item(arrColumns(j)) = dateTimeInfo
ElseIf dt.Columns(j).DataType.ToString = "System.Decimal" Then
If arrValues(j).Trim = "" Then
rw.Item(arrColumns(j)) = 0
ElseIf arrValues(j).Trim = 0 Then
rw.Item(arrColumns(j)) = Convert.ToDecimal(arrValues(j))
Else
rw.Item(arrColumns(j)) = arrValues(j)
End If
Else
rw.Item(arrColumns(j)) = arrValues(j)
End If
Next
dt.Rows.Add(rw)
'strValues = "" ' Not used
strColumns = ""
SubfileObject.m_dtbDataTable = dt
SubfileObject.blnOverRideOccurrence = True
SubfileObject.OverRideOccurrence = dt.Rows.Count - 1
SubfileObject.Occurs = dt.Rows.Count
SubfileObject.SubfileInit(dt.Rows.Count - 1)
SubfileObject.IsInitialized = True
SubfileObject.RaiseSetItemFinals()
dt = SubfileObject.m_dtbDataTable
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
Dim strNewValues As String = String.Empty
For i As Integer = 0 To dt.Columns.Count - 1
If dt.Columns(i).ColumnName <> "CHECKSUM_VALUE" AndAlso dt.Columns(i).ColumnName <> "ROW_ID" _
Then
If dt.Columns(i).DataType.ToString = "System.DateTime" Then
If _
IsNull(dt.Rows(dt.Rows.Count - 1)(i)) OrElse
dt.Rows(dt.Rows.Count - 1)(i) = #12:00:00 AM# Then
strNewValues = strNewValues & "NULL, "
Else
strNewValues = strNewValues &
"CONVERT(DATETIME, " +
StringToField(Format(dt.Rows(dt.Rows.Count - 1)(i),
"yyyy-MM-dd HH:mm:ss")) + ", 120), "
End If
ElseIf _
dt.Columns(i).DataType.ToString = "System.Decimal" OrElse
dt.Columns(i).DataType.ToString = "System.Double" OrElse
dt.Columns(i).DataType.ToString = "System.Integer" Then
strNewValues = strNewValues & dt.Rows(dt.Rows.Count - 1)(i).ToString & ", "
Else
'strNewValues = strNewValues & "'" & dt.Rows(dt.Rows.Count - 1)(i).ToString & "', "
strNewValues = strNewValues & StringToField(dt.Rows(dt.Rows.Count - 1)(i).ToString) &
", "
End If
End If
Next
strNewValues = strNewValues.Substring(0, strNewValues.Length - 2)
strInsertRowSQL = New StringBuilder(strInsertRowSQL.ToString.Replace(strValues, strNewValues))
End If
'Dim strConnect As String = GetConnectionString()
If Not blnQTPSubFile Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("(").Append(" ROWID uniqueidentifier NULL DEFAULT (newid()), ")
strCreateTableSQL.Append(strCreateTable).Append(" CHECKSUM_VALUE FLOAT DEFAULT 0 ").Append(")")
End If
'Check if table already exists
Dim blnKeepTable As Boolean
If IsNothing(ConfigurationManager.AppSettings("KeepSubFile")) Then
blnKeepTable = False
Else
blnKeepTable = ConfigurationManager.AppSettings("KeepSubFile").ToUpper = "TRUE"
End If
strSQL = New StringBuilder(String.Empty)
strSQL.Append("SELECT * FROM ").Append("sysobjects WHERE TYPE='U' AND NAME='").
Append(strName).Append("'")
objReader = SqlHelper.ExecuteReader(strConnect, CommandType.Text, strSQL.ToString)
If objReader.Read Then
strSQL.Remove(0, strSQL.Length)
If strSchema <> "" Then
strSQL.Append("DROP TABLE ").Append(strSchema).Append(".").Append(strName)
Else
strSQL.Append("DROP TABLE ").Append(strName)
End If
Try
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strSQL.ToString.Replace("..", "."))
Catch ex As Exception
End Try
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'Table does not exists
'Create Table
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strCreateTableSQL.ToString)
End If
End If
If Not NoSubFileData AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) AndAlso Not blnDeletedSubFile Then
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strInsertRowSQL.ToString.Replace(m_strDelimiter, ","))
End If
If _
Not _
Session(UniqueSessionID + "hsSubfileKeepText").Contains(strName) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
ElseIf _
IsNothing(
Session(UniqueSessionID + "hsSubfileKeepText").Item(strName)) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Remove(strName)
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
End If
If NoSubFileData Then
dt.Rows.RemoveAt(dt.Rows.Count - 1)
End If
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not arrKeepFile.Contains(strName) Then
arrKeepFile.Add(strName)
End If
' GW2018. Added. As soon as we formed the first record, create the MiniDictionary
'g_recordCount = g_recordCount + 1
'If (g_recordCount = 1) Then
WriteMiniDictionaryFile(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
'End If
If dt.Rows.Count > 4999 Then
PutDataTextTable(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
blnOver5000Records = True
dt.Clear()
End If
End If
blnQTPSubFile = True
If (blnDeletedSubFile OrElse Not IsKeepText) AndAlso dt.Rows.Count > 0 Then
dt.Rows.RemoveAt(0)
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Item(strName) = dt
Else
Session(UniqueSessionID + "hsSubfile").Add(strName, dt)
End If
'AddRecordsRead(strName, 0, LogType.OutPut)
Dim processedname As String
If SubfileObject.AliasName <> "" Then
processedname = SubfileObject.AliasName
If Not arrSubFiles.Contains(processedname) Then
arrSubFiles.Add(processedname)
If (Not m_hsFileInOutput.Contains(processedname)) Then
m_hsFileInOutput.Add(processedname, processedname)
End If
End If
Else
processedname = strName
End If
If blnDeletedSubFile OrElse NoSubFileData Then
'AddRecordsRead(strName, 0, LogType.Added)
AddRecordsProcessed(processedname, 0, LogType.Added)
Else
'AddRecordsRead(strName, 1, LogType.Added)
AddRecordsProcessed(processedname, 1, LogType.Added)
End If
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
Catch ex As Exception
WriteError(ex)
Finally
If Not IsNothing(objReader) Then
objReader.Close()
objReader = Nothing
End If
If Not IsNothing(dt) Then
dt.Dispose()
dt = Nothing
End If
If Not IsNothing(dc) Then
dc.Dispose()
dc = Nothing
End If
rw = Nothing
arrColumns = Nothing
arrValues = Nothing
hsLenght = Nothing
hsSubfileKeepText = Nothing
End Try
End Sub
Public Sub SubFile(ByRef m_trnTRANS_UPDATE As SqlTransaction, strName As String, SubType As SubFileType,
ByVal ParamArray Include() As Object)
AddRecordsProcessed(strName, 0, LogType.Added)
Dim objReader As SqlDataReader
Dim strSQL As New StringBuilder("")
Dim strCreateTableSQL As New StringBuilder("")
Dim strInsertRowSQL As New StringBuilder("")
Dim intTableCount As Integer = 0
Dim fleTemp As SqlFileObject
Dim strColumns As String = String.Empty
Dim strValues As String = String.Empty
Dim strDataValues As String = String.Empty
Dim strCreateTable As String = String.Empty
Dim strSchema As String = ConfigurationManager.AppSettings("SubFileSchema") & ""
Dim IsKeepText As Boolean = (ConfigurationManager.AppSettings("SubfileKEEPtoTEXT") & "").ToUpper = "TRUE"
Dim intSubFileRow As Integer = 0
Dim SubTotalValue As String = String.Empty
Dim hsLenght As New Hashtable
Dim hsSubfileKeepText As SortedList
hsSubfileKeepText = Session(UniqueSessionID + "hsSubfileKeepText")
Dim strCulture As String = ConfigurationManager.AppSettings("Culture") & ""
Dim strSubfileNumeric As String = ConfigurationManager.AppSettings("SubFileNumeric") & ""
Dim strConnect As String = GetConnectionString()
If SubType = SubFileType.KeepSQL
SubType = SubFileType.Keep
IsKeepText = False
End If
If NoSubFileData Then
If NoDataSubfile.Contains(strName) Then
Return
End If
NoDataSubfile.Add(strName)
End If
If strCulture.Length > 0 Then
strCulture = " COLLATE " & strCulture
End If
If SubType = SubFileType.KeepText Then
IsKeepText = True
SubType = SubFileType.Keep
End If
If strSchema.Length > 0 Then
strSchema = strSchema & "."
End If
Dim dt As DataTable
Dim dt2 As DataTable
Dim dt2_Value As DataTable
Dim dc As DataColumn
Dim rw As DataRow
Dim arrColumns() As String
Dim arrValues() As String
If IsKeepText AndAlso SubType <> SubFileType.Keep AndAlso SubType <> SubFileType.Portable Then
Session(UniqueSessionID + "alSubTempFile").Add(strName & "_" & Session("SessionID"))
End If
If SubType = SubFileType.Portable Then
If IsNothing(Session("PortableSubFiles")) Then
Session("PortableSubFiles") = New ArrayList
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
Else
If Not DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strName) Then
DirectCast(Session("PortableSubFiles"), ArrayList).Add(strName)
End If
End If
End If
' If we have a temp table that is kept in memory, store the INTEGER or DECIMAL columns in
' a hashtable to determine the decimal value decimal.
Dim htDecimals As Hashtable = Nothing
Dim hasItemCache As Boolean = False
If SubType = SubFileType.Temp Then
hasItemCache = Not Session(strName + "_DataTypes") Is Nothing
If Not hasItemCache Then htDecimals = New Hashtable
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
dt = Session(UniqueSessionID + "hsSubfile").Item(strName)
blnQTPSubFile = True
If IsNothing(dt) Then
intSubFileRow = 1
dt = New DataTable(strName)
Else
intSubFileRow = dt.Rows.Count + 1
blnAppendSubFile = False
End If
Else
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
DeleteDataTextTable(strName, False)
End If
dt = New DataTable(strName)
blnQTPSubFile = False
intSubFileRow = 1
End If
If blnDeleteSubFile Then
blnDeletedSubFile = True
End If
blnHasRunSubfile = True
Try
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("CREATE TABLE ")
If strSchema <> "" Then
strCreateTableSQL.Append(strSchema).Append(strName)
Else
strCreateTableSQL.Append(strName)
End If
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strInsertRowSQL.Append(" INSERT INTO ")
If strSchema <> "" Then
strInsertRowSQL.Append(strSchema).Append(strName)
Else
strInsertRowSQL.Append(strName)
End If
End If
'Find the tables and Colunms
For i As Integer = 0 To Include.Length - 1
Select Case Include(i).GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.SQLFILEOBJECT"
intTableCount = intTableCount + 1
fleTemp = Include(i)
If fleTemp.m_dtbDataTable Is Nothing Then
fleTemp.CreateDataStructure()
End If
'Get all the the record structure of the file object
If i = Include.Length - 1 OrElse Include(i + 1).GetType.ToString <> "System.String" Then
For j As Integer = 0 To fleTemp.Columns.Count - 1
If _
fleTemp.Columns.Item(j).ColumnName <> "ROW_ID" AndAlso
fleTemp.Columns.Item(j).ColumnName <> "CHECKSUM_VALUE" Then
Select Case fleTemp.GetObjectType(fleTemp.Columns.Item(j).ColumnName)
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If Not hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString) _
Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName)
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName)))
dc.MaxLength =
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " &
strCulture & " NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName)) = cZeroDate _
Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).
ColumnName))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName)) = cZeroDate _
Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).
ColumnName))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(fleTemp.Columns.Item(j).ColumnName.ToUpper,
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName))
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName &
" DECIMAL(" &
fleTemp.GetDecimalSize(
fleTemp.Columns.Item(j).ColumnName.
ToLower) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(fleTemp.Columns.Item(j).ColumnName.ToUpper,
"18,0")
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 _
Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower, 10)
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do _
While _
dt.Columns.Contains(
fleTemp.Columns.Item(j).ColumnName & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = fleTemp.Columns.Item(j).ColumnName &
intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If _
VAL(
fleTemp.GetObjectSize(
fleTemp.Columns.Item(j).ColumnName.ToLower)) <> 0 Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower) Then
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
fleTemp.Columns.Item(j).ColumnName.ToLower))
Else
If _
Not _
hsLenght.Contains(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString) Then _
hsLenght.Add(
fleTemp.Columns.Item(j).ColumnName.ToLower &
intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
strDataValues = strDataValues &
fleTemp.GetDecimalValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
If _
Not blnQTPSubFile AndAlso
((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
End If
Next
End If
Case "SYSTEM.STRING"
'build the Values
Select Case fleTemp.GetObjectType(Include(i))
Case ""
Dim message As String = "Error on subfile : " + strName + ". Column '" + Include(i) + "' from Table '" + fleTemp.BaseName + "' does not exist."
Dim ex As CustomApplicationException = New CustomApplicationException(message)
Throw ex
Case "System.String"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
dc.MaxLength =
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower)
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
dc.MaxLength = CInt(fleTemp.GetObjectSize(Include(i).ToString))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) &
m_strDelimiter
strDataValues = strDataValues & fleTemp.GetStringValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture &
" NULL ,"
End If
End Try
Case "System.DateTime"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) =
cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(Include(i)))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & fleTemp.GetNumericDateTimeValue(Include(i)) &
m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
GetDateFromYYYYMMDDDecimal(fleTemp.GetNumericDateTimeValue(Include(i))) =
cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(
CDate(
GetDateFromYYYYMMDDDecimal(
fleTemp.GetNumericDateTimeValue(Include(i)))),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues &
fleTemp.GetNumericDateTimeValue(Include(i)).ToString.Replace(
"12:00:00 AM", "NULL") & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "System.Decimal", "System.Double", "System.Single"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(Include(i).ToString.ToUpper,
fleTemp.GetDecimalSize(Include(i).ToString))
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
CInt(fleTemp.GetObjectSize(Include(i).ToString)))
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
If strSubfileNumeric.Length > 0 Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(" &
fleTemp.GetDecimalSize(Include(i).ToString) & "),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT,"
End If
End If
End Try
Case "System.Int32", "System.Int64"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
htDecimals.Add(Include(i).ToString.ToUpper, "18,0")
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i)
dc.DataType = Type.GetType("System.Int64")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If Not hsLenght.Contains(Include(i).ToString.ToLower) Then _
hsLenght.Add(Include(i).ToString.ToLower, 10)
End If
End If
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i) & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i) & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If fleTemp.GetObjectSize(Include(i).ToString).Trim <> "" Then
If _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower & intNextCol.ToString) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower &
intNextCol.ToString))
ElseIf _
hsSubfileKeepText.Contains(fleTemp.BaseName) AndAlso
hsSubfileKeepText.Item(fleTemp.BaseName).Contains(
Include(i).ToString.ToLower.ToLower) Then
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString,
hsSubfileKeepText.Item(fleTemp.BaseName).Item(
Include(i).ToString.ToLower.ToLower))
Else
If _
Not _
hsLenght.Contains(Include(i).ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).ToString.ToLower & intNextCol.ToString, 10)
End If
End If
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
strDataValues = strDataValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) _
Then
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End Try
End Select
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DCHARACTER", "CORE.FRAMEWORK.CORE.FRAMEWORK.DVARCHAR",
"CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.String")
If Include(i).Size > 0 Then
dc.MaxLength = Include(i).Size
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " VARCHAR("
strCreateTable = strCreateTable & dc.MaxLength & ") " & strCulture & " NULL ,"
End If
End Try
Case "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
'build the columns
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value.ToString.Replace("12:00:00 AM", "NULL") &
m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL", "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER",
"CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL", "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
Try
' If we have an integer or decimal in a temp table that is stored in memory,
' save the decimal value ("18,0" for integer, "18,2" if decimal 2, etc.)
If SubType = SubFileType.Temp AndAlso Not hasItemCache Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
Then
htDecimals.Add(Include(i).Name.ToString.ToUpper, "18,0")
Else
htDecimals.Add(Include(i).Name.ToString.ToUpper, "18,2")
End If
End If
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
If (Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") Then
dc.DataType = Type.GetType("System.Int64")
Else
dc.DataType = Type.GetType("System.Decimal")
End If
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower) Then _
hsLenght.Add(Include(i).Name.ToString.ToLower, Include(i).Size)
End If
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) Then strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.Decimal")
If Include(i).Size > 0 Then
If Not hsLenght.Contains(Include(i).Name.ToString.ToLower & intNextCol.ToString) _
Then _
hsLenght.Add(Include(i).Name.ToString.ToLower & intNextCol.ToString,
Include(i).Size)
End If
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If _
(Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") _
AndAlso Include(i).IsSubtotal Then
SubTotalValue = Include(i).SubTotalValue
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
Else
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER") AndAlso
Include(i).IsMaximum Then
SubTotalValue = Include(i).MaximumValue
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) Then strValues = strValues & SubTotalValue & m_strDelimiter
strDataValues = strDataValues & SubTotalValue & m_strDelimiter
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues & Include(i).Value & m_strDelimiter
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If _
(Include(i).GetType.ToString.ToUpper = "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL" OrElse
Include(i).GetType.ToString.ToUpper = "CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL") Then
strCreateTable = strCreateTable & dc.ColumnName & " DECIMAL(18,2),"
Else
strCreateTable = strCreateTable & dc.ColumnName & " FLOAT" & ","
End If
End If
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDATE", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = Include(i).Name
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
End If
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
strDataValues = strDataValues & Include(i).Value & m_strDelimiter
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
Catch ex As Exception
Dim intNextCol As Integer = 2
Do While dt.Columns.Contains(Include(i).Name & intNextCol.ToString)
intNextCol = intNextCol + 1
Loop
dc = New DataColumn()
dc.ColumnName = Include(i).Name & intNextCol.ToString
dc.DataType = Type.GetType("System.DateTime")
dt.Columns.Add(dc)
strColumns = strColumns & Include(i).Name & m_strDelimiter
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strValues = strValues &
GetDateFromYYYYMMDDDecimal(Include(i).Value).ToString.Replace(
"12:00:00 AM", "NULL") & m_strDelimiter
If GetDateFromYYYYMMDDDecimal(Include(i).Value) = cZeroDate Then
strValues = strValues & "Null"
Else
strValues = strValues &
"CONVERT(DATETIME, " +
StringToField(
Format(CDate(GetDateFromYYYYMMDDDecimal(Include(i).Value)),
"yyyy-MM-dd HH:mm:ss")) + ", 120)"
End If
strValues = strValues & m_strDelimiter
End If
If Not blnQTPSubFile AndAlso ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTable = strCreateTable & dc.ColumnName & " DATETIME,"
End If
End Try
End Select
Next
'If Not strInsertRowSQL.ToString = "" Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then _
strValues = strValues.Substring(0, strValues.Length - 1)
strDataValues = strDataValues.Substring(0, strDataValues.Length - 1)
strColumns = ""
For i As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns.Item(i).ColumnName.ToLower <> "row_id" AndAlso
dt.Columns.Item(i).ColumnName.ToLower <> "checksum_value" Then
strColumns = strColumns & dt.Columns(i).ColumnName & m_strDelimiter
End If
Next
strColumns = strColumns.Substring(0, strColumns.Length - 1)
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'create insert sql
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strColumns)
strInsertRowSQL.Append(")")
strInsertRowSQL.Append(" VALUES ")
strInsertRowSQL.Append("(")
strInsertRowSQL.Append(strValues)
strInsertRowSQL.Append(")")
Else
If Not ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "CHECKSUM_VALUE"
dc.DataType = Type.GetType("System.Decimal")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "CHECKSUM_VALUE"
'strValues = strValues & "~" & "0" ' Not used
strDataValues = strDataValues & m_strDelimiter & "0"
If Not blnQTPSubFile OrElse blnAppendSubFile Then
dc = New DataColumn()
dc.ColumnName = "ROW_ID"
dc.DataType = Type.GetType("System.String")
dt.Columns.Add(dc)
End If
'build the columns
strColumns = strColumns & m_strDelimiter & "ROW_ID"
'strValues = strValues & "~" & StringToField(Now.TimeOfDay.TotalMilliseconds.ToString & (intSubFileRow).ToString) ' Not used
strDataValues = strDataValues & m_strDelimiter & Now.TimeOfDay.TotalMilliseconds.ToString &
(intSubFileRow).ToString
End If
arrColumns = strColumns.Split(m_strDelimiter)
arrValues = strDataValues.Split(m_strDelimiter)
rw = dt.NewRow
For j As Integer = 0 To dt.Columns.Count - 1
If _
dt.Columns(j).DataType.ToString = "System.DateTime" AndAlso
(arrValues(j) = "0" OrElse arrValues(j) = "") Then
ElseIf dt.Columns(j).DataType.ToString = "System.DateTime" Then
Dim _
dateTimeInfo As _
New DateTime(CInt(arrValues(j).ToString.PadRight(16, "0").Substring(0, 4)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(4, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(6, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(8, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(10, 2)),
CInt(arrValues(j).ToString.PadRight(16, "0").Substring(12, 4)))
rw.Item(arrColumns(j)) = dateTimeInfo
Else
rw.Item(arrColumns(j)) = arrValues(j)
End If
Next
dt.Rows.Add(rw)
'strValues = "" ' Not used
strColumns = ""
End If
'End If
'Dim strConnect As String = GetConnectionString()
If Not blnQTPSubFile Then
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
strCreateTableSQL.Append("(").Append(" ROWID uniqueidentifier NULL DEFAULT (newid()), ")
strCreateTableSQL.Append(strCreateTable).Append(" CHECKSUM_VALUE FLOAT DEFAULT 0 ").Append(")")
End If
'Check if table already exists
Dim blnKeepTable As Boolean
If IsNothing(ConfigurationManager.AppSettings("KeepSubFile")) Then
blnKeepTable = False
Else
blnKeepTable = ConfigurationManager.AppSettings("KeepSubFile").ToUpper = "TRUE"
End If
strSQL = New StringBuilder(String.Empty)
strSQL.Append("SELECT * FROM ").Append("").Append("sysobjects WHERE TYPE='U' AND NAME='").
Append(strName).Append("'")
objReader = SqlHelper.ExecuteReader(strConnect, CommandType.Text, strSQL.ToString)
If objReader.Read Then
strSQL.Remove(0, strSQL.Length)
If strSchema <> "" Then
strSQL.Append("DROP TABLE ").Append(strSchema).Append(strName)
Else
strSQL.Append("DROP TABLE ").Append(strName)
End If
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strSQL.ToString)
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) Then
'Table does not exists
'Create Table
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strCreateTableSQL.ToString)
End If
End If
If ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not IsKeepText) AndAlso Not blnDeletedSubFile Then
SqlHelper.ExecuteNonQuery(strConnect, CommandType.Text, strInsertRowSQL.ToString.Replace(m_strDelimiter, ","))
End If
If _
Not _
Session(UniqueSessionID + "hsSubfileKeepText").Contains(strName) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
ElseIf _
IsNothing(
Session(UniqueSessionID + "hsSubfileKeepText").Item(strName)) _
Then
Session(UniqueSessionID + "hsSubfileKeepText").Remove(strName)
Session(UniqueSessionID + "hsSubfileKeepText").Add(strName,
hsLenght)
End If
If SubType = SubFileType.TempText OrElse ((SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso IsKeepText) Then
If (SubType = SubFileType.Keep OrElse SubType = SubFileType.Portable) AndAlso Not arrKeepFile.Contains(strName) Then
arrKeepFile.Add(strName)
End If
' GW2018. Added. As soon as we formed the first record, create the MiniDictionary
'g_recordCount = g_recordCount + 1
'If (g_recordCount = 1) Then
WriteMiniDictionaryFile(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
'End If
If dt.Rows.Count > 4999 Then
PutDataTextTable(strName, dt, Session(UniqueSessionID + "hsSubfileKeepText").Item(strName))
blnOver5000Records = True
dt.Clear()
End If
End If
blnQTPSubFile = True
If (blnDeletedSubFile OrElse Not IsKeepText) AndAlso dt.Rows.Count > 0 Then
dt.Rows.RemoveAt(0)
End If
If Session(UniqueSessionID + "hsSubfile").Contains(strName) Then
Session(UniqueSessionID + "hsSubfile").Item(strName) = dt
Else
Session(UniqueSessionID + "hsSubfile").Add(strName, dt)
End If
'AddRecordsRead(strName, 0, LogType.OutPut)
If blnDeletedSubFile Then
'AddRecordsRead(strName, 0, LogType.Added)
AddRecordsProcessed(strName, 0, LogType.Added)
Else
'AddRecordsRead(strName, 1, LogType.Added)
AddRecordsProcessed(strName, 1, LogType.Added)
End If
If Not arrSubFiles.Contains(strName) Then
arrSubFiles.Add(strName)
If (Not m_hsFileInOutput.Contains(strName)) Then
m_hsFileInOutput.Add(strName, strName)
End If
End If
Catch ex As Exception
WriteError(ex)
Finally
If Not IsNothing(objReader) Then
objReader.Close()
objReader = Nothing
End If
If Not IsNothing(dt) Then
dt.Dispose()
dt = Nothing
End If
If Not IsNothing(dc) Then
dc.Dispose()
dc = Nothing
End If
rw = Nothing
arrColumns = Nothing
arrValues = Nothing
hsLenght = Nothing
hsSubfileKeepText = Nothing
End Try
End Sub
Public Function GetSubSize(size As Integer, datatype As String) As Integer
If datatype = "System.Integer" OrElse datatype = "System.Int64" Then
Select Case size
Case 1
Return 6
Case 2
Return 6
Case 3
Return 6
Case 4
Return 6
Case 5
Return 11
Case 6
Return 11
Case 7
Return 11
Case 8
Return 11
Case 9
Return 11
Case 10
Return 16
Case 11
Return 16
Case 12
Return 16
Case 13
Return 16
Case 14
Return 16
Case Else
Return 21
End Select
Else
' Commented out the addition + 1 here. Moved to WriteMiniDictionary
'Return size + 1
Return size
End If
End Function
Private Function GetTextTableStructure(ByVal fileName As String) As DataTable
Dim strFilePath As String = ""
Dim strFileColumn As String = strFilePath
strFilePath = Directory.GetCurrentDirectory()
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(fileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & fileName & ".psd"
Else
strFileColumn = strFilePath & "\" & fileName & ".psd"
End If
Else
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & fileName & ".sfd"
Else
strFileColumn = strFilePath & "\" & fileName & ".sfd"
End If
End If
If Not File.Exists(strFileColumn) Then
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(fileName) Then
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & fileName & ".psd"
Else
strFileColumn = strFilePath & "\" & fileName & ".psd"
End If
Else
If strFileColumn.EndsWith("\") Then
strFileColumn = strFilePath & fileName & ".sfd"
Else
strFileColumn = strFilePath & "\" & fileName & ".sfd"
End If
End If
End If
Dim strFile As String = String.Empty
Dim sr As New StreamReader(strFileColumn)
Dim dt As New DataTable
Dim strText As String = String.Empty
Dim arrStructure() As String
Dim intPlaceholder As Integer = 0
Dim intLinelength As Integer = 0
Dim hsLength As New Hashtable
Dim strTextName As String = String.Empty
Dim dc As DataColumn
Try
strText = sr.ReadLine
Do While Not IsNothing(strText)
arrStructure = strText.Split(",")
dc = New DataColumn()
dc.ColumnName = arrStructure(0)
dc.DataType = System.Type.GetType(arrStructure(1))
hsLength.Add(arrStructure(0), arrStructure(2))
dt.Columns.Add(dc)
intLinelength = intLinelength + VAL(arrStructure(2))
strText = sr.ReadLine
Loop
sr.Close()
Return dt
Catch ex As Exception
Return dt
End Try
End Function
Public Sub WriteSub(ByVal ParamArray Include() As Object)
Dim fleTemp As SqlFileObject
Dim intTableCount As Integer = 0
Dim strValues As String = String.Empty
Dim strColumns As String = String.Empty
For i As Integer = 0 To Include.Length - 1
Select Case Include(i).GetType.ToString.ToUpper
Case "CORE.WINDOWS.UI.CORE.WINDOWS.SQLFILEOBJECT"
intTableCount = intTableCount + 1
fleTemp = Include(i)
If i = Include.Length - 1 OrElse Include(i + 1).GetType.ToString <> "System.String" Then
For j As Integer = 0 To fleTemp.Columns.Count - 1
If _
fleTemp.Columns.Item(j).ColumnName <> "ROW_ID" AndAlso
fleTemp.Columns.Item(j).ColumnName <> "CHECKSUM_VALUE" Then
strColumns = strColumns & fleTemp.Columns.Item(j).ColumnName & m_strDelimiter
Select Case fleTemp.GetObjectType(fleTemp.Columns.Item(j).ColumnName)
Case "System.String"
Try
strValues = strValues &
StringToField(
fleTemp.GetStringValue(
fleTemp.Columns.Item(j).ColumnName)) & m_strDelimiter
Catch ex As Exception
End Try
Case "System.DateTime"
Try
strValues = strValues &
fleTemp.GetNumericDateTimeValue(
fleTemp.Columns.Item(j).ColumnName) & m_strDelimiter
Catch ex As Exception
End Try
Case "System.Decimal", "System.Double", "System.Int32", "System.Single"
Try
strValues = strValues &
fleTemp.GetDecimalValue(fleTemp.Columns.Item(j).ColumnName) &
m_strDelimiter
Catch ex As Exception
End Try
End Select
End If
Next
End If
Case "SYSTEM.STRING"
'build the Values
Select Case fleTemp.GetObjectType(Include(i))
Case "System.String"
Try
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
strValues = strValues & StringToField(fleTemp.GetStringValue(Include(i))) & m_strDelimiter
Catch ex As Exception
End Try
Case "System.DateTime"
Try
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
strValues = strValues & fleTemp.GetDateValue(Include(i)) & m_strDelimiter
Catch ex As Exception
End Try
Case "System.Decimal", "System.Double", "System.Int32", "System.Single"
Try
'build the columns
strColumns = strColumns & Include(i) & m_strDelimiter
strValues = strValues & fleTemp.GetDecimalValue(Include(i)) & m_strDelimiter
Catch ex As Exception
End Try
End Select
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DCHARACTER", "CORE.FRAMEWORK.CORE.FRAMEWORK.DVARCHAR",
"CORE.WINDOWS.UI.CORE.WINDOWS.CORECHARACTER", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
strColumns = strColumns & Include(i).Name & m_strDelimiter
strValues = strValues & StringToField(Include(i).Value) & m_strDelimiter
Catch ex As Exception
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDECIMAL", "CORE.FRAMEWORK.CORE.FRAMEWORK.DINTEGER",
"CORE.WINDOWS.UI.CORE.WINDOWS.COREDECIMAL", "CORE.WINDOWS.UI.CORE.WINDOWS.COREINTEGER"
Try
strColumns = strColumns & Include(i).Name & m_strDelimiter
strValues = strValues & Include(i).Value & m_strDelimiter
Catch ex As Exception
End Try
Case "CORE.FRAMEWORK.CORE.FRAMEWORK.DDATE", "CORE.WINDOWS.UI.CORE.WINDOWS.COREDATE"
Try
strColumns = strColumns & Include(i).Name & m_strDelimiter
strValues = strValues & Include(i).Value & m_strDelimiter
Catch ex As Exception
End Try
End Select
Next
If Not blnQTPSubFile Then
WriteLogFile(vbNewLine & strColumns.Replace(m_strDelimiter, ",") & vbNewLine)
blnQTPSubFile = True
End If
WriteLogFile(vbNewLine & strValues.Replace(m_strDelimiter, ",") & vbNewLine)
End Sub
Protected Function GetRPSystemval(strName As String, Optional ByVal blnNoSession As Boolean = False) As Object
Dim objReader As IDataReader
Dim strSQL As New StringBuilder("")
strSQL.Append("SELECT SYSTEM_VALUE FROM RPSYSTEMVAL ")
If blnNoSession Then
strSQL.Append(" WHERE SESSION_ID = ").Append(StringToField(" "))
Else
strSQL.Append(" WHERE SESSION_ID = ").Append(StringToField(NumberedSessionID.Value))
End If
strSQL.Append(" AND NAME = ").Append(StringToField(strName))
objReader = OracleHelper.ExecuteReader(GetConnectionString, CommandType.Text, strSQL.ToString)
If objReader.Read Then
Return objReader.Item(0).ToString()
Else
Return ""
End If
End Function
Public Sub ChangeSubName(strName As String, strPrefix As String, Optional ByVal strSuffix As String = "")
Dim strFiles() As String
strFiles = Directory.GetFiles(Directory.GetCurrentDirectory())
Dim strFilePath As String = Directory.GetCurrentDirectory()
If Not strFilePath.Trim.EndsWith("\") Then
strFilePath = strFilePath.Trim & "\"
End If
Dim intLastNumber As Integer = 0
Dim intTempNumber As Integer = 0
Dim sqlconnect As New SqlConnection(GetConnectionString)
Dim fi As FileInfo
Dim blnFoundMatch As Boolean = False
Dim CURRYEAR As String = ASCII(SysDate(sqlconnect), 8).Substring(2, 2)
Dim BEGYEAR As Decimal = NConvert(ASCII(SysDate(sqlconnect), 8).Substring(0, 4) + "0101")
Dim CURRDAYS As String = ASCII((Days(SysDate(sqlconnect)) - Days(BEGYEAR) + 1), 3)
Dim JULDAY As String = CURRYEAR + CURRDAYS
sqlconnect.Close()
sqlconnect.Dispose()
For i As Integer = 0 To strFiles.Length - 1
fi = New FileInfo(strFiles(i))
If blnFoundMatch AndAlso Not fi.Name.StartsWith(strPrefix + JULDAY) Then
Exit For
End If
If fi.Name.StartsWith(strPrefix + JULDAY) AndAlso (fi.Name.IndexOf(".sfd") <= 0 OrElse fi.Name.IndexOf(".psd") <= 0) Then
intTempNumber = VAL(fi.Name.Replace(strPrefix + JULDAY, ""))
If intTempNumber > intLastNumber Then
intLastNumber = intTempNumber
End If
blnFoundMatch = True
End If
Next
If File.Exists(strFilePath & strName) Then
fi = New FileInfo(strFilePath & strName)
If strSuffix.Length > 0 Then
If Not strSuffix.Trim.StartsWith(".") Then
strSuffix = "." & strSuffix.Trim
End If
fi.MoveTo(strFilePath & strPrefix + JULDAY + (intLastNumber + 1).ToString & strSuffix)
Else
fi.MoveTo(strFilePath & strPrefix + JULDAY + (intLastNumber + 1).ToString)
End If
If Not IsNothing(Session("PortableSubFiles")) AndAlso DirectCast(Session("PortableSubFiles"), ArrayList).Contains(strName) Then
If File.Exists(strFilePath & strName & ".psd") Then
fi = New FileInfo(strFilePath & strName & ".psd")
fi.MoveTo(strFilePath & strPrefix + JULDAY + (intLastNumber + 1).ToString & ".psd")
End If
Else
If File.Exists(strFilePath & strName & ".sfd") Then
fi = New FileInfo(strFilePath & strName & ".sfd")
fi.MoveTo(strFilePath & strPrefix + JULDAY + (intLastNumber + 1).ToString & ".sfd")
End If
End If
End If
fi = Nothing
End Sub
#End If
Protected Friend Sub MoveFile(SourceFileName As String, DestinationFileName As String)
' Update the Last Access Time to the Session Manager
SessionInformation.UpdateSessionAccessTime(UniqueSessionID)
Dim reportDirectory As String = ConfigurationManager.AppSettings("CompletedReportsPath")
Dim sharedDrive As String = ConfigurationManager.AppSettings("SharedDrive")
Dim fileName As String = String.Empty
Dim fileGroup As String = String.Empty
Dim fileAccount As String = String.Empty
Dim fileEquate As String = String.Empty
Dim variable As String = String.Empty
Dim extension As String = String.Empty
Dim destinationFile As String = String.Empty
Dim strUserId As String = Session(UniqueSessionID + "m_strUser")
strUserId = strUserId.Trim
' Determine the file equate variable and filename.
variable = DestinationFileName.Split("="c)(0).Trim
fileEquate = DestinationFileName.Split("="c)(1).Trim
' Get the file name, group and account.
Select Case fileEquate.Split("."c).Length
Case 1
fileName = fileEquate.Split("."c)(0)
fileGroup = Me.Session(UniqueSessionID + "m_strGROUP")
fileAccount = Me.Session(UniqueSessionID + "m_strACCOUNT")
Case 2
fileName = fileEquate.Split("."c)(0)
fileGroup = fileEquate.Split("."c)(1)
fileAccount = Me.Session(UniqueSessionID + "m_strACCOUNT")
Case 3
fileName = fileEquate.Split("."c)(0)
fileGroup = fileEquate.Split("."c)(1)
fileAccount = fileEquate.Split("."c)(2)
End Select
destinationFile = sharedDrive & "\" & variable
' Delete the file if it exists.
If My.Computer.FileSystem.FileExists(destinationFile) Then
My.Computer.FileSystem.DeleteFile(destinationFile)
End If
' Copy the file.
My.Computer.FileSystem.CopyFile(reportDirectory & "\" & strUserId & "\Reports\" & SourceFileName,
destinationFile)
Try
If SshConnectionOpen Then
Dim purge As Boolean = False
If Me.ScreenType = ScreenTypes.QTP OrElse Me.ScreenType = ScreenTypes.QUIZ Then purge = True
' Log the location of files moved to AMXW.
Dim fullName As String = fileName
If fileGroup Is Nothing Then fileGroup = String.Empty
If fileAccount Is Nothing Then fileAccount = String.Empty
If fileGroup.Trim.Length > 0 Then fullName &= "." & fileGroup
If fileAccount.Trim.Length > 0 Then fullName &= "." & fileAccount
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Transfer file to AMXW: ").Append(fullName).Append(", 0").Append(vbNewLine)
' Register file on AMXW.
Else
m_Error.Append(" ").Append("SSH connection failed, please contact IT support.").Append(
vbNewLine)
m_LogFile.Append(" ").Append("SSH connection failed, please contact IT support.").Append(
vbNewLine)
End If
Catch ex As Exception
WriteError(ex)
Finally
If m_LogFile.Length > 0 Then WriteLogFile(m_LogFile.ToString)
End Try
End Sub
Protected Friend Overridable Sub Request(strName As String)
Try
m_intMaxRecordsToRetrieve = -1
' Initialize the connections objects.
#If TARGET_DB = "INFORMIX" Then
cnnQUERY = Session(UniqueSessionID + "cnnQUERY")
cnnTRANS_UPDATE = Session(UniqueSessionID + "cnnTRANS_UPDATE")
trnTRANS_UPDATE = Session(UniqueSessionID + "trnTRANS_UPDATE")
If IsNothing(cnnTRANS_UPDATE) Then
cnnTRANS_UPDATE = New IfxConnection(GetInformixConnectionString)
cnnTRANS_UPDATE.Open()
trnTRANS_UPDATE = cnnTRANS_UPDATE.BeginTransaction
cnnQUERY = New IfxConnection(GetInformixConnectionString)
End If
Session.Remove(UniqueSessionID + "EOF")
#End If
Try
InitializeTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
Try
InitializeFiles()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
hsSubFileSize = Session(UniqueSessionID + "hsSubFileSize")
If IsNothing(hsSubFileSize) Then hsSubFileSize = New Hashtable
NumberedSessionID.Value = Session(UniqueSessionID + "NumberedSessionID")
QTPSessionID = Session(UniqueSessionID + "QTPSessionID")
CallInitializeInternalValues()
If IsNothing(Session(UniqueSessionID + "alSubTempFile")) Then _
Session(UniqueSessionID + "alSubTempFile") = New ArrayList
m_LogFile.Remove(0, m_LogFile.Length)
If Not IsNothing(Session("Log")) Then
m_LogFile.Append(vbNewLine).Append(Session("Log")).Append(vbNewLine)
Session("Log") = Nothing
End If
m_LogFile.Append(vbNewLine).Append(vbNewLine)
m_LogFile.Append("Run: ").Append(Me.Name).Append(vbNewLine)
m_LogFile.Append(("Request: " & strName).ToString.PadRight(40))
m_LogFile.Append(Now.Day.ToString.PadLeft(2, "0")).Append("/").Append(Now.Month.ToString.PadLeft(2, "0")) _
.Append("/").Append(Now.Year.ToString).Append(" ")
m_LogFile.Append(TimeOfDay.ToLongTimeString)
m_LogFile.Append(vbNewLine)
If m_ClassParameters.ToString().Trim() <> String.Empty Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Parameters").Append(vbNewLine)
m_LogFile.Append(m_ClassParameters.ToString())
m_ClassParameters.Remove(0, m_ClassParameters.Length)
End If
m_LogFile.Append(vbNewLine).Append(vbNewLine)
m_LogFile.Append("Records read:").Append(vbNewLine)
m_SortOrder = Nothing
m_intSortOrder = 0
blnQTPSubFile = False
If IsNothing(Session(UniqueSessionID + "hsSubfile")) Then
Session(UniqueSessionID + "hsSubfile") = New SortedList
End If
If IsNothing(Session(UniqueSessionID + "hsSubfileKeepText")) Then
Session(UniqueSessionID + "hsSubfileKeepText") = New SortedList
End If
GC.Collect()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
Protected Friend Overridable Sub WriteError(ex As CustomApplicationException)
Dim strError As String = String.Empty
If Not CancelQTPs Then
CurrentQTPCancel = True
End If
CancelQTPs = True
If ex.MessageText <> "" Then
strError = ex.MessageText
Else
strError = ex.Message
End If
If strError <> "No Records Found." Then 'IM.NoRecords
If strError.Length > 2 AndAlso strError.ToUpper.Substring(0, 3) = "IM." Then
strError = strError.Substring(3)
ElseIf strError.Trim = "Exception of type 'System.OutOfMemoryException' was thrown." Then
strError = "The Server does not have the required memory available."
End If
If Not strError.ToUpper.Substring(0, 3) = "IM." Then
ExceptionManager.Publish(ex)
End If
m_Error.Append(" ").Append(strError).Append(vbNewLine)
End If
End Sub
Protected Friend Overridable Sub WriteError(ex As Exception)
Dim strError As String = String.Empty
strError = ex.Message
If strError = "Error" Then
strError = DirectCast(ex, CustomApplicationException).MessageText
End If
If Not CancelQTPs Then
CurrentQTPCancel = True
End If
CancelQTPs = True
If strError.ToUpper.Substring(0, 3) = "IM." Then
strError = strError.Substring(3)
ElseIf strError.Trim = "Exception of type 'System.OutOfMemoryException' was thrown." Then
strError = "The Server does not have the required memory available."
End If
If Not strError.ToUpper.Substring(0, 3) = "IM." Then
ExceptionManager.Publish(ex)
End If
m_Error.Append(" ").Append(strError).Append(vbNewLine)
End Sub
' Used in QTP/Quiz when joining multiple sqls into one to determine if we need to call the
' VAL function.
Protected Friend Sub SetJoinColumnInfo(ByRef file As IFileObject, field As String)
m_fleJoinFile = file
m_strJoinColumn = field
End Sub
''' --- UseSqlVal --------------------------------------------------------
''' <summary>
''' Returns true of false depending on whether the SqlVal setting is set
''' in the Web.Config file
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function SqlValDB() As String
If m_strSqlValDB.Length = 0 Then
If Not ConfigurationManager.AppSettings("SqlValDB") Is Nothing Then
m_strSqlValDB = ConfigurationManager.AppSettings("SqlValDB")
Else
m_strSqlValDB = " "
End If
End If
Return m_strSqlValDB
End Function
''' -----------------------------------------------------------------------------
''' <summary>
''' Converts a string into a Decimal.
''' </summary>
''' <param name="Value">A string.</param>
''' <returns>A Decimal.</returns>
''' <remarks>
''' Will only convert numeric values and remove character values.
''' </remarks>
''' <example>
''' VAL("123") returns 123<br />
''' VAL("$12") returns 12
''' </example>
''' <history>
''' [Campbell] 4/6/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function VAL2(Value As String, Optional ByVal StartPosition As Integer = 0,
Optional ByVal Length As Integer = 0) As Object
If StartPosition > 0 Then
Value = Substring(Value, StartPosition, Length)
End If
' Remove any trailing spaces.
Value = Value.TrimEnd
Try
' Check if we are joining SQLs to return a single SQL statement. If a GetStringValue
' uses the VAL2, we need to ensure that the VAL function is called in the database.
If _
SqlValDB.Trim.Length > 0 AndAlso (ScreenType = ScreenTypes.QTP OrElse ScreenType = ScreenTypes.QUIZ) AndAlso
Not m_fleJoinFile Is Nothing Then
If m_fleJoinFile.WhereColumn.Contains(m_strJoinColumn) Then
Dim index As Integer = m_fleJoinFile.WhereColumn.IndexOf(m_strJoinColumn)
Dim joinString As String = m_fleJoinFile.WhereColumn.Item(index)
Dim firstTilde As Integer = joinString.IndexOf("~")
Dim secondTilde As Integer = joinString.IndexOf("~", firstTilde + 1)
If secondTilde > -1 Then
If StartPosition > 0 Then
joinString = joinString.Substring(0, firstTilde + 1) + SqlValDB() + "VAL(Substring(" +
joinString.Substring(firstTilde + 1, secondTilde - firstTilde - 1) + "," +
StartPosition.ToString + "," + Length.ToString + "))" +
joinString.Substring(secondTilde)
Else
joinString = joinString.Substring(0, firstTilde + 1) + SqlValDB() + "VAL(" +
joinString.Substring(firstTilde + 1, secondTilde - firstTilde - 1) + ")" +
joinString.Substring(secondTilde)
End If
m_fleJoinFile.WhereColumn.Item(index) = joinString
End If
m_fleJoinFile = Nothing
m_strJoinColumn = String.Empty
End If
End If
'
If IsNumeric(Value) Then
Return CDec(Value)
' TODO: Revisit DECIMAL code.
'If InStr(1, strNumber, ".") > 0 And blnDecimal Then
' VAL = VAL * (10 ^ (Len(Trim(strNumber)) - InStr(1, strNumber, ".")))
'End If
Else
Dim intPosition As Integer
Dim strNewNumber As String = String.Empty
If Value.StartsWith("0") Then
strNewNumber = Value
Do While strNewNumber.StartsWith("0")
strNewNumber = strNewNumber.Substring(1)
Loop
If strNewNumber.Length = 0 Then strNewNumber = "0"
If IsNumeric(strNewNumber) Then
Return CDec(strNewNumber)
End If
strNewNumber = ""
End If
If Not HttpContext.Current.Session(UniqueSessionID + "QtpStr") Is Nothing Then
' This is to ensure that when the VAL2 is called when the ElementOwner is being
' used (from GetDecimalValue, GetNumericDateValue, etc.), that we still fail
' and return the string value. Pat had coded this to handle returning one SQL
' for all the GetData() calls within Quiz/QTP.
HttpContext.Current.Session.Remove(UniqueSessionID + "QtpStr")
' Loop through the string and remove any non-numeric characters.
For intPosition = 1 To Value.Length
' Remove non-numeric characters.
If Asc(Value.Substring(intPosition, 1)) > 47 And Asc(Value.Substring(intPosition, 1)) < 58 _
Then
strNewNumber &= Value.Substring(intPosition, 1)
End If
Next
Else
' Loop through the string and remove any non-numeric characters.
For intPosition = 0 To Value.Length - 1
' Remove non-numeric characters.
If Asc(Value.Substring(intPosition, 1)) > 47 And Asc(Value.Substring(intPosition, 1)) < 58 _
Then
strNewNumber &= Value.Substring(intPosition, 1)
End If
Next
End If
' Return the new number.
If IsNumeric(strNewNumber) Then
Return CDec(strNewNumber)
Else
Return 0
End If
End If
Catch ex As Exception
If Not IsNumeric(Value) Then
Return Value
Else
Return 0
End If
End Try
End Function
Protected Friend Overridable Sub EndRequest(strName As String, ByVal ParamArray strSubFile() As Object)
Dim intSpace As Integer = 12
Dim intUnchanged As Integer = 0
Dim blnAddTitle As Boolean = False
Dim strtemp As String = String.Empty
Dim intSubCount As Integer = 0
Try
If IsAxiant AndAlso CancelQTPs Then
If m_Error.Length > 0 Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Error:").Append(vbNewLine)
m_LogFile.Append(m_Error.ToString).Append(vbNewLine)
End If
If CurrentQTPCancel Then
m_LogFile.Append(vbNewLine).Append("Changes made since the last commit have been rolled back to a stable state. ").Append(vbNewLine)
m_LogFile.Append("Therefore, statistics reported may be incorrect. ").Append(vbNewLine).Append(vbNewLine)
Else
m_LogFile.Append(vbNewLine).Append("Request ").Append(strName).Append(" condition is false--skipping request.").Append(vbNewLine).Append(vbNewLine)
End If
WriteLogFile(m_LogFile.ToString)
Return
End If
dtSortOrder = New DataTable
strSortOrder = ""
dcSysDate = 0
dcSysTime = 0
dcSysDateTime = 0
Session(UniqueSessionID + "hsSubFileSize") = hsSubFileSize
hsSubFileSize = Nothing
RaiseEvent SaveTempFile(Me, New PageStateEventArgs("_"))
RaiseSavePageState()
m_blnNoRecords = False
m_strNoRecordsLevel = String.Empty
Dim arrRemove As New ArrayList
If Not IsNothing(Session(UniqueSessionID + "hsSubfile")) Then
'Dim Enumerator As IDictionaryEnumerator = Session(UniqueSessionID + "hsSubfile").GetEnumerator
'While Enumerator.MoveNext
Dim subkey As String
For Each subkey In Session(UniqueSessionID + "hsSubfile").Keys
If _
arrKeepFile.Contains(subkey) OrElse
(alSubTempText.Contains(subkey) OrElse
((ConfigurationManager.AppSettings("SubfileKEEPtoTEXT") & "").ToUpper = "TRUE" AndAlso
Not _
Session(UniqueSessionID + "alSubTempFile").Contains(
subkey & "_" & Session("SessionID")))) AndAlso
Not _
(subkey.ToUpper.EndsWith("_TEMP") AndAlso Me.ScreenType = ScreenTypes.QUIZ) _
Then
If IsNothing(Session("TempFiles")) OrElse Not DirectCast(Session("TempFiles"), ArrayList).Contains(subkey) Then
PutDataTextTable(subkey, Session(UniqueSessionID + "hsSubfile")(subkey),
Session(UniqueSessionID + "hsSubfileKeepText").Item(subkey),
strSubFile)
Session(UniqueSessionID + "hsSubfile").Item(subkey).Clear()
End If
'ElseIf Enumerator.Key.ToString.ToUpper.EndsWith("_TEMP") AndAlso Me.ScreenType = ScreenTypes.QUIZ Then
' If Session(UniqueSessionID + "alSubTempFile").Contains(Enumerator.Key.ToString & "_" & Session("SessionID")) Then Session(UniqueSessionID + "alSubTempFile").Remove(Enumerator.Key.ToString & "_" & Session("SessionID"))
End If
'End While
Next
For i As Integer = 0 To arrRemove.Count - 1
Session(UniqueSessionID + "hsSubfile").Remove(arrRemove.Item(i))
Next
End If
If arrFileInRequests.Count > 0 Then
If arrReadInRequests.Count > 0 Then
For i As Integer = 0 To arrReadInRequests.Count - 1
If arrReadInRequests(i) <> "" Then
m_LogFile.Append(" ").Append(arrReadInRequests(i))
For j As Integer = 0 To ((intSpace * 2) - (arrReadInRequests(i).ToString.Length + 3))
m_LogFile.Append(" ")
Next
If m_hsFileInRequests.ContainsKey(arrReadInRequests(i) & "_Read") Then
strtemp = m_hsFileInRequests.Item(arrReadInRequests(i) & "_Read")
m_LogFile.Append(strtemp.PadLeft(intSpace))
intUnchanged = m_hsFileInRequests.Item(arrReadInRequests(i) & "_Read")
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
m_LogFile.Append(vbNewLine)
End If
Next
End If
'If intTransactions > 0 Then
m_LogFile.Append(vbNewLine & "Transactions Processed: ")
strtemp = intTransactions.ToString.PadLeft(intSpace)
m_LogFile.Append(strtemp & vbNewLine & vbNewLine)
'End If
'For i As Integer = 0 To arrFileInRequests.Count - 1
' If m_hsFileInOutput.Count > 0 Then
' If Not blnAddTitle Then
' m_LogFile.Append(vbNewLine)
' m_LogFile.Append("Records processed: Added")
' m_LogFile.Append("Updated".PadLeft(intSpace))
' m_LogFile.Append("Unchanged".PadLeft(intSpace))
' m_LogFile.Append("Deleted".PadLeft(intSpace))
' m_LogFile.Append(vbNewLine)
' blnAddTitle = True
' End If
' If m_hsFileInOutput.Contains(arrFileInRequests(i)) Then
' intUnchanged = m_hsFileInRequests.Item(arrFileInRequests(i) & "_Read")
' m_LogFile.Append(" ").Append(arrFileInRequests(i))
' For j As Integer = 0 To ((intSpace * 2) - (arrFileInRequests(i).ToString.Length + 3))
' m_LogFile.Append(" ")
' Next
' If m_hsFileInRequests.ContainsKey(arrFileInRequests(i) & "_Added") Then
' strtemp = m_hsFileInRequests.Item(arrFileInRequests(i) & "_Added")
' intUnchanged = intUnchanged - m_hsFileInRequests.Item(arrFileInRequests(i) & "_Added")
' m_LogFile.Append(strtemp.PadLeft(intSpace))
' Else
' m_LogFile.Append("0".PadLeft(intSpace))
' End If
' If m_hsFileInRequests.ContainsKey(arrFileInRequests(i) & "_Updated") Then
' strtemp = m_hsFileInRequests.Item(arrFileInRequests(i) & "_Updated")
' m_LogFile.Append(strtemp.PadLeft(intSpace))
' intUnchanged = intUnchanged - m_hsFileInRequests.Item(arrFileInRequests(i) & "_Updated")
' Else
' m_LogFile.Append("0".PadLeft(intSpace))
' End If
' If m_hsFileInRequests.ContainsKey(arrFileInRequests(i) & "_Deleted") Then
' intUnchanged = intUnchanged - m_hsFileInRequests.Item(arrFileInRequests(i) & "_Deleted")
' End If
' If intUnchanged < 0 Then intUnchanged = 0
' m_LogFile.Append(intUnchanged.ToString.PadLeft(intSpace))
' If m_hsFileInRequests.ContainsKey(arrFileInRequests(i) & "_Deleted") Then
' strtemp = m_hsFileInRequests.Item(arrFileInRequests(i) & "_Deleted")
' m_LogFile.Append(strtemp.PadLeft(intSpace))
' Else
' m_LogFile.Append("0".PadLeft(intSpace))
' End If
' m_LogFile.Append(vbNewLine)
' End If
' End If
'Next
'File object where records have been addded, modified, or deleted.
For i As Integer = 0 To arrFilesProcessed.Count - 1
If m_hsFileInOutput.Count > 0 Then
If (arrFileInRequests.Contains(arrFilesProcessed(i))) Then
If Not blnAddTitle Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Records processed: Added")
m_LogFile.Append("Updated".PadLeft(intSpace))
m_LogFile.Append("Unchanged".PadLeft(intSpace))
m_LogFile.Append("Deleted".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
blnAddTitle = True
End If
If m_hsFileInOutput.Contains(arrFilesProcessed(i)) Then
intUnchanged = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Read")
m_LogFile.Append(" ").Append(arrFilesProcessed(i))
For j As Integer = 0 To ((intSpace * 2) - (arrFilesProcessed(i).ToString.Length + 3))
m_LogFile.Append(" ")
Next
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Added") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Added")
intUnchanged = intUnchanged -
m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Added")
m_LogFile.Append(strtemp.PadLeft(intSpace))
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Updated") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Updated")
m_LogFile.Append(strtemp.PadLeft(intSpace))
intUnchanged = intUnchanged -
m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Updated")
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Unchanged") Then
intUnchanged = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Unchanged")
End If
If intUnchanged < 0 Then intUnchanged = 0
m_LogFile.Append(intUnchanged.ToString.PadLeft(intSpace))
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Deleted") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Deleted")
m_LogFile.Append(strtemp.PadLeft(intSpace))
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
m_LogFile.Append(vbNewLine)
End If
End If
End If
Next
For i As Integer = 0 To arrFilesProcessed.Count - 1
If m_hsFileInOutput.Count > 0 Then
If (Not arrFileInRequests.Contains(arrFilesProcessed(i))) Then
If Not blnAddTitle Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Records processed: Added")
m_LogFile.Append("Updated".PadLeft(intSpace))
m_LogFile.Append("Unchanged".PadLeft(intSpace))
m_LogFile.Append("Deleted".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
blnAddTitle = True
End If
If m_hsFileInOutput.Contains(arrFilesProcessed(i)) Then
intUnchanged = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Read")
m_LogFile.Append(" ").Append(arrFilesProcessed(i))
For j As Integer = 0 To ((intSpace * 2) - (arrFilesProcessed(i).ToString.Length + 3))
m_LogFile.Append(" ")
Next
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Added") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Added")
intUnchanged = intUnchanged -
m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Added")
m_LogFile.Append(strtemp.PadLeft(intSpace))
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Updated") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Updated")
m_LogFile.Append(strtemp.PadLeft(intSpace))
intUnchanged = intUnchanged -
m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Updated")
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Unchanged") Then
intUnchanged = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Unchanged")
End If
If intUnchanged < 0 Then intUnchanged = 0
m_LogFile.Append(intUnchanged.ToString.PadLeft(intSpace))
If m_hsFilesProcessed.ContainsKey(arrFilesProcessed(i) & "_Deleted") Then
strtemp = m_hsFilesProcessed.Item(arrFilesProcessed(i) & "_Deleted")
m_LogFile.Append(strtemp.PadLeft(intSpace))
Else
m_LogFile.Append("0".PadLeft(intSpace))
End If
m_LogFile.Append(vbNewLine)
End If
End If
End If
Next
' Write out the information where an Output did not add, update or delete any records.
Dim keys As ICollection = m_hsFileInOutput.Keys
Dim key, value As Object
For Each key In keys
value = m_hsFileInOutput(key)
If Not arrFilesProcessed.Contains(value) Then
If Not blnAddTitle Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Records processed: Added")
m_LogFile.Append("Updated".PadLeft(intSpace))
m_LogFile.Append("Unchanged".PadLeft(intSpace))
m_LogFile.Append("Deleted".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
blnAddTitle = True
End If
m_LogFile.Append(" ").Append(value)
For j As Integer = 0 To ((intSpace * 2) - (value.ToString.Length + 3))
m_LogFile.Append(" ")
Next
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
End If
Next
' Write out the information for the SubFile.
'For i As Integer = 0 To arrSubFiles.Count - 1
' If Not blnAddTitle Then
' m_LogFile.Append(vbNewLine)
' m_LogFile.Append("Records processed: Added")
' m_LogFile.Append("Updated".PadLeft(intSpace))
' m_LogFile.Append("Unchanged".PadLeft(intSpace))
' m_LogFile.Append("Deleted".PadLeft(intSpace))
' m_LogFile.Append(vbNewLine)
' blnAddTitle = True
' End If
' m_LogFile.Append(" ").Append(arrSubFiles(i))
' For j As Integer = 0 To ((intSpace * 2) - (arrSubFiles(i).ToString.Length + 3))
' m_LogFile.Append(" ")
' Next
' If arrFilesProcessed.Contains(arrSubFiles(i)) Then
' If m_hsFilesProcessed.ContainsKey(arrSubFiles(i) & "_Added") Then
' strtemp = m_hsFilesProcessed.Item(arrSubFiles(i) & "_Added")
' m_LogFile.Append(strtemp.PadLeft(intSpace))
' Else
' m_LogFile.Append("0".PadLeft(intSpace))
' End If
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append(vbNewLine)
' Else
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append("0".PadLeft(intSpace))
' m_LogFile.Append(vbNewLine)
' End If
'Next
' Write out the information for the SubFile that was never written to.
If Not blnAddTitle AndAlso Me.ScreenType = ScreenTypes.QUIZ Then
' Remove the Request files from the SubFile list. The remaining subfile is the one
' that is in the SubFile statement but never got executed.
For i As Integer = 0 To arrFileInRequests.Count - 1
If arrSubFiles.Contains(arrFileInRequests(i)) Then
arrSubFiles.Remove(arrFileInRequests(i))
End If
Next
If arrSubFiles.Count > 0 Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Records processed: Added")
m_LogFile.Append("Updated".PadLeft(intSpace))
m_LogFile.Append("Unchanged".PadLeft(intSpace))
m_LogFile.Append("Deleted".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
blnAddTitle = True
m_LogFile.Append(" ").Append(arrSubFiles(0))
For j As Integer = 0 To ((intSpace * 2) - (arrSubFiles(0).ToString.Length + 3))
m_LogFile.Append(" ")
Next
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append("0".PadLeft(intSpace))
m_LogFile.Append(vbNewLine)
End If
End If
End If
If m_Error.Length > 0 Then
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Error:").Append(vbNewLine)
m_LogFile.Append(m_Error.ToString).Append(vbNewLine)
End If
m_LogFile.Append(vbNewLine)
m_LogFile.Append(("End Request: " & strName).ToString.PadRight(40))
m_LogFile.Append(Now.Day.ToString.PadLeft(2, "0")).Append("/").Append(Now.Month.ToString.PadLeft(2, "0")) _
.Append("/").Append(Now.Year.ToString).Append(" ")
m_LogFile.Append(TimeOfDay.ToLongTimeString)
m_LogFile.Append(vbNewLine).Append(vbNewLine).Append(vbNewLine)
WriteLogFile(m_LogFile.ToString)
m_LogFile.Remove(0, m_LogFile.Length)
m_hsFileInRequests = New Hashtable
arrFileInRequests = Nothing
arrReadInRequests = Nothing
m_hsFileInOutput = New SortedList
m_SortFileOrder = 0
If Not IsNothing(m_dtbDataTable) Then
m_dtbDataTable.Dispose()
m_dtbDataTable = Nothing
End If
#If TARGET_DB = "INFORMIX" Then
Session(UniqueSessionID + "cnnQUERY") = cnnQUERY
Session(UniqueSessionID + "cnnTRANS_UPDATE") = cnnTRANS_UPDATE
Session(UniqueSessionID + "trnTRANS_UPDATE") = trnTRANS_UPDATE
#Else
Try
TRANS_UPDATE(TransactionMethods.Commit)
Catch ex As Exception
End Try
#End If
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
Finally
Try
CloseTransactionObjects()
Catch ex As CustomApplicationException
Throw ex
Catch ex As Exception
Throw ex
End Try
GC.Collect()
End Try
End Sub
''' -----------------------------------------------------------------------------
''' <exclude />
''' <summary>
''' </summary>
''' <returns></returns>
''' <remarks>
''' </remarks>
''' <history>
''' [mayur] 8/19/2005 Created
''' </history>
''' -----------------------------------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function GetDEFAULT_BATCH_FILE_DIRECTORY() As String
If m_strDEFAULT_BATCH_FILE_DIRECTORY = "" Then
m_strDEFAULT_BATCH_FILE_DIRECTORY = ConfigurationManager.AppSettings("Default_Batch_File_Directory")
m_strDEFAULT_BATCH_FILE_DIRECTORY = m_strDEFAULT_BATCH_FILE_DIRECTORY.Replace("UserID", Environment.UserName)
End If
Return m_strDEFAULT_BATCH_FILE_DIRECTORY
End Function
Protected Sub WriteLogFile(strText As String)
Try
Dim sw As StreamWriter
Dim Fs As FileStream
Dim strDirectory As String = GetDEFAULT_BATCH_FILE_DIRECTORY()
Dim newFile As String = ""
If Not strDirectory.Trim = "" Then
If Not Directory.Exists(strDirectory) Then Directory.CreateDirectory(strDirectory)
If _
(Not ConfigurationManager.AppSettings("JobOutPut") Is Nothing AndAlso
ConfigurationManager.AppSettings("JobOutPut").ToUpper() = "TRUE") Then
newFile = strDirectory & "\" & Session("JobOutPut") & ".txt"
Else
newFile = strDirectory & "\" & Session(UniqueSessionID + "LogName") & ".txt"
End If
If File.Exists(newFile) Then
Fs = New FileStream(newFile, FileMode.Append, FileAccess.Write, FileShare.None)
Else
Fs = New FileStream(newFile, FileMode.CreateNew, FileAccess.Write, FileShare.None)
End If
sw = New StreamWriter(Fs, Encoding.Default)
sw.Write(strText)
sw.Flush()
sw.Close()
End If
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
Public Sub WriteGlobalParametersToLogFile()
Try
If m_GlobalParameters.ToString().Trim() <> String.Empty Then
m_LogFile.Remove(0, m_LogFile.Length)
m_LogFile.Append(vbNewLine)
m_LogFile.Append("Global Parameters").Append(vbNewLine)
m_LogFile.Append(m_GlobalParameters.ToString())
WriteLogFile(m_LogFile.ToString())
m_GlobalParameters.Remove(0, m_GlobalParameters.Length)
End If
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
Public Sub StoreClassParametersForLogFile(line As String)
Try
m_ClassParameters.Append(line).Append(vbNewLine)
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
Public Sub StoreGlobalParametersForLogFile(line As String)
Try
m_GlobalParameters.Append(line).Append(vbNewLine)
Catch ex As Exception
ExceptionManager.Publish(ex)
Throw ex
End Try
End Sub
Public Sub AddRecordsRead(strFile As String, intRecords As Integer, LogType As LogType)
If _
LogType = LogType.Added Or LogType = LogType.Deleted Or LogType = LogType.Updated Or
LogType = LogType.OutPut Or LogType = LogType.UnChanged Then
AddRecordsProcessed(strFile, intRecords, LogType)
Else
If Not LogType = LogType.OutPut AndAlso Not arrFileInRequests.Contains(strFile) Then
If Not blnHasBeenSort Then
arrFileInRequests.Add(strFile)
End If
End If
' Select Case LogType
'Case LogType.Added
' If m_hsFileInRequests.ContainsKey(strFile & "_Added") Then
' m_hsFileInRequests.Item(strFile & "_Added") = m_hsFileInRequests.Item(strFile & "_Added") + intRecords
' Else
' m_hsFileInRequests.Add(strFile & "_Added", intRecords)
' End If
'Case LogType.Deleted
' If m_hsFileInRequests.ContainsKey(strFile & "_Deleted") Then
' m_hsFileInRequests.Item(strFile & "_Deleted") = m_hsFileInRequests.Item(strFile & "_Deleted") + intRecords
' Else
' m_hsFileInRequests.Add(strFile & "_Deleted", intRecords)
' End If
' Case LogType.Read
If Not blnHasBeenSort Then
If Not arrReadInRequests.Contains(strFile) Then
arrReadInRequests.Add(strFile)
End If
If m_hsFileInRequests.ContainsKey(strFile & "_Read") Then
m_hsFileInRequests.Item(strFile & "_Read") = m_hsFileInRequests.Item(strFile & "_Read") +
intRecords
Else
m_hsFileInRequests.Add(strFile & "_Read", intRecords)
End If
End If
'Case LogType.Updated
' If m_hsFileInRequests.ContainsKey(strFile & "_Updated") Then
' m_hsFileInRequests.Item(strFile & "_Updated") = m_hsFileInRequests.Item(strFile & "_Updated") + intRecords
' Else
' m_hsFileInRequests.Add(strFile & "_Updated", intRecords)
' End If
'Case LogType.OutPut
' If Not m_hsFileInOutput.Contains(strFile) Then
' m_hsFileInOutput.Add(strFile, strFile)
' End If
'End Select
End If
End Sub
Public Sub AddRecordsProcessed(strFile As String, intRecords As Integer, LogType As LogType)
If Not arrFilesProcessed.Contains(strFile) Then
'If Not blnHasBeenSort Then
arrFilesProcessed.Add(strFile)
'End If
End If
Select Case LogType
Case LogType.Added
AddRecordsProcessed(strFile, intRecords, LogType.OutPut)
If m_hsFilesProcessed.ContainsKey(strFile & "_Added") Then
m_hsFilesProcessed.Item(strFile & "_Added") = m_hsFilesProcessed.Item(strFile & "_Added") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Added", intRecords)
End If
Case LogType.Deleted
If m_hsFilesProcessed.ContainsKey(strFile & "_Deleted") Then
m_hsFilesProcessed.Item(strFile & "_Deleted") = m_hsFilesProcessed.Item(strFile & "_Deleted") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Deleted", intRecords)
End If
Case LogType.Updated
If m_hsFilesProcessed.ContainsKey(strFile & "_Updated") Then
m_hsFilesProcessed.Item(strFile & "_Updated") = m_hsFilesProcessed.Item(strFile & "_Updated") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Updated", intRecords)
End If
Case LogType.UnChanged
If m_hsFilesProcessed.ContainsKey(strFile & "_Unchanged") Then
m_hsFilesProcessed.Item(strFile & "_Unchanged") = m_hsFilesProcessed.Item(strFile & "_Unchanged") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Unchanged", intRecords)
End If
Case LogType.OutPut
If Not m_hsFileInOutput.Contains(strFile) Then
m_hsFileInOutput.Add(strFile, strFile)
End If
End Select
End Sub
Public Sub AddRecordsProcessed(strFile As String, strFileAlias As String, intRecords As Integer, LogType As LogType)
If strFileAlias.Length > 0 Then
strFile = strFileAlias
End If
If Not arrFilesProcessed.Contains(strFile) Then
'If Not blnHasBeenSort Then
arrFilesProcessed.Add(strFile)
'End If
End If
Select Case LogType
Case LogType.Added
AddRecordsProcessed(strFile, intRecords, LogType.OutPut)
If m_hsFilesProcessed.ContainsKey(strFile & "_Added") Then
m_hsFilesProcessed.Item(strFile & "_Added") = m_hsFilesProcessed.Item(strFile & "_Added") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Added", intRecords)
End If
Case LogType.Deleted
If m_hsFilesProcessed.ContainsKey(strFile & "_Deleted") Then
m_hsFilesProcessed.Item(strFile & "_Deleted") = m_hsFilesProcessed.Item(strFile & "_Deleted") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Deleted", intRecords)
End If
Case LogType.Updated
If m_hsFilesProcessed.ContainsKey(strFile & "_Updated") Then
m_hsFilesProcessed.Item(strFile & "_Updated") = m_hsFilesProcessed.Item(strFile & "_Updated") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Updated", intRecords)
End If
Case LogType.UnChanged
If m_hsFilesProcessed.ContainsKey(strFile & "_Unchanged") Then
m_hsFilesProcessed.Item(strFile & "_Unchanged") = m_hsFilesProcessed.Item(strFile & "_Unchanged") +
intRecords
Else
m_hsFilesProcessed.Add(strFile & "_Unchanged", intRecords)
End If
Case LogType.OutPut
If Not m_hsFileInOutput.Contains(strFile) Then
m_hsFileInOutput.Add(strFile, strFile)
End If
End Select
End Sub
#Region " Methods to Save/Retrieve State "
''' --- RetrieveState ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of RetrieveState.
''' </summary>
''' <param name="InField"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend Overridable Sub RetrieveState(Optional ByVal InField As Boolean = False)
'Retrieve State information by overriding this method into a Derived page
'Note: At present we are not Retrieving state of CoreBaseTypes internally
'TODO: to be changed to Save/Retrieve State Internally
End Sub
''' --- SaveState ----------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of SaveState.
''' </summary>
''' <param name="InField"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Friend Overridable Sub SaveState(Optional ByVal InField As Boolean = False)
'Save State information by overriding this method into a Derived page
'Note: At present we are not saving state of CoreBaseTypes internally
'TODO: to be changed to Save/Retrieve State Internally
End Sub
''' --- RetrieveParamsReceived ---------------------------------------------
''' <summary>
''' This method is called to handle the values received by this screen.
''' objects.
''' </summary>
''' <remarks>
''' Use the RetrieveParamsReceived method to handle assigning the values passed in to
''' the screen to the appropriate File/Temporary objects.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Overridable Sub RetrieveParamsReceived()
'Retrieve Params Received from State information by overriding this method into a Derived page
End Sub
''' --- RetrieveInitalizeParamsReceived ---------------------------------------------
''' <summary>
''' This method is called to handle the values received by this screen.
''' objects.
''' </summary>
''' <remarks>
''' Use the RetrieveInitalizeParamsReceived method to handle assigning the values passed in to
''' the screen to the appropriate File/Temporary objects.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Overridable Sub RetrieveInitalizeParamsReceived()
'Retrieve Params Received from State information by overriding this method into a Derived page
End Sub
''' --- SaveInitalizeParamsReceived -------------------------------------------------
''' <summary>
''' This method is called to handle updating the values received by this screen.
''' objects.
''' </summary>
''' <remarks>
''' Use the SaveInitalizeParamsReceived method to handle updating the values from the
''' File/Temporary objects that were passed in to this screen.
''' </remarks>
''' <history>
''' [Campbell] 7/5/2005 Created
''' [Mark] 19/7/2005 Copied the nDocs info from page.aspx.vb
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Overridable Sub SaveInitalizeParamsReceived()
'Save Params Received into State information by overriding this method into a Derived page
End Sub
''' --- AddDateFunction --------------------------------------------------
''' <exclude />
''' <summary>
''' Wraps the date field within the appropriate date function code.
''' </summary>
''' <param name="Field">The field to add the function around.</param>
''' <remarks>
''' Returns a string with the date function.
''' </remarks>
''' <example>
''' 1. AddDateFunction("EMPLOYEE.START_DATE") will return
''' " TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE, 'YYYYMMDD'))" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Protected Function AddDateFunction(Field As String) As String
Dim sb As StringBuilder = New StringBuilder(255)
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
Return sb.Append("TO_NUMBER(TO_CHAR(").Append(Field).Append(", 'YYYYMMDD'))").ToString
Else
Return sb.Append("CONVERT(INTEGER, CONVERT(CHAR(8), ").Append(Field).Append(", 112))").ToString
End If
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <param name="AddWhere">
''' Indicates that this is the first field in the WHERE clause and the keyword WHERE is to be
''' appended. This is passed in using a variable.
''' </param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As String, [Operator] As String, Field2 As String,
AddWhere As Boolean) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
If AddWhere Then
sb.Append(" WHERE ")
Else
sb.Append(" AND ")
End If
sb.Append(GetWhereClauseString(Field1, [Operator], Field2))
Return sb.ToString
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As String, [Operator] As String, Field2 As String) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
Dim arrField2() As String = Field2.Split(",")
If [Operator].ToUpper = "IN" Then
For i As Integer = 0 To arrField2.Length - 1
If sb.Length > 0 Then sb.Append(" OR ")
sb.Append(GetWhereClauseString(Field1, "=", CDec(arrField2(i).Trim)))
Next
Else
sb.Append("(")
sb.Append((Field1)).Append(" ").Append([Operator]).Append(" ").Append((Field2))
If [Operator].Trim.Equals("=") Then
sb.Append(" OR ( ").Append(Field1).Append(" IS NULL ").Append(" AND ").Append(Field2).Append(
" IS NULL )")
ElseIf [Operator].Trim.Equals("<") Then
sb.Append(" OR ( ").Append(Field1).Append(" IS NULL ").Append(" AND ").Append(Field2).Append(
" IS NOT NULL )")
ElseIf [Operator].Trim.Equals(">") Then
sb.Append(" OR ( ").Append(Field1).Append(" IS NOT NULL ").Append(" AND ").Append(Field2).Append(
" IS NULL )")
ElseIf [Operator].Trim.Equals("<>") Then
sb.Append(" OR (( ").Append(Field1).Append(" IS NOT NULL ").Append(" AND ").Append(Field2).Append(
" IS NULL ) ")
sb.Append(" OR ( ").Append(Field1).Append(" IS NULL ").Append(" AND ").Append(Field2).Append(
" IS NOT NULL ))")
End If
sb.Append(")")
End If
Return sb.ToString
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <param name="AddWhere">
''' Indicates that this is the first field in the WHERE clause and the keyword WHERE is to be
''' appended. This is passed in using a variable.
''' </param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As String, [Operator] As String, Field2 As Decimal,
AddWhere As Boolean) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
If AddWhere Then
sb.Append(" WHERE ")
Else
sb.Append(" AND ")
End If
sb.Append(GetWhereClauseString(Field1, [Operator], Field2))
Return sb.ToString
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As String, [Operator] As String, Field2 As Decimal) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
If Field2 = 0 Then
If [Operator].Trim.Equals("=") Then
sb.Append(Field1).Append(" IS NULL ")
ElseIf [Operator].Trim.Equals("<>") OrElse [Operator].Trim.Equals("!=") Then
sb.Append(Field1).Append(" IS NOT NULL ")
Else
If [Operator].Trim.IndexOf("=") > -1 Then
sb.Append("(").Append(Field1).Append(" IS NULL OR ").Append(AddDateFunction(Field1)).Append(" ") _
.Append([Operator]).Append(" 0)")
Else
sb.Append(AddDateFunction(Field1)).Append(" ").Append([Operator]).Append(" 0")
End If
End If
Else
If [Operator].IndexOf("<") > -1 Then
sb.Append("(").Append(Field1).Append(" IS NULL OR ").Append(AddDateFunction(Field1)).Append(" ").
Append([Operator]).Append(" ").Append(Field2).Append(")")
Else
sb.Append(AddDateFunction(Field1)).Append(" ").Append([Operator]).Append(" ").Append(Field2)
End If
End If
Return sb.ToString
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <param name="AddWhere">
''' Indicates that this is the first field in the WHERE clause and the keyword WHERE is to be
''' appended. This is passed in using a variable.
''' </param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As Decimal, [Operator] As String, Field2 As String,
ByRef AddWhere As Boolean) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
If AddWhere Then
sb.Append(" WHERE ")
Else
sb.Append(" AND ")
End If
sb.Append(GetWhereClauseString(Field1, [Operator], Field2))
Return sb.ToString
End Function
''' --- GetWhereClauseString --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="Field1">The first field in the SQL statement.</param>
''' <param name="Operator">The Operator value.</param>
''' <param name="Field2">The second field in the SQL statement</param>
''' <remarks>
''' Returns a formatted SQL WHERE CLAUSE by concatenating the parameters Field1, Operator and Field2 for date fields to
''' ensure that
''' fields with a NULL are also returned if necessary.
''' </remarks>
''' <example>
''' 1. GetWhereClauseString("EMPLOYEE.START_DATE", "=", 0, True) will return
''' " WHERE EMPLOYEE.START_DATE IS NULL" <br />
''' 2. GetWhereClauseString("EMPLOYEE.START_DATE", "<", 19991231, True) will return
''' " WHERE (EMPLOYEE.START_DATE IS NULL OR TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) < 19991231)" <br />
''' 3. GetWhereClauseString(19991231, ">", "EMPLOYEE.START_DATE", True) will return
''' " WHERE (19991231 > (TO_NUMBER(TO_CHAR(EMPLOYEE.START_DATE,'YYYYMMDD')) OR EMPLOYEE.START_DATE IS NULL)" <br />
''' </example>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function GetWhereClauseString(Field1 As Decimal, [Operator] As String, Field2 As String) As String
Dim sb As StringBuilder = New StringBuilder(String.Empty)
If Field1 = 0 Then
If [Operator].Trim.Equals("=") Then
sb.Append(Field2).Append(" IS NULL ")
Else
If [Operator].Trim.IndexOf("=") > -1 Then
sb.Append("(").Append(Field2).Append(" IS NULL OR 0 ").Append([Operator]).Append(" ").Append(
AddDateFunction(Field2)).Append(")")
Else
sb.Append("0 ").Append([Operator]).Append(" ").Append(AddDateFunction(Field2))
End If
End If
Else
If [Operator].IndexOf(">") > -1 Then
sb.Append("(").Append(Field2).Append(" IS NULL OR ").Append(Field1).Append(" ").Append([Operator]).
Append(" ").Append(AddDateFunction(Field2)).Append(")")
Else
sb.Append(Field1).Append(" ").Append([Operator]).Append(" ").Append(AddDateFunction(Field2))
End If
End If
Return sb.ToString
End Function
#If TARGET_DB = "INFORMIX" Then
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject) As Boolean
Return GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, ByVal GetDataBehaviour As GetDataOptions) As Boolean
Return GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, ByVal WhereClause As String) As Boolean
Return GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, _
ByVal WhereClause As String, _
ByVal OrderByClause As String) As Boolean
Return GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, _
ByVal WhereClause As String, _
ByVal GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, GetDataBehaviour)
Return GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, _
ByVal WhereClause As String, _
ByVal OrderByClause As String, _
ByVal GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, OrderByClause, GetDataBehaviour)
Return GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, _
ByVal IsOverrided As Boolean, _
ByVal OverrideSQL As String) As Boolean
'Return FileObject.GetData(IsOverrided, OverrideSQL)
Return GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Retrieve data from the database.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>Use this method if you ever need to pass a complete SQL statement with GetDataBehaviour.
''' <para>
''' <list type="numbered">
''' <item>Don't use this construct to generate Overrided SQL Statement internally.
''' i.e. Use this method if you ever need to pass GetDataBehaviour
''' other than GetDataBehaviour.CreateSubSelect.</item>
''' <item>To pass GetDataBehaviour.CreateSubSelect use another method, if you need
''' to pass Where Clause and Order By clause along with Auto Overrided SQL
''' e.g. GetData(WhereClause, OrderByClause, GetDataOptions.CreateSubSelect)
''' <para>
''' If you pass OverrideSQL along with GetDataBehaviour = GetDataOptions.CreateSubSelect
''' this method will use passed OverrideSQL, completely ignoring the GetDataOptions.CreateSubSelect
''' </para></item>
''' <item>The first parameter "IsOverrided" is added to add overloaded method Passing it as false has NO impact,
''' i.e. whether you pass True or False this function will treat it as True.</item>
''' </list>
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Function GetData(ByRef FileObject As IfxFileObject, _
ByVal IsOverrided As Boolean, _
ByVal OverrideSQL As String, _
ByVal GetDataBehaviour As GetDataOptions) As Boolean
Return GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude/>
'''
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <param name="RecordsToFill"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Overridable Function GetData(ByRef FileObject As IfxFileObject, _
ByVal WhereClause As String, _
ByVal OrderByClause As String, _
ByVal OverrideSQL As String, _
ByVal GetDataBehaviour As GetDataOptions, _
ByRef RecordsToFill As Integer) As Boolean
Dim blnReturnValue As Boolean
blnReturnValue = FileObject.GetData(WhereClause, OrderByClause, OverrideSQL, GetDataBehaviour, RecordsToFill
)
Return blnReturnValue
End Function
#Else
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject, GetDataBehaviour As GetDataOptions) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject, WhereClause As String) As Boolean
Return _
GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject,
WhereClause As String,
OrderByClause As String) As Boolean
'Return FileObject.GetData(WhereClause, OrderByClause)
Return _
GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject,
WhereClause As String,
GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, GetDataBehaviour)
Return _
GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject,
WhereClause As String,
OrderByClause As String,
GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, OrderByClause, GetDataBehaviour)
Return _
GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject,
IsOverrided As Boolean,
OverrideSQL As String) As Boolean
'Return FileObject.GetData(IsOverrided, OverrideSQL)
Return _
GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Retrieve data from the database.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' Use this method if you ever need to pass a complete SQL statement with GetDataBehaviour.
''' <para>
''' <list type="numbered">
''' <item>
''' Don't use this construct to generate Overrided SQL Statement internally.
''' i.e. Use this method if you ever need to pass GetDataBehaviour
''' other than GetDataBehaviour.CreateSubSelect.
''' </item>
''' <item>
''' To pass GetDataBehaviour.CreateSubSelect use another method, if you need
''' to pass Where Clause and Order By clause along with Auto Overrided SQL
''' e.g. GetData(WhereClause, OrderByClause, GetDataOptions.CreateSubSelect)
''' <para>
''' If you pass OverrideSQL along with GetDataBehaviour = GetDataOptions.CreateSubSelect
''' this method will use passed OverrideSQL, completely ignoring the GetDataOptions.CreateSubSelect
''' </para>
''' </item>
''' <item>
''' The first parameter "IsOverrided" is added to add overloaded method Passing it as false has NO impact,
''' i.e. whether you pass True or False this function will treat it as True.
''' </item>
''' </list>
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As OracleFileObject,
IsOverrided As Boolean,
OverrideSQL As String,
GetDataBehaviour As GetDataOptions) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <param name="RecordsToFill"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overridable Function GetData(ByRef FileObject As OracleFileObject,
WhereClause As String,
OrderByClause As String,
OverrideSQL As String,
GetDataBehaviour As GetDataOptions,
ByRef RecordsToFill As Integer) As Boolean
Dim blnReturnValue As Boolean
blnReturnValue = FileObject.GetData(WhereClause, OrderByClause, OverrideSQL, GetDataBehaviour, RecordsToFill)
Return blnReturnValue
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject, GetDataBehaviour As GetDataOptions) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject, WhereClause As String) As Boolean
Return _
GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject,
WhereClause As String,
OrderByClause As String) As Boolean
'Return FileObject.GetData(WhereClause, OrderByClause)
Return _
GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject,
WhereClause As String,
GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, GetDataBehaviour)
Return _
GetData(FileObject, WhereClause, String.Empty, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject,
WhereClause As String,
OrderByClause As String,
GetDataBehaviour As GetDataOptions) As Boolean
'Return FileObject.GetData(WhereClause, OrderByClause, GetDataBehaviour)
Return _
GetData(FileObject, WhereClause, OrderByClause, String.Empty, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject,
IsOverrided As Boolean,
OverrideSQL As String) As Boolean
'Return FileObject.GetData(IsOverrided, OverrideSQL)
Return _
GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataOptions.None,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Retrieve data from the database.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="IsOverrided"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <remarks>
''' Use this method if you ever need to pass a complete SQL statement with GetDataBehaviour.
''' <para>
''' <list type="numbered">
''' <item>
''' Don't use this construct to generate Overrided SQL Statement internally.
''' i.e. Use this method if you ever need to pass GetDataBehaviour
''' other than GetDataBehaviour.CreateSubSelect.
''' </item>
''' <item>
''' To pass GetDataBehaviour.CreateSubSelect use another method, if you need
''' to pass Where Clause and Order By clause along with Auto Overrided SQL
''' e.g. GetData(WhereClause, OrderByClause, GetDataOptions.CreateSubSelect)
''' <para>
''' If you pass OverrideSQL along with GetDataBehaviour = GetDataOptions.CreateSubSelect
''' this method will use passed OverrideSQL, completely ignoring the GetDataOptions.CreateSubSelect
''' </para>
''' </item>
''' <item>
''' The first parameter "IsOverrided" is added to add overloaded method Passing it as false has NO impact,
''' i.e. whether you pass True or False this function will treat it as True.
''' </item>
''' </list>
''' </para>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Function GetData(ByRef FileObject As SqlFileObject,
IsOverrided As Boolean,
OverrideSQL As String,
GetDataBehaviour As GetDataOptions) As Boolean
Return _
GetData(FileObject, String.Empty, String.Empty, OverrideSQL, GetDataBehaviour,
m_intRecordsToFillInFindOrDetailFind)
End Function
''' --- GetData ------------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of GetData.
''' </summary>
''' <param name="FileObject"></param>
''' <param name="WhereClause"></param>
''' <param name="OrderByClause"></param>
''' <param name="OverrideSQL"></param>
''' <param name="GetDataBehaviour"></param>
''' <param name="RecordsToFill"></param>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overridable Function GetData(ByRef FileObject As SqlFileObject,
WhereClause As String,
OrderByClause As String,
OverrideSQL As String,
GetDataBehaviour As GetDataOptions,
ByRef RecordsToFill As Integer) As Boolean
Dim blnReturnValue As Boolean
Dim strFileName As String
m_intGetSequence += 1
' Get the file name (either Alias name or Base name).
If FileObject.AliasName.TrimEnd.Length > 0 Then
strFileName = FileObject.AliasName
Else
strFileName = FileObject.BaseName
End If
strFileName &= m_intGetSequence.ToString
Dim blnMethodWasExecuted As Boolean
blnMethodWasExecuted = MethodWasExecuted(m_strGetFlag, m_intGetSequence, "GET_FLAG")
If Not blnMethodWasExecuted Then
blnReturnValue = FileObject.GetData(WhereClause, OrderByClause, OverrideSQL, GetDataBehaviour,
RecordsToFill)
Me.InternalPageState(
FileObject.AliasName + FileObject.BaseName + "_GetData_" & m_intGetSequence.ToString) =
FileObject.GetInternalValues()
Me.InternalPageState(FileObject.AliasName + FileObject.BaseName + "_GetData") =
FileObject.GetInternalValues()
' Save the sequence information and set a flag indicating ACCEPT was run.
SetMethodExecutedFlag(m_strGetFlag, "GET_FLAG", m_intGetSequence)
Else
FileObject.SetInternalValues(
CType(
Me.InternalPageState(
FileObject.AliasName + FileObject.BaseName + "_GetData_" & m_intGetSequence.ToString),
Hashtable))
Me.Session(UniqueSessionID + "AccessOk") = FileObject.Exists
blnReturnValue = True
End If
Return blnReturnValue
End Function
#End If
''' --- GetWhereCondition --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="FieldName">The name of the field in the SQL statement.</param>
''' <param name="Value">The value to assign to the field.</param>
''' <param name="blnAddWhere">
''' Indicates that this is the first field in the WHERE clause and the keyword WHERE is to be
''' appended.
''' </param>
''' <remarks>
''' Returns a formatted SQL Where Condition by concatenating the parameters FieldName and Value.
''' This function will return nothing if the passed Value is a null date (01/01/0001).
''' or space.
''' </remarks>
''' <example>
''' </example>
''' <note>
''' This function should only be used in the Find procedure.
''' </note>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function GetWhereCondition(FieldName As String, Value As DateTime,
Optional ByRef blnAddWhere As Boolean = False) As String
Dim strReturnValue As StringBuilder = New StringBuilder("")
Try
Dim d As OldCoreDate = New OldCoreDate(Value)
If Value <> cNullDate Then
If ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cORACLE) Then
If blnAddWhere = True Then
strReturnValue.Append(" WHERE ")
strReturnValue.Append(" CorePackage.CORE_TONUM(")
strReturnValue.Append(FieldName)
strReturnValue.Append(" )")
blnAddWhere = False
Else
strReturnValue.Append(" AND ")
strReturnValue.Append(" CorePackage.CORE_TONUM(")
strReturnValue.Append(FieldName)
strReturnValue.Append(" )")
End If
Else
If blnAddWhere = True Then
strReturnValue.Append(" WHERE ")
strReturnValue.Append(" dbo.CORE_TONUM(")
strReturnValue.Append(FieldName)
strReturnValue.Append(" )")
blnAddWhere = False
Else
strReturnValue.Append(" AND ")
strReturnValue.Append(" dbo.CORE_TONUM(")
strReturnValue.Append(FieldName)
strReturnValue.Append(" )")
End If
End If
strReturnValue.Append(" = ")
strReturnValue.Append(d.Value)
End If
Return strReturnValue.ToString
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function GetWhereCondition(FieldName As String, Value As Object, ByRef blnAddWhere As Boolean,
IsBlankLiteral As Boolean) As String
Return GetWhereCondition(FieldName, Value.ToString, blnAddWhere, IsBlankLiteral, False)
End Function
'<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
'Public Function GetWhereCondition(ByVal FieldName As String, ByVal Value As Object, ByRef blnAddWhere As Boolean) As String
' Return GetWhereCondition(FieldName, Value.ToString, blnAddWhere, False, False)
'End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function GetWhereCondition(FieldName As String, Value As String, ByRef blnAddWhere As Boolean) As String
Return GetWhereCondition(FieldName, Value.ToString, blnAddWhere, False, False)
End Function
'<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Always)> _
'Public Function GetWhereCondition(ByVal FieldName As String, ByVal Value As Object, ByRef blnAddWhere As Boolean, ByVal IsBlankLiteral As Boolean, ByVal IsGeneric As Boolean) As String
' Return GetWhereCondition(FieldName, Value.ToString, blnAddWhere, IsBlankLiteral, IsGeneric)
'End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Public Function GetWhereCondition(FieldName As String, Value As String, ByRef blnAddWhere As Boolean,
IsBlankLiteral As Boolean) As String
Return GetWhereCondition(FieldName, Value.ToString, blnAddWhere, IsBlankLiteral, False)
End Function
''' --- GetWhereCondition --------------------------------------------------
''' <summary>
''' Generates a string value containing a SQL WHERE clause.
''' </summary>
''' <param name="FieldName">The name of the field in the SQL statement.</param>
''' <param name="Value">The value to assign to the field.</param>
''' <param name="blnAddWhere">
''' Indicates that this is the first field in the WHERE clause and the keyword WHERE is to be
''' appended. This is passed in using a variable.
''' </param>
''' <param name="IsBlankLiteral">Set this to True if we are passing a blank value (constant).</param>
''' <remarks>
''' Returns a formatted SQL Where Condition by concatenating the parameters FieldName and Value and substituting the
''' wildcard character (@) and creating a LIKE clause. This function will return nothing if the passed Value is blank
''' unless IsBlankLiteral is set to true.
''' or space.
''' </remarks>
''' <example>
''' 1. GetWhereCondition("RegionCode", "AABB", blnAddWhere) will return
''' " WHERE RegionCode = 'AABB'" <br />
''' 2. GetWhereCondition("RegionCode", "AABB") will return
''' " AND RegionCode = 'AABB'" <br />
''' 3. GetWhereCondition("RegionCode", "@") will return
''' " AND RegionCode LIKE '%'" <br />
''' 4. GetWhereCondition("RegionCode", "%", blnAddWhere) will return
''' " WHERE RegionCode LIKE '%'" <br />
''' 5. GetWhereCondition("RegionCode", " ", blnAddWhere, True) will return
''' " WHERE RegionCode = ' ' Or RegionCode IS NULL"
''' </example>
''' <note>
''' This function should only be used in the Find procedure.
''' </note>
''' <history>
''' [Campbell] 6/16/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Private Function GetWhereCondition(FieldName As String, Value As String, ByRef blnAddWhere As Boolean,
IsBlankLiteral As Boolean, IsGeneric As Boolean) As String
Dim strReturnValue As StringBuilder = New StringBuilder("")
Try
If Value.Trim.Length > 0 Then
If blnAddWhere = True Then
strReturnValue.Append(" WHERE ")
strReturnValue.Append(FieldName)
blnAddWhere = False
Else
strReturnValue.Append(" AND ")
strReturnValue.Append(FieldName)
End If
If IsNothing(m_strGenericRetrievalCharacter) OrElse m_strGenericRetrievalCharacter.Length = 0 Then
m_strGenericRetrievalCharacter = "@"
End If
If IsGeneric AndAlso Value.EndsWith(m_strGenericRetrievalCharacter + m_strGenericRetrievalCharacter) _
Then
'e.g. If the user enters M@@, all data records will be retrieved where the index begins with letter M to the highest value (that is the last segment value).
Value = Value.Replace(m_strGenericRetrievalCharacter, String.Empty)
If Value.Equals(String.Empty) Then
'In case user type one or more "@" (or character set as GenericRetrievalCharacter)
strReturnValue.Append(" LIKE '%'")
Else
strReturnValue.Append(" >= ")
strReturnValue.Append(StringToField(Value.Trim))
End If
ElseIf Value.IndexOf(m_strGenericRetrievalCharacter) >= 0 Then
Value = Replace(Value, m_strGenericRetrievalCharacter, "%")
strReturnValue.Append(" Like ")
strReturnValue.Append(StringToField(Value.Trim))
Else
strReturnValue.Append(" = ")
strReturnValue.Append(StringToField(Value))
End If
Else
'---------------
'Changed to " " as literal string while calling "GetWhereCondition" from "Find" procedure
'where as in similar case when called from "SelectProcessing", whole condition will be ignored
'September 12, 2005 11:23
'---------------
If blnAddWhere = True Then
strReturnValue.Append(" WHERE (")
strReturnValue.Append(FieldName)
blnAddWhere = False
Else
strReturnValue.Append(" AND (")
strReturnValue.Append(FieldName)
End If
strReturnValue.Append(" = ")
strReturnValue.Append(StringToField(Value))
strReturnValue.Append(" OR ")
strReturnValue.Append(FieldName)
strReturnValue.Append(" IS NULL)")
End If
Return strReturnValue.ToString
Catch ex As Exception
' Write the exception to the event log and throw an error.
ExceptionManager.Publish(ex)
Throw ex
End Try
End Function
#If TARGET_DB = "INFORMIX" Then
<EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)> _
Public Overridable Function WhileRetrieving(ByRef FileObject As IfxFileObject, Optional ByVal WhereClause As _
String = "", Optional ByVal OrderByClause As String = "", Optional ByVal Sequential As Boolean = False, Optional ByVal _
Backward As Boolean = False, Optional ByVal IsOptional As Boolean = False) As Boolean
Dim blnReturnValue As Boolean
blnReturnValue = FileObject.WhileRetrieving(WhereClause, OrderByClause, Sequential, Backward, IsOptional)
Return blnReturnValue
End Function
#Else
<EditorBrowsable(EditorBrowsableState.Advanced)>
Public Overridable Function WhileRetrieving(ByRef FileObject As SqlFileObject,
Optional ByVal WhereClause As String = "",
Optional ByVal OrderByClause As String = "",
Optional ByVal Sequential As Boolean = False,
Optional ByVal Backward As Boolean = False,
Optional ByVal IsOptional As Boolean = False) As Boolean
Dim blnReturnValue As Boolean
blnReturnValue = FileObject.WhileRetrieving(WhereClause, OrderByClause, Sequential, Backward, IsOptional)
Return blnReturnValue
End Function
#End If
''' --- OldValue -----------------------------------------------------------
''' <summary>
''' Returns the value of the underlying record buffer during editing.
''' </summary>
''' <param name="Name">A String containing the name of field.</param>
''' <param name="Value">A String containing the current value of field.</param>
''' <remarks>
''' The OldValue function returns the current item in the underlying record buffer. If the value passed in
''' as value is not found, then this value is returned in case OldValue is used on a field that is not currently
''' executing the Edit procedure.
''' <note>
''' OldValue can should only be used during the Edit procedure to return the value in
''' the associated record buffer. FieldText or FieldValue are used to handle the new value
''' associated to this field.
''' </note>
''' </remarks>
''' <example>T_TEMP.Value = OldValue("SURNAME", "Smith")</example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function OldValue(Name As String, Value As String) As String
' If the OldValue we are retrieving is the same as
' the current item on which the validate is executing,
' then return the value from the array, otherwise return
' the value passed in.
If IsUsingSqlServer() Then
Name = Name.Substring(Name.IndexOf("dbo.") + 4)
End If
If m_OldValue.Field = Name Then
Return m_OldValue.FieldText
Else
Return Value
End If
End Function
''' --- OldValue -----------------------------------------------------------
''' <summary>
''' Returns the value of the underlying record buffer during editing.
''' </summary>
''' <param name="Name">A String containing the name of field.</param>
''' <param name="Value">A String containing the current value of field.</param>
''' <remarks>
''' The OldValue function returns the current item in the underlying record buffer. If the value passed in
''' as value is not found, then this value is returned in case OldValue is used on a field that is not currently
''' executing the Edit procedure.
''' <note>
''' OldValue can should only be used during the Edit procedure to return the value in
''' the associated record buffer. FieldText or FieldValue are used to handle the new value
''' associated to this field.
''' </note>
''' </remarks>
''' <example>T_TEMP.Value = OldValue("YEAR", 1961)</example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function OldValue(Name As String, Value As Decimal) As Decimal
' If the OldValue we are retrieving is the same as
' the current item on which the validate is executing,
' then return the value from the array, otherwise return
' the value passed in.
If IsUsingSqlServer() Then
Name = Name.Substring(Name.IndexOf("dbo.") + 4)
End If
If m_OldValue.Field = Name Then
Return m_OldValue.FieldValue
Else
Return Value
End If
End Function
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function OldValue(Name As String, Value As Object) As Decimal
' If the OldValue we are retrieving is the same as
' the current item on which the validate is executing,
' then return the value from the array, otherwise return
' the value passed in.
If IsUsingSqlServer() Then
Name = Name.Substring(Name.IndexOf("dbo.") + 4)
End If
If m_OldValue.Field = Name Then
Return m_OldValue.FieldValue
Else
Return Value
End If
End Function
''' --- OldValue -----------------------------------------------------------
''' <summary>
''' Returns the value of the underlying record buffer during editing.
''' </summary>
''' <param name="Name">A String containing the name of field.</param>
''' <param name="Value">A String containing the current value of field.</param>
''' <remarks>
''' The OldValue function returns the current item in the underlying record buffer. If the value passed in
''' as value is not found, then this value is returned in case OldValue is used on a field that is not currently
''' executing the Edit procedure.
''' <note>
''' OldValue can should only be used during the Edit procedure to return the value in
''' the associated record buffer. FieldText or FieldValue are used to handle the new value
''' associated to this field. <br />
''' </note>
''' </remarks>
''' <example>T_TEMP.Value = OldValue("EMP_DATE", SysDateTime)</example>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Always)>
Protected Function OldValue(Name As String, Value As DateTime) As DateTime
' If the OldValue we are retrieving is the same as
' the current item on which the validate is executing,
' then return the value from the array, otherwise return
' the value passed in.
If IsUsingSqlServer() Then
Name = Name.Substring(Name.IndexOf("dbo.") + 4)
End If
If m_OldValue.Field = Name Then
Return CDate(m_OldValue.FieldText)
Else
Return Value
End If
End Function
''' --- IsUsingSqlServer ------------------------------------------------------
''' <exclude />
''' <summary>
''' Summary of IsUsingSqlServer.
''' </summary>
''' <remarks>
''' </remarks>
''' <history>
''' [Campbell] 7/4/2005 Created
''' </history>
''' --- End of Comments ----------------------------------------------------
<EditorBrowsable(EditorBrowsableState.Advanced)>
Private Function IsUsingSqlServer() As TriState
If m_blnIsUsingSqlServer = TriState.UseDefault Then
If ConfigurationManager.AppSettings("AuthenticationDatabase") Is Nothing OrElse
ConfigurationManager.AppSettings("AuthenticationDatabase").ToString.Equals(cSQL_SERVER) Then
m_blnIsUsingSqlServer = TriState.True
Else
m_blnIsUsingSqlServer = TriState.False
End If
End If
Return (m_blnIsUsingSqlServer = TriState.True)
End Function
#End Region
#End Region
End Class
End Namespace
|
#Region "Microsoft.VisualBasic::58eebdb24350b3c245dd8221150780f5, mzkit\src\mzmath\SingleCells\Deconvolute\MzMatrix.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: 54
' Code Lines: 26
' Comment Lines: 18
' Blank Lines: 10
' File Size: 1.67 KB
' Class MzMatrix
'
' Properties: matrix, mz, tolerance
'
' Function: ExportCsvSheet
'
'
' /********************************************************************************/
#End Region
Imports System.IO
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.ComponentModel.Collection.Generic
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
Imports Microsoft.VisualBasic.Text
Namespace Deconvolute
''' <summary>
''' a data matrix object in format of row is pixel and
''' column is mz intensity value across different
''' pixels
''' </summary>
Public Class MzMatrix
''' <summary>
''' m/z vector in numeric format of round to digit 4
''' </summary>
''' <returns></returns>
Public Property mz As Double()
''' <summary>
''' the script string of the mz diff tolerance for <see cref="mz"/>
''' </summary>
''' <returns></returns>
Public Property tolerance As String
''' <summary>
''' MS-imaging pixel data matrix or the
''' cells data matrix in a single cells raw data
''' </summary>
''' <returns></returns>
Public Property matrix As PixelData()
''' <summary>
''' Create a dataset matrix of spatial spot id or single cell id in rows and ions mz features in columns.
''' </summary>
''' <typeparam name="T"></typeparam>
''' <returns></returns>
Public Iterator Function ExportSpatial(Of T As {New, INamedValue, DynamicPropertyBase(Of Double)})() As IEnumerable(Of T)
Dim mzId As String() = mz _
.Select(Function(mzi) mzi.ToString("F4")) _
.ToArray
For Each spot As PixelData In matrix
Dim ds As New T With {
.Key = $"{spot.X},{spot.Y}"
}
Dim ms As Dictionary(Of String, Double) = ds.Properties
For i As Integer = 0 To mzId.Length - 1
Call ms.Add(mzId(i), spot.intensity(i))
Next
ds.Properties = ms
Yield ds
Next
End Function
Public Function ExportCsvSheet(file As Stream) As Boolean
Using text As New StreamWriter(file, Encodings.ASCII.CodePage) With {
.NewLine = vbLf
}
Call text.WriteLine("Pixels," & mz.JoinBy(","))
For Each pixelLine As String In matrix _
.AsParallel _
.Select(Function(pixel)
Return $"""{pixel.X},{pixel.Y}"",{pixel.intensity.JoinBy(",")}"
End Function)
Call text.WriteLine(pixelLine)
Next
Call text.Flush()
End Using
Return True
End Function
End Class
End Namespace
|
Namespace Base
''' <summary>
''' 说明:定义的用户结构类
''' </summary>
''' <remarks></remarks>
Public Structure UserInfo
''' <summary>
''' 说明:用户名
''' </summary>
''' <remarks></remarks>
Public UserName As String '操作员
''' <summary>
''' 说明:岗位
''' </summary>
''' <remarks></remarks>
Public Post As String '操作员所在岗位
''' <summary>
''' 说明:用户ID
''' </summary>
''' <remarks></remarks>
Public UserId As String '用户ID
Public Password As String '//用户密码 2017/5/9
''' <summary>
''' 说明:机器码
''' </summary>
''' <remarks></remarks>
Public MachineId As String '机位码
''' <summary>
''' 说明:是否授权开放机器码
''' </summary>
''' <remarks></remarks>
Public OpenMachine As String '是否开放机位码。1=开放。0为限制
''' <summary>
''' 说明:IPAddress
''' </summary>
''' <remarks></remarks>
Public IpAddress As String 'ip地址
''' <summary>
''' 说明:所属部门
''' </summary>
''' <remarks></remarks>
Public DeptName As String '部门信息
''' <summary>
''' 说明:Notes Full Name
''' </summary>
''' <remarks></remarks>
Public NoteFullName As String '//notes用户全称
''' <summary>
''' 说明:NotesID,对应Notes组织库的用户ID
''' </summary>
''' <remarks></remarks>
Public NotesId As String 'notesID--一串数字
''' <summary>
''' 说明:应用实例ID
''' </summary>
''' <remarks></remarks>
Public SysId As String
''' <summary>
''' 2017/12/11
''' 说明:备注信息
''' </summary>
''' <remarks></remarks>
Public Memo As String
''' <summary>
''' 2017/12/11
''' 说明:Net密码加密
''' </summary>
''' <remarks></remarks>
Public NetPassword As String
''' <summary>
''' 2017/12/11
''' 说明:NET调用机器码
''' </summary>
''' <remarks></remarks>
Public NetMachineId As String
End Structure
End NameSpace |
'---------------------------------------------------------------------------
' Author : Nguyễn Khánh Tùng
' Company : Thiên An ESS
' Created Date : Tuesday, June 17, 2008
'---------------------------------------------------------------------------
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.OracleClient
Imports ESS.Machine
Imports ESS.Entity.Entity
Namespace DBManager
Public Class ChucVu_DAL
#Region "Constructor"
Public Sub New()
End Sub
#End Region
#Region "Function"
Public Function Load_ChucVu(ByVal ID_chuc_vu As Integer) As DataTable
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(1) As SqlParameter
para(0) = New SqlParameter("@ID_chuc_vu", ID_chuc_vu)
Return UDB.SelectTableSP("PLAN_ChucVu_Load", para)
Else
Dim para(1) As OracleParameter
para(0) = New OracleParameter(":ID_chuc_vu", ID_chuc_vu)
Return UDB.SelectTableSP("PLAN_ChucVu_Load", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Load_ChucVu_List() As DataTable
Try
Return UDB.SelectTableSP("PLAN_ChucVu_Load_List")
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Insert_ChucVu(ByVal obj As ChucVu) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(1) As SqlParameter
para(0) = New SqlParameter("@Ma_chuc_vu", obj.Ma_chuc_vu)
para(1) = New SqlParameter("@Chuc_vu", obj.Chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Insert", para)
Else
Dim para(1) As OracleParameter
para(0) = New OracleParameter(":Ma_chuc_vu", obj.Ma_chuc_vu)
para(1) = New OracleParameter(":Chuc_vu", obj.Chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Insert", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Update_ChucVu(ByVal obj As ChucVu, ByVal ID_chuc_vu As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para(2) As SqlParameter
para(0) = New SqlParameter("@ID_chuc_vu", ID_chuc_vu)
para(1) = New SqlParameter("@Ma_chuc_vu", obj.Ma_chuc_vu)
para(2) = New SqlParameter("@Chuc_vu", obj.Chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Update", para)
Else
Dim para(2) As OracleParameter
para(0) = New OracleParameter(":ID_chuc_vu", ID_chuc_vu)
para(1) = New OracleParameter(":Ma_chuc_vu", obj.Ma_chuc_vu)
para(2) = New OracleParameter(":Chuc_vu", obj.Chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Update", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function Delete_ChucVu(ByVal ID_chuc_vu As Integer) As Integer
Try
If gDBType = DatabaseType.SQLServer Then
Dim para As SqlParameter
para = New SqlParameter("@ID_chuc_vu", ID_chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Delete", para)
Else
Dim para As OracleParameter
para = New OracleParameter(":ID_chuc_vu", ID_chuc_vu)
Return UDB.ExecuteSP("PLAN_ChucVu_Delete", para)
End If
Catch ex As Exception
Throw ex
End Try
End Function
Public Function CheckExist_ChucVu(ByVal Ma_chuc_vu As String) As Boolean
Try
Dim dt As New DataTable
If gDBType = DatabaseType.SQLServer Then
Dim para As SqlParameter
para = New SqlParameter("@Ma_chuc_vu", Ma_chuc_vu)
dt = UDB.SelectTableSP("PLAN_ChucVu_CheckExist", para)
Else
Dim para As OracleParameter
para = New OracleParameter(":Ma_chuc_vu", Ma_chuc_vu)
dt = UDB.SelectTableSP("PLAN_ChucVu_CheckExist", para)
End If
If dt.Rows.Count = 0 Then
Return False
Else
Return True
End If
Catch ex As Exception
Throw ex
End Try
End Function
#End Region
End Class
End Namespace
|
Imports System.Globalization
Imports System.Text.RegularExpressions
Public Class Validator
Sub New()
End Sub
'ตรวจสอบการตั้งชื่อ Username
Function Check_UserID(ByVal numlength As Integer, ByVal userchar As String) As String
Dim message As String = ""
If numlength < 6 Or numlength > 20 Then
message = res.Message("Validator1") '"รหัสผู้ใช้งานต้องมีความยาว 6-20 ตัวอักษร"
Else
For i = 0 To userchar.Length - 1
If Char.IsLetter(userchar.Chars(i)) Or Regex.IsMatch(userchar.Chars(i), "(?:[^a-z0-9 ]|(?<=['""])s)") Then
i = userchar.Length
Else
If i = userchar.Length - 1 Then
message = res.Message("Validator2") '"รหัสผู้ใช้งานต้องมีตัวอักษรหรืออักขระพิเศษอย่างน้อย 1 ตัว"
End If
End If
Next
For i = 0 To userchar.Length - 1
If Char.IsNumber(userchar.Chars(i)) Then
i = userchar.Length
Else
If i = userchar.Length - 1 Then
message = res.Message("Validator3") '"รหัสผู้ใช้งานต้องมีตัวเลขอย่างน้อย 1 ตัว"
End If
End If
Next
End If
Return message
End Function
'ตรวจสอบการใช้ Username ซ้ำกัน
Function Check_SameUser(ByVal userchar As String) As Integer
Dim loginprofile As New LoginProfile
loginprofile.USER_ID = userchar
Dim loginbiz As New LoginProfileBiz
Return loginbiz.Get_UserID(loginprofile).Rows.Count
End Function
'ตรวจสอบการตั้งชื่อ Password
Function Check_Password(ByVal numlength As Integer, ByVal passchar As String) As String
Dim message As String = ""
Dim ch As String = ""
Dim temp As String = ""
Dim s As String = ""
If numlength < 8 Or numlength > 30 Then
message = res.Message("Validator4") '"รหัสผ่านต้องมีความยาว 8-30 ตัวอักษร"
Else
For i = 0 To passchar.Length - 1
If Char.IsLetter(passchar.Chars(i)) Then
i = passchar.Length
Else
If i = passchar.Length - 1 Then
message = res.Message("Validator5") '"รหัสผ่านต้องมีตัวอักษรอย่างน้อย 1 ตัว"
End If
End If
Next
For i = 0 To passchar.Length - 1
If Char.IsNumber(passchar.Chars(i)) Then
i = passchar.Length
Else
If i = passchar.Length - 1 Then
message = res.Message("Validator6") '"รหัสผ่านต้องมีตัวเลขอย่างน้อย 1 ตัว"
End If
End If
Next
End If
For i = 0 To passchar.Length - 1
If passchar.Substring(i, 1).Equals(ch) Then
temp = temp + passchar.Substring(i, 1)
If temp.Length = 3 Then
message = res.Message("Validator7") '"รหัสผ่านห้ามมีตัวอักษรหรือตัวเลขซ้ำติดกันตั้งแต่ 3 ตัวขึ้นไป"
End If
Else
temp = passchar.Substring(i, 1)
End If
ch = passchar.Substring(i, 1)
Next
Return message
End Function
'ตรวจสอบการใช้ Password ซ้ำ
Function Check_SamePass(ByVal userchar As String, ByVal password As String) As String
Dim dt As DataTable
Dim order As Integer = 0
Dim sum As Integer = 0
Dim msg As String = ""
Dim loginprofile As New LoginProfile
Dim DeCrypt As New SSOSecurity
loginprofile.USER_ID = userchar
Dim loginbiz As New LoginProfileBiz
dt = loginbiz.Get_UserID(loginprofile)
For i As Integer = 1 To 6
If dt.Rows(0)("PASSWORD0" + i.ToString).ToString <> "" Then
If password = DeCrypt.DeCryptData(dt.Rows(0)("PASSWORD0" + i.ToString).ToString) Then
order = i
End If
End If
Next
If order > 0 Then
If order = 1 Then
msg = res.Message("Validator8") '"คุณใช้รหัสผ่านซ้ำกับรหัสผ่านปัจจุบัน"
Else
msg = res.Message("Validator9") '"คุณใช้รหัสผ่านซ้ำกับ 6 ครั้งล่าสุด"
End If
End If
Return msg
End Function
'ตรวจสอบเฉพาะตัวอักษรภาษาอังกฤษและตัวเลขเท่านั้น
Function Check_CharAndNum(ByVal pchar As String) As Boolean
If System.Text.RegularExpressions.Regex.IsMatch(pchar, "^[0-9a-zA-Z]+$") = False Then
Return False
Else
Return True
End If
End Function
Dim invalid As Boolean = False
Public Function IsValidEmail(strIn As String) As Boolean
invalid = False
If String.IsNullOrEmpty(strIn) Then Return False
' Use IdnMapping class to convert Unicode domain names.
Try
strIn = Regex.Replace(strIn, "(@)(.+)$", AddressOf Me.DomainMapper,
RegexOptions.None, TimeSpan.FromMilliseconds(200))
Catch e As RegexMatchTimeoutException
Return False
End Try
If invalid Then Return False
' Return true if strIn is in valid e-mail format.
Try
Return Regex.IsMatch(strIn, _
"^(?("")(""[^""]+?""@)|(([0-9a-z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-z])@))" + _
"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-z][-\w]*[0-9a-z]*\.)+[a-z0-9]{2,24}))$",
RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))
Catch e As RegexMatchTimeoutException
Return False
End Try
End Function
Private Function DomainMapper(match As Match) As String
' IdnMapping class with default property values.
Dim idn As New IdnMapping()
Dim domainName As String = match.Groups(2).Value
Try
domainName = idn.GetAscii(domainName)
Catch e As ArgumentException
invalid = True
End Try
Return match.Groups(1).Value + domainName
End Function
End Class
|
Imports System.IO
Public Class FormMain
Dim formLoaded As Boolean = False
Dim folderPath As String = ""
Dim myOriginalDataTable As DataTable = Nothing
Dim mySearchDataTable As DataTable = Nothing
Dim myReplacementDataTable As DataTable = Nothing
Dim myFileNameList As New List(Of FileNames)
Dim mySearchList As New List(Of FileNames)
Dim myFileTypeFilter As Common.FileTypeFilter
Private Sub FormFileRename_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'datagridview
Me.DataGridViewFileNamesOriginal.DefaultCellStyle.Font = New Font("Tahoma", 14)
myFileTypeFilter = Common.FileTypeFilter.None
formLoaded = True
End Sub
Private Sub ButtonSelectFolder_Click(sender As Object, e As EventArgs) Handles ButtonSelectFolder.Click
FolderBrowserDialogFileNames.SelectedPath = My.Settings.ModFolder
If (FolderBrowserDialogFileNames.ShowDialog() = DialogResult.OK) Then
TextBoxSelectFolder.Text = FolderBrowserDialogFileNames.SelectedPath
folderPath = TextBoxSelectFolder.Text
My.Settings.ModFolder = FolderBrowserDialogFileNames.SelectedPath
My.Settings.Save()
End If
End Sub
#Region "Load Files"
Private Sub ButtonFileLoad_Click(sender As Object, e As EventArgs) Handles ButtonFileLoad.Click
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
Private Sub LoadFiles(folderPathName As String, refreshGrid As Boolean)
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
'get file names
myFileNameList = New List(Of FileNames)
GetAllFiles(myFileNameList, folderPathName, True)
'load grid
If refreshGrid Then
myOriginalDataTable = Nothing
myOriginalDataTable = CreateDataTable()
End If
LoadGrid(myOriginalDataTable, myFileNameList)
End If
End Sub
Private Sub GetAllFiles(ByRef myFileNameList As List(Of FileNames), rootPath As String, recursiveSearch As Boolean)
Dim objRoot As New DirectoryInfo(rootPath)
Dim objSubDir As DirectoryInfo
Dim objFile As FileInfo
If objRoot.Exists Then
'if recursive search then loop subdirectories
If recursiveSearch Then
Dim myDirectories = objRoot.GetDirectories.Where(Function(file) ((file.Attributes And FileAttributes.Hidden) <> FileAttributes.Hidden) _
AndAlso (file.Attributes And FileAttributes.System) <> FileAttributes.System)
For Each objSubDir In myDirectories
'add to list
GetAllFiles(myFileNameList, objSubDir.FullName, True)
Next
End If
'keep this for loop
For Each objFile In objRoot.GetFiles
FillFileNameList(myFileNameList, objFile.FullName, objFile.Name, objFile.Extension, myFileTypeFilter)
Next
End If
End Sub
Private Sub FillFileNameList(ByRef fileNameList As List(Of FileNames), ByVal fullFileName As String, ByVal fileName As String,
ByVal fileExtension As String, ByVal fileTypeFilter As Common.FileTypeFilter)
Dim fileCollection As New FileNames
If fileTypeFilter = Common.FileTypeFilter.Audio Then
'Audio
If Common.AudioFileExtensions.Where(Function(x) x.Contains(fileExtension.ToUpper)).Count > 0 Then
'only add audio files
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
ElseIf fileTypeFilter = Common.FileTypeFilter.Video Then
'Video
If Common.VideoFileExtensions.Where(Function(x) x.Contains(fileExtension.ToUpper)).Count > 0 Then
'only add audio files
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
ElseIf fileTypeFilter = Common.FileTypeFilter.Photos Then
'Photos
If Common.PhotoFileExtensions.Where(Function(x) x.Contains(fileExtension.ToUpper)).Count > 0 Then
'only add audio files
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
ElseIf fileTypeFilter = Common.FileTypeFilter.Documents Then
'Documents
If Common.DocumentFileExtensions.Where(Function(x) x.Contains(fileExtension.ToUpper)).Count > 0 Then
'only add audio files
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
ElseIf fileTypeFilter = Common.FileTypeFilter.Other Then
If fileExtension = TextBoxExtension.Text Then
'Other
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
Else
'only add audio files
fileCollection.FileFullName = fullFileName
fileCollection.FileName = fileName
fileNameList.Add(fileCollection)
End If
End Sub
Private Function CreateDataTable() As DataTable
Dim dt As New DataTable("DataTableFileNames")
'Add the following columns: Name. Length Last Write Time, Creation Time
dt.Columns.AddRange({New DataColumn("FullName"),
New DataColumn("FileName")})
Return dt
End Function
Private Sub FillDataTable(ByRef dt As DataTable, ByVal fileNamesList As List(Of FileNames))
Try
'Loop through each file in the list
For Each file As FileNames In fileNamesList
'Create a new row
Dim dr As DataRow = dt.NewRow
'Set the data
dr(0) = file.FileFullName
dr(1) = file.FileName
'Add the row to the data table
dt.Rows.Add(dr)
Next
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
Private Sub LoadGrid(dtTable As DataTable, fileList As List(Of FileNames))
'fill datatable
FillDataTable(dtTable, fileList)
DataGridViewFileNamesOriginal.DataSource = dtTable
If dtTable Is Nothing Then Exit Sub
LabelTotalFilesOriginalCounter.Text = CStr(dtTable.Rows.Count)
'populate data in the grid
If DataGridViewFileNamesOriginal.Columns.Count > 0 Then
DataGridViewFileNamesOriginal.AutoSizeColumnsMode = DataGridViewAutoSizeColumnMode.Fill
DataGridViewFileNamesOriginal.AutoResizeColumns()
DataGridViewFileNamesOriginal.Columns(0).Visible = False
Else
MsgBox("No files found!")
End If
End Sub
#End Region
#Region "Search FileNames"
Private Sub ButtonSearch_Click(sender As Object, e As EventArgs) Handles ButtonSearch.Click
Dim searchText As String
searchText = TextBoxSearch.Text
SearchFiles(DataGridViewFileNamesOriginal, searchText)
End Sub
Private Sub ButtonReset_Click(sender As Object, e As EventArgs) Handles ButtonReset.Click
TextBoxSearch.Text = ""
SearchFiles(DataGridViewFileNamesOriginal, String.Empty)
End Sub
Private Sub TextBoxSearch_KeyUp(sender As Object, e As KeyEventArgs) Handles TextBoxSearch.KeyUp
SearchFiles(DataGridViewFileNamesOriginal, TextBoxSearch.Text)
End Sub
Private Sub SearchFiles(myDataGrid As DataGridView, searchString As String)
If myOriginalDataTable IsNot Nothing AndAlso myOriginalDataTable.Rows.Count > 0 Then
Dim myDataView As New DataView
myDataView = myOriginalDataTable.DefaultView
myDataView.RowFilter = "[FileName] Like '%" & searchString & "%'"
myDataGrid.DataSource = myDataView
LabelTotalFilesOriginalCounter.Text = CStr(myDataView.Count)
End If
End Sub
#End Region
#Region "Replace FileNames"
Private Sub ButtonReplaceFileNames_Click(sender As Object, e As EventArgs) Handles ButtonReplaceFileNames.Click
Dim oldSting As String = ""
Dim newString As String = ""
If TextBoxFileNameOriginal.Text = "" Then
MsgBox("Enter file text to replace")
TextBoxFileNameOriginal.Focus()
Exit Sub
Else
oldSting = TextBoxFileNameOriginal.Text
End If
newString = TextBoxFileNameReplacement.Text
If DataGridViewFileNamesOriginal.Rows.Count = 0 Then
MsgBox("No files found for selected folder or Files are not loaded!")
Exit Sub
End If
'get the file name collection
Dim fileNameCollection As List(Of String)
fileNameCollection = GetFileNameCollection()
'replace file names
If fileNameCollection.Count > 0 Then
ReplaceFileNames(fileNameCollection, oldSting, newString)
Else
MsgBox("No files to replace")
End If
End Sub
Private Function GetFileNameCollection() As List(Of String)
Dim value As String = String.Empty
Dim selectedFileNameCollection As New List(Of String)
If myOriginalDataTable.Rows.Count > 0 Then
For Each SelectedRow As DataGridViewRow In DataGridViewFileNamesOriginal.Rows
value = (SelectedRow.Cells("FullName").Value.ToString.Trim)
If value <> String.Empty Then
selectedFileNameCollection.Add(value)
End If
Next
Else
MsgBox("No files in the grid, pls load files")
End If
Return selectedFileNameCollection
End Function
Private Sub ReplaceFileNames(filesCollection As List(Of String), oldCharacters As String, newCharacters As String)
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName = String.Empty OrElse Not Directory.Exists(folderPathName) Then
MsgBox("Please enter folder path!")
Exit Sub
End If
Dim rootFilePath As String = ""
Dim originalFileName As String = ""
Dim newFileName As String = ""
Dim replacementCount As Integer = 0
For Each fullFileName As String In filesCollection
originalFileName = Path.GetFileName(fullFileName)
If originalFileName.Contains(oldCharacters) Then
rootFilePath = Path.GetDirectoryName(fullFileName)
newFileName = originalFileName.Replace(oldCharacters, newCharacters)
Try
System.IO.File.Move(fullFileName, rootFilePath & "\" & newFileName)
replacementCount += 1
Catch ex As Exception
'do not handle access denied
End Try
End If
Next
myFileTypeFilter = Common.FileTypeFilter.Other
DataGridViewFileNamesOriginal.DataSource = Nothing
LoadFiles(folderPathName, True)
If replacementCount > 0 Then
MsgBox("File names replaced = " & replacementCount)
SearchFiles(DataGridViewFileNamesOriginal, TextBoxSearch.Text)
End If
End Sub
#End Region
#Region "Filter File Types by Extension"
Private Sub RadioButtonPhotos_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonPhotos.CheckedChanged
If Not formLoaded Then Exit Sub
DataGridViewFileNamesOriginal.DataSource = Nothing
myFileTypeFilter = Common.FileTypeFilter.Photos
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
Private Sub RadioButtonAudio_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonAudio.CheckedChanged
If Not formLoaded Then Exit Sub
myFileTypeFilter = Common.FileTypeFilter.Audio
DataGridViewFileNamesOriginal.DataSource = Nothing
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
Private Sub RadioButtonVideos_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonVideos.CheckedChanged
If Not formLoaded Then Exit Sub
myFileTypeFilter = Common.FileTypeFilter.Video
DataGridViewFileNamesOriginal.DataSource = Nothing
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
Private Sub RadioButtonDocuments_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButtonDocuments.CheckedChanged
If Not formLoaded Then Exit Sub
myFileTypeFilter = Common.FileTypeFilter.Documents
DataGridViewFileNamesOriginal.DataSource = Nothing
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
Private Sub TextBoxExtension_TextChanged(sender As Object, e As EventArgs) Handles TextBoxExtension.TextChanged
If TextBoxExtension.Text.Length < 3 Then Exit Sub
RadioButtonAudio.Checked = False
RadioButtonVideos.Checked = False
RadioButtonPhotos.Checked = False
RadioButtonDocuments.Checked = False
myFileTypeFilter = Common.FileTypeFilter.Other
DataGridViewFileNamesOriginal.DataSource = Nothing
Dim folderPathName As String = TextBoxSelectFolder.Text
If folderPathName <> String.Empty AndAlso Directory.Exists(folderPathName) Then
LoadFiles(folderPathName, True)
Else
MsgBox("Please enter folder path!")
End If
End Sub
#End Region
End Class
|
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Windows.Forms
Imports System.IO
Public Class DAL
Public Shared Connection As SqlConnection = Nothing
Shared Function CreateConnection() As Integer
'Connection = New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=" & Environment.GetEnvironmentVariable("APPDATA") & "\Clínica Informática\BD\BD-C.I.mdf" & ";Integrated Security=True;Connect Timeout=30")
Connection = New SqlConnection("Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\Resources\BD-C.I.mdf;Integrated Security=True")
Return 0
End Function
Shared Sub OpenConnection()
If Connection.State <> ConnectionState.Open Then
Connection.Open()
End If
End Sub
Shared Sub CloseConnection()
If Connection.State <> ConnectionState.Closed Then
Connection.Close()
End If
End Sub
Shared Sub TerminateConnection()
If Connection.State <> ConnectionState.Closed Then
Connection.Dispose()
End If
End Sub
Shared Function ExecuteScalar(ByVal SQLText As String, ByRef Params As ArrayList) As Object
Dim cmdSQL As New SqlCommand(SQLText, Connection)
Try
If Not (Params Is Nothing) Then
For Each Param As SqlParameter In Params
cmdSQL.Parameters.Add(Param)
Next
End If
OpenConnection()
Return cmdSQL.ExecuteScalar
Catch ex As Exception
'Inserir codigo debugger aqui
Return -1
Finally
cmdSQL.Dispose()
CloseConnection()
End Try
End Function
Shared Function ExecuteNonQuery(ByVal SQLText As String, ByRef Params As ArrayList) As Integer
Dim cmdSQL As New SqlCommand(SQLText, Connection)
Try
If Params IsNot Nothing Then
For Each Param As SqlParameter In Params
cmdSQL.Parameters.Add(Param)
Next
End If
OpenConnection()
Return CInt(cmdSQL.ExecuteNonQuery)
Catch ex As Exception
'Inserir codigo debugger aqui
Return -1
Finally
CloseConnection()
cmdSQL.Parameters.Clear()
cmdSQL.Dispose()
End Try
End Function
Shared Function ExecuteQuery(ByVal SQLText As String, ByRef Params As ArrayList) As ArrayList
Dim cmdSQL As New SqlCommand(SQLText, Connection)
Dim Result As New ArrayList
Try
If Not (Params Is Nothing) Then
For Each Param As SqlParameter In Params
cmdSQL.Parameters.Add(Param)
Next
End If
OpenConnection()
Dim dr As SqlDataReader = cmdSQL.ExecuteReader
While dr.Read()
For i As Integer = 0 To dr.FieldCount - 1
Result.Add(dr(i))
Next
End While
Return Result
Catch ex As Exception
'Inserir codigo debugger aqui
Return Nothing
Finally
cmdSQL.Dispose()
CloseConnection()
End Try
End Function
Shared Function ExecuteQueryDT(ByVal SQLText As String, ByRef Params As ArrayList) As DataTable
Dim cmdSQL As New SqlDataAdapter(SQLText, Connection)
Dim Result As New DataTable
Try
If Not (Params Is Nothing) Then
For Each Param As SqlParameter In Params
cmdSQL.SelectCommand.Parameters.Add(Param)
Next
End If
OpenConnection()
'Result.Clear()
cmdSQL.AcceptChangesDuringFill = True
cmdSQL.Fill(Result)
Return Result
Catch ex As Exception
MsgBox("Erro ao conectar à base-de-dados: " & ex.Message)
Application.Exit()
Return Nothing
Finally
cmdSQL.Dispose()
CloseConnection()
End Try
End Function
Shared Sub BackUpDB(ByVal backupfile As String)
Try
Dim bakadp As SqlDataAdapter
Dim bakds As DataSet
Dim dbname As String = DAL.ExecuteScalar("SELECT DB_NAME() AS DataBaseName", Nothing)
Dim strbakSQLSentence As String = "BACKUP DATABASE [" & dbname & "] TO DISK = '" & backupfile & "'"
strbakSQLSentence.Replace("'", Chr(34))
bakadp = New SqlDataAdapter(strbakSQLSentence, Connection)
Connection.Open()
bakds = New DataSet
bakadp.Fill(bakds)
Connection.Close()
MsgBox("Backup feito com êxito!", vbOKOnly, "Êxito!")
Catch ex As Exception
MsgBox("Erro ao fazer backup! " & ex.Message)
Finally
If Connection.State = ConnectionState.Open Then
Connection.Close()
Connection.Dispose()
End If
End Try
End Sub
Shared Sub RestoreDB(ByVal restorefile As String)
Dim resCmd As SqlCommand
Dim databaseloc As String = DAL.ExecuteScalar("select physical_name from sys.database_files", Nothing)
Dim databaselogloc As String = ""
For i = 0 To databaseloc.Length - 5
databaselogloc += databaseloc.Chars(i)
Next
databaselogloc = databaselogloc + "_log.ldf"
Dim dbname As String = DAL.ExecuteScalar("SELECT DB_NAME() AS DataBaseName", Nothing)
Try
Dim strResSQLsentencia As String = "RESTORE DATABASE [" & dbname & "] FROM DISK = '" & restorefile & "' WITH MOVE 'ClinicaInformatica' TO '" & databaseloc & "' , MOVE 'ClinicaInformatica_log' TO '" & databaselogloc & "' , REPLACE"
Connection.Open()
resCmd = New SqlCommand("ALTER DATABASE [" & dbname & "] SET OFFLINE WITH ROLLBACK IMMEDIATE", Connection)
resCmd.ExecuteNonQuery()
resCmd = New SqlCommand(strResSQLsentencia, Connection)
resCmd.ExecuteNonQuery()
resCmd = New SqlCommand("ALTER DATABASE [" & dbname & "] SET ONLINE", Connection)
resCmd.ExecuteNonQuery()
Connection.Close()
MsgBox("Backup restaurado com êxito!", MsgBoxStyle.OkOnly, "Restauro Backup")
Catch ex As Exception
resCmd = New SqlCommand("ALTER DATABASE [" & dbname & "] SET ONLINE", Connection)
resCmd.ExecuteNonQuery()
Connection.Close()
MsgBox("Não foi possível restaurar! " & ex.Message, vbOKOnly)
Finally
If Connection.State = ConnectionState.Open Then
Connection.Close()
Connection.Dispose()
End If
End Try
End Sub
Shared Function return_logical_files()
Dim resCmd As SqlCommand
resCmd = New SqlCommand("RESTORE FILELISTONLY FROM DISK = 'C:\Users\Emanuel\OneDrive\Documentos\backup.CIDB'", Connection)
Return resCmd.ExecuteScalar()
End Function
'Shared Sub store_pic_Sql(ByVal img As Image, ByVal id As Integer)
' 'for SQL
' Dim sql As String = "insert into picture(id,image) values(@id,@imgData)"
' Dim command1 As SqlCommand = New SqlCommand(sql, Connection)
' Dim sqlpara As New SqlParameter("imgData", SqlDbType.Image)
' Dim sqlparaid As New SqlParameter("id", id)
' Dim mStream As MemoryStream = New MemoryStream()
' img.Save(mStream, ImageFormat.Png)
' sqlpara.SqlValue = mStream.GetBuffer
' command1.Parameters.Add(sqlpara)
' OpenConnection()
' command1.ExecuteNonQuery()
' CloseConnection()
'End Sub
'Shared Function Load_Pic_Sql(ByVal sql As String) As Image
' Try
' Dim command1 As SqlCommand = New SqlCommand(sql, Connection)
' command1.Connection.Open()
' Dim reader As SqlDataReader = command1.ExecuteReader
' reader.Read()
' command1.Connection.Close()
' Return img
' Catch ex As Exception
' MessageBox.Show("Erro na base-de-dados: " & ex.Message)
' Workspace.Close()
' Return Nothing
' End Try
'End Function
'Shared Function ExecuteQuery(ByVal SQLText As String, ByRef Params As ArrayList) As DataTable
' Dim cmdSQL As New OleDb.OleDbCommand(SQLText, Connection)
' Dim Result As New DataTable
' Try
' For Each Param As OleDb.OleDbParameter In Params
' cmdSQL.Parameters.Add(Param)
' Next
' OpenConnection()
' Dim dr As OleDbDataReader = cmdSQL.ExecuteQuery()
' If dr.Read() Then
' For i As Integer = 0 To dr.FieldCount - 1
' Result.Add(dr(i))
' Next
' End If
' Return Result
' Catch
' Return Nothing
' Finally
' cmdSQL.Dispose()
' CloseConnection()
' End Try
'End Function
End Class |
Imports System.IO
Imports System.Reflection
Imports System.ComponentModel
Imports System.Resources
Imports System.Globalization
Imports Symmex.Snowflake.Common
Public Class ResourceManager
Inherits ObservableObject
Private _CurrentCultureChangedEventHandler As EventHandler(Of EventArgs)
Private ReadOnly Property CurrentCultureChangedEventHandler As EventHandler(Of EventArgs)
Get
If _CurrentCultureChangedEventHandler Is Nothing Then
_CurrentCultureChangedEventHandler = New EventHandler(Of EventArgs)(AddressOf Me.OnCurrentCultureChanged)
End If
Return _CurrentCultureChangedEventHandler
End Get
End Property
Private _Resources As Dictionary(Of CultureInfo, Dictionary(Of String, Object))
Private ReadOnly Property Resources As Dictionary(Of CultureInfo, Dictionary(Of String, Object))
Get
If _Resources Is Nothing Then
_Resources = New Dictionary(Of CultureInfo, Dictionary(Of String, Object))()
End If
Return _Resources
End Get
End Property
Private _Converters As ResourceConverterCollection
Public ReadOnly Property Converters As ResourceConverterCollection
Get
If _Converters Is Nothing Then
_Converters = New ResourceConverterCollection()
Me.LoadConverters()
End If
Return _Converters
End Get
End Property
Default Public ReadOnly Property Item(name As String) As Object
Get
Return Me.GetResource(name)
End Get
End Property
Public Sub New()
CultureManager.CurrentCultureChangedEvent.AddHandler(Me.CurrentCultureChangedEventHandler)
End Sub
Private Sub LoadConverters()
Me.Converters.Add(New TextResourceConverter())
End Sub
Public Sub LoadResources(fromAssembly As Assembly)
Dim rootName = fromAssembly.GetName().Name + ".g.resources"
Dim rootStream = fromAssembly.GetManifestResourceStream(rootName)
Dim rootReader As New ResourceReader(rootStream)
Dim allEntries = rootReader.Cast(Of DictionaryEntry)()
Dim cultureGroups = (From entry In allEntries
Let fullName = DirectCast(entry.Key, String).ToLower()
Where fullName.StartsWith("resources")
Let culture = Me.GetResourceCulture(fullName)
Let name = Path.GetFileName(fullName)
Let value = Me.GetResourceValue(name, DirectCast(entry.Value, Stream))
Group New With {.Name = name, .Value = value} By culture Into Group
Select New With {.Culture = culture,
.Resources = Group})
For Each cultureGroup In cultureGroups
Dim rd As Dictionary(Of String, Object) = Nothing
If Not Me.Resources.TryGetValue(cultureGroup.Culture, rd) Then
rd = New Dictionary(Of String, Object)()
Me.Resources.Add(cultureGroup.Culture, rd)
End If
For Each resource In cultureGroup.Resources
rd(resource.Name) = resource.Value
Next
Next
End Sub
Private Function GetResourceValue(name As String, s As Stream) As Object
Dim ext = Path.GetExtension(name)
If Me.Converters.Contains(ext) Then
Return Me.Converters(ext).Convert(s)
Else
Return s
End If
End Function
Private Function GetResourceCulture(fullName As String) As CultureInfo
Dim parts = fullName.Split(New Char() {"/"c}, StringSplitOptions.RemoveEmptyEntries)
Dim cultureName = parts(1)
Return CultureInfo.GetCultureInfo(cultureName)
End Function
Public Function GetResource(Of T)(name As String) As T
Return DirectCast(Me.GetResource(name), T)
End Function
Public Function GetResource(name As String) As Object
name = name.ToLower()
Dim dict As Dictionary(Of String, Object) = Nothing
Dim value As Object = Nothing
If CultureManager.CurrentCulture Is Nothing OrElse Not Me.Resources.TryGetValue(CultureManager.CurrentCulture, dict) OrElse Not dict.TryGetValue(name, value) Then
If Me.Resources.TryGetValue(CultureManager.DefaultCulture, dict) Then
dict.TryGetValue(name, value)
Else
Debug.Write(String.Format("{0} does not contain a resource with the name {1}.", Me.GetType().Name, name))
End If
End If
Return value
End Function
Private Sub OnCurrentCultureChanged(sender As Object, e As EventArgs)
Me.OnPropertyChanged(String.Empty)
End Sub
End Class |
#Region "License"
' The MIT License (MIT)
'
' Copyright (c) 2017 Richard L King (TradeWright Software Systems)
'
' 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.
#End Region
Imports ChartSkil27
Imports StudyUtils27
Imports TWUtilities40
Public NotInheritable Class ChartControlToolstrip
Inherits ToolStrip
Private mChart As MarketChart
Private mBarSeries As BarSeries
Private components As System.ComponentModel.IContainer
Friend WithEvents mBarsToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mCandlesticksToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mLineToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mToolStripSeparator4 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mShowCrosshairToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mShowCursorToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mToolStripSeparator5 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mThinnerBarsToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mThickerBarsToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mToolStripSeparator6 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mNarrowToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mWidenToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScaleDownToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScaleUpToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mToolStripSeparator7 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mScrollDownToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScrollUpToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScrollLeftToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScrollRightToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mScrollEndToolStripButton As System.Windows.Forms.ToolStripButton
Friend WithEvents mToolStripSeparator8 As System.Windows.Forms.ToolStripSeparator
Friend WithEvents mAutoScaleToolStripButton As System.Windows.Forms.ToolStripButton
Public Sub New()
MyBase.New()
Me.components = New System.ComponentModel.Container()
InitializeComponent()
Me.Enabled = False
End Sub
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(ChartControlToolstrip))
mBarsToolStripButton = New System.Windows.Forms.ToolStripButton
mCandlesticksToolStripButton = New System.Windows.Forms.ToolStripButton
mLineToolStripButton = New System.Windows.Forms.ToolStripButton
mToolStripSeparator4 = New System.Windows.Forms.ToolStripSeparator
mShowCrosshairToolStripButton = New System.Windows.Forms.ToolStripButton
mShowCursorToolStripButton = New System.Windows.Forms.ToolStripButton
mToolStripSeparator5 = New System.Windows.Forms.ToolStripSeparator
mThinnerBarsToolStripButton = New System.Windows.Forms.ToolStripButton
mThickerBarsToolStripButton = New System.Windows.Forms.ToolStripButton
mToolStripSeparator6 = New System.Windows.Forms.ToolStripSeparator
mNarrowToolStripButton = New System.Windows.Forms.ToolStripButton
mWidenToolStripButton = New System.Windows.Forms.ToolStripButton
mScaleDownToolStripButton = New System.Windows.Forms.ToolStripButton
mScaleUpToolStripButton = New System.Windows.Forms.ToolStripButton
mToolStripSeparator7 = New System.Windows.Forms.ToolStripSeparator
mScrollDownToolStripButton = New System.Windows.Forms.ToolStripButton
mScrollUpToolStripButton = New System.Windows.Forms.ToolStripButton
mScrollLeftToolStripButton = New System.Windows.Forms.ToolStripButton
mScrollRightToolStripButton = New System.Windows.Forms.ToolStripButton
mScrollEndToolStripButton = New System.Windows.Forms.ToolStripButton
mToolStripSeparator8 = New System.Windows.Forms.ToolStripSeparator
mAutoScaleToolStripButton = New System.Windows.Forms.ToolStripButton
Me.SuspendLayout()
Me.Items.AddRange(New System.Windows.Forms.ToolStripItem() {mBarsToolStripButton,
mCandlesticksToolStripButton,
mLineToolStripButton,
mToolStripSeparator4,
mShowCrosshairToolStripButton,
mShowCursorToolStripButton,
mToolStripSeparator5,
mThinnerBarsToolStripButton,
mThickerBarsToolStripButton,
mToolStripSeparator6,
mNarrowToolStripButton,
mWidenToolStripButton,
mScaleDownToolStripButton,
mScaleUpToolStripButton,
mToolStripSeparator7,
mScrollDownToolStripButton,
mScrollUpToolStripButton,
mScrollLeftToolStripButton,
mScrollRightToolStripButton,
mScrollEndToolStripButton,
mToolStripSeparator8,
mAutoScaleToolStripButton})
'
'BarsToolStripButton
'
mBarsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mBarsToolStripButton.Image = CType(resources.GetObject("BarsToolStripButton.Image"), System.Drawing.Image)
mBarsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mBarsToolStripButton.Name = "BarsToolStripButton"
mBarsToolStripButton.Size = New System.Drawing.Size(23, 22)
mBarsToolStripButton.Text = "Display as bars"
mBarsToolStripButton.ToolTipText = "Display as bars"
'
'CandlesticksToolStripButton
'
mCandlesticksToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mCandlesticksToolStripButton.Image = CType(resources.GetObject("CandlesticksToolStripButton.Image"), System.Drawing.Image)
mCandlesticksToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mCandlesticksToolStripButton.Name = "CandlesticksToolStripButton"
mCandlesticksToolStripButton.Size = New System.Drawing.Size(23, 22)
mCandlesticksToolStripButton.Text = "Display as candlesticks"
mCandlesticksToolStripButton.ToolTipText = "Display as candlesticks"
'
'LineToolStripButton
'
mLineToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mLineToolStripButton.Image = CType(resources.GetObject("LineToolStripButton.Image"), System.Drawing.Image)
mLineToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mLineToolStripButton.Name = "LineToolStripButton"
mLineToolStripButton.Size = New System.Drawing.Size(23, 22)
mLineToolStripButton.Text = "Display as line"
'
'ToolStripSeparator4
'
mToolStripSeparator4.Name = "ToolStripSeparator4"
mToolStripSeparator4.Size = New System.Drawing.Size(6, 25)
'
'ShowCrosshairToolStripButton
'
mShowCrosshairToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mShowCrosshairToolStripButton.Image = CType(resources.GetObject("ShowCrosshairToolStripButton.Image"), System.Drawing.Image)
mShowCrosshairToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mShowCrosshairToolStripButton.Name = "ShowCrosshairToolStripButton"
mShowCrosshairToolStripButton.Size = New System.Drawing.Size(23, 22)
mShowCrosshairToolStripButton.Text = "Show crosshair"
'
'ShowCursorToolStripButton
'
mShowCursorToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mShowCursorToolStripButton.Image = CType(resources.GetObject("ShowCursorToolStripButton.Image"), System.Drawing.Image)
mShowCursorToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mShowCursorToolStripButton.Name = "ShowCursorToolStripButton"
mShowCursorToolStripButton.Size = New System.Drawing.Size(23, 22)
mShowCursorToolStripButton.Text = "Show cursor"
'
'ToolStripSeparator5
'
mToolStripSeparator5.Name = "ToolStripSeparator5"
mToolStripSeparator5.Size = New System.Drawing.Size(6, 25)
'
'ThinnerBarsToolStripButton
'
mThinnerBarsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mThinnerBarsToolStripButton.Image = CType(resources.GetObject("ThinnerBarsToolStripButton.Image"), System.Drawing.Image)
mThinnerBarsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mThinnerBarsToolStripButton.Name = "ThinnerBarsToolStripButton"
mThinnerBarsToolStripButton.Size = New System.Drawing.Size(23, 22)
mThinnerBarsToolStripButton.Text = "Make bars thinner"
'
'ThickerBarsToolStripButton
'
mThickerBarsToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mThickerBarsToolStripButton.Image = CType(resources.GetObject("ThickerBarsToolStripButton.Image"), System.Drawing.Image)
mThickerBarsToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mThickerBarsToolStripButton.Name = "ThickerBarsToolStripButton"
mThickerBarsToolStripButton.Size = New System.Drawing.Size(23, 22)
mThickerBarsToolStripButton.Text = "Make bars thicker"
'
'ToolStripSeparator6
'
mToolStripSeparator6.Name = "ToolStripSeparator6"
mToolStripSeparator6.Size = New System.Drawing.Size(6, 25)
'
'NarrowToolStripButton
'
mNarrowToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mNarrowToolStripButton.Image = CType(resources.GetObject("NarrowToolStripButton.Image"), System.Drawing.Image)
mNarrowToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mNarrowToolStripButton.Name = "NarrowToolStripButton"
mNarrowToolStripButton.Size = New System.Drawing.Size(23, 22)
mNarrowToolStripButton.Text = "Narrower bar spacing"
mNarrowToolStripButton.ToolTipText = "Reduce bar spacing"
'
'WidenToolStripButton
'
mWidenToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mWidenToolStripButton.Image = CType(resources.GetObject("WidenToolStripButton.Image"), System.Drawing.Image)
mWidenToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mWidenToolStripButton.Name = "WidenToolStripButton"
mWidenToolStripButton.Size = New System.Drawing.Size(23, 22)
mWidenToolStripButton.Text = "Wider bar spacing"
mWidenToolStripButton.ToolTipText = "Increase bar spacing"
'
'ScaleDownToolStripButton
'
mScaleDownToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScaleDownToolStripButton.Image = CType(resources.GetObject("ScaleDownToolStripButton.Image"), System.Drawing.Image)
mScaleDownToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScaleDownToolStripButton.Name = "ScaleDownToolStripButton"
mScaleDownToolStripButton.Size = New System.Drawing.Size(23, 22)
mScaleDownToolStripButton.Text = "Scale down"
mScaleDownToolStripButton.ToolTipText = "Compress vertical scale"
'
'ScaleUpToolStripButton
'
mScaleUpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScaleUpToolStripButton.Image = CType(resources.GetObject("ScaleUpToolStripButton.Image"), System.Drawing.Image)
mScaleUpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScaleUpToolStripButton.Name = "ScaleUpToolStripButton"
mScaleUpToolStripButton.Size = New System.Drawing.Size(23, 22)
mScaleUpToolStripButton.Text = "Scale up"
mScaleUpToolStripButton.ToolTipText = "Expand vertical scale"
'
'ToolStripSeparator7
'
mToolStripSeparator7.Name = "ToolStripSeparator7"
mToolStripSeparator7.Size = New System.Drawing.Size(6, 25)
'
'ScrollDownToolStripButton
'
mScrollDownToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScrollDownToolStripButton.Image = CType(resources.GetObject("ScrollDownToolStripButton.Image"), System.Drawing.Image)
mScrollDownToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScrollDownToolStripButton.Name = "ScrollDownToolStripButton"
mScrollDownToolStripButton.Size = New System.Drawing.Size(23, 22)
mScrollDownToolStripButton.Text = "Scroll down"
'
'ScrollUpToolStripButton
'
mScrollUpToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScrollUpToolStripButton.Image = CType(resources.GetObject("ScrollUpToolStripButton.Image"), System.Drawing.Image)
mScrollUpToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScrollUpToolStripButton.Name = "ScrollUpToolStripButton"
mScrollUpToolStripButton.Size = New System.Drawing.Size(23, 22)
mScrollUpToolStripButton.Text = "Scroll up"
'
'ScrollLeftToolStripButton
'
mScrollLeftToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScrollLeftToolStripButton.Image = CType(resources.GetObject("ScrollLeftToolStripButton.Image"), System.Drawing.Image)
mScrollLeftToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScrollLeftToolStripButton.Name = "ScrollLeftToolStripButton"
mScrollLeftToolStripButton.Size = New System.Drawing.Size(23, 22)
mScrollLeftToolStripButton.Text = "Scroll left"
'
'ScrollRightToolStripButton
'
mScrollRightToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScrollRightToolStripButton.Image = CType(resources.GetObject("ScrollRightToolStripButton.Image"), System.Drawing.Image)
mScrollRightToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScrollRightToolStripButton.Name = "ScrollRightToolStripButton"
mScrollRightToolStripButton.Size = New System.Drawing.Size(23, 22)
mScrollRightToolStripButton.Text = "Scroll right"
'
'ScrollEndToolStripButton
'
mScrollEndToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mScrollEndToolStripButton.Image = CType(resources.GetObject("ScrollEndToolStripButton.Image"), System.Drawing.Image)
mScrollEndToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mScrollEndToolStripButton.Name = "ScrollEndToolStripButton"
mScrollEndToolStripButton.Size = New System.Drawing.Size(23, 22)
mScrollEndToolStripButton.Text = "Scroll to end"
'
'ToolStripSeparator8
'
mToolStripSeparator8.Name = "ToolStripSeparator8"
mToolStripSeparator8.Size = New System.Drawing.Size(6, 25)
'
'AutoScaleToolStripButton
'
mAutoScaleToolStripButton.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
mAutoScaleToolStripButton.Image = CType(resources.GetObject("AutoScaleToolStripButton.Image"), System.Drawing.Image)
mAutoScaleToolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta
mAutoScaleToolStripButton.Name = "AutoScaleToolStripButton"
mAutoScaleToolStripButton.Size = New System.Drawing.Size(23, 22)
mAutoScaleToolStripButton.Text = "Auto-scale"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Private Sub mChart_StateChange(ev As StateChangeEventData)
Dim State = CType(ev.State, MarketChart.ChartState)
Select Case State
Case MarketChart.ChartState.Blank
Case MarketChart.ChartState.Created
Case MarketChart.ChartState.Initialised
Case MarketChart.ChartState.Loaded
setupButtons()
Me.Enabled = True
End Select
End Sub
Private Sub PriceRegion_AutoscalingChanged()
mAutoScaleToolStripButton.Checked = mChart.PriceRegion.Autoscaling
End Sub
Private Sub mBarsToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mBarsToolStripButton.Click
mBarSeries.Style.DisplayMode = BarDisplayModes.BarDisplayModeBar
mBarsToolStripButton.Checked = True
mCandlesticksToolStripButton.Checked = False
mLineToolStripButton.Checked = False
End Sub
Private Sub mCandlesticksToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mCandlesticksToolStripButton.Click
mBarSeries.Style.DisplayMode = BarDisplayModes.BarDisplayModeCandlestick
mBarsToolStripButton.Checked = False
mCandlesticksToolStripButton.Checked = True
mLineToolStripButton.Checked = False
End Sub
Private Sub mLineToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mLineToolStripButton.Click
mBarSeries.Style.DisplayMode = BarDisplayModes.BarDisplayModeLine
mBarsToolStripButton.Checked = False
mCandlesticksToolStripButton.Checked = False
mLineToolStripButton.Checked = True
End Sub
Private Sub mShowCrosshairToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mShowCrosshairToolStripButton.Click
mChart.PointerStyle = PointerStyles.PointerCrosshairs
mShowCrosshairToolStripButton.Checked = True
mShowCursorToolStripButton.Checked = False
End Sub
Private Sub mShowCursorToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mShowCursorToolStripButton.Click
mChart.PointerStyle = PointerStyles.PointerDisc
mShowCursorToolStripButton.Checked = True
mShowCrosshairToolStripButton.Checked = False
End Sub
Private Sub mThinnerBarsToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mThinnerBarsToolStripButton.Click
Select Case mBarSeries.DisplayMode
Case BarDisplayModes.BarDisplayModeCandlestick
If mBarSeries.Width > 0.1 Then
mBarSeries.Style.Width = mBarSeries.Width - CSng(0.1)
End If
If mBarSeries.Width <= 0.1 Then
mThinnerBarsToolStripButton.Enabled = False
End If
Case BarDisplayModes.BarDisplayModeBar
If mBarSeries.Thickness > 1 Then
mBarSeries.Style.Thickness = mBarSeries.Thickness - 1
End If
If mBarSeries.Thickness = 1 Then
mThinnerBarsToolStripButton.Enabled = False
End If
End Select
End Sub
Private Sub mThickerBarsToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mThickerBarsToolStripButton.Click
Select Case mBarSeries.DisplayMode
Case BarDisplayModes.BarDisplayModeCandlestick
mBarSeries.Style.Width = mBarSeries.Width + CSng(0.1)
Case BarDisplayModes.BarDisplayModeBar
mBarSeries.Style.Thickness = mBarSeries.Thickness + 1
End Select
mThinnerBarsToolStripButton.Enabled = True
End Sub
Private Sub mNarrowToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mNarrowToolStripButton.Click
If mChart.PeriodWidth > 3 Then
mChart.PeriodWidth = mChart.PeriodWidth - 2
End If
If mChart.PeriodWidth = 3 Then
mNarrowToolStripButton.Enabled = False
End If
End Sub
Private Sub mWidenToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mWidenToolStripButton.Click
mChart.PeriodWidth = mChart.PeriodWidth + 2
mNarrowToolStripButton.Enabled = True
End Sub
Private Sub mScaleDownToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScaleDownToolStripButton.Click
mChart.PriceRegion.ScaleUp(-0.09091)
End Sub
Private Sub mScaleUpToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScaleUpToolStripButton.Click
mChart.PriceRegion.ScaleUp(0.1)
End Sub
Private Sub mScrollDownToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScrollDownToolStripButton.Click
mChart.PriceRegion.ScrollVerticalProportion(-0.2)
End Sub
Private Sub mScrollUpToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScrollUpToolStripButton.Click
mChart.PriceRegion.ScrollVerticalProportion(0.2)
End Sub
Private Sub mScrollLeftToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScrollLeftToolStripButton.Click
mChart.ScrollX(-CInt((mChart.ChartWidth * 0.2)))
End Sub
Private Sub mScrollRightToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScrollRightToolStripButton.Click
mChart.ScrollX(CInt((mChart.ChartWidth * 0.2)))
End Sub
Private Sub mScrollEndToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mScrollEndToolStripButton.Click
mChart.LastVisiblePeriod = mChart.CurrentPeriodNumber
End Sub
Private Sub mAutoScaleToolStripButton_Click(sender As System.Object, e As System.EventArgs) Handles mAutoScaleToolStripButton.Click
mChart.PriceRegion.Autoscaling = Not mAutoScaleToolStripButton.Checked
End Sub
Private Sub mBarSeries_PropertyChanged(ByRef ev As PropertyChangedEventData)
If ev.PropertyName.ToUpper = "DISPLAYMODE" Then setupDisplayModeButtons()
End Sub
Public Property Chart() As MarketChart
Get
Return mChart
End Get
Set(value As MarketChart)
If mChart IsNot Nothing Then RemoveHandler mChart.StateChange, AddressOf mChart_StateChange
mChart = value
If mChart Is Nothing Then
Me.Enabled = False
Exit Property
End If
AddHandler mChart.StateChange, AddressOf mChart_StateChange
If mChart.State = MarketChart.ChartState.Loaded Then
setupButtons()
Me.Enabled = True
Else
Me.Enabled = False
End If
End Set
End Property
Private Sub setupButtons()
Static prevPriceRegion As ChartRegion
Try
If mBarSeries IsNot Nothing Then RemoveHandler mBarSeries.PropertyChanged, AddressOf mBarSeries_PropertyChanged
If prevPriceRegion IsNot Nothing Then RemoveHandler prevPriceRegion.AutoscalingChanged, AddressOf PriceRegion_AutoscalingChanged
Catch ex As Exception
End Try
mBarSeries = DirectCast(mChart.ChartManager.BaseStudyConfiguration.ValueSeries(StudyUtils.BarStudyValueBar), BarSeries)
If mBarSeries Is Nothing Then Exit Sub
AddHandler mBarSeries.PropertyChanged, AddressOf mBarSeries_PropertyChanged
setupDisplayModeButtons()
If mChart.PriceRegion.PointerStyle = PointerStyles.PointerCrosshairs Then
mShowCrosshairToolStripButton.Checked = True
mShowCursorToolStripButton.Checked = False
Else
mShowCrosshairToolStripButton.Checked = False
mShowCursorToolStripButton.Checked = True
End If
mNarrowToolStripButton.Enabled = (mChart.PeriodWidth > 3)
mAutoScaleToolStripButton.Checked = mChart.PriceRegion.Autoscaling
AddHandler mChart.PriceRegion.AutoscalingChanged, AddressOf PriceRegion_AutoscalingChanged
prevPriceRegion = mChart.PriceRegion
End Sub
Private Sub setupDisplayModeButtons()
If mBarSeries.DisplayMode = BarDisplayModes.BarDisplayModeBar Then
mBarsToolStripButton.Checked = True
mCandlesticksToolStripButton.Checked = False
mThinnerBarsToolStripButton.Enabled = (mBarSeries.Thickness > 1)
Else
mBarsToolStripButton.Checked = False
mCandlesticksToolStripButton.Checked = True
mThinnerBarsToolStripButton.Enabled = (mBarSeries.Width > 0.1)
End If
End Sub
End Class
|
Imports System.Security.Cryptography
Imports System.Globalization
Imports System.IO
Public Class H2G
Private Const KeyEncryption As String = "H2GkjKDF%IUuv&#r"
Private Const PassPhrase As String = "H2G!hfYTE&#j@HFd"
Private Const SaltCryptography As String = "H2GEngineSecurity2016"
Public Shared ReadOnly Property DEBUG() As Boolean
Get
Dim _debug As Boolean = False
If (HttpContext.Current.Request.Url.Host.Contains("localhost")) Then _debug = True
Return _debug
End Get
End Property
Public Shared ReadOnly Property DEMO() As Boolean
Get
Dim _debug As Boolean = False
If (HttpContext.Current.Request.Url.AbsoluteUri.Contains("travox.com/mos_demo")) Then _debug = True
Return _debug
End Get
End Property
Private Shared SelectedCode As String = ""
Public Shared Property CompanyCode() As String
Get
Dim val As String = Nothing
Try
Dim session As SessionState.HttpSessionState = HttpContext.Current.Session
Dim cookie As HttpCookieCollection = HttpContext.Current.Request.Cookies()
If (Not String.IsNullOrEmpty(session("companycode"))) Then
val = session("companycode").ToString.ToUpper
ElseIf (Not String.IsNullOrEmpty(cookie("COMPANY_ACCESS").Value)) Then
HttpContext.Current.Session("companycode") = cookie("COMPANY_ACCESS").Value
HttpContext.Current.Session("ID") = cookie("ID").Value
val = cookie("COMPANY_ACCESS").Value
Else
Throw New Exception("Session missing. Please Relogin.")
End If
Catch ex As Exception
If (String.IsNullOrEmpty(SelectedCode)) Then Throw New Exception(ex.Message) Else val = SelectedCode
End Try
Return val.ToUpper()
End Get
Set(ByVal value As String)
SelectedCode = value
End Set
End Property
Public Shared ReadOnly Property Login() As User
Get
Dim _get As New User()
_get.ID = IIf(Response.isSession("ID"), Response.Session("ID"), Response.Cookie("ID"))
_get.Name = Response.Cookie("N")
_get.Code = Response.Cookie("C")
_get.CollectionPointID = Response.Cookie("CPID")
_get.SiteID = Response.Cookie("SID")
_get.PlanID = Response.Cookie("PID")
_get.PlanDate = Response.Cookie("PD")
Return _get
End Get
End Property
Public Shared ReadOnly Property URL() As String
Get
Dim scheme As String = HttpContext.Current.Request.Url.Scheme & Uri.SchemeDelimiter.ToString()
Dim reqUrl As String = HttpContext.Current.Request.Url.AbsoluteUri.ToLower
Dim link As String = HttpContext.Current.Request.Url.Host
If (link.Contains("localhost")) Then
link = HttpContext.Current.Request.Url.Authority
End If
Return scheme & link
End Get
End Property
Public Shared ReadOnly Property Path() As String
Get
Return HttpContext.Current.Server.MapPath("~\")
End Get
End Property
Public Shared Function FileRead(ByVal name_withextension As String) As String
Dim path As String = H2G.Path & name_withextension
If (IO.File.Exists(path)) Then
path = File.ReadAllText(path)
ElseIf (IO.File.Exists(name_withextension)) Then
path = File.ReadAllText(name_withextension)
Else : path = Nothing
End If
Return path
End Function
Public Shared Function FileStore(ByVal pathname As String, ByVal data As String) As String
Dim target As String = "D:\mid-backOffice_Backup\#Store_Data\" & pathname
Dim pathfile As String = IO.Path.GetDirectoryName(target)
If (IO.File.Exists(target)) Then IO.File.Delete(target)
If (Not IO.Directory.Exists(pathfile)) Then IO.Directory.CreateDirectory(pathfile)
File.WriteAllText(target, data)
Return target
End Function
Public Shared Function FileWrite(ByVal pathname As String, ByVal data As String) As String
Dim target As String = H2G.Path & pathname
Dim pathfile As String = IO.Path.GetDirectoryName(target)
If (IO.File.Exists(target)) Then IO.File.Delete(target)
If (Not IO.Directory.Exists(pathfile)) Then IO.Directory.CreateDirectory(pathfile)
File.WriteAllText(target, data)
Return target
End Function
Public Shared Function FileWrite(ByVal pathname As String, ByVal data() As Byte) As String
Dim target As String = H2G.Path & pathname
Dim pathfile As String = IO.Path.GetDirectoryName(target)
If (IO.File.Exists(target)) Then IO.File.Delete(target)
If (Not IO.Directory.Exists(pathfile)) Then IO.Directory.CreateDirectory(pathfile)
File.WriteAllBytes(target, data)
Return target
End Function
Public Shared Function FileCopy(ByVal source As String, ByVal destination As String) As Boolean
Dim success As Boolean = True
Try
If Not H2G.DEBUG Then
If (Not source.Contains(":\")) Then source = H2G.Path & source
If (Not destination.Contains(":\")) Then destination = H2G.Path & destination
If (IO.File.Exists(destination)) Then IO.File.Delete(destination)
If (Not IO.Directory.Exists(IO.Path.GetDirectoryName(destination))) Then IO.Directory.CreateDirectory(IO.Path.GetDirectoryName(destination))
File.Copy(source, destination)
End If
Catch
success = False
End Try
Return success
End Function
Public Shared Function Timestamp() As Long
Return CLng(DateTime.UtcNow.Subtract(New DateTime(1970, 1, 1)).TotalSeconds)
End Function
Public Shared Function ParseDate(ByVal from_format As String, ByVal to_format As String, ByVal date_time As String) As String
Dim result As String = ""
Dim exact As DateTime
If DateTime.TryParseExact(date_time, from_format, CultureInfo.CurrentCulture.DateTimeFormat, DateTimeStyles.NoCurrentDateDefault, exact) Then
result = exact.ToString(to_format)
Else
If Date.TryParse(date_time, CultureInfo.CurrentCulture.DateTimeFormat, DateTimeStyles.NoCurrentDateDefault, exact) Then
result = exact.ToString(to_format)
Else
Throw New Exception("Error ParseDate")
End If
End If
Return result
End Function
Public Shared Function Null(ByVal value As Object) As Integer
Return String.IsNullOrEmpty(value)
End Function
Public Shared Function Int(ByVal value As String) As Integer
Return H2G.Convert(Of Integer)(value)
End Function
Public Shared Function Dec(ByVal value As String) As Decimal
Return H2G.Convert(Of Decimal)(value)
End Function
Public Shared Function DT(ByVal value As String) As DateTime
Return H2G.Convert(Of DateTime)(value)
End Function
Public Shared Function Bool(ByVal value As String) As Boolean
Return H2G.Convert(Of Boolean)(value)
End Function
Public Shared Function ToYN(ByVal value As String) As String
Return IIf(H2G.Convert(Of Boolean)(value), "Y", "N")
End Function
Public Shared Function Convert(Of T)(ByVal value As String) As T
Dim type As T = Nothing
Dim index = Nothing
If (TypeOf type Is Boolean) Then
If (String.IsNullOrEmpty(value) OrElse (value.ToLower = "n" Or value.ToLower = "false" Or value.ToLower = "no" Or value.ToLower = "0")) Then
index = False
ElseIf (value.ToLower = "y" Or value.ToLower = "true" Or value.ToLower = "yes" Or value.ToLower = "1") Then
index = True
End If
ElseIf (TypeOf type Is Decimal) Then
If (String.IsNullOrEmpty(value) Or Not IsNumeric(value)) Then value = Decimal.Parse("0")
index = Decimal.Parse(Regex.Replace(value, ",", ""))
ElseIf (TypeOf type Is Double) Then
If (String.IsNullOrEmpty(value) Or Not IsNumeric(value)) Then value = Double.Parse("0")
index = Double.Parse(Regex.Replace(value, ",", ""))
ElseIf (TypeOf type Is Integer OrElse TypeOf type Is Int32 OrElse TypeOf type Is Int64) Then
If (String.IsNullOrEmpty(value) Or Not IsNumeric(value)) Then value = Integer.Parse("0")
If (value.Contains(".")) Then value = Math.Round(Decimal.Parse(value), 0).ToString()
index = Integer.Parse(value)
ElseIf (TypeOf type Is DateTime) Or (TypeOf type Is Date) Then
Try
Dim FormatDateTime As String = "dd-MM-yyyy HH:mm:ss"
value = value.Replace("/", "-")
If (FormatDateTime.Length <> value.Trim.Length) Then
Select Case value.Trim.Length
Case 10 : value = value.Trim & " 00:00:00"
Case 16 : value = value.Trim & ":00"
End Select
End If
index = DateTime.ParseExact(value, FormatDateTime, System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat)
Catch
Throw New Exception("Datetime not format ""DD-MM-YYYY"" OR ""DD-MM-YYYY HH:MM:SS"".")
End Try
ElseIf (TypeOf type Is Money.VATType) Then
If (value.ToUpper = "INCLUDE") Then
index = Money.VATType.INCLUDE
ElseIf (value.ToUpper = "EXCLUDE") Then
index = Money.VATType.EXCLUDE
End If
ElseIf (TypeOf type Is Booking.ItemStatus) Then
Select Case value.ToString.Replace(" ", "").ToUpper()
Case "TEMP" : index = Booking.ItemStatus.TEMP
Case "VAT" : index = Booking.ItemStatus.VAT
Case "NOVAT" : index = Booking.ItemStatus.NOVAT
End Select
End If
Return index
End Function
Public Shared Function BE2AC(ByVal value As DateTime) As DateTime
Return value.AddYears(-543)
End Function
Public Shared Function AC2BE(ByVal value As DateTime) As DateTime
Return value.AddYears(543)
End Function
Public Shared Function CountCharacter(ByVal value As String, ch As String) As Int32
Return CountCharacter(value, ch, False)
End Function
Public Shared Function CountCharacter(ByVal value As String, ch As String, ignorCase As Boolean) As Int32
Return IIf(ignorCase, Len(value) - Len(value.ToLower.Replace(ch.ToLower, "")), Len(value) - Len(value.Replace(ch, "")))
End Function
Public Shared Function nextVal(ByVal tableName As String) As String
Return "select SQ_" & tableName & "_ID.nextval from dual"
End Function
Public Shared Function calAge(birthday As Date) As String
Dim Age As New Date(Now.Subtract(birthday).Ticks)
Return Age.Year - 1
End Function
Public Shared Function Encrypt(ByVal plainText As String) As String
Dim password As Rfc2898DeriveBytes = New Rfc2898DeriveBytes(PassPhrase, Encoding.ASCII.GetBytes(SaltCryptography), 2)
Dim symmetric As New RijndaelManaged()
symmetric.Mode = CipherMode.CBC
Dim textBytes As Byte() = Encoding.UTF8.GetBytes(plainText)
Dim mem As New MemoryStream()
Dim crypt As New CryptoStream(mem, symmetric.CreateEncryptor(password.GetBytes(32), Encoding.ASCII.GetBytes(KeyEncryption)), CryptoStreamMode.Write)
crypt.Write(textBytes, 0, textBytes.Length)
crypt.FlushFinalBlock()
plainText = System.Convert.ToBase64String(mem.ToArray())
mem.Close()
crypt.Close()
Return plainText
End Function
Public Shared Function Decrypt(ByVal cipherText As String) As String
Dim password As Rfc2898DeriveBytes = New Rfc2898DeriveBytes(PassPhrase, Encoding.ASCII.GetBytes(SaltCryptography), 2)
Dim symmetric As New RijndaelManaged()
symmetric.Mode = CipherMode.CBC
Dim mem As New MemoryStream(System.Convert.FromBase64String(cipherText))
Dim crypt As New CryptoStream(mem, symmetric.CreateDecryptor(password.GetBytes(32), Encoding.ASCII.GetBytes(KeyEncryption)), CryptoStreamMode.Read)
Dim textBytes As Byte() = New Byte(System.Convert.FromBase64String(cipherText).Length - 1) {}
cipherText = Encoding.UTF8.GetString(textBytes, 0, crypt.Read(textBytes, 0, textBytes.Length))
mem.Close()
crypt.Close()
Return cipherText
End Function
Public Shared Function MD5(ByVal plainText As String) As String
Return BitConverter.ToString(MD5CryptoServiceProvider.Create().ComputeHash(Encoding.UTF8.GetBytes(plainText))).Replace("-", "").ToLower()
End Function
Public Shared Function MD5(ByVal plainText As String, ByVal cipherText As String) As Boolean
Dim checkSum As Boolean = False
If (MD5(plainText) = cipherText.Trim()) Then checkSum = True
Return checkSum
End Function
REM :: HACK SECURITY CHECK
Public Shared Function CookieAllowAccess() As Boolean
If (Response.Cookie("SocketInjection") = "N/A") Then Return False Else Return True
End Function
Public Shared Sub setMasterData(current As Page)
Dim data As HtmlInputText
data = CType(current.Master.FindControl("data"), HtmlInputText)
If current.Request.Form.Keys.Count = 0 Then Throw New Exception("Enter by hotlink")
If Not data Is Nothing Then
For Each key As String In current.Request.Form.Keys
If Not (key = "__VIEWSTATE" OrElse key = "ctl00$data" OrElse key = "__VIEWSTATEGENERATOR" OrElse key = "__EVENTVALIDATION") Then
data.Attributes.Add(key, current.Request.Form(key))
End If
Next
End If
End Sub
End Class |
Public Class frmEmpresa_Transporte_Piloto
Private pObjLNJ As New clsLnEmpresa_transporte_pilotos
Public pObjBEJ As New clsBeEmpresa_transporte_pilotos
Public Enum TipoTrans
Nuevo = 1
Editar = 2
End Enum
Private Property Modo As TipoTrans
Sub New(ByVal pModo As TipoTrans)
InitializeComponent()
Modo = pModo
End Sub
Private Sub frmEmpresa_Transporte_Piloto_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Top = 50
Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 2
Try
If Not AP.Listar_EmpresaTransportePorEmpresa(cmbEmpresaT, AP.IdEmpresa) Then
MsgBox("No hay empresas de transporte definidas para la aplicación.", MsgBoxStyle.Critical, Me.Text)
End If
Select Case Modo
Case TipoTrans.Nuevo
lblCodigo.Text = "-"
cmbEmpresaT.Enabled = True
User_agrTextEdit.Text = AP.UsuarioAp.Nombres + " " + AP.UsuarioAp.Apellidos
Fec_agrDateEdit.Text = Now
User_modTextEdit.Text = AP.UsuarioAp.Nombres + " " + AP.UsuarioAp.Apellidos
Fec_modDateEdit.Text = Now
mnuGuardar.Enabled = True
mnuActualizar.Enabled = False
mnuEliminar.Enabled = False
txtDPI.Enabled = True
cmbEmpresaT.Enabled = True
Case TipoTrans.Editar
pObjLNJ.Obtener(pObjBEJ)
lblCodigo.Text = pObjBEJ.IdPiloto
cmbEmpresaT.SelectedValue = pObjBEJ.IdEmpresaTransporte
txtNombres.Text = pObjBEJ.Nombres
txtApellidos.Text = pObjBEJ.Apellidos
txtTelefono.Text = pObjBEJ.Telefono
txtCorreo.Text = pObjBEJ.Correo_electronico
txtNoCarnet.Text = pObjBEJ.No_carnet
dtmFechaExpiracionCarnet.Value = pObjBEJ.Fecha_expiracion_carnet
txtDPI.Text = pObjBEJ.No_dpi
txtCodigoBarra.Text = pObjBEJ.Codigo_barra
txtDireccion.Text = pObjBEJ.Direccion
If pObjBEJ.IdTipoLicencia <> 0 Then
cmbTipoLicencia.SelectedIndex = pObjBEJ.IdTipoLicencia - 1
End If
txtLicencia.Text = pObjBEJ.No_licencia
dtmFechaExpiracionLicencia.Value = pObjBEJ.Fecha_expiracion_licencia
If pObjBEJ.Foto IsNot Nothing Then
picFoto.Image = ByteArrayToImage(pObjBEJ.Foto)
End If
dtmFechaNacimiento.Value = pObjBEJ.Fecha_nacimiento
dtmFechaInicio.Value = pObjBEJ.Fecha_ingreso
dtmFechaSalida.Value = pObjBEJ.Fecha_salida
picFoto.SizeMode = PictureBoxSizeMode.StretchImage
User_agrTextEdit.Text = pObjBEJ.User_agr
Fec_agrDateEdit.Text = pObjBEJ.Fec_agr
User_modTextEdit.Text = pObjBEJ.User_mod
Fec_modDateEdit.Text = pObjBEJ.Fec_mod
mnuGuardar.Enabled = False
mnuActualizar.Enabled = True
mnuEliminar.Enabled = True
txtDPI.Enabled = False
cmbEmpresaT.Enabled = False
End Select
Application.DoEvents()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
txtNombres.Focus()
End Sub
Private Sub mnuGuardar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuGuardar.ItemClick
If Datos_Correctos() Then
If MessageBox.Show("¿Guardar el Piloto?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
If Guardar() Then
MsgBox("Se guardó el registro.", MsgBoxStyle.Information, Me.Text)
Me.Close()
End If
End If
End If
End Sub
Private Function Guardar() As Boolean
Guardar = False
Try
Dim ObjN As New clsBeEmpresa_transporte_pilotos()
ObjN.No_dpi = txtDPI.Text.Trim()
If clsLnEmpresa_transporte_pilotos.ExisteDPI(ObjN.No_dpi) Then
MsgBox(String.Format("El DPI {0} ingresado ya existe.", txtDPI.Text.Trim()), MsgBoxStyle.Exclamation, Me.Text)
txtDPI.SelectAll()
Return False
End If
ObjN.No_licencia = txtLicencia.Text.Trim()
If clsLnEmpresa_transporte_pilotos.ExisteNoLicencia(ObjN.No_licencia) Then
MsgBox(String.Format("El Número de Licencia {0} ingresado ya existe.", txtLicencia.Text.Trim()), MsgBoxStyle.Exclamation, Me.Text)
txtLicencia.SelectAll()
Return False
End If
ObjN.IdEmpresaTransporte = cmbEmpresaT.SelectedValue
ObjN.IdPiloto = clsLnEmpresa_transporte_pilotos.MaxID()
ObjN.Nombres = txtNombres.Text.Trim()
ObjN.Apellidos = txtApellidos.Text.Trim()
ObjN.Telefono = txtTelefono.Text.Trim()
ObjN.Correo_electronico = txtCorreo.Text.Trim()
ObjN.No_carnet = txtNoCarnet.Text.Trim()
ObjN.Fecha_expiracion_carnet = dtmFechaExpiracionCarnet.Value
If cmbTipoLicencia.SelectedIndex <> -1 Then
ObjN.IdTipoLicencia = cmbTipoLicencia.SelectedIndex + 1
End If
ObjN.Fecha_expiracion_licencia = dtmFechaExpiracionLicencia.Value
ObjN.Codigo_barra = txtCodigoBarra.Text.Trim()
ObjN.Direccion = txtDireccion.Text.Trim()
If picFoto.Image IsNot Nothing Then
ObjN.Foto = ImageToByteArray(picFoto.Image)
End If
ObjN.Fecha_nacimiento = dtmFechaNacimiento.Value
ObjN.Fecha_ingreso = dtmFechaInicio.Value
ObjN.Fecha_salida = dtmFechaSalida.Value
ObjN.Activo = True
ObjN.User_agr = AP.UsuarioAp.IdUsuario
ObjN.Fec_agr = Now
ObjN.User_mod = AP.UsuarioAp.IdUsuario
ObjN.Fec_mod = Now
Guardar = pObjLNJ.Insertar(ObjN) > 0
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Function
Private Function Actualizar() As Boolean
Actualizar = False
Try
If Datos_Correctos() Then
If cmbTipoLicencia.SelectedIndex <> -1 Then
pObjBEJ.IdTipoLicencia = cmbTipoLicencia.SelectedIndex + 1
End If
pObjBEJ.Nombres = txtNombres.Text.Trim()
pObjBEJ.Apellidos = txtApellidos.Text.Trim()
pObjBEJ.Telefono = txtTelefono.Text.Trim()
pObjBEJ.Correo_electronico = txtCorreo.Text.Trim()
pObjBEJ.No_carnet = txtNoCarnet.Text.Trim()
pObjBEJ.Fecha_expiracion_carnet = dtmFechaExpiracionCarnet.Value
pObjBEJ.Fecha_expiracion_licencia = dtmFechaExpiracionLicencia.Value
pObjBEJ.No_licencia = txtLicencia.Text.Trim()
pObjBEJ.Codigo_barra = txtCodigoBarra.Text.Trim()
pObjBEJ.Direccion = txtDireccion.Text.Trim()
pObjBEJ.Fecha_nacimiento = dtmFechaNacimiento.Value
pObjBEJ.Fecha_ingreso = dtmFechaInicio.Value
pObjBEJ.Fecha_salida = dtmFechaSalida.Value
If picFoto.Image IsNot Nothing Then
pObjBEJ.Foto = ImageToByteArray(picFoto.Image)
End If
pObjBEJ.User_mod = AP.UsuarioAp.IdUsuario
pObjBEJ.Fec_mod = Now
Actualizar = pObjLNJ.Actualizar(pObjBEJ) > 0
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Function
Private Function Datos_Correctos() As Boolean
Datos_Correctos = False
Try
If cmbEmpresaT.SelectedIndex = -1 Then
MsgBox("Seleccione Empresa Transporte.", MsgBoxStyle.Exclamation, Me.Text)
ElseIf String.IsNullOrEmpty(txtNombres.Text.Trim()) Then
MsgBox("Ingrese Nombre.", MsgBoxStyle.Exclamation, Me.Text)
txtNombres.Focus()
ElseIf String.IsNullOrEmpty(txtApellidos.Text.Trim()) Then
MsgBox("Ingrese Apellido.", MsgBoxStyle.Exclamation, Me.Text)
txtApellidos.Focus()
ElseIf String.IsNullOrEmpty(txtLicencia.Text.Trim()) Then
MsgBox("Ingrese número de licencia.", MsgBoxStyle.Exclamation, Me.Text)
txtLicencia.Focus()
ElseIf cmbTipoLicencia.SelectedIndex = -1 Then
MsgBox("Seleccione Tipo de Licencia.", MsgBoxStyle.Exclamation, Me.Text)
ElseIf String.IsNullOrEmpty(txtDPI.Text.Trim) Then
MsgBox("Ingrese DPI.", MsgBoxStyle.Exclamation, Me.Text)
txtDPI.Focus()
Else
Datos_Correctos = True
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Function
Private Sub mnuActualizar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuActualizar.ItemClick
If Actualizar() Then
MsgBox("Se actualizó el registro.", MsgBoxStyle.Information, Me.Text)
Me.Close()
End If
End Sub
Private Sub mnuEliminar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuEliminar.ItemClick
Try
If MessageBox.Show("¿Desactivar el Piloto?", Me.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
pObjBEJ.Activo = False
If pObjLNJ.Actualizar(pObjBEJ) > 0 Then
MsgBox("Se ha desactivado el registro.", MsgBoxStyle.Information, Me.Text)
Me.Close()
frmEmpresa_Transporte_PilotoList.Dgrid.Refresh()
End If
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Sub
Private Sub btnExaminar_Click(sender As Object, e As EventArgs) Handles btnExaminar.Click
Dim ofd As New OpenFileDialog()
ofd.Filter = "Imagenes JPG|*.jpg"
ofd.RestoreDirectory = True
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
picFoto.Image = Image.FromFile(ofd.FileName)
End If
End Sub
Public Function ImageToByteArray(ByVal imageIn As Image) As Byte()
Dim ms As New System.IO.MemoryStream()
imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg)
Return ms.ToArray()
End Function
Public Function ByteArrayToImage(ByVal byteArrayIn As Byte()) As Image
Dim ms As New System.IO.MemoryStream(byteArrayIn)
Return Image.FromStream(ms)
End Function
End Class |
Imports System.Runtime.CompilerServices
Imports BioNovoGene.BioDeep.Chemoinformatics.SMILES
Imports Microsoft.VisualBasic.Data.visualize.Network.FileStream.Generic
Imports Microsoft.VisualBasic.Data.visualize.Network.Graph
Public Module SMILESGraph
''' <summary>
''' convert the smiles chemical formula graph data to a network graph object
''' </summary>
''' <param name="f"></param>
''' <returns></returns>
<Extension>
Public Function AsGraph(f As ChemicalFormula) As NetworkGraph
Dim g As New NetworkGraph
For Each atom As ChemicalElement In f.AllElements
Call g.CreateNode(atom.label, New NodeData With {
.label = atom.label,
.origID = atom.label,
.Properties = New Dictionary(Of String, String) From {
{NamesOf.REFLECTION_ID_MAPPING_NODETYPE, atom.group}
}
})
Next
For Each key As ChemicalKey In f.AllBonds
Call g.CreateEdge(key.U.label, key.V.label, weight:=1, data:=New EdgeData With {
.label = key.ID,
.Properties = New Dictionary(Of String, String)
})
Next
Return g
End Function
End Module
|
Partial Class index
Inherits System.Web.UI.Page
Protected Sub Clear_Click(sender As Object, e As System.EventArgs) Handles Clear.Click
' clear all input and output textbox and label
hourlyWage.Text = ""
numberOfHours.Text = ""
pretaxDeduction.Text = ""
aftertaxDeduction.Text = ""
resultLable.Text = ""
End Sub
Protected Sub calculate_Click(sender As Object, e As System.EventArgs) Handles calculate.Click
' declare variables to contain user entered input
Dim wage As Decimal = hourlyWage.Text
Dim hour As Decimal = numberOfHours.Text
Dim pretaxD As Decimal = pretaxDeduction.Text
Dim afterD As Decimal = aftertaxDeduction.Text
'create constant variable for tax rate
Const tax As Decimal = 0.18
'declare a variable to contain result
Dim result As Decimal
'calculate before tax and deduction salary
Dim salary As Decimal
'if hour is lower than 40, just multiple the hour and hourly wage
If hour <= 40 Then
salary = hour * wage
Else 'if hour is bigger than 40, than calculate the 40 hours salary and the over-time salary
salary = 40 * wage + (hour - 40) * wage * 1.5
End If
'calculate after pre-tax deduction salary
Dim preSalary As Decimal = salary - pretaxD
'calculate the after tax salary
Dim taxedSalary As Decimal = preSalary - preSalary * tax
'calculate the final result
result = taxedSalary - afterD
'display the result
resultLable.Text = "Your net pay is " & String.Format("{0:C}", result)
End Sub
End Class
|
Namespace EntityModel
Partial Public Class VRNS_Maintainance_Detail
Property No As Integer
Property BranchName As String
Property EMP_Contact_Name As String
Property MA_Team_Name As String
End Class
End Namespace
|
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Xml
Imports Talent.Common
'--------------------------------------------------------------------------------------------------
' Project Trading Portal Project.
'
' Function This class is used to deal with Product Navigation Load
' responses
'
' Date 23/10/08
'
' Author Ben Ford
'
' © CS Group 2007 All rights reserved.
'
' Error Number Code base TTPRSPRNL -
'
' Modification Summary
'
' dd/mm/yy ID By Description
' -------- ----- --- -----------
'
'--------------------------------------------------------------------------------------------------
Namespace Talent.TradingPortal
Public Class XmlProductNavigationLoadResponse
Inherits XmlResponse
Private ndHeaderRoot, ndHeaderRootHeader, ndHeader, ndReturnCode, ndResponse As XmlNode
Private ndCustomer As XmlNode
Private DtEligibleCustomers As DataTable
Private dtStatusResults As DataTable
Private errorOccurred As Boolean = False
Protected Overrides Sub InsertBodyV1()
Try
' Create the three xml nodes needed at the root level
With MyBase.xmlDoc
End With
'--------------------------------------------------------------------------------------
' Insert the fragment into the XML document
'
Const c1 As String = "//" ' Constants are faster at run time
Const c2 As String = "/TransactionHeader"
'
ndHeader = MyBase.xmlDoc.SelectSingleNode(c1 & RootElement())
ndHeaderRootHeader = MyBase.xmlDoc.SelectSingleNode(c1 & RootElement() & c2)
Catch ex As Exception
Const strError As String = "Failed to create the response xml"
With Err
.ErrorMessage = ex.Message
.ErrorStatus = strError
.ErrorNumber = "TTPRSPRNL-01"
.HasError = True
End With
End Try
End Sub
Protected Sub CreateResponseSection()
Dim dr As DataRow
'Create the response xml nodes
With MyBase.xmlDoc
ndReturnCode = .CreateElement("ReturnCode")
End With
'Read the values for the response section
dtStatusResults = ResultDataSet.Tables("StatusResults")
dr = dtStatusResults.Rows(0)
'Populate the nodes
ndReturnCode.InnerText = dr("ReturnCode")
If dr("ErrorOccurred") = "E" Then
errorOccurred = True
End If
'Set the xml nodes
With ndResponse
.AppendChild(ndReturnCode)
End With
End Sub
End Class
End Namespace |
Imports TrackSpy.PlugIn
Imports System.Drawing
Imports Newtonsoft.Json.Linq
Imports System.IO
Imports TrackSpy.Exceptions
Imports System
Namespace plug_Ins
Public Class PluginText
Inherits TrackSpy.PlugIn.BasePlugin
Implements IPlugin
#Region "Fields"
Private _CurrentFont As String
Private _CurrentFontSize As String
Private _Current As String
Private _LapFont As String
Private _LapFontSize As String
Private _Lap As String
Private _BestFont As String
Private _BestFontSize As String
Private _Best As String
Private _LastFont As String
Private _LastFontSize As String
Private _Last As String
#End Region
#Region "Property"
Public Property LapFont() As String
Get
Return _LapFont
End Get
Set(ByVal value As String)
_LapFont = value
End Set
End Property
Public Property LapFontSize() As String
Get
Return _LapFontSize
End Get
Set(ByVal value As String)
_LapFontSize = value
End Set
End Property
Public Property Lap() As String
Get
Return _Lap
End Get
Set(ByVal value As String)
_Lap = value
End Set
End Property
Public Property CurrentFont() As String
Get
Return _CurrentFont
End Get
Set(ByVal value As String)
_CurrentFont = value
End Set
End Property
Public Property CurrentFontSize() As String
Get
Return _CurrentFontSize
End Get
Set(ByVal value As String)
_CurrentFontSize = value
End Set
End Property
Public Property Current() As String
Get
Return _Current
End Get
Set(ByVal value As String)
_Current = value
End Set
End Property
Public Property BestFont() As String
Get
Return _BestFont
End Get
Set(ByVal value As String)
_BestFont = value
End Set
End Property
Public Property BestFontSize() As String
Get
Return _BestFontSize
End Get
Set(ByVal value As String)
_BestFontSize = value
End Set
End Property
Public Property Best() As String
Get
Return _Best
End Get
Set(ByVal value As String)
_Best = value
End Set
End Property
Public Property LastFont() As String
Get
Return _LastFont
End Get
Set(ByVal value As String)
_LastFont = value
End Set
End Property
Public Property LastFontSize() As String
Get
Return _LastFontSize
End Get
Set(ByVal value As String)
_LastFontSize = value
End Set
End Property
Public Property Last() As String
Get
Return _Last
End Get
Set(ByVal value As String)
_Last = value
End Set
End Property
#End Region
Protected Overrides ReadOnly Property Name() As String
Get
Return "ImgRender"
End Get
End Property
Public Overrides Sub PerformAction(ByVal context As TrackSpy.PlugIn.IPluginContext)
' context.g.DrawString(Me.Text, New Font(Me.Font, Me.FontSize), Brushes.White, context.Layout.GetX, context.Layout.GetY)
Dim lapsize = context.g.MeasureString("Lap: " & Me.Lap, New Font(Me.LapFont, Me.LapFontSize))
Dim currentsize = context.g.MeasureString("Current: " & Me.Current, New Font(Me.CurrentFont, Me.CurrentFontSize))
Dim lastsize = context.g.MeasureString("Last: " & Me.Last, New Font(Me.LastFont, Me.LapFontSize))
Dim bestsize = context.g.MeasureString("Best: " & Me.Best, New Font(Me.BestFont, Me.LapFontSize))
Dim MaxWidth = Math.Max(lapsize.Width, currentsize.Width)
MaxWidth = Math.Max(MaxWidth, lastsize.Width)
MaxWidth = Math.Max(MaxWidth, bestsize.Width)
Dim MaxHeight = lapsize.Height + currentsize.Height + lastsize.Height + bestsize.Height
MaxWidth = Math.Max(MaxWidth, context.Layout.GetWidth)
context.g.FillRectangle(New SolidBrush(Color.FromArgb(150, 0, 0, 0)), New RectangleF(context.Layout.GetX, context.Layout.GetY, MaxWidth, MaxHeight))
'context.g.FillRectangle(New SolidBrush(Color.Black), New RectangleF(context.Layout.GetX, context.Layout.GetY, MaxWidth, MaxHeight))
context.g.DrawString("Lap: " & Me.Lap, New Font(Me.LapFont, Me.LapFontSize), Brushes.White, context.Layout.GetX, context.Layout.GetY)
context.g.DrawString("Current: " & Me.Current, New Font(Me.CurrentFont, Me.CurrentFontSize), Brushes.White, context.Layout.GetX, context.Layout.GetY + lapsize.Height)
context.g.DrawString("Last: " & Me.Last, New Font(Me.LastFont, Me.LastFontSize), Brushes.White, context.Layout.GetX, context.Layout.GetY + lapsize.Height + currentsize.Height)
context.g.DrawString("Best: " & Me.Best, New Font(Me.BestFont, Me.BestFontSize), Brushes.White, context.Layout.GetX, context.Layout.GetY + lapsize.Height + currentsize.Height + lastsize.Height)
End Sub
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(PluginImg))
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 |
Imports System
Imports com.qas.proweb.soap
Namespace com.qas.proweb
' Simple class to encapsulate data associated with a formatted address
Public Class FormattedAddress
' -- Private Members --
Private m_aAddressLines As AddressLine()
Private m_bIsOverflow As Boolean
Private m_bIsTruncated As Boolean
' -- Public Methods --
' Construct from SOAP-layer object
Public Sub New(ByVal t As QAAddressType)
m_bIsOverflow = t.Overflow
m_bIsTruncated = t.Truncated
Dim aLines As AddressLineType() = t.AddressLine
' We must have lines in an address so aLines should never be null
Dim iSize As Integer = aLines.GetLength(0)
ReDim m_aAddressLines(iSize - 1)
If iSize > 0 Then
Dim i As Integer
For i = 0 To iSize - 1
m_aAddressLines(i) = New AddressLine(aLines(i))
Next i
End If
End Sub
' -- Read-only Properties --
' Returns the array of address line objects
ReadOnly Property AddressLines() As AddressLine()
Get
Return m_aAddressLines
End Get
End Property
' Returns the number of lines in the address
ReadOnly Property Length() As Integer
Get
If m_aAddressLines Is Nothing Then
Return 0
Else
Return m_aAddressLines.Length()
End If
End Get
End Property
' Flag that indicates there were not enough address lines configured to contain the address
ReadOnly Property IsOverflow() As Boolean
Get
Return m_bIsOverflow
End Get
End Property
' Flag that indicates one or more address lines were truncated
ReadOnly Property IsTruncated() As Boolean
Get
Return m_bIsTruncated
End Get
End Property
End Class
End Namespace
|
Imports Entidades
Imports LogicaNegocio
Imports System.Threading
Public Class frmAMMovimientos
Private _movimiento As New EMovimiento() 'Objeto perteneciente a la capa de Entidades
Private ReadOnly _LNMovimiento As New LNMovimiento() 'Objeto perteneciente a la capa de Lógica de Negocio.
Private ReadOnly _LNCategoria As New LNCategoria() 'Objeto perteneciente a la capa de Lógica de Negocio.
Private ReadOnly _LNSubCategoria As New LNSubCategoria() 'Objeto perteneciente a la capa de Lógica de Negocio.
Private ReadOnly _LNCuenta As New LNCuenta() 'Objeto perteneciente a la capa de Lógica de Negocio.
'Creación de una nueva instancia del formulario
Public Sub New(ByVal tipoMovimiento As String)
InitializeComponent()
Text = "Nuevo " + tipoMovimiento
_movimiento = New EMovimiento()
_movimiento.TipoMovimiento = tipoMovimiento
End Sub
Public Sub New(ByVal movimiento As EMovimiento)
InitializeComponent()
Text = "Modificar"
_movimiento = New EMovimiento()
_movimiento = movimiento
End Sub
' ____EVENTOS____
'Evento Load del Form
Private Sub frmMovimientos_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CheckForIllegalCrossThreadCalls = False
Dim thrCat As New Thread(AddressOf CargarComboCategorias)
thrCat.Start()
Dim thrCue As New Thread(AddressOf CargarComboCuentas)
thrCue.Start()
If Text = "Modificar" Then
dtpFecha.Value = _movimiento.Fecha
cmbCategorias.SelectedValue = _movimiento.Categoria
If _movimiento.Subcategoria <> Nothing Then
cmbSubCategorias.SelectedValue = _movimiento.Subcategoria
End If
txtMonto.Text = Format(_movimiento.Monto, "N2")
cmbCuentas.SelectedValue = _movimiento.Cuenta
txtDescripcion.Text = _movimiento.Descripcion
End If
End Sub
'Evento SelectionChangeCommited del ComboBox de Categorías
Private Sub cmbCategorias_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cmbCategorias.SelectionChangeCommitted
cmbSubCategorias.DataSource = Nothing
CargarComboSubCategorias(cmbCategorias.SelectedValue)
End Sub
'Evento Click del Botón Guardar
Private Sub btnGuardar_Click(sender As Object, e As EventArgs) Handles btnGuardar.Click
If Not IsNumeric(txtMonto.Text) Then
MessageBox.Show("El monto ingresado no es válido.", "Información", MessageBoxButtons.OK, MessageBoxIcon.Information)
Exit Sub
End If
Dim old_movimiento As New EMovimiento()
old_movimiento.ID = _movimiento.ID
old_movimiento.Fecha = _movimiento.Fecha
old_movimiento.Categoria = _movimiento.Categoria
old_movimiento.Subcategoria = _movimiento.Subcategoria
old_movimiento.Monto = _movimiento.Monto
old_movimiento.Cuenta = _movimiento.Cuenta
old_movimiento.Descripcion = _movimiento.Descripcion
Actualizar()
GrabarDatos(old_movimiento)
If _LNMovimiento.sb.Length <> 0 Then
MessageBox.Show(_LNMovimiento.sb.ToString(), "Información", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
Close()
End If
End Sub
'Evento Leave del TextBox Monto
Private Sub txtMonto_Leave(sender As Object, e As EventArgs) Handles txtMonto.Leave
If IsNumeric(txtMonto.Text) Then
txtMonto.Text = Format(Convert.ToDouble(txtMonto.Text), "N2")
End If
End Sub
'Evento KeyDown del Form
Private Sub frmAMMovimientos_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
If e.KeyCode = Keys.Escape Then
Close()
ElseIf e.Control AndAlso e.KeyCode = Keys.G Then
btnGuardar_Click(sender, e)
End If
End Sub
' ____FUNCIONES/RUTINAS____
'Grabar los datos ingresados en la base de datos.
Public Sub GrabarDatos(ByVal old_movimiento As EMovimiento)
Try
If _movimiento.ID = 0 Then
_LNMovimiento.Insertar(_movimiento)
Else
_LNMovimiento.Actualizar(old_movimiento, _movimiento)
End If
Catch ex As Exception
MessageBox.Show("Error inesperado: " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
'Setear el objeto Movimiento según los datos del formulario.
Public Sub Actualizar()
_movimiento.Fecha = dtpFecha.Value
_movimiento.Categoria = cmbCategorias.SelectedValue
_movimiento.SubCategoria = cmbSubCategorias.SelectedValue
If _movimiento.TipoMovimiento = "Ingreso" Then
_movimiento.Monto = Convert.ToDouble(txtMonto.Text)
Else
_movimiento.Monto = Convert.ToDouble("-" + txtMonto.Text)
End If
_movimiento.Cuenta = cmbCuentas.SelectedValue
_movimiento.Descripcion = txtDescripcion.Text.ToString.Trim()
End Sub
'Cargar el ComboBox con las distintas categorías.
Public Sub CargarComboCategorias()
Try
Dim categorias As List(Of ECategoria) = Nothing
If _movimiento.TipoMovimiento = "Ingreso" Then
categorias = _LNCategoria.ObtenerIngresos()
ElseIf _movimiento.TipoMovimiento = "Gasto" Then
categorias = _LNCategoria.ObtenerGastos()
End If
cmbCategorias.DataSource = categorias
cmbCategorias.DisplayMember = "Nombre"
cmbCategorias.ValueMember = "ID"
Catch ex As Exception
MessageBox.Show("Error inesperado: " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
'Cargar el ComboBox con las distintas subcategorías.
Public Sub CargarComboSubCategorias(ByVal categoria As Integer)
Try
Dim subCategorias As List(Of ESubCategoria) = _LNSubCategoria.ObtenerPorCategoria(categoria)
If subCategorias.Count = 0 Then
cmbSubCategorias.Enabled = False
Else
cmbSubCategorias.Enabled = True
cmbSubCategorias.DataSource = subCategorias
cmbSubCategorias.DisplayMember = "Nombre"
cmbSubCategorias.ValueMember = "ID"
End If
Catch ex As Exception
MessageBox.Show("Error inesperado: " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
'Cargar el ComboBox con las distintas cuentas.
Public Sub CargarComboCuentas()
Try
Dim cuentas As List(Of ECuenta) = _LNCuenta.ObtenerTodos()
cmbCuentas.DataSource = cuentas
cmbCuentas.DisplayMember = "Nombre"
cmbCuentas.ValueMember = "ID"
Catch ex As Exception
MessageBox.Show("Error inesperado: " + ex.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning)
End Try
End Sub
End Class |
Module Module1
Dim deck() As String
Dim r As New Random
Private Structure value
Dim cardName As String
Dim cardValue As Integer
Public Sub New(ByVal cn As String, ByVal cv As Integer)
Me.cardName = cn
Me.cardValue = cv
End Sub
End Structure
Dim values As New List(Of value)
Dim gamesPlayed As Integer
Dim youWon As Integer
Dim dealerWon As Integer
Dim balance As Decimal = 100D
Dim bet As Decimal
Sub Main()
Dim hearts() As String = Enumerable.Range(2, 9).Select(Function(x) x.ToString & Chr(3)).ToArray
hearts = hearts.Concat(New String() {"J" & Chr(3), "Q" & Chr(3), "K" & Chr(3), "A" & Chr(3)}).ToArray
Dim diamonds() As String = Enumerable.Range(2, 9).Select(Function(x) x.ToString & Chr(4)).ToArray
diamonds = diamonds.Concat(New String() {"J" & Chr(4), "Q" & Chr(4), "K" & Chr(4), "A" & Chr(4)}).ToArray
Dim clubs() As String = Enumerable.Range(2, 9).Select(Function(x) x.ToString & Chr(5)).ToArray
clubs = clubs.Concat(New String() {"J" & Chr(5), "Q" & Chr(5), "K" & Chr(5), "A" & Chr(5)}).ToArray
Dim spades() As String = Enumerable.Range(2, 9).Select(Function(x) x.ToString & Chr(6)).ToArray
spades = spades.Concat(New String() {"J" & Chr(6), "Q" & Chr(6), "K" & Chr(6), "A" & Chr(6)}).ToArray
values.Add(New value("2", 2))
values.Add(New value("3", 3))
values.Add(New value("4", 4))
values.Add(New value("5", 5))
values.Add(New value("6", 6))
values.Add(New value("7", 7))
values.Add(New value("8", 8))
values.Add(New value("9", 9))
values.Add(New value("10", 10))
values.Add(New value("J", 10))
values.Add(New value("Q", 10))
values.Add(New value("K", 10))
values.Add(New value("A", 11))
Dim playAgain As String
Do
playAgain = If(balance > 0, playAHand(), "n")
If playAgain.ToLower = "y" Then
deck = hearts.Concat(diamonds).Concat(clubs).Concat(spades).ToArray
shuffle()
Dim dealersHand() As String = deal(2)
Dim playersHand() As String = deal(2)
Dim dealerScore As Integer = dealersHand.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
If dealerScore = 22 Then dealerScore = 12
Dim playerScore As Integer = playersHand.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
If playerScore = 22 Then playerScore = 12
showCards("Your hand: ", playersHand)
Console.WriteLine()
If playerScore = 21 And Not dealerScore = 21 Then
Console.WriteLine("BlackJack! You win.")
Console.WriteLine()
showCards("Dealer's hand: ", dealersHand)
updateStats("user")
ElseIf playerScore = 21 And dealerScore = 21 Then
showCards("Dealer's hand: ", dealersHand)
Console.WriteLine("It's a draw. No one wins.")
updateStats("draw")
ElseIf (Not playerScore = 21 And Not dealerScore = 21) OrElse (Not playerScore = 21 And dealerScore = 21) Then
playGame("user", playerScore, dealerScore, playersHand, dealersHand)
End If
End If
Console.WriteLine()
Loop While playAgain.ToLower = "y"
Console.ReadLine()
End Sub
Private Function playAHand() As String
Console.WriteLine("Play a hand? (y/n)")
Dim response As String = Console.ReadLine
If response.ToLower = "y" Then
Console.Clear()
Console.WriteLine("Hands played: {0}", gamesPlayed)
Console.WriteLine("You won: {0}, Dealer won: {1}", youWon, dealerWon)
Console.WriteLine("Balance: {0:c2}", balance)
If balance = 0 Then
Console.WriteLine("Zero balance")
Return "n"
End If
Do
Console.WriteLine("How much would you like to bet?")
If Decimal.TryParse(Console.ReadLine, bet) AndAlso bet <= balance AndAlso bet > 0 Then
Console.WriteLine()
Console.WriteLine("Bet: {0:c2}", bet)
Exit Do
Else
Console.WriteLine()
Console.WriteLine("Invalid bet")
End If
Loop
End If
Return response
End Function
Private Sub playGame(ByVal player As String, ByVal score1 As Integer, ByVal score2 As Integer, ByVal hand1() As String, ByVal hand2() As String)
Dim response As String = ""
If player = "user" Then
Console.WriteLine("Twist? (y/n)")
response = Console.ReadLine
Console.WriteLine()
Else
response = "y"
End If
If response.ToLower = "y" Then
hand1 = hand1.Concat(deal(1)).ToArray
If player = "user" Then
showCards("Your hand: ", hand1)
Console.WriteLine()
End If
score1 = hand1.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
If player = "user" Then
If score1 > 21 And Not (score1 - (hand1.Count(Function(c) c.StartsWith("A")) * 10) <= 21) Then
showCards("Dealer's hand: ", If(player = "user", hand2, hand1))
Console.WriteLine()
updateStats(winner(player, hand1, hand2))
ElseIf score1 > 21 And (score1 - (hand1.Count(Function(c) c.StartsWith("A")) * 10) <= 21) Then
Dim count As Integer = 0
While count < hand1.Count(Function(c) c.StartsWith("A")) And score1 > 21
count += 1
score1 -= 10
End While
If score1 < 21 Then
playGame("user", score1, score2, hand1, hand2)
Else
showCards("Dealer's hand: ", hand2)
updateStats(winner(player, hand1, hand2))
End If
ElseIf score1 < 21 Then
playGame("user", score1, score2, hand1, hand2)
ElseIf score1 = 21 Then
playGame("dealer", score2, score1, hand2, hand1)
End If
Else
If score1 < 17 Then
playGame("dealer", score1, score2, hand1, hand2)
Else
If score1 < 20 Then
If r.Next(0, 4) = 1 Then
playGame("dealer", score1, score2, hand1, hand2)
Else
showCards("Dealer's hand: ", hand1)
updateStats(winner(player, hand1, hand2))
End If
ElseIf score1 > 21 And (score1 - (hand1.Count(Function(c) c.StartsWith("A")) * 10) <= 21) Then
Dim count As Integer = 0
While count < hand1.Count(Function(c) c.StartsWith("A")) And score1 > 21
count += 1
score1 -= 10
End While
If score1 < 21 Then
playGame("dealer", score1, score2, hand1, hand2)
Else
showCards("Dealer's hand: ", hand1)
updateStats(winner(player, hand1, hand2))
End If
Else
showCards("Dealer's hand: ", hand1)
updateStats(winner(player, hand1, hand2))
End If
End If
End If
Else
If score2 < 17 Then
playGame("dealer", score2, score1, hand2, hand1)
Else
If score2 < 20 Then
If r.Next(0, 4) = 1 Then
playGame("dealer", score2, score1, hand2, hand1)
Else
showCards("Dealer's hand: ", hand2)
updateStats(winner(player, hand1, hand2))
End If
Else
showCards("Dealer's hand: ", hand2)
updateStats(winner(player, hand1, hand2))
End If
End If
End If
End Sub
Private Function winner(ByVal player As String, ByVal hand1() As String, ByVal hand2() As String) As String
Dim score1 As Integer = hand1.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
Dim count As Integer = 0
While count < hand1.Count(Function(c) c.StartsWith("A")) And score1 > 21
count += 1
score1 -= 10
End While
Dim score2 As Integer = hand2.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
count = 0
While count < hand2.Count(Function(c) c.StartsWith("A")) And score2 > 21
count += 1
score2 -= 10
End While
If player = "user" Then
If score1 <= 21 AndAlso score2 <= 21 Then
If score1 > score2 Then
Console.WriteLine("You win.")
Return "user"
ElseIf score2 > score1 Then
Console.WriteLine("Dealer wins.")
Return "dealer"
Else 'draw
Console.WriteLine("No one wins.")
Return "draw"
End If
Else
If score1 > 21 Then
Console.WriteLine("You bust. Dealer wins.")
Return "dealer"
Else 'score2 > 21
Console.WriteLine("Dealer bust. You win.")
Return "user"
End If
End If
Else '"dealer"
If score1 <= 21 AndAlso score2 <= 21 Then
If score2 > score1 Then
Console.WriteLine("You win.")
Return "user"
ElseIf score1 > score2 Then
Console.WriteLine("Dealer wins.")
Return "dealer"
Else 'draw
Console.WriteLine("No one wins.")
Return "draw"
End If
Else
If score2 > 21 Then
Console.WriteLine("You bust. Dealer wins.")
Return "dealer"
Else 'score1 > 21
Console.WriteLine("Dealer bust. You win.")
Return "user"
End If
End If
End If
End Function
Private Sub shuffle()
deck = deck.OrderBy(Function(x) r.NextDouble).ToArray
End Sub
Private Function deal(ByVal count As Integer) As String()
Dim a() As String = deck.Take(count).ToArray
deck = deck.Except(a).ToArray
Return a
End Function
Private Sub showCards(ByVal label As String, ByVal cards() As String)
Console.Write(label)
Dim reds() As String = {Chr(3), Chr(4)}
For x As Integer = 0 To cards.GetUpperBound(0)
Console.ForegroundColor = If(reds.Any(Function(s) cards(x).Contains(s)), ConsoleColor.Red, ConsoleColor.Gray)
Console.Write(cards(x) & " ")
Next x
Dim cardSum As Integer = cards.Sum(Function(c) values.First(Function(v) If(Val(c) > 0, Val(c).ToString = v.cardName, c.StartsWith(v.cardName))).cardValue)
Dim count As Integer = 0
While count < cards.Count(Function(c) c.StartsWith("A")) And cardSum > 21
count += 1
cardSum -= 10
End While
Console.ForegroundColor = ConsoleColor.White
Console.Write("({0})", cardSum)
Console.WriteLine(vbCrLf)
End Sub
Private Sub updateStats(ByVal winner As String)
gamesPlayed += 1
youWon += If(winner = "user", 1, 0)
dealerWon += If(winner = "dealer", 1, 0)
balance += If(winner = "user", bet, If(winner = "dealer", -bet, 0))
End Sub
End Module
|
Public Class DBO_FormatosEnvasados
inherits BasesParaCompatibilidad.DataBussines
Private m_Id As BasesParaCompatibilidad.DataBussinesParameter
Private m_TipoFormatoEnvasadoID As BasesParaCompatibilidad.DataBussinesParameter
Private m_TipoFormatoLineaID As BasesParaCompatibilidad.DataBussinesParameter
Private m_EnvasadoID As BasesParaCompatibilidad.DataBussinesParameter
Private m_inicio As BasesParaCompatibilidad.DataBussinesParameter
Private m_fin As BasesParaCompatibilidad.DataBussinesParameter
Public Sub New()
MyBase.New()
m_Id = New BasesParaCompatibilidad.DataBussinesParameter("@FormatoEnvasadoID","FormatoEnvasadoID")
m_TipoFormatoEnvasadoID= New BasesParaCompatibilidad.DataBussinesParameter("@TipoFormatoEnvasadoID","TipoFormatoEnvasadoID")
m_TipoFormatoLineaID= New BasesParaCompatibilidad.DataBussinesParameter("@TipoFormatoLineaID","TipoFormatoLineaID")
m_EnvasadoID= New BasesParaCompatibilidad.DataBussinesParameter("@EnvasadoID","EnvasadoID")
m_inicio= New BasesParaCompatibilidad.DataBussinesParameter("@inicio","inicio")
m_fin= New BasesParaCompatibilidad.DataBussinesParameter("@fin","fin")
MyBase.primaryKey = m_Id
aņadirParametros()
End Sub
Public Property ID() As Int32
Get
Return if(isdbnull(m_id.value), Nothing, m_id.value)
End Get
Set(ByVal value As Int32)
Me.primaryKey.value = value
m_id.value = value
End Set
End Property
Public Property TipoFormatoEnvasadoID() As Int32
Get
Return if(isdbnull(m_TipoFormatoEnvasadoID.value), Nothing, m_TipoFormatoEnvasadoID.value)
End Get
Set(ByVal value As Int32)
m_TipoFormatoEnvasadoID.value = value
End Set
End Property
Public Property TipoFormatoLineaID() As Int32
Get
Return if(isdbnull(m_TipoFormatoLineaID.value), Nothing, m_TipoFormatoLineaID.value)
End Get
Set(ByVal value As Int32)
m_TipoFormatoLineaID.value = value
End Set
End Property
Public Property EnvasadoID() As Int32
Get
Return if(IsDBNull(m_EnvasadoID.value), Nothing, m_EnvasadoID.value)
End Get
Set(ByVal value As Int32)
m_EnvasadoID.value = value
End Set
End Property
Public Property inicio() As TimeSpan
Get
Return If(IsDBNull(m_inicio.value), DateTime.Now.TimeOfDay, m_inicio.value)
End Get
Set(ByVal value As TimeSpan)
m_inicio.value = value
End Set
End Property
Public Property fin() As TimeSpan
Get
Return If(IsDBNull(m_fin.value), DateTime.Now.TimeOfDay, m_fin.value)
End Get
Set(ByVal value As TimeSpan)
m_fin.value = value
End Set
End Property
Public ReadOnly Property fin_is_null() As Boolean
Get
Return if(IsDBNull(m_fin.value), True, False)
End Get
End Property
Private Sub aņadirParametros()
MyBase.atributos.Add(m_Id, m_Id.sqlName)
MyBase.atributos.Add(m_TipoFormatoEnvasadoID, m_TipoFormatoEnvasadoID.sqlName)
MyBase.atributos.Add(m_TipoFormatoLineaID, m_TipoFormatoLineaID.sqlName)
MyBase.atributos.Add(m_EnvasadoID, m_EnvasadoID.sqlName)
MyBase.atributos.Add(m_inicio, m_inicio.sqlName)
MyBase.atributos.Add(m_fin, m_fin.sqlName)
End Sub
End Class
|
Namespace IPC
Public Class Protocol
Public Shared ReadOnly Property HandShake As Byte = Asc("H"c)
Public Shared ReadOnly Property Execute As Byte = Asc("R"c)
Public Shared ReadOnly Property Library As Byte = Asc("L"c)
Public Shared ReadOnly Property ClassInfo As Byte = Asc("C"c)
Public Shared ReadOnly Property Critial As Byte = Asc("E"c)
Public Shared Function GetStringArgument(data As Byte()) As String
Return Text.Encoding.UTF8.GetString(data.Skip(1).ToArray)
End Function
Public Shared Function BuildStringCommand(command As Byte, data As String) As Byte()
Return {command}.Concat(Text.Encoding.UTF8.GetBytes(data)).ToArray
End Function
End Class
End Namespace
|
'-----------------------------------------------
' MatrixElements.vb (c) 2002 by Charles Petzold
'-----------------------------------------------
Imports System
Imports System.Drawing
Imports System.Drawing.Drawing2D
Imports System.Windows.Forms
Class MatrixElements
Inherits Form
Private matx As Matrix
Private btnUpdate As Button
Private updown(5) As NumericUpDown
Event Changed As EventHandler
Sub New()
Text = "Matrix Elements"
FormBorderStyle = FormBorderStyle.FixedDialog
ControlBox = False
MinimizeBox = False
MaximizeBox = False
ShowInTaskbar = False
Dim strLabel() As String = {"X Scale:", "Y Shear:", _
"X Shear:", "Y Scale:", _
"X Translate:", "Y Translate:"}
Dim i As Integer
For i = 0 To 5
Dim lbl As New Label()
lbl.Parent = Me
lbl.Text = strLabel(i)
lbl.Location = New Point(8, 8 + 16 * i)
lbl.Size = New Size(64, 8)
updown(i) = New NumericUpDown()
updown(i).Parent = Me
updown(i).Location = New Point(76, 8 + 16 * i)
updown(i).Size = New Size(48, 12)
updown(i).TextAlign = HorizontalAlignment.Right
AddHandler updown(i).ValueChanged, AddressOf UpDownOnValueChanged
updown(i).DecimalPlaces = 2
updown(i).Increment = 0.1D
updown(i).Minimum = Decimal.MinValue
updown(i).Maximum = Decimal.MaxValue
Next i
btnUpdate = New Button()
btnUpdate.Parent = Me
btnUpdate.Text = "Update"
btnUpdate.Location = New Point(8, 108)
btnUpdate.Size = New Size(50, 16)
AddHandler btnUpdate.Click, AddressOf ButtonUpdateOnClick
AcceptButton = btnUpdate
Dim btn As New Button()
btn.Parent = Me
btn.Text = "Methods..."
btn.Location = New Point(76, 108)
btn.Size = New Size(50, 16)
AddHandler btn.Click, AddressOf ButtonMethodsOnClick
ClientSize = New Size(134, 132)
AutoScaleBaseSize = New Size(4, 8)
End Sub
Property Matrix() As Matrix
Set(ByVal Value As Matrix)
matx = Value
Dim i As Integer
For i = 0 To 5
updown(i).Value = CDec(Value.Elements(i))
Next i
End Set
Get
matx = New Matrix(CSng(updown(0).Value), _
CSng(updown(1).Value), _
CSng(updown(2).Value), _
CSng(updown(3).Value), _
CSng(updown(4).Value), _
CSng(updown(5).Value))
Return matx
End Get
End Property
Private Sub UpDownOnValueChanged(ByVal obj As Object, _
ByVal ea As EventArgs)
Dim grfx As Graphics = CreateGraphics()
Dim boolEnableButton As Boolean = True
Try
grfx.Transform = Matrix
Catch
boolEnableButton = False
End Try
btnUpdate.Enabled = boolEnableButton
grfx.Dispose()
End Sub
Private Sub ButtonUpdateOnClick(ByVal obj As Object, _
ByVal ea As EventArgs)
RaiseEvent Changed(Me, EventArgs.Empty)
End Sub
Private Sub ButtonMethodsOnClick(ByVal obj As Object, _
ByVal ea As EventArgs)
Dim dlg As New MatrixMethods()
dlg.Matrix = Matrix
If dlg.ShowDialog() = DialogResult.OK Then
Matrix = dlg.Matrix
btnUpdate.PerformClick()
End If
End Sub
End Class
|
Imports Microsoft.VisualBasic
Imports System.data
Imports System.Web
'--------------------------------------------------------------------------------------------------
' Project Trading Portal Project.
'
' Function This class is used to deal with Profile Manager Requests
'
' Date 24/11/08
'
' Author Ben Ford
'
' CS Group 2007 All rights reserved.
'
' Error Number Code base TACPMR-
'
' Modification Summary
'
' dd/mm/yy ID By Description
' -------- ----- --- -----------
'
'--------------------------------------------------------------------------------------------------
<Serializable()> _
Public Class TalentProfileManager
Inherits TalentBase
Private _settings As New DESettings
Private _resultDataSet As DataSet
Public Property ResultDataSet() As DataSet
Get
Return _resultDataSet
End Get
Set(ByVal value As DataSet)
_resultDataSet = value
End Set
End Property
Private _profileManagerTransactions As DEProfileManagerTransactions
Public Property ProfileManagerTransactions() As DEProfileManagerTransactions
Get
Return _profileManagerTransactions
End Get
Set(ByVal value As DEProfileManagerTransactions)
_profileManagerTransactions = value
End Set
End Property
Public Function ReceiveProfileManagerTransactions() As ErrorObj
Const ModuleName As String = "ReceiveProfileManagerTransactions"
Settings.ModuleName = ModuleName
Me.GetConnectionDetails(Settings.BusinessUnit, "", ModuleName)
Dim err As New ErrorObj
' No cache
Dim DbProfileManager As New dbprofilemanager
With DbProfileManager
.ProfileManagerTransactions = ProfileManagerTransactions
.Settings = Settings
err = .ValidateAgainstDatabase()
If Not .ResultDataSet Is Nothing Then
ResultDataSet = .ResultDataSet
End If
'
If Not err.HasError And ResultDataSet Is Nothing Then
err = .AccessDatabase()
If Not err.HasError And Not .ResultDataSet Is Nothing Then
ResultDataSet = .ResultDataSet
End If
End If
End With
Return err
End Function
End Class
|
Public Class frmRol
Private pObjLn As New clsLnRol
Public pObjBe As New clsBeRol
Public Enum TipoTrans
Nuevo = 1
Editar = 2
End Enum
Private Property Modo As TipoTrans
Sub New(ByVal pModo As TipoTrans)
InitializeComponent()
Modo = pModo
End Sub
Private Sub frmRol_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Try
Select Case Modo
Case TipoTrans.Nuevo
User_agrTextEdit.Text = AP.UsuarioAp.Nombres + " " + AP.UsuarioAp.Apellidos
Fec_agrDateEdit.Text = Now
User_modTextEdit.Text = AP.UsuarioAp.Nombres + " " + AP.UsuarioAp.Apellidos
Fec_modDateEdit.Text = Now
mnuGuardar.Enabled = True
mnuActualizar.Enabled = False
mnuEliminar.Enabled = False
clsLnRol.CargaMenuRol(lvMenuRol, Integer.Parse(txtIdRol.Text.ToString))
clsLnRol.CargaMenuSistema(lvMenuSistema)
Case TipoTrans.Editar
pObjLn.Obtener(pObjBe)
txtNombreRol.Text = pObjBe.Nombre
txtIdRol.Text = pObjBe.IdRol.ToString
clsLnRol.CargaMenuRol(lvMenuRol, Integer.Parse(txtIdRol.Text.ToString))
clsLnRol.CargaMenuSistema(lvMenuSistema)
chkActivo.Checked = pObjBe.Activo
User_agrTextEdit.Text = pObjBe.User_agr.ToString
Fec_agrDateEdit.Text = pObjBe.Fec_agr.ToShortDateString
User_modTextEdit.Text = pObjBe.User_mod.ToString
Fec_modDateEdit.Text = pObjBe.Fec_mod.ToShortDateString
mnuGuardar.Enabled = False
mnuActualizar.Enabled = True
mnuEliminar.Enabled = True
End Select
txtNombreRol.Focus()
Application.DoEvents()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Sub
Private Function Guardar() As Boolean
Guardar = False
Try
pObjBe.IdRol = clsLnRol.MaxID()
pObjBe.Nombre = txtNombreRol.Text.Trim()
pObjBe.Activo = chkActivo.Checked
pObjBe.User_agr = AP.UsuarioAp.IdUsuario
pObjBe.Fec_agr = Now
pObjBe.User_mod = AP.UsuarioAp.IdUsuario
pObjBe.User_agr = Now
Guardar = pObjLn.Insertar(pObjBe) > 0
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, ex.Message)
End Try
End Function
Private Function Actualizar() As Boolean
Actualizar = False
Try
If Datos_Correctos() Then
pObjBe.Nombre = txtNombreRol.Text.Trim()
pObjBe.Activo = chkActivo.Checked
pObjBe.User_mod = AP.UsuarioAp.IdUsuario
pObjBe.Fec_mod = Now
Actualizar = pObjLn.Actualizar(pObjBe) > 0
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Private Sub mnuGuardar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuGuardar.ItemClick
If Datos_Correctos() Then
If MsgBox("¿Guardar Rol?", MsgBoxStyle.YesNo, Me.Text) = MsgBoxResult.Yes Then
If Guardar() Then
MsgBox("Se guardó el registro", MsgBoxStyle.Information, Me.Text)
Me.Close()
End If
End If
End If
End Sub
Private Sub mnuActualizar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuActualizar.ItemClick
If Actualizar() Then
MsgBox("Se actualizó el registro", MsgBoxStyle.Information, Me.Text)
Me.Close()
End If
End Sub
Private Function Datos_Correctos() As Boolean
Datos_Correctos = False
Try
If String.IsNullOrEmpty(txtNombreRol.Text.Trim()) Then
MsgBox("Ingrese Nombre.", MsgBoxStyle.Exclamation, Me.Text)
txtNombreRol.Focus()
Else
Datos_Correctos = True
End If
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Function
Private Sub mnuEliminar_ItemClick(sender As Object, e As DevExpress.XtraBars.ItemClickEventArgs) Handles mnuEliminar.ItemClick
If CBool(MsgBox("¿Desactivar el Rol?", MsgBoxStyle.YesNo, Me.Text) = MsgBoxResult.Yes) Then
If pObjLn.Eliminar(pObjBe) > 0 Then
MsgBox("Se ha eliminado el registro", MsgBoxStyle.Information, Me.Text)
Me.Close()
End If
End If
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
Try
For Each m As ListViewItem In lvMenuSistema.Items
m.Checked = (CheckBox1.Checked = True)
Next
Application.DoEvents()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
Try
For Each m As ListViewItem In lvMenuRol.Items
m.Checked = (CheckBox2.Checked = True)
Next
Application.DoEvents()
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
End Try
End Sub
Private Sub cmdAgregar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAgregar.Click
Dim I As Integer, vMenuID$
Try
prg.Visible = True
prg.Maximum = lvMenuSistema.Items.Count
For I = 0 To lvMenuSistema.Items.Count - 1
If (lvMenuSistema.Items(I).Checked) Then
vMenuID$ = lvMenuSistema.Items(I).SubItems(1).Text
If Not clsLnRol.ExisteOpcion(vMenuID$, CInt(txtIdRol.Text)) Then
'dRol.Inserta_MenuRol(vMenuID$, CInt(txtIdRol.Text))
Else
'dRol.Actualiza_MenuRol(vMenuID$, CInt(txtIdRol.Text))
End If
prg.Value = I
End If
Application.DoEvents()
Next I
clsLnRol.CargaMenuRol(lvMenuRol, Integer.Parse(txtIdRol.Text.ToString))
MsgBox("Permisos actualizados", MsgBoxStyle.Information, Me.Text)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
Finally
prg.Visible = False
End Try
End Sub
Private Sub cmdQuitar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdQuitar.Click
Dim I As Integer, vMenuID$
Try
prg.Visible = True
prg.Maximum = lvMenuRol.Items.Count
For I = 0 To lvMenuRol.Items.Count - 1
If lvMenuRol.Items(I).Checked = True Then
vMenuID$ = lvMenuRol.Items(I).SubItems(1).Text
lvMenuRol.Items(I).Checked = (CheckBox2.Checked = True)
'dRol.Elimina_MenuRol(vMenuID, CInt(txtIdRol.Text.ToString))
Application.DoEvents()
prg.Value = I
End If
Next
clsLnRol.CargaMenuRol(lvMenuRol, CInt(txtIdRol.Text.ToString))
MsgBox("Se han desactivado las opciones", MsgBoxStyle.Information, Me.Text)
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, Me.Text)
Finally
prg.Visible = False
End Try
End Sub
End Class |
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Text
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports BaseClasses
''' <summary>
''' A json enabled web control
''' </summary>
''' <remarks></remarks>
#If DEBUG Then
Public Class jsonSeverConrol
Inherits System.Web.UI.Control
#Else
<ComponentModel.EditorBrowsable(ComponentModel.EditorBrowsableState.Never), ComponentModel.ToolboxItem(False)> _
Public Class jsonSeverConrol
Inherits System.Web.UI.Control
#End If
Private Sub jsonSeverConrol_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
jQueryLibrary.jQueryInclude.addScriptBlock(Page,
"window." & jsCallFunc & " = function(action1,datainput,successFunction){" & vbCrLf &
"if(!successFunction){successFunction=" & jsCompleteFunc & ";} " & vbCrLf &
"$.ajax({ " & vbCrLf &
" url: '" & postURL & "', " & vbCrLf &
" type: ""POST"", " & vbCrLf &
" dataType: """ & System.Enum.GetName(ajaxReturn.[GetType], ajaxReturn) & """, " & vbCrLf &
" data: {action: action1,id:'" & ajaxId & "',input:datainput}, " & vbCrLf &
" success: successFunction " & vbCrLf &
"} );}" & vbCrLf, isolateJquery:=True)
Page.Session(ajaxId) = workerclass
End Sub
Private _workerclass As String = "DTIAjax.jsonWorker"
Public Property workerclass() As String
Get
Return _workerclass
End Get
Set(ByVal value As String)
_workerclass = value
End Set
End Property
Private _ajaxId As String = Nothing
Public Property ajaxId() As String
Get
If _ajaxId Is Nothing Then _ajaxId = Guid.NewGuid.ToString
Return _ajaxId
End Get
Set(ByVal value As String)
_ajaxId = value
End Set
End Property
Private _ActionCompleteFunction As String = Nothing
Public Property jsCompleteFunc() As String
Get
If _ActionCompleteFunction Is Nothing Then
Return "function(data){;}"
End If
Return _ActionCompleteFunction
End Get
Set(ByVal value As String)
_ActionCompleteFunction = value
End Set
End Property
Private _returnType As ajaxReturnType = ajaxReturnType.json
Public Property ajaxReturn() As ajaxReturnType
Get
Return _returnType
End Get
Set(ByVal value As ajaxReturnType)
_returnType = value
End Set
End Property
Private _callingfunt As String = Nothing
Public Property jsCallFunc() As String
Get
If _callingfunt Is Nothing Then
_callingfunt = "ajax" & Me.ClientID
End If
Return _callingfunt
End Get
Set(ByVal value As String)
_callingfunt = value
End Set
End Property
Private _postURL As String = "~/res/DTIAjax/jsonpg.aspx"
Public Property postURL() As String
Get
Return _postURL
End Get
Set(ByVal value As String)
_postURL = value
End Set
End Property
Public Enum ajaxReturnType
xml
html
script
json
jsonp
text
End Enum
End Class
|
#Region "Microsoft.VisualBasic::fb6350ceb9235236b7ab430b6adb1e20, mzkit\src\mzmath\mz_deco\Models\PeakFeature.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: 71
' Code Lines: 25
' Comment Lines: 35
' Blank Lines: 11
' File Size: 2.07 KB
' Class PeakFeature
'
' Properties: area, baseline, integration, maxInto, mz
' noise, nticks, rt, rtmax, rtmin
' snRatio, xcms_id
'
' Function: ToString
'
' /********************************************************************************/
#End Region
Imports BioNovoGene.Analytical.MassSpectrometry.Math.Chromatogram
Imports stdNum = System.Math
''' <summary>
''' a result peak feature
''' </summary>
Public Class PeakFeature
Implements IRetentionTime
Implements IROI
Public Property xcms_id As String
Public Property mz As Double
''' <summary>
''' 出峰达到峰高最大值<see cref="maxInto"/>的时间点
''' </summary>
''' <returns></returns>
Public Property rt As Double Implements IRetentionTime.rt
Public Property rtmin As Double Implements IROI.rtmin
Public Property rtmax As Double Implements IROI.rtmax
''' <summary>
''' 这个区域的最大峰高度
''' </summary>
''' <returns></returns>
Public Property maxInto As Double
''' <summary>
''' 所计算出来的基线的响应强度
''' </summary>
''' <returns></returns>
Public Property baseline As Double
''' <summary>
''' 当前的这个ROI的峰面积积分值
''' </summary>
''' <returns></returns>
''' <remarks>
''' 为当前的ROI峰面积占整个TIC峰面积的百分比,一个实验所导出来的所有的ROI的
''' 积分值加起来应该是约等于100的
''' </remarks>
Public Property integration As Double
''' <summary>
''' 计算得到的峰面积
''' </summary>
''' <returns></returns>
Public Property area As Double
''' <summary>
''' 噪声的面积积分百分比
''' </summary>
''' <returns></returns>
Public Property noise As Double
Public Property nticks As Integer
Public Property rawfile As String
''' <summary>
''' 信噪比
''' </summary>
''' <returns></returns>
Public ReadOnly Property snRatio As Double
Get
Return stdNum.Log(integration / noise)
End Get
End Property
Public Overrides Function ToString() As String
Return $"[{xcms_id}] {mz.ToString("F4")}@[{rtmin.ToString("F1")}, {rtmax.ToString("F1")}] = {area.ToString("G3")}"
End Function
End Class
|
Imports System.Drawing
Imports System.Reflection
Imports System.Windows.Forms
Imports SportingAppFW.Data.Common
Imports SportingAppFW.SaWindows.Forms
Namespace Tools
Public Module SaDataGridViewUtility
''' <summary>
''' 依據 SaFields 設定的屬性設定 DataGridView
''' </summary>
''' <param name="gv"></param>
''' <param name="saf"></param>
''' <param name="dbconn"></param>
Public Sub SetGridViewHeaderByAttribute(ByRef gv As DataGridView, ByVal saf As SaFields, ByVal dbconn As IDbConnection)
gv.AutoGenerateColumns = False
gv.Columns.Clear()
For Each attri As KeyValuePair(Of PropertyInfo, SaUIFieldsAttribute) In saf.SaUIFieldsAttributes
If attri.Value.CustomControl = CustomControlEnum.TextBox Then
Dim textCln As DataGridViewTextBoxColumn = New DataGridViewTextBoxColumn()
textCln.HeaderText = attri.Value.Caption
textCln.ReadOnly = attri.Value.ReadMode
If textCln.ReadOnly Then
textCln.DefaultCellStyle.BackColor = SystemColors.ControlDark
End If
textCln.Resizable = DataGridViewTriState.True
textCln.DataPropertyName = attri.Key.Name
textCln.Name = attri.Key.Name
textCln.Visible = attri.Value.FieldVisible
gv.Columns.Add(textCln)
ElseIf attri.Value.CustomControl = CustomControlEnum.DateTimePicker Then
Dim calCln As SaCalendarColumn = New SaCalendarColumn()
calCln.HeaderText = attri.Value.Caption
calCln.ReadOnly = attri.Value.ReadMode
If calCln.ReadOnly Then
calCln.DefaultCellStyle.BackColor = SystemColors.ControlDark
End If
calCln.Resizable = DataGridViewTriState.True
calCln.DataPropertyName = attri.Key.Name
calCln.Name = attri.Key.Name
calCln.MinimumWidth = 100
calCln.Visible = attri.Value.FieldVisible
gv.Columns.Add(calCln)
ElseIf attri.Value.CustomControl = CustomControlEnum.CheckBox Then
Dim checkCln As DataGridViewCheckBoxColumn = New DataGridViewCheckBoxColumn()
checkCln.HeaderText = attri.Value.Caption
checkCln.ReadOnly = attri.Value.ReadMode
If checkCln.ReadOnly Then
checkCln.DefaultCellStyle.BackColor = SystemColors.ControlDark
End If
checkCln.Resizable = DataGridViewTriState.True
checkCln.DataPropertyName = attri.Key.Name
checkCln.Name = attri.Key.Name
checkCln.TrueValue = "Y"
checkCln.FalseValue = "N"
checkCln.Visible = attri.Value.FieldVisible
gv.Columns.Add(checkCln)
ElseIf attri.Value.CustomControl = CustomControlEnum.MultiComboBox Then
Dim saTab As SaTable = Activator.CreateInstance(attri.Value.ComboBoxSetting.DataSourceClass, dbconn)
Dim dt As DataTable = saTab.SelectAll()
Dim cmbCln As SaMultiComboBoxColumn = New SaMultiComboBoxColumn()
cmbCln.DataSource = dt
cmbCln.Member = attri.Value.ComboBoxSetting.ValueMember
cmbCln.ColToDisplay = attri.Value.ComboBoxSetting.ColumnsToDisplay
cmbCln.PassMemeber = attri.Value.ComboBoxSetting.PassToTargets
cmbCln.HeaderText = attri.Value.Caption
cmbCln.ReadOnly = attri.Value.ReadMode
If cmbCln.ReadOnly Then
cmbCln.DefaultCellStyle.BackColor = SystemColors.ControlDark
End If
cmbCln.Resizable = DataGridViewTriState.True
cmbCln.DataPropertyName = attri.Key.Name
cmbCln.Name = attri.Key.Name
cmbCln.MinimumWidth = 100
cmbCln.Visible = attri.Value.FieldVisible
gv.Columns.Add(cmbCln)
End If
Next
End Sub
End Module
End Namespace |
#Region "License"
' The MIT License (MIT)
'
' Copyright (c) 2017 Richard L King (TradeWright Software Systems)
'
' 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.
#End Region
Imports OrderUtils27
Imports TickUtils27
Public Enum EntryOrderType
None = BracketEntryTypes.BracketEntryTypeNone
Market = BracketEntryTypes.BracketEntryTypeMarket
MarketOnOpen = BracketEntryTypes.BracketEntryTypeMarketOnOpen
MarketOnClose = BracketEntryTypes.BracketEntryTypeMarketOnClose
MarketIfTouched = BracketEntryTypes.BracketEntryTypeMarketIfTouched
MarketToLimit = BracketEntryTypes.BracketEntryTypeMarketToLimit
Bid = BracketEntryTypes.BracketEntryTypeBid
Ask = BracketEntryTypes.BracketEntryTypeAsk
Last = BracketEntryTypes.BracketEntryTypeLast
Limit = BracketEntryTypes.BracketEntryTypeLimit
LimitOnOpen = BracketEntryTypes.BracketEntryTypeLimitOnOpen
LimitOnClose = BracketEntryTypes.BracketEntryTypeLimitOnClose
LimitIfTouched = BracketEntryTypes.BracketEntryTypeLimitIfTouched
[Stop] = BracketEntryTypes.BracketEntryTypeStop
StopLimit = BracketEntryTypes.BracketEntryTypeStopLimit
End Enum
Public Enum OrderRole
Entry = BracketOrderRoles.BracketOrderRoleEntry
StopLoss = BracketOrderRoles.BracketOrderRoleStopLoss
Target = BracketOrderRoles.BracketOrderRoleTarget
End Enum
Public Enum OrderTIF
None = OrderTIFs.OrderTIFNone
Day = OrderTIFs.OrderTIFDay
GoodTillCancelled = OrderTIFs.OrderTIFGoodTillCancelled
ImmediateOrCancel = OrderTIFs.OrderTIFImmediateOrCancel
End Enum
Public Enum StopLossOrderType
None = BracketStopLossTypes.BracketStopLossTypeNone
[Stop] = BracketStopLossTypes.BracketStopLossTypeStop
StopLimit = BracketStopLossTypes.BracketStopLossTypeStopLimit
Bid = BracketStopLossTypes.BracketStopLossTypeBid
Ask = BracketStopLossTypes.BracketStopLossTypeAsk
Last = BracketStopLossTypes.BracketStopLossTypeLast
Auto = BracketStopLossTypes.BracketStopLossTypeAuto
End Enum
Public Enum TargetOrderType
None = BracketTargetTypes.BracketTargetTypeNone
Limit = BracketTargetTypes.BracketTargetTypeLimit
LimitIfTouched = BracketTargetTypes.BracketTargetTypeLimitIfTouched
MarketIfTouched = BracketTargetTypes.BracketTargetTypeMarketIfTouched
Bid = BracketTargetTypes.BracketTargetTypeBid
Ask = BracketTargetTypes.BracketTargetTypeAsk
Last = BracketTargetTypes.BracketTargetTypeLast
Auto = BracketTargetTypes.BracketTargetTypeAuto
End Enum
Public Enum TickType
Bid = TickTypes.TickTypeBid
Ask = TickTypes.TickTypeAsk
ClosePrice = TickTypes.TickTypeClosePrice
HighPrice = TickTypes.TickTypeHighPrice
LowPrice = TickTypes.TickTypeLowPrice
MarketDepth = TickTypes.TickTypeMarketDepth
MarketDepthReset = TickTypes.TickTypeMarketDepthReset
Trade = TickTypes.TickTypeTrade
Volume = TickTypes.TickTypeVolume
OpenInterest = TickTypes.TickTypeOpenInterest
OpenPrice = TickTypes.TickTypeOpenPrice
End Enum
|
Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Xml
Imports Talent.Common
Namespace Talent.TradingPortal
Public Class XmlRetrievePromotionsResponse
Inherits XmlResponse
Private dtPomotionsListDetails As DataTable
Private dtStatusDetails As DataTable
Private errorOccurred As Boolean = False
Private ndsPriceCode(10) As XmlNode
Private ndPromotionList, ndPromotions, ndPromotion, ndPromotionType, ndPriority, ndMatchType, _
ndProductCode, ndStand, ndArea, ndPreReq, ndPriceCodes, ndPriceBand, ndShortDescription, _
ndLongDescription, ndCompetitionCode, ndMaxDiscountPerProduct, ndMaxDiscountPerPromotion, _
ndStartDate, ndEndDate, ndReturnCode, ndResponse As XmlNode
Protected Overrides Sub InsertBodyV1()
Dim ndHeaderRoot, ndHeaderRootHeader As XmlNode
With MyBase.xmlDoc
ndPromotionList = .CreateElement("PromotionsList")
ndPromotion = .CreateElement("Promotion")
End With
If Not Err.HasError Then
'Create the response xml section
CreateResponseSection()
'Create the promotions list
CreatePromotionsList()
End If
With MyBase.xmlDoc
'--------------------------------------------------------------------------------------
' Insert the fragment into the XML document
'
Const c1 As String = "//" ' Constants are faster at run time
Const c2 As String = "/TransactionHeader"
'
ndHeaderRoot = .SelectSingleNode(c1 & RootElement())
ndHeaderRootHeader = .SelectSingleNode(c1 & RootElement() & c2)
ndHeaderRoot.InsertAfter(ndPromotionList, ndHeaderRootHeader)
'Insert the XSD reference & namespace as an attribute within the root node
End With
End Sub
Protected Sub CreateResponseSection()
Dim dr As DataRow
'Create the response xml nodes
With MyBase.xmlDoc
ndReturnCode = .CreateElement("ReturnCode")
End With
'Read the values for the response section
If Not ResultDataSet Is Nothing AndAlso ResultDataSet.Tables.Count > 0 Then
dtStatusDetails = ResultDataSet.Tables(0)
If dtStatusDetails.Rows.Count > 0 Then
dr = dtStatusDetails.Rows(0)
End If
End If
End Sub
Protected Sub CreatePromotionsList()
Dim dr As DataRow
If Not errorOccurred Then
'Read the values for the response section
dtPomotionsListDetails = ResultDataSet.Tables(0)
'Loop around the products
For Each dr In dtPomotionsListDetails.Rows
ndPromotion = MyBase.xmlDoc.CreateElement("Promotion")
'Create the customer xml nodes
With MyBase.xmlDoc
ndPromotionType = .CreateElement("PromotionType")
ndPriority = .CreateElement("Priority")
ndMatchType = .CreateElement("MatchType")
ndProductCode = .CreateElement("ProductCode")
ndStand = .CreateElement("Stand")
ndArea = .CreateElement("Area")
ndPreReq = .CreateElement("PreReq")
ndPriceCodes = .CreateElement("PriceCodes")
For i As Integer = 1 To 10
ndsPriceCode(i) = .CreateElement("PriceCode" & i)
Next
ndPriceBand = .CreateElement("PriceBand")
ndShortDescription = .CreateElement("ShortDescription")
ndLongDescription = .CreateElement("LongDescription")
ndCompetitionCode = .CreateElement("CompetitionCode")
ndMaxDiscountPerProduct = .CreateElement("MaxDiscountPerProduct")
ndMaxDiscountPerPromotion = .CreateElement("MaxDiscountPerPromotion")
ndStartDate = .CreateElement("StartDate")
ndEndDate = .CreateElement("EndDate")
End With
'Populate the nodes
ndPromotionType.InnerText = CType(dr("PromotionType"), String)
ndPriority.InnerText = dr("Priority")
ndMatchType.InnerText = dr("MatchType")
ndProductCode.InnerText = dr("ProductCode")
ndStand.InnerText = dr("Stand")
ndArea.InnerText = dr("Area")
ndPreReq.InnerText = dr("PreReq")
For i As Integer = 1 To 10
ndsPriceCode(i).InnerText = dr("PriceCode" & i)
ndPriceCodes.AppendChild(ndsPriceCode(i))
Next
ndPriceBand.InnerText = dr("PriceBand")
ndShortDescription.InnerText = dr("ShortDescription")
ndLongDescription.InnerText = dr("Description1")
ndCompetitionCode.InnerText = dr("CompetitionCode")
ndMaxDiscountPerProduct.InnerText = dr("MaxPerProduct")
ndMaxDiscountPerPromotion.InnerText = dr("MaxPerPromotion")
Try
Dim sDate As String = Format(dr("StartDate"), "dd/MM/yyyy").ToString
ndStartDate.InnerText = sDate
Catch ex As Exception
ndStartDate.InnerText = ""
End Try
Try
Dim eDate As String = Format(dr("EndDate"), "dd/MM/yyyy")
ndEndDate.InnerText = eDate
Catch ex As Exception
ndStartDate.InnerText = ""
End Try
'Set the xml nodes
With ndPromotion
.AppendChild(ndPromotionType)
.AppendChild(ndPriority)
.AppendChild(ndMatchType)
.AppendChild(ndProductCode)
.AppendChild(ndStand)
.AppendChild(ndArea)
.AppendChild(ndPreReq)
.AppendChild(ndPriceCodes)
.AppendChild(ndPriceBand)
.AppendChild(ndShortDescription)
.AppendChild(ndLongDescription)
.AppendChild(ndCompetitionCode)
.AppendChild(ndMaxDiscountPerProduct)
.AppendChild(ndMaxDiscountPerPromotion)
.AppendChild(ndStartDate)
.AppendChild(ndEndDate)
End With
'Add the product to the product list
With ndPromotionList
.AppendChild(ndPromotion)
End With
Next dr
End If
End Sub
End Class
End Namespace
|
#Region "License"
' The MIT License (MIT)
'
' Copyright (c) 2017 Richard L King (TradeWright Software Systems)
'
' 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.
#End Region
Namespace Contracts
Public Enum ContractSortKeyId
None
LocalSymbol
Symbol
SecType
Exchange
Expiry
Mutiplier
Currency
Right
Strike
End Enum
<Flags> Public Enum ContractStoreCapabilities
'CanStore = 1
CanQuery = 2
End Enum
Public Enum OptionRight
None = 0
[Call]
Put
End Enum
Public Enum SecurityType
None
Stock
Future
[Option]
FuturesOption
Cash
Combo
Index
End Enum
End Namespace
|
Option Explicit On
Option Compare Text
Imports System.IO
Imports System.Data.OleDb
Module modDBAccess
'Constante que guarda el nombre del mudolu
Const mc_strNombre_Modulo As String = "modDBAccess"
'Se declara la variable de la conexion a la base de datos
Private m_cnxConexion As New OleDbConnection
'Se guarda la ruta de la base de datos para saber cuando cambia
Private m_strDBPath As String = ""
'Guarda la ubicacion de las plantillas de la base de datos
Public Const gc_strDBTemplatesPath As String = "\DBIT\"
'<CABECERA>-----------------------------------------------
'Descripcion......: Establece o cierra la conexion con la Base de Datos
'Fecha............: 07/10/2011
'<FIN CABECERA>-------------------------------------------
Private Sub AbrirConexion()
Const strNombre_Funcion As String = "AbrirConexion"
Dim blnCambioDB As Boolean
Try
If Not m_strDBPath.Equals(gv_strDBPrincipal) Then
m_strDBPath = gv_strDBPrincipal
blnCambioDB = True
End If
If m_cnxConexion.State <> ConnectionState.Open Then
m_cnxConexion.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & m_strDBPath & ";Persist Security Info=False"
m_cnxConexion.Open()
ElseIf blnCambioDB Then
CerrarConexion()
m_cnxConexion.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & m_strDBPath & ";Persist Security Info=False"
m_cnxConexion.Open()
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
Public ReadOnly Property ConexionDB As OleDbConnection
Get
Return m_cnxConexion
End Get
End Property
'<CABECERA>-----------------------------------------------
'Descripcion......: Cierra la conexion con la Base de Datos
'Fecha............: 10/01/2012
'<FIN CABECERA>-------------------------------------------
Public Sub CerrarConexion()
Const strNombre_Funcion As String = "CerrarConexion"
Try
If m_cnxConexion.State = ConnectionState.Open Then
m_cnxConexion.Close()
End If
Catch ex As Exception
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
End Try
End Sub
'<CABECERA>-----------------------------------------------
'Descripcion......: Devuelve un DataSet con la tabla que contiene
' los registros obtenidos de la SQL recibida
'Fecha............: 10/10/2011
'<FIN CABECERA>-------------------------------------------
Public Function dtsObtenerDataSet(ByVal strSQL As String) As DataSet
Const strNombre_Funcion As String = "dtsObtenerDataSet"
Dim blnError As Boolean
Dim dtaDataAdapter As New OleDbDataAdapter
Dim dtsDataSet As New DataSet
Try
'Se abre la conexion con la base de datos
AbrirConexion()
'Se obtiene el dataset
dtaDataAdapter.SelectCommand = New OleDbCommand(strSQL, m_cnxConexion)
dtaDataAdapter.Fill(dtsDataSet)
dtaDataAdapter.Dispose()
Catch ex As Exception
blnError = True
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
Finally
If blnError Then
dtsObtenerDataSet = Nothing
Else
dtsObtenerDataSet = dtsDataSet
End If
End Try
End Function
'<CABECERA>-----------------------------------------------
'Descripcion......: Devuelve un DataSet con la tabla que contiene
' los registros obtenidos de la SQL recibida
'Fecha............: 10/10/2011
'<FIN CABECERA>-------------------------------------------
Public Function blnEjecutarQuery(ByVal strSQL As String) As Boolean
Const strNombre_Funcion As String = "blnEjecutarQuery"
Dim blnError As Boolean
Dim cmdCommand As New OleDbCommand
Dim blnResultado As Boolean
Try
'Se abre la conexion con la base de datos
AbrirConexion()
'Se obtiene el dataset
cmdCommand.Connection = m_cnxConexion
cmdCommand.CommandText = strSQL
cmdCommand.ExecuteNonQuery()
blnResultado = True
Catch ex As Exception
blnError = True
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
Finally
If blnError Then
blnResultado = False
End If
blnEjecutarQuery = blnResultado
End Try
End Function
'<CABECERA>-----------------------------------------------
'Descripcion......: Averigua si existe una tabla en la base de datos
'Fecha............: 21/02/2012
'<FIN CABECERA>-------------------------------------------
Public Function blnExisteTabla(ByVal strDBPath As String, ByVal strTabla As String) As Boolean
Const strNombre_Funcion As String = "blnExisteTabla"
Dim blnError As Boolean
Dim blnResultado As Boolean
Dim cnxConexion As OleDbConnection
Dim dttTabla As DataTable
Dim objRows() As DataRow
Dim strCriterio As String
Try
If strDBPath <> "" Then
'Abre la base de datos
cnxConexion = New OleDbConnection
cnxConexion.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & strDBPath & ";Persist Security Info=False"
cnxConexion.Open()
'Declara y abre el recordset
dttTabla = cnxConexion.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, New Object() {Nothing, Nothing, Nothing, "TABLE"})
strCriterio = String.Format("TABLE_NAME = '{0}'", strTabla)
objRows = dttTabla.Select(strCriterio)
blnResultado = (objRows.Length > 0)
Else
blnResultado = False
End If
Catch ex As Exception
blnError = True
AddLog(ex.Message, mc_strNombre_Modulo, strNombre_Funcion)
Finally
If blnError Then
blnResultado = False
End If
blnExisteTabla = blnResultado
End Try
End Function
End Module
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("BurnSoft Application Profiler Manager")>
<Assembly: AssemblyDescription("This is the main process that will look to see if any of the applications are running on the system. If they are it will launch the AppMonitor to gather the information from that process")>
<Assembly: AssemblyCompany("BurnSoft, www.burnsoft.net")>
<Assembly: AssemblyProduct("BurnSoft Application Profiler")>
<Assembly: AssemblyCopyright("Copyright © 2017-2019 BurnSoft, www.burnsoft.net")>
<Assembly: AssemblyTrademark("BurnSoft, www.burnsoft.net")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("cede9fc9-2e30-4cef-b8f9-2673694246e9")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.*")>
<Assembly: AssemblyFileVersion("1.0.0.12")>
|
Public Class ClassCidade
' Classe esta pronta e funcionando, "FAVOR NÃO AUTERAR SEM FALAR COMIGO" Ederson..
Private _Codigo_Cidade As Integer
Public Property Codigo_Cidade() As Integer
Get
Return _Codigo_Cidade
End Get
Set(ByVal value As Integer)
_Codigo_Cidade = value
End Set
End Property
Private _Nome As String
Public Property Nome() As String
Get
Return _Nome
End Get
Set(ByVal value As String)
If value.Trim() = "" Then
Throw New Exception("Valor inválido para parâmetro nome!")
End If
_Nome = value
End Set
End Property
Private _Estado As New ClassEstado
Public Property Estado() As ClassEstado
Get
Return _Estado
End Get
Set(ByVal value As ClassEstado)
_Estado = value
End Set
End Property
Public Overrides Function ToString() As String
Return Nome
End Function
End Class
|
Imports System
Imports System.IO
Imports System.Net
Imports System.Text
Imports System.Text.RegularExpressions
Imports CookComputing.XmlRpc
Public Class formStats
Private Sub formStats_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim proxy As ISapeXmlRpc = XmlRpcProxyGen.Create(Of ISapeXmlRpc)()
Dim userId As Integer = proxy.SapeLogin(formMain.txtUser.Text.Trim(), formMain.txtPass.Text.Trim())
If (userId > 0) Then
Try
Dim userInfo As UserInfo = proxy.SapeGetUser()
Dim sb As StringBuilder = New StringBuilder()
gbStats.Text = "Your Sape ID: (" + userId.ToString() + ")"
For Each s As System.Reflection.PropertyInfo In userInfo.GetType().GetProperties()
Dim stringReplaced As String = s.Name.Replace("_", " ")
sb.AppendLine(Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(stringReplaced) + ": (" + s.GetValue(userInfo, Nothing).ToString() + ")")
Next
txtBoxStats.Text = sb.ToString()
Catch ex As Exception
formMain.returnMessage("XML-RPC ERROR!" & vbCrLf & vbCrLf & ex.ToString)
End Try
End If
End Sub
Private Sub btnCloseStats_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Me.Close()
End Sub
Private Sub txtBoxStats_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtBoxStats.TextChanged
End Sub
End Class |
Imports Microsoft.VisualStudio.TestTools.UnitTesting
Imports ReportGenConnector
'''<summary>
'''This is a test class for TecITGenerTest and is intended
'''to contain all TecITGenerTest Unit Tests
'''</summary>
<TestClass()> _
Public Class TecITGenerTest
Private testContextInstance As TestContext
'''<summary>
'''Gets or sets the test context which provides
'''information about and functionality for the current test run.
'''</summary>
Public Property TestContext() As TestContext
Get
Return testContextInstance
End Get
Set(value As TestContext)
testContextInstance = Value
End Set
End Property
#Region "Additional test attributes"
'
'You can use the following additional attributes as you write your tests:
'
'Use ClassInitialize to run code before running the first test in the class
'<ClassInitialize()> _
'Public Shared Sub MyClassInitialize(ByVal testContext As TestContext)
'End Sub
'
'Use ClassCleanup to run code after all tests in a class have run
'<ClassCleanup()> _
'Public Shared Sub MyClassCleanup()
'End Sub
'
'Use TestInitialize to run code before running each test
'<TestInitialize()> _
'Public Sub MyTestInitialize()
'End Sub
'
'Use TestCleanup to run code after each test has run
'<TestCleanup()> _
'Public Sub MyTestCleanup()
'End Sub
'
#End Region
'''<summary>
'''A test for TecITGener Constructor
'''</summary>
<TestMethod()> _
Public Sub TecITGenerConstructorTest()
Dim license As TECITLicense = Nothing ' TODO: Initialize to an appropriate value
Dim target As TecITGener = New TecITGener(license)
Assert.Inconclusive("TODO: Implement code to verify target")
End Sub
'''<summary>
'''A test for Print
'''</summary>
<TestMethod()> _
Public Sub PrintTest()
Dim license As TECITLicense = New TECITLicense("1", "1", 1, TECIT.TFORMer.LicenseKind.Developer) ' TODO: Initialize to an appropriate value
Dim target As IReportGen = New TecITGener(license) ' TODO: Initialize to an appropriate value
Dim records As RecordSet = New RecordSet ' TODO: Initialize to an appropriate value
Dim config As ReportGenConfig = New ReportGenConfig With {.Printer = "Adobe PDF", _
.Template = _
"C:\Users\lenovo\Desktop\TecITTest\TecITTest\Label\1.tff"}
'HP Officejet 6500 E709n Series-WLAN
Dim rec As RecordData = New RecordData
rec.Add("HEADER_TNR", "T-000001")
rec.Add("header_knr", "42001123")
records.Add(rec)
Dim _record As RecordData
_record = New RecordData
_record.Add("nr1", "This is the value of the datafield1")
_record.Add("nr2", "set1")
_record.Add("nr3", "set2")
Dim _record1 As RecordData = New RecordData
_record1.Add("nr1", "This is the value of the datafield2")
_record1.Add("nr2", "set5")
_record1.Add("nr3", "set6")
records.Add(_record)
records.Add(_record1)
target.Print(records, config)
End Sub
End Class
|
' (c) Copyright Microsoft Corporation.
' This source is subject to the Microsoft Public License (Ms-PL).
' Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
' All other rights reserved.
''' <summary>
''' A Page that displays a variety of controls to which a frame can navigate.
''' </summary>
Public Class Page2
Inherits Page
''' <summary>
''' Initializes a Page2.
''' </summary>
Public Sub New()
InitializeComponent()
End Sub
End Class
|
Imports System.Data.SqlClient
Public Class IncidenciaDAO
Inherits DBConnection
Public Function Generar(ByVal incidencia As Incidencia) As Boolean
Dim command As New SqlCommand("GenerarIncidencia", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@Desc_Inciden", incidencia.Descripcion)
command.Parameters.AddWithValue("@Inicio_Inciden", incidencia.Inicio)
command.Parameters.AddWithValue("@Fin_Inciden", incidencia.Fin)
command.Parameters.AddWithValue("@ID_Solicitante", incidencia.IDSolicitante)
command.Parameters.AddWithValue("@Fecha_Solicitud", incidencia.FechaSolicitud)
command.Parameters.AddWithValue("@Motiv_Solicitud", incidencia.MotivoSolicitud)
connection.Open()
command.ExecuteNonQuery()
connection.Close()
Return True
End Function
Public Function Revisar(ByVal incidencia As Incidencia) As Boolean
Dim command As New SqlCommand("RevisarIncidencia", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@ID_Incidencia", incidencia.ID)
command.Parameters.AddWithValue("@ID_Gerente", incidencia.IDGerente)
command.Parameters.AddWithValue("@Fecha_Revision", incidencia.FechaRevision)
command.Parameters.AddWithValue("@Est_Autoriza", incidencia.Estado)
command.Parameters.AddWithValue("@Goce_Sueldo", incidencia.GoceSueldo)
connection.Open()
Command.ExecuteNonQuery()
connection.Close()
Return True
End Function
Public Function VerIncidencias(ByVal unauthorizedOnly As Boolean) As List(Of Incidencia)
Dim command As New SqlCommand("VerIncidencias", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@UnauthorizedOnly", unauthorizedOnly)
Dim incidencias As New List(Of Incidencia)
connection.Open()
Dim reader As SqlDataReader
reader = command.ExecuteReader()
While (reader.Read())
Dim incidencia As New Incidencia With {
.ID = reader.GetInt32(0),
.Descripcion = reader.GetString(1),
.Inicio = reader.GetDateTime(2),
.Fin = reader.GetDateTime(3),
.IDSolicitante = reader.GetInt32(4),
.FechaSolicitud = reader.GetDateTime(5),
.MotivoSolicitud = reader.GetString(6),
.IDGerente = GetIntSafe(reader, 7),
.FechaRevision = GetDateSafe(reader, 8),
.Estado = reader.GetByte(9),
.GoceSueldo = GetBooleanSafe(reader, 10)
}
incidencias.Add(incidencia)
End While
reader.Close()
connection.Close()
Return incidencias
End Function
Public Function VerificarVacaciones(ByVal idEmpleado As Integer, ByVal year As Integer) As Boolean
Dim result = False
Dim command As New SqlCommand("VerUltimasVacaciones", connection)
command.CommandType = CommandType.StoredProcedure
command.Parameters.AddWithValue("@ID_Empleado", idEmpleado)
connection.Open()
Dim reader As SqlDataReader
reader = command.ExecuteReader()
If reader.Read() Then
Dim fecha As New Date
fecha = GetDateSafe(reader, 0)
If fecha = Date.MinValue Or fecha.Year <> year Then
result = True
End If
End If
reader.Close()
connection.Close()
Return result
End Function
End Class
|
Public Class clsProfesor
Public Property Codigo As String
Public Property Nombre As String
Public Shared Function List(Jefe As Integer, Calendario As Integer) As List(Of clsProfesor)
clsSQL.AddParameter("@Jefe", Jefe)
clsSQL.AddParameter("@Calendario", Calendario)
Return clsSQL.List("SPQ_ProfesorDep", CommandType.StoredProcedure, "ConnectionString").toList(Of clsProfesor)()
End Function
End Class |
Imports System.ComponentModel
Imports System.IO
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports System.Data.Common
Imports Telerik.WinControls.UI
Imports Telerik.WinControls.Data
Imports Telerik.WinControls
Imports System.Data.OleDb
Public Class frmNuovaSchedaDaEsistente
#Region "Proprieta Classe Campi Classe"
Public Shared factory As New DatabaseProviderFactory()
Public Property _db As Database = factory.Create("dbSchedaLavoroBBGConnectionString")
Public Property RigaOrdNum As Nullable(Of Integer)
Public Property PezziOrdNum As Nullable(Of Integer)
#End Region
#Region "Eventi"
Private Sub CmdSalvaNuovaScheda_Click(sender As Object, e As EventArgs) Handles cmdSalvaNuovaScheda.Click
Dim result As DialogResult
Dim intSalvaTestataSchedaLavoroBusLayer As Nullable(Of Integer)
Dim intSalvaLavorazioniBuslayer As Nullable(Of Integer)
'Controlla Se l'ID è stato aggiornato
propNuovoIDPerSalvareDaEsistente = CType(txtIDSchedaLavoro.Text, Integer)
If propNuovoIDPerSalvareDaEsistente = propIdPerSalvaDaEsistente Then
MessageBox.Show("ATTENZIONE: Per favore prima di salvare devi aggiornare l'ID cliccando sul bottone Cambia ID Scheda")
Exit Sub
End If
Try
intSalvaTestataSchedaLavoroBusLayer = SalvaTestataSchedaLavoroBusLayer()
intSalvaLavorazioniBuslayer = SalvaLavorazioniBuslayer()
'Salva anche in tabella per stampa
SalvaSchedaInteraByIdIntestazioneStampa()
'Inserisce solo ID in tabella lavorazioni se il resto dei dati lavorazioni sono vuoti
If (Not intSalvaTestataSchedaLavoroBusLayer Is Nothing) Then
If (intSalvaLavorazioniBuslayer Is Nothing) Then
inserisciSoloIDLavorazioniSeVuote()
End If
result = MessageBox.Show("Scheda Lavorazione Inserita Con Successo", "Inserimento Scheda Lavorazioni in Database", MessageBoxButtons.OKCancel)
If result = DialogResult.Cancel Then
Exit Sub
Else
CommandBarLabelAvvisi.Text = "Scheda Pronta Per La Stampa."
End If
End If
Catch ex As Exception
MessageBox.Show("Errore Registrazione Scheda lavoro Da Esistente In Database :" & ex.Message)
End Try
End Sub
Public Sub SalvaSchedaInteraByIdIntestazioneStampa()
Dim ret As Nullable(Of Integer)
Try
Dim iDIntestazione As Integer = propNuovoIDPerSalvareDaEsistente
Dim numOrdine As String = txtCodiceOrdine.Text
Dim codiceArticolo As String = txtCodiceArticolo.Text
Dim dataConsegna As Date = Convert(dtpDataConsegna.Text)
Dim materiale As String = txtMateriale.Text
Dim rigaOrdNum As Integer = txtNumeroRiga.Text
Dim numPezzi As Integer = txtNumeroPezziOrd.Text
Dim NoteTestata As String = txtNote.Text
Dim fornitore As String = cmbFornitore.Text
Dim lotto As String = cmbLottoNum.Text
Dim lavorazioniBBG As String = txtLavorazioniBBG.Text
'Dim operatore As String = txtOperatore.Text
Dim trattamento As String = txtTrattamento.Text
Dim clienteTrattamento As String = txtClienteTrattamento.Text
Dim clienteVerniciatura As String = txtClienteVerniciatura.Text
Dim noteVerniciatura As String = txtNoteVernciatura.Text
Dim clienteHelicoil As String = txtClienteHelicolil.Text
Dim noteHelicoil As String = txtNoteHelicoil.Text
Dim altreLavorazioni As String = txtAltreLavorazioni.Text
Dim noteAltreLavorazioni As String = txtNoteAltreLavorazioni.Text
Dim boolFai As Boolean
If chkFAI.Checked = True Then
boolFai = True
Else
boolFai = False
End If
Dim boolKc As Boolean
If chkKC.Checked = True Then
boolKc = True
Else
boolKc = False
End If
ret = InsertSchedaInteraPerStampa(iDIntestazione, numOrdine, codiceArticolo, dataConsegna,
materiale, rigaOrdNum, numPezzi, NoteTestata, fornitore, lotto, lavorazioniBBG, PropStringOperatore, PropIntOperatore,
trattamento, clienteTrattamento, clienteVerniciatura, noteVerniciatura, clienteHelicoil, noteHelicoil,
altreLavorazioni, noteAltreLavorazioni, boolFai, boolKc)
If Not ret Is Nothing Then
CommandBarLabelAvvisi.Text = "Salvate Scheda Lavorazione e Scheda Per Stampa"
End If
Catch ex As Exception
MessageBox.Show("Errore SalvaSchedaInteraByIdIntestazioneStampa :" & ex.Message)
End Try
End Sub
Public Function InsertSchedaInteraPerStampa(ByVal iDIntestazione As Integer, ByVal numOrdine As String, ByVal codiceArticolo As String,
ByVal dataConsegna As Date, ByVal materiale As String, ByVal rigaOrdNum As Integer, ByVal numPezzi As Integer,
ByVal NoteTestata As String, ByVal fornitore As String, ByVal lotto As String, ByVal lavorazioniBBG As String, ByVal operatore As String, ByVal numeroOperatore As Integer,
ByVal trattamento As String, ByVal clienteTrattamento As String, ByVal clienteVerniciatura As String, ByVal noteVerniciatura As String,
ByVal clienteHelicoil As String, ByVal noteHelicoil As String, ByVal altreLavorazioni As String, ByVal noteAltreLavorazioni As String, ByVal boolFai As Boolean, ByVal boolKc As Boolean) As Integer
Dim insertCommand As DbCommand = Nothing
Dim rowsAffected As Integer
Dim dataShorth As Date = Convert(dataConsegna)
Try
insertCommand = _db.GetStoredProcCommand("spInsertQuerySchedaPerStampa")
_db.AddInParameter(insertCommand, "IDIntestazione", DbType.Int32, iDIntestazione)
_db.AddInParameter(insertCommand, "NumOrdine", DbType.String, numOrdine)
_db.AddInParameter(insertCommand, "CodArticolo", DbType.String, codiceArticolo)
_db.AddInParameter(insertCommand, "Data", DbType.Date, dataShorth)
_db.AddInParameter(insertCommand, "Materiale", DbType.String, materiale)
_db.AddInParameter(insertCommand, "RigaOrdNum", DbType.Int32, rigaOrdNum)
_db.AddInParameter(insertCommand, "NumPezzi", DbType.Int32, numPezzi)
_db.AddInParameter(insertCommand, "Note", DbType.String, NoteTestata)
_db.AddInParameter(insertCommand, "Fornitori", DbType.String, fornitore)
_db.AddInParameter(insertCommand, "Lotto", DbType.String, lotto)
_db.AddInParameter(insertCommand, "LavorazioneBBG", DbType.String, lavorazioniBBG)
_db.AddInParameter(insertCommand, "Operatore", DbType.String, operatore)
_db.AddInParameter(insertCommand, "NumOperatore", DbType.Int32, numeroOperatore)
_db.AddInParameter(insertCommand, "Trattamento", DbType.String, trattamento)
_db.AddInParameter(insertCommand, "ClienteTrattamento", DbType.String, clienteTrattamento)
_db.AddInParameter(insertCommand, "ClienteVerniciatura", DbType.String, clienteVerniciatura)
_db.AddInParameter(insertCommand, "NoteVerniciatura", DbType.String, noteVerniciatura)
_db.AddInParameter(insertCommand, "ClienteHelicoil", DbType.String, clienteHelicoil)
_db.AddInParameter(insertCommand, "NoteHelicoil", DbType.String, noteHelicoil)
_db.AddInParameter(insertCommand, "AltreLavorazioni", DbType.String, altreLavorazioni)
_db.AddInParameter(insertCommand, "NoteAltreLavorazioni", DbType.String, noteAltreLavorazioni)
_db.AddInParameter(insertCommand, "Fai", DbType.Boolean, boolFai)
_db.AddInParameter(insertCommand, "Kc", DbType.Boolean, boolKc)
rowsAffected = _db.ExecuteNonQuery(insertCommand)
Catch ex As Exception
MessageBox.Show("Errore InsertSchedaInteraPerStampa : " & ex.Message)
End Try
Return rowsAffected
End Function
Public Function SalvaLavorazioniBuslayer() As Integer
Dim retLavorazioni As Nullable(Of Integer)
Try
'ID
Dim iDIntestazione As Integer = propNuovoIDPerSalvareDaEsistente
Dim codArticolo As String = txtCodiceArticolo.Text
Dim lavorazioneBBG As String = txtLavorazioniBBG.Text
'Dim operatore As String = txtOperatore.Text
Dim trattamento As String = txtTrattamento.Text
Dim clienteTrattamento As String = txtClienteTrattamento.Text
Dim verniciatura As String = txtClienteVerniciatura.Text
Dim noteVerniciatura As String = txtNoteVernciatura.Text
Dim helicoil As String = txtClienteHelicolil.Text
Dim noteHelicoil As String = txtNoteHelicoil.Text
Dim altreEventualiLavorazioni As String = txtAltreLavorazioni.Text
Dim noteAltreEventualiLav As String = txtNoteAltreLavorazioni.Text
Dim boolFai As Boolean
If chkFAI.Checked = True Then
boolFai = True
Else
boolFai = False
End If
Dim boolKc As Boolean
If chkKC.Checked = True Then
boolKc = True
Else
boolKc = False
End If
retLavorazioni = InsertLavorazioniSchedaLavoro(iDIntestazione, codArticolo, lavorazioneBBG,
PropStringOperatore, PropIntOperatore, trattamento, clienteTrattamento,
verniciatura, noteVerniciatura,
helicoil, noteHelicoil, altreEventualiLavorazioni, noteAltreEventualiLav, boolFai, boolKc)
Catch ex As Exception
MessageBox.Show("Errore SalvaLavorazioni :" & ex.Message)
End Try
Return retLavorazioni
End Function
Public Function InsertLavorazioniSchedaLavoro(ByVal idIntestazioni As Integer, ByVal codiceArticolo As String, ByVal lavorazioneBBG As String,
ByVal operatore As String, ByVal numeroOperatore As Integer, ByVal trattamento As String,
ByVal clienteTrattamento As String, ByVal verniciatura As String,
ByVal noteVerniciatura As String, ByVal helicoil As String,
ByVal noteHelicoil As String, ByVal altreEventualiLavorazioni As String, ByVal noteAltreEventualiLav As String, ByVal boolFai As Boolean, ByVal boolKc As Boolean) As Integer
Dim insertCommandLavorazioniSchedaLavoro As DbCommand = Nothing
Dim rowsAffectedLavorazioniSchedaLavoro As Integer = Nothing
Try
insertCommandLavorazioniSchedaLavoro = _db.GetStoredProcCommand("spInsertQueryLavorazioni")
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "IdIntestazione", DbType.Int32, idIntestazioni)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "CodiceArticolo", DbType.String, codiceArticolo)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "LavorazioneBBG", DbType.String, lavorazioneBBG)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "Operatore", DbType.String, operatore)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "NumeroOperatore", DbType.Int32, numeroOperatore)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "Trattamento", DbType.String, trattamento)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "ClienteTrattamento", DbType.String, clienteTrattamento)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "ClienteVerniciatura", DbType.String, verniciatura)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "NoteVerniciatura", DbType.String, noteVerniciatura)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "ClienteHelicoil", DbType.String, helicoil)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "NoteHelicoil", DbType.String, noteHelicoil)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "AltreLavorazioni", DbType.String, altreEventualiLavorazioni)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "NoteAltreLavorazioni", DbType.String, noteAltreEventualiLav)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "Fai", DbType.Boolean, boolFai)
_db.AddInParameter(insertCommandLavorazioniSchedaLavoro, "Kc", DbType.Boolean, boolKc)
rowsAffectedLavorazioniSchedaLavoro = _db.ExecuteNonQuery(insertCommandLavorazioniSchedaLavoro)
Catch ex As Exception
MessageBox.Show("Errore InsertLavorazioniSchedaLavoro : " & ex.Message)
End Try
Return rowsAffectedLavorazioniSchedaLavoro
End Function
Public Function SalvaTestataSchedaLavoroBusLayer() As Integer
Dim retScheda As Nullable(Of Integer)
Dim intScheda As Nullable(Of Integer)
Dim intContatore As Integer = propNuovoIDPerSalvareDaEsistente
Dim iDIntestazione As Integer = intContatore
Dim data As Date = Convert(dtpDataConsegna.Text)
Dim codiceArticolo As String = txtCodiceArticolo.Text
Dim ordineArticolo As String = txtCodiceOrdine.Text
'Numero Pezzi e Numero Riga sono in evento validating
Dim pezziOrdNum As Integer = CType(Me.txtNumeroPezziOrd.Text, Integer)
Dim rigaOrdNum As Integer = CType(Me.txtNumeroRiga.Text, Integer)
Dim materiale As String = txtMateriale.Text
Dim noteTestata As String = txtNote.Text
Dim fornitori As String = cmbFornitore.Text
Dim lotto As String = cmbLottoNum.Text
Try
intScheda = InsertTestataSchedaLavoro(iDIntestazione, ordineArticolo, propCodiceArticolo, data, materiale, pezziOrdNum, rigaOrdNum, noteTestata, fornitori, lotto)
If Not intScheda Is Nothing Then
retScheda = intScheda
End If
Catch ex As Exception
MessageBox.Show("Errore SalvaTestataSchedaLavoroBusLayer :" & ex.Message)
End Try
Return retScheda
End Function
Public Function InsertTestataSchedaLavoro(ByVal idIntestazione As Integer,
ByVal ordineArticolo As String,
ByVal codiceArticolo As String,
ByVal data As Date, ByVal materiale As String,
ByVal numpezzi As Integer, ByVal rigaordnum As Integer,
ByVal noteTestata As String, ByVal fornitori As String, ByVal lotto As String) As Integer
Dim insertCommand As DbCommand = Nothing
Dim rowsAffected As Integer
Dim dataShorth As Date = Convert(data)
Try
insertCommand = _db.GetStoredProcCommand("spInsertQueryIntestazione")
_db.AddInParameter(insertCommand, "IDIntestazione", DbType.Int32, idIntestazione)
_db.AddInParameter(insertCommand, "NumOrdine", DbType.String, ordineArticolo)
_db.AddInParameter(insertCommand, "CodArticolo", DbType.String, codiceArticolo)
_db.AddInParameter(insertCommand, "Data", DbType.Date, data)
_db.AddInParameter(insertCommand, "Materiale", DbType.String, materiale)
_db.AddInParameter(insertCommand, "RigaOrdNum", DbType.Int32, rigaordnum)
_db.AddInParameter(insertCommand, "NumPezzi", DbType.Int32, numpezzi)
_db.AddInParameter(insertCommand, "Note", DbType.String, noteTestata)
_db.AddInParameter(insertCommand, "Fornitori", DbType.String, fornitori)
_db.AddInParameter(insertCommand, "Lotto", DbType.String, lotto)
rowsAffected = _db.ExecuteNonQuery(insertCommand)
Catch ex As Exception
MessageBox.Show("Errore insertTestataSchedaLavoro : " & ex.Message)
End Try
Return rowsAffected
End Function
Public Sub New()
' Chiamata richiesta dalla finestra di progettazione.
InitializeComponent()
Me.cmbLottoNum.AutoSizeDropDownToBestFit = True
Dim multiColumnComboElement As RadMultiColumnComboBoxElement = Me.cmbLottoNum.MultiColumnComboBoxElement
multiColumnComboElement.DropDownSizingMode = SizingMode.UpDownAndRightBottom
multiColumnComboElement.DropDownMinSize = New Size(550, 420)
multiColumnComboElement.EditorControl.MasterTemplate.AutoGenerateColumns = False
Me.cmbLottoNum.AutoFilter = True
Me.cmbLottoNum.DisplayMember = "txtCompleto"
Me.cmbLottoNum.ValueMember = "txtCompleto"
Dim filter As New FilterDescriptor()
filter.PropertyName = Me.cmbLottoNum.DisplayMember
filter.Operator = FilterOperator.Contains
Me.cmbLottoNum.EditorControl.MasterTemplate.FilterDescriptors.Add(filter)
Me.cmbLottoNum.DropDownStyle = RadDropDownStyle.DropDown
Dim gridViewControl As RadGridView = Me.cmbLottoNum.EditorControl
gridViewControl.EnableFiltering = True
gridViewControl.EnableAlternatingRowColor = True
gridViewControl.ShowFilteringRow = True
gridViewControl.ReadOnly = True
gridViewControl.SelectionMode = GridViewSelectionMode.FullRowSelect
gridViewControl.UseCompatibleTextRendering = True
gridViewControl.Focusable = True
gridViewControl.MasterTemplate.AutoGenerateColumns = False
gridViewControl.Columns.Add(New GridViewTextBoxColumn("materiale"))
gridViewControl.Columns("materiale").HeaderText = "Materiale"
gridViewControl.Columns.Add(New GridViewTextBoxColumn("numeroLotto"))
gridViewControl.Columns("numeroLotto").HeaderText = "Numero Lotto"
gridViewControl.Columns.Add(New GridViewTextBoxColumn("fornitore"))
gridViewControl.Columns("fornitore").HeaderText = "Fornitore"
gridViewControl.Columns.Add(New GridViewTextBoxColumn("numDDT"))
gridViewControl.Columns("numDDT").HeaderText = "Numero DDT"
gridViewControl.Columns.Add(New GridViewTextBoxColumn("txtCompleto"))
gridViewControl.Columns("txtCompleto").IsVisible = False
For Each column As GridViewDataColumn In Me.cmbLottoNum.MultiColumnComboBoxElement.Columns
column.BestFit()
Next column
AddHandler Me.cmbLottoNum.DropDownClosing, AddressOf DropDownClosing
End Sub
Private Sub DropDownClosing(sender As Object, args As Telerik.WinControls.UI.RadPopupClosingEventArgs)
If TypeOf sender Is RadMultiColumnComboBox Then
Dim rmc As RadMultiColumnComboBox = sender
If rmc.SelectedIndex > -1 Then
'se la messa a fuoco è su una riga, lascia il popup chiuso
'Console.WriteLine("clicked on: " & CStr(rmc.SelectedIndex))
Else
'altrimenti, controllare la posizione del mouse e non consentire la chiusura se all'interno dell'area della finestra popup
'Varibile con valori dei punti che delimitano il menu a tendina (Pop Up)
Dim pt As Point = rmc.EditorControl.TableElement.PointFromControl(MousePosition)
Dim popTop As Integer = rmc.MultiColumnComboBoxElement.MultiColumnPopupForm.Top
Dim popLft As Integer = rmc.MultiColumnComboBoxElement.MultiColumnPopupForm.Left
Dim popHt As Integer = rmc.MultiColumnComboBoxElement.MultiColumnPopupForm.Height
Dim popWd As Integer = rmc.MultiColumnComboBoxElement.MultiColumnPopupForm.Width
'Se
If pt.X >= popLft And pt.X <= popLft + popWd Then
If pt.Y >= popTop And pt.Y <= popTop + popHt Then
'--- dovrebbe fare clic all'interno della finestra, quindi lasciarlo aperto
args.Cancel = True
If rmc.EditorControl.ActiveEditor IsNot Nothing Then
Dim editor As RadTextBoxEditor = TryCast(rmc.EditorControl.ActiveEditor, RadTextBoxEditor)
If editor IsNot Nothing Then
Dim editorElement As RadTextBoxEditorElement = TryCast(editor.EditorElement, RadTextBoxEditorElement)
editorElement.Focus()
End If
End If
End If
End If
End If
End If
End Sub
Private Sub OnTextBoxItem_Click(ByVal sender As Object, ByVal e As EventArgs)
Me.cmbLottoNum.MultiColumnComboBoxElement.ShowPopup()
End Sub
Private Sub FrmNuovaSchedaDaEsistente_Load(sender As Object, e As EventArgs) Handles Me.Load
Try
gridViewDisegni.AutoGenerateColumns = False
Dim result As DialogResult
'Controlla se nella form schede salvate è stato selezionato un articolo
If propIdPerSalvaDaEsistente = 0 Then
result = MessageBox.Show("Prima devi selezionare un articolo!", "Errore selezione articolo", MessageBoxButtons.OK)
If result = Windows.Forms.DialogResult.OK Then
Me.Close()
End If
End If
'Popola Combo
RiempiComboMateriali()
PopolaComboLavorazioniBBG()
PopolaComboClientiTrattamento()
popolaComboVari("spGetClienteVerniciatura", txtClienteVerniciatura, "ClienteVerniciatura")
popolaComboVari("spGetClientiHelicoil", txtClienteHelicolil, "ClienteHelicoil")
popolaComboVari("spGetTrattamenti", txtTrattamento, "Trattamenti")
'popolaComboVari("spGetOperatoreCombo", txtOperatore, "Operatore")
RiempiComboOperatore()
'Popola campi dati testata e lavorazioni
getTestataByIdIntestazioneNew(propIdPerSalvaDaEsistente)
GetLavorazioniByIDIntestazioneNew(propIdPerSalvaDaEsistente)
CodArtPerDisegniNew = txtCodiceArticolo.Text
propNomeArticoloPerNomeDirRegNew = CodArtPerDisegniNew.Replace("/", "-")
Dim pathDisegniNew As String = propPathDisegniApprovati + propNomeArticoloPerNomeDirRegNew
propPathDirDisegnoNew = pathDisegniNew
popolaGriglia(propPathDirDisegnoNew)
cmbLottoNum.SelectedIndex = -1
RiempiComboFornitori()
Catch ex As Exception
MessageBox.Show("Errore Riempimento Combo :" & ex.Message)
End Try
End Sub
Public Sub RiempiComboOperatore()
Dim con As OleDbConnection
Dim cmd As OleDbCommand
Dim connectionstring As String = "Provider=SQLOLEDB;Data Source=UTENTEBBGSQL-PC\SQLEXPRESS;Initial Catalog=dbSchedaLavoroSviluppo;User Id=sa;Password=tito;"
'Dim connectionstring As String = "Provider=SQLOLEDB;Data Source=FABLENOVO;Initial Catalog=dbSchedaLavoroSviluppo;Integrated Security=SSPI"
Dim strSQL As String = "SELECT ID, DataInserimento, Operatore FROM tblOperatoreCombo"
Try
con = New OleDbConnection(connectionstring)
con.Open()
cmd = New OleDbCommand(strSQL, con)
Dim da As New OleDbDataAdapter(cmd)
Dim dt As New DataTable
da.Fill(dt)
Dim bs1 As New BindingSource()
bs1.DataSource = dt
Dim dr As DataRow = dt.NewRow
dr("ID") = 0
dt.Rows.InsertAt(dr, 0)
txtOperatore.DisplayMember = "Operatore"
txtOperatore.ValueMember = "ID"
txtOperatore.DataSource = bs1
txtOperatore.SelectedIndex = 0
Catch ex As Exception
MessageBox.Show("Errore RiempiComboOperatore: " & ex.Message)
End Try
End Sub
Private Sub TxtOperatore_SelectedIndexChanged(sender As Object, e As EventArgs) Handles txtOperatore.SelectedIndexChanged
PropStringOperatore = txtOperatore.Text
PropIntOperatore = CType(txtOperatore.SelectedValue, Integer)
txtNumOperatore.Text = CType(PropIntOperatore, String)
End Sub
Public Sub RiempiComboFornitori()
Dim cmdForn As DbCommand
Dim strSQLForn As String = "spSelezionaFornitoriTutto"
cmdForn = _db.GetStoredProcCommand(strSQLForn)
Using datareader As IDataReader = _db.ExecuteReader(cmdForn)
While datareader.Read
Me.cmbFornitore.Items.Add(datareader("NomeFornitore"))
End While
End Using
End Sub
Private Sub CmbFornitore_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbFornitore.SelectedIndexChanged
Dim selFornitore As String = CType(cmbFornitore.SelectedItem, String)
RiempiComboLottoByFornitore(selFornitore)
End Sub
Public Sub RiempiComboLottoByFornitore(ByVal strFornitore As String)
Dim cmd As DbCommand
Dim tb As New DataTable
Dim strSQL As String = "spColonnaConcatenataLotto"
cmd = _db.GetStoredProcCommand(strSQL)
_db.AddInParameter(cmd, "fornitore", DbType.String, strFornitore)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
tb.Load(datareader)
Me.cmbLottoNum.DataSource = tb
End Using
cmbLottoNum.EditorControl.CurrentRow = Nothing
End Sub
Public Sub ClearItemMultiColumnComboBox()
Dim rows As New List(Of GridViewRowInfo)(Me.cmbLottoNum.EditorControl.Rows)
For Each rowInfo As GridViewRowInfo In rows
rowInfo.Delete()
Next
End Sub
Private Sub CmdChiudiForm_Click(sender As Object, e As EventArgs) Handles cmdChiudiForm.Click
Close()
End Sub
Private Sub cmdCambiaIDScheda_Click(sender As Object, e As EventArgs) Handles cmdCambiaIDScheda.Click
Dim intContatoreCambia As Integer = contatoreNuovoID()
Me.txtIDSchedaLavoro.Text = intContatoreCambia
End Sub
#End Region
#Region "Contatore"
Public Function IDCorrente() As Integer
Dim i As Nullable(Of Integer)
Try
Dim strSQL As String = "SELECT MAX(IDIntestazione) AS IDIntestazione FROM tblIntestazione"
Dim cmd As DbCommand = _db.GetSqlStringCommand(strSQL)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
While datareader.Read
i = datareader("IDIntestazione")
End While
End Using
Catch ex As Exception
MessageBox.Show("Errore IDCorrente : " & ex.Message)
End Try
Return i
End Function
Public Function contatoreNuovoID() As Integer
Dim i As Nullable(Of Integer)
Try
Dim strSQL As String = "SELECT MAX(IDIntestazione) AS IDIntestazione FROM tblIntestazione"
Dim cmd As DbCommand = _db.GetSqlStringCommand(strSQL)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
While datareader.Read
If IsDBNull(datareader("IDIntestazione")) Then
i = 1
Else
i = datareader("IDIntestazione")
i = i + 1
End If
End While
End Using
Catch ex As Exception
MessageBox.Show("Errore contatore con ID + 1 : " & ex.Message)
End Try
Return i
End Function
Public Function contatore() As Integer
Dim i As Nullable(Of Integer)
Try
Dim strSQL As String = "SELECT MAX(IDIntestazione) AS IDIntestazione FROM tblIntestazione"
Dim cmd As DbCommand = _db.GetSqlStringCommand(strSQL)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
While datareader.Read
If IsDBNull(datareader("IDIntestazione")) Then
i = 1
Else
i = datareader("IDIntestazione")
End If
End While
End Using
Catch ex As Exception
MessageBox.Show("Errore contatore con ID + 1 : " & ex.Message)
End Try
Return i
End Function
Public Function inserisciSoloIDLavorazioniSeVuote() As Integer
Dim intContatoreLavorazioni As Integer = propIdPerSalvaDaEsistente
Dim CodiceArticoloDb As String = propCodiceArticoloNew
Dim IDIntestazione As Integer = intContatoreLavorazioni
Dim strCodiceArticolo As String = CodiceArticoloDb
Try
Dim retInsertLavorazioniSoloID As Nullable(Of Integer) = inserisciSoloIDLavorazioniDAL(IDIntestazione, strCodiceArticolo)
If Not retInsertLavorazioniSoloID Is Nothing Then
inserisciSoloIDLavorazioniSeVuote = retInsertLavorazioniSoloID
End If
Catch ex As Exception
MessageBox.Show("Errore inserisciSoloIDLavorazioniSeVuote : " & ex.Message)
End Try
Return inserisciSoloIDLavorazioniSeVuote
End Function
Public Function inserisciSoloIDLavorazioniDAL(ByVal idIntestazione As Integer, ByVal codArt As String) As Integer
Dim insertCommandLavorazioniSoloID As DbCommand = Nothing
Dim rowsAffected As Integer = Nothing
Try
insertCommandLavorazioniSoloID = _db.GetStoredProcCommand("spInsertQueryLavorazioniSoloID")
_db.AddInParameter(insertCommandLavorazioniSoloID, "IdIntestazione", DbType.Int32, idIntestazione)
_db.AddInParameter(insertCommandLavorazioniSoloID, "CodiceArticolo", DbType.String, codArt)
rowsAffected = _db.ExecuteNonQuery(insertCommandLavorazioniSoloID)
Catch ex As Exception
MessageBox.Show("Errore inserisciSoloIDLavorazioniDAL :" & ex.Message)
End Try
Return rowsAffected
End Function
#End Region
#Region "Popola Combo"
Public Sub popolaComboVari(ByVal strNomeSP As String, ByVal nomeControllo As ComboBox, ByVal nomeTab As String)
Dim cmdGen As DbCommand
Dim ctrlCombo As ComboBox = nomeControllo
cmdGen = _db.GetStoredProcCommand(strNomeSP)
Using datareader As IDataReader = _db.ExecuteReader(cmdGen)
While datareader.Read
ctrlCombo.Items.Add(datareader(nomeTab))
End While
End Using
End Sub
Public Sub PopolaComboLavorazioniBBG()
Dim cmdLav As DbCommand
Dim strSQLLavo As String = "getLavorBBG"
cmdLav = _db.GetStoredProcCommand(strSQLLavo)
Using datareader As IDataReader = _db.ExecuteReader(cmdLav)
While datareader.Read
Me.txtLavorazioniBBG.Items.Add(datareader("Lavorazioni"))
End While
End Using
End Sub
Public Sub PopolaComboClientiTrattamento()
Dim cmdCliTratt As DbCommand
Dim strSQLCliTratt As String = "GetClientiTrattamento"
cmdCliTratt = _db.GetStoredProcCommand(strSQLCliTratt)
Using datareader As IDataReader = _db.ExecuteReader(cmdCliTratt)
While datareader.Read
Me.txtClienteTrattamento.Items.Add(datareader("ClienteTrattamento"))
End While
End Using
End Sub
Public Sub RiempiComboMateriali()
Dim cmdMat As DbCommand
Dim strSQLMat As String = "getMateriali"
cmdMat = _db.GetStoredProcCommand(strSQLMat)
Using datareader As IDataReader = _db.ExecuteReader(cmdMat)
While datareader.Read
Me.txtMateriale.Items.Add(datareader("Materiale"))
End While
End Using
End Sub
#End Region
#Region "Carica Dati Testata e Lavorazioni By IDIntestazione"
Public Sub GetLavorazioniByIDIntestazioneNew(ByVal intIdIntestazione As Integer)
Dim cmd As DbCommand = _db.GetStoredProcCommand("spGetLavorazioniByIdIntestazioneNew")
Try
_db.AddInParameter(cmd, "IDIntestazione", DbType.Int32, intIdIntestazione)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
While datareader.Read
'IDIntestazione
propIdIntestazioneNew = CType(datareader("IDIntestazione"), Integer)
'LavorazioniBBG
If Not datareader("LavorazioneBBG").ToString Is Nothing Then
propLavorazioniBBGNew = datareader("LavorazioneBBG").ToString
txtLavorazioniBBG.SelectedItem = propLavorazioniBBGNew
Else
txtLavorazioniBBG.SelectedValue = -1
End If
'Operatore
If Not datareader("Operatore").ToString Is Nothing Then
propOperatoreNew = datareader("Operatore").ToString
txtOperatore.SelectedItem = propOperatoreNew
Else
txtOperatore.SelectedValue = -1
End If
'Trattamento
If Not datareader("Trattamento").ToString Is Nothing Then
propTrattamentoNew = datareader("Trattamento").ToString
txtTrattamento.SelectedItem = propTrattamentoNew
Else
txtTrattamento.SelectedValue = -1
End If
'ClienteTrattamento
If Not datareader("ClienteTrattamento").ToString Is Nothing Then
propClienteTrattamentoNew = datareader("ClienteTrattamento").ToString
txtClienteTrattamento.SelectedItem = propClienteTrattamentoNew
Else
txtClienteTrattamento.SelectedValue = -1
End If
'ClienteVerniciatura
If Not datareader("ClienteVerniciatura").ToString Is Nothing Then
propClienteVerniciaturaNew = datareader("ClienteVerniciatura").ToString
txtClienteVerniciatura.SelectedItem = propClienteVerniciaturaNew
Else
txtClienteVerniciatura.SelectedValue = -1
End If
'NoteVerniciatura
If Not datareader("NoteVerniciatura").ToString Is Nothing Then
propNoteVerniciaturaNew = datareader("NoteVerniciatura").ToString
txtNoteVernciatura.Text = propNoteVerniciaturaNew
Else
Me.txtNoteVernciatura.Text = ""
End If
'ClienteHelicoil
If Not datareader("ClienteHelicoil").ToString Is Nothing Then
propClienteHelicoilNew = datareader("ClienteHelicoil").ToString
txtClienteHelicolil.SelectedItem = propClienteHelicoilNew
Else
txtClienteHelicolil.SelectedValue = -1
End If
'NoteHelicoil
If Not datareader("NoteHelicoil").ToString Is Nothing Then
propNoteHelicoilNew = datareader("NoteHelicoil").ToString
txtNoteHelicoil.Text = propNoteHelicoilNew
Else
txtNoteHelicoil.Text = ""
End If
'AltreLavorazioni
If Not datareader("AltreLavorazioni").ToString Is Nothing Then
propAltreLavorazioniNew = datareader("AltreLavorazioni").ToString
txtAltreLavorazioni.Text = propAltreLavorazioniNew
Else
txtAltreLavorazioni.Text = ""
End If
'NoteAltreLavorazioni
If Not datareader("NoteAltreLavorazioni").ToString Is Nothing Then
propNoteAltreLavorazioniNew = datareader("NoteAltreLavorazioni").ToString
txtNoteAltreLavorazioni.Text = propNoteAltreLavorazioniNew
Else
txtNoteAltreLavorazioni.Text = ""
End If
'FAI
chkFAI.Checked = CType(datareader("Fai"), Boolean)
'KC
chkKC.Checked = CType(datareader("Kc"), Boolean)
End While
End Using
Catch ex As Exception
MessageBox.Show("Errore getLavorazioniByIDIntestazioneNew : " & ex.Message)
End Try
End Sub
Public Sub getTestataByIdIntestazioneNew(ByVal intIdItestazione As Integer)
Dim cmd As DbCommand = _db.GetStoredProcCommand("spGetIntestazioneByIDNew")
Try
_db.AddInParameter(cmd, "IDIntestazione", DbType.Int32, intIdItestazione)
Using datareader As IDataReader = _db.ExecuteReader(cmd)
While datareader.Read
'IDIntestazione
propIdIntestazioneNew = CType(datareader("IDIntestazione"), Integer)
txtIDSchedaLavoro.Text = CType(propIdIntestazioneNew, String)
'Data test report
propDataReportNew = Convert(datareader("Data").ToString)
dtpDataConsegna.Text = CType(propDataReportNew, String)
'Codice Articolo
propCodiceArticoloNew = datareader("CodArticolo").ToString
txtCodiceArticolo.Text = propCodiceArticoloNew
'Codice Ordine
propCodiceOrdineNew = datareader("NumOrdine").ToString
txtCodiceOrdine.Text = propCodiceOrdineNew
'Materiale
If Not datareader("Materiale").ToString Is Nothing Then
propMaterialeNew = datareader("Materiale").ToString
txtMateriale.SelectedItem = propMaterialeNew
Else
txtMateriale.SelectedText = ""
End If
'Riga Ordine
propRigaOrdineNumNew = CType(datareader("RigaOrdNum"), Integer)
txtNumeroRiga.Text = CType(propRigaOrdineNumNew, String)
'Numero Pezzi
propNumPezziNew = CType(datareader("NumPezzi"), Integer)
txtNumeroPezziOrd.Text = CType(propNumPezziNew, String)
'Note
propNoteNew = datareader("Note").ToString
Me.txtNote.Text = propNoteNew
End While
End Using
Catch ex As Exception
MessageBox.Show("Errore GetTestata : " & ex.Message)
End Try
End Sub
#End Region
#Region "Funzioni Utility"
Public Function Convert(ByVal value As Date) As Date
Dim DateValue As DateTime = CType(value, DateTime)
Return DateValue.ToShortDateString
End Function
Public Shared Function FindControlRecursive(ByVal list As List(Of Control), ByVal parent As Control, ByVal ctrlType As System.Type) As List(Of Control)
If parent Is Nothing Then Return list
If parent.GetType Is ctrlType Then
list.Add(parent)
End If
For Each child As Control In parent.Controls
FindControlRecursive(list, child, ctrlType)
Next
Return list
End Function
Private Function IsInputNumeric(input As String) As Boolean
If String.IsNullOrEmpty(input) Then
IsInputNumeric = True
End If
If Not IsNumeric(input) Then
IsInputNumeric = False
End If
If IsNumeric(input) Then
IsInputNumeric = True
End If
Return IsInputNumeric
End Function
Private Sub txtNumeroPezziOrd_Validating(sender As Object, e As CancelEventArgs) Handles txtNumeroPezziOrd.Validating
If IsInputNumeric(txtNumeroPezziOrd.Text) = True Then
If txtNumeroPezziOrd.TextLength = 0 Then
PezziOrdNum = 0
Else
PezziOrdNum = CType(Me.txtNumeroPezziOrd.Text, Integer)
End If
Else
PezziOrdNum = 0
MessageBox.Show("Per favore usare valori numerici per il numero riga o lasciarlo vuoto")
End If
End Sub
Private Sub txtNumeroRiga_Validating(sender As Object, e As CancelEventArgs) Handles txtNumeroRiga.Validating
If IsInputNumeric(txtNumeroRiga.Text) = True Then
If txtNumeroRiga.TextLength = 0 Then
RigaOrdNum = 0
Else
RigaOrdNum = CType(Me.txtNumeroRiga.Text, Integer)
End If
Else
RigaOrdNum = 0
MessageBox.Show("Per favore usare valori numerici per il numero riga o lasciarlo vuoto")
End If
End Sub
#End Region
#Region "Disegni"
Private Sub popolaGriglia(ByVal pathFile As String)
Try
Dim files As [String]() = Directory.GetFiles(pathFile)
Dim table As New DataTable()
table.Columns.Add("NomeFile")
table.Columns.Add("PercorsoFile")
For i As Integer = 0 To files.Length - 1
Dim file As New FileInfo(files(i))
table.Rows.Add(file.Name, file.FullName)
Next
gridViewDisegni.DataSource = table
Catch ex As ArgumentException
MessageBox.Show("Non Ci Sono Disegni Salvati Per Questo Articolo : " + ex.Message)
Catch ex As FileNotFoundException
MessageBox.Show("Non Ci Sono Disegni Salvati Per Questo Articolo : " + ex.Message)
Catch ex As DirectoryNotFoundException
MessageBox.Show("Non Ci Sono Disegni Salvati Per Questo Articolo : " + ex.Message)
End Try
End Sub
Private Sub gridViewDisegni_CellContentClick(sender As Object, e As DataGridViewCellEventArgs) Handles gridViewDisegni.CellContentClick
'Griglia Disegni
Dim senderGrid = DirectCast(sender, DataGridView)
Dim nomeFile As String
Dim strEstension As String
Dim pathCompleto As String
Try
If TypeOf senderGrid.Columns(e.ColumnIndex) Is DataGridViewButtonColumn AndAlso e.RowIndex >= 0 Then
'TODO - Button Clicked - Execute Code Here
nomeFile = CType(gridViewDisegni.CurrentRow.Cells(0).Value, String)
strEstension = Path.GetExtension(nomeFile)
pathCompleto = propPathDirDisegno + "\" + nomeFile
'Se il disegno è PDF apre il disegno
If strEstension = ".pdf" Then
Dim frmViewer As New FrmPDF(pathCompleto)
frmViewer.Show()
End If
'Se il disegno è ZIP apre la directory
If strEstension = ".zip" Then
Process.Start("explorer.exe", pathCompleto)
End If
End If
Catch ex As Exception
MessageBox.Show("Errore GridViewDisegni : " + ex.Message)
End Try
End Sub
Private Sub btnStampaScheda_Click(sender As Object, e As EventArgs) Handles btnStampaScheda.Click
CommandBarLabelAvvisi.Text = "PER FAVORE ATTENDERE LA COMPILAZIONE DEL REPORT STAMPA:La Stampa si avviera in pochi secondi."
If GetAndInsertPerStampa() = True Then
Dim frmStampa As New frmStampa
frmStampa.Show()
Else
CommandBarLabelAvvisi.Text = ""
Exit Sub
End If
CommandBarLabelAvvisi.Text = String.Empty
End Sub
Public Function GetAndInsertPerStampa() As Boolean
Try
'Controlla Se l'ID è stato aggiornato
propNuovoIDPerSalvareDaEsistente = CType(txtIDSchedaLavoro.Text, Integer)
If propNuovoIDPerSalvareDaEsistente = propIdPerSalvaDaEsistente Then
MessageBox.Show("ATTENZIONE: Per favore prima di Stampare devi aggiornare l'ID cliccando sul bottone Cambia ID Scheda !! E SALVARE LA NUOVA SCHEDA !!! ")
GetAndInsertPerStampa = False
Exit Function
Else
GetAndInsertPerStampa = True
propIdIntestazioneStampa = propNuovoIDPerSalvareDaEsistente
End If
Catch ex As Exception
MessageBox.Show("Errore GetAndInsertPerStampa :" & ex.Message)
End Try
Return GetAndInsertPerStampa
End Function
#End Region
End Class |
'---------------------------------------------
' EnumMetafile.vb (c) 2002 by Charles Petzold
'---------------------------------------------
Imports System
Imports System.Drawing
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Windows.Forms
Class EnumMetafile
Inherits Form
Private mf As Metafile
Private pnl As panel
Private txtbox As TextBox
Private strCaption As String
Private strwrite As StringWriter
Shared Sub Main()
Application.Run(New EnumMetafile())
End Sub
Sub New()
strCaption = "Enumerate Metafile"
Text = strCaption
' Create the text box for displaying records.
txtbox = New TextBox()
txtbox.Parent = Me
txtbox.Dock = DockStyle.Fill
txtbox.Multiline = True
txtbox.WordWrap = False
txtbox.ReadOnly = True
txtbox.TabStop = False
txtbox.ScrollBars = ScrollBars.Vertical
' Create the splitter between the panel and the text box.
Dim split As New Splitter()
split.Parent = Me
split.Dock = DockStyle.Left
' Create the panel for displaying the metafile.
pnl = New Panel()
pnl.Parent = Me
pnl.Dock = DockStyle.Left
AddHandler pnl.Paint, AddressOf PanelOnPaint
' Create the menu.
Menu = New MainMenu()
Menu.MenuItems.Add("&Open!", AddressOf MenuOpenOnClick)
End Sub
Private Sub MenuOpenOnClick(ByVal obj As Object, ByVal ea As EventArgs)
Dim dlg As New OpenFileDialog()
dlg.Filter = "All Metafiles|*.wmf;*.emf|" & _
"Windows Metafile (*.wmf)|*.wmf|" & _
"Enhanced Metafile (*.emf)|*.emf"
If dlg.ShowDialog() = DialogResult.OK Then
Try
mf = New Metafile(dlg.FileName)
Catch exc As Exception
MessageBox.Show(exc.Message, strCaption)
Return
End Try
Text = strCaption & " - " & Path.GetFileName(dlg.FileName)
pnl.Invalidate()
' Enumerate the metafile for the text box.
strwrite = New StringWriter()
Dim grfx As Graphics = CreateGraphics()
grfx.EnumerateMetafile(mf, New Point(0, 0), _
AddressOf EnumMetafileProc)
grfx.Dispose()
txtbox.Text = strwrite.ToString()
txtbox.SelectionLength = 0
End If
End Sub
Private Function EnumMetafileProc(ByVal eprt As EmfPlusRecordType, _
ByVal iFlags As Integer, ByVal iDataSize As Integer, _
ByVal ipData As IntPtr, _
ByVal prc As PlayRecordCallback) As Boolean
strwrite.Write("{0} ({1}, {2})", eprt, iFlags, iDataSize)
If iDataSize > 0 Then
Dim abyData(iDataSize) As Byte
Marshal.Copy(ipData, abyData, 0, iDataSize)
Dim by As Byte
For Each by In abyData
strwrite.Write(" {0:X2}", by)
Next by
End If
strwrite.WriteLine()
Return True
End Function
Private Sub PanelOnPaint(ByVal obj As Object, _
ByVal pea As PaintEventArgs)
Dim pnl As Panel = DirectCast(obj, Panel)
Dim grfx As Graphics = pea.Graphics
If Not mf Is Nothing Then
grfx.DrawImage(mf, 0, 0)
End If
End Sub
End Class
|
Public Class FormRechercheConcession
' Sert à retrouver une concession existante sur base d'infos fournies par le demandeur
Private ListeConcessions As SortableBindingList(Of Concession.InfosPourListe)
Private _csnSelect As Concession
Public ReadOnly Property CsnSelect As Concession
Get
Return _csnSelect
End Get
End Property
' à faire :
' - charger la liste des concessions
Private Sub FormRechercheConcession_Load(sender As Object, e As EventArgs) Handles MyBase.Load
LabFiltre.Text = ""
DgvConcessions.AutoGenerateColumns = False
ChargerListe()
End Sub
Private Sub TbChampRecherche_KeyDown(sender As Object, e As KeyEventArgs) Handles TbChampRecherche.KeyDown
If e.KeyCode = Keys.Enter Then
BtChercher_Click(BtChercher, Nothing)
e.Handled = True
End If
End Sub
Private Sub ChargerListe(Optional AvecExpirees As Boolean = False)
End Sub
Private Sub BtChercher_Click(sender As Object, e As EventArgs) Handles BtChercher.Click
Dim f = TbChampRecherche.Text.Trim
ListeConcessions.Filter = f
If f = "" Then
LabFiltre.Text = ""
Else
LabFiltre.Text = "Recherche : " & f
End If
End Sub
'' couleur différente aux concessions expirées
'Private Sub ColorLignes(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DgvConcessions.CellFormatting
' Dim larow As DataGridViewRow = DgvConcessions.Rows(e.RowIndex)
' Dim datefin As Date? = CType(larow.DataBoundItem, Concession.InfosPourListe).DateFin
' Dim expire As Boolean = datefin.HasValue AndAlso datefin < Today
' Dim impair As Boolean = e.RowIndex Mod 2 <> 0
' If expire Then
' If impair Then
' larow.DefaultCellStyle.BackColor = Color.FromArgb(212, 212, 212)
' larow.DefaultCellStyle.ForeColor = SystemColors.GrayText
' Else
' larow.DefaultCellStyle.BackColor = Color.FromArgb(222, 222, 222)
' larow.DefaultCellStyle.ForeColor = SystemColors.GrayText
' End If
' End If
'End Sub
Private Function FiltrerElement(elem As Object, f As String)
Dim celem = CType(elem, Concession.InfosPourListe)
Return UzineAGaz.ReduireString(String.Concat(celem.NomCsnr, celem.NomsBenefs, celem.NomsDefunts, celem.RefEmpl)).Contains(UzineAGaz.ReduireString(f))
End Function
Private Sub DgvConcessions_SelectionChanged(sender As Object, e As EventArgs) Handles DgvConcessions.SelectionChanged
If Not DgvConcessions.SelectedRows.Count > 0 Then
_csnSelect = Nothing
LabCsnrNom.Text = ""
LabCsnrDomicile.Text = ""
LabCsnrTel.Text = ""
LabCsnrDateNaiss.Text = ""
LabCsnrNoRegistre.Text = ""
LabRefEmplacement.Text = ""
LabDateDebut.Text = ""
LabDateFin.Text = ""
LabEmplPlaces.Text = ""
LabCommentaireCsn.Text = ""
FlpBeneficiaires.Controls.Clear()
FlpOccupants.Controls.Clear()
GbCommentaire.Visible = False
LabCommentaireCsn.Text = ""
Else
' affiche les infos
' Concessionnaire
With _csnSelect.Concessionnaire
LabCsnrNom.Text = .NomComplet
LabCsnrDomicile.Text = .AdresseComplete
LabCsnrTel.Text = .Tel
LabCsnrDateNaiss.Text = If(.DateNaiss.HasValue, .DateNaiss.Value.ToString("dd/MM/yyyy"), "")
LabCsnrNoRegistre.Text = If(.NoRegistre, "")
End With
' Cadre Emplacement
With _csnSelect.Emplacement
If _csnSelect.Emplacement IsNot Nothing Then LabRefEmplacement.Text = .Reference Else LabRefEmplacement.Text = "(Réf. emplacement non disponible)"
LabDateDebut.Text = If(_csnSelect.DateDebut.HasValue, "Depuis " & _csnSelect.DateDebut.Value.ToString("dd/MM/yyyy"), "")
LabDateFin.Text = If(_csnSelect.DateFin.HasValue, "Expire " & _csnSelect.DateFin.Value.ToString("dd/MM/yyyy"), "")
LabEmplPlaces.Text = If(_csnSelect.Emplacement IsNot Nothing AndAlso .NbPlaces.HasValue, "Places (en tout) : " & .NbPlaces, "") ' À FAIRE : décompter les places prises
LabCommentaireEmpl.Text = If(_csnSelect.Emplacement IsNot Nothing, .Commentaire, "")
End With
' Bénéficiaires
With _csnSelect.MentionsBenefs ' collection
FlpBeneficiaires.Controls.Clear() ' dispose ?
If Not .Count > 0 Then
FlpBeneficiaires.Controls.Add(New Label With {.Text = "Aucun bénéficiaire n'a été spécifié.", .AutoSize = True})
Else
For Each men In _csnSelect.MentionsBenefs
FlpBeneficiaires.Controls.Add(New Label With {.Text = men.Beneficiaire.NomComplet, .AutoSize = True})
Next
End If
End With
' Occupants
' de emplacement -> get défunts dont c'est le séjour actuel
If _csnSelect.Emplacement IsNot Nothing Then
FlpOccupants.Controls.Clear()
End If
' Commentaire
If _csnSelect.Commentaire <> "" Then
GbCommentaire.Visible = True
LabCommentaireCsn.Text = _csnSelect.Commentaire
Else
GbCommentaire.Visible = False
LabCommentaireCsn.Text = ""
End If
End If
End Sub
Private Sub BtMontrerExpirees_Click(sender As Object, e As EventArgs) Handles BtMontrerExpirees.Click
BtMontrerExpirees.Visible = False
Dim idconcselect As Integer? = If(DgvConcessions.SelectedRows.Count > 0, CType(DgvConcessions.SelectedRows(0).DataBoundItem, Concession.InfosPourListe).Id, Nothing)
ChargerListe(True)
If idconcselect IsNot Nothing Then
Dim rowselect = (From r As DataGridViewRow In DgvConcessions.Rows
Where r.DataBoundItem.id = idconcselect) _
.FirstOrDefault
If rowselect IsNot Nothing Then rowselect.Selected = True
End If
End Sub
Private Sub DgvConcessions_KeyDown(sender As Object, e As KeyEventArgs) Handles DgvConcessions.KeyDown
If e.KeyCode = Keys.Enter Then
DialogResult = DialogResult.OK
Me.Close()
e.Handled = True
End If
End Sub
Private Sub DgvConcessions_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DgvConcessions.CellDoubleClick
End Sub
Private Sub BtTermine_Click(sender As Object, e As EventArgs) Handles BtTermine.Click
DialogResult = DialogResult.OK
Me.Close()
End Sub
End Class |
''' <summary>
''' The screen ID and list of all rules associated with the screen
''' </summary>
''' <remarks></remarks>
Public Class ScreenRuleBO
Public Property TOCID As Integer
Public Property NavigateUrl As String
Public Property Rules As List(Of RuleBO)
End Class
|
Public Class StylePanel
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 Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents BtnSetZoom As System.Windows.Forms.Button
Friend WithEvents TextZoom As System.Windows.Forms.TextBox
Friend WithEvents ComboPageMode As System.Windows.Forms.ComboBox
Friend WithEvents CheckBoxToolbar As System.Windows.Forms.CheckBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents ComboBoxLayout As System.Windows.Forms.ComboBox
Friend WithEvents Label4 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.Label1 = New System.Windows.Forms.Label
Me.Label2 = New System.Windows.Forms.Label
Me.BtnSetZoom = New System.Windows.Forms.Button
Me.TextZoom = New System.Windows.Forms.TextBox
Me.ComboPageMode = New System.Windows.Forms.ComboBox
Me.CheckBoxToolbar = New System.Windows.Forms.CheckBox
Me.Label3 = New System.Windows.Forms.Label
Me.ComboBoxLayout = New System.Windows.Forms.ComboBox
Me.Label4 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 32)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(72, 16)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Page Mode"
'
'Label2
'
Me.Label2.Location = New System.Drawing.Point(48, 8)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(128, 16)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Show Toolbar"
'
'BtnSetZoom
'
Me.BtnSetZoom.Location = New System.Drawing.Point(8, 96)
Me.BtnSetZoom.Name = "BtnSetZoom"
Me.BtnSetZoom.Size = New System.Drawing.Size(72, 24)
Me.BtnSetZoom.TabIndex = 3
Me.BtnSetZoom.Text = "Set Zoom"
'
'TextZoom
'
Me.TextZoom.Location = New System.Drawing.Point(96, 96)
Me.TextZoom.Name = "TextZoom"
Me.TextZoom.Size = New System.Drawing.Size(48, 20)
Me.TextZoom.TabIndex = 5
Me.TextZoom.Text = "60"
'
'ComboPageMode
'
Me.ComboPageMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboPageMode.Items.AddRange(New Object() {"None", "Bookmarks", "Thumbs"})
Me.ComboPageMode.Location = New System.Drawing.Point(72, 32)
Me.ComboPageMode.Name = "ComboPageMode"
Me.ComboPageMode.Size = New System.Drawing.Size(96, 21)
Me.ComboPageMode.TabIndex = 6
'
'CheckBoxToolbar
'
Me.CheckBoxToolbar.Checked = True
Me.CheckBoxToolbar.CheckState = System.Windows.Forms.CheckState.Checked
Me.CheckBoxToolbar.Location = New System.Drawing.Point(16, 8)
Me.CheckBoxToolbar.Name = "CheckBoxToolbar"
Me.CheckBoxToolbar.Size = New System.Drawing.Size(16, 16)
Me.CheckBoxToolbar.TabIndex = 7
'
'Label3
'
Me.Label3.Location = New System.Drawing.Point(8, 64)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(40, 16)
Me.Label3.TabIndex = 8
Me.Label3.Text = "Layout"
'
'ComboBoxLayout
'
Me.ComboBoxLayout.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.ComboBoxLayout.Items.AddRange(New Object() {"Don't Care", "Single Page", "One Column", "Two Column Left", "Two Column Right"})
Me.ComboBoxLayout.Location = New System.Drawing.Point(72, 64)
Me.ComboBoxLayout.Name = "ComboBoxLayout"
Me.ComboBoxLayout.Size = New System.Drawing.Size(96, 21)
Me.ComboBoxLayout.TabIndex = 9
'
'Label4
'
Me.Label4.Location = New System.Drawing.Point(152, 96)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(16, 16)
Me.Label4.TabIndex = 10
Me.Label4.Text = "%"
'
'StylePanel
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(184, 126)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.ComboBoxLayout)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.CheckBoxToolbar)
Me.Controls.Add(Me.ComboPageMode)
Me.Controls.Add(Me.TextZoom)
Me.Controls.Add(Me.BtnSetZoom)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.MaximumSize = New System.Drawing.Size(192, 160)
Me.MinimumSize = New System.Drawing.Size(192, 160)
Me.Name = "StylePanel"
Me.Text = "Window Style"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private Sub ComboPageMode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboPageMode.SelectedIndexChanged
' set page mode: none, bookmark, thumbnail
AcrobatPDFWin.AcrobatPDFOCX.setPageMode(ComboPageMode.Text.ToLower())
End Sub
Private Sub BtnSetZoom_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnSetZoom.Click
' set zoom: n per cent
AcrobatPDFWin.AcrobatPDFOCX.setZoom(TextZoom.Text)
End Sub
Private Sub CheckBoxToolbar_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBoxToolbar.CheckedChanged
' show / hide toolbar
AcrobatPDFWin.AcrobatPDFOCX.setShowToolbar(CheckBoxToolbar.Checked)
End Sub
Private Sub ComboBoxLayout_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBoxLayout.SelectedIndexChanged
' set layout: one, two column, ...
Dim layout As String
If (String.Compare(ComboBoxLayout.Text, "Single Page") = 0) Then
layout = "singlepage"
ElseIf (String.Compare(ComboBoxLayout.Text, "One Column") = 0) Then
layout = "onecolumn"
ElseIf (String.Compare(ComboBoxLayout.Text, "Two Column Left") = 0) Then
layout = "twocolumnleft"
ElseIf (String.Compare(ComboBoxLayout.Text, "Two Column Right") = 0) Then
layout = "twocolumnright"
Else
layout = "dontcare"
End If
AcrobatPDFWin.AcrobatPDFOCX.setLayoutMode(layout)
End Sub
End Class
|
Partial Public Class FormTransaksiDetail
'## Components Availability Setter
Private Sub SetAvailableShopCartComponents_Jasa(switch As Boolean)
btnTambahJasa.Enabled = switch
btnTambahJasa.Visible = switch
End Sub
'## DataSet Manipulations
Private Sub IsiItemJasaDariNomorNota(noNota As String)
Try
'--Isi Jasa
Using dataTable = tableAdapterTransDetailJasa.GetDataByNoNota(noNota)
For Each row As DataRow In dataTable.Rows
With row
Dim kodeJasa As String = .Item("kode_jasa")
Dim namaItem As String = kodeJasa
Dim tglMulai As Object = .Item("tgl_mulai")
Dim tglSelesai As Object = .Item("tgl_selesai")
Dim totalHarga As Decimal = .Item("harga_jasa")
Dim diskon As Decimal = .Item("diskon")
If IsDBNull(tglMulai) Then
tglMulai = Nothing
End If
If IsDBNull(tglSelesai) Then
tglSelesai = Nothing
End If
Dim dtj As New DataSetBelanja.DetailItemJasaDataTable()
dtj.AddDetailItemJasaRow(tglMulai, tglSelesai)
Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(dtj)
Using tableAdapter As New DataSetBengkelTableAdapters.JASATableAdapter()
With tableAdapter.GetDataByKode(kodeJasa)
If .Rows.Count > 0 Then
namaItem = .Rows(0).Item("nama")
End If
End With
End Using
Me.DataSetBelanja.KeranjangBelanja.AddKeranjangBelanjaRow(kodeJasa, namaItem, "-", 0, totalHarga, totalHarga, False, json)
If diskon > 0 Then
Using obDlgDisc As DialogTransaksiItemBelanjaDiskon = BuatDialogItemDiskon()
'-- update pakai dialog itemdiskon dan apply secara otomatis
obDlgDisc.WindowState = FormWindowState.Minimized
obDlgDisc.SuspendLayout()
obDlgDisc.Size = New Size(0, 0)
obDlgDisc.Show()
obDlgDisc.tbKunci.Text = kodeJasa
obDlgDisc.ProsesFilter()
obDlgDisc.numDiscPercentage.Value = diskon
obDlgDisc.OK_Button.PerformClick()
GabungDataTabel(obDlgDisc.Output)
End Using
End If
End With
Next
End Using
Catch ex As Exception
Dim myParent = Me.ParentForm
Me.Close()
ShowExceptionMessage(myParent, ex)
Exit Sub
End Try
End Sub
'## Submission Processing
Private Sub Submit_Insert_Jasa(ByRef hasil As Integer, ByRef noNota As String)
Dim persenDiskon As Decimal
'-- Buat transaksi detail jasa
Dim rows = DataSetBelanja.KeranjangBelanja.Select("Kode LIKE " & String.Format("'{0}%'", Pengodean.Tabel.Tulisan.Jasa))
For Each row As DataSetBelanja.KeranjangBelanjaRow In rows
hasil = 0
With row
Dim rowsDiskon As DataSetBelanja.KeranjangBelanjaRow() = DataSetBelanja.KeranjangBelanja.Select("IsDiskonItem = TRUE AND Kode = " & String.Format("'{0}-{1}'", Pengodean.Tabel.Tulisan.ItemBelanjaDiskon, .Kode))
If rowsDiskon.Length > 0 Then
persenDiskon = rowsDiskon(0).Kuantitas
End If
Dim tglMulai As DateTime = Nothing, tglSelesai As DateTime = Nothing
Dim dataJasa = Newtonsoft.Json.JsonConvert.DeserializeObject(Of DataSetBelanja.DetailItemJasaDataTable)(.DataJSON)
If dataJasa.Rows.Count > 0 Then
With dataJasa.Rows(0)
tglMulai = .Item("tgl_mulai")
tglSelesai = .Item("tgl_selesai")
End With
End If
hasil = tableAdapterTransDetailJasa.RowInsert(noNota, .Kode, .TotalHarga, tglMulai, tglSelesai, persenDiskon)
If hasil <= 0 Then
Throw New DataException("Gagal mengisi data detail transaksi JASA.")
End If
End With
Next
End Sub
End Class
|
#Region "Microsoft.VisualBasic::bc05247afd57463bc6bc14952a6b580b, mzkit\src\metadb\Massbank\Public\NCBI\PubChem\Web\Query\WebResponse.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: 51
' Code Lines: 39
' Comment Lines: 5
' Blank Lines: 7
' File Size: 2.00 KB
' Class JsonQuery
'
' Properties: [where], collection, download, limit, order
' start
'
' Class [QueryWhere]
'
' Properties: ands
'
' Class QueryTableExport
'
' Properties: aids, annothitcnt, annothits, cid, cidcdate
' cmpdname, cmpdsynonym, complexity, dois, hbondacc
' hbonddonor, heavycnt, inchikey, iupacname, meshheadings
' mf, mw, polararea, rotbonds, xlogp
'
'
' /********************************************************************************/
#End Region
Imports Microsoft.VisualBasic.Data.csv.StorageProvider.Reflection
Namespace NCBI.PubChem
' {"download":"*","collection":"compound","where":{"ands":[{"*":"66-84-2"}]},"order":["relevancescore,desc"],"start":1,"limit":1000000}
' {"collection":"compound","download":"*","limit":10,"order":["relevancescore,desc"],"start":1,"where":{"ands":{"*":"650818-62-1"}}}
Public Class JsonQuery
Public Property download As String = "*"
Public Property collection As String = "compound"
Public Property [where] As QueryWhere
Public Property order As String() = {"relevancescore,desc"}
Public Property start As Integer = 1
Public Property limit As Integer = 10
End Class
Public Class [QueryWhere]
Public Property ands As Dictionary(Of String, String)()
End Class
''' <summary>
''' Table export result of <see cref="JsonQuery"/>
''' </summary>
Public Class QueryTableExport
Public Property cid As String
Public Property cmpdname As String
<Collection("cmpdsynonym", "|")>
Public Property cmpdsynonym As String()
Public Property mw As Double
Public Property mf As String
Public Property polararea As Double
Public Property complexity As Double
Public Property xlogp As String
Public Property heavycnt As Double
Public Property hbonddonor As Double
Public Property hbondacc As Double
Public Property rotbonds As Double
Public Property inchikey As String
Public Property iupacname As String
Public Property meshheadings As String
Public Property annothits As Double
Public Property annothitcnt As Double
<Collection("aids", ",")>
Public Property aids As String()
Public Property cidcdate As String
<Collection("dois", "|")>
Public Property dois As String()
End Class
End Namespace
|
Imports DCS.ProjectBase.Core
Namespace Domain
Public Class PosDevice
Inherits DomainObject(Of Long)
Private _serialNumber As String
Private _name As String
Private _enabled As Boolean
Private _pairCode As String
Private _deleted As Boolean
Private _computerId As Integer
Public Property Deleted() As Boolean
Get
Return _deleted
End Get
Set(ByVal value As Boolean)
_deleted = value
End Set
End Property
Public Property PairCode() As String
Get
Return _pairCode
End Get
Set(ByVal value As String)
_pairCode = value
End Set
End Property
Public Property Enabled() As Boolean
Get
Return _enabled
End Get
Set(ByVal value As Boolean)
_enabled = value
End Set
End Property
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Property SerialNumber() As String
Get
Return _serialNumber
End Get
Set(ByVal value As String)
_serialNumber = value
End Set
End Property
Public Property ComputerId As Integer
Get
Return _computerId
End Get
Set(value As Integer)
_computerid = value
End Set
End Property
Public ReadOnly Property IsPaired As Boolean
Get
Return (Not SerialNumber Is Nothing)
End Get
End Property
Public Overrides Function GetHashCode() As Integer
End Function
End Class
End Namespace
|
Imports LSW.Win32
Imports System.Runtime.InteropServices
Namespace Files
Public Class MFT
Private Const INVALID_HANDLE_VALUE = (-1)
Private Const GENERIC_READ = &H80000000
Private Const FILE_SHARE_READ = &H1
Private Const FILE_SHARE_WRITE = &H2
Private Const OPEN_EXISTING = 3
Private Const FILE_READ_ATTRIBUTES = &H80
Private Const FILE_NAME_IINFORMATION = 9
Private Const FILE_FLAG_BACKUP_SEMANTICS = &H2000000
Private Const FILE_OPEN_FOR_BACKUP_INTENT = &H4000
Private Const FILE_OPEN_BY_FILE_ID = &H2000
Private Const FILE_OPEN = &H1
Private Const OBJ_CASE_INSENSITIVE = &H40
Private Const FSCTL_ENUM_USN_DATA = &H900B3
<StructLayout(LayoutKind.Sequential)> _
Private Structure USN_RECORD
Dim RecordLength As Integer
Dim MajorVersion As Short
Dim MinorVersion As Short
Dim FileReferenceNumber As Long
Dim ParentFileReferenceNumber As Long
Dim Usn As Long
Dim TimeStamp As Long
Dim Reason As Integer
Dim SourceInfo As Integer
Dim SecurityId As Integer
Dim FileAttributes As FileAttribute
Dim FileNameLength As Short
Dim FileNameOffset As Short
End Structure
Private m_hCJ As IntPtr
Private m_Buffer As IntPtr
Private m_BufferSize As Integer
Private m_DriveLetter As String
Public Delegate Sub Progress_Delegate(sMessage As String)
Public Delegate Sub IsMatch_Delegate(sFileName As String, eAttributes As FileAttribute, ByRef bIsMatch As Boolean)
Public Delegate Sub FileFound_Delegate(sFileName As String, lSize As Long)
Private Class FSNode
Public FRN As Long
Public ParentFRN As Long
Public FileName As String
Public IsFile As Boolean
Sub New(lFRN As Long, lParentFSN As Long, sFileName As String, bIsFile As Boolean)
FRN = lFRN
ParentFRN = lParentFSN
FileName = sFileName
IsFile = bIsFile
End Sub
End Class
Private Function OpenVolume(ByVal szDriveLetter As String) As IntPtr
Dim hCJ As IntPtr '// volume handle
m_DriveLetter = szDriveLetter
hCJ = CreateFile("\\.\" & szDriveLetter, GENERIC_READ, _
FILE_SHARE_READ Or FILE_SHARE_WRITE, IntPtr.Zero, OPEN_EXISTING, 0, IntPtr.Zero)
Return hCJ
End Function
Private Sub Cleanup()
If m_hCJ <> 0 Then
' Close the volume handle.
CloseHandle(m_hCJ)
m_hCJ = INVALID_HANDLE_VALUE
End If
If m_Buffer <> 0 Then
' Free the allocated memory
Marshal.FreeHGlobal(m_Buffer)
m_Buffer = IntPtr.Zero
End If
End Sub
Public Sub FindAllFiles(ByVal szDriveLetter As String, fFileFound As FileFound_Delegate, fProgress As Progress_Delegate, fMatch As IsMatch_Delegate)
Dim usnRecord As USN_RECORD
Dim mft As MFT_ENUM_DATA
Dim dwRetBytes As Integer
Dim cb As Integer
Dim dicFRNLookup As New Dictionary(Of Long, FSNode)
Dim bIsFile As Boolean
' This shouldn't be called more than once.
If m_Buffer.ToInt32 <> 0 Then
Console.WriteLine("invalid buffer")
Exit Sub
End If
' progress
If Not IsNothing(fProgress) Then fProgress.Invoke("Building file list.")
' Assign buffer size
m_BufferSize = 65536 '64KB
' Allocate a buffer to use for reading records.
m_Buffer = Marshal.AllocHGlobal(m_BufferSize)
' correct path
szDriveLetter = szDriveLetter.TrimEnd("\"c)
' Open the volume handle
m_hCJ = OpenVolume(szDriveLetter)
' Check if the volume handle is valid.
If m_hCJ = INVALID_HANDLE_VALUE Then
Console.WriteLine("Couldn't open handle to the volume.")
Cleanup()
Exit Sub
End If
mft.StartFileReferenceNumber = 0
mft.LowUsn = 0
mft.HighUsn = Long.MaxValue
Do
If DeviceIoControl(m_hCJ, FSCTL_ENUM_USN_DATA, mft, Marshal.SizeOf(mft), m_Buffer, m_BufferSize, dwRetBytes, IntPtr.Zero) Then
cb = dwRetBytes
' Pointer to the first record
Dim pUsnRecord As New IntPtr(m_Buffer.ToInt32() + 8)
While (dwRetBytes > 8)
' Copy pointer to USN_RECORD structure.
usnRecord = Marshal.PtrToStructure(pUsnRecord, usnRecord.GetType)
' The filename within the USN_RECORD.
Dim FileName As String = Marshal.PtrToStringUni(New IntPtr(pUsnRecord.ToInt32() + usnRecord.FileNameOffset), usnRecord.FileNameLength / 2)
'If Not FileName.StartsWith("$") Then
' use a delegate to determine if this file even matches our criteria
Dim bIsMatch As Boolean = True
If Not IsNothing(fMatch) Then fMatch.Invoke(FileName, usnRecord.FileAttributes, bIsMatch)
If bIsMatch Then
bIsFile = Not usnRecord.FileAttributes.HasFlag(FileAttribute.Directory)
dicFRNLookup.Add(usnRecord.FileReferenceNumber, New FSNode(usnRecord.FileReferenceNumber, usnRecord.ParentFileReferenceNumber, FileName, bIsFile))
End If
'End If
' Pointer to the next record in the buffer.
pUsnRecord = New IntPtr(pUsnRecord.ToInt32() + usnRecord.RecordLength)
dwRetBytes -= usnRecord.RecordLength
End While
' The first 8 bytes is always the start of the next USN.
mft.StartFileReferenceNumber = Marshal.ReadInt64(m_Buffer, 0)
Else
Exit Do
End If
Loop Until cb <= 8
If Not IsNothing(fProgress) Then fProgress.Invoke("Parsing file names.")
' Resolve all paths for Files
For Each oFSNode As FSNode In dicFRNLookup.Values.Where(Function(o) o.IsFile)
Dim sFullPath As String = oFSNode.FileName
Dim oParentFSNode As FSNode = oFSNode
While dicFRNLookup.TryGetValue(oParentFSNode.ParentFRN, oParentFSNode)
sFullPath = String.Concat(oParentFSNode.FileName, "\", sFullPath)
End While
sFullPath = String.Concat(szDriveLetter, "\", sFullPath)
If Not IsNothing(fFileFound) Then fFileFound.Invoke(sFullPath, 0)
Next
'// cleanup
Cleanup()
If Not IsNothing(fProgress) Then fProgress.Invoke("Complete.")
End Sub
End Class
End Namespace |
Imports System.Runtime.InteropServices
Public Class IniStream
#Region " API "
<DllImport("kernel32", CharSet:=CharSet.Ansi)> _
Private Shared Function GetPrivateProfileString( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal lpDefault As String, _
ByVal lpReturnedString As System.Text.StringBuilder, _
ByVal nSize As Integer, ByVal lpFileName As String) As Integer
End Function
<DllImport("kernel32", CharSet:=CharSet.Ansi)> _
Private Shared Function WritePrivateProfileString( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal lpString As String, _
ByVal lpFileName As String) As Integer
End Function
<DllImport("kernel32", CharSet:=CharSet.Ansi)> _
Private Shared Function GetPrivateProfileInt( _
ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal nDefault As Integer, _
ByVal lpFileName As String) As Integer
End Function
<DllImport("kernel32", CharSet:=CharSet.Ansi)> _
Private Shared Function FlushPrivateProfileString( _
ByVal lpApplicationName As Integer, _
ByVal lpKeyName As Integer, ByVal lpString As Integer, _
ByVal lpFileName As String) As Integer
End Function
#End Region
#Region " MEMBER VARIABLES "
Dim m_fileName As String
#End Region
#Region " CONSTRUCTORS "
Public Sub New(ByVal FileName As String)
m_fileName = FileName
End Sub
#End Region
#Region " PROPERTIES "
ReadOnly Property FileName() As String
Get
Return m_fileName
End Get
End Property
#End Region
#Region " PUBLIC FUNCTIONS "
''' <summary>
''' Return a string value from a key in the ini file
''' </summary>
''' <param name="Section">The section that the key resides in</param>
''' <param name="Key">The key of the value</param>
''' <param name="Default">The default value if the key is not present</param>
''' <returns>The value of the specified key in the specified section.
''' If the key is not present, the default value is returned.</returns>
''' <remarks></remarks>
Public Function GetString(ByVal Section As String, ByVal Key As String, ByVal [Default] As String) As String
Dim charCount As Integer
Dim result As New System.Text.StringBuilder(256)
charCount = GetPrivateProfileString(Section, Key, [Default], result, result.Capacity, m_fileName)
If charCount > 0 Then
GetString = Left(result.ToString, charCount)
Else
GetString = ""
End If
End Function
''' <summary>
''' Return a string value from a key in the ini file
''' </summary>
''' <param name="Section">The section that the key resides in</param>
''' <param name="Key">The key of the value</param>
''' <param name="Default">The default value if the key is not present</param>
''' <returns>The value of the specified key in the specified section.
''' If the key is not present, the default value is returned.</returns>
''' <remarks></remarks>
Public Function GetInteger(ByVal Section As String, ByVal Key As String, ByVal [Default] As Integer) As Integer
Return GetPrivateProfileInt(Section, Key, [Default], m_fileName)
End Function
''' <summary>
''' Return a boolean value from a key in the ini file
''' </summary>
''' <param name="Section">The section that the key resides in</param>
''' <param name="Key">The key of the value</param>
''' <param name="Default">The default value if the key is not present</param>
''' <returns>The value of the specified key in the specified section.
''' If the key is not present, the default value is returned.</returns>
''' <remarks></remarks>
Public Function GetBoolean(ByVal Section As String, ByVal Key As String, ByVal [Default] As Boolean) As Boolean
Return CBool(GetPrivateProfileInt(Section, Key, CInt([Default]), m_fileName) = 1)
End Function
''' <summary>
''' Writes a string value to the specified key in the specified section
''' </summary>
''' <param name="Section">The section to write the key to</param>
''' <param name="Key">The key to write the value to</param>
''' <param name="Value">The string value</param>
''' <remarks></remarks>
Public Sub WriteString(ByVal Section As String, ByVal Key As String, ByVal Value As String)
WritePrivateProfileString(Section, Key, Value, m_fileName)
Flush()
End Sub
''' <summary>
''' Writes a integer value to the specified key in the specified section
''' </summary>
''' <param name="Section">The section to write the key to</param>
''' <param name="Key">The key to write the value to</param>
''' <param name="Value">The integer value</param>
''' <remarks></remarks>
Public Sub WriteInteger(ByVal Section As String, ByVal Key As String, ByVal Value As Integer)
WriteString(Section, Key, CStr(Value))
Flush()
End Sub
''' <summary>
''' Writes a boolean value to the specified key in the specified section
''' </summary>
''' <param name="Section">The section to write the key to</param>
''' <param name="Key">The key to write the value to</param>
''' <param name="Value">The boolean value</param>
''' <remarks></remarks>
Public Sub WriteBoolean(ByVal Section As String, ByVal Key As String, ByVal Value As Boolean)
WriteString(Section, Key, CStr(CInt(Value)))
Flush()
End Sub
''' <summary>
''' Determines whether a Name or Value exists.
''' </summary>
''' <param name="Name">
''' </param>
''' <param name="Section">
''' </param>
''' <returns>True if the Name/Value Exists, False otherwise.</returns>
''' <remarks></remarks>
Public Function NameExists(ByVal Section As String, ByVal Name As Object) As Boolean
Dim n As String = CType(Name, String)
If GetString(Section, n, "") = "" Then
Return False
Else
Return True
End If
End Function
''' <summary>
''' Deletes a section.
''' </summary>
''' <param name="Section">The section name to remove.</param>
''' <remarks></remarks>
Public Sub DeleteSection(ByVal Section As String)
'vbNullString
'WritePrivateProfileString "theName", Null, Null, "filePath"
WritePrivateProfileString(Section, CType(vbNullString, String), CType(vbNullString, String), m_fileName)
Flush()
End Sub
''' <summary>
''' Deletes a key fro mthe specified section.
''' </summary>
''' <param name="Section">The section name.</param>
''' <param name="Key">The key to remove.</param>
''' <remarks></remarks>
Public Sub DeleteKey(ByVal Section As String, ByVal Key As String)
WritePrivateProfileString(Section, Key, CType(vbNullString, String), m_fileName)
Flush()
End Sub
''' <summary>
''' Flushes the ini file
''' </summary>
''' <remarks></remarks>
Private Sub Flush()
'FlushPrivateProfileString(0, 0, 0, m_fileName)
End Sub
#End Region
End Class
|
'3.6
'Elaborar un algoritmo que lea un número N, que imprima la sumatoria de los cuadrados de los
'enteros entre 1 y N. Utilizar un método para el cálculo de la sumatoria vía parámetro por
'referencia.Utilizar un método para validar los valores ingresados sean enteros positivos, si no
'cumple esta condición pedir el reingreso del dato
Module Ej03_06
Sub main()
Dim N, suma As Integer
Do
Console.Write("Ingrese un entero no negativo: ")
N = Console.ReadLine()
Loop Until validar(N)
For i = 1 To N
Console.WriteLine("La sumatoria de los cuadrados hasta {0} es: {1}", i, sumaCuadrados(i, suma))
Next
Console.ReadKey()
End Sub
Private Function validar(valor As Integer) As Boolean
If valor >= 0 And Int(valor) = valor Then
Return True
Else
Return False
End If
End Function
Private Function sumaCuadrados(ByRef valor As Integer, ByRef suma As Integer) As Integer
suma = suma + Math.Pow(valor, 2)
Return suma
End Function
End Module
|
Imports StudentSection.DomainClasses
Namespace DataLayer
Public Interface ICoachRepository
Inherits IEntityRepository(Of Coach)
Function FindByUsername(UserName As String) As Coach
Function FindTeamInLeague(coachId As String, leagueId As Integer) As Team
End Interface
End Namespace
|
Imports System.Xml.Serialization
Imports System.Drawing
Imports System.Data
Imports System
Namespace Layout
Public Class LayoutItem
#Region "Field"
Private _Name As String
Private _x As String
Private _y As String
Private _width As String
Private _height As String
Private _PlugInName As String
Private _PlugInConfigName As String
Private _DataMapping As Data.DataMappingItem()
Private _PlugInConfig As Layout.SettingItem()
Private Dt As New DataTable
Private _ScreenSize As Size
#End Region
#Region "Property"
<XmlAttribute("Name")> _
Public Property Name() As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
<XmlAttribute("PlugIn_Name")> _
Public Property PlugInName() As String
Get
Return _PlugInName
End Get
Set(ByVal value As String)
_PlugInName = value
End Set
End Property
<XmlAttribute("X")> _
Public Property X() As String
Get
Return _x
End Get
Set(ByVal value As String)
_x = value
End Set
End Property
<XmlAttribute("Y")> _
Public Property Y() As String
Get
Return _y
End Get
Set(ByVal value As String)
_y = value
End Set
End Property
<XmlAttribute("Width")> _
Public Property Width() As String
Get
Return _width
End Get
Set(ByVal value As String)
_width = value
End Set
End Property
<XmlAttribute("Height")> _
Public Property Height() As String
Get
Return _height
End Get
Set(ByVal value As String)
_height = value
End Set
End Property
Public Property DataMapping() As Data.DataMappingItem()
Get
Return _DataMapping
End Get
Set(ByVal value As Data.DataMappingItem())
_DataMapping = value
End Set
End Property
Public Property PlugInConfig() As Layout.SettingItem()
Get
Return _PlugInConfig
End Get
Set(ByVal value As Layout.SettingItem())
_PlugInConfig = value
End Set
End Property
#End Region
#Region "Methods"
Public Sub SetScreenSize(ByVal osize As Size)
_ScreenSize = osize
End Sub
Private Function EvalSize(ByVal Value As String) As String
Dim Tval As String = Value
If _ScreenSize = Nothing Then
Throw New Exception("Need to set Sceen Height")
End If
Tval = Tval.ToUpper.Replace("[SCREENWIDTH]", _ScreenSize.Width)
Tval = Tval.ToUpper.Replace("[SCREENHEIGHT]", _ScreenSize.Height)
Tval = Tval.ToUpper.Replace("[SCREENMIN]", Math.Min(_ScreenSize.Height, _ScreenSize.Height))
Tval = Tval.ToUpper.Replace("[SCREENMAX]", Math.Max(_ScreenSize.Height, _ScreenSize.Height))
Return Tval
End Function
Public Function GetX() As Single
Dim result = Dt.Compute(EvalSize(_x), Nothing)
Return result
End Function
Public Function GetY() As Single
Dim result = Dt.Compute(EvalSize(_y), Nothing)
Return result
End Function
Public Function GetWidth() As Single
Dim result = Dt.Compute(EvalSize(_width), Nothing)
Return result
End Function
Public Function GetHeight() As Single
Dim result = Dt.Compute(EvalSize(_height), Nothing)
Return result
End Function
#End Region
#Region "Constructor"
Public Sub New(ByVal X As Single, ByVal Y As Single, ByVal Width As Single, ByVal Height As Single, ByVal Plugin As String, ByVal PluginConfig As Layout.SettingItem(), ByVal DataMapping As Data.DataMappingItem())
Me._x = X
Me._y = Y
Me._width = Width
Me._height = Height
Me._PlugInName = Plugin
Me.PlugInConfig = PluginConfig
Me._DataMapping = DataMapping
End Sub
Public Sub New()
End Sub
#End Region
End Class
End Namespace |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.