Esempio n. 1
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string eventId, EventStatus eventStatus)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }

            string url = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots, "/", eventId);

            var patchRequests = new List <PatchRequest>();
            var patchRequest  = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());

            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            RawApiResponse response = RestClient.Patch(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);

            try
            {
                var individualEvent = response.Get <IndividualEvent>();
                return(individualEvent);
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Esempio n. 2
0
        public override void AddGumpLayout()
        {
            AddBackground(0, 0, 400, 250, 9300);

            AddHtml(0, 10, 400, 20, Center(Entry.Name), false, false);

            AddHtml(10, 40, 100, 20, "Start Month:", false, false);
            AddHtml(10, 62, 100, 20, "Start Day:", false, false);
            AddHtml(10, 84, 100, 20, "Duration [Days]:", false, false);
            AddHtml(10, 106, 100, 20, "Auto Activate:", false, false);

            AddHtml(120, 40, 250, 20, GetMonth(_Month), false, false);
            AddHtml(120, 62, 250, 20, _Day.ToString(), false, false);
            AddTextEntry(120, 84, 250, 20, 0, 0, _Duration.ToString());
            AddHtml(120, 106, 250, 20, _Status.ToString(), false, false);

            AddButton(335, 40, 4014, 4015, 1, GumpButtonType.Reply, 0);
            AddButton(367, 40, 4005, 4006, 2, GumpButtonType.Reply, 0);

            AddButton(335, 62, 4014, 4015, 3, GumpButtonType.Reply, 0);
            AddButton(367, 62, 4005, 4006, 4, GumpButtonType.Reply, 0);

            AddButton(335, 84, 4014, 4015, 5, GumpButtonType.Reply, 0);
            AddButton(367, 84, 4005, 4006, 6, GumpButtonType.Reply, 0);

            AddButton(335, 106, 4014, 4015, 7, GumpButtonType.Reply, 0);
            AddButton(367, 106, 4005, 4006, 8, GumpButtonType.Reply, 0);

            AddButton(5, 225, 4023, 4024, 9, GumpButtonType.Reply, 0);
            AddHtml(40, 225, 150, 20, "Apply", false, false);

            AddButton(365, 225, 4014, 4016, 10, GumpButtonType.Reply, 0);
            AddHtml(260, 225, 100, 20, AlignRight("Back"), false, false);
        }
Esempio n. 3
0
 public void ChangeStatus(EventStatus status)
 {
     Debug.Log(status.ToString());
     if (OnStatusChange != null)
     {
         OnStatusChange(status);
     }
 }
Esempio n. 4
0
        public string PrepareNotificationContent(string firstName, string surName, string description, string place, DateTime start, DateTime stop, EventStatus status)
        {
            StringBuilder builder = new StringBuilder();

            builder
            .AppendLine("Masz zaproszenie na wydarzenie.")
            .Append("Opis tego wydarzenia:  ").AppendLine(description)
            .Append("Odbędzie się ono: ").Append(start.ToString())
            .Append(", a zakończy sie: ").AppendLine(stop.ToString())
            .Append("w : ").AppendLine(place)
            .Append("Status eventu: ").AppendLine(status.ToString());
            return(builder.ToString());
        }
        public async Task ChangePublishStateAsync(EventEntity message, EventStatus state)
        {
            var sql =
                $"UPDATE {tableName} SET \"Retries\"=@Retries,\"ExpiresAt\"=@ExpiresAt,\"StatusName\"=@StatusName WHERE \"Id\"=@Id";

            using var connection = new NpgsqlConnection(options.ConnectionString);
            await connection.ExecuteAsync(sql, new
            {
                Id = long.Parse(message.Id),
                message.Retries,
                message.ExpiresAt,
                StatusName = state.ToString("G")
            });
        }
Esempio n. 6
0
        private EmbedBuilder CreateEventProposalEmbed(int ID, EventStatus Status, IUser Author, DateTimeOffset Release, string Description, string ResolveReason = "")
        {
            bool IncludeResolutionInfo = CommunityConfiguration.IncludeEventResolutionInfo && (Status == EventStatus.Pending || (Status == EventStatus.Expired && !CommunityConfiguration.FailOnOverdueApproval));

            return(BuildEmbed(EmojiEnum.Sign)
                   .WithColor(new Color(uint.Parse(CommunityConfiguration.EventStatusColor[Status].Replace("0x", ""), System.Globalization.NumberStyles.HexNumber)))
                   .WithTitle(Status.ToString().ToUpper())
                   .WithAuthor(Author)
                   .WithDescription(Description)
                   .AddField("Release Date:", $"{Release.ToOffset(TimeSpan.FromHours(BotConfiguration.StandardTimeZone)):ddd', 'MMM d 'at' hh:mm tt 'UTC'z}")
                   .AddField(IncludeResolutionInfo, "Resolution:", $"{BotConfiguration.Prefix}event [approve/decline] {ID}")
                   .AddField(ResolveReason.Length > 0, "Reason:", ResolveReason)
                   .WithFooter(ID.ToString())
                   .WithCurrentTimestamp());
        }
Esempio n. 7
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="accessToken">Constant Contact OAuth2 access token</param>
        /// <param name="apiKey">The API key for the application</param>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string accessToken, string apiKey, string eventId, EventStatus eventStatus)
        {
            string url = String.Concat(Config.Endpoints.BaseUrl, Config.Endpoints.EventSpots, "/", eventId);

            var patchRequests = new List <PatchRequest>();
            var patchRequest  = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());

            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            CUrlResponse response = RestClient.Patch(url, accessToken, apiKey, json);

            if (response.HasData)
            {
                return(response.Get <IndividualEvent>());
            }
            else if (response.IsError)
            {
                throw new CtctException(response.GetErrorMessage());
            }
            return(new IndividualEvent());
        }
