Microsoft Dynamics Forums Homepage

Forum Home Forum Home > Microsoft Dynamics SL (Solomon) > SL - Customization and Integration
  New Posts New Posts RSS Feed - SOM sample Applications
  FAQ FAQ  Forum Search   Register Register  Login Login


SOM sample Applications

 Post Reply Post Reply Page  12>
Author
Message
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Topic: SOM sample Applications
    Posted: September 15 2006 at 1:36pm

I am automating Solomon for the first time and i would like to get some sample applications to look at. I have a documentation that explains about how the Solomon Object model works. I would like some sample applications.

I am taking some data from a CSV file and importing them to solomon via the sales order screen. I would really appreciate some help.
 
thanks.
Back to Top
Sponsored Links


Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: September 15 2006 at 1:40pm

oh, i am using VB.Net 2005 to write the codes, but codes in any langage will be apprecaited. I just want a look at the logic.

thanks
Back to Top
Rohtash Kapoor View Drop Down
MicrosoftDynamicsForums.com Moderator
MicrosoftDynamicsForums.com Moderator


Joined: July 06 2005
Location: United States
Status: Offline
Points: 655
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rohtash Kapoor Quote  Post ReplyReply Direct Link To This Post Posted: September 16 2006 at 9:01am
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: September 25 2006 at 4:47pm
I found some good examples in the odject model folder that is on cd1 od solomon 6.0.
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 09 2006 at 2:30pm
I have completed my appliction and it is now working flawlessly. samples of the code can be produced upon request.
Back to Top
Rohtash Kapoor View Drop Down
MicrosoftDynamicsForums.com Moderator
MicrosoftDynamicsForums.com Moderator


Joined: July 06 2005
Location: United States
Status: Offline
Points: 655
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rohtash Kapoor Quote  Post ReplyReply Direct Link To This Post Posted: October 09 2006 at 3:49pm
You can post the samples of the code so that other can also benefit.

Originally posted by robotovich robotovich wrote:

I have completed my appliction and it is now working flawlessly. samples of the code can be produced upon request.
Back to Top
rrosenhagen View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: July 14 2005
Location: United States
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrosenhagen Quote  Post ReplyReply Direct Link To This Post Posted: October 23 2006 at 9:31am
Can you post your code or email a zip of the project?
Rick Rosenhagen | IT Support | Red Carpet Studios
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 24 2006 at 8:32am
I will prepare a document outlining the steps I took and sample codes from each section throughout this week. Keep your eyes peeled.
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:41am

I just completed University and graduated as one of the top programmers. I am now employed as a software developer to one of Jamaicaís leading software houses. My first project was to automate the sales order import process of Solomon. At first it proved to be quit a challenge as this was my first automation program. Not one to back down from a challenge I started by practicing on MS Excel. Needless to say I was up and running in no time. I then used that knowledge as the base for my project. Finding help material on the Solomon object model proved to be more difficult than the developmental process itself. After weeks of searching I finally got my hands on the Solomon Object Model documentation. Credit is due to the authors of the document as it was well written and straight forward, with adequate sample codes. After reading the documentation I thought it would be a good second step to get my hands on some sample codes. At first the search proved fruitless so I used the sample codes in the SOM documentation as a start. I wrote a good amount of code using this material. Up until this time I have never used the Solomon application before. When I finally got it installed on my computer it made a world of difference. I now had access to sample codes and a host of documentation that came with the installation CDs. I was now better able to follow the documentations, and could now write the codes with much confidence and conviction.

 

I will not attempt to put the reader to sleep anymore but will now delve into the heart of the matter; codes. My project was to export a CSV file to the Solomon application, particularly the Sales Order application. Before we go any further take a look at the structure of the CSV file.

 

"HEADER","Company","","Order Type","Customer ID","PO:","Address Type","Ship Complete","Order Date",""

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"HEADER","Company","","Order Type","Customer ID","PO:","Address Type","Ship Complete","Order Date",""

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

"LINES","Inventory ID","SiteID",Qty,"EACH","Price","Discount","Request date","Drop Ship"

 

Please note that you will have to replace the different fields with actual values to get a real picture. A possible header record might look something like this:

 

"HEADER","MyCom","","INVC","ABC1234","10/14/2006","C","1","10/21/2006",""

With a detail record resembling:

 

"LINES","INVT100","STORES",31,"EACH","100.00","10.00","10/14/2006","0"

 

Now we an idea of what the import file looks like we will now delve into some code. The project was written in VB.NET 2005. For possible code reuse segments of the code were compiled into separate DLLs. Please note that It is not a requirement to compile the different classes into separate DLLs, I just did it as a matter of programming practice. The first class that we will look at is a class I called MenuBar. This class was compiled into a DLL called SolomonToolbar. The class was designed to control the parent application. Using this class you can log in or out of Solomon, and exit the application. The definition of the class can be seen below.

 

Imports Parent

Imports SWIMAPI

 

Public Class MenuBar

    Private _sivTB As SIVToolbar = New Parent.SIVToolbar

    Private loggedin As Boolean = False

 

    Public Function Login(ByVal Server As String, ByVal Database As String, ByVal Company As String, ByVal UserID As String, ByVal Password As String, ByRef ReportsDir As String) As Boolean

        Try

            _sivTB = New SIVToolbar

            _sivTB.Visible = True

            _sivTB.Login(Server, Database, Company, UserID, Password)

            Login = True

            loggedin = True

         

            ErrorLog.ErrorLog.LogError("Automation client successfully loged into solomon at " + Date.Now.ToString, "", ReportsDir)

        Catch ex As System.Runtime.InteropServices.COMException

            CleanUpSIV(ReportsDir)

 

            ErrorLog.ErrorLog.LogError("Runtime Error", ex.Message, ReportsDir)

            Login = False

            Throw ex

        Catch ex As Exception

            Select Case Err.Number - vbObjectError

                'login errors

                Case 7500

 

                    ErrorLog.ErrorLog.LogError("Login Error", "Login Error: Already logged in", ReportsDir)

 

                Case 7501

 

                    CleanUpSIV(ReportsDir)

 

                    ErrorLog.ErrorLog.LogError("Login Error", "System Database Name > 20 Characters", ReportsDir)

                    Login = False

 

                Case 7502

 

                    CleanUpSIV(ReportsDir)

                    ErrorLog.ErrorLog.LogError("Login Error", "Wrong System Database Server Database Name", ReportsDir)

                    Login = False

 

                Case 7503

                    CleanUpSIV(ReportsDir)

                    ErrorLog.ErrorLog.LogError("Login Error", "Incorrect Company ID, User ID, or Password", ReportsDir)

                    Login = False

                Case 7504

                    CleanUpSIV(ReportsDir)

                    ErrorLog.ErrorLog.LogError("Login Error", "System Database Does Not Exist", ReportsDir)

                    Login = False

                Case 7505

                    CleanUpSIV(ReportsDir)

                    ErrorLog.ErrorLog.LogError("Login Error", "Interactive User ID <> Client Login", ReportsDir)

                    Login = False

                Case Else

                    CleanUpSIV(ReportsDir)

                    ErrorLog.ErrorLog.LogError("Login Error", ex.Message, ReportsDir)

                    Login = False

            End Select

            Throw ex

        End Try

    End Function

 

 

    Public Function Logout(ByRef ReportsDir As String) As Boolean

 

        Try

            _sivTB.logout()

            Logout = True

            ErrorLog.ErrorLog.LogError("Automation client successfully loged out of Solomon as " + Date.Now.ToString, "", ReportsDir)

        Catch ex As System.Runtime.InteropServices.COMException

 

            ErrorLog.ErrorLog.LogError("Logout Error", ex.Message, ReportsDir)

            Logout = False

 

        Catch ex As Exception

 

            Select Case Err.Number - vbObjectError

                'Possible errors when login out

                Case 7506

                  

                    ErrorLog.ErrorLog.LogError("Logout Error", "Can't logout: you were not loged in", ReportsDir)

                    Logout = False

 

                Case 7507

                   

                    ErrorLog.ErrorLog.LogError("Logout Error", "Can't log out: Applications still running", ReportsDir)

                    Logout = False

 

                Case Else

                   

                    ErrorLog.ErrorLog.LogError("Logout Error", "Unknown Exception", ReportsDir)

                    Logout = False

 

            End Select

            Throw ex

 

        End Try

 

        Return Logout

 

    End Function

 

    Public Function CleanUpSIV(ByRef ReportsDir As String) As Boolean

        Try

            If loggedin Then

                _sivTB.Quit()

            End If

            If Not _sivTB Is Nothing Then

                System.Runtime.InteropServices.Marshal.ReleaseComObject(_sivTB)

                GC.Collect()

                GC.Collect()

            End If

            ErrorLog.ErrorLog.LogError("Automation client successfully exited Solomon at " + Date.Now.ToString, "", ReportsDir)

 

            CleanUpSIV = True

        Catch ex As System.Runtime.InteropServices.COMException

            System.Runtime.InteropServices.Marshal.ReleaseComObject(_sivTB)

            GC.Collect()

            GC.Collect()

            ErrorLog.ErrorLog.LogError("Runtime Error", "Error while closing solomon", ReportsDir)

            CleanUpSIV = False

            Throw ex

        Catch ex As Exception

            System.Runtime.InteropServices.Marshal.ReleaseComObject(_sivTB)

            GC.Collect()

            GC.Collect()

            ErrorLog.ErrorLog.LogError("Toolbar close error", ex.Message, ReportsDir)

            CleanUpSIV = False

            Throw ex

        End Try

        Return CleanUpSIV

    End Function

 

    Public ReadOnly Property sivTB()

        Get

            Return _sivTB

        End Get

    End Property

 

