我正在开发基于Web的应用程序。在我的应用程序中,用户从撰稿人请求文章撰写服务。然后,撰稿人将继续创作并将文章提交给客户。然后客户可以批准或拒绝这些文章。所有这些行动都有地位。
01.我需要(以下给出的示例动作)
02.当文章状态发生变化时发送通知(电子邮件)
03.根据数据库中的表现(例如:拒绝与批准)更新撰稿人的个人资料
04.如果某篇文章被拒绝x次,请通知申请管理员
05.将来可能会增加更多的业务逻辑
基本上所有流程都是电子邮件发送或数据库调用。
我在中间层提出了一个功能(是的,我的应用程序是3层。)。
Public Sub ExecuteWorkFlow(ByVal requestid As Integer, ByVal oldStatus As ServiceStatus, ByVal newStatus As ServiceStatus)
Try
If oldStatus.Value = ServiceStatus.InProgress Then
If newStatus = ServiceStatus.PendingReview Then
'Update Logic
ElseIf newStatus = ServiceStatus.Completed Then
'Update Logic
End If
End If
'Check for rejected work flow. Send email to copywriters (and us if 3 rejection)
If newStatus = ServiceStatus.Rejected Then
If oldStatus.Value = ServiceStatus.PendingReview Then
'send email
SendRejectServieRequestEmail()
Dim rejects = From r In request.ServiceRequestHistory Where r.NewStatus = ServiceStatus.Rejected Select r
If rejects.Count() >= 3 Then 'Send email to admin
'send email
SendRejectServieEmailToAdmin()
End If
End If
End If
End If
'Check for new job workflow. Send emails to providers.
If oldStatus.HasValue = True Then
If oldStatus.Value = ServiceStatus.UserEditing Then
'Get all copywriters
For Each p In copywriters
'Send email
Next
End If
End If
End If
Catch ex As Exception
End Try
End Sub
内部逻辑可以轻松改变
整个流程在单一位置进行管理。
这是顺序的。在for循环中发送电子邮件需要相当长的时间。但是在asp.net发布的时间内,它太大了
我使用SmtpClient作为邮件工具。但是中间层不支持发送异步。
有没有办法从asp.net发送电子邮件异步,而不是页面(来自中间层)?
基于Web的解决方案还有其他更好的工作流解决方案吗?
我在C#或vb.net中没有我的答案。 我正在使用.net 4.0
我需要更新有关此状态的数据库。不仅仅是发送电子邮件。
答案 0 :(得分:1)
您可以选择解决异步电子邮件问题: