559 lines
30 KiB
VB.net
559 lines
30 KiB
VB.net
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.ExpressApp.Editors
|
|
Imports exontrol.EXG2ANTTLib
|
|
Imports DevExpress.Xpo
|
|
Imports DevExpress.Data.Filtering
|
|
Imports DevExpress.ExpressApp.SystemModule
|
|
Imports DevExpress.Persistent.BaseImpl
|
|
Imports System.Net.Mail
|
|
Imports System.Reflection
|
|
Imports DevExpress.ExpressApp.Utils
|
|
|
|
Public Class ProjectVC
|
|
Inherits SISBusiness.Module.ProjectVC
|
|
Dim _GanttControl As exontrol.EXG2ANTTLib.exg2antt
|
|
Dim _CtrlDownYes As Boolean = False
|
|
|
|
Public Sub New()
|
|
MyBase.New()
|
|
|
|
'This call is required by the Component Designer.
|
|
InitializeComponent()
|
|
RegisterActions(components)
|
|
|
|
End Sub
|
|
Protected Overrides Sub OnActivated()
|
|
MyBase.OnActivated()
|
|
|
|
If View.Id = "ProjectHeader_DetailView" Then
|
|
Dim _DetailView As DetailView = TryCast(View, DetailView)
|
|
Dim _GanttContolViewItem As ViewItem = _DetailView.FindItem("G2antt")
|
|
If _GanttContolViewItem IsNot Nothing Then
|
|
AddHandler _GanttContolViewItem.ControlCreated, AddressOf GanttContolViewItem_ControlCreated
|
|
AddHandler Frame.GetController(Of RefreshController).RefreshAction.Executing, AddressOf RefreshAction_Executing
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub aProjectAddRow_Execute_1(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aProjectAddRow.Execute
|
|
Dim _ProjectHeader As ProjectHeader = TryCast(View.SelectedObjects(0), ProjectHeader)
|
|
Dim _ProjectRows As ProjectRows
|
|
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
|
|
_ProjectRows = _onew.CreateObject(Of ProjectRows)()
|
|
_ProjectRows.ProjectHeader = _onew.GetObject(_ProjectHeader)
|
|
|
|
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "ProjectRows_DetailView", True, _ProjectRows)
|
|
End Sub
|
|
Private Sub aProjectEditRow_Execute_1(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aProjectEditRow.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ProjectRows As ProjectRows
|
|
Dim _selecteditem As Long = 0
|
|
Dim _Oid As String
|
|
If _GanttControl IsNot Nothing Then
|
|
_selecteditem = _GanttControl.Items.get_SelectedItem(0)
|
|
_Oid = _GanttControl.Items.get_CellValue(_selecteditem, 0)
|
|
_ProjectRows = _onew.FindObject(Of ProjectRows)(CriteriaOperator.Parse("Oid=?", _Oid))
|
|
If _ProjectRows IsNot Nothing Then
|
|
e.ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "ProjectRows_DetailView", True, _ProjectRows)
|
|
End If
|
|
End If
|
|
End Sub
|
|
|
|
Private Sub aProjectRefreshG2antt_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aProjectRefreshG2antt.Execute
|
|
'// Gantt diagram frissítése
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _ProjectHeader As ProjectHeader = TryCast(View.SelectedObjects(0), ProjectHeader)
|
|
|
|
|
|
If _ProjectHeader IsNot Nothing Then
|
|
Dim _ProjectRows_Collection As New XPCollection(Of ProjectRows)(_ocur.Session, CriteriaOperator.Parse("ProjectHeader=?", _ProjectHeader))
|
|
If _ProjectRows_Collection.Count > 0 Then
|
|
_ProjectRows_Collection.Sorting.Add(New SortProperty("RowPos", DB.SortingDirection.Ascending))
|
|
Dim _ProjectRows As ProjectRows
|
|
|
|
If _GanttControl IsNot Nothing Then
|
|
_GanttControl.BeginUpdate()
|
|
_GanttControl.Items.RemoveAllItems()
|
|
For Each _ProjectRows In _ProjectRows_Collection
|
|
RecursiveLoadItems(_ProjectRows)
|
|
Next
|
|
_ProjectRows_Collection.Sorting.Add(New SortProperty("DateStart", DB.SortingDirection.Ascending))
|
|
_GanttControl.Chart.FirstVisibleDate = _ProjectRows_Collection(0).DateStart
|
|
_GanttControl.Chart.StartPrintDate = _ProjectRows_Collection(0).DateStart
|
|
_ProjectRows_Collection.Sorting.Add(New SortProperty("DateEnd", DB.SortingDirection.Descending))
|
|
_GanttControl.Chart.EndPrintDate = _ProjectRows_Collection(0).DateEnd
|
|
_GanttControl.Chart.set_SelectDate(GetSQLTime(TryCast(View.ObjectSpace, Xpo.XPObjectSpace).Session), True)
|
|
_GanttControl.EndUpdate()
|
|
End If
|
|
End If
|
|
End If
|
|
End Sub
|
|
Private Sub RecursiveLoadItems(_ProjectRows As ProjectRows)
|
|
Dim _item As Long
|
|
|
|
_item = _GanttControl.Items.get_FindItem(_ProjectRows.Oid.ToString, 0)
|
|
If _item > 0 Then Exit Sub
|
|
|
|
If _ProjectRows.ProjectRows Is Nothing Then
|
|
'//AddItem
|
|
_item = _GanttControl.Items.AddItem()
|
|
SetItemData(_item, _ProjectRows)
|
|
Else
|
|
'//InsertItem
|
|
_item = _GanttControl.Items.get_FindItem(_ProjectRows.ProjectRows.Oid.ToString, 0)
|
|
If _item > 0 Then
|
|
_item = _GanttControl.Items.InsertItem(_item, "")
|
|
SetItemData(_item, _ProjectRows)
|
|
Else
|
|
RecursiveLoadItems(_ProjectRows.ProjectRows)
|
|
_item = _GanttControl.Items.get_FindItem(_ProjectRows.ProjectRows.Oid.ToString, 0)
|
|
If _item > 0 Then
|
|
_item = _GanttControl.Items.InsertItem(_item, "")
|
|
SetItemData(_item, _ProjectRows)
|
|
End If
|
|
End If
|
|
End If
|
|
|
|
End Sub
|
|
Private Sub SetItemData(_item As Long, _ProjectRows As ProjectRows)
|
|
If _ProjectRows.ProjectRows Is Nothing Then
|
|
_GanttControl.Items.set_CellValue(_item, 0, _ProjectRows.Oid.ToString)
|
|
_GanttControl.Items.set_CellValue(_item, 1, _ProjectRows.RowPos)
|
|
_GanttControl.Items.set_CellValue(_item, 2, "<b>" & _ProjectRows.TaskName & "</b>")
|
|
_GanttControl.Items.set_CellValueFormat(_item, 2, ValueFormatEnum.exHTML)
|
|
_GanttControl.Items.set_CellValue(_item, 3, _ProjectRows.DateStart)
|
|
_GanttControl.Items.set_CellValue(_item, 4, _ProjectRows.DateEnd)
|
|
_GanttControl.Items.set_CellValue(_item, 5, _ProjectRows.SumDay)
|
|
Else
|
|
_GanttControl.Items.set_CellValue(_item, 0, _ProjectRows.Oid.ToString)
|
|
_GanttControl.Items.set_CellValue(_item, 1, _ProjectRows.RowPos)
|
|
_GanttControl.Items.set_CellValue(_item, 2, _ProjectRows.TaskName)
|
|
_GanttControl.Items.set_CellValue(_item, 3, _ProjectRows.DateStart)
|
|
_GanttControl.Items.set_CellValue(_item, 4, _ProjectRows.DateEnd)
|
|
_GanttControl.Items.set_CellValue(_item, 5, _ProjectRows.SumDay)
|
|
End If
|
|
|
|
Select Case _ProjectRows.ProjectBarType
|
|
Case eProjectBarType.eDeadline
|
|
_GanttControl.Items.AddBar(CInt(_item), "Deadline", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eMilestone
|
|
_GanttControl.Items.AddBar(CInt(_item), "Milestone", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eProgress
|
|
_GanttControl.Items.AddBar(CInt(_item), "Progress", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eProjectSummary
|
|
_GanttControl.Items.AddBar(CInt(_item), "ProjectSummary", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eSplit
|
|
_GanttControl.Items.AddBar(CInt(_item), "Split", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eSummary
|
|
_GanttControl.Items.AddBar(CInt(_item), "Summary", _ProjectRows.DateStart, _ProjectRows.DateEnd)
|
|
Case eProjectBarType.eTask
|
|
_GanttControl.Items.AddBar(CInt(_item), "Task%Progress", _ProjectRows.DateStart, _ProjectRows.DateEnd, "P1")
|
|
Select Case _ProjectRows.TaskDuty
|
|
Case eTaskDuty.eMyTask
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarColor, _ProjectRows.ProjectHeader.ProjectType.DutyColorMyTask_NP)
|
|
Case eTaskDuty.eNotSet
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarColor, _ProjectRows.ProjectHeader.ProjectType.DutyColorNotSet_NP)
|
|
Case eTaskDuty.ePartnerTask
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarColor, _ProjectRows.ProjectHeader.ProjectType.DutyColorPartnerTask_NP)
|
|
Case eTaskDuty.eSubcontractorTask
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarColor, _ProjectRows.ProjectHeader.ProjectType.DutyColorSubcontractorTask_NP)
|
|
End Select
|
|
|
|
If _ProjectRows.PercentCompleted > 0 Then
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarPercent, _ProjectRows.PercentCompleted / 100)
|
|
_GanttControl.Items.set_ItemBar(CInt(_item), "P1", exontrol.EXG2ANTTLib.ItemBarPropertyEnum.exBarShowPercentCaption, True)
|
|
End If
|
|
End Select
|
|
End Sub
|
|
Private Sub GanttContolViewItem_ControlCreated(sender As Object, e As EventArgs)
|
|
Dim _ItemControl As Object = TryCast(sender, ViewItem).Control
|
|
Dim _columnindex As Long = 0
|
|
_GanttControl = TryCast(_ItemControl, G2anttUserControl).Exg2antt
|
|
|
|
AddHandler _GanttControl.MouseDownEvent, AddressOf GanttControl_MouseDownEvent
|
|
AddHandler _GanttControl.KeyDown, AddressOf GanttControl_KeyDown
|
|
AddHandler _GanttControl.KeyUp, AddressOf GanttControl_KeyUp
|
|
|
|
If _GanttControl IsNot Nothing Then
|
|
'//Gantt inicializálása
|
|
_GanttControl.BeginUpdate()
|
|
_GanttControl.Columns.Clear()
|
|
_GanttControl.Columns.Add("Oid")
|
|
_GanttControl.Columns(0).Visible = False
|
|
_GanttControl.Columns.Add("Pos")
|
|
_GanttControl.Columns(1).Width = 10
|
|
_GanttControl.Columns.Add("TaskName")
|
|
_GanttControl.Columns.Add("DateStart")
|
|
_GanttControl.Columns(3).Width = 20
|
|
_GanttControl.Columns.Add("DateEnd")
|
|
_GanttControl.Columns(4).Width = 20
|
|
_GanttControl.Columns.Add("Day")
|
|
_GanttControl.Columns(5).Width = 5
|
|
|
|
_GanttControl.LinesAtRoot = exontrol.EXG2ANTTLib.LinesAtRootEnum.exLinesAtRoot
|
|
_GanttControl.TreeColumnIndex = 2
|
|
_GanttControl.HeaderHeight = 36
|
|
|
|
_GanttControl.Columns(2).Editor.ExpandAll()
|
|
|
|
_GanttControl.Chart.Bars.Add("Task%Progress")
|
|
|
|
'_GanttControl.Chart.FirstVisibleDate = #5/30/2010#
|
|
_GanttControl.Chart.PaneWidthRight = 500
|
|
_GanttControl.Chart.FirstWeekDay = 1
|
|
_GanttControl.Chart.UnitWidth = 36
|
|
|
|
_GanttControl.Chart.LevelCount = 2
|
|
'_GanttControl.Chart.get_Level(0).Label = "<b><%loc_mmmm%></b> <%yyyy%><br><%loc_sdate%><r> <%ww%> "
|
|
_GanttControl.Chart.get_Level(0).ToolTip = _GanttControl.Chart.get_Level(0).Label
|
|
_GanttControl.Chart.get_Level(0).Unit = 256
|
|
|
|
'_GanttControl.Chart.get_Level(1).Label = "<%loc_ddd%><br><%d%>"
|
|
_GanttControl.Chart.get_Level(1).ToolTip = _GanttControl.Chart.get_Level(1).Label
|
|
|
|
'_GanttControl.Chart.ToolTip = "<%loc_ldate%>"
|
|
|
|
|
|
_GanttControl.Chart.OverviewVisible = exontrol.EXG2ANTTLib.OverviewVisibleEnum.exOverviewShowAll
|
|
_GanttControl.Chart.AllowOverviewZoom = exontrol.EXG2ANTTLib.OverviewZoomEnum.exAlwaysZoom
|
|
'_GanttControl.Chart.OverviewZoomCaption = "½Year|¼Year|Month|Third|Week|Day|Hour"
|
|
_GanttControl.SingleSel = False
|
|
|
|
_GanttControl.EndUpdate()
|
|
|
|
Frame.GetController(Of ProjectVC).aProjectRefreshG2antt.DoExecute()
|
|
End If
|
|
End Sub
|
|
Private Sub RefreshAction_Executing(sender As Object, e As CancelEventArgs)
|
|
Frame.GetController(Of ProjectVC).aProjectRefreshG2antt.DoExecute()
|
|
End Sub
|
|
Private Sub aProjectG2anttPrint_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aProjectG2anttPrint.Execute
|
|
With New exontrol.EXPRINTLib.exprint()
|
|
.Options = "ColumnsOnEveryPage=1"
|
|
.PrintExt = _GanttControl
|
|
.Preview()
|
|
End With
|
|
End Sub
|
|
Private Sub GanttControl_KeyDown(sender As Object, ByRef KeyCode As Short, Shift As Short)
|
|
Try
|
|
Select Case KeyCode
|
|
Case 17
|
|
If Not _CtrlDownYes Then
|
|
_CtrlDownYes = True
|
|
End If
|
|
End Select
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub GanttControl_KeyUp(sender As Object, ByRef KeyCode As Short, Shift As Short)
|
|
Try
|
|
Select Case KeyCode
|
|
Case 17
|
|
If _CtrlDownYes Then
|
|
_CtrlDownYes = False
|
|
End If
|
|
End Select
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub GanttControl_MouseDownEvent(sender As Object, Button As Short, Shift As Short, X As Integer, Y As Integer)
|
|
Try
|
|
If _CtrlDownYes Then
|
|
Dim _Item As Long = _GanttControl.get_ItemFromPoint(X, Y)
|
|
_GanttControl.Items.set_SelectableItem(_Item, True)
|
|
End If
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub aProject_GenerateProjectQuestions_Execute(sender As Object, e As SimpleActionExecuteEventArgs) Handles aProject_GenerateProjectQuestions.Execute
|
|
Try
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
|
|
Dim _ProjectHeader As ProjectHeader = TryCast(View.SelectedObjects(0), ProjectHeader)
|
|
If _ProjectHeader Is Nothing Then Throw New Exception("*Váratlan hiba történt, a folyamat megszakadt!")
|
|
|
|
Dim _ProjectQuestion_Collection As New XPCollection(Of ProjectQuestion)(_onew.Session, CriteriaOperator.Parse("ProjectHeader=?", _onew.GetObjectByKey(Of ProjectHeader)(_ProjectHeader.Oid)))
|
|
If _ProjectQuestion_Collection.Count > 0 Then
|
|
_onew.Delete(_ProjectQuestion_Collection)
|
|
_onew.CommitChanges()
|
|
End If
|
|
_ProjectQuestion_Collection.Dispose()
|
|
|
|
Dim _User_Collection As New ArrayList
|
|
Dim _HRPerson_Collection As New ArrayList
|
|
|
|
UsersUppload(_User_Collection, _HRPerson_Collection, _ProjectHeader)
|
|
|
|
'---=== ProjectQuestions ===---
|
|
For Each _User As User In _User_Collection
|
|
Dim _Question As Question = _onew.FindObject(Of Question)(CriteriaOperator.Parse("AliasUser=? AND DocumentNumber=?", _onew.GetObjectByKey(Of User)(_User.Oid), _ProjectHeader.DocumentNumber))
|
|
If _Question Is Nothing Then
|
|
_Question = New Question(_onew.Session)
|
|
With _Question
|
|
.QuestionStatus = eQuestionStatus.eActive
|
|
.QuestionClosed = eQuestionClosed.eOpen
|
|
.IssueType = eIssueType.eQuestion
|
|
.DocumentNumber = _ProjectHeader.DocumentNumber
|
|
.Subject = String.Format("{0} számú project.", _ProjectHeader.DocumentNumber)
|
|
.Description = String.Format("{0} számú project.", _ProjectHeader.DocumentNumber)
|
|
.User = _onew.GetObjectByKey(Of User)(_User.Oid)
|
|
.UserCreated = _onew.GetObjectByKey(Of User)(_User.Oid)
|
|
.AliasUser = _onew.GetObjectByKey(Of User)(_User.Oid)
|
|
Dim _Contacts As Contacts = _ocur.FindObject(Of Contacts)(CriteriaOperator.Parse("User=?", _User))
|
|
If _Contacts IsNot Nothing Then .Customers = _onew.GetObjectByKey(Of Customers)(_Contacts.Customers.Oid)
|
|
End With
|
|
End If
|
|
Dim _Events As New Events(_onew.Session)
|
|
With _Events
|
|
.Question = _Question
|
|
.QuestionStatus = eQuestionStatus.eActive
|
|
.EventDirection = eEventDirection.eOut
|
|
.Description = String.Format("{0} szmú projekt megnyitása.", _ProjectHeader.DocumentNumber)
|
|
End With
|
|
Dim _ProjectQuestion As New ProjectQuestion(_onew.Session)
|
|
With _ProjectQuestion
|
|
.ProjectHeader = _onew.GetObjectByKey(Of ProjectHeader)(_ProjectHeader.Oid)
|
|
.Question = _Question
|
|
End With
|
|
|
|
SendEmail(_Events, _User, _ProjectHeader)
|
|
Next
|
|
|
|
_onew.CommitChanges()
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub aProject_GenerateNewEvents_CustomizePopupWindowParams(sender As Object, e As CustomizePopupWindowParamsEventArgs) Handles aProject_GenerateNewEvents.CustomizePopupWindowParams
|
|
Try
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ProjectNewEvents As New ProjectNewEvents(_onew.Session)
|
|
|
|
e.View = Application.CreateDetailView(_onew, "ProjectNewEvents_DetailView", True, _ProjectNewEvents)
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub aProject_GenerateNewEvents_Execute(sender As Object, e As PopupWindowShowActionExecuteEventArgs) Handles aProject_GenerateNewEvents.Execute
|
|
Try
|
|
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
|
Dim _ProjectHeader As ProjectHeader = TryCast(View.SelectedObjects(0), ProjectHeader)
|
|
|
|
Dim _User_Collection As New ArrayList
|
|
Dim _HRPerson_Collection As New ArrayList
|
|
Dim _ProjectRows_Collection As New ArrayList
|
|
|
|
For _ik = 0 To _GanttControl.Items.SelectCount - 1
|
|
Dim _index As Long = _GanttControl.Items.get_SelectedItem(_ik)
|
|
Dim _Oid As String = _GanttControl.Items.get_CellValue(_index, 0)
|
|
Dim _ProjectRows As ProjectRows = _ocur.FindObject(Of ProjectRows)(CriteriaOperator.Parse("Oid=?", _Oid))
|
|
If _ProjectRows IsNot Nothing Then
|
|
If _ProjectRows_Collection.Count = 0 Then
|
|
_ProjectRows_Collection.Add(_ProjectRows)
|
|
Else
|
|
If Not _ProjectRows_Collection.Contains(_ProjectRows) Then _ProjectRows_Collection.Add(_ProjectRows)
|
|
End If
|
|
End If
|
|
Next
|
|
|
|
UsersUppload_Selected(_User_Collection, _HRPerson_Collection, _ProjectRows_Collection, _ProjectHeader)
|
|
|
|
For Each _User As User In _User_Collection
|
|
Dim _Question As Question = _ocur.FindObject(Of Question)(CriteriaOperator.Parse("DocumentNumber=? And AliasUser=?", _ProjectHeader.DocumentNumber, _User))
|
|
If _Question IsNot Nothing Then
|
|
Dim _Events As New Events(_ocur.Session)
|
|
With _Events
|
|
.Question = _Question
|
|
.Description = TryCast(e.PopupWindow.View.SelectedObjects(0), ProjectNewEvents).Description
|
|
.EventDirection = eEventDirection.eOut
|
|
.QuestionStatus = eQuestionStatus.eActive
|
|
End With
|
|
|
|
SendEmail(_Events, _User, _ProjectHeader)
|
|
End If
|
|
Next
|
|
|
|
Try
|
|
Dim _WebParameters As WebParameters = _ocur.FindObject(Of WebParameters)(CriteriaOperator.Parse("1=1"))
|
|
If _WebParameters Is Nothing Then Throw New Exception("*Nincsnek e-mail paraméterek beállítva!")
|
|
If _WebParameters.SMTPHost Is Nothing Then Throw New Exception("*Nincs SMTP server beállítva!")
|
|
If _WebParameters.SMTPUserName = "" Then Throw New Exception("*Nincs felhasználói név beállítva!")
|
|
If _WebParameters.SMTPPort = 0 Then Throw New Exception("*Nincs SMTP port beállítva!")
|
|
|
|
For Each _User As User In _HRPerson_Collection
|
|
If Not String.IsNullOrEmpty(_User.Email) Then
|
|
Try
|
|
Dim _MailMessage As New MailMessage
|
|
Dim _SmtpClient As SmtpClient = New SmtpClient(_WebParameters.SMTPHost)
|
|
_MailMessage.From = New MailAddress(_WebParameters.Email_SupportAdmin)
|
|
_MailMessage.To.Add(_User.Email)
|
|
_MailMessage.Subject = String.Format("{0} számú projekt", _ProjectHeader.DocumentNumber)
|
|
_MailMessage.IsBodyHtml = True
|
|
|
|
_MailMessage.Body = TryCast(e.PopupWindow.View.SelectedObjects(0), ProjectNewEvents).Description
|
|
|
|
_SmtpClient.Port = _WebParameters.SMTPPort
|
|
_SmtpClient.Credentials = New System.Net.NetworkCredential(_WebParameters.SMTPUserName, _WebParameters.SMTPPassword)
|
|
_SmtpClient.EnableSsl = _WebParameters.EnableSsl
|
|
|
|
_SmtpClient.Send(_MailMessage)
|
|
Catch ex As Exception
|
|
Dim _onewEr As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim sf As StackFrame = New StackFrame()
|
|
Dim _ErrorLog As ErrorLog = _onewEr.CreateObject(Of ErrorLog)()
|
|
_ErrorLog.Description = ex.Message
|
|
_ErrorLog.SubName = TryCast(sf.GetMethod(), MethodBase).Name
|
|
_onewEr.CommitChanges()
|
|
End Try
|
|
End If
|
|
Next
|
|
Catch ex As Exception
|
|
Dim _onewEr As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim sf As StackFrame = New StackFrame()
|
|
Dim _ErrorLog As ErrorLog = _onewEr.CreateObject(Of ErrorLog)()
|
|
_ErrorLog.Description = ex.Message
|
|
_ErrorLog.SubName = TryCast(sf.GetMethod(), MethodBase).Name
|
|
_onewEr.CommitChanges()
|
|
End Try
|
|
_ocur.CommitChanges()
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message, MsgBoxStyle.OkOnly + MsgBoxStyle.Critical, String.Format(CaptionHelper.GetLocalizedText("Exceptions\SISBusinessExceptions", "MsgBoxCheckItAgain")))
|
|
End Try
|
|
End Sub
|
|
Private Sub UsersUppload(_User_Collection As ArrayList, _HRPerson_Collection As ArrayList, _ProjectHeader As ProjectHeader)
|
|
For Each _ProjectContacts As ProjectContacts In _ProjectHeader.ProjectContacts
|
|
If _User_Collection.Count = 0 Then
|
|
_User_Collection.Add(_ProjectContacts.Contacts.User)
|
|
Else
|
|
If Not _User_Collection.Contains(_ProjectContacts.Contacts.User) Then _User_Collection.Add(_ProjectContacts.Contacts.User)
|
|
End If
|
|
Next
|
|
|
|
For Each _ProjectHRPerson As ProjectHRPerson In _ProjectHeader.ProjectHRPerson
|
|
If _HRPerson_Collection.Count = 0 Then
|
|
_HRPerson_Collection.Add(_ProjectHRPerson.HRPerson.User)
|
|
Else
|
|
If Not _HRPerson_Collection.Contains(_ProjectHRPerson.HRPerson.User) Then _HRPerson_Collection.Add(_ProjectHRPerson.HRPerson.User)
|
|
End If
|
|
Next
|
|
|
|
'---=== ProjectHeader.ProjectRows collections ===---
|
|
For Each _ProjectRows As ProjectRows In _ProjectHeader.ProjectRows
|
|
For Each _ProjectRowsContacts As ProjectRowsContacts In _ProjectRows.ProjectRowsContacts
|
|
If _User_Collection.Count = 0 Then
|
|
_User_Collection.Add(_ProjectRowsContacts.Contacts.User)
|
|
Else
|
|
If Not _User_Collection.Contains(_ProjectRowsContacts.Contacts.User) Then _User_Collection.Add(_ProjectRowsContacts.Contacts.User)
|
|
End If
|
|
Next
|
|
|
|
For Each _ProjectRowsHRPerson As ProjectRowsHRPerson In _ProjectRows.ProjectRowsHRPerson
|
|
If _HRPerson_Collection.Count = 0 Then
|
|
_HRPerson_Collection.Add(_ProjectRowsHRPerson.HRPerson.User)
|
|
Else
|
|
If Not _HRPerson_Collection.Contains(_ProjectRowsHRPerson.HRPerson.User) Then _HRPerson_Collection.Add(_ProjectRowsHRPerson.HRPerson.User)
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
Private Sub UsersUppload_Selected(_User_Collection As ArrayList, _HRPerson_Collection As ArrayList, _ProjectRows_Collection As ArrayList, _ProjectHeader As ProjectHeader)
|
|
For Each _ProjectContacts As ProjectContacts In _ProjectHeader.ProjectContacts
|
|
If _User_Collection.Count = 0 Then
|
|
_User_Collection.Add(_ProjectContacts.Contacts.User)
|
|
Else
|
|
If Not _User_Collection.Contains(_ProjectContacts.Contacts.User) Then _User_Collection.Add(_ProjectContacts.Contacts.User)
|
|
End If
|
|
Next
|
|
|
|
For Each _ProjectHRPerson As ProjectHRPerson In _ProjectHeader.ProjectHRPerson
|
|
If _HRPerson_Collection.Count = 0 Then
|
|
_HRPerson_Collection.Add(_ProjectHRPerson.HRPerson.User)
|
|
Else
|
|
If Not _HRPerson_Collection.Contains(_ProjectHRPerson.HRPerson.User) Then _HRPerson_Collection.Add(_ProjectHRPerson.HRPerson.User)
|
|
End If
|
|
|
|
Next
|
|
|
|
For Each _ProjectRows As ProjectRows In _ProjectRows_Collection
|
|
For Each _ProjectRowsContacts As ProjectRowsContacts In _ProjectRows.ProjectRowsContacts
|
|
If _User_Collection.Count = 0 Then
|
|
_User_Collection.Add(_ProjectRowsContacts.Contacts.User)
|
|
Else
|
|
If Not _User_Collection.Contains(_ProjectRowsContacts.Contacts.User) Then _User_Collection.Add(_ProjectRowsContacts.Contacts.User)
|
|
End If
|
|
Next
|
|
|
|
For Each _ProjectRowsHRPerson As ProjectRowsHRPerson In _ProjectRows.ProjectRowsHRPerson
|
|
If _HRPerson_Collection.Count = 0 Then
|
|
_HRPerson_Collection.Add(_ProjectRowsHRPerson.HRPerson.User)
|
|
Else
|
|
If Not _HRPerson_Collection.Contains(_ProjectRowsHRPerson.HRPerson.User) Then _HRPerson_Collection.Add(_ProjectRowsHRPerson.HRPerson.User)
|
|
End If
|
|
Next
|
|
Next
|
|
End Sub
|
|
Private Sub SendEmail(_Events As [Module].Events, _User As User, _ProjectHeader As ProjectHeader)
|
|
Try
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _WebParameters As WebParameters = _onew.FindObject(Of WebParameters)(CriteriaOperator.Parse("1=1"))
|
|
If _WebParameters Is Nothing Then Throw New Exception("*Nincsnek e-mail paraméterek beállítva!")
|
|
If _WebParameters.SMTPHost Is Nothing Then Throw New Exception("*Nincs SMTP server beállítva!")
|
|
If _WebParameters.SMTPUserName = "" Then Throw New Exception("*Nincs felhasználói név beállítva!")
|
|
If _WebParameters.SMTPPort = 0 Then Throw New Exception("*Nincs SMTP port beállítva!")
|
|
|
|
If Not String.IsNullOrEmpty(_User.Email) Then
|
|
Dim _MailMessage As New MailMessage
|
|
Dim _SmtpClient As SmtpClient = New SmtpClient(_WebParameters.SMTPHost)
|
|
_MailMessage.From = New MailAddress(_WebParameters.Email_SupportAdmin)
|
|
_MailMessage.To.Add(_User.Email)
|
|
_MailMessage.Subject = String.Format("{0} számú projekt", _ProjectHeader.DocumentNumber)
|
|
_MailMessage.IsBodyHtml = True
|
|
|
|
_MailMessage.Body = _Events.Description
|
|
|
|
_SmtpClient.Port = _WebParameters.SMTPPort
|
|
_SmtpClient.Credentials = New System.Net.NetworkCredential(_WebParameters.SMTPUserName, _WebParameters.SMTPPassword)
|
|
_SmtpClient.EnableSsl = _WebParameters.EnableSsl
|
|
|
|
_SmtpClient.Send(_MailMessage)
|
|
End If
|
|
Catch ex As Exception
|
|
Dim _onewEr As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim sf As StackFrame = New StackFrame()
|
|
Dim _ErrorLog As ErrorLog = _onewEr.CreateObject(Of ErrorLog)()
|
|
_ErrorLog.Description = ex.Message
|
|
_ErrorLog.SubName = TryCast(sf.GetMethod(), MethodBase).Name
|
|
_onewEr.CommitChanges()
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub aProjectDeleteRow_Execute_1(sender As Object, e As SimpleActionExecuteEventArgs) Handles aProjectDeleteRow.Execute
|
|
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
|
Dim _ProjectRows As ProjectRows
|
|
Dim _selecteditem As Long = 0
|
|
Dim _Oid As String
|
|
If _GanttControl IsNot Nothing Then
|
|
_selecteditem = _GanttControl.Items.get_SelectedItem(0)
|
|
_Oid = _GanttControl.Items.get_CellValue(_selecteditem, 0)
|
|
_ProjectRows = _onew.FindObject(Of ProjectRows)(CriteriaOperator.Parse("Oid=?", _Oid))
|
|
If _ProjectRows IsNot Nothing Then
|
|
_onew.Delete(_ProjectRows)
|
|
End If
|
|
End If
|
|
End Sub
|
|
End Class
|