End Class

 

            If you are in the least familiar with the Solomon Object Model, the above codes should look familiar to you, but there are lines that I want to discuss. First you might have noticed lines similar to ErrorLog.ErrorLog.LogError("Runtime Error", "Error while closing solomon", ReportsDir). ErrorLog is a Errorlog is a class that I developed to keep a track of all the activities of my application. We will have a look at that class shortly. For now I want to draw your attention to another line that can be found in the CleanUpSIV  function. In this function you will notice that I use marshalling to release the com object (System.Runtime.InteropServices.Marshal.ReleaseComObject(_sivTB)). The gargage collector of the .NET framework can only release manages objects, as a result it is possible to have COM objects in memory when you think you have released them. This can cause unforseen behaviour, for example when in the early developmental stage, I kept on getting errors when I tried to exit the application after opening the Sales order Screen and Closing it. Even though it appeared to close successfully it was still in memory, and as a result the parent application could not close. I had to use marshalling to get get over this hurdle.

 

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:43am

Let us now take a look at the reporting class called ErrorLog. This class was compiled into a DLL of the same name. The class simple takes the exceptions generated by solomon and write them to a file for administrative purposes. Using this class a new report is generated each day. The naming convention of the file will tell you whch day the report was generated for.

 

Imports System.Text

Imports System.IO

Public Class ErrorLog

    Private Shared reportCSV As String = ""

 

    Private Sub New()

 

    End Sub

 

 

        Public Shared Sub LogError(ByRef type As String, ByRef errors As String, ByRef errorDir As String)

        Dim filee As FileStream = Nothing

        Dim fileWriter As StreamWriter = Nothing

 

        Try

 

            Dim r As StringBuilder = New StringBuilder

            If Not Directory.Exists(errorDir) Then

 

                Directory.CreateDirectory(errorDir)

 

            End If

            r.Append(Date.Today.Month.ToString + Date.Today.Day.ToString + Date.Today.Year.ToString + "Report.txt")

 

            reportCSV = errorDir + "\" + r.ToString

 

            filee = New FileStream(reportCSV, FileMode.Append, FileAccess.Write)

            fileWriter = New StreamWriter(filee)

 

            fileWriter.Write(type + ": " + errors + Environment.NewLine + Environment.NewLine)

           

        Catch ex As Exception

            Trace.WriteLine("Error writing to report file")

        Finally

            If Not fileWriter Is Nothing Then

                fileWriter.Close()

            End If

            If Not filee Is Nothing Then

                filee.Close()

            End If

        End Try

    End Sub

 

    Public Shared ReadOnly Property ReportFilePath()

        Get

            Return reportCSV

        End Get

 

    End Property

 

End Class

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:45am

Before I go any further I need to discuss the structure of the import file. The file has header/detail imformation. My view of this header/detail information lead me to design a class that could hold one atomic operation. Each set of detail records belonged to a particular header record. I needed to design a class that could capture this so I came up with this.

 

Public Class Master

    Public HEADER As String

    Public CompanyID As String

    Public Site As String

    Public INVC As String

    Public CustomerID As String

    Public StartDate As Date

    Public c As String

    Public ONE As String

    Public EndDate As Date

    Public details As New ArrayList

End Class

 

The array list in the class was designed to hold an array of the details record for that particular header record. A class was also developed to represent a detail record.

 

Public Class Details

    Public TAB As String

    Public InventoryID As String

    Public SiteID As String

    Public Qty As Integer

    Public EACHz As String

    Public Value As Double

    Public Discount As Double

    Public TransactionDate As Date

    Public ZeroValue As Int32

End Class

 

 

In order to comply with design regulations I decided to place the retrieving of the CSV file into a data access layer (Multi-tier development). My data access layer was to retrieve the CSV file and transform for it into an object that was easier to work with, an arraylist.

 

Imports System.IO

Imports System.Text.RegularExpressions

 

