Пример #1
0
 public OrderManager(StoreHandler storeHandler, Effort.Provider.EffortConnection inMemoryConnection)
 {
     //Orders = new BlockingCollection<Order>();
     //usersOrders = new Dictionary<Guid, List<Order>>();
     //storesOrders = new Dictionary<Guid, List<StoreOrder>>();
     //pendingOrders = new Dictionary<Guid, Order>();
     StoreHandler = storeHandler;
     observers    = new HashSet <NotificationObserver>();
     this.IDForNotifactionSubject = Guid.NewGuid();
     Payment  = new PaymentProxy();
     Delivery = new DeliveryProxy();
     if (inMemoryConnection != null)
     {
         this.useInMemoryDB      = true;
         this.inMemoryConnection = inMemoryConnection;
     }
     else
     {
         this.useInMemoryDB = false;
     }
     Timer = new Timer
     {
         Interval = 1000 * 60 * 2
     };
     Timer.Enabled  = true;
     Timer.Elapsed += new ElapsedEventHandler(ReviewPendings);
 }
Пример #2
0
        private void createReceiveNotification(M_Message message, T_Task task)
        {
            if (message.Notified == false)
            {
                helper = new MailBodyHelper();
                string content = helper.getReceiveStateBody(message, 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 + "|" + message.Id, content);
                }

                messageStore.markMessageAsNotified(message.Id);
            }
        }
Пример #3
0
        public static async Task Maindo(SocketMessage arg)
        {
            string KeyForJob = $"JOB";

            if (StoreHandler.LoadData(arg.Author.Id, KeyForJob) != null)
            {
                var Job   = UserStuff.GetJob(arg.Author.Id);
                var Embed = new EmbedBuilder()
                {
                    Author = new EmbedAuthorBuilder()
                    {
                        IconUrl = arg.Author.GetAvatarUrl(),
                        Name    = $"{arg.Author.Username}'s Job",
                    },
                    Color  = new Color(85, 255, 157),
                    Footer = new EmbedFooterBuilder()
                    {
                        Text = Job.Timestamp >= new DateTime(2010, 1, 1) ? $"Has had job for {(DateTime.UtcNow - Job.Timestamp).Days} days" : "MGX"
                    },
                    Timestamp = DateTime.UtcNow,
                    Fields    = new List <EmbedFieldBuilder>()
                    {
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = "Name",
                                Value = $"{Job.Name}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = "Pay",
                                Value = $"${Job.Pay}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = $"People w/{Job.Name}",
                                Value = $"{StoreHandler.ReturnCountOfPattern(StoreHandler.LoadData(arg.Author.Id, KeyForJob))}"
                            }
                        },
                        {
                            new EmbedFieldBuilder()
                            {
                                Name  = $"Is Available",
                                Value = $"{Job.StillAvailable}"
                            }
                        },
                    }
                };

                await arg.Channel.SendMessageAsync("", false, Embed.Build());
            }
            else
            {
                await arg.Channel.SendMessageAsync($"You kind of need a job to view your job: `{Program.Prefix}joblist`");
            }
        }
Пример #4
0
        protected override void Execute(CodeActivityContext context)
        {
            IProcessStore      processStore    = StoreHandler.getProcessStore(context.GetValue(cfgSQLConnectionString));
            ITaskStore         taskStore       = StoreHandler.getTaskStore(context.GetValue(cfgSQLConnectionString));
            P_WorkflowInstance creatorinstance = processStore.getWorkflowInstance(context.GetValue(WFId));

            processStore.updateWorkflowInstanceEndState(creatorinstance.Id, context.GetValue(IsEndState));

            if (processStore.hasProcessEnded(creatorinstance.ProcessInstance_Id))
            {
                processStore.markProcessInstanceAsEnded(creatorinstance.ProcessInstance_Id, creatorinstance.ProcessSubject_Id, creatorinstance.Owner);
                taskStore.setAllTasksForProcessInstanceAsDone(creatorinstance.ProcessInstance_Id);

                var           instances = processStore.getWFInstanceIdsForProcessInstance(creatorinstance.ProcessInstance_Id);
                CoreFunctions c         = new CoreFunctions(context.GetValue(cfgWFMBaseAddress), context.GetValue(cfgWFMUsername), context.GetValue(cfgWFMPassword), context.GetValue(cfgSQLConnectionString));
                foreach (var i in instances)
                {
                    try
                    {
                        c.terminateSubjectInstance(i);
                    }
                    catch (Exception e)
                    { }
                }
            }
        }