Esempio n. 8
0
 static public long EventToDB(this string events, EventStatus status)
 {
     return(events.SaveLogs(status.ToString(), null, null));
 }
Esempio n. 9
0
 static public long EventOfeventIDToDB(this string events, EventStatus status, int?id_eventID)
 {
     return(events.SaveLogs(status.ToString(), null, id_eventID));
 }
Esempio n. 10
0
 public void TrackEvent(EventName eventName, EventType eventType, EventStatus eventStatus)
 {
     Track(eventName.ToString(), eventType.ToString(), eventStatus.ToString());
 }
Esempio n. 11
0
        /// <summary>
        /// Сохранить событие
        /// </summary>
        /// <param name="events"></param>
        /// <param name="status"></param>
        /// <returns></returns>
        public static long SaveEvents(this string events, EventStatus status)
        {
            EFLog eflog = new EFLog(_blog);

            return(eflog.SaveLogEvents(null, null, events, status.ToString()));
        }
Esempio n. 12
0
        /// <summary>
        /// Сохранить событие
        /// </summary>
        /// <param name="events"></param>
        /// <param name="status"></param>
        /// <param name="id_services"></param>
        /// <returns></returns>
        public static long SaveEventsOfServices(this string events, EventStatus status, int?id_services)
        {
            EFLog eflog = new EFLog(_blog);

            return(eflog.SaveLogEvents(id_services, null, events, status.ToString()));
        }
Esempio n. 13
0
        /// <summary>
        /// Сохранить событие
        /// </summary>
        /// <param name="events"></param>
        /// <param name="status"></param>
        /// <param name="id_eventID"></param>
        /// <returns></returns>
        public static long SaveEventsOfeventID(this string events, EventStatus status, int?id_eventID)
        {
            EFLog eflog = new EFLog(_blog);

            return(eflog.SaveLogEvents(null, id_eventID, events, status.ToString()));
        }
Esempio n. 14
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="accessToken">Constant Contact OAuth2 access token</param>
        /// <param name="apiKey">The API key for the application</param>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string accessToken, string apiKey, string eventId, EventStatus eventStatus)
        {
            string url = String.Concat(Config.Endpoints.BaseUrl, Config.Endpoints.EventSpots, "/", eventId);

            var patchRequests = new List<PatchRequest>();
            var patchRequest = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());
            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            CUrlResponse response = RestClient.Patch(url, accessToken, apiKey, json);
            if (response.HasData)
            {
                return response.Get<IndividualEvent>();
            }
            else if (response.IsError)
            {
                throw new CtctException(response.GetErrorMessage());
            }
            return new IndividualEvent();
        }
Esempio n. 15
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string eventId, EventStatus eventStatus)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }

            string url = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots, "/", eventId);

            var patchRequests = new List<PatchRequest>();
            var patchRequest = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());
            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            RawApiResponse response = RestClient.Patch(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);
            try
            {
                var individualEvent = response.Get<IndividualEvent>();
                return individualEvent;
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Esempio n. 16
0
 static public long EventOfServicesToDB(this string events, EventStatus status, int?id_services)
 {
     return(events.SaveLogs(status.ToString(), id_services, null));
 }
 public List<Event> GetEventsByStatus(EventStatus status)
 {
     using (SynchronicWorldContext context = new SynchronicWorldContext())
     {
         return context.Events.Where(e => e.Status.ToString().Equals(status.ToString())).ToList();
     }
 }