Reconfigure for GIT

This commit is contained in:
2017-03-26 20:00:03 +02:00
commit 00637826ab
8056 changed files with 535977 additions and 0 deletions
+150
View File
@@ -0,0 +1,150 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="CustomersGLParameters" type="System.Configuration.NameValueSectionHandler"/>
<section name="Services_Controlling" type="System.Configuration.NameValueSectionHandler"/>
<section name="Services_CostHolder" type="System.Configuration.NameValueSectionHandler"/>
<section name="Services_VAT" type="System.Configuration.NameValueSectionHandler"/>
</configSections>
<appSettings>
<!--0=Reader, 1=Publisher, 2=Both-->
<add key="RunningMode" value="0"/>
<add key="Factory_HostName" value="node1.mq3c.hu"></add>
<add key="Factory_UserName" value="sis_testing"></add>
<add key="Factory_Password" value="Iet3ooko"></add>
<!--<add key="Factory_VirtualHost" value="sis_jatszos"></add>-->
<add key="Factory_VirtualHost" value="testing"></add>
<!--Fogadáshoz ...-->
<add key="Queue_Name" value="sis.sis3cteszt.rpc"></add>
<!--<add key="Queue_Name" value="sis.3cteszt.ugyfelteszt"></add>-->
<!--Küldéshez-->
<add key="Exchange_Name" value="sis.sis3cteszt.out"/>
<add key="Exchange_RoutingKey" value="dh.dh3cteszt.rpc"/>
<add key="Exchange_RoutingKey_Error" value="dh.dh3cteszt.rpc"/>
<add key="Exchange_RoutingKey_Alert" value="dh.dh3cteszt.rpc"/>
<!--<add key="Exchange_Name" value=""/>
<add key="Exchange_RoutingKey" value="RDBH.queue.ok"/>-->
<!--Egyéb-->
<add key="CustomersFrom" value="fa802589-acd5-437b-a8d9-cf2eb96af21c"/>
<!--0: CurrentDirectory-->
<add key="ErrorLogPath" value="Path=CurrentDirectory;FileName=WIN_RabbitMQ.log"/>
</appSettings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"></supportedRuntime>
</startup>
<connectionStrings>
<!--MySQL ConnectionString:-->
<add name="ConnectionString" connectionString="XpoProvider=MySql;server=sisb.banknet.net;user id=root; password=pcl718; database=3c_rb;persist security info=true;CharSet=utf8;"/>
<!--MS SQL ConnectionString:-->
<!--<add name="ConnectionString" connectionString="User ID=sa; Application Name=; Password=pcl718; Pooling=false; Data Source=datacenter\sis; Initial Catalog=RabbitMQ"/>-->
<!--PostgreSQL ConnectionString:-->
<!--<add name="ConnectionString" connectionString="XpoProvider=Postgres;Server=datacenter;User Id=root;Password=pcl718;Database=RabbitMQ;Encoding=UNICODE;"/>-->
</connectionStrings>
<CustomersGLParameters>
<!--konyvelesi_parameter - CustomersGLParameters Oid-->
<add key="Belföldi" value="f949d751-52c1-4f0c-b9d3-3a189871fbd6"></add>
<add key="Külföldi" value="2d99e230-f607-4c00-a20b-156613c01839"></add>
</CustomersGLParameters>
<Services_Controlling>
<!--szolgaltatascsoport id - Controlling Oid-->
<!--CPS-->
<add key="1" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Egyéb szolgáltatások-->
<add key="2" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--ADSL-->
<add key="3" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet Wireless csomagok-->
<add key="4" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet Eszközök -->
<add key="5" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet Egyéb szolgáltatások-->
<add key="6" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet Bérelt vonal-->
<add key="7" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet ADSL-->
<add key="8" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--CPS kiegészítő-->
<add key="9" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Micronet VoIp forgalmi díjak-->
<add key="10" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Késedelmi kamatok-->
<add key="11" value="a11b6fea-a0e9-4ed3-be42-8869db1081b5"></add>
<!--Domain alapszolgáltatás-->
<add key="12" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Domain kiegészítő szolgáltatás-->
<add key="13" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Jóváírások CPS-->
<add key="14" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Jóváírások MicroNet-->
<add key="15" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--ADSL kiegészítő-->
<add key="16" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Eszköz eladások-->
<add key="17" value="9daf55a8-f2d3-4b3f-b313-76d08c25b19c"></add>
<!--Voip kiegészítő szolgáltatás-->
<add key="18" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Mironet Voip alapdíjak-->
<add key="19" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Mikroweb üzleti internet-->
<add key="20" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Mobil-->
<add key="21" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
<!--Mobil készülék értékesítés-->
<add key="22" value="b7f42ea4-5ae2-4618-bf21-8559b755f1f0"></add>
</Services_Controlling>
<Services_CostHolder>
<!--szolgaltatascsoport id - CostHolder Oid-->
<!--CPS-->
<add key="1" value="5c60d597-8e14-4d39-95e8-a92bef1a2aec"></add>
<!--Egyéb szolgáltatások-->
<add key="2" value="ba8725bc-7ab6-418c-a13f-6d8ef63e34ad"></add>
<!--ADSL-->
<add key="3" value="403d4efb-f901-4bfc-ad26-e390e2a27d97"></add>
<!--Micronet Wireless csomagok-->
<add key="4" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Micronet Eszközök -->
<add key="5" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Micronet Egyéb szolgáltatások-->
<add key="6" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Micronet Bérelt vonal-->
<add key="7" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Micronet ADSL-->
<add key="8" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--CPS kiegészítő-->
<add key="9" value="5c60d597-8e14-4d39-95e8-a92bef1a2aec"></add>
<!--Micronet VoIp forgalmi díjak-->
<add key="10" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Késedelmi kamatok-->
<add key="11" value="ba8725bc-7ab6-418c-a13f-6d8ef63e34ad"></add>
<!--Domain alapszolgáltatás-->
<add key="12" value="9ce3596a-4191-481d-9b79-b8d6ebe07424"></add>
<!--Domain kiegészítő szolgáltatás-->
<add key="13" value="9ce3596a-4191-481d-9b79-b8d6ebe07424"></add>
<!--Jóváírások CPS-->
<add key="14" value="5c60d597-8e14-4d39-95e8-a92bef1a2aec"></add>
<!--Jóváírások MicroNet-->
<add key="15" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--ADSL kiegészítő-->
<add key="16" value="403d4efb-f901-4bfc-ad26-e390e2a27d97"></add>
<!--Eszköz eladások-->
<add key="17" value="ba8725bc-7ab6-418c-a13f-6d8ef63e34ad"></add>
<!--Voip kiegészítő szolgáltatás-->
<add key="18" value="dab9ed6f-b952-4d52-8cf3-73434d744723"></add>
<!--Mironet Voip alapdíjak-->
<add key="19" value="42f88f83-6a8f-4f14-9866-84ea28332839"></add>
<!--Mikroweb üzleti internet-->
<add key="20" value="e71fb1d7-d0b9-40c5-90ae-f4ee8359b359"></add>
<!--Mobil-->
<add key="21" value="dcdecd83-d583-422c-830c-6db2b48724b5"></add>
<!--Mobil készülék értékesítés-->
<add key="22" value="dcdecd83-d583-422c-830c-6db2b48724b5"></add>
</Services_CostHolder>
<Services_VAT>
<!--afanev - VAT Oid-->
<add key="27" value="7a0ed725-9286-4386-81b0-2e47457a0697"></add>
<add key="20" value="0131855a-f2a2-482b-81e5-4a1425f783c5"></add>
<add key="0" value="31a39772-68ad-424c-ae13-6ea72bdeafd1"></add>
<add key="25" value="43d67aa2-d601-4379-8dc0-c559ede493d4"></add>
</Services_VAT>
</configuration>
@@ -0,0 +1,19 @@
Imports DevExpress.Xpo
Imports DevExpress.Persistent.AuditTrail
Imports DevExpress.Persistent.BaseImpl
Public Module AuditTrailHandler
Public Sub InitAuditTrail(_uow As UnitOfWork)
AuditTrailService.Instance.SetXPDictionary(_uow.Dictionary)
AuditTrailService.Instance.AuditDataStore = New AuditDataStore(Of AuditDataItemPersistent, AuditedObjectWeakReference)()
AuditTrailService.Instance.BeginSessionAudit(_uow, AuditTrailStrategy.OnObjectChanged, ObjectAuditingMode.Full)
AddHandler AuditTrailService.Instance.QueryCurrentUserName, AddressOf AuditTrailService_Instance_QueryCurrentUserName
End Sub
Public Sub SaveAuditTrail(_uow As UnitOfWork)
AuditTrailService.Instance.SaveAuditData(_uow)
End Sub
Private Sub AuditTrailService_Instance_QueryCurrentUserName(sender As Object, e As QueryCurrentUserNameEventArgs)
e.CurrentUserName = "SysAdmin"
End Sub
End Module
@@ -0,0 +1,162 @@
Imports System.Xml
Imports DevExpress.Xpo
Imports System.Configuration
Imports SISBusiness.RabbitMQ.Module
Imports DevExpress.Data.Filtering
Imports System.Collections.Specialized
Imports DevExpress.Persistent.BaseImpl
Imports SISBusiness.Module
Public Module GetCustomers
Public Sub CustomerImport(_XML As XmlDocument, _RootXMLTag As String, _errorLogFile As String)
Try
Dim _Oid_DH As String = _XML.SelectSingleNode(_RootXMLTag + "/id").InnerText
Dim _uow As UnitOfWork
Dim _Session As New Session
_Session.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
_Session.Connect()
If _Session.IsConnected Then
_uow = New UnitOfWork(_Session.DataLayer)
'_uow.Dictionary.GetDataStoreSchema(GetType(Customers).Assembly)
'InitAuditTrail(_uow)
Console.WriteLine(String.Format("Fogadás... {0} OID_DH:{1} Ügyfélszám:{2}", GLOBAL_Index.ToString, _Oid_DH, _XML.SelectSingleNode(_RootXMLTag + "/ugyfelszam").InnerText))
GLOBAL_Index += 1
Dim _Customers As Customers = _uow.FindObject(Of Customers)(CriteriaOperator.Parse("CustomerNumber=?", _Oid_DH))
If _Customers Is Nothing Then
_Customers = _uow.FindObject(Of Customers)(CriteriaOperator.Parse("Oid_DH=?", _Oid_DH))
End If
If _Customers IsNot Nothing Then
_Customers.Oid_DH = _Oid_DH
If _Customers.Name <> _XML.SelectSingleNode(_RootXMLTag + "/nev").InnerText Then
_Customers.Name = _XML.SelectSingleNode(_RootXMLTag + "/nev").InnerText
_Customers.FullName = _Customers.Name
End If
Dim _konyvelesi_parameter As String = _XML.SelectSingleNode(_RootXMLTag + "/konyvelesi_parameter").InnerText
Dim _NameValueCollection As NameValueCollection = ConfigurationManager.GetSection("CustomersGLParameters")
Dim _CustomersGLParameters As CustomersGLParameters = _uow.FindObject(Of CustomersGLParameters)(CriteriaOperator.Parse("Oid=?", _NameValueCollection(_konyvelesi_parameter)))
_Customers.CustomersGLParameters = _CustomersGLParameters
Dim _Address1City As String = _XML.SelectSingleNode(_RootXMLTag + "/varos").InnerText
Dim _Address1Street As String = _XML.SelectSingleNode(_RootXMLTag + "/utca").InnerText + " " + _XML.SelectSingleNode(_RootXMLTag + "/hazszam").InnerText
Dim _Address1ZipPostal As String = _XML.SelectSingleNode(_RootXMLTag + "/irszam").InnerText
Dim _Address1 As Address = _uow.FindObject(Of Address)(CriteriaOperator.Parse("City=? AND Street=? AND ZipPostal=?", _Address1City, _Address1Street, _Address1ZipPostal))
If _Address1 Is Nothing Then
_Address1 = New Address(_uow)
With _Address1
.City = _Address1City
.Street = _Address1Street
.ZipPostal = _Address1ZipPostal
End With
_Customers.Address1 = _Address1
End If
Dim _Address2City As String = _XML.SelectSingleNode(_RootXMLTag + "/levelezesivaros").InnerText
Dim _Address2Street As String = _XML.SelectSingleNode(_RootXMLTag + "/levelezesiutca").InnerText + " " + _XML.SelectSingleNode(_RootXMLTag + "/levelezesihazszam").InnerText
Dim _Address2ZipPostal As String = _XML.SelectSingleNode(_RootXMLTag + "/levelezesiirszam").InnerText
Dim _Address2 As Address = _uow.FindObject(Of Address)(CriteriaOperator.Parse("City=? AND Street=? AND ZipPostal=?", _Address2City, _Address2Street, _Address2ZipPostal))
If _Address2 Is Nothing Then
_Address2 = New Address(_uow)
With _Address2
.City = _Address2City
.Street = _Address2Street
.ZipPostal = _Address2ZipPostal
End With
_Customers.Address1 = _Address1
End If
Dim _XmlNodeList As XmlNodeList = _XML.SelectNodes(_RootXMLTag + "/bankszamlaszamok")
For Each _XmlNode As XmlNode In _XmlNodeList
If _XmlNode.HasChildNodes Then
For Each _XmlNode_Bank As XmlNode In _XmlNode.ChildNodes
Dim _AccountNumber As String = _XmlNode_Bank.SelectSingleNode("bankszamlaszam").InnerText
Dim _ShortName As String = _Customers.FullName + " " + _AccountNumber
Dim _CustomerBankAccounts As CustomerBankAccounts = _uow.FindObject(Of CustomerBankAccounts)(CriteriaOperator.Parse("AccountNumber=? AND ShortName=?", _AccountNumber, _ShortName))
If _CustomerBankAccounts Is Nothing Then
_CustomerBankAccounts = New CustomerBankAccounts(_uow)
With _CustomerBankAccounts
.AccountNumber = _XmlNode_Bank.SelectSingleNode("bankszamlaszam").InnerText
.Customers = _Customers
.ShortName = _Customers.FullName + " " + .AccountNumber
Select Case _XmlNode_Bank.SelectSingleNode("automatikusfeldolgozas").InnerText
Case "1"
.AutomaticProcessing = True
Case "0"
.AutomaticProcessing = False
Case Else
.AutomaticProcessing = False
End Select
End With
_Customers.CustomerBankAccounts.Add(_CustomerBankAccounts)
End If
Next
End If
Next
_Customers.QueueUpdated = GetSQLTime(_uow)
Else
_Customers = New Customers(_uow)
With _Customers
.Oid_DH = _Oid_DH
.CustomerNumber = _XML.SelectSingleNode(_RootXMLTag + "/ugyfelszam").InnerText
.Name = _XML.SelectSingleNode(_RootXMLTag + "/nev").InnerText
.FullName = .Name
Dim _konyvelesi_parameter As String = _XML.SelectSingleNode(_RootXMLTag + "/konyvelesi_parameter").InnerText
Dim _NameValueCollection As NameValueCollection = ConfigurationManager.GetSection("CustomersGLParameters")
Dim _CustomersGLParameters As CustomersGLParameters = _uow.FindObject(Of CustomersGLParameters)(CriteriaOperator.Parse("Oid=?", _NameValueCollection(_konyvelesi_parameter)))
.CustomersGLParameters = _CustomersGLParameters
Dim _Address1 As New Address(_uow)
With _Address1
.City = _XML.SelectSingleNode(_RootXMLTag + "/varos").InnerText
.Street = _XML.SelectSingleNode(_RootXMLTag + "/utca").InnerText + " " + _XML.SelectSingleNode(_RootXMLTag + "/hazszam").InnerText
.ZipPostal = _XML.SelectSingleNode(_RootXMLTag + "/irszam").InnerText
End With
.Address1 = _Address1
Dim _Address2 As New Address(_uow)
With _Address2
.City = _XML.SelectSingleNode(_RootXMLTag + "/levelezesivaros").InnerText
.Street = _XML.SelectSingleNode(_RootXMLTag + "/levelezesiutca").InnerText + " " + _XML.SelectSingleNode(_RootXMLTag + "/levelezesihazszam").InnerText
.ZipPostal = _XML.SelectSingleNode(_RootXMLTag + "/levelezesiirszam").InnerText
End With
.Address2 = _Address2
Dim _XmlNodeList As XmlNodeList = _XML.SelectNodes(_RootXMLTag + "/bankszamlaszamok")
For Each _XmlNode As XmlNode In _XmlNodeList
If _XmlNode.HasChildNodes Then
For Each _XmlNode_Bank As XmlNode In _XmlNode.ChildNodes
Dim _CustomerBankAccounts As New CustomerBankAccounts(_uow)
With _CustomerBankAccounts
.AccountNumber = _XmlNode_Bank.SelectSingleNode("bankszamlaszam").InnerText
.Customers = _Customers
.ShortName = "Bank-" & _Customers.CustomerNumber
End With
.CustomerBankAccounts.Add(_CustomerBankAccounts)
Next
End If
Next
End With
End If
'SaveAuditTrail(_uow)
_uow.CommitChanges()
If _Session.IsConnected Then
_Session.Disconnect()
End If
End If
Catch ex As Exception
WriteErrorLog(Now + " : " + ex.Message, _errorLogFile)
End Try
End Sub
End Module
@@ -0,0 +1,202 @@
Imports System.Xml
Imports System.Configuration
Imports DevExpress.Xpo
Imports SISBusiness.Module
Imports DevExpress.Data.Filtering
Imports System.Collections.Specialized
Public Module GetGLAccounts
Public Sub GLAccountImport(_XML As XmlDocument, _errorLogFile As String)
Dim _StartTime As DateTime = Now
GetCustomers.CustomerImport(_XML, "JsonXML/params/ugyfel", _errorLogFile)
Dim _decimalSeparator As String = Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator
Dim _groupSeparator As String = Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberGroupSeparator
Dim _uow As UnitOfWork
Dim _Session As New Session
Dim _Customers As Customers
_Session.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
_Session.Connect()
If _Session.IsConnected Then
_uow = New UnitOfWork(_Session.DataLayer)
_uow.Dictionary.GetDataStoreSchema(GetType(GLAccounts).Assembly)
InitAuditTrail(_uow)
Dim _GLAccounts As GLAccounts = _uow.FindObject(Of GLAccounts) _
(CriteriaOperator.Parse("PartnerType=0 and CustomersFrom=? and Customers.CustomerNumber=? and DocumentNumber=?", _
ConfigurationManager.AppSettings("CustomersFrom").ToString, _XML.SelectSingleNode("JsonXML/params/ugyfelszam").InnerText.ToString, _
_XML.SelectSingleNode("JsonXML/params/szamlasorszam").InnerText.ToString))
Dim _GLRows As GLRows
Dim _BruttoHUF As Double = 0, _BruttoDEV As Double = 0
Dim _VATHUF As Double = 0, _VATDEV As Double = 0
Dim _NettoHUF As Double = 0, _NettoDEV As Double = 0
Dim _GUID As Guid = Guid.NewGuid
Dim _NV_Controlling As NameValueCollection = ConfigurationManager.GetSection("Services_Controlling")
Dim _NV_CostHolder As NameValueCollection = ConfigurationManager.GetSection("Services_CostHolder")
Dim _NV_VAT As NameValueCollection = ConfigurationManager.GetSection("Services_VAT")
If _GLAccounts Is Nothing Then
_Customers = _uow.FindObject(Of Customers)(CriteriaOperator.Parse("CustomerNumber=?", _XML.SelectSingleNode("JsonXML/params/ugyfelszam").InnerText.ToString))
If _Customers Is Nothing Then
WriteErrorLog("Nincs ügyfél rögzítve ! -> " + _XML.SelectSingleNode("JsonXML/params/ügyfelszam").InnerText.ToString, _errorLogFile)
Exit Sub
End If
_GLAccounts = New GLAccounts(_uow)
_GLAccounts.IsEditable = True
_GLAccounts.IsStorno = False
_GLAccounts.PartnerType = ePartnerType.eReceivables
_GLAccounts.Customers = _Customers
_GLAccounts.CustomersFrom = _uow.FindObject(Of CustomersFrom)(CriteriaOperator.Parse("Oid=?", ConfigurationManager.AppSettings("CustomersFrom").ToString))
_GLAccounts.ConnectInfo = _XML.SelectSingleNode("JsonXML/params/szamlasorszam").InnerText.ToString
_GLAccounts.DocumentNumber = _XML.SelectSingleNode("JsonXML/params/szamlasorszam").InnerText.ToString
_GLAccounts.DateCreated = _XML.SelectSingleNode("JsonXML/params/kiallitas").InnerText.ToString
_GLAccounts.DateExecution = _XML.SelectSingleNode("JsonXML/params/teljesites").InnerText.ToString
_GLAccounts.DatePayment = _XML.SelectSingleNode("JsonXML/params/hatarido").InnerText.ToString
_GLAccounts.NoteHeader = _XML.SelectSingleNode("JsonXML/params/megjegyzes").InnerText.ToString
_GLAccounts.CurrencyName = _uow.FindObject(Of CurrencyName)(CriteriaOperator.Parse("ShortName='HUF'"))
_GLAccounts.PaymentOption = _uow.FindObject(Of PaymentOption)(CriteriaOperator.Parse("ShortName='ÁTUTALÁS'"))
Dim _XmlNodeList As XmlNodeList = _XML.SelectNodes("JsonXML/params/szamlasorok")
For Each _XmlNode As XmlNode In _XmlNodeList
If _XmlNode.HasChildNodes Then
For Each _XmlNode_szamlasorok As XmlNode In _XmlNode.ChildNodes
_GLAccounts.row_Controlling = _uow.FindObject(Of Controlling)(CriteriaOperator.Parse("Oid=?", _NV_Controlling(_XmlNode_szamlasorok.SelectSingleNode("szolgaltatas/szolgaltatascsoport/id").InnerText)))
_GLAccounts.row_CostHolder = _uow.FindObject(Of CostHolder)(CriteriaOperator.Parse("Oid=?", _NV_CostHolder(_XmlNode_szamlasorok.SelectSingleNode("szolgaltatas/szolgaltatascsoport/id").InnerText)))
_GLAccounts.row_VAT = _uow.FindObject(Of VAT)(CriteriaOperator.Parse("Oid=?", _NV_VAT(_XmlNode_szamlasorok.SelectSingleNode("afanev").InnerText)))
_GLAccounts.row_ChartOfAccounts = _GLAccounts.row_Controlling.GetChartOfAccounts(_GLAccounts.DateExecution.Year, False)
_GLAccounts.row_AmountDEV = 0
_GLAccounts.row_AmountHUF = CDbl(Replace(_XmlNode_szamlasorok.SelectSingleNode("nettoar").InnerText, ".", _decimalSeparator))
_GLAccounts.row_DateVAT = _GLAccounts.DateExecution
_GLAccounts.row_NoteRows = _XmlNode_szamlasorok.SelectSingleNode("megnevezes").InnerText + vbNewLine + _XmlNode_szamlasorok.SelectSingleNode("megjegyzes").InnerText
_GLAccounts.row_UniqueObjects = Nothing
_GLAccounts.row_JobNumberObjects = Nothing
_GLAccounts.row_CostPlace = Nothing
_GLAccounts.row_ConnectInfo = _GLAccounts.ConnectInfo
If _GLAccounts.PartnerType = ePartnerType.eReceivables Then
_GLAccounts.PartnerType = ePartnerType.eReceivables
_GLAccounts.row_CreditChartOfAccounts = _GLAccounts.row_ChartOfAccounts
_GLAccounts.row_DebitChartOfAccounts = _GLAccounts.Customers.CustomersGLParameters.GetChartOfAccounts(_GLAccounts.DateExecution.Year, eVATMode.eOut)
Else
_GLAccounts.PartnerType = ePartnerType.ePayabels
_GLAccounts.row_CreditChartOfAccounts = _GLAccounts.Customers.CustomersGLParameters.GetChartOfAccounts(_GLAccounts.DateExecution.Year, eVATMode.eIn)
_GLAccounts.row_DebitChartOfAccounts = _GLAccounts.row_ChartOfAccounts
End If
_BruttoHUF = _GLAccounts.row_AmountHUF
If _GLAccounts.row_VAT IsNot Nothing Then
If _GLAccounts.row_VAT.InversState = True Then
_VATHUF = Math.Round(_BruttoHUF * _GLAccounts.row_VAT.InversKeyValue, 0, MidpointRounding.AwayFromZero)
_NettoHUF = _BruttoHUF
_BruttoHUF = _NettoHUF + _VATHUF
Else
_VATHUF = Math.Round(_BruttoHUF / (1 + _GLAccounts.row_VAT.KeyValue) * _GLAccounts.row_VAT.KeyValue, 0, MidpointRounding.AwayFromZero)
_NettoHUF = _BruttoHUF - _VATHUF
End If
Else
_VATHUF = 0
_NettoHUF = _BruttoHUF - _VATHUF
End If
' -- ÁFA vizsgálata --------------------------------------------------------------------------------------------
' -- Létrehoz egy sort a nettó összegre ------------------------------------------------------------------------------------------
_GLRows = New GLRows(_uow)
_GLRows.PartnerType = _GLAccounts.PartnerType
If _GLRows.PartnerType = ePartnerType.eReceivables Then
_GLRows.DebitAmountHUF = _NettoHUF
_GLRows.DebitAmountDEV = _NettoDEV
Else
_GLRows.CreditAmountHUF = _NettoHUF
_GLRows.CreditAmountDEV = _NettoDEV
End If
_GLRows.AddGLRows(_GLAccounts, _GLAccounts.row_DebitChartOfAccounts, _GLAccounts.row_CreditChartOfAccounts, _
_NettoDEV, _NettoHUF, Nothing, _
_GLAccounts.Customers, _GLAccounts.row_DateVAT, _GLAccounts.row_VAT, _
_GLAccounts.row_NoteRows, _GLAccounts.row_UniqueObjects, _
_GLAccounts.row_Controlling, _GLAccounts.row_JobNumberObjects, _GLAccounts.row_CostPlace, _
_GLAccounts.row_CostHolder, _GLAccounts.row_ConnectInfo, eGLRowsTypeVAT.eNettoRow, _GUID, _
eTransactionType.eNotSet, eCashType.ePartner, _GLAccounts.PartnerType)
Next
End If
Next
'-- ÁFA összesítés egy, egy sorban !
Dim _XmlNodeList_afaosszesites As XmlNodeList = _XML.SelectNodes("JsonXML/params/afaosszesitesek")
For Each _XmlNode As XmlNode In _XmlNodeList_afaosszesites
If _XmlNode.HasChildNodes Then
For Each _XmlNode_afaosszesites As XmlNode In _XmlNode.ChildNodes
_VATHUF = CDbl(Replace(_XmlNode_afaosszesites.SelectSingleNode("afa").InnerText, ".", _decimalSeparator))
_GLAccounts.row_VAT = _uow.FindObject(Of VAT)(CriteriaOperator.Parse("Oid=?", _NV_VAT(_XmlNode_afaosszesites.SelectSingleNode("afakulcs").InnerText)))
_GLAccounts.row_CreditChartOfAccounts = _GLAccounts.row_VAT.GetChartOfAccounts(_GLAccounts.DateExecution.Year, eVATMode.eOut)
_GLAccounts.row_DebitChartOfAccounts = _GLAccounts.Customers.CustomersGLParameters.GetChartOfAccounts(_GLAccounts.DateExecution.Year, eVATMode.eOut)
_GLRows = New GLRows(_uow)
_GLRows.PartnerType = _GLAccounts.PartnerType
If _GLRows.PartnerType = ePartnerType.eReceivables Then
_GLRows.DebitAmountHUF = _VATHUF
_GLRows.DebitAmountDEV = _VATDEV
Else
_GLRows.CreditAmountHUF = _VATHUF
_GLRows.CreditAmountDEV = _VATDEV
End If
_GLRows.AddGLRows(_GLAccounts, _GLAccounts.row_DebitChartOfAccounts, _GLAccounts.row_CreditChartOfAccounts, _
_VATDEV, _VATHUF, _GLAccounts.row_LiquidAssets, _
_GLAccounts.Customers, _GLAccounts.row_DateVAT, _GLAccounts.row_VAT, _GLAccounts.row_NoteRows, _
_GLAccounts.row_UniqueObjects, _GLAccounts.row_Controlling, _GLAccounts.row_JobNumberObjects, _
_GLAccounts.row_CostPlace, _GLAccounts.row_CostHolder, _GLAccounts.row_ConnectInfo, _
eGLRowsTypeVAT.eVATRow, Nothing, eTransactionType.eNotSet, eCashType.ePartner, _GLAccounts.PartnerType)
Next
End If
Next
'// Számla véglegesítése
_GLAccounts.IsEditable = False
For Each _GLRows In _GLAccounts.GLRows
_GLRows.ConnectInfo = _GLAccounts.row_ConnectInfo
_GLRows.DateVAT = _GLAccounts.row_DateVAT
If _GLRows.GLHeader.CurrencyName.ShortName <> "HUF" Then
If _GLAccounts.PartnerType = ePartnerType.ePayabels Then
If _GLRows.GLRowsTypeVAT <> eGLRowsTypeVAT.eVATRow Then
_GLRows.AmountHUF = Math.Round(Math.Round(_GLAccounts.CurrencyRate, 2, MidpointRounding.AwayFromZero) * Math.Round(_GLRows.AmountDEV, 2, MidpointRounding.AwayFromZero), 0, MidpointRounding.AwayFromZero)
End If
If _GLRows.GLRowsTypeVAT = eGLRowsTypeVAT.eVATRow Then
_GLRows.AmountHUF = Math.Round(Math.Round(_GLAccounts.CurrencyRateVAT, 2, MidpointRounding.AwayFromZero) * Math.Round(_GLRows.AmountDEV, 2, MidpointRounding.AwayFromZero), 0, MidpointRounding.AwayFromZero)
End If
Else
_GLRows.AmountHUF = Math.Round(Math.Round(_GLAccounts.CurrencyRate, 2, MidpointRounding.AwayFromZero) * Math.Round(_GLRows.AmountDEV, 2, MidpointRounding.AwayFromZero), 0, MidpointRounding.AwayFromZero)
End If
End If
Next
_GLAccounts.RecalculateTotal()
End If
_uow.CommitChanges()
SaveAuditTrail(_uow)
GLFunctions.ReconfigurePCI(_uow, _GLAccounts.CustomersFrom, _GLAccounts.Customers, _GLAccounts.PartnerType, _GLAccounts.ConnectInfo)
_uow.CommitChanges()
Dim _EndTime As DateTime = Now
Dim _ActTime As TimeSpan = _EndTime.Subtract(_StartTime)
WriteStatisticFile(String.Format("Current time: {0}, Record: [Customer: {1}, GLAccounts: {2}]", _ActTime.ToString, _Customers.Oid_DH, _GLAccounts.DocumentNumber), Environment.CurrentDirectory + "Statistic.txt")
End If
If _Session.IsConnected Then _Session.Disconnect()
End Sub
End Module
@@ -0,0 +1,16 @@
Imports System.IO
Public Module GlobalVariables
Public GLOBAL_Index As Int32 = 0
Public Sub WriteErrorLog(_ex As String, _errorLogFile As String)
Dim _StreamWriter As New StreamWriter(_errorLogFile, True)
_StreamWriter.WriteLine(_ex)
_StreamWriter.Close()
End Sub
Public Sub WriteStatisticFile(_Text As String, _StatLogFile As String)
Dim _StreamWriter As New StreamWriter(_StatLogFile, True)
_StreamWriter.WriteLine(_Text)
_StreamWriter.Close()
End Sub
End Module
@@ -0,0 +1,13 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34003
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>2</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>
@@ -0,0 +1,35 @@
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("SISBusiness.RabbitMQ.Console")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("SISBusiness.RabbitMQ.Console")>
<Assembly: AssemblyCopyright("Copyright © 2013")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("7b9fe2ea-e769-459c-9d4c-ac6fc7c7ac0c")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("13.2.6.1001")>
<Assembly: AssemblyFileVersion("13.2.6.1001")>
@@ -0,0 +1,63 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34003
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Imports System
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set
resourceCulture = value
End Set
End Property
End Module
End Namespace
@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
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">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</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 for serialized 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="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<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>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
@@ -0,0 +1,73 @@
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34003
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.My.MySettings
Get
Return Global.My.MySettings.Default
End Get
End Property
End Module
End Namespace
@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" UseMySettingsClassName="true">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
+185
View File
@@ -0,0 +1,185 @@
Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports System.Configuration
Imports DevExpress.Persistent.Base
Imports DevExpress.ExpressApp
Imports System.Collections
Imports DevExpress.ExpressApp.Xpo
Imports System.ServiceModel
Imports System.Runtime.Remoting.Channels
Imports System.Security.Principal
Imports System.Threading
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.AuditTrail
Imports RabbitMQ.Client
Imports RabbitMQ.ServiceModel
Imports RabbitMQ.Client.Events
Imports Newtonsoft.Json
Imports DevExpress.Xpo
Imports SISBusiness.Module
Imports DevExpress.Data.Filtering
Imports System.Xml
Imports System.IO
Imports System.Collections.Specialized
Imports SISBusiness.RabbitMQ.Module
Friend Class Program
Private Shared _Session As DevExpress.Xpo.Session
Private Shared _TimerCore As System.Threading.Timer
Private Shared _Semaphor As Boolean = True
Private Shared _ErrorLogPath As String
Private Shared _StatLogPath As String
Shared Sub Main(ByVal args() As String)
Dim _ErrorFileHandling As String() = (ConfigurationManager.AppSettings("ErrorLogPath")).Split(New Char() {";"c})
If _ErrorFileHandling(0).Replace("Path=", "") = "CurrentDirectory" Then
_ErrorLogPath = Environment.CurrentDirectory + _ErrorFileHandling(1).Replace("FileName=", "")
Else
_ErrorLogPath = _ErrorFileHandling(0).Replace("Path=", "") + _ErrorFileHandling(1).Replace("FileName=", "")
End If
Dim _RunningMode As String = ConfigurationManager.AppSettings("RunningMode")
_Session = LoginSession()
If _Session IsNot Nothing Then
If _Session.IsConnected Then
Select Case _RunningMode
Case "0" 'Olvas
Try
Console.WriteLine("SIS Business RabbitMQ console application version 1.2.10234, XAF Version: 12.2.11, RabbitMQ version: 3.2.1")
Console.WriteLine(_ErrorLogPath)
ValueManager.ValueManagerType = GetType(MultiThreadValueManager(Of )).GetGenericTypeDefinition()
Dim _Factory_HostName As String = ConfigurationManager.AppSettings("Factory_HostName")
Dim _Factory_UserName As String = ConfigurationManager.AppSettings("Factory_UserName")
Dim _Factory_Password As String = ConfigurationManager.AppSettings("Factory_Password")
Dim _Factory_VirtualHost As String = ConfigurationManager.AppSettings("Factory_VirtualHost")
Dim _Queue_Name As String = ConfigurationManager.AppSettings("Queue_Name")
Console.WriteLine("Starting...")
Dim _factory As RabbitMQ.Client.ConnectionFactory
Dim _connection As RabbitMQ.Client.IConnection
Dim _channel As RabbitMQ.Client.IModel
Dim _consumer As EventingBasicConsumer
_factory = New ConnectionFactory
_factory.HostName = _Factory_HostName
_factory.UserName = _Factory_UserName
_factory.Password = _Factory_Password
_factory.VirtualHost = _Factory_VirtualHost
_factory.RequestedChannelMax = 10
_connection = _factory.CreateConnection
_channel = _connection.CreateModel
Console.WriteLine("Setup...")
_consumer = New EventingBasicConsumer
AddHandler _consumer.Received, AddressOf Consumer_Received
Console.WriteLine("Starting server pool...")
' _channel.BasicConsume(_Queue_Name, False, _consumer) 'Fenthagyni a queue-ban
_channel.BasicConsume(_Queue_Name, True, _consumer) 'Leszedni a queue-ból
Console.WriteLine("Server is started. Press Enter to stop.")
Console.ReadLine()
Console.WriteLine("Stopping...")
'_channel.Dispose()
_channel.Close()
_connection.Close()
Console.WriteLine("Server is stopped.")
Catch e As Exception
Console.WriteLine("Exception occurs: " & e.Message)
Console.WriteLine("Press Enter to close.")
Console.ReadLine()
End Try
Case "1" 'Küld
Try
Console.WriteLine("SIS Business RabbitMQ console application version 1.2.10234, XAF Version: 12.2.11, RabbitMQ version: 3.2.1")
ValueManager.ValueManagerType = GetType(MultiThreadValueManager(Of )).GetGenericTypeDefinition()
Console.WriteLine("Starting...")
Console.WriteLine("Setup...")
_TimerCore = New System.Threading.Timer(AddressOf _TimerCore_Tick, Nothing, 0, 10000)
Console.WriteLine("Starting server send...")
Console.WriteLine("Server is started. Press Enter to stop.")
Console.ReadLine()
Console.WriteLine("Stopping...")
Console.WriteLine("Server is stopped.")
Catch e As Exception
Console.WriteLine("Exception occurs: " & e.Message)
Console.WriteLine("Press Enter to close.")
Console.ReadLine()
End Try
Case "2" 'Mindkettő
Case Else
'Gáz van
End Select
End If
End If
End Sub
Private Shared Sub Consumer_Received(sender As IBasicConsumer, args As BasicDeliverEventArgs)
Try
If _Session IsNot Nothing Then
Dim _JSONText As String = Encoding.UTF8.GetString(args.Body)
Dim _XML As System.Xml.XmlDocument = JsonConvert.DeserializeXmlNode(_JSONText, "JsonXML")
If _XML IsNot Nothing Then
Dim _method As String = _XML.SelectSingleNode("JsonXML/method").InnerText
If _method.Contains("ugyfelimport") Then GetCustomers.CustomerImport(_XML, "JsonXML/params", "", _Session, True)
If _method.Contains("szamlaimport") Then GetGLAccounts.GLAccountImport(_XML, "", _Session, True)
If _method.Contains("get_version") Then SISVersion.SendSISVersion(_XML, args.BasicProperties)
End If
Else
Throw New Exception(String.Format("Nem lehet csatlakozni az SQL serverhez. ConnenctionString:{0}", ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString))
End If
Catch ex As Exception
WriteErrorLog((Now + " " + ex.Message).ToString, _ErrorLogPath)
End Try
End Sub
Private Shared Sub _TimerCore_Tick(ByVal state As Object)
_TimerCore.Change(Timeout.Infinite, 0)
Console.WriteLine("Küldés : " + Now)
PublishCustomers.PublishCustomers(_ErrorLogPath, _Session)
_TimerCore.Change(0, 10000)
End Sub
Private Shared Function LoginSession() As DevExpress.Xpo.Session
Dim _Session As New DevExpress.Xpo.Session
_Session.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
_Session.Connect()
If Not _Session.IsConnected Then
_Session = Nothing
End If
Return _Session
End Function
Private Shared Sub LogoffSession(_Session As DevExpress.Xpo.Session)
_Session.Connection.Close()
End Sub
End Class
@@ -0,0 +1,225 @@
Imports DevExpress.Xpo
Imports System.Configuration
Imports SISBusiness.Module
Imports DevExpress.Data.Filtering
Imports System.Threading
Imports RabbitMQ.Client
Public Module PublishCustomers
Public Sub PublishCustomers(_errorLogFile As String)
Try
Dim _Session As New Session
_Session.ConnectionString = ConfigurationManager.ConnectionStrings.Item("ConnectionString").ConnectionString
_Session.Connect()
If _Session.IsConnected Then
Dim _uow As New UnitOfWork(_Session.DataLayer)
Dim _Customers_Collection As New XPCollection(Of Customers)(_uow, CriteriaOperator.Parse("IsNull(Oid_DH)=False AND Oid_DH<>''")) 'CriteriaOperator.Parse("ObjectChanged>QueueUpdated"))
If _Customers_Collection.Count > 0 Then
Dim _factory As RabbitMQ.Client.ConnectionFactory
Dim _connection As RabbitMQ.Client.IConnection
Dim _channel As RabbitMQ.Client.IModel
_factory = New ConnectionFactory
_factory.HostName = ConfigurationManager.AppSettings("Factory_HostName")
_factory.UserName = ConfigurationManager.AppSettings("Factory_UserName")
_factory.Password = ConfigurationManager.AppSettings("Factory_Password")
_factory.VirtualHost = ConfigurationManager.AppSettings("Factory_VirtualHost")
_connection = _factory.CreateConnection
_channel = _connection.CreateModel
Dim _Exchange_Name = ConfigurationManager.AppSettings("Exchange_Name")
Dim _Exchange_RoutingKey As String = ConfigurationManager.AppSettings("Exchange_RoutingKey")
Dim _IBasicProperties As IBasicProperties = _channel.CreateBasicProperties
For Each _Customers As Customers In _Customers_Collection
If _Customers.ObjectChanged > _Customers.QueueUpdated Then
Dim _Text4Send As String = CreateCustomerText(_Customers, _uow, _errorLogFile)
Dim uTime As Integer
uTime = (DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds
_IBasicProperties.Timestamp = New RabbitMQ.Client.AmqpTimestamp(uTime)
_IBasicProperties.MessageId = Guid.NewGuid().ToString
_IBasicProperties.ContentType = "application/json"
_IBasicProperties.ContentEncoding = "UTF-8"
_IBasicProperties.Headers = New Collections.Generic.Dictionary(Of String, Object)
_IBasicProperties.Headers.Add("mq3c-message-type", "MQ3CMessage_JSON_RPC")
_channel.BasicPublish(_Exchange_Name, _Exchange_RoutingKey, _IBasicProperties, StrToByteArray(_Text4Send))
_Customers.QueueUpdated = GetSQLTime(_uow)
_Customers.Save()
End If
Next
_channel.Close()
_connection.Close()
End If
_uow.CommitChanges()
End If
Catch ex As Exception
WriteErrorLog(Now + " : " + ex.Message, _errorLogFile)
Finally
End Try
End Sub
Public Function StrToByteArray(str As String) As Byte()
Dim encoding As New System.Text.UTF8Encoding()
Return encoding.GetBytes(str)
End Function
Private Function CreateCustomerText(_Customers As Customers, _Session As Session, _errorLogFile As String) As String
Dim _CustomersText As String = ""
Try
_CustomersText += "{""jsonrpc"":""2.0"",""method"":""ugyfelimport"",""params"":{ ""ugyfel"":{"
_CustomersText += """id"":""" + _Customers.Oid_DH + ""","
_CustomersText += """ugyfelszam"":""" + _Customers.CustomerNumber + ""","
'_CustomersText += """kulsougyfelazonosito"":"""","
_CustomersText += """nev"":""" + _Customers.Name + ""","
'_CustomersText += """nev"":""" + "ÁRVÍZTŰRŐTÜKÖRFÚRÓGÉP árvíztűrőtükörfúrógép" + ""","
If _Customers.Address1 IsNot Nothing Then
If _Customers.Address1.Country IsNot Nothing Then
_CustomersText += """orszag"":""" + _Customers.Address1.Country.Name + ""","
Else
_CustomersText += """orszag"":"""","
End If
_CustomersText += """varos"":""" + _Customers.Address1.City + ""","
'_CustomersText += """emajto"":"""","
_CustomersText += """irszam"":""" + _Customers.Address1.ZipPostal + ""","
_CustomersText += """utca"":""" + _Customers.Address1.Street + ""","
Else
_CustomersText += """orszag"":"""","
_CustomersText += """varos"":"""","
''_CustomersText += """emajto"":"""","
_CustomersText += """irszam"":"""","
_CustomersText += """utca"":"""","
End If
'_CustomersText += """hazszam"":"""","
'_CustomersText += """szigsz"":"""","
'_CustomersText += """jogositvanyszam"":"""","
'_CustomersText += """utlevelszam"":"""","
'_CustomersText += """lakcimkartyaszam"":"""","
If _Customers.MotherName IsNot Nothing Then
_CustomersText += """anyjaneve"":""" + _Customers.MotherName + ""","
Else
_CustomersText += """anyjaneve"":"""","
End If
_CustomersText += """szuletesidatum"":""" + Format(_Customers.BirthDate.Date, "yyyy-MM-dd") + ""","
If _Customers.BirthAddress IsNot Nothing Then
_CustomersText += """szuletesihely"":""" + _Customers.BirthAddress.City + ""","
Else
_CustomersText += """szuletesihely"":"""","
End If
'_CustomersText += """szuletesinev"":"""","
'_CustomersText += """meghatalmazott_nev"":"""","
'_CustomersText += """meghatalmazott_szuletesinev"":"""","
'_CustomersText += """meghatalmazott_anyjaneve"":"""","
'_CustomersText += """meghatalmazott_szigsz"":"""","
'_CustomersText += """meghatalmazott_jogositvanyszam"":"""","
'_CustomersText += """meghatalmazott_utlevelszam"":"""","
'_CustomersText += """meghatalmazott_lakcimkartyaszam"":"""","
'_CustomersText += """telefonszam"":"""","
'_CustomersText += """fax"":"""","
_CustomersText += """email"":""" + _Customers.Email + ""","
''_CustomersText += """eszamla_email"":"""","
_CustomersText += """megjegyzes"":""" + _Customers.Description + ""","
'_CustomersText += """kiemelt"":"""","
'_CustomersText += """letrehozva"":"""","
'_CustomersText += """letrehozta"":"""","
'_CustomersText += """modositva"":"""","
'_CustomersText += """modositotta"":"""","
'_CustomersText += """torolve"":"""","
'_CustomersText += """torolte"":"""","
'_CustomersText += """jelleg"":"""","
_CustomersText += """cegjegyzekszam"":""" + _Customers.CompanyRegistrationNumber + ""","
If _Customers.VATNumber IsNot Nothing Then
_CustomersText += """adoszam"":""" + _Customers.VATNumber + ""","
Else
_CustomersText += """adoszam"":"""","
End If
'_CustomersText += """belsomegjegyzes"":"""","
'_CustomersText += """levelezesinev"":"""","
'If _Customers.Address2 IsNot Nothing Then
' If _Customers.Address2.Country IsNot Nothing Then
' _CustomersText += """levelezesiorszag"":""" + _Customers.Address2.Country.Name + ""","
' Else
' _CustomersText += """levelezesiorszag"":"""","
' End If
' _CustomersText += """levelezesivaros"":""" + _Customers.Address2.City + ""","
' _CustomersText += """levelezesiemajto"":"""","
' _CustomersText += """levelezesiutca"":""" + _Customers.Address2.Street + ""","
' _CustomersText += """levelezesihazszam"":"""","
' _CustomersText += """levelezesiirszam"":""" + _Customers.Address2.ZipPostal + ""","
'Else
' _CustomersText += """levelezesiorszag"":"""","
' _CustomersText += """levelezesivaros"":"""","
' _CustomersText += """levelezesiemajto"":"""","
' _CustomersText += """levelezesiutca"":"""","
' _CustomersText += """levelezesihazszam"":"""","
' _CustomersText += """levelezesiirszam"":"""","
'End If
If _Customers.CanUseMarketingInfo Then
_CustomersText += """adataimarketingcelrahasznalhatok"":""1"","
Else
_CustomersText += """adataimarketingcelrahasznalhatok"":""0"","
End If
If _Customers.CanUseMarketingInfoThirdParts Then
_CustomersText += """adataimarketingcelraharmadikfelnekkiadhatok"":""1"","
Else
_CustomersText += """adataimarketingcelraharmadikfelnekkiadhatok"":""0"","
End If
'_CustomersText += """telefonszam2"":"""","
'_CustomersText += """telefonszam3"":"""","
'_CustomersText += """szorszag"":"""","
'_CustomersText += """sznev"":"""","
'_CustomersText += """szadoszam"":"""","
'_CustomersText += """szvaros"":"""","
'_CustomersText += """szemajto"":"""","
'_CustomersText += """szutca"":"""","
'_CustomersText += """szhazszam"":"""","
'_CustomersText += """szirszam"":"""","
'_CustomersText += """ugyfeljutalek"":"""","
'_CustomersText += """befizeteskonyvelendo"":"""","
'_CustomersText += """email_penzugy"":"""","
'_CustomersText += """iszamla_ugyfelazon"":"""","
'_CustomersText += """felszolitando"":"""","
'_CustomersText += """hangbemondastartozas"":"""","
'_CustomersText += """megjegyzes_szamlara"":"""","
'_CustomersText += """kapcsolattarto"":"""","
'_CustomersText += """viszonteladokod"":"""","
'_CustomersText += """viszontelado"":"""","
'_CustomersText += """vevo"":"""","
'_CustomersText += """szallito"":"""","
'_CustomersText += """konyvelesi_parameter"":"""","
'_CustomersText += """partner_ugyfelszam"":"""","
'_CustomersText += """partner_viszonteladokod"":"""","
'_CustomersText += """partner_nev"":"""","
'_CustomersText += """szulo_ugyfel_ugyfelszam"":"""","
'_CustomersText += """szulo_ugyfel_viszonteladokod"":"""","
'_CustomersText += """szulo_ugyfel_nev"":"""","
'_CustomersText += """terulet"":"""","
_CustomersText += """sis_oid"":""" + _Customers.Oid.ToString + ""","
_CustomersText += """bankszamlaszamok"":{"
For Each _CustomerBankAccounts As CustomerBankAccounts In _Customers.CustomerBankAccounts
_CustomersText += """" + CInt(Math.Ceiling(Rnd() * 100000)).ToString + """: {"
'_CustomersText += """id"": """","
_CustomersText += """bankszamlaszam"": """ + _CustomerBankAccounts.AccountNumber + """"
'_CustomersText += """szamlatulajdonos"": """","
'_CustomersText += """megjegyzes"": """","
_CustomersText += "}"
Next
_CustomersText += "}" 'bankszámlaszámok vége vége
_CustomersText += "}},""MQ3CMessage_JSON_RPC"":{"
_CustomersText += "}}" 'params vége és utolsó szekció
Catch ex As Exception
WriteErrorLog(Now + " : " + ex.Message, _errorLogFile)
_CustomersText = ""
End Try
Return _CustomersText
End Function
End Module
@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{4B7A3116-446E-4926-9EE1-EFD38E3FF151}</ProjectGuid>
<OutputType>Exe</OutputType>
<StartupObject>Sub Main</StartupObject>
<RootNamespace>
</RootNamespace>
<AssemblyName>SISBusiness.RabbitMQ.Console</AssemblyName>
<FileAlignment>512</FileAlignment>
<MyType>Console</MyType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>SISBusiness.RabbitMQ.Console.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DocumentationFile>SISBusiness.RabbitMQ.Console.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
</PropertyGroup>
<PropertyGroup>
<OptionExplicit>On</OptionExplicit>
</PropertyGroup>
<PropertyGroup>
<OptionCompare>Binary</OptionCompare>
</PropertyGroup>
<PropertyGroup>
<OptionStrict>Off</OptionStrict>
</PropertyGroup>
<PropertyGroup>
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DevExpress.Data.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.ExpressApp.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.ExpressApp.Xpo.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Persistent.Base.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Persistent.BaseImpl.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="DevExpress.Xpo.v15.2, Version=15.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
</Reference>
<Reference Include="Newtonsoft.Json, Version=4.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\jSON\Bin\Net\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.Client">
<HintPath>..\..\..\..\..\rabbirmq_client\bin\RabbitMQ.Client.dll</HintPath>
</Reference>
<Reference Include="RabbitMQ.ServiceModel">
<HintPath>..\..\..\..\..\rabbirmq_client\bin\RabbitMQ.ServiceModel.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.ServiceModel" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Collections.Generic" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Linq" />
<Import Include="System.Xml.Linq" />
<Import Include="System.Threading.Tasks" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.vb" />
<Compile Include="My Project\AssemblyInfo.vb" />
<Compile Include="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="My Project\Resources.Designer.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="My Project\Settings.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="My Project\Resources.resx">
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
<CustomToolNamespace>My.Resources</CustomToolNamespace>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.vb</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
</None>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\SISBusiness.Module\SISBusiness.Module.vbproj">
<Project>{60bf693f-7dea-4cf6-85bd-ea96829d79dd}</Project>
<Name>SISBusiness.Module</Name>
</ProjectReference>
<ProjectReference Include="..\SISBusiness.RabbitMQ.Module\SISBusiness.RabbitMQ.Module.vbproj">
<Project>{ac6169db-f71a-4c6f-aa54-e21c3057e2a7}</Project>
<Name>SISBusiness.RabbitMQ.Module</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}