Пример #5
0
        public static void Store(TimelineStoreData[] arr, StoreHandler onStoreOver)
        {
            int count = arr.Length;

            if (count <= 0)
            {
                onStoreOver();
                return;
            }
            StoreHandler StoreHandler = () =>
            {
                count--;
                if (count <= 0)
                {
                    onStoreOver();
                    return;
                }
            };

            for (int i = 0; i < arr.Length; i++)
            {
                var l = arr[i];
                Store(l, StoreHandler);
            }
        }
Пример #6
0
        public void Setup()
        {
            inMemoryConnection = Effort.DbConnectionFactory.CreateTransient();
            using var context  = new MarketDbContext(inMemoryConnection);
            context.Init();
            RegisteredUser first_owner = new RegisteredUser("FIRST_OWNER", new byte[] { });

            context.Users.Add(first_owner);
            TEST_FIRST_OWNER = first_owner.ID;
            RegisteredUser owner = new RegisteredUser("OWNER", new byte[] { });

            context.Users.Add(owner);
            TEST_OWNER = owner.ID;
            RegisteredUser manager = new RegisteredUser("MANAGER", new byte[] { });

            context.Users.Add(manager);
            TEST_MANAGER = manager.ID;
            RegisteredUser new_user = new RegisteredUser("NEW_USER", new byte[] { });

            context.Users.Add(new_user);
            TEST_NEW_USER   = new_user.ID;
            storeName       = DataForTests.CreateTestContactDetails().Name;
            storeHandler    = new StoreHandler();
            orderManager    = new OrderManager(storeHandler, inMemoryConnection);
            storeManagement = new StoreManagementFacade(storeHandler, orderManager);
            storeHandler.OpenStore(DataForTests.CreateTestContactDetails(), TEST_FIRST_OWNER, context);
            Store store = storeHandler.GetStoreByName(storeName, context);

            store.AddOwner(TEST_OWNER, TEST_FIRST_OWNER, STUB_USER_NAME, storeHandler, context);
            store.AddManager(TEST_MANAGER, TEST_OWNER, context);
            item    = store.AddItem("existing", 2, categories1, 3.55, context);
            itemID  = item.Id;
            storeID = store.Id;
        }
Пример #7
0
        public ActionResult ViewDetails(int processId)
        {
            var p = _db.P_Processes.Find(processId);

            string     connectionString = ConfigurationSettings.AppSettings["repositoryConnectionString"].ToString();
            IUserStore ustore           = StoreHandler.getUserStore(connectionString);


            ManageBackendProcessDetailViewModel model = new ManageBackendProcessDetailViewModel()
            {
                ProcessInfo = p.ProcessInfo, ProcessId = p.Id, GlobalProcessName = p.GlobalProcessName, ProcessScopeName = p.WFM_ProcessScope, Version = p.WS_Project_Version, ProjectId = p.WS_ProjectId, ProjectName = p.WS_Project.Name, PublishDate = p.PublishDate.ToString(), Active = p.Active
            };

            foreach (var sub in p.ProcessSubjects)
            {
                ManageBackendProcessDetailSubjectViewModel subjectvm = new ManageBackendProcessDetailSubjectViewModel()
                {
                    Name = sub.Name, AssignedRole = sub.U_Role.Name, RelatedUsers = ustore.getUsernamesForRole(sub.U_Role_Id)
                };
                model.Subjects.Add(subjectvm);
            }



            return(View(model));
        }
