First create solution
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
Partial Class DragAndDropBusinessDirectory_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()
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,123 @@
|
||||
<?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="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,397 @@
|
||||
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 DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports System.Drawing
|
||||
Imports System.Collections
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Data
|
||||
Imports DevExpress.ExpressApp.Win.Editors
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.ExpressApp.Win
|
||||
Imports Microsoft.Office.Interop
|
||||
Imports System.IO
|
||||
Imports DevExpress.XtraTreeList
|
||||
Imports DevExpress.ExpressApp.Win.Controls
|
||||
Imports DevExpress.ExpressApp.TreeListEditors.Win
|
||||
Imports DevExpress.XtraTreeList.Nodes
|
||||
Imports Microsoft.Office
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Collections.Specialized
|
||||
Imports System.Threading
|
||||
|
||||
Public Class DragAndDropBusinessDirectory_VC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Private _TreeListEditor As TreeListEditor
|
||||
Private _TreeList As TreeList
|
||||
Private _Selection As New ArrayList
|
||||
Private _EnabledSelection = True
|
||||
Private _CanEmailDrop As Boolean = True
|
||||
Dim _WaitFormClass As New WaitFormClass
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
End Sub
|
||||
Protected Overrides Sub OnActivated()
|
||||
MyBase.OnActivated()
|
||||
If View.Id Like "*BusinessDirectory_ListView*" Then
|
||||
AddHandler View.ControlsCreated, AddressOf View_ControlsCreated
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnDeactivated()
|
||||
MyBase.OnDeactivated()
|
||||
If View.Id = "BusinessDirectory_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.DeleteObjectsViewController).DeleteAction.Active.SetItemValue("", True)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub View_ControlsCreated(sender As Object, e As EventArgs)
|
||||
_TreeListEditor = CType((CType(View, DevExpress.ExpressApp.ListView)).Editor, TreeListEditor)
|
||||
_TreeList = _TreeListEditor.TreeList
|
||||
_TreeList.OptionsDragAndDrop.DragNodesMode = DragNodesMode.Multiple
|
||||
_TreeList.OptionsDragAndDrop.ExpandNodeOnDrag = True
|
||||
|
||||
AddHandler _TreeList.DragOver, AddressOf _TreeList_DragOver
|
||||
AddHandler _TreeList.DragDrop, AddressOf _TreeList_DragDrop
|
||||
AddHandler _TreeList.DragLeave, AddressOf _TreeList_DragLeave
|
||||
|
||||
|
||||
AddHandler View.SelectionChanged, AddressOf BusinessDirectory_ListView_SelectionChanged
|
||||
End Sub
|
||||
#Region "Drag and Drop"
|
||||
|
||||
Private Sub _TreeList_DragOver(sender As Object, e As DragEventArgs)
|
||||
'Dim dragNode As TreeListNode = TryCast(e.Data.GetData(GetType(TreeListNode)), TreeListNode)
|
||||
e.Effect = DragDropEffects.All
|
||||
|
||||
|
||||
'e.Effect = GetDragDropEffect(TryCast(sender, TreeList), dragNode, New Point(e.X, e.Y))
|
||||
End Sub
|
||||
Private Sub _TreeList_DragLeave(sender As Object, e As EventArgs)
|
||||
'Fileok Clipboard droplistba
|
||||
Dim _Paths As New StringCollection
|
||||
|
||||
For Each _BusinessDirectory As BusinessDirectory In View.SelectedObjects
|
||||
If _BusinessDirectory.FileData IsNot Nothing Then
|
||||
Dim _FileName As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetTempPath, _BusinessDirectory.FileData.FileName)
|
||||
Dim _StreamFile As System.IO.Stream = New System.IO.FileStream(_FileName, System.IO.FileMode.Create)
|
||||
|
||||
_BusinessDirectory.FileData.SaveToStream(_StreamFile)
|
||||
_StreamFile.Close()
|
||||
_Paths.Add(_FileName)
|
||||
|
||||
End If
|
||||
Next
|
||||
If _Paths.Count > 0 Then
|
||||
Dim data As New DataObject()
|
||||
data.SetFileDropList(_Paths)
|
||||
_TreeList.DoDragDrop(data, DragDropEffects.Copy)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub _TreeList_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Dim _TargetNode As TreeListNode = Nothing
|
||||
Dim _Point As Point
|
||||
Dim _BusinessDirectoryDrop As Boolean = False
|
||||
Dim _FileDrop As Boolean = False
|
||||
Dim _EmailDrop As Boolean = False
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
Dim _TL As TreeList = TryCast(sender, TreeList)
|
||||
If _TL IsNot Nothing Then
|
||||
_Point = _TL.PointToClient(New Point(e.X, e.Y))
|
||||
_TargetNode = _TL.CalcHitInfo(_Point).Node
|
||||
|
||||
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
||||
_FileDrop = True
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then
|
||||
_EmailDrop = True
|
||||
ElseIf TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory) IsNot Nothing Then
|
||||
_BusinessDirectoryDrop = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If _TargetNode Is Nothing Then Exit Sub
|
||||
|
||||
If _BusinessDirectoryDrop Then
|
||||
Dim _TargetBusinessDirectory As BusinessDirectory = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
If TryCast(_Selection(0), BusinessDirectory).Oid <> _TargetBusinessDirectory.Oid Then
|
||||
If _TargetBusinessDirectory.IsFolder Then
|
||||
If _TargetBusinessDirectory IsNot Nothing Then
|
||||
_EnabledSelection = False
|
||||
For Each _BusinessDirectory As BusinessDirectory In _Selection
|
||||
_BusinessDirectory.BusinessDirectory_Parent = _TargetBusinessDirectory
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_EnabledSelection = True
|
||||
End If
|
||||
Else
|
||||
MsgBox("Fájl nem használható könyvtárként!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Figyelem!")
|
||||
End If
|
||||
Else
|
||||
MsgBox("Nem helyezhetõ át az elem saját magába!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Figyelem!")
|
||||
End If
|
||||
End If
|
||||
|
||||
If _FileDrop Then
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_Selection.Clear()
|
||||
_WaitFormClass.Initwork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
_WaitFormClass.DoWork()
|
||||
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _BusinessDirectory As New BusinessDirectory(_ocur.Session)
|
||||
With _BusinessDirectory
|
||||
.IsFolder = False
|
||||
.ShortName = IO.Path.GetFileName(IO.Path.GetFileNameWithoutExtension(_ActFile))
|
||||
.FileData = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.BusinessDirectory_Parent = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
End If
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_WaitFormClass.FinalWork()
|
||||
End If
|
||||
End If
|
||||
|
||||
If _EmailDrop Then
|
||||
Dim _OL As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
|
||||
Dim _Explorer As Microsoft.Office.Interop.Outlook.Explorer = _OL.ActiveExplorer
|
||||
Dim _TargetBusinessDirectory As BusinessDirectory = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
If _TargetBusinessDirectory.IsFolder Then
|
||||
If _CanEmailDrop Then
|
||||
If _Explorer.Selection.Count > 0 Then
|
||||
_CanEmailDrop = False
|
||||
|
||||
Dim _MemoryStream As MemoryStream = TryCast(e.Data.GetData("FileGroupDescriptor"), MemoryStream)
|
||||
Dim _TMPFileName As String = Path.GetTempPath + Path.GetRandomFileName
|
||||
|
||||
Dim _FileStream As FileStream = File.OpenWrite(_TMPFileName)
|
||||
_MemoryStream.WriteTo(_FileStream)
|
||||
_FileStream.Flush()
|
||||
_FileStream.Close()
|
||||
|
||||
Dim _TxtLine As String = ""
|
||||
If File.Exists(_TMPFileName) Then
|
||||
|
||||
Dim _StreamReader As New StreamReader(_TMPFileName)
|
||||
Do While _StreamReader.Peek <> -1
|
||||
_TxtLine += _StreamReader.ReadLine
|
||||
Loop
|
||||
End If
|
||||
|
||||
If _TxtLine.Contains(".msg") Then
|
||||
|
||||
_WaitFormClass.Initwork(0, 1, _Explorer.Selection.Count)
|
||||
For ik = 1 To _Explorer.Selection.Count
|
||||
_WaitFormClass.DoWork()
|
||||
Dim _FileIn As Object = _Explorer.Selection(ik)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
Dim _MeetingItem As Microsoft.Office.Interop.Outlook.MeetingItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MeetingItem)
|
||||
|
||||
If _MailItem Is Nothing And _MeetingItem Is Nothing Then Throw New Exception("*Csak e-mail, értekezlet és találkozó típusú Outlook elemet lehet beilleszteni!")
|
||||
|
||||
If _MailItem IsNot Nothing Then
|
||||
Try
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = ""
|
||||
If _MailItem.Subject IsNot Nothing Then
|
||||
_Subject = _MailItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
Else
|
||||
_Subject = "Nincs tárgy"
|
||||
End If
|
||||
|
||||
If Not IsValidFileName(_Subject) Then Throw New Exception("*Illegális karakterek a tárgy mezõben!")
|
||||
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
_MailItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _BusinessDirectory As New BusinessDirectory(_ocur.Session)
|
||||
With _BusinessDirectory
|
||||
.FileData = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
.FileData.FileName = IO.Path.GetFileName(_FileName)
|
||||
.FileCreated = _MailItem.ReceivedTime 'Küldés dátuma kell?
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.ShortName = IO.Path.GetFileName(_FileName)
|
||||
.BusinessDirectory_Parent = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
.IsFolder = False
|
||||
.EMail_Sender = _MailItem.Sender.Name
|
||||
.Email_Copy = _MailItem.CC
|
||||
End With
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Hiba!")
|
||||
End Try
|
||||
ElseIf _MeetingItem IsNot Nothing Then
|
||||
Try
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = ""
|
||||
If _MeetingItem.Subject IsNot Nothing Then
|
||||
_Subject = _MeetingItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
_Subject = _Subject.Replace("|", "_")
|
||||
Else
|
||||
_Subject = "Nincs tárgy"
|
||||
End If
|
||||
|
||||
If Not IsValidFileName(_Subject) Then Throw New Exception("*Illegális karakterek a tárgy mezõben!")
|
||||
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
_MeetingItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _BusinessDirectory As New BusinessDirectory(_ocur.Session)
|
||||
With _BusinessDirectory
|
||||
.FileData = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
.FileData.FileName = IO.Path.GetFileName(_FileName)
|
||||
.FileCreated = _MeetingItem.ReceivedTime 'Küldés dátuma kell?
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.ShortName = IO.Path.GetFileName(_FileName)
|
||||
.BusinessDirectory_Parent = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
.IsFolder = False
|
||||
.EMail_Sender = _MeetingItem.SenderName '.Sender.Name
|
||||
End With
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, "Hiba!")
|
||||
Finally
|
||||
_WaitFormClass.FinalWork()
|
||||
End Try
|
||||
End If
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
_Explorer = Nothing
|
||||
Marshal.ReleaseComObject(_OL)
|
||||
_OL = Nothing
|
||||
_WaitFormClass.FinalWork()
|
||||
Else
|
||||
_WaitFormClass.Initwork(0, 1, 1)
|
||||
_WaitFormClass.DoWork()
|
||||
Dim _FileNameFromStream As New StringBuilder("")
|
||||
_FileNameFromStream.Append(Path.GetTempPath)
|
||||
|
||||
|
||||
Dim fileGroupDescriptor(512) As Byte
|
||||
_MemoryStream.Read(fileGroupDescriptor, 0, 512)
|
||||
|
||||
Dim i As Integer = 76
|
||||
While fileGroupDescriptor(i) <> 0
|
||||
_FileNameFromStream.Append(Convert.ToChar(fileGroupDescriptor(i)))
|
||||
i += 1
|
||||
End While
|
||||
|
||||
Dim _FileIn As Object = _Explorer.Selection(1)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
|
||||
For Each _Attachment As Microsoft.Office.Interop.Outlook.Attachment In _MailItem.Attachments
|
||||
If _Attachment.FileName = Path.GetFileName(_FileNameFromStream.ToString) Then
|
||||
_Attachment.SaveAsFile(Path.GetTempPath + _Attachment.FileName)
|
||||
|
||||
If System.IO.File.Exists(Path.GetTempPath + _Attachment.FileName) Then
|
||||
Dim _BusinessDirectory As New BusinessDirectory(_ocur.Session)
|
||||
With _BusinessDirectory
|
||||
.FileData = LoadOtherFile(Path.GetTempPath + _Attachment.FileName, New FileData(_ocur.Session))
|
||||
.FileData.FileName = IO.Path.GetFileName(Path.GetTempPath + _Attachment.FileName)
|
||||
.FileCreated = GetFileCreatedDate(Path.GetTempPath + _Attachment.FileName)
|
||||
.FileModified = GetFileModifiedDate(Path.GetTempPath + _Attachment.FileName)
|
||||
.ShortName = IO.Path.GetFileName(Path.GetTempPath + _Attachment.FileName)
|
||||
.BusinessDirectory_Parent = TryCast(DirectCast(_TargetNode, DevExpress.ExpressApp.Win.Controls.ObjectTreeListNode).Object, BusinessDirectory)
|
||||
.IsFolder = False
|
||||
.EMail_Sender = _MailItem.Sender.Name
|
||||
.Email_Copy = _MailItem.CC
|
||||
End With
|
||||
|
||||
System.IO.File.Delete(Path.GetTempPath + _Attachment.FileName)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
_ocur.CommitChanges()
|
||||
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
_Explorer = Nothing
|
||||
Marshal.ReleaseComObject(_OL)
|
||||
_OL = Nothing
|
||||
|
||||
_WaitFormClass.FinalWork()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
_CanEmailDrop = True
|
||||
Else
|
||||
MsgBox("Fájl nem használható könyvtárként!", MsgBoxStyle.OkOnly + MsgBoxStyle.Information, "Figyelem!")
|
||||
End If
|
||||
End If
|
||||
e.Effect = DragDropEffects.None
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
Private Function GetDragDropEffect(ByVal tl As TreeList, ByVal dragNode As TreeListNode, _Point As Point) As DragDropEffects
|
||||
Dim _TargetNode As TreeListNode
|
||||
Dim _PointNew As Point = tl.PointToClient(_Point)
|
||||
_TargetNode = tl.CalcHitInfo(_PointNew).Node
|
||||
|
||||
Return DragDropEffects.Move
|
||||
End Function
|
||||
Private Sub BusinessDirectory_ListView_SelectionChanged(sender As Object, e As EventArgs)
|
||||
If _EnabledSelection Then
|
||||
_Selection.Clear()
|
||||
_Selection.AddRange(View.SelectedObjects)
|
||||
End If
|
||||
End Sub
|
||||
Private Function LoadOtherFile(ByVal _ActFile As String, _FileData As FileData) As FileData
|
||||
Dim _StreamFile = New System.IO.FileStream(_ActFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
|
||||
Dim _StreamReader As New System.IO.StreamReader(_StreamFile)
|
||||
_StreamFile.Seek(0, System.IO.SeekOrigin.Begin)
|
||||
|
||||
_FileData.LoadFromStream(_ActFile, _StreamFile)
|
||||
_FileData.FileName = System.IO.Path.GetFileName(_ActFile)
|
||||
_StreamReader.Close()
|
||||
_StreamFile.Close()
|
||||
|
||||
Return _FileData
|
||||
|
||||
End Function
|
||||
Private Function GetFileCreatedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetCreationTime(_ActFile)
|
||||
End Function
|
||||
Private Function GetFileModifiedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetLastAccessTime(_ActFile)
|
||||
End Function
|
||||
Public Function IsValidFileName(ByVal fn As String) As Boolean
|
||||
Try
|
||||
Dim fi As New IO.FileInfo(fn)
|
||||
Catch ex As Exception
|
||||
Return False
|
||||
End Try
|
||||
Return True
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
Partial Class DragAndDropCRMOutlookCRM_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()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.aDragDrop_CRM_Change = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
'
|
||||
'aDragDrop_CRM_Change
|
||||
'
|
||||
Me.aDragDrop_CRM_Change.AcceptButtonCaption = Nothing
|
||||
Me.aDragDrop_CRM_Change.CancelButtonCaption = Nothing
|
||||
Me.aDragDrop_CRM_Change.Caption = "aDragDrop_CRM_Change"
|
||||
Me.aDragDrop_CRM_Change.Category = "aDragDrop_CRM_Change"
|
||||
Me.aDragDrop_CRM_Change.ConfirmationMessage = Nothing
|
||||
Me.aDragDrop_CRM_Change.Id = "aDragDrop_CRM_Change"
|
||||
Me.aDragDrop_CRM_Change.ImageName = Nothing
|
||||
Me.aDragDrop_CRM_Change.Shortcut = Nothing
|
||||
Me.aDragDrop_CRM_Change.Tag = Nothing
|
||||
Me.aDragDrop_CRM_Change.TargetObjectsCriteria = Nothing
|
||||
Me.aDragDrop_CRM_Change.TargetViewId = Nothing
|
||||
Me.aDragDrop_CRM_Change.ToolTip = Nothing
|
||||
Me.aDragDrop_CRM_Change.TypeOfView = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aDragDrop_CRM_Change As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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="aDragDrop_CRM_Change.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</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,603 @@
|
||||
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 DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports System.Drawing
|
||||
Imports System.Collections
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Data
|
||||
Imports DevExpress.ExpressApp.Win.Editors
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.ExpressApp.Win
|
||||
Imports Microsoft.Office.Interop
|
||||
Imports System.IO
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports Microsoft.Office
|
||||
|
||||
Public Class DragAndDropCRMOutlookCRM_VC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Private _Selection As New ArrayList
|
||||
Dim _ActSelection As Object
|
||||
Private downHitInfo As GridHitInfo = Nothing
|
||||
Dim _WaitFormClass As New WaitFormClass
|
||||
Private _CRM_Opportunities As CRM_Opportunities = Nothing
|
||||
Private _AllowSelect_CRM_Opportunities As Boolean = False
|
||||
|
||||
Private _DoDragGridViewOutlookEMailAttachments As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _DoDragGridControlOutlookEMailAttachments As DevExpress.XtraGrid.GridControl
|
||||
Private _DoDragGridViewOutlookEMailIn As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _DoDragGridControlOutlookEMailIn As DevExpress.XtraGrid.GridControl
|
||||
|
||||
Private _ToDragGridControlCRM_Opportunities As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewCRM_Opportunities As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlCRM_LeadsDocumentation As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewCRM_LeadsDocumentation As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
End Sub
|
||||
Protected Overrides Sub OnViewControlsCreated()
|
||||
MyBase.OnViewControlsCreated()
|
||||
If View.Id = "" Then
|
||||
End If
|
||||
If View.Id = "OutlookEMailIn_ListView_CRM_Outlook" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_DoDragGridViewOutlookEMailIn = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_DoDragGridViewOutlookEMailIn.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseUp
|
||||
_DoDragGridControlOutlookEMailIn = _DoDragGridViewOutlookEMailIn.GridControl
|
||||
|
||||
AddHandler _DoDragGridViewOutlookEMailIn.MouseDown, AddressOf _DoDragGridViewOutlookEMailIn_MouseDown
|
||||
AddHandler _DoDragGridViewOutlookEMailIn.MouseMove, AddressOf _DoDragGridViewOutlookEMailIn_MouseMove
|
||||
AddHandler View.SelectionChanged, AddressOf OutlookEMailIn_ListView_SelectionChanged
|
||||
End If
|
||||
If View.Id = "OutlookEMailIn_OutlookEMailAttachments_ListView" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_DoDragGridViewOutlookEMailAttachments = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_DoDragGridViewOutlookEMailAttachments.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseUp
|
||||
_DoDragGridControlOutlookEMailAttachments = _DoDragGridViewOutlookEMailAttachments.GridControl
|
||||
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseDown, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseMove, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove
|
||||
AddHandler View.SelectionChanged, AddressOf OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged
|
||||
End If
|
||||
If View.Id = "CRM_Opportunities_ListView_CRM_Outlook" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCRM_Opportunities = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlCRM_Opportunities = _ToDragGridViewCRM_Opportunities.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCRM_Opportunities.DragOver, AddressOf _ToDragGridControlCRM_Opportunities_DragOver
|
||||
AddHandler _ToDragGridControlCRM_Opportunities.DragDrop, AddressOf _ToDragGridControlCRM_Opportunities_DragDrop
|
||||
AddHandler _ToDragGridViewCRM_Opportunities.MouseMove, AddressOf _ToDragGridControlCRM_Opportunities_MouseMove
|
||||
|
||||
AddHandler View.SelectionChanged, AddressOf CRM_Opportunities_ListView_CRM_Outlook_SelectionChanged
|
||||
End If
|
||||
If View.Id = "CRM_Leads_CRM_LeadsDocumentation_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentListViewController).Active.SetItemValue("", False)
|
||||
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCRM_LeadsDocumentation = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlCRM_LeadsDocumentation = _ToDragGridViewCRM_LeadsDocumentation.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCRM_LeadsDocumentation.DragOver, AddressOf ToDragGridControlControlCRM_LeadsDocumentation_DragOver
|
||||
AddHandler _ToDragGridControlCRM_LeadsDocumentation.DragDrop, AddressOf ToDragGridControlCRM_LeadsDocumentation_DragDrop
|
||||
AddHandler _ToDragGridViewCRM_LeadsDocumentation.MouseMove, AddressOf ToDragGridView_MouseMove
|
||||
End If
|
||||
End Sub
|
||||
Private Sub _DoDragGridViewOutlookEMailIn_MouseDown(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
downHitInfo = Nothing
|
||||
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
If Control.ModifierKeys <> Keys.None Then
|
||||
Return
|
||||
End If
|
||||
If e.Button = MouseButtons.Left AndAlso hitInfo.InRow AndAlso hitInfo.HitTest <> GridHitTest.RowIndicator Then
|
||||
downHitInfo = hitInfo
|
||||
End If
|
||||
End Sub
|
||||
Private Sub _DoDragGridViewOutlookEMailIn_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If e.Button = MouseButtons.Left AndAlso downHitInfo IsNot Nothing Then
|
||||
Dim dragSize As Size = SystemInformation.DragSize
|
||||
Dim dragRect As New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize)
|
||||
|
||||
If (Not dragRect.Contains(New Point(e.X, e.Y))) Then
|
||||
_AllowSelect_CRM_Opportunities = True
|
||||
view.GridControl.DoDragDrop(_Selection, DragDropEffects.All)
|
||||
downHitInfo = Nothing
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OutlookEMailIn_ListView_SelectionChanged(sender As Object, e As EventArgs)
|
||||
_Selection.Clear()
|
||||
_Selection.AddRange(View.SelectedObjects)
|
||||
End Sub
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
downHitInfo = Nothing
|
||||
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
If Control.ModifierKeys <> Keys.None Then
|
||||
Return
|
||||
End If
|
||||
If e.Button = MouseButtons.Left AndAlso hitInfo.InRow AndAlso hitInfo.HitTest <> GridHitTest.RowIndicator Then
|
||||
downHitInfo = hitInfo
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If e.Button = MouseButtons.Left AndAlso downHitInfo IsNot Nothing Then
|
||||
Dim dragSize As Size = SystemInformation.DragSize
|
||||
Dim dragRect As New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize)
|
||||
|
||||
If (Not dragRect.Contains(New Point(e.X, e.Y))) Then
|
||||
_AllowSelect_CRM_Opportunities = True
|
||||
view.GridControl.DoDragDrop(_Selection, DragDropEffects.All)
|
||||
downHitInfo = Nothing
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged(sender As Object, e As EventArgs)
|
||||
_Selection.Clear()
|
||||
_Selection.AddRange(View.SelectedObjects)
|
||||
End Sub
|
||||
Private Sub _ToDragGridControlCRM_Opportunities_DragOver(sender As Object, e As DragEventArgs)
|
||||
e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewCRM_Opportunities.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCRM_Opportunities.CollapseAllGroups()
|
||||
If _ToDragGridViewCRM_Opportunities.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCRM_Opportunities.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
|
||||
If _ToDragGridViewCRM_Opportunities.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
_ToDragGridViewCRM_Opportunities.ClearSelection()
|
||||
_ToDragGridViewCRM_Opportunities.SelectRow(_GridHitInfo.RowHandle)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub _ToDragGridControlCRM_Opportunities_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
Dim _CRM_Opportunities As CRM_Opportunities = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), CRM_Opportunities)
|
||||
If _CRM_Opportunities Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = View.ObjectSpace
|
||||
|
||||
Dim _OutlookEMailInSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _OutlookEMailInSelection IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, _OutlookEMailInSelection.Count)
|
||||
If TryCast(_OutlookEMailInSelection(0), OutlookEMailIn) IsNot Nothing Then
|
||||
|
||||
For Each _OutlookEMailIn As OutlookEMailIn In _OutlookEMailInSelection
|
||||
Dim _CRM_Leads_Activity As New CRM_Leads_Activity(_ocur.Session)
|
||||
_OutlookEMailIn = _ocur.GetObject(_OutlookEMailIn)
|
||||
_CRM_Leads_Activity.CRM_Opportunities = _CRM_Opportunities
|
||||
_CRM_Leads_Activity.CRM_Leads = _CRM_Opportunities.CRM_Leads
|
||||
_CRM_Leads_Activity.EventType = eEventType.eEMailIn
|
||||
_CRM_Leads_Activity.Email_Oid = _OutlookEMailIn.Oid.ToString
|
||||
|
||||
_OutlookEMailIn.Qualified = True
|
||||
_OutlookEMailIn.IsReaded = True
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
_Waitformclass.FinalWork
|
||||
ElseIf TryCast(_OutlookEMailInSelection(0), OutlookEMailAttachments) IsNot Nothing Then
|
||||
If _CRM_Opportunities.CRM_Leads Is Nothing Then Throw New Exception("*Nem tartozik Potenciáli ügyfél a CRM ügyhöz!")
|
||||
_Selection.Clear()
|
||||
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _OutlookEMailInSelection
|
||||
Dim _CRM_LeadsDocumentation As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With (_CRM_LeadsDocumentation)
|
||||
.CRM_Leads = _ocur.GetObject(_CRM_Opportunities.CRM_Leads)
|
||||
.File = _ocur.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
End With
|
||||
_Selection.Add(_CRM_LeadsDocumentation)
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
_Waitformclass.FinalWork
|
||||
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookCRM_VC).aDragDrop_CRM_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
Else
|
||||
Throw New Exception("*Váratlan hiba történt a folyamat megszakadt!")
|
||||
End If
|
||||
ElseIf e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop) 'File
|
||||
If _FileIn IsNot Nothing Then
|
||||
_Selection.Clear()
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CRM_LeadsDocumentation As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With (_CRM_LeadsDocumentation)
|
||||
.CRM_Leads = _ocur.GetObject(_CRM_Opportunities.CRM_Leads)
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
End With
|
||||
_Selection.Add(_CRM_LeadsDocumentation)
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
_Waitformclass.FinalWork
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookCRM_VC).aDragDrop_CRM_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
End If
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then 'Email
|
||||
Dim _OL As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
|
||||
_WaitFormClass.InitWork(0, 1, _OL.ActiveExplorer.Selection.Count)
|
||||
If _OL.ActiveExplorer.Selection.Count > 0 Then
|
||||
For ik As Long = 1 To _OL.ActiveExplorer.Selection.Count
|
||||
Dim _FileIn As Object = _OL.ActiveExplorer.Selection(ik)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
If _MailItem IsNot Nothing Then
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = ""
|
||||
If _MailItem.Subject IsNot Nothing Then
|
||||
_Subject = _MailItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
Else
|
||||
_Subject = "Nincs tárgy"
|
||||
End If
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
_FileName = _FileName.Replace("\\", "\")
|
||||
_MailItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _CRM_LeadsDocumentation As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With (_CRM_LeadsDocumentation)
|
||||
.CRM_Leads = _ocur.GetObject(_CRM_Opportunities.CRM_Leads)
|
||||
.FileCreated = GetFileCreatedDate(_FileName)
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.File = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
End With
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
SwitchOutlookPanes(_OL)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RefreshController).RefreshAction.DoExecute()
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub _ToDragGridControlCRM_Opportunities_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
If _AllowSelect_CRM_Opportunities Then
|
||||
Dim view As XafGridView = TryCast(sender, XafGridView)
|
||||
view.ClearSelection()
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
view.SelectRow(hitInfo.RowHandle)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CRM_Opportunities_ListView_CRM_Outlook_SelectionChanged(sender As Object, e As EventArgs)
|
||||
' frissíteni kell a masterdetail view-et! na de hogy a pékbe?
|
||||
End Sub
|
||||
Private Sub ToDragGridControlControlCRM_LeadsDocumentation_DragOver(sender As Object, e As DragEventArgs)
|
||||
'e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
If TryCast(_ListView.CollectionSource.Collection, ProxyCollection).Count > 0 Then
|
||||
If _ToDragGridViewCRM_LeadsDocumentation.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCRM_LeadsDocumentation.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = Nothing
|
||||
|
||||
If Not _ToDragGridViewCRM_LeadsDocumentation.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.None
|
||||
_ToDragGridViewCRM_LeadsDocumentation.Tag = "NODROPCRM"
|
||||
|
||||
ElseIf _ToDragGridViewCRM_LeadsDocumentation.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.Copy
|
||||
_ToDragGridViewCRM_LeadsDocumentation.ClearSelection()
|
||||
_ToDragGridViewCRM_LeadsDocumentation.SelectRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = _ToDragGridViewCRM_LeadsDocumentation.GetRow(_ToDragGridViewCRM_LeadsDocumentation.GetSelectedRows(0))
|
||||
_ToDragGridViewCRM_LeadsDocumentation.Tag = ""
|
||||
End If
|
||||
Else
|
||||
e.Effect = DragDropEffects.Copy
|
||||
End If
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCRM_LeadsDocumentation_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
If _ToDragGridViewCRM_LeadsDocumentation.Tag = "NODROPCRM" Then
|
||||
_ToDragGridViewCRM_LeadsDocumentation.Tag = ""
|
||||
Return
|
||||
End If
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
Dim _CRM_LeadsDocumentation As CRM_LeadsDocumentation = Nothing
|
||||
Dim _CRM_Opportunities As CRM_Opportunities = Nothing
|
||||
Dim _NoListViewElem As Boolean = False
|
||||
If _ActSelection IsNot Nothing Then
|
||||
_CRM_LeadsDocumentation = TryCast(_ActSelection, CRM_LeadsDocumentation)
|
||||
ElseIf TryCast(_ListView.CollectionSource.Collection, ProxyCollection).Count > 0 Then
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
_CRM_LeadsDocumentation = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), CRM_LeadsDocumentation)
|
||||
Else
|
||||
_NoListViewElem = True
|
||||
End If
|
||||
|
||||
If _CRM_LeadsDocumentation Is Nothing And _NoListViewElem = False Then Return
|
||||
|
||||
If _CRM_LeadsDocumentation Is Nothing Then
|
||||
_CRM_Opportunities = TryCast(TryCast(_ListView.CollectionSource, PropertyCollectionSource).MasterObject, CRM_Opportunities)
|
||||
End If
|
||||
|
||||
If _CRM_LeadsDocumentation Is Nothing And _CRM_Opportunities Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
Dim _OutlookEMailAttachments_Collection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _OutlookEMailAttachments_Collection IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, _OutlookEMailAttachments_Collection.Count)
|
||||
If TryCast(_OutlookEMailAttachments_Collection(0), OutlookEMailAttachments) IsNot Nothing Then
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _OutlookEMailAttachments_Collection
|
||||
Dim _CRM_LeadsDocumentation_New As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With _CRM_LeadsDocumentation_New
|
||||
If _CRM_LeadsDocumentation IsNot Nothing Then
|
||||
.RowGroup1 = _CRM_LeadsDocumentation.RowGroup1
|
||||
.RowGroup2 = _CRM_LeadsDocumentation.RowGroup2
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_LeadsDocumentation.CRM_Leads.Oid)
|
||||
Else
|
||||
.RowGroup1 = ""
|
||||
.RowGroup2 = ""
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_Opportunities.CRM_Leads.Oid)
|
||||
End If
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = _ocur.GetObjectByKey(Of FileData)(_OutlookEMailAttachments.DocumentFileData.File.Oid)
|
||||
.File.FileName = _OutlookEMailAttachments.DocumentFileData.File.FileName
|
||||
End With
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
ElseIf TryCast(_OutlookEMailAttachments_Collection(0), OutlookEMailIn) IsNot Nothing Then
|
||||
Dim _OutlookApp As New Outlook.Application()
|
||||
Dim _OutlookNameSpace As Outlook.NameSpace
|
||||
_OutlookNameSpace = _OutlookApp.GetNamespace("MAPI")
|
||||
_OutlookNameSpace.Logon(, , False, True)
|
||||
|
||||
For Each _OutlookEMailIn As OutlookEMailIn In _OutlookEMailAttachments_Collection
|
||||
Dim _CRM_LeadsDocumentation_New As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With _CRM_LeadsDocumentation_New
|
||||
If _CRM_LeadsDocumentation IsNot Nothing Then
|
||||
.RowGroup1 = _CRM_LeadsDocumentation.RowGroup1
|
||||
.RowGroup2 = _CRM_LeadsDocumentation.RowGroup2
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_LeadsDocumentation.CRM_Leads.Oid)
|
||||
Else
|
||||
.RowGroup1 = ""
|
||||
.RowGroup2 = ""
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_Opportunities.CRM_Leads.Oid)
|
||||
End If
|
||||
|
||||
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)
|
||||
.File = New FileData(_ocur.Session)
|
||||
.File.LoadFromStream("EmailMessage.msg", _fs)
|
||||
.File.FileName = "E-mail üzenet"
|
||||
_fs.Close()
|
||||
If System.IO.File.Exists(Path.GetTempPath() + "EmailMessage.msg") Then
|
||||
System.IO.File.Delete(Path.GetTempPath() + "EmailMessage.msg")
|
||||
End If
|
||||
End With
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
End If
|
||||
ElseIf e.Data.GetDataPresent(DataFormats.FileDrop) Then
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CRM_LeadsDocumentation_New As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With _CRM_LeadsDocumentation_New
|
||||
If _CRM_LeadsDocumentation IsNot Nothing Then
|
||||
.RowGroup1 = _CRM_LeadsDocumentation.RowGroup1
|
||||
.RowGroup2 = _CRM_LeadsDocumentation.RowGroup2
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_LeadsDocumentation.CRM_Leads.Oid)
|
||||
Else
|
||||
.RowGroup1 = ""
|
||||
.RowGroup2 = ""
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_Opportunities.CRM_Leads.Oid)
|
||||
End If
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
End With
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
End If
|
||||
ElseIf e.Data.GetDataPresent("FileGroupDescriptor") Then 'Email
|
||||
Dim _OL As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
|
||||
_WaitFormClass.InitWork(0, 1, _OL.ActiveExplorer.Selection.Count)
|
||||
If _OL.ActiveExplorer.Selection.Count > 0 Then
|
||||
For ik As Long = 1 To _OL.ActiveExplorer.Selection.Count
|
||||
Dim _FileIn As Object = _OL.ActiveExplorer.Selection(ik)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
If _MailItem IsNot Nothing Then
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = ""
|
||||
If _MailItem.Subject IsNot Nothing Then
|
||||
_Subject = _MailItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
Else
|
||||
_Subject = "Nincs tárgy"
|
||||
End If
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
_FileName = _FileName.Replace("\\", "\")
|
||||
_MailItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _CRM_LeadsDocumentation_New As New CRM_LeadsDocumentation(_ocur.Session)
|
||||
With _CRM_LeadsDocumentation_New
|
||||
If _CRM_LeadsDocumentation IsNot Nothing Then
|
||||
.RowGroup1 = _CRM_LeadsDocumentation.RowGroup1
|
||||
.RowGroup2 = _CRM_LeadsDocumentation.RowGroup2
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_LeadsDocumentation.CRM_Leads.Oid)
|
||||
Else
|
||||
.RowGroup1 = ""
|
||||
.RowGroup2 = ""
|
||||
.CRM_Leads = _ocur.GetObjectByKey(Of CRM_Leads)(_CRM_Opportunities.CRM_Leads.Oid)
|
||||
End If
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.FileCreated = GetFileCreatedDate(_FileName)
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.File = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
End With
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
SwitchOutlookPanes(_OL)
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub ToDragGridView_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
If _AllowSelect_CRM_Opportunities Then
|
||||
Dim view As XafGridView = TryCast(sender, XafGridView)
|
||||
view.ClearSelection()
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
view.SelectRow(hitInfo.RowHandle)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aDragDrop_CRM_Change_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aDragDrop_CRM_Change.CustomizePopupWindowParams
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = _onew.CreateObject(Of ChangeFileAttachment_PopUp)()
|
||||
e.View = Application.CreateDetailView(_onew, "ChangeFileAttachment_PopUp_DetailView", True, _ChangeFileAttachment_PopUp)
|
||||
e.View.Tag = "aCRM_LeadsDocumentation_ChangeGroup"
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_CRM_Change_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aDragDrop_CRM_Change.Execute
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), ChangeFileAttachment_PopUp)
|
||||
Dim _CRM_Opportunities As CRM_Opportunities = _onew.GetObject(TryCast(View.SelectedObjects(0), CRM_Opportunities))
|
||||
_WaitFormClass.InitWork(1, 1, _Selection.Count)
|
||||
For Each _CRM_LeadsDocumentation_Select As CRM_LeadsDocumentation In _Selection
|
||||
Dim _CRM_LeadsDocumentation As CRM_LeadsDocumentation = _onew.GetObject(_CRM_LeadsDocumentation_Select)
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup1 Then
|
||||
_CRM_LeadsDocumentation.RowGroup1 = _ChangeFileAttachment_PopUp.RowGroup1
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup2 Then
|
||||
_CRM_LeadsDocumentation.RowGroup2 = _ChangeFileAttachment_PopUp.RowGroup2
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeStatus Then
|
||||
_CRM_LeadsDocumentation.Status = _ChangeFileAttachment_PopUp.Status
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork
|
||||
_Selection.Clear()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'------Subs as Functions-------------
|
||||
Private Function LoadOtherFile(ByVal _ActFile As String, _FileData As FileData) As FileData
|
||||
Dim _StreamFile = New System.IO.FileStream(_ActFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
|
||||
Dim _StreamReader As New System.IO.StreamReader(_StreamFile)
|
||||
_StreamFile.Seek(0, System.IO.SeekOrigin.Begin)
|
||||
|
||||
_FileData.LoadFromStream(_ActFile, _StreamFile)
|
||||
_FileData.FileName = System.IO.Path.GetFileName(_ActFile)
|
||||
_StreamReader.Close()
|
||||
_StreamFile.Close()
|
||||
|
||||
Return _FileData
|
||||
|
||||
End Function
|
||||
Private Function GetFileCreatedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetCreationTime(_ActFile)
|
||||
End Function
|
||||
Private Function GetFileModifiedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetLastAccessTime(_ActFile)
|
||||
End Function
|
||||
|
||||
Public Sub SwitchOutlookPanes(_OL As Microsoft.Office.Interop.Outlook.Application)
|
||||
Dim _Explorer As Microsoft.Office.Interop.Outlook.Explorer = _OL.ActiveExplorer
|
||||
Try
|
||||
If _OL IsNot Nothing And _Explorer IsNot Nothing Then
|
||||
Dim nMAPIFOlder As Interop.Outlook.MAPIFolder = _Explorer.CurrentFolder
|
||||
Dim _NameSpace As Microsoft.Office.Interop.Outlook.NameSpace = _OL.GetNamespace("MAPI")
|
||||
If _NameSpace.Folders(1) IsNot Nothing Then
|
||||
If _NameSpace.Folders(1).Folders.Count > 0 Then
|
||||
If _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count) IsNot Nothing Then
|
||||
If _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count).Name <> nMAPIFOlder.Name Then
|
||||
_Explorer.CurrentFolder = _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count)
|
||||
Else
|
||||
_Explorer.CurrentFolder = _NameSpace.Folders(1).Folders(1)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
System.Threading.Thread.Sleep(1000)
|
||||
_Explorer.CurrentFolder = nMAPIFOlder
|
||||
System.Threading.Thread.Sleep(1000)
|
||||
End If
|
||||
Catch ex As System.Exception
|
||||
Finally
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
Marshal.ReleaseComObject(_OL)
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
Partial Class DragAndDropCRMOutlookCustomers_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()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.aDragDrop_CRM_Customer_Change = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
'
|
||||
'aDragDrop_CRM_Customer_Change
|
||||
'
|
||||
Me.aDragDrop_CRM_Customer_Change.AcceptButtonCaption = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.CancelButtonCaption = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.Caption = "aDragDrop_CRM_Customer_Change"
|
||||
Me.aDragDrop_CRM_Customer_Change.Category = "aDragDrop_CRM_Customer_Change"
|
||||
Me.aDragDrop_CRM_Customer_Change.ConfirmationMessage = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.Id = "aDragDrop_CRM_Customer_Change"
|
||||
Me.aDragDrop_CRM_Customer_Change.ImageName = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.Shortcut = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.Tag = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.TargetObjectsCriteria = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.TargetViewId = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.ToolTip = Nothing
|
||||
Me.aDragDrop_CRM_Customer_Change.TypeOfView = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aDragDrop_CRM_Customer_Change As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,126 @@
|
||||
<?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="aDragDrop_CRM_Customer_Change.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</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,504 @@
|
||||
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 DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports System.Drawing
|
||||
Imports System.Collections
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Data
|
||||
Imports DevExpress.ExpressApp.Win.Editors
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.ExpressApp.Win
|
||||
Imports Microsoft.Office
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
|
||||
Public Class DragAndDropCRMOutlookCustomers_VC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Private _CanEmailDrop As Boolean = True
|
||||
Private _Selection As New ArrayList
|
||||
Dim _ActSelection As Object
|
||||
Private _DoDragGridControl As DevExpress.XtraGrid.GridControl
|
||||
Private _DoDragGridView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _DoDragGridControlOutlookEMailAttachments As DevExpress.XtraGrid.GridControl
|
||||
Private _DoDragGridViewOutlookEMailAttachments As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
|
||||
Private _ToDragGridControl As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridView As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlCustomers As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewCustomers As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridViewCustomersFileAttachment As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlCustomersFileAttachment As DevExpress.XtraGrid.GridControl
|
||||
Private downHitInfo As GridHitInfo = Nothing
|
||||
Dim _WaitFormClass As New WaitFormClass
|
||||
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
End Sub
|
||||
Protected Overrides Sub OnViewControlsCreated()
|
||||
MyBase.OnViewControlsCreated()
|
||||
|
||||
If View.Id = "OutlookEMailIn_OutlookEMailAttachments_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentListViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of Nuvolar.Module.Win.OutlookEmailVC).aAttachFile.Active.SetItemValue("", False)
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_DoDragGridViewOutlookEMailAttachments = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_DoDragGridViewOutlookEMailAttachments.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseUp
|
||||
_DoDragGridControlOutlookEMailAttachments = _DoDragGridViewOutlookEMailAttachments.GridControl
|
||||
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseDown, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseMove, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove
|
||||
AddHandler View.SelectionChanged, AddressOf OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged
|
||||
|
||||
End If
|
||||
|
||||
If View.Id = "Customers_ListView_CRM_Outlook" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCustomers = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlCustomers = _ToDragGridViewCustomers.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCustomers.DragOver, AddressOf ToDragGridControlCustomers_DragOver
|
||||
AddHandler _ToDragGridControlCustomers.DragDrop, AddressOf ToDragGridControlCustomers_DragDrop
|
||||
|
||||
End If
|
||||
|
||||
If View.Id = "Customers_CustomersFileAttachment_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentListViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController).Active.SetItemValue("", False)
|
||||
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCustomersFileAttachment = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
|
||||
_ToDragGridControlCustomersFileAttachment = _ToDragGridViewCustomersFileAttachment.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCustomersFileAttachment.DragOver, AddressOf ToDragGridControlCustomersFileAttachment_DragOver
|
||||
AddHandler _ToDragGridControlCustomersFileAttachment.DragDrop, AddressOf ToDragGridControlCustomersFileAttachment_DragDrop
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
'Protected Overrides Sub OnDeactivated()
|
||||
' MyBase.OnDeactivated()
|
||||
' 'If View.Id = "Customers_CustomersFileAttachment_ListView" Then
|
||||
' ' Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
' ' _ToDragGridViewCustomersFileAttachment = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
|
||||
' ' _ToDragGridControlCustomersFileAttachment = _ToDragGridViewCustomersFileAttachment.GridControl
|
||||
|
||||
' ' RemoveHandler _ToDragGridControlCustomersFileAttachment.DragOver, AddressOf ToDragGridControlCustomersFileAttachment_DragOver
|
||||
' ' RemoveHandler _ToDragGridControlCustomersFileAttachment.DragDrop, AddressOf ToDragGridControlCustomersFileAttachment_DragDrop
|
||||
|
||||
' 'End If
|
||||
'End Sub
|
||||
'------Subs as Functions-------------
|
||||
Private Function LoadOtherFile(ByVal _ActFile As String, _FileData As FileData) As FileData
|
||||
Dim _StreamFile = New System.IO.FileStream(_ActFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
|
||||
Dim _StreamReader As New System.IO.StreamReader(_StreamFile)
|
||||
_StreamFile.Seek(0, System.IO.SeekOrigin.Begin)
|
||||
|
||||
_FileData.LoadFromStream(_ActFile, _StreamFile)
|
||||
_FileData.FileName = System.IO.Path.GetFileName(_ActFile)
|
||||
_StreamReader.Close()
|
||||
_StreamFile.Close()
|
||||
|
||||
Return _FileData
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown(sender As Object, e As MouseEventArgs)
|
||||
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
downHitInfo = Nothing
|
||||
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
If Control.ModifierKeys <> Keys.None Then
|
||||
Return
|
||||
End If
|
||||
If e.Button = MouseButtons.Left AndAlso hitInfo.InRow AndAlso hitInfo.HitTest <> GridHitTest.RowIndicator Then
|
||||
downHitInfo = hitInfo
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If e.Button = MouseButtons.Left AndAlso downHitInfo IsNot Nothing Then
|
||||
Dim dragSize As Size = SystemInformation.DragSize
|
||||
Dim dragRect As New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize)
|
||||
|
||||
If (Not dragRect.Contains(New Point(e.X, e.Y))) Then
|
||||
view.GridControl.DoDragDrop(_Selection, DragDropEffects.All)
|
||||
downHitInfo = Nothing
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged(sender As Object, e As EventArgs)
|
||||
|
||||
_Selection.Clear()
|
||||
_Selection.AddRange(View.SelectedObjects)
|
||||
End Sub
|
||||
|
||||
Private Sub ToDragGridControlCustomers_DragOver(sender As Object, e As DragEventArgs)
|
||||
|
||||
e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewCustomers.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomers.CollapseAllGroups()
|
||||
If _ToDragGridViewCustomers.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomers.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
|
||||
If _ToDragGridViewCustomers.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
_ToDragGridViewCustomers.ClearSelection()
|
||||
_ToDragGridViewCustomers.SelectRow(_GridHitInfo.RowHandle)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCustomers_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
Dim _Customers As Customers = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), Customers)
|
||||
If _Customers Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
If TryCast(_AttachmentSelection(0), OutlookEMailAttachments) Is Nothing Then Throw New InvalidCastException
|
||||
_WaitFormClass.InitWork(0, 1, _AttachmentSelection.Count)
|
||||
_Selection.Clear()
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _CustomersFileAttachment As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachment)
|
||||
.Customers = _ocur.GetObject(_Customers)
|
||||
.File = _ocur.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.File.FileName = _OutlookEMailAttachments.DocumentFileData.File.FileName
|
||||
End With
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
|
||||
_Selection.Add(_CustomersFileAttachment)
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookCustomers_VC).aDragDrop_CRM_Customer_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
_Selection.Clear()
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.Customers = _ocur.GetObject(_Customers)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
_Selection.Add(_CustomersFileAttachmentNew)
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookCustomers_VC).aDragDrop_CRM_Customer_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
Else
|
||||
If _CanEmailDrop Then
|
||||
_CanEmailDrop = False
|
||||
Dim _OL As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
|
||||
_WaitFormClass.InitWork(0, 1, _OL.ActiveExplorer.Selection.Count)
|
||||
If _OL.ActiveExplorer.Selection.Count > 0 Then
|
||||
For ik As Long = 1 To _OL.ActiveExplorer.Selection.Count
|
||||
_FileIn = _OL.ActiveExplorer.Selection(ik)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
If _MailItem IsNot Nothing Then
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = _MailItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
_FileName = _FileName.Replace("\\", "\")
|
||||
_MailItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.Customers = _ocur.GetObject(_Customers)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
.ShortName = _MailItem.Sender.Name
|
||||
.FileCreated = _MailItem.CreationTime
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.Description = _MailItem.Subject
|
||||
End With
|
||||
_Selection.Add(_CustomersFileAttachmentNew)
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
SwitchOutlookPanes(_OL)
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookCustomers_VC).aDragDrop_CRM_Customer_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
End If
|
||||
End If
|
||||
_CanEmailDrop = True
|
||||
End If
|
||||
End If
|
||||
Catch ex As InvalidCastException
|
||||
MsgBox("Ügyfélhez nem lehet e-mailt rendeleni!", MsgBoxStyle.OkOnly, "Hiba!")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCustomersFileAttachment_DragOver(sender As Object, e As DragEventArgs)
|
||||
|
||||
'e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersFileAttachment.CollapseAllGroups()
|
||||
If _ToDragGridViewCustomersFileAttachment.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersFileAttachment.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = Nothing
|
||||
|
||||
If Not _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.None
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = "NODROP"
|
||||
|
||||
ElseIf _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.Copy
|
||||
_ToDragGridViewCustomersFileAttachment.ClearSelection()
|
||||
_ToDragGridViewCustomersFileAttachment.SelectRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = _ToDragGridViewCustomersFileAttachment.GetRow(_ToDragGridViewCustomersFileAttachment.GetSelectedRows(0))
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = ""
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCustomersFileAttachment_DragDrop(sender As Object, e As DragEventArgs)
|
||||
'Try
|
||||
If _ToDragGridViewCustomersFileAttachment.Tag = "NODROP" Then
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = ""
|
||||
Return
|
||||
End If
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
Dim _Customer_CustomersFileAttachment As CustomersFileAttachment = Nothing
|
||||
If _ActSelection IsNot Nothing Then
|
||||
_Customer_CustomersFileAttachment = TryCast(_ActSelection, CustomersFileAttachment)
|
||||
Else
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
|
||||
_Customer_CustomersFileAttachment = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), CustomersFileAttachment)
|
||||
End If
|
||||
|
||||
If _Customer_CustomersFileAttachment Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, _AttachmentSelection.Count)
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _CustomersFileAttachment As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachment)
|
||||
.RowGroup1 = _Customer_CustomersFileAttachment.RowGroup1
|
||||
.RowGroup2 = _Customer_CustomersFileAttachment.RowGroup2
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.Customers = _ocur.GetObject(_Customer_CustomersFileAttachment.Customers)
|
||||
.File = _ocur.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.File.FileName = _OutlookEMailAttachments.DocumentFileData.File.FileName
|
||||
End With
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.RowGroup1 = _Customer_CustomersFileAttachment.RowGroup1
|
||||
.RowGroup2 = _Customer_CustomersFileAttachment.RowGroup2
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.Customers = _ocur.GetObject(_Customer_CustomersFileAttachment.Customers)
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
Else
|
||||
If _CanEmailDrop Then
|
||||
_CanEmailDrop = False
|
||||
Dim _OL As Microsoft.Office.Interop.Outlook.Application = New Microsoft.Office.Interop.Outlook.Application
|
||||
If _OL.ActiveExplorer.Selection.Count > 0 Then
|
||||
_WaitFormClass.InitWork(0, 1, _OL.ActiveExplorer.Selection.Count)
|
||||
For ik = 1 To _OL.ActiveExplorer.Selection.Count
|
||||
_FileIn = _OL.ActiveExplorer.Selection(ik)
|
||||
Dim _MailItem As Microsoft.Office.Interop.Outlook.MailItem = TryCast(_FileIn, Microsoft.Office.Interop.Outlook.MailItem)
|
||||
If _MailItem IsNot Nothing Then
|
||||
Dim _FileName As String = ""
|
||||
Dim _Subject As String = ""
|
||||
If _MailItem.Subject IsNot Nothing Then
|
||||
_Subject = _MailItem.Subject.Replace(":", "")
|
||||
_Subject = _Subject.Replace("/", "-")
|
||||
Else
|
||||
_Subject = "Nincs tárgy"
|
||||
End If
|
||||
If _Subject.Length > 16 Then
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject.Remove(16, _Subject.Length - 16) + ".msg"
|
||||
Else
|
||||
_FileName = System.IO.Path.GetTempPath + _Subject + ".msg"
|
||||
End If
|
||||
|
||||
_MailItem.SaveAs(_FileName, Microsoft.Office.Interop.Outlook.OlSaveAsType.olMSG)
|
||||
|
||||
If System.IO.File.Exists(_FileName) Then
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.RowGroup1 = _Customer_CustomersFileAttachment.RowGroup1
|
||||
.RowGroup2 = _Customer_CustomersFileAttachment.RowGroup2
|
||||
.Customers = _ocur.GetObject(_Customer_CustomersFileAttachment.Customers)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = LoadOtherFile(_FileName, New FileData(_ocur.Session))
|
||||
.ShortName = _MailItem.Sender.Name
|
||||
.FileCreated = _MailItem.ReceivedTime 'Küldés dátuma kell?
|
||||
.FileModified = GetFileModifiedDate(_FileName)
|
||||
.Description = _MailItem.Subject
|
||||
End With
|
||||
_Selection.Add(_CustomersFileAttachmentNew)
|
||||
System.IO.File.Delete(_FileName)
|
||||
End If
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
_Waitformclass.FinalWork
|
||||
SwitchOutlookPanes(_OL)
|
||||
End If
|
||||
End If
|
||||
_CanEmailDrop = True
|
||||
End If
|
||||
End If
|
||||
'Catch ex As Exception
|
||||
'MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
'End Try
|
||||
End Sub
|
||||
|
||||
Private Sub aDragDrop_CRM_Customer_Change_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aDragDrop_CRM_Customer_Change.CustomizePopupWindowParams
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = _onew.CreateObject(Of ChangeFileAttachment_PopUp)()
|
||||
e.View = Application.CreateDetailView(_onew, "ChangeFileAttachment_PopUp_DetailView", True, _ChangeFileAttachment_PopUp)
|
||||
e.View.Tag = "aCustomersFileAttachment_ChangeGroup"
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_CRM_Customer_Change_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aDragDrop_CRM_Customer_Change.Execute
|
||||
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), ChangeFileAttachment_PopUp)
|
||||
Dim _Customers As Customers = _onew.GetObject(TryCast(View.SelectedObjects(0), Customers))
|
||||
_WaitFormClass.InitWork(1, 1, _Selection.Count)
|
||||
For Each _CustomersFileAttachment_Select As CustomersFileAttachment In _Selection
|
||||
Dim _CustomersFileAttachment As CustomersFileAttachment = _onew.GetObject(_CustomersFileAttachment_Select)
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup1 Then
|
||||
_CustomersFileAttachment.RowGroup1 = _ChangeFileAttachment_PopUp.RowGroup1
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup2 Then
|
||||
_CustomersFileAttachment.RowGroup2 = _ChangeFileAttachment_PopUp.RowGroup2
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeStatus Then
|
||||
_CustomersFileAttachment.Status = _ChangeFileAttachment_PopUp.Status
|
||||
End If
|
||||
_WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
View.Refresh()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork
|
||||
_Selection.Clear()
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Private Function GetFileCreatedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetCreationTime(_ActFile)
|
||||
End Function
|
||||
Private Function GetFileModifiedDate(_ActFile As String) As Date
|
||||
Return System.IO.File.GetLastAccessTime(_ActFile)
|
||||
End Function
|
||||
Public Sub SwitchOutlookPanes(_OL As Microsoft.Office.Interop.Outlook.Application)
|
||||
Dim _Explorer As Microsoft.Office.Interop.Outlook.Explorer = _OL.ActiveExplorer
|
||||
Try
|
||||
If _OL IsNot Nothing And _Explorer IsNot Nothing Then
|
||||
Dim nMAPIFOlder As Interop.Outlook.MAPIFolder = _Explorer.CurrentFolder
|
||||
Dim _NameSpace As Microsoft.Office.Interop.Outlook.NameSpace = _OL.GetNamespace("MAPI")
|
||||
If _NameSpace.Folders(1) IsNot Nothing Then
|
||||
If _NameSpace.Folders(1).Folders.Count > 0 Then
|
||||
If _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count) IsNot Nothing Then
|
||||
If _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count).Name <> nMAPIFOlder.Name Then
|
||||
_Explorer.CurrentFolder = _NameSpace.Folders(1).Folders(_NameSpace.Folders(1).Folders.Count)
|
||||
Else
|
||||
_Explorer.CurrentFolder = _NameSpace.Folders(1).Folders(1)
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
System.Threading.Thread.Sleep(1000)
|
||||
_Explorer.CurrentFolder = nMAPIFOlder
|
||||
System.Threading.Thread.Sleep(1000)
|
||||
End If
|
||||
Catch ex As System.Exception
|
||||
Finally
|
||||
Marshal.ReleaseComObject(_Explorer)
|
||||
Marshal.ReleaseComObject(_OL)
|
||||
End Try
|
||||
End Sub
|
||||
End Class
|
||||
+69
@@ -0,0 +1,69 @@
|
||||
Partial Class DragAndDropCRMOutlookProducts_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()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.aDragDrop_Products_Change = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
Me.aDragDrop_CustomersDoc_Change = New DevExpress.ExpressApp.Actions.PopupWindowShowAction(Me.components)
|
||||
'
|
||||
'aDragDrop_Products_Change
|
||||
'
|
||||
Me.aDragDrop_Products_Change.AcceptButtonCaption = Nothing
|
||||
Me.aDragDrop_Products_Change.CancelButtonCaption = Nothing
|
||||
Me.aDragDrop_Products_Change.Caption = "aDragDrop_Products_Change"
|
||||
Me.aDragDrop_Products_Change.Category = "aDragDrop_Products_Change"
|
||||
Me.aDragDrop_Products_Change.ConfirmationMessage = Nothing
|
||||
Me.aDragDrop_Products_Change.Id = "aDragDrop_Products_Change"
|
||||
Me.aDragDrop_Products_Change.ImageName = Nothing
|
||||
Me.aDragDrop_Products_Change.Shortcut = Nothing
|
||||
Me.aDragDrop_Products_Change.Tag = Nothing
|
||||
Me.aDragDrop_Products_Change.TargetObjectsCriteria = Nothing
|
||||
Me.aDragDrop_Products_Change.TargetViewId = Nothing
|
||||
Me.aDragDrop_Products_Change.ToolTip = Nothing
|
||||
Me.aDragDrop_Products_Change.TypeOfView = Nothing
|
||||
'
|
||||
'aDragDrop_CustomersDoc_Change
|
||||
'
|
||||
Me.aDragDrop_CustomersDoc_Change.AcceptButtonCaption = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.CancelButtonCaption = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.Caption = "aDragDrop_CustomersDoc_Change"
|
||||
Me.aDragDrop_CustomersDoc_Change.Category = "aDragDrop_CustomersDoc_Change"
|
||||
Me.aDragDrop_CustomersDoc_Change.ConfirmationMessage = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.Id = "aDragDrop_CustomersDoc_Change"
|
||||
Me.aDragDrop_CustomersDoc_Change.ImageName = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.Shortcut = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.Tag = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.TargetObjectsCriteria = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.TargetViewId = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.ToolTip = Nothing
|
||||
Me.aDragDrop_CustomersDoc_Change.TypeOfView = Nothing
|
||||
|
||||
End Sub
|
||||
Friend WithEvents aDragDrop_Products_Change As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
Friend WithEvents aDragDrop_CustomersDoc_Change As DevExpress.ExpressApp.Actions.PopupWindowShowAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,129 @@
|
||||
<?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="aDragDrop_Products_Change.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="aDragDrop_CustomersDoc_Change.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>221, 17</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,633 @@
|
||||
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 DevExpress.XtraGrid.Views.Grid
|
||||
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
|
||||
|
||||
Imports Microsoft.VisualBasic
|
||||
Imports System.Drawing
|
||||
Imports System.Collections
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Data
|
||||
Imports DevExpress.ExpressApp.Win.Editors
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.ExpressApp.Win
|
||||
Imports System.IO
|
||||
Imports DevExpress.ExpressApp.Utils
|
||||
|
||||
Public Class DragAndDropCRMOutlookProducts_VC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
|
||||
Private _Selection As New ArrayList
|
||||
Dim _ActSelection As Object
|
||||
Private downHitInfo As GridHitInfo = Nothing
|
||||
Dim _WaitFormClass As New WaitFormClass
|
||||
Private _CRM_Opportunities As CRM_Opportunities = Nothing
|
||||
Private _AllowSelect_CRM_Opportunities As Boolean = False
|
||||
|
||||
Private _DoDragGridViewOutlookEMailAttachments As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _DoDragGridControlOutlookEMailAttachments As DevExpress.XtraGrid.GridControl
|
||||
|
||||
Private _ToDragGridControlProducts As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewProducts As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlProductsDocumentations As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewProductsDocumentations As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlCustomersOrderPriority As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewCustomersOrderPriority As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
Private _ToDragGridControlCustomersFileAttachment As DevExpress.XtraGrid.GridControl
|
||||
Private _ToDragGridViewCustomersFileAttachment As DevExpress.XtraGrid.Views.Grid.GridView
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
|
||||
End Sub
|
||||
Protected Overrides Sub OnViewControlsCreated()
|
||||
MyBase.OnViewControlsCreated()
|
||||
|
||||
If View.Id = "OutlookEMailIn_OutlookEMailAttachments_ListView" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_DoDragGridViewOutlookEMailAttachments = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_DoDragGridViewOutlookEMailAttachments.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseUp
|
||||
_DoDragGridControlOutlookEMailAttachments = _DoDragGridViewOutlookEMailAttachments.GridControl
|
||||
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseDown, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown
|
||||
AddHandler _DoDragGridViewOutlookEMailAttachments.MouseMove, AddressOf DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove
|
||||
AddHandler View.SelectionChanged, AddressOf OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged
|
||||
End If
|
||||
If View.Id = "Products_ListView_CRM_Outlook" Then
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewProducts = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlProducts = _ToDragGridViewProducts.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlProducts.DragOver, AddressOf ToDragGridControlProducts_DragOver
|
||||
AddHandler _ToDragGridControlProducts.DragDrop, AddressOf ToDragGridControlProducts_DragDrop
|
||||
End If
|
||||
If View.Id = "Products_ProductsDocumentations_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentListViewController).Active.SetItemValue("", False)
|
||||
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewProductsDocumentations = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlProductsDocumentations = _ToDragGridViewProductsDocumentations.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlProductsDocumentations.DragOver, AddressOf ToDragGridControlProductsDocumentations_DragOver
|
||||
AddHandler _ToDragGridControlProductsDocumentations.DragDrop, AddressOf ToDragGridControlProductsDocumentations_DragDrop
|
||||
End If
|
||||
If View.Id = "Products_CustomersOrderPriority_ListView_CRM_Outlook" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController).Active.SetItemValue("", False)
|
||||
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCustomersOrderPriority = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
_ToDragGridControlCustomersOrderPriority = _ToDragGridViewCustomersOrderPriority.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCustomersOrderPriority.DragOver, AddressOf ToDragGridControlCustomersOrderPriority_DragOver
|
||||
AddHandler _ToDragGridControlCustomersOrderPriority.DragDrop, AddressOf ToDragGridControlCustomersOrderPrioritys_DragDrop
|
||||
End If
|
||||
If View.Id = "CustomersFileAttachment_ListView" Then
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.NewObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.CloneObject.CloneObjectViewController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.LinkUnlinkController).Active.SetItemValue("", False)
|
||||
Frame.GetController(Of DevExpress.ExpressApp.FileAttachments.Win.FileAttachmentListViewController).Active.SetItemValue("", False)
|
||||
|
||||
Dim _View As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
_ToDragGridViewCustomersFileAttachment = TryCast(_View.Editor, DevExpress.ExpressApp.Win.Editors.GridListEditor).GridView
|
||||
|
||||
_ToDragGridControlCustomersFileAttachment = _ToDragGridViewCustomersFileAttachment.GridControl
|
||||
|
||||
AddHandler _ToDragGridControlCustomersFileAttachment.DragOver, AddressOf ToDragGridControlCustomersFileAttachment_DragOver
|
||||
AddHandler _ToDragGridControlCustomersFileAttachment.DragDrop, AddressOf ToDragGridControlCustomersFileAttachment_DragDrop
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseDown(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
downHitInfo = Nothing
|
||||
|
||||
Dim hitInfo As GridHitInfo = view.CalcHitInfo(New Point(e.X, e.Y))
|
||||
If Control.ModifierKeys <> Keys.None Then
|
||||
Return
|
||||
End If
|
||||
If e.Button = MouseButtons.Left AndAlso hitInfo.InRow AndAlso hitInfo.HitTest <> GridHitTest.RowIndicator Then
|
||||
downHitInfo = hitInfo
|
||||
End If
|
||||
End Sub
|
||||
Private Sub DoDragGridViewOutlookEMailAttachments_MouseDown_MouseMove(sender As Object, e As MouseEventArgs)
|
||||
Dim view As GridView = TryCast(sender, GridView)
|
||||
If e.Button = MouseButtons.Left AndAlso downHitInfo IsNot Nothing Then
|
||||
Dim dragSize As Size = SystemInformation.DragSize
|
||||
Dim dragRect As New Rectangle(New Point(downHitInfo.HitPoint.X - dragSize.Width / 2, downHitInfo.HitPoint.Y - dragSize.Height / 2), dragSize)
|
||||
|
||||
If (Not dragRect.Contains(New Point(e.X, e.Y))) Then
|
||||
_AllowSelect_CRM_Opportunities = True
|
||||
view.GridControl.DoDragDrop(_Selection, DragDropEffects.All)
|
||||
downHitInfo = Nothing
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OutlookEMailIn_OutlookEMailAttachments_ListView_SelectionChanged(sender As Object, e As EventArgs)
|
||||
_Selection.Clear()
|
||||
_Selection.AddRange(View.SelectedObjects)
|
||||
End Sub
|
||||
|
||||
Private Sub ToDragGridControlProducts_DragOver(sender As Object, e As DragEventArgs)
|
||||
e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewProducts.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewProducts.CollapseAllGroups()
|
||||
If _ToDragGridViewProducts.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewProducts.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
|
||||
If _ToDragGridViewProducts.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
_ToDragGridViewProducts.ClearSelection()
|
||||
_ToDragGridViewProducts.SelectRow(_GridHitInfo.RowHandle)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ToDragGridControlProducts_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
Dim _Products As Products = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), Products)
|
||||
If _Products Is Nothing Then Return
|
||||
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
'_WaitFormClass.InitWork(0, 1, _AttachmentSelection.Count)
|
||||
_Selection.Clear()
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _ProductsDocumentations As New ProductsDocumentations(_onew.Session)
|
||||
With (_ProductsDocumentations)
|
||||
.Products = _onew.GetObject(_Products)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = _onew.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.ShortName = .File.FileName
|
||||
End With
|
||||
_Selection.Add(_ProductsDocumentations)
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
'_WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookProducts_VC).aDragDrop_Products_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
' _WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
_Selection.Clear()
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _ProductsDocumentations As New ProductsDocumentations(_onew.Session)
|
||||
With (_ProductsDocumentations)
|
||||
.Products = _onew.GetObject(_Products)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_onew.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
|
||||
_Selection.Add(_ProductsDocumentations)
|
||||
End If
|
||||
' _WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookProducts_VC).aDragDrop_Products_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
End If
|
||||
End If
|
||||
Catch ex As InvalidCastException
|
||||
MsgBox("Termékhez nem lehet e-mailt rendeleni!", MsgBoxStyle.OkOnly, "Hiba!")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
' _Waitformclass.FinalWork
|
||||
Frame.GetController(Of DevExpress.ExpressApp.SystemModule.RefreshController).RefreshAction.DoExecute()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ToDragGridControlProductsDocumentations_DragOver(sender As Object, e As DragEventArgs)
|
||||
' e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
If _ToDragGridViewProductsDocumentations.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewProductsDocumentations.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = Nothing
|
||||
|
||||
If Not _ToDragGridViewProductsDocumentations.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.None
|
||||
_ToDragGridViewProductsDocumentations.Tag = "NODROPDOC"
|
||||
|
||||
ElseIf _ToDragGridViewProductsDocumentations.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.Copy
|
||||
_ToDragGridViewProductsDocumentations.ClearSelection()
|
||||
_ToDragGridViewProductsDocumentations.SelectRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = _ToDragGridViewProductsDocumentations.GetRow(_ToDragGridViewProductsDocumentations.GetSelectedRows(0))
|
||||
_ToDragGridViewProductsDocumentations.Tag = ""
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ToDragGridControlProductsDocumentations_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
If _ToDragGridViewProductsDocumentations.Tag = "NODROPDOC" Then
|
||||
_ToDragGridViewProductsDocumentations.Tag = ""
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
Dim _ProductsDocumentations As ProductsDocumentations = Nothing
|
||||
|
||||
If _ActSelection IsNot Nothing Then
|
||||
_ProductsDocumentations = TryCast(_ActSelection, ProductsDocumentations)
|
||||
Else
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
_ProductsDocumentations = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), ProductsDocumentations)
|
||||
End If
|
||||
|
||||
If _ProductsDocumentations Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
_WaitFormClass.Initwork(1, 1, _AttachmentSelection.Count)
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _ProductsDocumentationsNew As New ProductsDocumentations(_ocur.Session)
|
||||
With (_ProductsDocumentationsNew)
|
||||
.RowGroup1 = _ProductsDocumentations.RowGroup1
|
||||
.RowGroup2 = _ProductsDocumentations.RowGroup2
|
||||
.Products = _ocur.GetObject(_ProductsDocumentations.Products)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = _ocur.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.ShortName = .File.FileName
|
||||
End With
|
||||
_Selection.Add(_ProductsDocumentations)
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _ProductsDocumentationsNew As New ProductsDocumentations(_ocur.Session)
|
||||
With (_ProductsDocumentationsNew)
|
||||
.RowGroup1 = _ProductsDocumentations.RowGroup1
|
||||
.RowGroup2 = _ProductsDocumentations.RowGroup2
|
||||
.Products = _ocur.GetObject(_ProductsDocumentations.Products)
|
||||
.Status = eProductsDocumentationStatus.ePublic
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
End If
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ToDragGridControlCustomersOrderPriority_DragOver(sender As Object, e As DragEventArgs)
|
||||
e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewCustomersOrderPriority.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersOrderPriority.CollapseAllGroups()
|
||||
If _ToDragGridViewCustomersOrderPriority.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersOrderPriority.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
|
||||
If _ToDragGridViewCustomersOrderPriority.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
_ToDragGridViewCustomersOrderPriority.ClearSelection()
|
||||
_ToDragGridViewCustomersOrderPriority.SelectRow(_GridHitInfo.RowHandle)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCustomersOrderPrioritys_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
Dim _CustomersOrderPriority As CustomersOrderPriority = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), CustomersOrderPriority)
|
||||
If _CustomersOrderPriority Is Nothing Then Return
|
||||
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
' _WaitFormClass.InitWork(0, 1, _AttachmentSelection.Count)
|
||||
_Selection.Clear()
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _CustomersFileAttachment As New CustomersFileAttachment(_onew.Session)
|
||||
With (_CustomersFileAttachment)
|
||||
.Customers = _onew.GetObject(TryCast(_CustomersOrderPriority.CustomersOrder, Customers))
|
||||
.File = _onew.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.File.FileName = _OutlookEMailAttachments.DocumentFileData.File.FileName
|
||||
.ShortName = .File.FileName
|
||||
End With
|
||||
_Selection.Add(_CustomersFileAttachment)
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
' _WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookProducts_VC).aDragDrop_CustomersDoc_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
' _WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
_Selection.Clear()
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CustomersFileAttachment As New CustomersFileAttachment(_onew.Session)
|
||||
With (_CustomersFileAttachment)
|
||||
.Customers = _onew.GetObject(TryCast(_CustomersOrderPriority.CustomersOrder, Customers))
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_onew.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
_Selection.Add(_CustomersFileAttachment)
|
||||
End If
|
||||
' _WaitFormClass.DoWork
|
||||
Next
|
||||
_onew.CommitChanges()
|
||||
|
||||
CType(New PopupWindowShowActionHelper(Frame.GetController(Of DragAndDropCRMOutlookProducts_VC).aDragDrop_CustomersDoc_Change), PopupWindowShowActionHelper).ShowPopupWindow()
|
||||
End If
|
||||
End If
|
||||
Catch ex As InvalidCastException
|
||||
MsgBox("Beszállítóhoz nem lehet e-mailt rendeleni!", MsgBoxStyle.OkOnly, "Hiba!")
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
' _Waitformclass.FinalWork
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub ToDragGridControlCustomersFileAttachment_DragOver(sender As Object, e As DragEventArgs)
|
||||
'e.Effect = DragDropEffects.Copy
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
|
||||
' If Not _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersFileAttachment.CollapseAllGroups()
|
||||
If _ToDragGridViewCustomersFileAttachment.IsGroupRow(_GridHitInfo.RowHandle) Then _ToDragGridViewCustomersFileAttachment.ExpandGroupRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = Nothing
|
||||
|
||||
If Not _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.None
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = "NODROPATTACH"
|
||||
|
||||
ElseIf _ToDragGridViewCustomersFileAttachment.IsDataRow(_GridHitInfo.RowHandle) Then
|
||||
e.Effect = DragDropEffects.Copy
|
||||
_ToDragGridViewCustomersFileAttachment.ClearSelection()
|
||||
_ToDragGridViewCustomersFileAttachment.SelectRow(_GridHitInfo.RowHandle)
|
||||
_ActSelection = _ToDragGridViewCustomersFileAttachment.GetRow(_ToDragGridViewCustomersFileAttachment.GetSelectedRows(0))
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = ""
|
||||
End If
|
||||
End Sub
|
||||
Private Sub ToDragGridControlCustomersFileAttachment_DragDrop(sender As Object, e As DragEventArgs)
|
||||
Try
|
||||
|
||||
If _ToDragGridViewCustomersFileAttachment.Tag = "NODROPATTACH" Then
|
||||
_ToDragGridViewCustomersFileAttachment.Tag = ""
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim _ListView As DevExpress.ExpressApp.ListView = TryCast(View, DevExpress.ExpressApp.ListView)
|
||||
If _ListView Is Nothing Then Return
|
||||
Dim _Grid As DevExpress.XtraGrid.GridControl = TryCast(sender, DevExpress.XtraGrid.GridControl)
|
||||
Dim _GridHitInfo As GridHitInfo = _Grid.MainView.CalcHitInfo(_Grid.PointToClient(New Point(e.X, e.Y)))
|
||||
Dim _CustomersFileAttachment As CustomersFileAttachment = Nothing
|
||||
If _ActSelection IsNot Nothing Then
|
||||
_CustomersFileAttachment = TryCast(_ActSelection, CustomersFileAttachment)
|
||||
Else
|
||||
If Not _GridHitInfo.InRow OrElse Not _GridHitInfo.InRowCell Then Return
|
||||
If Not DirectCast(_Grid.MainView, GridView).IsDataRow(_GridHitInfo.RowHandle) Then Return
|
||||
|
||||
_CustomersFileAttachment = TryCast(_Grid.MainView.GetRow(_GridHitInfo.RowHandle), CustomersFileAttachment)
|
||||
End If
|
||||
|
||||
If _CustomersFileAttachment Is Nothing Then Return
|
||||
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
|
||||
Dim _AttachmentSelection As ArrayList = e.Data.GetData(GetType(ArrayList))
|
||||
If _AttachmentSelection IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, _AttachmentSelection.Count)
|
||||
For Each _OutlookEMailAttachments As OutlookEMailAttachments In _AttachmentSelection
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.RowGroup1 = _CustomersFileAttachment.RowGroup1
|
||||
.RowGroup2 = _CustomersFileAttachment.RowGroup2
|
||||
.Customers = _ocur.GetObject(_CustomersFileAttachment.Customers)
|
||||
.File = _ocur.GetObject(_OutlookEMailAttachments.DocumentFileData.File)
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(.File)
|
||||
.FileModified = GetFileModifiedDate(.File)
|
||||
End With
|
||||
_OutlookEMailAttachments.OutlookEMailIn.IsReaded = True
|
||||
_OutlookEMailAttachments.OutlookEMailIn.Qualified = True
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
Else
|
||||
Dim _FileIn As Object = e.Data.GetData(DataFormats.FileDrop)
|
||||
If _FileIn IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(0, 1, TryCast(_FileIn, String()).Length)
|
||||
For Each _ActFile As String In _FileIn
|
||||
If System.IO.File.Exists(_ActFile) Then
|
||||
Dim _CustomersFileAttachmentNew As New CustomersFileAttachment(_ocur.Session)
|
||||
With (_CustomersFileAttachmentNew)
|
||||
.RowGroup1 = _CustomersFileAttachment.RowGroup1
|
||||
.RowGroup2 = _CustomersFileAttachment.RowGroup2
|
||||
.Customers = _ocur.GetObject(_CustomersFileAttachment.Customers)
|
||||
.File = LoadOtherFile(_ActFile, New FileData(_ocur.Session))
|
||||
.ShortName = .File.FileName
|
||||
.FileCreated = GetFileCreatedDate(_ActFile)
|
||||
.FileModified = GetFileModifiedDate(_ActFile)
|
||||
End With
|
||||
End If
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
_ocur.CommitChanges()
|
||||
|
||||
End If
|
||||
End If
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork()
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_Products_Change_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aDragDrop_Products_Change.CustomizePopupWindowParams
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = _onew.CreateObject(Of ChangeFileAttachment_PopUp)()
|
||||
e.View = Application.CreateDetailView(_onew, "ChangeFileAttachment_PopUp_DetailView", True, _ChangeFileAttachment_PopUp)
|
||||
e.View.Tag = "aProductsDocumentations_ChangeGroup"
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_Products_Change_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aDragDrop_Products_Change.Execute
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), ChangeFileAttachment_PopUp)
|
||||
If TryCast(_Selection(0), ProductsDocumentations) IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(1, 1, _Selection.Count)
|
||||
For Each _ProductsDocumentationsAct As ProductsDocumentations In _Selection
|
||||
Dim _ProductsDocumentations As ProductsDocumentations = _onew.GetObject(_ProductsDocumentationsAct)
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup1 Then
|
||||
_ProductsDocumentations.RowGroup1 = _ChangeFileAttachment_PopUp.RowGroup1
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup2 Then
|
||||
_ProductsDocumentations.RowGroup2 = _ChangeFileAttachment_PopUp.RowGroup2
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeStatus Then
|
||||
_ProductsDocumentations.Status = _ChangeFileAttachment_PopUp.Status
|
||||
End If
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
End If
|
||||
_onew.CommitChanges()
|
||||
View.Refresh()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork()
|
||||
_Selection.Clear()
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_CustomersDoc_Change_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aDragDrop_CustomersDoc_Change.CustomizePopupWindowParams
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = _onew.CreateObject(Of ChangeFileAttachment_PopUp)()
|
||||
e.View = Application.CreateDetailView(_onew, "ChangeFileAttachment_PopUp_DetailView", True, _ChangeFileAttachment_PopUp)
|
||||
e.View.Tag = "aCustomersDocFileAttachment_ChangeGroup"
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
End Try
|
||||
End Sub
|
||||
Private Sub aDragDrop_CustomersDoc_Change_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aDragDrop_CustomersDoc_Change.Execute
|
||||
Try
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _ChangeFileAttachment_PopUp As ChangeFileAttachment_PopUp = TryCast(e.PopupWindow.View.SelectedObjects(0), ChangeFileAttachment_PopUp)
|
||||
If TryCast(_Selection(0), CustomersFileAttachment) IsNot Nothing Then
|
||||
_WaitFormClass.InitWork(1, 1, _Selection.Count)
|
||||
For Each _CustomersFileAttachmentAct As CustomersFileAttachment In _Selection
|
||||
Dim _CustomersFileAttachment As CustomersFileAttachment = _onew.GetObject(_CustomersFileAttachmentAct)
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup1 Then
|
||||
_CustomersFileAttachment.RowGroup1 = _ChangeFileAttachment_PopUp.RowGroup1
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeRowGroup2 Then
|
||||
_CustomersFileAttachment.RowGroup2 = _ChangeFileAttachment_PopUp.RowGroup2
|
||||
End If
|
||||
If _ChangeFileAttachment_PopUp.ChangeStatus Then
|
||||
_CustomersFileAttachment.Status = _ChangeFileAttachment_PopUp.Status
|
||||
End If
|
||||
_WaitFormClass.DoWork()
|
||||
Next
|
||||
End If
|
||||
_onew.CommitChanges()
|
||||
Catch ex As Exception
|
||||
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\NuvolarExceptions", "MsgBoxCheckItAgain")))
|
||||
Finally
|
||||
_Waitformclass.FinalWork()
|
||||
_Selection.Clear()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
'------Subs as Functions-------------
|
||||
Private Function LoadOtherFile(ByVal _ActFile As String, _FileData As FileData) As FileData
|
||||
Dim _StreamFile = New System.IO.FileStream(_ActFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
|
||||
Dim _StreamReader As New System.IO.StreamReader(_StreamFile)
|
||||
_StreamFile.Seek(0, System.IO.SeekOrigin.Begin)
|
||||
|
||||
_FileData.LoadFromStream(_ActFile, _StreamFile)
|
||||
_FileData.FileName = System.IO.Path.GetFileName(_ActFile)
|
||||
_StreamReader.Close()
|
||||
_StreamFile.Close()
|
||||
|
||||
Return _FileData
|
||||
End Function
|
||||
Public Function GetFileCreatedDate(_FileData As FileData) As Date
|
||||
Try
|
||||
Dim _FileName As String = System.IO.Path.GetTempPath + _FileData.FileName
|
||||
Dim _StreamFile As New System.IO.FileStream(_FileName, FileMode.Create)
|
||||
|
||||
_FileData.SaveToStream(_StreamFile)
|
||||
_StreamFile.Close()
|
||||
|
||||
Return File.GetCreationTime(_FileName)
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
Dim _FileName As String = System.IO.Path.GetTempPath + _FileData.FileName
|
||||
If File.Exists(_FileName) Then File.Delete(_FileName)
|
||||
End Try
|
||||
End Function
|
||||
Public Function GetFileCreatedDate(_FileName As String) As Date
|
||||
Return File.GetCreationTime(_FileName)
|
||||
End Function
|
||||
Public Function GetFileModifiedDate(_FileData As FileData) As Date
|
||||
Try
|
||||
Dim _FileName As String = System.IO.Path.GetTempPath + _FileData.FileName
|
||||
Dim _StreamFile As New System.IO.FileStream(_FileName, FileMode.Create)
|
||||
|
||||
_FileData.SaveToStream(_StreamFile)
|
||||
_StreamFile.Close()
|
||||
|
||||
Return File.GetLastAccessTime(_FileName)
|
||||
Catch ex As Exception
|
||||
Finally
|
||||
Dim _FileName As String = System.IO.Path.GetTempPath + _FileData.FileName
|
||||
If File.Exists(_FileName) Then File.Delete(_FileName)
|
||||
End Try
|
||||
End Function
|
||||
Public Function GetFileModifiedDate(_FileName As String) As Date
|
||||
Return File.GetLastAccessTime(_FileName)
|
||||
End Function
|
||||
End Class
|
||||
Reference in New Issue
Block a user