This commit is contained in:
32
API/VBCreatePart/AssemblyInfo.vb
Normal file
32
API/VBCreatePart/AssemblyInfo.vb
Normal file
@@ -0,0 +1,32 @@
|
||||
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("")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("")>
|
||||
<Assembly: AssemblyProduct("")>
|
||||
<Assembly: AssemblyCopyright("")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: CLSCompliant(True)>
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("8464C355-E7F6-4791-BE5A-341AE61848F1")>
|
||||
|
||||
' 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.0.0")>
|
||||
175
API/VBCreatePart/Form1.resx
Normal file
175
API/VBCreatePart/Form1.resx
Normal file
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 1.3
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">1.3</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1">this is my long string</data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
[base64 mime encoded serialized .NET Framework object]
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used forserialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="cbSuppliers.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="cbSuppliers.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="cbSuppliers.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="lblSupplier.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="lblSupplier.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="lblSupplier.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="edPartNumber.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="edPartNumber.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="edPartNumber.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="lblPartNumber.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="lblPartNumber.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="lblPartNumber.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnAdd.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="btnAdd.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="btnAdd.Modifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
<data name="$this.Locked" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Language" type="System.Globalization.CultureInfo, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>(Default)</value>
|
||||
</data>
|
||||
<data name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.Name">
|
||||
<value>Form1</value>
|
||||
</data>
|
||||
<data name="$this.Localizable" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.GridSize" type="System.Drawing.Size, System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>8, 8</value>
|
||||
</data>
|
||||
<data name="$this.DrawGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>True</value>
|
||||
</data>
|
||||
<data name="$this.TrayHeight" type="System.Int32, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>80</value>
|
||||
</data>
|
||||
<data name="$this.SnapToGrid" type="System.Boolean, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</data>
|
||||
<data name="$this.DefaultModifiers" type="System.CodeDom.MemberAttributes, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>Assembly</value>
|
||||
</data>
|
||||
</root>
|
||||
299
API/VBCreatePart/Form1.vb
Normal file
299
API/VBCreatePart/Form1.vb
Normal file
@@ -0,0 +1,299 @@
|
||||
'The AyaNova business object library
|
||||
Imports GZTW.AyaNova.BLL
|
||||
|
||||
'The following two imports are used only to process a login
|
||||
'Typically they will only be required for the form where you process the login
|
||||
'Once a user is logged in that is active until the application closes
|
||||
Imports CSLA.Security
|
||||
Imports System.Threading
|
||||
|
||||
|
||||
Public Class Form1
|
||||
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 cbSuppliers As System.Windows.Forms.ComboBox
|
||||
Friend WithEvents lblSupplier As System.Windows.Forms.Label
|
||||
Friend WithEvents edPartNumber As System.Windows.Forms.TextBox
|
||||
Friend WithEvents lblPartNumber As System.Windows.Forms.Label
|
||||
Friend WithEvents btnAdd As System.Windows.Forms.Button
|
||||
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
|
||||
Me.cbSuppliers = New System.Windows.Forms.ComboBox
|
||||
Me.lblSupplier = New System.Windows.Forms.Label
|
||||
Me.edPartNumber = New System.Windows.Forms.TextBox
|
||||
Me.lblPartNumber = New System.Windows.Forms.Label
|
||||
Me.btnAdd = New System.Windows.Forms.Button
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'cbSuppliers
|
||||
'
|
||||
Me.cbSuppliers.Location = New System.Drawing.Point(17, 45)
|
||||
Me.cbSuppliers.Name = "cbSuppliers"
|
||||
Me.cbSuppliers.Size = New System.Drawing.Size(292, 21)
|
||||
Me.cbSuppliers.Sorted = True
|
||||
Me.cbSuppliers.TabIndex = 0
|
||||
'
|
||||
'lblSupplier
|
||||
'
|
||||
Me.lblSupplier.Location = New System.Drawing.Point(17, 22)
|
||||
Me.lblSupplier.Name = "lblSupplier"
|
||||
Me.lblSupplier.Size = New System.Drawing.Size(292, 23)
|
||||
Me.lblSupplier.TabIndex = 1
|
||||
Me.lblSupplier.Text = "Supplier:"
|
||||
'
|
||||
'edPartNumber
|
||||
'
|
||||
Me.edPartNumber.Location = New System.Drawing.Point(17, 117)
|
||||
Me.edPartNumber.Name = "edPartNumber"
|
||||
Me.edPartNumber.Size = New System.Drawing.Size(292, 20)
|
||||
Me.edPartNumber.TabIndex = 2
|
||||
Me.edPartNumber.Text = ""
|
||||
'
|
||||
'lblPartNumber
|
||||
'
|
||||
Me.lblPartNumber.Location = New System.Drawing.Point(17, 89)
|
||||
Me.lblPartNumber.Name = "lblPartNumber"
|
||||
Me.lblPartNumber.Size = New System.Drawing.Size(292, 23)
|
||||
Me.lblPartNumber.TabIndex = 3
|
||||
Me.lblPartNumber.Text = "Part number:"
|
||||
'
|
||||
'btnAdd
|
||||
'
|
||||
Me.btnAdd.Location = New System.Drawing.Point(218, 194)
|
||||
Me.btnAdd.Name = "btnAdd"
|
||||
Me.btnAdd.TabIndex = 4
|
||||
Me.btnAdd.Text = "Add part"
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
|
||||
Me.ClientSize = New System.Drawing.Size(325, 237)
|
||||
Me.Controls.Add(Me.btnAdd)
|
||||
Me.Controls.Add(Me.lblPartNumber)
|
||||
Me.Controls.Add(Me.edPartNumber)
|
||||
Me.Controls.Add(Me.lblSupplier)
|
||||
Me.Controls.Add(Me.cbSuppliers)
|
||||
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
|
||||
Me.Name = "Form1"
|
||||
Me.Text = "Add part sample"
|
||||
Me.ResumeLayout(False)
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
|
||||
|
||||
'THIS IS AN EXAMPLE ONLY, YOU APPLICATION SHOULD IMPLEMENT
|
||||
'ERROR HANDLING AND RECOVERY AND CHECK FOR EXCEPTIONS
|
||||
|
||||
'The call to Initialize is always the first required in any
|
||||
'application working with AyaNova, it initializes the database
|
||||
'connection and business object framework
|
||||
|
||||
'IMPORTANT: If you receive an exception when calling the Initialize method it is most likely
|
||||
'a connection string problem in your application configuration file causing the
|
||||
'database provider to throw a not found exception. Or a problem with the configuration
|
||||
'file itself like it's missing or not configured properly.
|
||||
|
||||
'Remember that in the case of any exception using the AyaNova business object library
|
||||
'it is that exceptions Inner exception which is most likely the actual error (if present)
|
||||
'because AyaNova objects are invoked through a factory method which wraps any actual exception
|
||||
'generated by the business object inside a TargeInvocationException
|
||||
|
||||
GZTW.AyaNova.BLL.AyaBizUtils.Initialize()
|
||||
|
||||
'Once your application gets to this point right after Initialize without error
|
||||
'you can be assured that you have a clean configuration file and a connection
|
||||
'to the database and are ready to log in
|
||||
|
||||
'this is the default AyaNova trial login and password
|
||||
'and this is how you login to AyaNova
|
||||
'typically you would, of course, use a dialog and prompt
|
||||
'the user for the login and password
|
||||
AyaBizUtils.Login("manager", "letmein")
|
||||
|
||||
'if a login fails no operations can take place with AyaNova
|
||||
'so let's confirm the login was sucessful:
|
||||
|
||||
If Thread.CurrentPrincipal.Identity.IsAuthenticated.Equals(False) Then
|
||||
'Nope, they are not authenticated so
|
||||
'show and error and bail out
|
||||
'Or more typically re-prompt to login
|
||||
MessageBox.Show("Login failed")
|
||||
Application.Exit()
|
||||
Return
|
||||
End If
|
||||
|
||||
'At this point the user is logged in and
|
||||
'you can now work with any AyaNova business objects that
|
||||
'the login account used above has rights to.
|
||||
|
||||
'Logging OUT: There is technically no need to logout
|
||||
|
||||
|
||||
'Let's just make sure the database hasn't expired,
|
||||
'an expired AyaNova database is read only so
|
||||
'the example code will not work if that's true.
|
||||
|
||||
'AyaBizUtils handles all manner of general operations
|
||||
'that aren't related to a particular object
|
||||
If AyaBizUtils.Expired Then
|
||||
MessageBox.Show("Sorry the AyaNova database has an expired license: " & AyaBizUtils.ExpiryDate.ToString())
|
||||
Application.Exit()
|
||||
Return
|
||||
End If
|
||||
|
||||
'Populate the list of vendors
|
||||
'It's not absolutely necessary to set a vendor when creating
|
||||
'a part, only the Number field is mandatory, but it will
|
||||
'show how to work with a pick list
|
||||
PopulateVendorList()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'Populate the list of vendors on the main form
|
||||
'using an AyaNova read only collection object
|
||||
Private Sub PopulateVendorList()
|
||||
|
||||
'Declare a VendorPick list and retrieve it from the database:
|
||||
Dim vendorlist As VendorPickList = VendorPickList.GetList()
|
||||
|
||||
'Declare an info object to contain each item in the list
|
||||
'temporarily as it's iterated over in the For each loop below
|
||||
Dim vendorInfo As VendorPickList.VendorPickListInfo
|
||||
|
||||
'Tell the combo to use the Name field for displaying
|
||||
Me.cbSuppliers.DisplayMember = "Name"
|
||||
|
||||
'Tell the combo to use the ID field for the actual value
|
||||
Me.cbSuppliers.ValueMember = "ID"
|
||||
|
||||
'Iterate over the list of vendors
|
||||
'and add each active one that is a wholesaler to the combo box
|
||||
For Each vendorInfo In vendorlist
|
||||
|
||||
If vendorInfo.Active = True And vendorInfo.VendorType = VendorTypes.Wholesaler Then
|
||||
Me.cbSuppliers.Items.Add(vendorInfo)
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
'Create a new part in the AyaNova database based
|
||||
'on the users selection of Wholesaler (supplier) and
|
||||
'the part number
|
||||
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
|
||||
|
||||
'A guid value to hold the selected supplier's ID value
|
||||
Dim vendorInfo As VendorPickList.VendorPickListInfo
|
||||
|
||||
'A Part object
|
||||
Dim p As Part
|
||||
|
||||
'Create a new part object
|
||||
'Note that it's not saved to database until the save method is called
|
||||
'so it's in memory only for now.
|
||||
'when you call newitem an ID is automatically generated for the new object
|
||||
p = Part.NewItem()
|
||||
|
||||
'Let's save the ID of the new part so we can retrieve it later to prove
|
||||
'that it was really saved to the database:
|
||||
Dim NewPartID As Guid
|
||||
NewPartID = p.ID
|
||||
|
||||
|
||||
'Set the required part number field
|
||||
p.PartNumber = Me.edPartNumber.Text
|
||||
|
||||
'Let's set some other values to just for the heck of it
|
||||
p.Retail = 19.95
|
||||
p.Cost = 10.5
|
||||
p.Notes = "This part was created using the API sample VBCreatepart"
|
||||
|
||||
|
||||
|
||||
'At this point we can just save it, all that is absolutely required
|
||||
'is the part number, but let's set it's wholesaler to the selected value
|
||||
'in the combo box
|
||||
|
||||
'Get the selected vendorInfo object if present
|
||||
If Me.cbSuppliers.SelectedItem Is Nothing Then
|
||||
p.WholesalerID = Guid.Empty
|
||||
|
||||
Else
|
||||
p.WholesalerID = CType(Me.cbSuppliers.SelectedItem(), VendorPickList.VendorPickListInfo).ID
|
||||
|
||||
End If
|
||||
|
||||
'Lets make sure the part can be saved and is valid
|
||||
'Each business object implements it's own business rules
|
||||
'and decides if an object is valid or not and will not let an
|
||||
'object be saved if it's not valid.
|
||||
|
||||
'to test this out try leaving the part number out and saving the part
|
||||
'(note that the message you get is a localized text string which will be covered in other examples)
|
||||
If Not p.IsSavable Then
|
||||
MessageBox.Show("The part is not valid and can't be saved" & vbCrLf & "It has one or more broken rules:" & vbCrLf & vbCrLf & p.GetBrokenRulesString())
|
||||
Return
|
||||
End If
|
||||
|
||||
'Now save the part to the database
|
||||
p.Save()
|
||||
|
||||
'Note that save always returns an object when called
|
||||
'the object returned is the new and valid object and the original,
|
||||
'once saved is no longer valid.
|
||||
'This means that if you wanted to continue to work with the part object
|
||||
'as in the example above you would call the save method like this instead:
|
||||
'p = CType(p.Save(), Part)
|
||||
'In any case where you want to save an AyaNova object but keep working with it remember that
|
||||
'you will need to set the variable you use for that object by casting the returned object
|
||||
'from the save method to that type of object
|
||||
|
||||
'lets show that it worked:
|
||||
Dim MyPart As Part
|
||||
MyPart = Part.GetItem(NewPartID)
|
||||
|
||||
MessageBox.Show("Part " & MyPart.PartNumber & " created sucessfully @ " & MyPart.Created.ToString())
|
||||
|
||||
|
||||
'If you run AyaNova now pointed to the same database used for this example
|
||||
'you will see and be able to use the new part you just created
|
||||
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
11
API/VBCreatePart/VBCreatePart.exe.manifest
Normal file
11
API/VBCreatePart/VBCreatePart.exe.manifest
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
|
||||
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="VBCreatePart" type="win32" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
<requestedPrivileges>
|
||||
<requestedExecutionLevel level="asInvoker" />
|
||||
</requestedPrivileges>
|
||||
</security>
|
||||
</trustInfo>
|
||||
</assembly>
|
||||
19
API/VBCreatePart/VBCreatePart.sln
Normal file
19
API/VBCreatePart/VBCreatePart.sln
Normal file
@@ -0,0 +1,19 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 10.00
|
||||
# Visual Studio 2008
|
||||
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "VBCreatePart", "VBCreatePart.vbproj", "{202D4449-603B-4777-87C9-E89D666761BF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{202D4449-603B-4777-87C9-E89D666761BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{202D4449-603B-4777-87C9-E89D666761BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{202D4449-603B-4777-87C9-E89D666761BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{202D4449-603B-4777-87C9-E89D666761BF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
API/VBCreatePart/VBCreatePart.suo
Normal file
BIN
API/VBCreatePart/VBCreatePart.suo
Normal file
Binary file not shown.
153
API/VBCreatePart/VBCreatePart.vbproj
Normal file
153
API/VBCreatePart/VBCreatePart.vbproj
Normal file
@@ -0,0 +1,153 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{202D4449-603B-4777-87C9-E89D666761BF}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>VBCreatePart</AssemblyName>
|
||||
<AssemblyOriginatorKeyFile>
|
||||
</AssemblyOriginatorKeyFile>
|
||||
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
|
||||
<DefaultClientScript>JScript</DefaultClientScript>
|
||||
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<RootNamespace>VBCreatePart</RootNamespace>
|
||||
<StartupObject>VBCreatePart.Form1</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<MyType>WindowsFormsWithCustomSubMain</MyType>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<OldToolsVersion>2.0</OldToolsVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>VBCreatePart.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<Optimize>false</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>full</DebugType>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>VBCreatePart.xml</DocumentationFile>
|
||||
<BaseAddress>285212672</BaseAddress>
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>
|
||||
</DefineConstants>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<RegisterForComInterop>false</RegisterForComInterop>
|
||||
<RemoveIntegerChecks>false</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningLevel>1</WarningLevel>
|
||||
<NoWarn>42016,42017,42018,42019,42032</NoWarn>
|
||||
<DebugType>none</DebugType>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="CSLA, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\CSLA.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CSLA.Core.Bindablebase, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\CSLA.Core.Bindablebase.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CSLA.Server.DataPortal, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\CSLA.Server.DataPortal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="CSLA.Server.ServicedDataPortal, Version=1.3.0.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\CSLA.Server.ServicedDataPortal.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GZTW.AyaNova.BLL, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\GZTW.AyaNova.BLL.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GZTW.Data, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\GZTW.Data.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="GZTW.Profile, Version=4.0.1.0, Culture=neutral, PublicKeyToken=df66a8d8e49833d3, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Program Files\Ground Zero Tech-Works Inc\AyaNova\GZTW.Profile.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Name>System</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Name>System.Data</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing">
|
||||
<Name>System.Drawing</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms">
|
||||
<Name>System.Windows.Forms</Name>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Name>System.XML</Name>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Data" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Drawing" />
|
||||
<Import Include="System.Windows.Forms" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.vb">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.vb</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="VBCreatePart.exe.manifest">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
57
API/VBCreatePart/VBCreatePart.vbproj.user
Normal file
57
API/VBCreatePart/VBCreatePart.vbproj.user
Normal file
@@ -0,0 +1,57 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<LastOpenVersion>7.10.3077</LastOpenVersion>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ReferencePath>C:\data\AyaNova 3.1\API\AyaNova3_1\</ReferencePath>
|
||||
<CopyProjectDestinationFolder>
|
||||
</CopyProjectDestinationFolder>
|
||||
<CopyProjectUncPath>
|
||||
</CopyProjectUncPath>
|
||||
<CopyProjectOption>0</CopyProjectOption>
|
||||
<ProjectView>ProjectFiles</ProjectView>
|
||||
<ProjectTrust>0</ProjectTrust>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<EnableASPDebugging>false</EnableASPDebugging>
|
||||
<EnableASPXDebugging>false</EnableASPXDebugging>
|
||||
<EnableUnmanagedDebugging>false</EnableUnmanagedDebugging>
|
||||
<EnableSQLServerDebugging>false</EnableSQLServerDebugging>
|
||||
<RemoteDebugEnabled>false</RemoteDebugEnabled>
|
||||
<RemoteDebugMachine>
|
||||
</RemoteDebugMachine>
|
||||
<StartAction>Project</StartAction>
|
||||
<StartArguments>
|
||||
</StartArguments>
|
||||
<StartPage>
|
||||
</StartPage>
|
||||
<StartProgram>
|
||||
</StartProgram>
|
||||
<StartURL>
|
||||
</StartURL>
|
||||
<StartWorkingDirectory>
|
||||
</StartWorkingDirectory>
|
||||
<StartWithIE>false</StartWithIE>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
7
API/VBCreatePart/bin/config.txt
Normal file
7
API/VBCreatePart/bin/config.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<!-- Use the embedded Firebird database -->
|
||||
<ConnectionType>DataBase</ConnectionType>
|
||||
<DataBaseType>FireBird</DataBaseType>
|
||||
<DataBaseConnectionString>ServerType=1;DataBase=%AllUsersProfile%\AyaNovaData\AYANOVA.FDB;Dialect=3;</DataBaseConnectionString>
|
||||
</configuration>
|
||||
BIN
API/VBCreatePart/bin/fbembed.dll
Normal file
BIN
API/VBCreatePart/bin/fbembed.dll
Normal file
Binary file not shown.
BIN
API/VBCreatePart/bin/firebird.msg
Normal file
BIN
API/VBCreatePart/bin/firebird.msg
Normal file
Binary file not shown.
BIN
API/VBCreatePart/bin/icudt30.dll
Normal file
BIN
API/VBCreatePart/bin/icudt30.dll
Normal file
Binary file not shown.
BIN
API/VBCreatePart/bin/icuin30.dll
Normal file
BIN
API/VBCreatePart/bin/icuin30.dll
Normal file
Binary file not shown.
BIN
API/VBCreatePart/bin/icuuc30.dll
Normal file
BIN
API/VBCreatePart/bin/icuuc30.dll
Normal file
Binary file not shown.
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.Form1.resources
Normal file
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.Form1.resources
Normal file
Binary file not shown.
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.exe
Normal file
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.exe
Normal file
Binary file not shown.
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.pdb
Normal file
BIN
API/VBCreatePart/obj/Debug/VBCreatePart.pdb
Normal file
Binary file not shown.
Reference in New Issue
Block a user