Пример #8
0
        private static MsgFilter MessageFilter(SocketMessage arg)
        {
            var ToRet = new MsgFilter
            {
                MsgPassed = false
            };

            if (StoreHandler.LoadData(arg.Author.Id, $"GLOBALCHAT-BAN") == null)
            {
                if (!(arg.Attachments.Count > 0))
                {
                    if (!(arg.Content.ToLower().Contains("http") && arg.Content.ToLower().Contains("discord")) && !(arg.Content.ToLower().Contains("discord") && arg.Content.ToLower().Contains("inv")) && !arg.Content.ToLower().Contains("discord.gg") && !arg.Content.ToLower().Contains(".gg/"))
                    {
                        ToRet.MsgPassed = true;
                    }
                    else
                    {
                        ToRet.Reason = "Discord invites can't be sent through here, let's keep this place as ad-free as possible.";
                    }
                }
                else
                {
                    ToRet.Reason = $"Images/files can't be sent through global chat - *Most* links can though!";
                }
            }
            else
            {
                ToRet.Reason = $"You have been banned from global chat for this reason: - {StoreHandler.LoadData(arg.Author.Id, $"GLOBALCHAT-BAN")}";
            }
            return(ToRet);
        }
Пример #9
0
        public static async Task Maindo(SocketMessage arg)
        {
            await arg.Channel.SendMessageAsync("user");

            ulong UserToEdit = ulong.Parse((await new WaitForResponse()
            {
                TimeLimitS = 10,
                ChannelId = arg.Channel.Id,
                UserId = arg.Author.Id
            }.Start()).Content);
            await arg.Channel.SendMessageAsync("key");

            string KeyToEdit = (await new WaitForResponse()
            {
                TimeLimitS = 10,
                ChannelId = arg.Channel.Id,
                UserId = arg.Author.Id
            }.Start()).Content;
            await arg.Channel.SendMessageAsync("value");

            string Value = (await new WaitForResponse()
            {
                TimeLimitS = 10,
                ChannelId = arg.Channel.Id,
                UserId = arg.Author.Id
            }.Start()).Content;

            StoreHandler.SaveData(UserToEdit, KeyToEdit, Value);
            await arg.Channel.SendMessageAsync("saved");
        }
Пример #10
0
        /// <summary>
        /// Set taskanswer for a receive-task
        /// </summary>
        /// <param name="taskId">Id of the task</param>
        /// <param name="messageInstanceId">Id of the choosen message</param>
        /// <param name="username">username</param>
        public void submitReceiveTaskAnswer(int taskId, string messageInstanceId, string username)
        {
            IProcessStore processStore = StoreHandler.getProcessStore(connectionString);
            ITaskStore    taskStore    = StoreHandler.getTaskStore(connectionString);

            T_Task openTask = taskStore.getTaskById(taskId);

            //check if task isn't already answered
            if (openTask.Done == false && openTask.Type.Equals("R"))
            {
                P_ProcessSubject processSubject = processStore.getProcessSubjectForWFId(openTask.WFId);
                P_Process        process        = processStore.getProcess(processSubject.Process_Id);

                DynamicValue val = new DynamicValue();
                val.Add("MessageId", new DynamicValue(messageInstanceId));

                submitTaskAnswer(val, process, openTask);

                //set task as answered
                //taskStore.setTaskStatus(taskId, true);
                taskStore.setTaskStatus(taskId, username, "", messageInstanceId);

                //set the owner of the task recipient instance to the user who submitted the taskanswer
                processStore.setWorkflowInstanceOwner(openTask.WFId, username);
            }
        }
Пример #11
0
        public List <M_Message> getMessagesForReceiveStateTask(string workflowInstanceGuid, List <string> messageTypes)
        {
            List <M_Message> tmp          = new List <M_Message>();
            IProcessStore    processStore = StoreHandler.getProcessStore(connectionString);

            //string wfOwner = processStore.getWorkflowInstance(workflowInstanceGuid).Owner;

            var query = from m in db.M_Messages
                        where m.Recipient_WF_Id == workflowInstanceGuid & m.Received == false
                        select m;

            foreach (var item in query)
            {
                foreach (String s in messageTypes)
                {
                    String[] sa = s.Split('|');
                    String   possibleFromSubject = sa[0];
                    String   possibleMessageType = sa[1];


                    if (item.Message_Type.Equals(possibleMessageType) &&
                        item.Sender_SubjectName.Equals(possibleFromSubject))
                    {
                        tmp.Add(item);
                    }
                }
            }


            return(tmp);
        }
