public object GetAddEdit(Guid?ID = null)
 {
     using (MessageTypeService messageTypeService = new MessageTypeService())
     {
         return(ID.ToGuidObj() != Guid.Empty ? new MessageTypeDTO(messageTypeService.GetInfo(ID.Value)) : new MessageTypeDTO());
     }
 }
示例#2
0
        // GET: BpmsEvent
        public object GetIndex(Guid ProcessId, string ElementId)
        {
            EventDTO eventDTO = null;

            using (EventService eventService = new EventService())
            {
                eventDTO = new EventDTO(eventService.GetInfo(ElementId, ProcessId));
            }
            //Filling Default Message ViewBag
            using (MessageTypeService messageTypeService = new MessageTypeService())
            {
                if (eventDTO.SubTypeMessageEventModel?.Type == (int)SubTypeMessageEventModel.e_Type.Message &&
                    eventDTO.MessageTypeID.HasValue)
                {
                    //If messageType was changed, it adds or removes extra params.
                    List <MessageTypeParamsModel> listMTParams = messageTypeService.GetInfo(eventDTO.MessageTypeID.Value).ParamsXmlModel;

                    //update list of parameter
                    eventDTO.SubTypeMessageEventModel.MessageParams = listMTParams.Select(c =>
                                                                                          new SubTypeMessageParamEventModel(eventDTO.SubTypeMessageEventModel.MessageParams.FirstOrDefault(d => d.Name == c.Name)?.Variable, c.Name, c.IsRequired)).ToList();
                }

                using (EmailAccountService emailAccountService = new EmailAccountService())
                {
                    List <QueryModel> list = new List <QueryModel>()
                    {
                        new QueryModel(((int)SubTypeEmailEventModel.e_FromType.CurrentUser).ToString(), "Current User"),
                        new QueryModel(((int)SubTypeEmailEventModel.e_FromType.CurrentThreadUser).ToString(), "Requested User")
                    };
                    return(new
                    {
                        SubTypeTimerEventModelIntervalTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_IntervalType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeTimerEventModelSetTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_SetType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeTimerEventModelTypes = EnumObjHelper.GetEnumList <SubTypeTimerEventModel.e_Type>().Where(c => eventDTO.TypeLU == (int)sysBpmsEvent.e_TypeLU.StartEvent || eventDTO.TypeLU == (int)sysBpmsEvent.e_TypeLU.boundary || c.Key != (int)SubTypeTimerEventModel.e_Type.Interval).Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeEmailEventModelToSystemicTypes = EnumObjHelper.GetEnumList <SubTypeEmailEventModel.e_ToSystemicType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeEmailEventModelToTypes = EnumObjHelper.GetEnumList <SubTypeEmailEventModel.e_ToType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeMessageEventModelKeyTypes = EnumObjHelper.GetEnumList <SubTypeMessageEventModel.e_KeyType>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        SubTypeMessageEventModelTypes = EnumObjHelper.GetEnumList <SubTypeMessageEventModel.e_Type>().Select(c => new QueryModel(c.Key.ToString(), c.Value)).ToList(),
                        //eventDTO.MessageTypeID
                        MessageTypes = messageTypeService.GetList("", true).Select(c => new QueryModel(c.ID.ToString(), c.Name)).ToList(),
                        //eventDTO.SubTypeMessageEventModel?.Email?.From
                        EmailAccounts = emailAccountService.GetList((int)sysBpmsEmailAccount.e_ObjectTypeLU.Systemic, null, null).
                                        Select(c => new QueryModel(c.ID.ToString(), c.Email)).Union(list).ToList(),
                        Model = eventDTO,
                    });
                }
            }
        }
        public object PostAddEdit(MessageTypeDTO MessageTypeDTO)
        {
            if (ModelState.IsValid)
            {
                using (MessageTypeService messageTypeService = new MessageTypeService())
                {
                    sysBpmsMessageType messageType     = MessageTypeDTO.ID != Guid.Empty ? messageTypeService.GetInfo(MessageTypeDTO.ID) : new sysBpmsMessageType();
                    ResultOperation    resultOperation = messageType.Update(MessageTypeDTO.Name, true, MessageTypeDTO.ListParameter);
                    if (!resultOperation.IsSuccess)
                    {
                        return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
                    }

                    if (messageType.ID != Guid.Empty)
                    {
                        resultOperation = messageTypeService.Update(messageType);
                    }
                    else
                    {
                        resultOperation = messageTypeService.Add(messageType);
                    }

                    if (resultOperation.IsSuccess)
                    {
                        return(new PostMethodMessage(SharedLang.Get("Success.Text"), DisplayMessageType.success));
                    }
                    else
                    {
                        return(new PostMethodMessage(resultOperation.GetErrors(), DisplayMessageType.error));
                    }
                }
            }
            else
            {
                return(new PostMethodMessage(SharedLang.Get("NotFound.Text"), DisplayMessageType.error));
            }
        }
示例#4
0
 public object GetThrowMessageParams(Guid MessageTypeID)
 {
     using (MessageTypeService messageTypeService = new MessageTypeService())
         return(new MessageTypeDTO(messageTypeService.GetInfo(MessageTypeID)).ListParameter);
 }