123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using InABox.Core;
- using InABox.DynamicGrid;
- using PRS.Shared.Events;
- using PRSStores.Events;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace PRS.Shared.Grids.EventEditor;
- public class SendEmailActionEditItem : BaseObject
- {
- [EditorSequence(1)]
- [ExpressionEditor(null)]
- public string To { get; set; } = "";
- [EditorSequence(2)]
- [ExpressionEditor(null)]
- public string CC { get; set; } = "";
- [EditorSequence(3)]
- [ExpressionEditor(null)]
- public string BCC { get; set; } = "";
- [EditorSequence(4)]
- [ExpressionEditor(null)]
- public string Subject { get; set; } = "";
- [EditorSequence(5)]
- [ExpressionEditor(null)]
- public string Message { get; set; } = "";
- }
- public class SendEmailActionEditor<TEvent> : IEventActionEditor<SendEmailEventAction<TEvent>>
- where TEvent : IEvent
- {
- public bool Edit(SendEmailEventAction<TEvent> action, IEventDataModelDefinition dataModelDefinition)
- {
- var item = new SendEmailActionEditItem
- {
- To = action.To,
- CC = action.CC,
- BCC = action.BCC,
- Subject = action.Subject,
- Message = action.Message,
- };
- if(DynamicGridUtils.EditObject(item, customiseGrid: grid =>
- {
- grid.OnCustomiseEditor += (sender, items, column, editor) =>
- {
- if (editor is ExpressionEditor expressionEditor)
- {
- expressionEditor.VariableNames = dataModelDefinition.GetVariables().Select(x => x.Name).ToList();
- }
- };
- }))
- {
- action.To = item.To;
- action.CC = item.CC;
- action.BCC = item.BCC;
- action.Subject = item.Subject;
- action.Message = item.Message;
- return true;
- }
- else
- {
- return false;
- }
- }
- }
|