Example #1
0
        private void ReactionListClick(object sender, RoutedEventArgs e)
        {
            DimMainWindow(true);

            ModuleList dlg = new ModuleList(MayhemEntry.Instance.ReactionList, "Reaction List");

            dlg.Owner = this;
            dlg.WindowStartupLocation     = WindowStartupLocation.CenterOwner;
            dlg.ModulesList.SelectedIndex = 0;

            dlg.ShowDialog();
            DimMainWindow(false);

            if (dlg.DialogResult == true)
            {
                if (dlg.SelectedModule != null)
                {
                    reactionType     = dlg.SelectedModule;
                    reactionInstance = dlg.SelectedModuleInstance as ReactionBase;

                    buttonEmptyReaction.Style   = (Style)FindResource("ReactionButton");
                    buttonEmptyReaction.Content = reactionType.Name;

                    CheckEnableBuild();
                }
            }
        }
Example #2
0
        public async Task DeleteReactionAsync(EntityType entityType, ReactionBase reaction, int entityId)
        {
            if (entityId < 0 || entityId < 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            await _shoutStore.DeleteReactionByIdAsync(entityType, reaction, entityId);
        }
Example #3
0
        public static void addConnection()
        {
            Console.WriteLine("Create a Connection:");
            EventBase eventInstance = chooseEvent();

            Console.WriteLine();
            ReactionBase reaction = chooseReaction();

            Connection conn = new Connection(eventInstance, reaction);

            mayhem.ConnectionList.Add(conn);

            Console.WriteLine("Created a new connection: {0}", printConnection(conn));
        }
Example #4
0
        public async Task <int> DeleteReactionByIdAsync(EntityType entityType, ReactionBase reaction, int entityId)
        {
            string reactionName = reaction.ReactionTypeId == ReactionTypeId.Like ? ReactionTypeColumnNames.Like : ReactionTypeColumnNames.Dislike;

            await base._dBContext.OpenDBConnectionAsync();

            using (base._dBContext.DbConnection)
            {
                return(await base._dBContext.ExecuteTransactionAsync(new Dictionary <string, object>()
                {
                    {
                        $@"DELETE FROM {( entityType == EntityType.Shout ? TableNames.ShoutReaction : TableNames.CommentReaction )}
                           WHERE Id = { reaction.Id } AND UserId = { reaction.UserId }",
                        null
                    },
                    {
                        $@"UPDATE {( entityType == EntityType.Shout ? TableNames.Shout : TableNames.Comment )}
                           SET {reactionName} = {reactionName} - 1
                           WHERE Id = { entityId }",
                        null
                    }
                }));
            }
        }