Public Class GetCSV

    Private _Transactions As ArrayList = New ArrayList

    Private _gotFiles As Boolean = False

    Private tryDate As Date = New Date

 

    Public Function GetCSVFile(ByRef file As String) As Boolean

        Trace.WriteLine(file)

 

        Dim input As System.IO.FileStream = Nothing 'used to open import file

 

        Dim reader As System.IO.StreamReader = Nothing 'used to read import file

 

        Dim FileObjectArr As ArrayList = New ArrayList 'holds all the master/detail records

        'for each customer grouped transaction

 

        'Dim FileObjectRecord As FileObject 'used to temporarily store master records

 

        Dim Inputrecord As String = "" 'holds individual lines of the csv file

 

        Dim record() As String = {} 'holds individual fields when the record is split up

        Dim ourFile As System.IO.FileInfo = New System.IO.FileInfo(file)

 

        If ourFile.Exists Then

 

            Try

                'Create the filestream to obtain read access to the file

                input = New System.IO.FileStream(file, IO.FileMode.Open, IO.FileAccess.Read, IO.FileShare.Read)

 

                reader = New System.IO.StreamReader(input)

                FileObjectArr = New ArrayList

 

                'get all the data from the csv file and store the records as

                'an object array

                Dim HEADER As String = "HEADER"

                Dim LINES As String = "LINES"

                While Not reader.EndOfStream

 

                    Dim FileObjectRec As New FileObject

                    Inputrecord = reader.ReadLine()

 

                    If Not Inputrecord Is Nothing Then

 

                        record = Inputrecord.Split(","c)

                        Trace.WriteLine("record length = " + record.Length.ToString)

                        Trace.WriteLine("First item in record = " + record(0).ToString)

 

                       

                        'When we break up the record into individual data elements

                        'the data elements has quotes around them, the follwing

                        'loop removes the quotes leaving clean records

                        For i As Integer = 0 To record.Length - 1

                            record(i) = Regex.Replace(record(i), Char.Parse("""").ToString, String.Empty)

                        Next

 

                        If record(0).ToString = HEADER Then

                            If Not (record.Length < 11 And record.Length > 8) Then

                                _Transactions = Nothing

                                Return False

                            End If

                        ElseIf record(0) = LINES Then

                            If record.Length <> 9 Then

                                _Transactions = Nothing

                                Return False

                            End If

                        Else

                            _Transactions = Nothing

                            Return False

                        End If

                        'popupate an individual file object

                        FileObjectRec.Field1 = record(0).Trim

                        FileObjectRec.field2 = record(1).Trim

                        FileObjectRec.Field3 = record(2).Trim

                        FileObjectRec.field4 = record(3).Trim

                        FileObjectRec.Field5 = record(4).Trim

                        FileObjectRec.field6 = record(5).Trim

                        FileObjectRec.Field7 = record(6).Trim

                        FileObjectRec.field8 = record(7).Trim

                        FileObjectRec.field9 = record(8).Trim

                        'add a FileObject to a FileObject Array

                        FileObjectArr.Add(FileObjectRec) 'array of FileObject's

                    End If

 

                End While 'by this time all the records in the csv file is in

                'an array of FileObjects. We no longer need the file and from now

                'on will use the FileObject array.

               

                FileObjectArr.TrimToSize()

 

            Catch ex As FileNotFoundException

 

                GetCSVFile = False

                _Transactions = Nothing

                Exit Function

           

 

            Catch ex As EndOfStreamException

 

                GetCSVFile = False

                _Transactions = Nothing

                Exit Function

 

            Catch ex As IOException

 

                GetCSVFile = False

                _Transactions = Nothing

                Exit Function

            Catch ex As NullReferenceException

 

                GetCSVFile = False

                _Transactions = Nothing

                Exit Function

            Catch ex As Exception

 

                GetCSVFile = False

                _Transactions = Nothing

                Exit Function

 

            Finally

                If Not reader Is Nothing Then

                    reader.Close()

                End If

 

                If Not input Is Nothing Then

                    input.Close()

                End If

 

            End Try

 

        Else

 

            GetCSVFile = False

            _Transactions = Nothing

            Exit Function

 

        End If

        'by now we should have an array of fileObjects

        'so we can now create the master records

        ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

        Try

            'We will now loop through all the FileObjects in the array

            'and create an array of transaction records. A transaction record

            'is all the information belonging to an individual customer.

            'Due to the data structure requirements of the Sales Order Application

            'the transaction record has master/datail structure

            For Counter As Integer = 0 To FileObjectArr.Count - 1

                'used to temporarily store items from cvs object array

                Dim FileObjectRecord As New FileObject

                FileObjectRecord = FileObjectArr(Counter)

 

 

                'check if record is a master record

                If FileObjectRecord.Field1.ToString = "HEADER" Then

                    'Create new master record

                    Dim SOMaster As New Master

                    'and populate its fields

                    SOMaster.HEADER = CStr(FileObjectRecord.Field1)

                    SOMaster.CompanyID = CStr(FileObjectRecord.field2)

                    SOMaster.Site = CStr(FileObjectRecord.Field3)

                    SOMaster.INVC = CStr(FileObjectRecord.field4)

                    SOMaster.CustomerID = CStr(FileObjectRecord.Field5)

                    tryDate = Convert.ToDateTime(FileObjectRecord.field6)

                    SOMaster.StartDate = CDate(FileObjectRecord.field6)

                    SOMaster.c = CStr(FileObjectRecord.Field7)

                    SOMaster.ONE = CInt(FileObjectRecord.field8)

                    tryDate = Convert.ToDateTime(FileObjectRecord.field9)

                    SOMaster.EndDate = CDate(FileObjectRecord.field9)

 

                    Counter += 1

 

                    'check to make sure there are more records

                    If Counter < FileObjectArr.Count - 1 Then

                        'temp variable to hold item from csv object array

                        Dim DetailFileObjectRecord As New FileObject

                        DetailFileObjectRecord = FileObjectArr(Counter)

 

                        'check of object contains information about a

                        'detail record

                        If DetailFileObjectRecord.Field1.ToString = "LINES" Then

                            'capture all the detail record for the particular

                            'master record

                            While DetailFileObjectRecord.Field1.ToString = "LINES"

                                'Create new details object that will be added

                                'to the master object

                                Dim Detail As New Details

                                Detail.TAB = CStr(DetailFileObjectRecord.Field1)

                                Detail.InventoryID = CStr(DetailFileObjectRecord.field2)

                                Detail.SiteID = CStr(DetailFileObjectRecord.Field3)

                                Detail.Qty = Convert.ToInt32(DetailFileObjectRecord.field4)

                                Detail.EACHz = CStr(DetailFileObjectRecord.Field5)

                                Detail.Value = CInt(DetailFileObjectRecord.field6)

                                Detail.Discount = CStr(DetailFileObjectRecord.Field7)

                                tryDate = Convert.ToDateTime(DetailFileObjectRecord.field8)

                                Trace.WriteLine("Transaction Date: " + DetailFileObjectRecord.field8)

                                Detail.TransactionDate = CDate(DetailFileObjectRecord.field8)

                                Detail.ZeroValue = Convert.ToInt32(DetailFileObjectRecord.field9)

 

                                'add new details record to master object

                                SOMaster.details.Add(Detail)

                                Counter += 1

                                If Counter > FileObjectArr.Count - 1 Then

                                    Exit While

                                End If

 

                                DetailFileObjectRecord = FileObjectArr(Counter)

                            End While

                            'add master record to transactions array only if valid

                            'a valid master record must have details record

                            If SOMaster.details.Count > 0 Then

                                _Transactions.Add(SOMaster)

                            Else

 

                                _Transactions = Nothing

 

                                Return False

 

                            End If

 

                            Counter -= 1

                        End If

                    End If

                    If _Transactions.Count = 0 Then

                        _Transactions = Nothing

                    End If

                End If

            Next

 

            _Transactions.TrimToSize()

            _gotFiles = True

 

        Catch ex As Exception

 

            _Transactions = Nothing

            GetCSVFile = False

            Exit Function

 

        End Try

 

        Return GetCSVFile

 

    End Function

 

 

    Private Function CheckLines(ByVal linesRecord() As String) As Boolean

        If linesRecord.Length <> 9 Then

            Return False

        Else

            If Not linesRecord(0).GetType Is GetType(String) Then

                Return False

            End If

        End If

    End Function

 

 

    Public ReadOnly Property Transactions()

 

        Get

            Return _Transactions

        End Get

 

    End Property

 

 

    Public ReadOnly Property gotFiles()

        Get

            Return _gotFiles

        End Get

    End Property

 

    'procedure developed for testing purposes only.

    'checking to see if the Transactions arraylist has valid entries.

    Public Sub DisplayMasterDetail()

        For Each masterRec As Master In Transactions

            Debug.WriteLine(masterRec.HEADER.ToString + " " + masterRec.CompanyID.ToString + " " + masterRec.Site.ToString + " " + masterRec.INVC.ToString + " " + masterRec.CustomerID.ToString + " " + masterRec.StartDate + " " + masterRec.c.ToString + " " + masterRec.ONE.ToString + " " + masterRec.EndDate)

            For Each detail As Details In masterRec.details

                Debug.WriteLine(detail.TAB.ToString + " " + detail.InventoryID.ToString + " " + detail.SiteID.ToString + " " + detail.Qty.ToString + " " + detail.EACHz + " " + detail.Value.ToString + " " + detail.Discount.ToString + " " + detail.TransactionDate + " " + detail.ZeroValue.ToString)

            Next

        Next

    End Sub

 

 

End Class

 

The above class made use of the following classes:

 

Public Class FileObject

    Public Field1 As Object

    Public field2 As Object

    Public Field3 As Object

    Public field4 As Object

    Public Field5 As Object

    Public field6 As Object

    Public Field7 As Object

    Public field8 As Object

    Public field9 As Object

End Class

 

 

 

This class was designed to hold the individual fields on each line of the CSV file (look at the structure of the CSV file and you might see why the class is made up of just objects).

If the CSV file is a valid one, the operation should produce an arraylist of Master records (remember that the Master record represents an atomic transaction of header/detail records).

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:51am

We are now ready for the real worker module. The import class takes the arraylist of Master records and exports them to Solomon. Throughout the importation process we will loop through the arraylist and save the records to the Solomon. If for any reason we could not save one of the records to Solomon we decided to rebuild a small CSV file with the same structure as the import file. This file could then be corrected in Excel, after which you could use the program to import the corrected file. There is a lot of programming logic so you might want to take you time and go through the following code.

 

Imports SWIMAPI

Imports SolomonToolbar

Imports System.IO

Imports System.Text

Imports System.Threading

Imports System.Threading.Thread

Imports System.Text.RegularExpressions

Public Class Import

    Private _importErrorsNo As Integer = 0

    Private errorFileName As String = ""

    Private WithEvents salesOrdersApp As SIVApplication

    Private sivMenu As MenuBar = New MenuBar

    Private CVSMaster As GetCSV.Master = New GetCSV.Master

    Private _SOLog As String = "" 'This variable is used to store the

    'event log generated by the Sales Order Screen. Even though I capture this

    'data I did not use it. I made my own log but you can use it if you want.

    'Private Delegate Sub MyDelSub()

    'Dim del As MyDelSub

 

    Public ReadOnly Property importErrorsNo()

        Get

            Return _importErrorsNo

        End Get

    End Property

 

 

    Public ReadOnly Property ErrFileName()

        Get

            Return errorFileName

        End Get

    End Property

 

    Public Function StartSalesOrderApp(ByVal Server As String, ByVal Database As String, ByVal Company As String, ByVal UserID As String, ByVal Password As String, ByVal App As String, ByRef ReportsDir As String) As Boolean

 

        'start the solomon application

 

        If sivMenu.Login(Server, Database, Company, UserID, Password, ReportsDir) Then

            Try

 

 

                'Open the sales order screen

                salesOrdersApp = sivMenu.sivTB.StartApplication(App)

                salesOrdersApp.Visible = True

                StartSalesOrderApp = True

 

                ErrorLog.ErrorLog.LogError("Automation client successfully opened Sales Orders Screen at " + Date.Now.ToString, "", ReportsDir)

 

            Catch ex As System.Runtime.InteropServices.COMException

 

                ErrorLog.ErrorLog.LogError("Start Application Error", ex.Message, ReportsDir)

                Throw ex

            Catch ex As Exception

 

                Select Case Err.Number - vbObjectError

                    Case 7516

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Login context may not have rights to run the application", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case 7517

                        ErrorLog.ErrorLog.LogError("Start Application Error", "User Limit Exceeded", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case 7519

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Unable to start application due to operating system error: specific error number", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case 7520

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Unable to start application due to fatal error during form load: specific error number", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case 7521

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Initialize mode is on, but user doesnít have rights to run application in Initialize mode", ReportsDir)

 

                    Case 7555

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Application did not return an object handle", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case 7563

 

                        ErrorLog.ErrorLog.LogError("Start Application Error", "Object Model disabled in application", ReportsDir)

                        StartSalesOrderApp = False

 

                    Case Else

                        ErrorLog.ErrorLog.LogError("Start Application Error", ex.Message, ReportsDir)

                        StartSalesOrderApp = False

 

                End Select

 

                Throw ex

 

            End Try

        End If

 

 

 

        Return StartSalesOrderApp

 

    End Function

 

 

    Public Function CloseSalesOrdersApp(ByRef errorDir As String) As Boolean

        Try

 

            salesOrdersApp.Visible = False

            salesOrdersApp.Quit()

            System.Runtime.InteropServices.Marshal.ReleaseComObject(salesOrdersApp)

            GC.Collect()

            CloseSalesOrdersApp = True

            ErrorLog.ErrorLog.LogError("Automation client successfully closed Sales Orders Screen at " + Date.Now.ToString, "", errorDir)

 

        Catch ex As System.Runtime.InteropServices.COMException

 

            ErrorLog.ErrorLog.LogError("Runtime Error", "Error closing Sales order applcation " + ex.Message, errorDir)

            CloseSalesOrdersApp = False

            Throw ex

        Catch ex As Exception

 

            ErrorLog.ErrorLog.LogError("Application Closing Error", "Error closing Sales order applcation " + ex.Message, errorDir)

            CloseSalesOrdersApp = False

            Throw ex

        End Try

 

    End Function

 

View the next post for the rest of the class.

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:54am

    Public Sub AddSalesOrders(ByRef Transactions As ArrayList, ByRef reportsDir As String, ByRef errorDir As String)

 

        'Dim RandomClass As New Random()

        'Dim unique As Integer = RandomClass.Next

 

        'If Not Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\SO_Automated_Client_Reports\Errors") Then

 

        '    Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "\SO_Automated_Client_Reports\Errors")

 

        'End If

        Dim errorFileNameBuilder As StringBuilder = New StringBuilder

 

 

        errorFileNameBuilder.Append(Date.Today.Month.ToString + "_" + Date.Today.Day.ToString + "_" + Date.Now.Year.ToString + "_" + Date.Now.Hour.ToString + "_" + Date.Now.Minute.ToString + "_" + Date.Now.Second.ToString + "_" + "ErrorCSV.csv")

        errorFileName = errorDir + "\" + errorFileNameBuilder.ToString ' + errorFileNameBuilder.ToString()

 

        Trace.WriteLine(errorFileName)

        ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

        Dim DetailError As Boolean = False

        Dim transactionPos As Integer = 0

        Dim newNeeded As Boolean = False 'if there is something wrong with a header record we will

        'simply clear all the controls for the header record and hence they will be blank and we do

        'not need to call the new method. This lets us avoid having to respond to the save request

        'if we has call the new method

        '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

 

 

        Dim masterRec As GetCSV.Master = New GetCSV.Master 'used to hold one master record

        Dim detail As GetCSV.Details = New GetCSV.Details ' used to hold one detail record

        'Master record controls

        Dim customerID As SIVControl = Nothing

        Dim company As SIVControl = Nothing

        Dim orderType As SIVControl = Nothing

        Dim CustOrderNo As SIVControl = Nothing

        Dim cshiptotype As SWIMAPI.SIVControl = Nothing

        Dim cshipcmplt As SWIMAPI.SIVControl = Nothing

        Dim corderDate As SWIMAPI.SIVControl = Nothing

 

        Trace.WriteLine("Initializing saf controls")

 

        'Dim customerID As SIVControl = salesOrdersApp.Controls("ccustid_0")

        'Dim company As SIVControl = salesOrdersApp.Controls("cCpnyID_0")

        'Dim orderType As SIVControl = salesOrdersApp.Controls("csotypeid_0")

        'Dim CustOrderNo As SIVControl = salesOrdersApp.Controls("ccustordnbr_0")

        'Dim cshiptotype As SWIMAPI.SIVControl = salesOrdersApp.Controls("cshiptotype_0")

        'Dim cshipcmplt As SWIMAPI.SIVControl = salesOrdersApp.Controls("cshipcmplt_0")

        'Dim corderDate As SWIMAPI.SIVControl = salesOrdersApp.Controls("corddate_0")

 

        ''Details record controls

        Dim inventoryID As SWIMAPI.SIVControl = Nothing

        Dim siteID As SWIMAPI.SIVControl = Nothing

        Dim qty As SWIMAPI.SIVControl = Nothing

        Dim cunitdesc As SWIMAPI.SIVControl = Nothing

        Dim unitPrice As SWIMAPI.SIVControl = Nothing

        Dim discount As SWIMAPI.SIVControl = Nothing

        Dim requestDate As SWIMAPI.SIVControl = Nothing

        Dim cDropShip As SWIMAPI.SIVControl = Nothing

        'Dim per As SWIMAPI.SIVControl = sivApp.Controls("")

 

 

 

        'Initialize controls

 

        'Master controls initialized

        orderType = salesOrdersApp.Controls("csotypeid_0")

        company = salesOrdersApp.Controls("cCpnyID_0")

        customerID = salesOrdersApp.Controls("ccustid_0")

        CustOrderNo = salesOrdersApp.Controls("ccustordnbr_0")

        cshiptotype = salesOrdersApp.Controls("cshiptotype_0")

        cshipcmplt = salesOrdersApp.Controls("cshipcmplt_0")

        corderDate = salesOrdersApp.Controls("corddate_0")

 

        'Details record controls

        inventoryID = salesOrdersApp.Controls("cinvtid_1")

        siteID = salesOrdersApp.Controls("csiteid_1")

        qty = salesOrdersApp.Controls("cqtyord_1")

        cunitdesc = salesOrdersApp.Controls("cunitdesc_1")

        unitPrice = salesOrdersApp.Controls("ccuryslsprice_1")

        discount = salesOrdersApp.Controls("cdiscpct_1")

        requestDate = salesOrdersApp.Controls("creqdate_1")

        cDropShip = salesOrdersApp.Controls("cDropShip_1")

        ''Dim per As SWIMAPI.SIVControl = sivApp.Controls("")

        ':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

        'Get the level property for the header record so we can declare

        'new master records

        Dim level0 As String = ""

        level0 = customerID.Properties("Level").value

 

        'Get the level property for the detail record so we can declare

        'new details records

        Dim level1 As String = ""

        level1 = inventoryID.Properties("Level").value

 

        Trace.WriteLine("about to start adding records")

        If Not Transactions Is Nothing Then

            Dim c As System.Windows.Forms.Control = New System.Windows.Forms.Control

            '::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

            For Each masterRec In Transactions

                'c.Invoke(ShowStatus, New Object() {CType(transactionPos, String)})

                transactionPos += 1

                If newNeeded Then

 

                    Try

 

                        salesOrdersApp.[New](level0)

 

                    Catch ex As System.Runtime.InteropServices.COMException

 

                        ErrorLog.ErrorLog.LogError("COM Error calling new method for " + masterRec.CustomerID, ex.Message, reportsDir)

 

 

                    Catch ex As Exception

 

                        Select Case Err.Number - vbObjectError

 

                            Case 7524

 

                                ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, ex.Message, reportsDir)

                                'CleanUpSIV()

 

                            Case 7525

 

                                ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, level0 + " is an invalid entity", reportsDir)

                                'CleanUpSIV()

 

                            Case Else

 

                                ErrorLog.ErrorLog.LogError("Unexpected exception while calling new method for " + masterRec.CustomerID, ex.Message, reportsDir)

                                'CleanUpSIV()

 

                        End Select

 

                    End Try

                End If

                newNeeded = True

 

                Try

                    company.value = masterRec.CompanyID

                    orderType.value = masterRec.INVC

                    customerID.value = masterRec.CustomerID

 

                Catch ex As System.Runtime.InteropServices.COMException

                    _importErrorsNo += 1

                    ErrorLog.ErrorLog.LogError("Bad header record for " + masterRec.CustomerID, ex.Message, reportsDir)

                    ErrorLog.ErrorLog.LogError("Unable to save record " + masterRec.CustomerID, "", reportsDir)

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    newNeeded = False

                    Continue For

 

                Catch ex As Exception

                    _importErrorsNo += 1

                    Dim ErrString As String = ""

                    Dim OtherErr As Integer = 0

                    Dim strMsgText As String = ""

                    OtherErr = Err.Number

                    If Err.Source = "Solomon IV" Then

                        OtherErr = Err.Number - vbObjectError

                    End If

                    Select Case OtherErr

                        Case 2048 'Could be solomon error passed from application

                            If Err.Source = "Solomon IV" Then

                                ErrString = Err.Description

                                Select Case Val(ErrString)

                                    Case 6931

                                    Case Else

                                        strMsgText = "ERROR " & Err.Description

                                End Select

                            Else

                                strMsgText = "ERROR " & Err.Description

                                Exit Sub

                            End If

                        Case 7541 'data does not match mask specified for control

                            strMsgText = "ERROR " & OtherErr & ": Data does not match mask specified for control. "

                            Exit Sub

                        Case 7553 'data value too large

                            strMsgText = "ERROR " & OtherErr & ": Data is too long to fit in field. "

                            Exit Sub

                        Case Else

                            strMsgText = "ERROR " & Err.Description

                            Exit Sub

                    End Select

                    ErrorLog.ErrorLog.LogError("Bad header record for " + masterRec.CustomerID, strMsgText, reportsDir)

                    ErrorLog.ErrorLog.LogError("Unable to save record " + masterRec.CustomerID, "", reportsDir)

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    'salesOrdersApp.[New](level0)

                    Continue For

                End Try

 

                Try

 

                    CustOrderNo.value = Format(masterRec.StartDate, "MM/dd/yyyy")

 

                Catch ex As Exception

 

                    ErrorLog.ErrorLog.LogError("Possible bad Order Date", ex.Message, reportsDir)

                    ErrorLog.ErrorLog.LogError("Unable to save record " + masterRec.CustomerID, "", reportsDir)

                    _importErrorsNo += 1

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    newNeeded = False

                    Continue For

 

                End Try

 

                Try

                    If masterRec.c = "C" Then

                        cshiptotype.value = "Customer"

                    ElseIf masterRec.c = "V" Then

                        cshiptotype.value = "Vendor"

                    ElseIf masterRec.c = "S" Then

                        cshiptotype.value = "Site"

                    ElseIf masterRec.c = "O" Then

                        cshiptotype.value = "Other"

                    End If

 

 

                Catch ex As Exception

 

                    ErrorLog.ErrorLog.LogError("Bad Address Type", ex.Message, reportsDir)

                    _importErrorsNo += 1

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    newNeeded = False

                    Continue For

                End Try

 

                Try

                    Trace.WriteLine(masterRec.ONE.ToString)

                    If masterRec.ONE = "1" Then

                        cshipcmplt.value = "Ship Complete"

                    ElseIf masterRec.ONE = "2" Then

                        cshipcmplt.value = "Backorders Allowed"

                    ElseIf masterRec.ONE = "3" Then

                        cshipcmplt.value = "Partially Ship-Cancel Remainder"

                    End If

                    'cshipcmplt.value = masterRec.ONE

                Catch ex As Exception

                    ErrorLog.ErrorLog.LogError("Bad ship complete type", ex.Message, reportsDir)

                    _importErrorsNo += 1

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    newNeeded = False

                    Continue For

                End Try

 

                Try

 

                    corderDate.value = Format(masterRec.EndDate, "MM/dd/yyyy")

 

                Catch ex As Exception

                    ErrorLog.ErrorLog.LogError("Possible bad Invoice Date", ex.Message, reportsDir)

                    _importErrorsNo += 1

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    newNeeded = False

                    Continue For

 

                End Try

 

                'We are now ready to handle the details for this

                'particular header record

                For Each detail In masterRec.details

 

                    If masterRec.details.Count < 1 Then

 

                        ErrorLog.ErrorLog.LogError("Empty master record", "No detail record for " + masterRec.CustomerID, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

 

                        Exit For

                    End If

 

                    Try

                        salesOrdersApp.[New](level1)

 

                    Catch ex As System.Runtime.InteropServices.COMException

                        ErrorLog.ErrorLog.LogError("COM Error calling new method for " + detail.InventoryID, ex.Message, reportsDir)

                    Catch ex As Exception

                        Select Case Err.Number - vbObjectError

                            Case 7524

                                ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, ex.Message, reportsDir)

                            Case 7525

                                ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, level1 + " is an invalid entity", reportsDir)

                            Case Else

                                ErrorLog.ErrorLog.LogError("Unexpected exception while calling new method for " + masterRec.CustomerID, ex.Message, reportsDir)

                        End Select

                    End Try

 

                    Try

 

                        inventoryID.value = detail.InventoryID.Trim.ToString

 

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Bad inventory ID (" + detail.InventoryID.ToString + ") for " + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Exit For

                    End Try

 

                    Try

                        siteID.value = detail.SiteID.Trim.ToString

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Bad inventory Site ID (" + detail.SiteID.ToString + ") for " + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Trace.WriteLine("Site")

                        Exit For

                    End Try

 

                    Try

                        qty.value = detail.Qty

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid quantity (" + detail.Qty.ToString + ") for " + masterRec.CustomerID.ToString + " " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Exit For

                    End Try

 

                    Try

                        cunitdesc.value = detail.EACHz

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid unit description (" + detail.EACHz.ToString + ") for " + masterRec.CustomerID.ToString + " " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        'Exit For

                    End Try

 

                    Try

                        unitPrice.value = CDbl(detail.Value.ToString + ".000")

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid unit price (" + detail.Value.ToString + ") for " + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Exit For

                    End Try

 

                    Try

                        discount.value = CDbl(detail.Discount.ToString + "")

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid discount value (" + detail.Discount.ToString + ") for " + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Exit For

                    End Try

                    Trace.WriteLine("Detail transaction date: " + detail.TransactionDate)

                    Trace.WriteLine(Regex.Replace(detail.TransactionDate.ToString, "/", String.Empty))

                    Try

                        'Dim xdate As Date = requestDate.value

                        'Trace.WriteLine(xdate)

                        requestDate.value = Format(detail.TransactionDate, "MM/dd/yyyy")

 

                    Catch ex As Exception

                        '_importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid request date (" + Format(detail.TransactionDate, "MM/dd/yyyy") + ") for " + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        Dim e As Integer = Err.Number - vbObjectError

                        Trace.WriteLine(ex.Source + " " + e.ToString)

                    End Try

 

                    Try

 

                        cDropShip.value = detail.ZeroValue

 

                    Catch ex As Exception

                        _importErrorsNo += 1

                        ErrorLog.ErrorLog.LogError("Detail entity error", "Invalid project value" + detail.ZeroValue.ToString + " for" + masterRec.CustomerID.ToString + ": " + ex.Message, reportsDir)

                        CSVErrorFile(masterRec, errorFileName, reportsDir)

                        DetailError = True

                        Exit For

 

                    End Try

 

                Next 'at the end of this loop all details should be processed

 

                'If any of the detail records has errors we will not save

                'any transaction for that customer. We will add the

                'customer to the error file along with all his

                'Transactions.

                If DetailError Then

 

                    ErrorLog.ErrorLog.LogError("Unable to save record " + masterRec.CustomerID, "", reportsDir)

 

                    Try

                        salesOrdersApp.First(level1)

 

                        For i As Integer = 0 To masterRec.details.Count - 1

 

                            salesOrdersApp.Delete(level1)

 

                        Next

                        Trace.WriteLine("Screen cleared for" + masterRec.CustomerID.ToString)

                        newNeeded = False

                        DetailError = False

                        Continue For 'continue for the next master record

 

                    Catch ex As System.Runtime.InteropServices.COMException

 

                        ErrorLog.ErrorLog.LogError("COM Exception", ex.Message, reportsDir)

 

                    Catch ex As Exception

 

                        Select Case Err.Number - vbObjectError

 

                            Case 7524

 

                                ErrorLog.ErrorLog.LogError("COM Exception 7524", ex.Message, reportsDir)

 

                            Case 7525

 

                                ErrorLog.ErrorLog.LogError("COM Exception 7525", ex.Message, reportsDir)

 

                            Case Else

 

                                ErrorLog.ErrorLog.LogError("Unexpected COM Exception", ex.Message, reportsDir)

 

                        End Select

 

                    End Try

 

                End If

                'Thread.CurrentThread.Sleep(30000)

 

                If Not saveEntries(masterRec) Then

 

                    ErrorLog.ErrorLog.LogError("Save Error", "Unable to save transaction for customer " + masterRec.CustomerID.ToString, reportsDir)

                    CSVErrorFile(masterRec, errorFileName, reportsDir)

                    Continue For

                Else

                    ErrorLog.ErrorLog.LogError("Successfully saved transactions for " + masterRec.CustomerID, "", reportsDir)

                End If

 

                System.Windows.Forms.Application.DoEvents()

            Next

 

        End If

        Trace.WriteLine(Transactions.Count)

        If CInt(transactionPos) = CInt(Transactions.Count) Then

            If Not saveEntries(masterRec) Then

 

                Try

 

                    salesOrdersApp.[New](level0)

 

                Catch ex As System.Runtime.InteropServices.COMException

 

                    ErrorLog.ErrorLog.LogError("COM Error calling new method", ex.Message, reportsDir)

 

 

                Catch ex As Exception

 

                    Select Case Err.Number - vbObjectError

 

                        Case 7524

 

                            ErrorLog.ErrorLog.LogError("Error calling new method", ex.Message, reportsDir)

                            'CleanUpSIV()

 

                        Case 7525

 

                            ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, level0 + " is an invalid entity", reportsDir)

                            'CleanUpSIV()

 

                        Case Else

 

                            ErrorLog.ErrorLog.LogError("Unexpected exception while calling new method", ex.Message, reportsDir)

                            'CleanUpSIV()

 

                    End Select

 

                End Try

 

                Try

 

                    salesOrdersApp.[New](level0)

 

                Catch ex As System.Runtime.InteropServices.COMException

 

                    ErrorLog.ErrorLog.LogError("COM Error calling new method", ex.Message, reportsDir)

 

 

                Catch ex As Exception

 

                    Select Case Err.Number - vbObjectError

 

                        Case 7524

 

                            ErrorLog.ErrorLog.LogError("Error calling new method" + masterRec.CustomerID, ex.Message, reportsDir)

                            'CleanUpSIV()

 

                        Case 7525

 

                            ErrorLog.ErrorLog.LogError("Error calling new method for " + masterRec.CustomerID, level0 + " is an invalid entity", reportsDir)

                            'CleanUpSIV()

 

                        Case Else

 

                            ErrorLog.ErrorLog.LogError("Unexpected exception while calling new method", ex.Message, reportsDir)

                            'CleanUpSIV()

 

                    End Select

 

                End Try

 

            End If

 

        End If

 

        _SOLog = salesOrdersApp.EventLog

 

    End Sub

 

View next post for rest of class

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:57am

    Public ReadOnly Property SOLog()

        Get

            Return _SOLog

        End Get

    End Property

 

    Public Function ExitSolomon(ByRef errorDir As String) As Boolean

 

        If Not sivMenu.Logout(errorDir) Then

            Return False

        End If

        If Not sivMenu.CleanUpSIV(errorDir) Then

            Return False

        End If

        Return True

    End Function

 

 

    Public Function saveEntries(ByRef masterRec As GetCSV.Master) As Boolean

        Try

 

            salesOrdersApp.Save()

            saveEntries = True

 

        Catch ex As Exception

 

            saveEntries = False

 

        End Try

 

        Return saveEntries

 

    End Function

 

 

 

    Private Sub salesOrdersApp_Message(ByVal MessageNumber As Integer, ByVal MessageText As String, ByVal MessageType As SWIMAPI.sivMessageType, ByRef MessageResponse As SWIMAPI.sivMessageResponse) Handles salesOrdersApp.Message

 

        Try

 

            Select Case MessageType

 

                Case SWIMAPI.sivMessageType.sivMsgAbortRetryIgnore

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspAbort

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

                Case SWIMAPI.sivMessageType.sivMsgOk

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspOk

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

                Case SWIMAPI.sivMessageType.sivMsgOkCancel

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspCancel

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

                Case SWIMAPI.sivMessageType.sivMsgRetryCancel

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspCancel

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

                Case SWIMAPI.sivMessageType.sivMsgYesNo

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspNo

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

                Case SWIMAPI.sivMessageType.sivMsgYesNoCancel

 

                    MessageResponse = SWIMAPI.sivMessageResponse.sivMsgRspNo

                    'ErrorLog.ErrorLog.LogError("Message response = " + MessageResponse.ToString, "")

 

            End Select

        Catch ex As Exception

            Select Case Err.Number - vbObjectError

                Case 7554

                Case Else

            End Select

        End Try

 

    End Sub

 

 

    'This function is used to generate a cvs file with the same structure as

    'the import file. This file contains all the records with errors.

    'When this file is fixed you can reimport it. The most likely causes of

    'error are incorrect Customer IDs if incorrect Inventory IDs.

    Public Sub CSVErrorFile(ByVal masterRec As GetCSV.Master, ByVal errorCSV As String, ByRef reportsDir As String)

 

        Dim fiile As FileStream = Nothing

        Dim fileWriter As StreamWriter = Nothing

        Try

 

            fiile = New FileStream(errorCSV, FileMode.Append, FileAccess.Write)

            fileWriter = New StreamWriter(fiile)

 

            fileWriter.WriteLine(Chr(34).ToString + masterRec.HEADER.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.CompanyID.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.Site.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.INVC.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.CustomerID.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.StartDate + Chr(34).ToString + "," + Chr(34).ToString + masterRec.c.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.ONE.ToString + Chr(34).ToString + "," + Chr(34).ToString + masterRec.EndDate + Chr(34).ToString + "," + Chr(34).ToString + Chr(34).ToString)

 

            For Each DETAIL As GetCSV.Details In masterRec.details

 

                fileWriter.WriteLine(Chr(34).ToString + DETAIL.TAB.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.InventoryID.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.SiteID.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.Qty.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.EACHz + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.Value.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.Discount.ToString + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.TransactionDate + Chr(34).ToString + "," + Chr(34).ToString + DETAIL.ZeroValue.ToString + Chr(34).ToString)

 

            Next

 

 

 

        Catch ex As Exception

 

            ErrorLog.ErrorLog.LogError("Error writing to CSV error file", ex.Message, reportsDir)

        Finally

            If Not fileWriter Is Nothing Then

                fileWriter.Close()

            End If

 

            If Not fiile Is Nothing Then

                fiile.Close()

            End If

        End Try

 

    End Sub

 

 

End Class

 

Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: October 25 2006 at 11:58am

Last but not least I designed a form for user interaction. Once again there are a few programming logic be utilized, so take your time to go through.

 

Imports system.Configuration

Imports System.IO

Imports System.Threading

Public Class AutomationClient

    Dim fileName As String = ""

    Dim changeTrial As Int16 = 0

    Dim fileToImport As GetCSV.GetCSV = Nothing

    Dim Transactions As ArrayList = Nothing

    Dim SalesOrder As SOImport.Import = Nothing

    Public Shared _ProcessLastRan As Date = New Date

    Private reports As Report = Nothing

    Private fileNameFirstChange As Boolean = True

    Private AllAppSettings As Specialized.NameValueCollection = ConfigurationManager.AppSettings

    Private clientDir As String = ""

    Private errorDir As String = ""

    Private reportsDir As String = ""

    Private prompt As String = ""

    Private lastTime As String = ""

    Dim thExecuteTaskAsync As Thread = Nothing

    'Private fileInformation As FileInfo

 

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click

        ' create dialog box enabling user to open file

        Dim fileChooser As New OpenFileDialog()

        fileChooser.Filter = "CSV|*.CSV"

        Dim result As DialogResult = fileChooser.ShowDialog()

        'Dim fileName As String ' name of file containing data

 

        ' exit event handler if user clicked Cancel

        If result = Windows.Forms.DialogResult.Cancel Then

 

            Return

 

        End If

 

        fileName = fileChooser.FileName ' get specified file name

 

 

        ' show error if user specified invalid file

        If fileName = "" Or fileName Is Nothing Then

 

            MessageBox.Show("Invalid File Name", "Error", _

               MessageBoxButtons.OK, MessageBoxIcon.Error)

 

        Else

 

            'fileInformation = New FileInfo(fileName)

            fileNameFirstChange = True

            tbxFileName.Text = fileName

            tbxFileName.Enabled = True

            btnRun.Enabled = True

 

        End If

 

    End Sub

 

    Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRun.Click

        Dim importFileInfo As FileInfo = Nothing

        If File.Exists(Me.tbxFileName.Text) Then

            importFileInfo = New FileInfo(Me.tbxFileName.Text)

        End If

 

 

        If Not importFileInfo Is Nothing Then

 

            If File.Exists(AllAppSettings("EpinsDirectory") + "\Solomon\Completed\" + importFileInfo.Name) Then

                prompt = "A file with that name has already been imported." + Environment.NewLine + "Importing this file could cause duplication in Solomon" + Environment.NewLine + Environment.NewLine

            End If

 

        End If

        Dim response As Windows.Forms.DialogResult = MessageBox.Show(prompt + "Are you sure you want to import this file?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

        prompt = ""

        If ValidateControls() Then

            If response = Windows.Forms.DialogResult.Yes Then

                Me.tbxFileName.Enabled = False

                System.Windows.Forms.Application.DoEvents()

                Me.btnRun.Enabled = False

                reportsDir = AllAppSettings("EpinsDirectory") + "\Solomon\Reports"

                If Not Directory.Exists(reportsDir) Then

                    Directory.CreateDirectory(reportsDir)

                End If

 

                errorDir = AllAppSettings("EpinsDirectory") + "\Solomon\Errors"

                If Not Directory.Exists(errorDir) Then

 

                    Directory.CreateDirectory(errorDir)

 

                End If

 

                fileToImport = New GetCSV.GetCSV

 

                If Not fileToImport.GetCSVFile(tbxFileName.Text) Then

                    Transactions = fileToImport.Transactions

 

                    If Not Transactions Is Nothing Then

                        ErrorLog.ErrorLog.LogError("Report for process ran at" + Date.Now.ToString, "", reportsDir)

                        ErrorLog.ErrorLog.LogError(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", "", reportsDir)

 

 

                        SalesOrder = New SOImport.Import

 

 

                        Try

                            If SalesOrder.StartSalesOrderApp(tbxServer.Text, tbxDb.Text, tbxCpny.Text, tbxUser.Text, tbxPassword.Text, AllAppSettings("SOApp"), reportsDir) Then

                                SetProcessLastRan()

                                Me.tbxPassword.Text = ""

                                SalesOrder.AddSalesOrders(Transactions, reportsDir, errorDir)

                                lastTime = getProcessLastRan()

                                If SalesOrder.importErrorsNo > 0 Then

                                    MessageBox.Show("The process completed with " + SalesOrder.importErrorsNo.ToString + " errors" + Environment.NewLine + "Please view " + SalesOrder.ErrFileName.ToString + Environment.NewLine + "for details of the error", "Process complete", MessageBoxButtons.OK, MessageBoxIcon.Error)

                                Else

                                    MessageBox.Show("The process completed successfully with 0 errors", "Process complete", MessageBoxButtons.OK, MessageBoxIcon.None)

                                End If

                                Dim fInfo As FileInfo = New FileInfo(tbxFileName.Text)

 

                                clientDir = AllAppSettings("EpinsDirectory") + "\Solomon\Completed"

 

                                If Not Directory.Exists(clientDir) Then

 

                                    Directory.CreateDirectory(clientDir)

 

                                End If

                                Dim desFile As String = clientDir + "\" + fInfo.Name

                                If File.Exists(desFile) Then

                                    File.Delete(desFile)

                                End If

 

                                Try

                                    System.IO.File.Move(tbxFileName.Text, desFile)

                                    System.IO.File.Delete(tbxFileName.Text)

                                Catch ex As Exception

                                    MessageBox.Show("An error occured while moving the import file", "Error", MessageBoxButtons.OK, MessageBoxIcon.None)

 

                                End Try

 

 

 

                                Me.lbLastProcessTime.Text = "Process was last ran on: " + lastTime

 

                                'ProcessLastRan = Date.Now

                                If Not SalesOrder.CloseSalesOrdersApp(reportsDir) Then

                                    Trace.WriteLine("Error closing Sales order screen")

                                End If

                                If Not SalesOrder.ExitSolomon(reportsDir) Then

 

                                    MessageBox.Show("Error closing Solomon Toolbar", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

                                Else

 

                                    ErrorLog.ErrorLog.LogError(Environment.NewLine, "", reportsDir)

                                    ErrorLog.ErrorLog.LogError(Environment.NewLine, "", reportsDir)

                                    ErrorLog.ErrorLog.LogError(Environment.NewLine, "", reportsDir)

                                    reports = New Report()

                                    reports.Show()

                                    Me.btnRun.Enabled = False

                                End If

                            Else

 

                                MessageBox.Show("Error loging into solomon", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

 

                            End If

                        Catch ex As Exception

                            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

                        End Try

                    Else

 

                        MessageBox.Show("Import file does not exist or contains errors", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

 

                    End If

 

                Else

 

                    MessageBox.Show("Import file does not exist or contains errors", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)

 

                End If

            End If

        End If

        Me.btnRun.Enabled = True

    End Sub

 

 

    Private Sub AutomationClient_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        tbxServer.Text = AllAppSettings("SolomonServer")

        Me.tbxDb.Text = AllAppSettings("SolomonDatabase")

        Me.tbxCpny.Text = AllAppSettings("SolomonCompany")

        'Me.tbxUser.Text = AllAppSettings("SolomonUserID")

        Me.lbLastProcessTime.Text = "Process was last ran on: " + getProcessLastRan()

    End Sub

 

    Private Function ValidateControls() As Boolean

        If tbxServer.Text Is Nothing Or tbxServer.Text = "" Then

 

            tbxServer.BackColor = Color.Red

            MessageBox.Show("Server cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Return False

        ElseIf Me.tbxDb.Text Is Nothing Or tbxDb.Text = "" Then

            tbxDb.BackColor = Color.Red

            MessageBox.Show("Database cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Return False

        ElseIf Me.tbxCpny.Text Is Nothing Or tbxCpny.Text = "" Then

            tbxCpny.BackColor = Color.Red

            MessageBox.Show("Company cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Return False

        ElseIf Me.tbxUser.Text Is Nothing Or tbxUser.Text = "" Then

            tbxUser.BackColor = Color.Red

            MessageBox.Show("User ID cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Return False

        ElseIf Me.tbxPassword.Text Is Nothing Or tbxPassword.Text = "" Then

            tbxPassword.BackColor = Color.Red

            MessageBox.Show("Password cannot be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

            Return False

        Else

 

            Return True

 

        End If

    End Function

 

 

    Private Sub tbxFileName_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tbxFileName.TextChanged

        If fileNameFirstChange Then

            fileNameFirstChange = False

        Else

            tbxFileName.Text = fileName

            MessageBox.Show("You cannot change the filename manually, please use the browse button instead", "", MessageBoxButtons.OK, MessageBoxIcon.Information)

        End If

 

    End Sub

 

    Private Sub SetProcessLastRan()

        Dim filename As String = "ProcessLastRan.txt"

        Dim fiile As FileStream = Nothing

        Dim fileWriter As StreamWriter = Nothing

        Dim Dir As String = AllAppSettings("EpinsDirectory") + "\Solomon"

        Try

 

            If Not Directory.Exists(Dir) Then

                Directory.CreateDirectory(Dir)

            End If

 

            fiile = New FileStream(Dir + "\" + filename, FileMode.Create, FileAccess.Write)

            fileWriter = New StreamWriter(fiile)

 

            fileWriter.WriteLine(Now.ToString)

        Catch ex As Exception

            Trace.WriteLine("-->" + ex.Message)

        Finally

            If Not fileWriter Is Nothing Then

                fileWriter.Close()

            End If

 

            If Not fiile Is Nothing Then

                fiile.Close()

            End If

        End Try

    End Sub

 

    Private Function getProcessLastRan() As String

        getProcessLastRan = ""

        Dim time As String = ""

        Dim fiile As FileStream = Nothing

        Dim fileReader As StreamReader = Nothing

        Dim filename As String = AllAppSettings("EpinsDirectory") + "\Solomon\ProcessLastRan.txt"

 

        Try

            If File.Exists(filename) Then

                Trace.WriteLine("time file exist")

                fiile = New FileStream(filename, FileMode.Open, FileAccess.Read)

                fileReader = New StreamReader(fiile)

                time = fileReader.ReadLine

                Trace.WriteLine(time)

                getProcessLastRan = time

                Return getProcessLastRan

            End If

        Catch ex As Exception

        Finally

            If Not fileReader Is Nothing Then

                fileReader.Close()

            End If

 

            If Not fiile Is Nothing Then

                fiile.Close()

            End If

 

        End Try

 

        Return getProcessLastRan

    End Function

End Class

 

Some of the settings were stored in the config file but you can store your setting where ever you want. I hope this helps someone. I know that there are some wicked @$$@# developers out there so if any of you have any comments about the code and the approach please fire away.

Back to Top
Rohtash Kapoor View Drop Down
MicrosoftDynamicsForums.com Moderator
MicrosoftDynamicsForums.com Moderator


Joined: July 06 2005
Location: United States
Status: Offline
Points: 655
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rohtash Kapoor Quote  Post ReplyReply Direct Link To This Post Posted: November 01 2006 at 8:09am
Thanks for sharing the code.
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: November 01 2006 at 8:40am
It was a pleasure to share the source code. I can remember the intial dificulty I had to find a good example, so I hope the codes I posted was able to help someone.
Back to Top
rrosenhagen View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: July 14 2005
Location: United States
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrosenhagen Quote  Post ReplyReply Direct Link To This Post Posted: November 01 2006 at 9:52am
Congrats on graduating as one of the top programmers.  Thanks for sharing your sample code here on the this website.  I am also using vb.net 2005  as a newbie to do customization for the small company that work for. 
 
Could you provide a zip file of the complete project including your UI forms,  Business and Data classes, etc... to make it easier for me to examine and walk through your code logic as I debug it on the fly?  I am trying to design an application currently that will take data exported from a 3rd hand held palm system and import it into the Solomon order entry screen.  I am also looking to build a Pocket Pc app in VB.NET 2005 using SQL Server Mobile.
 
You talk about several things like compiling your code for reuse into different class dlls like the ErrorLog, Import, GetCSV, and AutomationClient form. 
 
 
My email address is rrosenhagen@rcsgifts.com
 
I will also look through some of my code and see what I can post to share with other users.
Rick Rosenhagen | IT Support | Red Carpet Studios
Back to Top
briwagner View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: November 02 2006
Location: United States
Status: Offline
Points: 1
Post Options Post Options   Thanks (0) Thanks(0)   Quote briwagner Quote  Post ReplyReply Direct Link To This Post Posted: November 02 2006 at 1:37pm
I to would like to receive the zipped VB project, if that is OK. I twould make it a lot easier to follow the code in debug mode.
 
 
Thank you,
Brian Wagner
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: November 06 2006 at 8:59am
The project is part of a larger solution and as a result I cannot Zip the project and email it. The files that were posted is the entire group of files required to run the automation program. I will see if i can extract those files from the solution and build a smaller project. It would be nice if the forum managers could give me an email address to send the files to and then they could upload the files to their server and provide a link for others to download from. The forum managers has my email address so they could email me an address to send the files to.
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: November 06 2006 at 9:04am
To create a DLL in Visual Studio 2005
 
File >> New project
 
Select Class Library
 
Provide a name for the class library
 
Note that the DLL will take the name of the class library.
 
For more information on DLLs you could google it, or use MSDN
 
 
Back to Top
rrosenhagen View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: July 14 2005
Location: United States
Status: Offline
Points: 52
Post Options Post Options   Thanks (0) Thanks(0)   Quote rrosenhagen Quote  Post ReplyReply Direct Link To This Post Posted: November 06 2006 at 9:08am
Thanks for taking the time to build a smaller application so that we may learn how to write vb.net code to interface with Solomon.  I am looking forward to your sample.  I think this will also benefit us as the new version of Solomon I think is written in vb.net 2005 or at least part of it is.
Rick Rosenhagen | IT Support | Red Carpet Studios
Back to Top
Rohtash Kapoor View Drop Down
MicrosoftDynamicsForums.com Moderator
MicrosoftDynamicsForums.com Moderator


Joined: July 06 2005
Location: United States
Status: Offline
Points: 655
Post Options Post Options   Thanks (0) Thanks(0)   Quote Rohtash Kapoor Quote  Post ReplyReply Direct Link To This Post Posted: November 07 2006 at 6:32am
I have sent you an email. You may send the project to me. I shall upload it on this website.
 
Thank you.
 
 
 
Originally posted by robotovich robotovich wrote:

The project is part of a larger solution and as a result I cannot Zip the project and email it. The files that were posted is the entire group of files required to run the automation program. I will see if i can extract those files from the solution and build a smaller project. It would be nice if the forum managers could give me an email address to send the files to and then they could upload the files to their server and provide a link for others to download from. The forum managers has my email address so they could email me an address to send the files to.
Back to Top
robotovich View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: September 14 2006
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote robotovich Quote  Post ReplyReply Direct Link To This Post Posted: November 07 2006 at 11:40am

I have sent the files to the address you sent me. copy the text from the email and include it as instructions when you are posting the link.

Jah bless and one love.

irie

Back to Top
senthil View Drop Down
MicrosoftDynamicsForums.com Member
MicrosoftDynamicsForums.com Member


Joined: November 07 2006
Location: India
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote senthil Quote  Post ReplyReply Direct Link To This Post Posted: November 07 2006 at 12:20pm
I need a great help from you rosen. I tried to contact your mail-id, but I could not. Could you also view my post which I posted today with the topic name "How to get the screen number".
Back to Top
 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down


Copyright 2013 microsoftdynamicsforums.com. All rights reserved. MicrosoftDynamicsForums.com is an independent non-Microsoft website.
Email: contact AT microsoftdynamicsforums DOT com