Files
Nuvolar/Nuvolar.Module/BusinessObjects/SIS/App_Code/HTMLModule.vb
T
2017-03-08 11:21:27 +01:00

224 lines
12 KiB
VB.net

Imports DevExpress.Xpo
Imports DevExpress.Data.Filtering
Imports DevExpress.ExpressApp.Utils
Module HTMLModule
Public Function CreateHTMLEvents(_Question As Question, _Session As DevExpress.Xpo.Session) As String
Dim _Events_Collection As New XPCollection(Of Events)(PersistentCriteriaEvaluationBehavior.InTransaction, _
_Session, CriteriaOperator.Parse("Question.Oid=?", _Question.Oid))
Dim _Events As Events
Dim s As String = ""
's = " <style> "
's += " * { font-family: Arial; }"
's += " h1 { color: #8080a0; font-weight: normal; padding: 0px; margin: 5px 0px; }"
's += " p { padding: 0px; margin: 3px 0px; color: #808080; }"
's += " </style> "
If _Events_Collection IsNot Nothing Then
_Events_Collection.Sorting.Add(New SortProperty("ObjectCreated", DB.SortingDirection.Ascending))
For Each _Events In _Events_Collection
If _Events.EventDirection = eEventDirection.eIn Then
s += "<table cellspacing='0' cellpadding='0' border='0' width=100% style='background-color:&&ECDEEC;'>"
s += "<tr>"
s += "<td style='width:10px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&ECDEEC;color:&&866A86;"
s += " font-size:small;'>"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;width:25px;height:30px;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += "<img id='1' alt='<-' src='" & GLOBAL_ApplicationStartupPath & "Images\iRedArrow.png' style='height:22px;width:21px;border-style:none;'/>"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += _Events.UserCreated.LastName & " " & _Events.UserCreated.FirstName & " írta (" & CaptionHelper.GetLocalizedText("Enums\Nuvolar.Module.eQuestionStatus", _Events.QuestionStatus.ToString) & ")"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;text-align:right;"
s += " border-top:solid 1px;border-bottom:solid 1px;font-size:small;"
s += "'>"
s += Format(_Events.ObjectCreated, "yyyy/MM/dd HH:mm")
s += "</td>"
s += "<td style='width:5px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&ECDEEC;color:&&866A86;"
s += " font-size:small;'>"
s += "</td>"
s += "</tr>"
s += "</table><br>"
s += "<table cellspacing='0' cellpadding='0' border='0' width=100%>"
s += "<tr>"
s += "<td style='width:25px;'></td>"
s += "<td>"
If _Events.Attachment IsNot Nothing Then
s += "<span id='100'><b>Csatolmány:</b> <a href='GetAttachments.ashx?id=" & _Events.Attachment.Oid.ToString & "' target='_blank'>" & _Events.Attachment.FileName & "</a> (" & _Events.Attachment.Size & " bytes)</span><br><br>"
End If
s += _Events.Description
s += "</td>"
s += "</tr>"
s += "</table>"
s += "<br><br>"
End If
If _Events.EventDirection = eEventDirection.eOut Then
s += "<table cellspacing='0' cellpadding='0' border='0' width=100% style='background-color:&&E1F7EC;'>"
s += "<tr>"
s += "<td style='width:10px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&E1F7EC;color:&&83968D;"
s += " font-size:small;'>"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;width:25px;height:30px;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += "<img id='1' alt='->' src='" & GLOBAL_ApplicationStartupPath & "Images\iGreenArrow.png' style='height:22px;width:21px;border-style:none;'/>"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += _Events.UserCreated.LastName & " " & _Events.UserCreated.FirstName & " válaszolta (" & CaptionHelper.GetLocalizedText("Enums\Nuvolar.Module.eQuestionStatus", _Events.QuestionStatus.ToString) & ")"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;text-align:right;"
s += " border-top:solid 1px;border-bottom:solid 1px;font-size:small;"
s += "'>"
s += Format(_Events.ObjectCreated, "yyyy/MM/dd HH:mm")
s += "</td>"
s += "<td style='width:5px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&E1F7EC;color:&&83968D;"
s += " font-size:small;'>"
s += "</td>"
s += "</tr>"
s += "</table><br>"
s += "<table cellspacing='0' cellpadding='0' border='0' width=100%>"
s += "<tr>"
If LTrim(RTrim(_Events.Description)) <> "" Then
s += "<td style='width:25px;'></td>"
s += "<td>"
If _Events.Attachment IsNot Nothing Then
s += "<span id='100'><b>Csatolmány:</b> <a href='GetAttachments.ashx?id=" & _Events.Attachment.Oid.ToString & "' target='_blank'>" & _Events.Attachment.FileName & "</a> (" & _Events.Attachment.Size & " bytes)</span><br><br>"
End If
s += _Events.Description
s += "</td>"
s += "</tr>"
s += "</table>"
s += "<br><br>"
End If
End If
Next
End If
s = Replace(s, "'", """")
s = Replace(s, "&&", "#")
Return s
End Function
Public Function CreateHTMLEventsMail(_Question As Question, _Session As DevExpress.Xpo.Session) As String
Dim _Events_Collection As New XPCollection(Of Events)(PersistentCriteriaEvaluationBehavior.InTransaction, _
_Session, CriteriaOperator.Parse("Question.Oid=?", _Question.Oid))
Dim _Events As Events
Dim s As String = ""
's = " <style> "
's += " * { font-family: Arial; }"
's += " h1 { color: #8080a0; font-weight: normal; padding: 0px; margin: 5px 0px; }"
's += " p { padding: 0px; margin: 3px 0px; color: #808080; }"
's += " </style> "
If _Events_Collection IsNot Nothing Then
_Events_Collection.Sorting.Add(New SortProperty("ObjectCreated", DB.SortingDirection.Ascending))
For Each _Events In _Events_Collection
If _Events.EventDirection = eEventDirection.eIn Then
s += "<table cellspacing='0' cellpadding='0' border='0' width=100% style='background-color:&&ECDEEC;'>"
s += "<tr>"
s += "<td style='width:10px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&ECDEEC;color:&&866A86;"
s += " font-size:small;'>"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;width:25px;height:30px;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += "<img id='1' alt='<-' <img src='cid:c001' style='height:22px;width:21px;border-style:none;'/>"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += _Events.UserCreated.LastName & " " & _Events.UserCreated.FirstName & " írta (" & CaptionHelper.GetLocalizedText("Enums\Nuvolar.Module.eQuestionStatus", _Events.QuestionStatus.ToString) & ")"
s += "</td>"
s += "<td style='background-color:&&ECDEEC;color:&&866A86;vertical-align:center;text-align:right;"
s += " border-top:solid 1px;border-bottom:solid 1px;font-size:small;"
s += "'>"
s += Format(_Events.ObjectCreated, "yyyy/MM/dd HH:mm")
s += "</td>"
s += "<td style='width:5px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&ECDEEC;color:&&866A86;"
s += " font-size:small;'>"
s += "</td>"
s += "</tr>"
s += "</table><br>"
s += "<table cellspacing='0' cellpadding='0' border='0' width=100%>"
s += "<tr>"
s += "<td style='width:25px;'></td>"
s += "<td>"
s += _Events.Description
s += "</td>"
s += "</tr>"
s += "</table>"
s += "<br><br>"
End If
If _Events.EventDirection = eEventDirection.eOut Then
s += "<table cellspacing='0' cellpadding='0' border='0' width=100% style='background-color:&&E1F7EC;'>"
s += "<tr>"
s += "<td style='width:10px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&E1F7EC;color:&&83968D;"
s += " font-size:small;'>"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;width:25px;height:30px;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += "<img id='1' alt='->' src='cid:c002' style='height:22px;width:21px;border-style:none;'/>"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;"
s += " border-top:solid 1px;border-bottom:solid 1px;"
s += "'>"
s += _Events.UserCreated.LastName & " " & _Events.UserCreated.FirstName & " válaszolta (" & CaptionHelper.GetLocalizedText("Enums\Nuvolar.Module.eQuestionStatus", _Events.QuestionStatus.ToString) & ")"
s += "</td>"
s += "<td style='background-color:&&E1F7EC;color:&&83968D;vertical-align:center;text-align:right;"
s += " border-top:solid 1px;border-bottom:solid 1px;font-size:small;"
s += "'>"
s += Format(_Events.ObjectCreated, "yyyy/MM/dd HH:mm")
s += "</td>"
s += "<td style='width:5px;border-top:solid 1px;border-bottom:solid 1px;background-color:&&E1F7EC;color:&&83968D;"
s += " font-size:small;'>"
s += "</td>"
s += "</tr>"
s += "</table><br>"
s += "<table cellspacing='0' cellpadding='0' border='0' width=100%>"
s += "<tr>"
If LTrim(RTrim(_Events.Description)) <> "" Then
s += "<td style='width:25px;'></td>"
s += "<td>"
s += _Events.Description
s += "</td>"
s += "</tr>"
s += "</table>"
s += "<br><br>"
End If
End If
Next
End If
s = Replace(s, "'", """")
s = Replace(s, "&&", "#")
Return s
End Function
End Module