Ejemplo n.º 1
0
        public List <Models.JobsViewModels.TaskListItemViewModel> getOpenTaskListForUser(string username)
        {
            initService();

            List <TaskListItemViewModel> list = new List <TaskListItemViewModel>();
            var tasks = taskStore.getTasksNotSeenByUsername(username);

            if (tasks != null)
            {
                foreach (T_Task t in tasks)
                {
                    if (t.Type.Equals("R"))
                    {
                        if (messageStore.getMessagesForReceiveStateTask(t.WFId, t.getTaskPropertiesAsListOfString()).Count > 0)
                        {
                            list.Add(new TaskListItemViewModel {
                                Id = t.Id, Name = t.Name, Done = t.Done, Type = t.Type, ProcessId = taskStore.getProcessIdForTask(t.Id), OrderId = t.InternalOrderId, DateTime = t.DateCreated.ToString()
                            });
                        }
                    }
                    else
                    {
                        list.Add(new TaskListItemViewModel {
                            Id = t.Id, Name = t.Name, Done = t.Done, Type = t.Type, ProcessId = taskStore.getProcessIdForTask(t.Id), OrderId = t.InternalOrderId, DateTime = t.DateCreated.ToString()
                        });
                    }
                }
            }

            return(list);
        }
Ejemplo n.º 2
0
        public void createNotificationForTask(int TaskId, string cfgSQLConnectionString)
        {
            this.cfgSQLConnectionString = cfgSQLConnectionString;
            configStore  = StoreHandler.getConfigStore(cfgSQLConnectionString);
            baseURL      = configStore.getString(BaseURL);
            templatepath = configStore.getString(Email_NotificationTemplate);

            taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString);
            T_Task task = taskStore.getTaskById(TaskId);

            helper       = new MailBodyHelper();
            processStore = StoreHandler.getProcessStore(cfgSQLConnectionString);
            instance     = processStore.getWorkflowInstance(task.WFId);
            mail         = new SmtpUtils(configStore);
            if (task.Type.Equals("F") || task.Type.Equals("S"))
            {
                if (configStore.getBool(Email_Notifications_Tasks))
                {
                    string content = helper.getStateBody(task, baseURL, templatepath);



                    List <string> recipients = new List <string>();

                    if (String.IsNullOrEmpty(instance.Owner))
                    {
                        var subject = processStore.getProcessSubjectForWFId(task.WFId);
                        userStore = StoreHandler.getUserStore(cfgSQLConnectionString);
                        recipients.AddRange(userStore.getUsernamesForRole(subject.U_Role_Id));
                    }
                    else
                    {
                        recipients.Add(instance.Owner);
                    }

                    foreach (string user in recipients)
                    {
                        mail.sendMail(user, "InFlow: " + task.Name + " #" + task.Id, content);
                    }
                }
            }
            if (task.Type.Equals("R"))
            {
                if (configStore.getBool(Email_Notifications_Messages))
                {
                    messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString);
                    var messages = messageStore.getMessagesForReceiveStateTask(task.WFId, task.getTaskPropertiesAsListOfString());

                    foreach (var i in messages)
                    {
                        createReceiveNotification(i, task);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void createNotificationForTask(int TaskId, string cfgSQLConnectionString)
        {
            this.cfgSQLConnectionString = cfgSQLConnectionString;
            configStore = StoreHandler.getConfigStore(cfgSQLConnectionString);
            baseURL = configStore.getString(BaseURL);
            templatepath = configStore.getString(Email_NotificationTemplate);

            taskStore = StoreHandler.getTaskStore(cfgSQLConnectionString);
            T_Task task = taskStore.getTaskById(TaskId);
            helper = new MailBodyHelper();
            processStore = StoreHandler.getProcessStore(cfgSQLConnectionString);
            instance = processStore.getWorkflowInstance(task.WFId);
            mail = new SmtpUtils(configStore);
            if (task.Type.Equals("F") || task.Type.Equals("S"))
            {
                if (configStore.getBool(Email_Notifications_Tasks))
                {
                    string content = helper.getStateBody(task, baseURL, templatepath);



                    List<string> recipients = new List<string>();

                    if (String.IsNullOrEmpty(instance.Owner))
                    {
                        var subject = processStore.getProcessSubjectForWFId(task.WFId);
                        userStore = StoreHandler.getUserStore(cfgSQLConnectionString);
                        recipients.AddRange(userStore.getUsernamesForRole(subject.U_Role_Id));
                    }
                    else
                    {
                        recipients.Add(instance.Owner);
                    }

                    foreach (string user in recipients)
                    {
                        mail.sendMail(user, "InFlow: " + task.Name + " #" + task.Id, content);
                    }
                }
            }
            if (task.Type.Equals("R"))
            {
                if (configStore.getBool(Email_Notifications_Messages))
                {
                    messageStore = StoreHandler.getMessageStore(cfgSQLConnectionString);
                    var messages = messageStore.getMessagesForReceiveStateTask(task.WFId, task.getTaskPropertiesAsListOfString());

                    foreach (var i in messages)
                    {
                        createReceiveNotification(i, task);
                    }
                }
            }

        }