Esempio n. 1
0
        private async Task SendApplicationsList(ApplicationStatus status, int?limit, bool sortByDescending)
        {
            var pendingApps = await _mediator.Send(new GetByStatus.Query
            {
                Status = status, Limit = limit, SortByDescending = sortByDescending
            });

            var statusText = status.ToString().ToLower();

            if (pendingApps.IsEmpty())
            {
                await Context.Channel.SendMessageAsync($"There are no {statusText} applications at the moment.");

                return;
            }

            var embed = new EmbedBuilder()
                        .WithTitle(sortByDescending
                    ? $"Last {statusText} applications"
                    : $"{statusText.First().ToString().ToUpper() + statusText.Substring(1)} applications")
                        .WithColor(Color.Blue)
                        .WithMmccLogo()
                        .WithApplicationFields(pendingApps)
                        .Build();

            await Context.Channel.SendEmbedAsync(embed);
        }
Esempio n. 2
0
        public void Dispatch(ApplicationStatus status)
        {
            switch (status)
            {
            case ApplicationStatus.Banned:
            {
                HostedWindows.ForEach((element) => element.Banned());

                break;
            }

            case ApplicationStatus.Blocked:
            {
                HostedWindows.ForEach((element) => element.Blocked());

                break;
            }

            case ApplicationStatus.Connected:
            {
                HostedWindows.ForEach((element) => element.Connected());

                break;
            }

            case ApplicationStatus.Disconnected:
            {
                HostedWindows.ForEach((element) => element.Disconnect());

                break;
            }

            case ApplicationStatus.Loading:
            {
                HostedWindows.ForEach((element) => element.Loading());

                break;
            }

            case ApplicationStatus.Normal:
            {
                HostedWindows.ForEach((element) => element.Normal());

                break;
            }

            default:
            {
                ArgumentException ex = new ArgumentException($"Incorrect appstatus '{status.ToString()}' for changing.");
                ex.ToLog(Components.LogLevel.Error);

                throw ex;
            }
            }
        }
Esempio n. 3
0
        public bool UpdateMembershipApplication(ApplicationStatus newStatus, out string message)
        {
            bool confirmation = false;

            if (ApplicationDate is null)
            {
                message = "Invalid membership application";
                return(confirmation);
            }
            message = "success";
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                using (SqlCommand command = new SqlCommand("UpdateMembershipApplication", connection)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                })
                {
                    command.Parameters.AddWithValue("@lastName", ProspectiveMemberContactInfo.LastName);
                    command.Parameters.AddWithValue("@firstName", ProspectiveMemberContactInfo.FirstName);
                    command.Parameters.AddWithValue("@applicationDate", ApplicationDate);
                    command.Parameters.AddWithValue("@applicationStatus", newStatus.ToString());
                    command.Parameters.Add(new SqlParameter("@returnCode", -1)
                    {
                        Direction = System.Data.ParameterDirection.ReturnValue
                    });

                    connection.Open();

                    try
                    {
                        command.ExecuteNonQuery();
                        confirmation = command.Parameters[command.Parameters.Count - 1].Value.ToString() == "0";
                    }
                    catch (Exception ex)
                    {
                        confirmation = false;
                        message      = ex.Message;
                    }
                }
            }

            return(confirmation);
        }