Пример #12
0
 //A method which adds a new Store to the list of stores, and saves them in Json in localstorage
 public void AddStoreToList(Store store)
 {
     SingletonStores.Instance.StoreList.Add(store);                 // Adds a single store Object to StoreList
     OnPropertyChanged(nameof(SingletonStores.Instance.StoreList)); // Updates the StoreList
     StoreHandler.SaveStoresAsync();                                // Saves the store in Json
     RedirectToShopsMethod();                                       // Navigates back to Shops page when a store is added
 }
Пример #13
0
        private static void InitieraDatabas()
        {
            if (DBHandler.InitDatabase())
            {
                // Skapa tabeller
                DBHandler.CreateTable("Purchases", "ID INTEGER NOT NULL UNIQUE ", "ItemId INTEGER NOT NULL", "StoreId INTEGER NOT NULL", "Price REAL NOT NULL", "Date TEXT NOT NULL", @"PRIMARY KEY(""ID"" AUTOINCREMENT)");
                DBHandler.CreateTable("Stores", "ID INTEGER NOT NULL UNIQUE", "Name TEXT NOT NULL", @"PRIMARY KEY(""ID"" AUTOINCREMENT)");
                DBHandler.CreateTable("Items", "ID INTEGER NOT NULL UNIQUE", "Name TEXT NOT NULL", @"PRIMARY KEY(""ID"" AUTOINCREMENT)");

                // Skapa butiker
                StoreHandler.InsertStore("Coop", "Ica", "Netto", "Lidl", "Bokus", "Adlibris", "SF Bokhandeln", "Kjell och Co", "Knas Ohlson", "Elgiganten", "H&M");

                // Skapa varor
                ItemHandler.InsertItem("Mjölk", "Kattmat", "ASUS Laptop", "Bröd", "Knäckebröd", "USB hub", "Bok");

                // Skapa demoinköp med slumpvalda datum
                PurchaseHandler.InsertPurchase("Coop", "Mjölk", 17.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Coop", "Smör", 26.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Coop", "Ost", 99.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Ica", "Bröd", 16.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Ica", "Mjölk", 17.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Ica", "Pålägg", 22.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Netto", "Mjölk", 17.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Netto", "Bröd", 16.0, GetRandomDate());
                PurchaseHandler.InsertPurchase("Adlibris", "Bok", 175, GetRandomDate());
                PurchaseHandler.InsertPurchase("Adlibris", "Bok", 234, GetRandomDate());
                PurchaseHandler.InsertPurchase("Bokus", "Bok", 127, GetRandomDate());
                PurchaseHandler.InsertPurchase("Bokus", "Bok", 36, GetRandomDate());
                PurchaseHandler.InsertPurchase("Netto", "Knäckabröd", 19, GetRandomDate());
                PurchaseHandler.InsertPurchase("Netto", "Mjölk", 19, GetRandomDate());
                PurchaseHandler.InsertPurchase("Kjell och Co", "USB Hub", 256, GetRandomDate());
                PurchaseHandler.InsertPurchase("Knas Ohlson", "Glödlampa", 79, GetRandomDate());
            }
        }
Пример #14
0
        protected override void InitializeWebServer(IEtpSelfHostedWebServer webServer)
        {
            var webServerHandler = new StoreHandler(TestDataStore);

            InitializeRegistrar(webServer.ServerManager, webServerHandler);
            Handlers.Add(webServerHandler);
        }
Пример #15
0
 public void SaveStoreMethod()
 {
     _selectedStore = null;
     GoBackMethod();
     //((Frame)Window.Current.Content).GoBack();
     StoreHandler.SaveStoresAsync();
 }
Пример #16
0
        public static async Task Maindo(SocketMessage arg)
        {
            var Builder = new EmbedBuilder()
            {
                Color       = Color.Magenta,
                Description = "Your Relationship"
            };

            if (StoreHandler.LoadData(arg.Author.Id, $"DATINGDATA") != null)
            {
                var Chchh = arg.Channel as SocketGuildChannel;
                var Guild = Chchh.Guild;

                var User = ulong.Parse(StoreHandler.LoadData(arg.Author.Id, $"DATINGDATA"));

                Builder.AddField($" - - - ", $"<@{User}> + {arg.Author.Mention}", true);

                if (Guild.GetUser(User) != null)
                {
                    Builder.WithThumbnailUrl(Guild.GetUser(User).GetAvatarUrl(ImageFormat.Auto, 2048));
                }
                else
                {
                    Builder.WithThumbnailUrl(arg.Author.GetAvatarUrl(ImageFormat.Auto, 2048));
                }

                await arg.Channel.SendMessageAsync("", false, Builder.Build());
            }
            else
            {
                await arg.Channel.SendMessageAsync($"Sorry {arg.Author.Username}, you're single );");
            }
        }
Пример #17
0
        public static long GetSize(ulong UserId)
        {
            var  Random   = new Random();
            long ToReturn = Random.Next(0, 10);

            if (StoreHandler.LoadData(UserId, $"PPSIZE") != null)
            {
                if (long.TryParse(StoreHandler.LoadData(UserId, $"PPSIZE"), out long ReturnedLong))
                {
                    if (ReturnedLong <= 0)
                    {
                        StoreHandler.RemoveData(UserId, $"PPSIZE");
                        return(ToReturn);
                    }
                    return(ReturnedLong);
                }
                else
                {
                    StoreHandler.RemoveData(UserId, $"PPSIZE");
                    return(ToReturn);
                }
            }

            return(ToReturn);
        }
Пример #18
0
        protected override void InitializeClient(IEtpClient client)
        {
            var clientHandler = new StoreHandler(TestDataStore);

            InitializeRegistrar(client, clientHandler);
            clientHandler.InitializeSession(client);
            Handlers.Add(clientHandler);
        }
Пример #19
0
 // This method deletes a selected store, if one is selected.
 public void DeleteStore()
 {
     if (SelectedStore != null)                                    //  If SelectedStore is not null, run the code inside the If statement
     {
         SingletonStores.Instance.StoreList.Remove(SelectedStore); // Removes the SelectedStore Object from the StoreList
         StoreHandler.SaveStoresAsync();                           // Saves the current StoreList in Json
     }
     RedirectToShopsMethod();                                      // Navigates back to Shops when a store is removed
 }
        /// <summary>Loads data from file with optional automated graph generation.</summary>
        /// <param name="store">Target store to be loaded with data.</param>
        /// <param name="file">Source file with data.</param>
        public static void LoadFromFile(this ITripleStore store, string file)
        {
            var rdfHandler = new StoreHandler(store);

            using (var fileStream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
            {
                VDS.RDF.Parsing.StreamLoader.Load(rdfHandler, file, fileStream);
            }
        }
Пример #21
0
        public static void Store(TimelineStoreData data, StoreHandler onStoreHandler)
        {
            var pool = new TimelinePool();

            pool.index      = data.index;
            pool.path       = data.path;
            pool.storeCount = data.count;
            m_instance.m_dic.Add(data.index, pool);
            pool.Initialize(onStoreHandler);
        }
Пример #22
0
        public static async Task Maindo(SocketMessage arg)
        {
            var             Guild       = ((SocketGuildChannel)arg.Channel).Guild;
            SocketGuildUser UserToCheck = arg.MentionedUsers.Count >= 1 ? arg.MentionedUsers.First() as SocketGuildUser : arg.Author as SocketGuildUser;

            string TitleOfBuilder = $"{UserToCheck.Username}'s Information";
            var    Fields         = new List <EmbedFieldBuilder>()
            {
                new EmbedFieldBuilder()
                {
                    Name  = "Full Username",
                    Value = $"{UserToCheck.Username} #{UserToCheck.Discriminator}"
                },
                new EmbedFieldBuilder()
                {
                    Name  = "Developer ID",
                    Value = UserToCheck.Id.ToString()
                },
                new EmbedFieldBuilder()
                {
                    Name  = "Profile Picture",
                    Value = $"[Link]({UserToCheck.GetAvatarUrl(ImageFormat.Auto, 2048)})"
                },
                new EmbedFieldBuilder()
                {
                    Name  = "Account Age (Days)",
                    Value = (DateTime.UtcNow - UserToCheck.CreatedAt.UtcDateTime).Days.ToString()
                },
                new EmbedFieldBuilder()
                {
                    Name  = "Other",
                    Value = InfoCommandRemarkHolder.ReturnRemarkOfUser(UserToCheck.Id)
                },
                new EmbedFieldBuilder()
                {
                    Name  = "Commands Run",
                    Value = StoreHandler.LoadData(UserToCheck.Id, "CMD-COUNT") != null?StoreHandler.LoadData(UserToCheck.Id, "CMD-COUNT") : "0"
                },
            };

            var Builder = new EmbedBuilder()
            {
                Fields = Fields,
                Color  = new Color(110, 110, 255),
                Footer = new EmbedFooterBuilder()
                {
                    Text = ":D"
                },
                Timestamp    = DateTime.UtcNow,
                Title        = TitleOfBuilder,
                ThumbnailUrl = UserToCheck.GetAvatarUrl() != null?UserToCheck.GetAvatarUrl() : Program.Client.CurrentUser.GetAvatarUrl()
            };

            await arg.Channel.SendMessageAsync("", false, Builder.Build());
        }
Пример #23
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);
                    }
                }
            }
        }
