First create solution

This commit is contained in:
2017-03-08 11:21:27 +01:00
commit a2fb86bacf
5508 changed files with 1082238 additions and 0 deletions
@@ -0,0 +1,219 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports Microsoft.Office.Interop.Outlook
Imports Microsoft.Office.Interop
Imports System.IO
Imports DevExpress.ExpressApp.ConditionalAppearance
Public Enum eCRMEstate_Leads
eCRM = 0 'Klasszikus CRM rendszerbõl
eCRMEstate = 1 'Ingatlanértékesítési rendszerbõl
eManual = 2 'Manuálisan felvitt
End Enum
<Appearance("Hide CRMEstate_Leads", AppearanceItemType.ViewItem, "eCRMEstate_Leads=0", TargetItems:="CRMEstate_Leads", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide CRM_Leads, CRM_Opportunities", AppearanceItemType.ViewItem, "eCRMEstate_Leads=1", TargetItems:="CRM_Leads;CRM_Opportunities", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("Hide CRM_Leads, CRM_Opportunities,eCRMEstate_Leads", AppearanceItemType.ViewItem, "eCRMEstate_Leads=2", TargetItems:="CRM_Leads;CRM_Opportunities;CRMEstate_Leads", visibility:=Editors.ViewItemVisibility.Hide)> _
<DefaultClassOptions()> _
<NavigationItem("Outlook e-mail")> _
Public Class OutlookEMail
Inherits BaseObject
Private _Recipients As String 'Kinek megy az emil
Private _Subject As String 'Tárgy
Private _HTMLBody As String 'HTML szöveg
Private _EntryID As String = "" 'Outlook item ID
Private _ObjectCreated As Date 'Mikor készült az objektum
Private _UserCreated As User 'Ki készítette
Private _OwnerUser As User
Private _CRM_Leads As CRM_Leads 'Leads-hoz tartozik-e
Private _CRM_Opportunities As CRM_Opportunities
Private _CRMEstate_Leads As CRMEstate_Leads
Private _eCRMEstate_Leads As eCRMEstate_Leads
Private _OutlookEMailIn_Oid As String
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
Dim _CurrentUser As User = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
Me.ObjectCreated = GetSQLTime(Session)
Me.UserCreated = _CurrentUser
End Sub
<Size(255)> _
<RuleRequiredField("OutlookEMail-Recipients", DefaultContexts.Save)> _
Property Recipients As String
Get
Return _Recipients
End Get
Set(value As String)
SetPropertyValue("Recipients", _Recipients, value)
End Set
End Property
<Size(255)> _
<RuleRequiredField("OutlookEMail-Subject", DefaultContexts.Save)> _
Property Subject As String
Get
Return _Subject
End Get
Set(value As String)
SetPropertyValue("Subject", _Subject, value)
End Set
End Property
<Size(-1)> _
Property HTMLBody As String
Get
Return _HTMLBody
End Get
Set(value As String)
SetPropertyValue("HTMLBody", _HTMLBody, value)
End Set
End Property
<Size(255), Browsable(False)> _
Property EntryID As String
Get
Return _EntryID
End Get
Set(value As String)
SetPropertyValue("EntryID", _EntryID, value)
End Set
End Property
<NonCloneable> _
Property ObjectCreated As Date
Get
Return _ObjectCreated
End Get
Set(value As Date)
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<NonCloneable> _
Property UserCreated As User
Get
Return _UserCreated
End Get
Set(value As User)
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
Public Property OwnerUser As User
Get
Return _OwnerUser
End Get
Set(value As User)
SetPropertyValue("OwnerUser", _OwnerUser, value)
End Set
End Property
Property CRM_Leads As CRM_Leads
Get
Return _CRM_Leads
End Get
Set(value As CRM_Leads)
SetPropertyValue("CRM_Leads", _CRM_Leads, value)
End Set
End Property
Public Property CRM_Opportunities As CRM_Opportunities
Get
Return _CRM_Opportunities
End Get
Set(value As CRM_Opportunities)
SetPropertyValue("CRM_Opportunities", _CRM_Opportunities, value)
End Set
End Property
Public Property CRMEstate_Leads As CRMEstate_Leads
Get
Return _CRMEstate_Leads
End Get
Set(value As CRMEstate_Leads)
SetPropertyValue("CRMEstate_Leads", _CRMEstate_Leads, value)
End Set
End Property
<ImmediatePostData()> _
Public Property eCRMEstate_Leads As eCRMEstate_Leads
Get
Return _eCRMEstate_Leads
End Get
Set(value As eCRMEstate_Leads)
SetPropertyValue("eCRMEstate_Leads", _eCRMEstate_Leads, value)
End Set
End Property
<Browsable(False)> _
<VisibleInListView(False)> _
<VisibleInDetailView(False)> _
Public Property OutlookEMailIn_Oid As String
Get
Return _OutlookEMailIn_Oid
End Get
Set(value As String)
SetPropertyValue("OutlookEMailIn_Oid", _OutlookEMailIn_Oid, value)
End Set
End Property
'--- ReadOnly ----------
<VisibleInListView(False)> _
<Association("OutlookEMail-OutlookEMailAttachments", GetType(OutlookEMailAttachments))> _
ReadOnly Property OutlookEMailAttachments As XPCollection(Of OutlookEMailAttachments)
Get
Return GetCollection(Of OutlookEMailAttachments)("OutlookEMailAttachments")
End Get
End Property
'--- Sub---------------
Public Sub SendMail(_OutlookEmail As OutlookEMail, _ObjectSpace As Xpo.XPObjectSpace, Optional _WithCommit As Boolean = False)
Dim _OutlookApp As New Outlook.Application()
Dim _OutlookNameSpace As Outlook.NameSpace
Dim _FdMail As Outlook.MAPIFolder
Dim _Mail_New As Outlook.MailItem = _OutlookApp.CreateItem(OlItemType.olMailItem)
Dim _OutlookEMailAttachments As OutlookEMailAttachments
Dim _FileStream As Stream
Dim _FilePath As String
_OutlookNameSpace = _OutlookApp.GetNamespace("MAPI")
_OutlookNameSpace.Logon(, , True, True)
_FdMail = _OutlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderOutbox)
_Mail_New = _FdMail.Items.Add(Outlook.OlItemType.olMailItem)
_Mail_New.Subject = _OutlookEmail.Subject
_Mail_New.To = _OutlookEmail.Recipients
_Mail_New.HTMLBody = _OutlookEmail.HTMLBody
If _OutlookEmail.OutlookEMailAttachments.Count > 0 Then
For Each _OutlookEMailAttachments In _OutlookEmail.OutlookEMailAttachments
_FilePath = Path.GetTempPath & _OutlookEMailAttachments.DocumentFileData.File.FileName
_FileStream = New FileStream(_FilePath, FileMode.Create)
_OutlookEMailAttachments.DocumentFileData.File.SaveToStream(_FileStream)
Dim _AttachFile As Outlook.Attachments = _Mail_New.Attachments
Dim _Attach As Outlook.Attachment = _AttachFile.Add(_FilePath)
_FileStream.Close()
If System.IO.File.Exists(_FilePath) Then
System.IO.File.Delete(_FilePath)
End If
Next
End If
_Mail_New.Save()
_OutlookEmail.EntryID = _Mail_New.EntryID
_Mail_New.UnRead = True
_Mail_New.Send()
If _WithCommit = True Then
_OutlookEmail.Save()
_ObjectSpace.CommitChanges()
End If
End Sub
End Class
@@ -0,0 +1,53 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class OutlookEMailAttachments
Inherits BaseObject
Private _OutlookEMail As OutlookEMail
Private _OutlookEMailIn As OutlookEMailIn
Private _DocumentFileData As DocumentFileData
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
<Association("OutlookEMail-OutlookEMailAttachments", GetType(OutlookEMail))> _
<Browsable(False)> _
Property OutlookEMail As OutlookEMail
Get
Return _OutlookEMail
End Get
Set(value As OutlookEMail)
SetPropertyValue("OutlookEMail", _OutlookEMail, value)
End Set
End Property
<Association("OutlookEMailIn-OutlookEMailAttachments", GetType(OutlookEMailIn))> _
<Browsable(False)> _
Property OutlookEMailIn As OutlookEMailIn
Get
Return _OutlookEMailIn
End Get
Set(value As OutlookEMailIn)
SetPropertyValue("OutlookEMailIn", _OutlookEMailIn, value)
End Set
End Property
Property DocumentFileData As DocumentFileData
Get
Return _DocumentFileData
End Get
Set(value As DocumentFileData)
SetPropertyValue("DocumentFileData", _DocumentFileData, value)
End Set
End Property
End Class
@@ -0,0 +1,176 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.ConditionalAppearance
Imports System.Drawing
Imports DevExpress.ExpressApp.Utils
<DefaultClassOptions()> _
<NavigationItem("Outlook e-mail")> _
<Appearance("Hide EntryID", AppearanceItemType.ViewItem, "1=1", TargetItems:="EntryID", visibility:=Editors.ViewItemVisibility.Hide)> _
<DeferredDeletion(False)> _
<CreatableItem(False)> _
Public Class OutlookEMailIn
Inherits BaseObject
Private _SenderName As String
Private _SenderEmailAddress As String
Private _EmailSubject As String
Private _EmailBody As String
Private _EntryID As String
Private _ObjectCreated As Date 'Mikor készült az objektum
Private _OwnerUser As User
Private _UserCreated As User 'Ki készítette
Private _ReceivedTime As Date
Private _ReceiverEmailAdress As String '
Private _Qualified As Boolean 'Elintézett-e?
Private _IsReaded As Boolean 'Elolvasott-e?
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
MyBase.AfterConstruction()
IsReaded = False
Qualified = False
End Sub
Protected Overrides Sub OnSaving()
MyBase.OnSaving()
If Session.IsNewObject(Me) Then
Dim _CurrentUser As User = Session.GetObjectByKey(Of User)(Session.GetKeyValue(SecuritySystem.CurrentUser))
ObjectCreated = GetSQLTime(Session)
UserCreated = _CurrentUser
End If
End Sub
<Size(255)> _
Property SenderName As String
Get
Return _SenderName
End Get
Set(value As String)
SetPropertyValue("SenderName", _SenderName, value)
End Set
End Property
<Size(255)> _
Property SenderEmailAddress As String
Get
Return _SenderEmailAddress
End Get
Set(value As String)
SetPropertyValue("SenderEmailAddress", _SenderEmailAddress, value)
End Set
End Property
<Size(255)> _
Property EmailSubject As String
Get
Return _EmailSubject
End Get
Set(value As String)
SetPropertyValue("EmailSubject", _EmailSubject, value)
End Set
End Property
<Size(-1)> _
Property EmailBody As String
Get
Return _EmailBody
End Get
Set(value As String)
SetPropertyValue("EmailBody", _EmailBody, value)
End Set
End Property
<Size(255)> _
<Browsable(False)> _
Property EntryID As String
Get
Return _EntryID
End Get
Set(value As String)
SetPropertyValue("EntryID", _EntryID, value)
End Set
End Property
<NonCloneable> _
Property ObjectCreated As Date
Get
Return _ObjectCreated
End Get
Set(value As Date)
SetPropertyValue("ObjectCreated", _ObjectCreated, value)
End Set
End Property
<NonCloneable> _
Property UserCreated As User
Get
Return _UserCreated
End Get
Set(value As User)
SetPropertyValue("UserCreated", _UserCreated, value)
End Set
End Property
Property ReceivedTime As Date
Get
Return _ReceivedTime
End Get
Set(value As Date)
SetPropertyValue("ReceivedTime", _ReceivedTime, value)
End Set
End Property
Property OwnerUser As User
Get
Return _OwnerUser
End Get
Set(value As User)
SetPropertyValue("OwnerUser", _OwnerUser, value)
End Set
End Property
Property ReceiverEmailAdress As String
Get
Return _ReceiverEmailAdress
End Get
Set(value As String)
SetPropertyValue("ReceiverEmailAdress", _ReceiverEmailAdress, value)
End Set
End Property
Property Qualified As Boolean
Get
Return _Qualified
End Get
Set(value As Boolean)
SetPropertyValue("Qualified", _Qualified, value)
End Set
End Property
Property IsReaded As Boolean
Get
Return _IsReaded
End Get
Set(value As Boolean)
SetPropertyValue("IsReaded", _IsReaded, value)
End Set
End Property
'-------------ReadOnly---------------
<VisibleInListView(False)> _
<Association("OutlookEMailIn-OutlookEMailAttachments", GetType(OutlookEMailAttachments)), Aggregated()> _
ReadOnly Property OutlookEMailAttachments As XPCollection(Of OutlookEMailAttachments)
Get
Return GetCollection(Of OutlookEMailAttachments)("OutlookEMailAttachments")
End Get
End Property
ReadOnly Property OutllokEmailInHasAttachments As Image
Get
Dim _ReturnImage As Image = Nothing
If Me.OutlookEMailAttachments.Count > 0 Then _ReturnImage = ImageLoader.Instance.GetImageInfo("Action_FileAttachment_Attach").Image
If Me.OutlookEMailAttachments.Count = 0 Then _ReturnImage = ImageLoader.Instance.GetImageInfo("NoImage").Image
Return _ReturnImage
End Get
End Property
End Class
@@ -0,0 +1,130 @@
Partial Class OutlookEmailVC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.aSendOutlookEmail = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aRecieveEmails = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aEmailIn_To_CRMLeads = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
Me.aAttachFile = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aViewAttachedFile = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
Me.aEmailIn_To_CRMEstateLeads = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
'
'aSendOutlookEmail
'
Me.aSendOutlookEmail.Caption = "Send email via outlook"
Me.aSendOutlookEmail.ConfirmationMessage = Nothing
Me.aSendOutlookEmail.Id = "aSendOutlookEmail"
Me.aSendOutlookEmail.ImageName = "mail2"
Me.aSendOutlookEmail.Shortcut = Nothing
Me.aSendOutlookEmail.Tag = Nothing
Me.aSendOutlookEmail.TargetObjectsCriteria = Nothing
Me.aSendOutlookEmail.TargetViewId = "OutlookEMail_DetailView"
Me.aSendOutlookEmail.ToolTip = Nothing
Me.aSendOutlookEmail.TypeOfView = Nothing
'
'aRecieveEmails
'
Me.aRecieveEmails.Caption = "Recive Emails"
Me.aRecieveEmails.ConfirmationMessage = "Do you want to execute command ?"
Me.aRecieveEmails.Id = "aRecieveEmails"
Me.aRecieveEmails.ImageName = "server_mail_download"
Me.aRecieveEmails.Shortcut = Nothing
Me.aRecieveEmails.Tag = Nothing
Me.aRecieveEmails.TargetObjectsCriteria = Nothing
Me.aRecieveEmails.TargetObjectType = GetType(Nuvolar.[Module].Win.OutlookEMailIn)
Me.aRecieveEmails.TargetViewId = ""
Me.aRecieveEmails.ToolTip = Nothing
Me.aRecieveEmails.TypeOfView = Nothing
'
'aEmailIn_To_CRMLeads
'
Me.aEmailIn_To_CRMLeads.AcceptButtonCaption = Nothing
Me.aEmailIn_To_CRMLeads.CancelButtonCaption = Nothing
Me.aEmailIn_To_CRMLeads.Caption = "aEmailIn_To_CRMLeads"
Me.aEmailIn_To_CRMLeads.ConfirmationMessage = Nothing
Me.aEmailIn_To_CRMLeads.Id = "aEmailIn_To_CRMLeads"
Me.aEmailIn_To_CRMLeads.ImageName = "BO_Opportunity"
Me.aEmailIn_To_CRMLeads.Shortcut = Nothing
Me.aEmailIn_To_CRMLeads.Tag = Nothing
Me.aEmailIn_To_CRMLeads.TargetObjectsCriteria = Nothing
Me.aEmailIn_To_CRMLeads.TargetViewId = "OutlookEMailIn_ListView"
Me.aEmailIn_To_CRMLeads.ToolTip = Nothing
Me.aEmailIn_To_CRMLeads.TypeOfView = Nothing
'
'aAttachFile
'
Me.aAttachFile.Caption = "Attach file"
Me.aAttachFile.ConfirmationMessage = Nothing
Me.aAttachFile.Id = "aAttachFile"
Me.aAttachFile.ImageName = "Action_FileAttachment_Attach"
Me.aAttachFile.Shortcut = Nothing
Me.aAttachFile.Tag = Nothing
Me.aAttachFile.TargetObjectsCriteria = Nothing
Me.aAttachFile.TargetViewId = Nothing
Me.aAttachFile.ToolTip = Nothing
Me.aAttachFile.TypeOfView = Nothing
'
'aViewAttachedFile
'
Me.aViewAttachedFile.Caption = "View attached File"
Me.aViewAttachedFile.ConfirmationMessage = Nothing
Me.aViewAttachedFile.Id = "aViewAttachedFile"
Me.aViewAttachedFile.ImageName = "BO_Folder"
Me.aViewAttachedFile.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireSingleObject
Me.aViewAttachedFile.Shortcut = Nothing
Me.aViewAttachedFile.Tag = Nothing
Me.aViewAttachedFile.TargetObjectsCriteria = Nothing
Me.aViewAttachedFile.TargetViewId = Nothing
Me.aViewAttachedFile.ToolTip = Nothing
Me.aViewAttachedFile.TypeOfView = Nothing
'
'aEmailIn_To_CRMEstateLeads
'
Me.aEmailIn_To_CRMEstateLeads.AcceptButtonCaption = Nothing
Me.aEmailIn_To_CRMEstateLeads.CancelButtonCaption = Nothing
Me.aEmailIn_To_CRMEstateLeads.Caption = "aEmailIn_To_CRMEstateLeads"
Me.aEmailIn_To_CRMEstateLeads.ConfirmationMessage = Nothing
Me.aEmailIn_To_CRMEstateLeads.Id = "aEmailIn_To_CRMEstateLeads"
Me.aEmailIn_To_CRMEstateLeads.ImageName = "BO_Opportunity"
Me.aEmailIn_To_CRMEstateLeads.SelectionDependencyType = DevExpress.ExpressApp.Actions.SelectionDependencyType.RequireMultipleObjects
Me.aEmailIn_To_CRMEstateLeads.Shortcut = Nothing
Me.aEmailIn_To_CRMEstateLeads.Tag = Nothing
Me.aEmailIn_To_CRMEstateLeads.TargetObjectsCriteria = Nothing
Me.aEmailIn_To_CRMEstateLeads.TargetViewId = "OutlookEMailIn_ListView"
Me.aEmailIn_To_CRMEstateLeads.ToolTip = Nothing
Me.aEmailIn_To_CRMEstateLeads.TypeOfView = Nothing
End Sub
Friend WithEvents aSendOutlookEmail As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aRecieveEmails As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aEmailIn_To_CRMLeads As DevExpress.ExpressApp.Actions.PopupWindowShowAction
Friend WithEvents aAttachFile As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aViewAttachedFile As DevExpress.ExpressApp.Actions.SimpleAction
Friend WithEvents aEmailIn_To_CRMEstateLeads As DevExpress.ExpressApp.Actions.PopupWindowShowAction
End Class
@@ -0,0 +1,141 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="aSendOutlookEmail.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="aRecieveEmails.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 95</value>
</metadata>
<metadata name="aEmailIn_To_CRMLeads.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 173</value>
</metadata>
<metadata name="aAttachFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 212</value>
</metadata>
<metadata name="aViewAttachedFile.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 134</value>
</metadata>
<metadata name="aEmailIn_To_CRMEstateLeads.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>600, 302</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>
@@ -0,0 +1,507 @@
Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports Microsoft.Office.Interop
Imports DevExpress.Persistent.Validation
Imports DevExpress.Xpo
Imports System.IO
Imports DevExpress.Persistent.BaseImpl
Imports Microsoft.Office.Interop.Outlook
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.ExpressApp.CloneObject
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Editors
Imports System.Windows.Forms
Imports DevExpress.ExpressApp.Utils
Public Class OutlookEmailVC
Inherits DevExpress.ExpressApp.ViewController
Dim _WaitFormClass As New WaitFormClass
Protected selection As ArrayList
Protected noselect As Boolean = False
Public Sub New()
MyBase.New()
InitializeComponent()
RegisterActions(components)
selection = New ArrayList()
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
Frame.GetController(Of OutlookEmailVC).aEmailIn_To_CRMEstateLeads.Active.SetItemValue("", False)
If View IsNot Nothing Then
If View.Id = "OutlookEMailIn_ListView" Then
Dim _OutlookEmailListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _CurrentUser As User = _ocur.Session.GetObjectByKey(Of User)(_ocur.Session.GetKeyValue(SecuritySystem.CurrentUser))
_OutlookEmailListView.CollectionSource.Criteria.Add("Criteria1", CriteriaOperator.Parse("ReceiverEmailAdress=?", _CurrentUser.Email))
End If
End If
Frame.GetController(Of OutlookEmailVC).aAttachFile.Active.SetItemValue("", False)
Frame.GetController(Of OutlookEmailVC).aViewAttachedFile.Active.SetItemValue("", False)
If View.Id = "OutlookEMailIn_ListView" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
'Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of ObjectViewController)().Active.SetItemValue("", False)
AddHandler View.SelectionChanged, AddressOf view_SelectionChanged
End If
If View.Id = "OutlookEMailIn_DetailView" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", False)
Frame.GetController(Of ObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of ModificationsController)().Active.SetItemValue("", False)
Frame.GetController(Of CloneObjectViewController)().Active.SetItemValue("", False)
End If
If View.Id = "OutlookEMail_OutlookEMailAttachments_ListView" Then
Frame.GetController(Of LinkUnlinkController)().Active.SetItemValue("", False)
Frame.GetController(Of CloneObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", False)
End If
If View.Id = "OutlookEMail_DetailView" Then
Dim _OutlookEMail As OutlookEMail = TryCast(View.SelectedObjects(0), OutlookEMail)
Dim _OutlookEMailIn As OutlookEMailIn = TryCast(View.SelectedObjects(0), OutlookEMailIn)
If _OutlookEMail IsNot Nothing Then
If _OutlookEMail.EntryID <> "" Then
Frame.GetController(Of OutlookEmailVC)().aSendOutlookEmail.Active.SetItemValue("", False)
End If
Else
If _OutlookEMailIn.EntryID <> "" Then
Frame.GetController(Of OutlookEmailVC)().aSendOutlookEmail.Active.SetItemValue("", False)
End If
End If
End If
If View.Id = "OutlookEMail_OutlookEMailAttachments_ListView" Or _
View.Id = "OutlookEMailIn_OutlookEMailAttachments_ListView" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", False)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", False)
Frame.GetController(Of OutlookEmailVC).aAttachFile.Active.SetItemValue("", True)
Frame.GetController(Of OutlookEmailVC).aViewAttachedFile.Active.SetItemValue("", True)
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OutlookEMailIn_ListView" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DeleteObjectsViewController)().Active.SetItemValue("", True)
Frame.GetController(Of ObjectViewController)().Active.SetItemValue("", True)
RemoveHandler View.SelectionChanged, AddressOf view_SelectionChanged
End If
If View.Id = "OutlookEMail_OutlookEMailAttachments_ListView" Then
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController)().Active.SetItemValue("", True)
End If
If View.Id = "OutlookEMail_DetailView" Then
Dim _OutlookEMail As OutlookEMail = TryCast(View.SelectedObjects(0), OutlookEMail)
Dim _OutlookEMailIn As OutlookEMailIn = TryCast(View.SelectedObjects(0), OutlookEMailIn)
If _OutlookEMail IsNot Nothing Then
If _OutlookEMail.EntryID <> "" Then
Frame.GetController(Of OutlookEmailVC)().aSendOutlookEmail.Active.SetItemValue("", False)
End If
Else
If _OutlookEMailIn.EntryID <> "" Then
Frame.GetController(Of OutlookEmailVC)().aSendOutlookEmail.Active.SetItemValue("", False)
End If
End If
End If
If View.Id = "OutlookEMail_OutlookEMailAttachments_ListView" Or _
View.Id = "OutlookEMailIn_OutlookEMailAttachments_ListView" Then
Frame.GetController(Of NewObjectViewController)().Active.SetItemValue("", True)
Frame.GetController(Of DevExpress.ExpressApp.Win.SystemModule.OpenObjectController)().Active.SetItemValue("", True)
End If
End Sub
Protected Overrides Sub OnViewControlsCreated()
MyBase.OnViewControlsCreated()
If View.Id = "OutlookEMailIn_DetailView" Then
Dim _OutlookEMailIn As OutlookEMailIn = View.SelectedObjects(0)
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _OutlookEMailIn.OutlookEMailAttachments
If _OutlookEMailIn.EmailBody.Contains(_OutlookEMailAttachments.DocumentFileData.File.FileName) Then
Dim _ActCIDText As String = "cid:"
Dim _GenString As String = _OutlookEMailIn.EmailBody.Substring(_OutlookEMailIn.EmailBody.IndexOf(_OutlookEMailAttachments.DocumentFileData.File.FileName))
_GenString = _GenString.Remove(_GenString.IndexOf(Chr(34)), _GenString.Length - _GenString.IndexOf(Chr(34)))
_ActCIDText += _GenString
Dim _fs As New FileStream(Path.GetTempPath() + _OutlookEMailAttachments.DocumentFileData.File.FileName, FileMode.Create)
_OutlookEMailAttachments.DocumentFileData.File.SaveToStream(_fs)
_fs.Close()
_OutlookEMailIn.EmailBody = _OutlookEMailIn.EmailBody.Replace(_ActCIDText, Path.GetTempPath() + _OutlookEMailAttachments.DocumentFileData.File.FileName)
End If
Next
End If
End Sub
Private Sub aSendOutlookEmail_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aSendOutlookEmail.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OutlookEMail As OutlookEMail = TryCast(View.SelectedObjects(0), OutlookEMail)
_OutlookEMail.SendMail(_OutlookEMail, _ocur, True)
Dim _CRM_Leads As CRM_Leads = _OutlookEMail.CRM_Leads
Dim _CRM_Opportunities As CRM_Opportunities = _OutlookEMail.CRM_Opportunities
Dim _CRMEstate_Leads As CRMEstate_Leads = _OutlookEMail.CRMEstate_Leads
'--CRM_Leads; CRM_Opportunities ==>CRM_Leads_Activity-be
If _CRM_Leads IsNot Nothing Then
Dim _CRM_Leads_Activity As CRM_Leads_Activity = _ocur.CreateObject(Of CRM_Leads_Activity)()
_CRM_Leads_Activity.CRM_Leads = _CRM_Leads
_CRM_Leads_Activity.Subject = _OutlookEMail.Subject
_CRM_Leads_Activity.Email_Oid = _OutlookEMail.Oid.ToString()
_CRM_Leads_Activity.EventType = eEventType.eEmailOut
If _CRM_Opportunities IsNot Nothing Then
_CRM_Leads_Activity.CRM_Opportunities = _CRM_Opportunities
End If
End If
If _CRMEstate_Leads IsNot Nothing Then
Dim _CRMEstate_Leads_Activity As CRMEstate_Leads_Activity = _ocur.CreateObject(Of CRMEstate_Leads_Activity)()
_CRMEstate_Leads_Activity.CRMEstate_Leads = _CRMEstate_Leads
_CRMEstate_Leads_Activity.Email_Oid = _OutlookEMail.Oid.ToString()
_CRMEstate_Leads_Activity.Subject = _OutlookEMail.Subject
_CRMEstate_Leads_Activity.EventType = eEventType.eEmailOut
_CRMEstate_Leads_Activity.HRPerson = _CRMEstate_Leads.HRPerson
End If
_ocur.CommitChanges()
View.Close(False)
End Sub
Private Sub aRecieveEmails_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aRecieveEmails.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OutlookApp As New Outlook.Application()
Dim _OutlookNameSpace As Outlook.NameSpace
Dim _FolderMail As Outlook.MAPIFolder
Dim _Mail As Outlook.MailItem
Dim _OutlookEMailIn As OutlookEMailIn
Dim _GO As Boolean = False
Dim _CollectionOfEmailIn As XPCollection = _ocur.CreateCollection(GetType(OutlookEMailIn))
Dim _Mail_New As OutlookEMailIn
Dim _FilePath As String
Dim _fs As FileStream
Dim i As Long = 0
Dim _uow As New UnitOfWork(_ocur.Session.DataLayer)
Dim _FDObject As Object
Dim _CurrentUser As User = _ocur.Session.GetObjectByKey(Of User)(_ocur.Session.GetKeyValue(SecuritySystem.CurrentUser))
Dim _HRPerson As HRPerson = _ocur.FindObject(Of HRPerson)(CriteriaOperator.Parse("User=?", _CurrentUser))
If _HRPerson Is Nothing Then
Throw New System.Exception("Nincs a felhasználó a személyzeti törzsben !")
Exit Sub
End If
If _CurrentUser.Email <> "" Then
_OutlookNameSpace = _OutlookApp.GetNamespace("MAPI")
_OutlookNameSpace.Logon(, , False, True)
'_FolderMail = _OutlookNameSpace.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderInbox)
_FolderMail = _OutlookNameSpace.GetFolderFromID(_HRPerson.DefaultOutlookFolderEntryID)
If _FolderMail Is Nothing Then
Throw New System.Exception("Nem találom a megadott outlook könyvtárat ! ")
Exit Sub
End If
_WaitFormClass.Initwork(1, 1, _FolderMail.Items.Count)
For Each _FDObject In _FolderMail.Items
_Mail = TryCast(_FDObject, MailItem)
If _Mail IsNot Nothing Then
_GO = False
_WaitFormClass.DoWork()
i += 1
For Each _OutlookEMailIn In _CollectionOfEmailIn
If _Mail.EntryID = _OutlookEMailIn.EntryID Then
_GO = True
Exit For
End If
Next
If _GO = False Then
_Mail_New = New OutlookEMailIn(_uow)
'If _Mail.SenderEmailType = "EX" Then
' _Mail_New.SenderEmailAddress = GetExchangeSenderAddress(_Mail, _OutlookNameSpace)
'Else
' _Mail_New.SenderEmailAddress = _Mail.SenderEmailAddress
'End If
_Mail_New.SenderEmailAddress = GetSmtpAddress(_Mail)
_Mail_New.ReceivedTime = _Mail.ReceivedTime
_Mail_New.SenderName = _Mail.SenderName
_Mail_New.EmailSubject = _Mail.Subject
_Mail_New.EmailBody = _Mail.HTMLBody
_Mail_New.EntryID = _Mail.EntryID
_Mail_New.ReceiverEmailAdress = _CurrentUser.Email
If _Mail.Attachments.Count > 0 Then
For Each _Attachment As Outlook.Attachment In _Mail.Attachments
_FilePath = Path.GetTempPath & _Attachment.FileName
_Attachment.SaveAsFile(_FilePath)
Dim _EmailAttachments As OutlookEMailAttachments
Dim _DocumentFileData As DocumentFileData = New DocumentFileData(_uow)
_fs = New FileStream(_FilePath, FileMode.Open)
_DocumentFileData.File = New FileData(_uow)
_DocumentFileData.File.LoadFromStream(Path.GetFileName(_Attachment.FileName), _fs)
_EmailAttachments = New OutlookEMailAttachments(_uow)
_EmailAttachments.DocumentFileData = _DocumentFileData
_Mail_New.OutlookEMailAttachments.Add(_EmailAttachments)
_fs.Close()
If System.IO.File.Exists(_FilePath) Then
System.IO.File.Delete(_FilePath)
End If
Next
End If
'_Mail_New.Save()
If i Mod 100 Then _uow.CommitChanges()
End If
End If
Next
_uow.CommitChanges()
_WaitFormClass.FinalWork()
If Frame.GetController(Of RefreshController).RefreshAction.Enabled Then
Frame.GetController(Of RefreshController).RefreshAction.DoExecute()
End If
Else
_ocur.Rollback()
Throw New System.Exception("Nincs beállítva e-mail cím a bejelentkezett felhasználónak!")
End If
End Sub
Private Function GetSmtpAddress(ByVal item As Outlook.MailItem) As String
Dim sAddress As String
Dim recip As Outlook.Recipient
Dim exUser As Outlook.ExchangeUser
Dim oOutlook As Outlook.Application
Dim oNS As Outlook.NameSpace
On Error Resume Next
oOutlook = New Outlook.Application
oNS = oOutlook.GetNamespace("MAPI")
If UCase$(item.SenderEmailType) = "EX" Then
recip = oNS.CreateRecipient(item.SenderEmailAddress)
exUser = recip.AddressEntry.GetExchangeUser()
sAddress = exUser.PrimarySmtpAddress
Else
sAddress = item.SenderEmailAddress
End If
GetSmtpAddress = sAddress
oNS = Nothing
oOutlook = Nothing
End Function
Private Sub aEmailIn_To_CRMLeads_Cancel(sender As Object, e As System.EventArgs) Handles aEmailIn_To_CRMLeads.Cancel
noselect = False
End Sub
Private Sub aEmailIn_To_CRMLeads_CustomizePopupWindowParams(sender As System.Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aEmailIn_To_CRMLeads.CustomizePopupWindowParams
If View.SelectedObjects.Count > 0 Then
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
noselect = True
Dim _OutlookEmailIn_To_CRMLeads As OutlookEmailIn_To_CRMLeads = _onew.CreateObject(Of OutlookEmailIn_To_CRMLeads)()
Dim _Mail As Outlook.MailItem = TryCast(View.SelectedObjects(0), Outlook.MailItem)
Dim _OutlookEMailIn As OutlookEMailIn = TryCast(View.SelectedObjects(0), OutlookEMailIn)
_OutlookEmailIn_To_CRMLeads.EMail = _OutlookEMailIn.SenderEmailAddress
e.View = Application.CreateDetailView(_onew, "OutlookEmailIn_To_CRMLeads_DetailView", False, _OutlookEmailIn_To_CRMLeads)
View.Refresh()
End If
End Sub
Private Sub aEmailIn_To_CRMLeads_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aEmailIn_To_CRMLeads.Execute
Try
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OutlookEmailIn_To_CRMLeads As OutlookEmailIn_To_CRMLeads = TryCast(e.PopupWindow.View.SelectedObjects(0), OutlookEmailIn_To_CRMLeads)
Dim _OutlookEMailIn As OutlookEMailIn
noselect = True
Select Case _OutlookEmailIn_To_CRMLeads.EmailTo
Case eEmailTo.eCRM
Dim _CRM_Leads_POPUP As CRM_Leads
Dim _CRM_Opportunities_POPUP As CRM_Opportunities
Dim _CRM_Leads_Activity As CRM_Leads_Activity
If _OutlookEmailIn_To_CRMLeads.CRM_Leads IsNot Nothing Then
_CRM_Leads_POPUP = _ocur.GetObjectByKey(Of CRM_Leads)(_OutlookEmailIn_To_CRMLeads.CRM_Leads.Oid)
End If
If _OutlookEmailIn_To_CRMLeads.CRM_Opportunities IsNot Nothing Then
_CRM_Opportunities_POPUP = _ocur.GetObjectByKey(Of CRM_Opportunities)(_OutlookEmailIn_To_CRMLeads.CRM_Opportunities.Oid)
If _CRM_Leads_POPUP Is Nothing Then
_CRM_Leads_POPUP = _CRM_Opportunities_POPUP.CRM_Leads
End If
End If
_WaitFormClass.Initwork(1, 1, selection.Count)
For Each _OutlookEMailIn In selection
_WaitFormClass.DoWork()
_OutlookEMailIn.IsReaded = True
_OutlookEMailIn.Qualified = True
If _OutlookEMailIn.SenderEmailAddress = _OutlookEmailIn_To_CRMLeads.EMail Then
If _CRM_Leads_POPUP IsNot Nothing Then
_CRM_Leads_Activity = _ocur.CreateObject(Of CRM_Leads_Activity)()
If _CRM_Opportunities_POPUP IsNot Nothing Then
_CRM_Leads_Activity.CRM_Leads = _CRM_Leads_POPUP
_CRM_Leads_Activity.CRM_Opportunities = _CRM_Opportunities_POPUP
_CRM_Leads_Activity.Email_Oid = _OutlookEMailIn.Oid.ToString()
_CRM_Leads_Activity.Subject = _OutlookEMailIn.EmailSubject
_CRM_Leads_Activity.EventType = eEventType.eEMailIn
Else
_CRM_Leads_Activity.CRM_Leads = _CRM_Leads_POPUP
_CRM_Leads_Activity.CRM_Opportunities = Nothing
_CRM_Leads_Activity.Email_Oid = _OutlookEMailIn.Oid.ToString()
_CRM_Leads_Activity.Subject = _OutlookEMailIn.EmailSubject
_CRM_Leads_Activity.EventType = eEventType.eEMailIn
End If
End If
End If
Next
Case eEmailTo.eRegistry
_WaitFormClass.Initwork(1, 1, selection.Count)
Dim _OutlookApp As New Outlook.Application()
Dim _OutlookNameSpace As Outlook.NameSpace
_OutlookNameSpace = _OutlookApp.GetNamespace("MAPI")
_OutlookNameSpace.Logon(, , False, True)
For Each _OutlookEMailIn In selection
_WaitFormClass.DoWork()
_OutlookEMailIn.IsReaded = True
_OutlookEMailIn.Qualified = True
Dim _RegistryHeader As RegistryHeader = _ocur.CreateObject(Of RegistryHeader)()
_RegistryHeader.RegistryType = _ocur.GetObjectByKey(Of RegistryType)(_OutlookEmailIn_To_CRMLeads.RegistryType.Oid)
_RegistryHeader.DeliveryType = eDeliveryType.eMail
_RegistryHeader.CustomersFrom = _ocur.GetObjectByKey(Of CustomersFrom)(_OutlookEmailIn_To_CRMLeads.CustomersFrom.Oid)
Dim _Mail As Outlook.MailItem = TryCast(_OutlookNameSpace.GetItemFromID(_OutlookEMailIn.EntryID), Outlook.MailItem)
_Mail.SaveAs(Path.GetTempPath() + "EmailMessage.msg")
Dim _fs As FileStream
_fs = New FileStream(Path.GetTempPath() + "EmailMessage.msg", FileMode.Open)
_RegistryHeader.DocumentFile = New FileData(_ocur.Session)
_RegistryHeader.DocumentFile.LoadFromStream("EmailMessage.msg", _fs)
_fs.Close()
If System.IO.File.Exists(Path.GetTempPath() + "EmailMessage.msg") Then
System.IO.File.Delete(Path.GetTempPath() + "EmailMessage.msg")
End If
Next
Case eEmailTo.eCRMEstate
_WaitFormClass.Initwork(1, 1, selection.Count)
For Each _OutlookEMailIn In selection
_WaitFormClass.DoWork()
_OutlookEMailIn.IsReaded = True
_OutlookEMailIn.Qualified = True
Dim _CRMEstate_Leads As CRMEstate_Leads = _ocur.GetObjectByKey(Of CRMEstate_Leads)(_OutlookEmailIn_To_CRMLeads.CRMEstate_Leads.Oid)
If _CRMEstate_Leads Is Nothing Then Throw New System.Exception("Nem lett kiválasztva a felugró ablakban egyetlen ingatlan ügy sem!" + vbNewLine + "A folyamat megszakadt!")
Dim _CRMEstate_Leads_Activity As CRMEstate_Leads_Activity = _ocur.CreateObject(Of CRMEstate_Leads_Activity)()
_CRMEstate_Leads_Activity.EventType = eEventType.eEMailIn
_CRMEstate_Leads_Activity.CRMEstate_Leads = _CRMEstate_Leads
_CRMEstate_Leads_Activity.Email_Oid = _OutlookEMailIn.Oid.ToString
_CRMEstate_Leads_Activity.HRPerson = _CRMEstate_Leads.HRPerson
_CRMEstate_Leads_Activity.Subject = _OutlookEMailIn.EmailSubject
Next
End Select
noselect = False
_ocur.CommitChanges()
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly)
Finally
Me._WaitFormClass.FinalWork()
End Try
End Sub
Private Sub view_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Dim _OutlookEmailIn As OutlookEMailIn
If View Is Nothing Then Exit Sub
If noselect = False Then
selection.Clear()
For Each _OutlookEmailIn In View.SelectedObjects
selection.Add(_OutlookEmailIn)
Next
End If
End Sub
Private Sub aViewAttachedFile_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aViewAttachedFile.Execute
Try
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
Dim _OutlookEMailAttachments As OutlookEMailAttachments = TryCast(View.SelectedObjects(0), OutlookEMailAttachments)
Dim _FilePath As String = Path.Combine(Path.GetTempPath(), _OutlookEMailAttachments.DocumentFileData.File.FileName)
Dim _Stream As Stream = New FileStream(_FilePath, FileMode.Create)
_OutlookEMailAttachments.DocumentFileData.File.SaveToStream(_Stream)
_Stream.Close()
Process.Start(_FilePath)
Catch
Throw New UserFriendlyException("Nem tudom megnyitni a file-t!")
End Try
End Sub
Private Sub aAttachFile_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aAttachFile.Execute
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
Dim _PropertyCollectionSource As PropertyCollectionSource = TryCast(_ListView.CollectionSource, PropertyCollectionSource)
Dim _OutlookEMail As OutlookEMail = TryCast(_PropertyCollectionSource.MasterObject, OutlookEMail)
Dim _MyStream As Stream = Nothing
Dim _OpenFileDialog As New OpenFileDialog()
_OpenFileDialog.InitialDirectory = "c:\"
_OpenFileDialog.RestoreDirectory = True
If _OpenFileDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
Try
_MyStream = _OpenFileDialog.OpenFile()
If (_MyStream IsNot Nothing) Then
Dim _EmailAttachments As OutlookEMailAttachments
Dim _DocumentFileData As DocumentFileData = _ocur.CreateObject(Of DocumentFileData)()
_DocumentFileData.File = _ocur.CreateObject(Of FileData)()
_DocumentFileData.File.LoadFromStream(Path.GetFileName(_OpenFileDialog.FileName), _MyStream)
_EmailAttachments = _ocur.CreateObject(Of OutlookEMailAttachments)()
_EmailAttachments.DocumentFileData = _DocumentFileData
_OutlookEMail.OutlookEMailAttachments.Add(_ocur.GetObject(_EmailAttachments))
_OutlookEMail.Save()
_ocur.CommitChanges()
View.Refresh()
End If
Catch
'--- TESZT MIATT!!! -----
MessageBox.Show("Nem tudtam csatolni a file-t!")
Finally
If (_MyStream IsNot Nothing) Then
_MyStream.Close()
End If
End Try
End If
End Sub
Private Sub aEmailIn_To_CRMEstateLeads_CustomizePopupWindowParams(sender As Object, e As DevExpress.ExpressApp.Actions.CustomizePopupWindowParamsEventArgs) Handles aEmailIn_To_CRMEstateLeads.CustomizePopupWindowParams
Try
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
End Try
End Sub
Private Sub aEmailIn_To_CRMEstateLeads_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.PopupWindowShowActionExecuteEventArgs) Handles aEmailIn_To_CRMEstateLeads.Execute
Try
Catch ex As System.Exception
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
End Try
End Sub
End Class
@@ -0,0 +1,93 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions()> _
<NavigationItem("Outlook e-mail")> _
Public Class OutlookReminder
Inherits BaseObject
Private _Subject As String
Private _Body As String
Private _DueDate As DateTime
Private _ReminderTimeDay As DateTime
Private _Hours As Integer
Private _Minutes As Integer
Private _TaskEntryID As String
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
<Size(255)> _
Property Subject As String
Get
Return _Subject
End Get
Set(value As String)
SetPropertyValue("Subject", _Subject, value)
End Set
End Property
<Size(-1)> _
Property Body As String
Get
Return _Body
End Get
Set(value As String)
SetPropertyValue("Body", _Body, value)
End Set
End Property
Property DueDate As DateTime
Get
Return _DueDate
End Get
Set(value As DateTime)
SetPropertyValue("DueDate", _DueDate, value)
End Set
End Property
Property ReminderTimeDay As DateTime
Get
Return _ReminderTimeDay
End Get
Set(value As DateTime)
SetPropertyValue("ReminderTimeDay", _ReminderTimeDay, value)
End Set
End Property
<RuleRange("Hours", DefaultContexts.Save, 0, 24)> _
Property Hours As Integer
Get
Return _Hours
End Get
Set(value As Integer)
SetPropertyValue("Hours", _Hours, value)
End Set
End Property
<RuleRange("Minutes", DefaultContexts.Save, 0, 60)> _
Property Minutes As Integer
Get
Return _Minutes
End Get
Set(value As Integer)
SetPropertyValue("Minutes", _Minutes, value)
End Set
End Property
<Size(255)> _
<Browsable(False)> _
Property TaskEntryID As String
Get
Return _TaskEntryID
End Get
Set(value As String)
SetPropertyValue("TaskEntryID", _TaskEntryID, value)
End Set
End Property
End Class
@@ -0,0 +1,32 @@
Partial Class OutlookReminder_VC
<System.Diagnostics.DebuggerNonUserCode()> _
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
MyClass.New()
'Required for Windows.Forms Class Composition Designer support
Container.Add(Me)
End Sub
'Component overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Component Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Component Designer
'It can be modified using the Component Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
components = New System.ComponentModel.Container()
End Sub
End Class
@@ -0,0 +1,73 @@
Imports System
Imports System.ComponentModel
Imports System.Collections.Generic
Imports System.Diagnostics
Imports System.Text
Imports DevExpress.ExpressApp
Imports DevExpress.ExpressApp.Actions
Imports DevExpress.Persistent.Base
Imports Microsoft.Office.Interop
Imports DevExpress.ExpressApp.Win.Editors
Imports DevExpress.ExpressApp.SystemModule
Imports DevExpress.ExpressApp.Editors
Public Class OutlookReminder_VC
Inherits DevExpress.ExpressApp.ViewController
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
RegisterActions(components)
End Sub
Protected Overrides Sub OnActivated()
MyBase.OnActivated()
If View.Id = "OutlookReminder_DetailView" Then
AddHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf OutlookReminder_DetailView_Save
AddHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf OutlookReminder_DetailView_Save
AddHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf OutlookReminder_DetailView_Save
End If
End Sub
Protected Overrides Sub OnDeactivated()
MyBase.OnDeactivated()
If View.Id = "OutlookReminder_DetailView" Then
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAction.Executing, AddressOf OutlookReminder_DetailView_Save
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndCloseAction.Executing, AddressOf OutlookReminder_DetailView_Save
RemoveHandler Frame.GetController(Of ModificationsController)().SaveAndNewAction.Executing, AddressOf OutlookReminder_DetailView_Save
End If
End Sub
Private Sub OutlookReminder_DetailView_Save()
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
Dim _OutlookApp As New Outlook.Application()
Dim _OutlookNameSpace As Outlook.NameSpace = _OutlookApp.GetNamespace("MAPI")
Dim _OutlookReminder As OutlookReminder = TryCast(View.SelectedObjects(0), OutlookReminder)
Dim _NewTask As Outlook.TaskItem = Nothing
If Not String.IsNullOrEmpty(_OutlookReminder.TaskEntryID) Then
Try
_NewTask = _OutlookNameSpace.GetItemFromID(_OutlookReminder.TaskEntryID)
Catch ex As Exception
End Try
End If
If _NewTask Is Nothing Then _NewTask = _OutlookApp.CreateItem(Outlook.OlItemType.olTaskItem)
_OutlookNameSpace.Logon(, , True, True)
_NewTask.ReminderSet = True
_NewTask.Body = _OutlookReminder.Body
_NewTask.DueDate = New DateTime(_OutlookReminder.DueDate.Year, _OutlookReminder.DueDate.Month, _OutlookReminder.DueDate.Day, _OutlookReminder.Hours, _OutlookReminder.Minutes, 0)
_NewTask.ReminderTime = _OutlookReminder.ReminderTimeDay
_NewTask.Subject = _OutlookReminder.Subject
_NewTask.UnRead = True
_NewTask.Save()
If String.IsNullOrEmpty(_OutlookReminder.TaskEntryID) Then _OutlookReminder.TaskEntryID = _NewTask.EntryID
_ocur.CommitChanges()
End Sub
End Class
@@ -0,0 +1,118 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
Imports DevExpress.ExpressApp.ConditionalAppearance
Public Enum eEmailTo
eCRM = 0
eRegistry = 1
eCRMEstate = 2
End Enum
<DefaultClassOptions()> _
<NavigationItem(False)> _
<CreatableItem(False)> _
<NonPersistent()> _
<Appearance("OutlookEmailIn_To_CRMLeads - Hide Registry properties when EmailTo=0", AppearanceItemType.ViewItem, "EmailTo=0", TargetItems:="CustomersFrom; RegistryType; DeliveryType; CRMEstate_Leads", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("OutlookEmailIn_To_CRMLeads - Hide CRM properties when EmailTo=1", AppearanceItemType.ViewItem, "EmailTo=1", TargetItems:="CRM_Leads; CRM_Opportunities; CRMEstate_Leads", visibility:=Editors.ViewItemVisibility.Hide)> _
<Appearance("OutlookEmailIn_To_CRMLeads - Hide CRM properties when EmailTo=2", AppearanceItemType.ViewItem, "EmailTo=2", TargetItems:="CRM_Leads; CRM_Opportunities; CustomersFrom; RegistryType; DeliveryType;", visibility:=Editors.ViewItemVisibility.Hide)> _
Public Class OutlookEmailIn_To_CRMLeads
Inherits BaseObject
Private _EmailTo As eEmailTo
Private _EMail As String
'-------CRM----------
Private _CRM_Leads As CRM_Leads
Private _CRM_Opportunities As CRM_Opportunities
'-------Registry-------
Private _CustomersFrom As CustomersFrom
Private _RegistryType As RegistryType 'Iktatás típusa
'-------CRMEstate------
Private _CRMEstate_Leads As CRMEstate_Leads
Public Sub New(ByVal session As Session)
MyBase.New(session)
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
End Sub
<ImmediatePostData()> _
Property EmailTo As eEmailTo
Get
Return _EmailTo
End Get
Set(value As eEmailTo)
SetPropertyValue("EmailTo", _EmailTo, value)
End Set
End Property
<Browsable(False)> _
Property EMail As String
Get
Return _EMail
End Get
Set(value As String)
SetPropertyValue("EMail", _EMail, value)
End Set
End Property
'-------CRM----------
Public Property CRM_Leads As CRM_Leads
Get
Return _CRM_Leads
End Get
Set(value As CRM_Leads)
SetPropertyValue("CRM_Leads", _CRM_Leads, value)
End Set
End Property
Public Property CRM_Opportunities As CRM_Opportunities
Get
Return _CRM_Opportunities
End Get
Set(value As CRM_Opportunities)
SetPropertyValue("CRM_Opportunities", _CRM_Opportunities, value)
End Set
End Property
'-------Registry-------
Property CustomersFrom As CustomersFrom
Get
Return _CustomersFrom
End Get
Set(value As CustomersFrom)
SetPropertyValue("CustomersFrom", _CustomersFrom, value)
End Set
End Property
<ImmediatePostData(True), DataSourceCriteria("CustomersFrom = '@This.CustomersFrom'")>
Property RegistryType As RegistryType
Get
Return _RegistryType
End Get
Set(value As RegistryType)
SetPropertyValue("RegistryType", _RegistryType, value)
End Set
End Property
'-------CRMEstate------
Property CRMEstate_Leads As CRMEstate_Leads
Get
Return _CRMEstate_Leads
End Get
Set(value As CRMEstate_Leads)
SetPropertyValue("CRMEstate_Leads", _CRMEstate_Leads, value)
End Set
End Property
End Class
@@ -0,0 +1,29 @@
Imports System
Imports System.ComponentModel
Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp
Imports DevExpress.Persistent.Base
Imports DevExpress.Persistent.BaseImpl
Imports DevExpress.Persistent.Validation
<DefaultClassOptions()> _
<NavigationItem(False), CreatableItem(False)> _
Public Class WEB
Inherits BaseObject
Public Sub New(ByVal session As Session)
MyBase.New(session)
' This constructor is used when an object is loaded from a persistent storage.
' Do not place any code here or place it only when the IsLoading property is false:
' if (!IsLoading){
' It is now OK to place your initialization code here.
' }
' or as an alternative, move your initialization code into the AfterConstruction method.
End Sub
Public Overrides Sub AfterConstruction()
MyBase.AfterConstruction()
' Place here your initialization code.
End Sub
End Class