Пример #24
0
        /// <summary>
        /// Starts some background initialization tasks spinning so they're already prepped when actually needed
        /// </summary>
        private void Warmup()
        {
            TempFolder.Warmup();
            // ToDo
            // Currently this is a blocking call.  Perhaps upgrade to be run in a background task.
            // Would first need to ensure users of CEF properly await the background initialization before use
            Helpers.Init();
            StoreHandler.Warmup();

            Task.Run(AssociateListsWithWabbajack).FireAndForget();
        }
Пример #25
0
        public void terminateSubjectInstance(string workFlowId)
        {
            IProcessStore processStore = StoreHandler.getProcessStore(connectionString);
            var           instance     = processStore.getWorkflowInstance(workFlowId);
            var           subject      = instance.ProcessSubject;
            var           process      = subject.Process;

            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(baseAddress + process.WFM_RootScope + process.WFM_ProcessScope), credentials);

            client.Instances.Terminate(subject.WFM_WFName, workFlowId, "ProcessEnd");
        }
Пример #26
0
        public void Setup()
        {
            inMemoryConnection = DbConnectionFactory.CreateTransient();
            using var context  = new MarketDbContext(inMemoryConnection);
            context.Init();
            storeHandler = new StoreHandler();
            RegisteredUser owner = new RegisteredUser("OWNER", new byte[] { });

            context.Users.Add(owner);
            context.SaveChanges();
            Owner = owner.ID;
        }
Пример #27
0
 public static async Task Maindo(SocketMessage arg)
 {
     if (arg.Content.Contains(' ') && ulong.TryParse(arg.Content.ToLower().Split(' ')[1], out ulong ToBan))
     {
         StoreHandler.RemoveData(ToBan, $"GLOBALCHAT-BAN");
         await arg.Channel.SendMessageAsync("Unbanned.");
     }
     else
     {
         await arg.Channel.SendMessageAsync("You need to include the user's id.");
     }
 }
Пример #28
0
        public static async Task Maindo(SocketMessage arg)
        {
            var  User      = arg.MentionedUsers.Count >= 1 ? arg.MentionedUsers.First() : arg.Author;
            long PPSize    = GetSize(User.Id);
            var  MainField = new EmbedFieldBuilder()
            {
                Name = $"PP Size [{PPSize}]"
            };

            MainField.Value = "8";
            try
            {
                long NumberToGoUpTo = PPSize > 750 ? 750 : PPSize;
                long LeftOver       = PPSize > 750 ? PPSize - NumberToGoUpTo : 0;
                for (int i = 1; i <= NumberToGoUpTo; i++)
                {
                    MainField.Value = MainField.Value + "=";
                }
                MainField.Value = MainField.Value + "D";
                if (LeftOver > 0)
                {
                    MainField.Value = MainField.Value + $"  ..+{LeftOver} more";
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (StoreHandler.LoadData(User.Id, "PPSIZE") == null)
            {
                await arg.Channel.SendMessageAsync($"Just a tip (terrible pun intended) - You can use `{Program.Prefix}pills` to save your pp size (and increase or decrease it!)");
            }

            var Embed = new EmbedBuilder()
            {
                Color  = Color.Green,
                Footer = new EmbedFooterBuilder()
                {
                    Text = "MGX"
                },
                Timestamp = DateTime.UtcNow,
                Fields    = new List <EmbedFieldBuilder>()
                {
                    {
                        MainField
                    },
                },
                ThumbnailUrl = User.GetAvatarUrl() == null?Program.Client.CurrentUser.GetAvatarUrl() : User.GetAvatarUrl(),
            };

            await arg.Channel.SendMessageAsync("", false, Embed.Build());
        }
Пример #29
0
        public string addProcess(string companyScopeName, string processScopeName, string workflow_MessageTier_Path, List <SubjectConfig> processSubjects, bool createDBEntries, string startSubjectname, int WS_Project_Id, int WS_Project_Version, string processInfo)
        {
            string scope = createProcessScope(companyScopeName, processScopeName);


            WorkflowManagementClient client = new WorkflowManagementClient(new Uri(cfgWFMBaseAddress + companyScopeName + "/" + processScopeName + "/"), credentials);

            client.PublishWorkflow(workflow_MessageTier_Name, workflow_MessageTier_Path,
                                   new MatchAllSubscriptionFilter() //Filter
            {
                Matches =
                {
                    { "NotificationType", "NewMessage" }
                }
            });

            foreach (SubjectConfig process in processSubjects)
            {
                if (process.Xaml != null)
                {
                    client.PublishWorkflowString(process.Name, process.Xaml);
                }
            }

            if (createDBEntries)
            {
                IProcessStore processStore = StoreHandler.getProcessStore(cfgSQLConnectionString);

                P_Process newProcess = new P_Process(processScopeName);
                newProcess.WS_ProjectId       = WS_Project_Id;
                newProcess.WS_Project_Version = WS_Project_Version;
                newProcess.WFM_ProcessScope   = processScopeName;
                newProcess.ProcessInfo        = processInfo;
                newProcess.WFM_RootScope      = companyScopeName + "/";
                newProcess.ProcessSubjects    = new List <P_ProcessSubject>();

                foreach (SubjectConfig process in processSubjects)
                {
                    if (process.Xaml != null)
                    {
                        newProcess.ProcessSubjects.Add(new P_ProcessSubject(process.Name, process.Name.Equals(startSubjectname), process.Name, process.Role_Id, process.MultiSubject));
                    }
                    else
                    {
                        newProcess.ProcessSubjects.Add(new P_ProcessSubject(process.Name, process.Name.Equals(startSubjectname), null, process.Role_Id, process.MultiSubject));
                    }
                }

                processStore.addNewProcess(newProcess);
            }

            return(scope);
        }
Пример #30
0
        public static async Task Maindo(SocketMessage arg)
        {
            var DataE = StoreHandler.ReturnFilePath(0);

            if (DataE != null)
            {
                await arg.Author.SendMessageAsync(File.ReadAllText(StoreHandler.ReturnFilePath(0)));
            }
            else
            {
                await arg.Author.SendMessageAsync("No data.");
            }
        }