コード例 #1
0
        // constructor method for Progression/Regression for Associations

        /*public CalendarEvent(Association a)
         * {
         *  EventType = CalendarEventType.ProgressionRegression;
         *  EventName = a.Abbreviation + " Progression/Regression";
         *  EventDate = new Date(11, Months.December, 1);
         *  Sport = a.Sport;
         * }*/
        //constructor method for DraftDeclaration for Leagues
        public CalendarEvent(League l, Date d)
        {
            EventType = CalendarEventType.DraftDeclaration;
            EventName = l.Abbreviation + " Draft Declaration";
            EventDate = d;
            Sport     = l.Sport;
        }
コード例 #2
0
        // constructor method for ClientBirthday

        /*public CalendarEvent(Client client)
         * {
         *  EventType = CalendarEventType.ClientBirthday;
         *  EventName = client.FullName + "'s Birthday";
         *  PlayerName = client.FullName;
         *  EventDate = client.Birthday;
         *  PlayerID = client.Id;
         *  Sport = client.Sport;
         * }*/

        // constructor method for LoanRepayment
        public CalendarEvent(Date loanRepaymentDate, int loanRepaymentAmount)
        {
            EventType           = CalendarEventType.LoanRepayment;
            EventName           = "Agency Repays Loan of " + loanRepaymentAmount.ToString("C0");
            EventDate           = loanRepaymentDate;
            LoanRepaymentAmount = loanRepaymentAmount;
        }
コード例 #3
0
 // constrcutor method for LeagueYearBeings and LeagueYearEnds
 public CalendarEvent(League l, string s)
 {
     EventType = CalendarEventType.LeagueYearEnds;
     EventName = l.Abbreviation + " Year Ends";
     EventDate = l.SeasonEnd;
     Sport     = l.Sport;
 }
コード例 #4
0
        // constructor method for AssociationEvent

        /*public CalendarEvent(Event e)
         * {
         *  EventType = CalendarEventType.AssociationEvent;
         *  EventName = e.Year + " " + e.Name;
         *  EventDate = e.EventDate;
         *  Sport = e.Sport;
         *  EventID = e.Id;
         * }*/

        // constructor method for LeagueYearBegins
        public CalendarEvent(League l)
        {
            EventType = CalendarEventType.LeagueYearBegins;
            EventName = l.Abbreviation + " Year Begins";
            EventDate = l.SeasonStart;
            Sport     = l.Sport;
        }
コード例 #5
0
        // constructor method for Progression/Regression for leagues
        public CalendarEvent(string s, League l)
        {
            int month;
            int week;

            if (l.SeasonEnd.MonthNumber == 12)
            {
                month = 0;
            }
            else
            {
                month = l.SeasonEnd.MonthNumber;
            }

            if (l.SeasonEnd.Week == 5)
            {
                week = 4;
            }
            else
            {
                week = l.SeasonEnd.Week;
            }

            EventType = CalendarEventType.ProgressionRegression;
            EventName = l.Abbreviation + " Progression/Regression";
            EventDate = new Date(month + 1, week);
            Sport     = l.Sport;
        }
コード例 #6
0
        public async Task <IActionResult> SetEvent([FromRoute] Guid id, [FromBody] CalendarEventType eventType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var @event = await _db.CalendarEvents.SingleOrDefaultAsync(m => m.Id == id);

            if (@event == null)
            {
                return(NotFound());
            }

            @event.EventType = eventType;

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EventExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #7
0
 // constructor method for Progression/Regression for Associations
 public CalendarEvent(Association a)
 {
     EventType = CalendarEventType.ProgressionRegression;
     EventName = a.Abbreviation + " Progression/Regression";
     EventDate = new Date(11, Months.December, 1);
     Sport     = a.Sport;
 }
コード例 #8
0
        /// <summary>
        /// Updates or creates a resource based on the resource identifier. The PUT operation is used to update or create a resource by identifier.  If the resource doesn't exist, the resource will be created using that identifier.  Additionally, natural key values cannot be changed using this operation, and will not be modified in the database.  If the resource &quot;id&quot; is provided in the JSON body, it will be ignored as well.
        /// </summary>
        /// <param name="id">A resource identifier specifying the resource to be updated.</param>
        /// <param name="IfMatch">The ETag header value used to prevent the PUT from updating a resource modified by another consumer.</param>
        /// <param name="body">The JSON representation of the &quot;calendarEventType&quot; resource to be updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PutCalendarEventType(string id, string IfMatch, CalendarEventType body)
        {
            var request = new RestRequest("/calendarEventTypes/{id}", Method.PUT);

            request.RequestFormat = DataFormat.Json;

            request.AddUrlSegment("id", id);
            // verify required params are set
            if (id == null || body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddHeader("If-Match", IfMatch);
            request.AddBody(body);
            request.Parameters.First(param => param.Type == ParameterType.RequestBody).Name = "application/json";
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
コード例 #9
0
 // constructor method for AssociationEvent
 public CalendarEvent(Event e)
 {
     EventType = CalendarEventType.AssociationEvent;
     EventName = e.Year + " " + e.Name;
     EventDate = e.EventDate;
     Sport     = e.Sport;
     EventID   = e.Id;
 }
コード例 #10
0
 private static CalendarEventTypeDto ToCalendarEventTypeDto(CalendarEventType entity)
 {
     return(new CalendarEventTypeDto
     {
         Id = entity.Id,
         Title = entity.Title
     });
 }
コード例 #11
0
 // constructor method for ClientBirthday
 public CalendarEvent(Client client)
 {
     EventType  = CalendarEventType.ClientBirthday;
     EventName  = client.FullName + "'s Birthday";
     PlayerName = client.FullName;
     EventDate  = client.Birthday;
     PlayerID   = client.Id;
     Sport      = client.Sport;
 }
コード例 #12
0
 // constructor method for PlayerBirthdays
 public CalendarEvent(Player player)
 {
     EventType  = CalendarEventType.PlayerBirthday;
     EventName  = player.FullName + "'s Birthday";
     PlayerName = player.FullName;
     EventDate  = player.Birthday;
     PlayerID   = player.Id;
     Sport      = player.Sport;
 }
コード例 #13
0
 public CalendarEvent(CalendarEventType eventType, string name, string description, DateTime startTime, DateTime endTime, bool repeats, int repeatedInterval, User createdBy)
 {
     this.EventType        = eventType;
     this.Name             = name;
     this.Description      = description;
     this.StartTime        = startTime;
     this.EndTime          = endTime;
     this.Repeats          = repeats;
     this.RepeatedInterval = repeatedInterval;
     this.CreatedBy        = createdBy;
 }
コード例 #14
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        //--Add event
        private void createEventButton_Click(object sender, EventArgs e)
        {
            CalendarEventType calEvent = new CalendarEventType();

            calEvent.config = new AgentConfigType();
            int indexToSelect = this.eventsList.Items.Add(calEvent);

            // Select the created item
            this.eventsList.SelectedIndex = indexToSelect;
            this.saveConfig.Enabled       = true;
        }
コード例 #15
0
 public CalendarEvent(ulong eventId, ObjectGuid ownerGuid, ulong guildId, CalendarEventType type, int textureId, long date, CalendarFlags flags, string title, string description, long lockDate)
 {
     EventId     = eventId;
     OwnerGuid   = ownerGuid;
     GuildId     = guildId;
     EventType   = type;
     TextureId   = textureId;
     Date        = date;
     Flags       = flags;
     LockDate    = lockDate;
     Title       = title;
     Description = description;
 }
コード例 #16
0
        public ActionResult <CalendarEventType> PostCalendarEventType([FromBody] CalendarEventType calendarEventType)
        {
            try
            {
                calendarEventTypeRepository.Create(calendarEventType);

                return(Ok(calendarEventType));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #17
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        private void startSecondChanged(object sender, EventArgs e)
        {
            if (eventsList.SelectedIndex == -1)
            {
                return;
            }
            CalendarEventType calEvent = (CalendarEventType)this.eventsList.SelectedItem;

            calEvent.start.second = (ushort)secondStart.Value;
            // Refresh widget
            this.eventsList.RefreshItem(eventsList.SelectedIndex);

            saveConfig.Enabled = true;
        }
コード例 #18
0
        public CalendarEventTypeDto Create(CalendarEventTypeDto dto)
        {
            CalendarEventType entity = new CalendarEventType()
            {
                Title = dto.Title
            };

            _uow.CalendarEventTypes.Add(entity);
            _uow.Commit();

            dto = ToCalendarEventTypeDto(entity);

            return(dto);
        }
コード例 #19
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        //--Change start day
        private void weekdayStart_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (eventsList.SelectedIndex == -1)
            {
                return;
            }
            CalendarEventType calEvent = (CalendarEventType)this.eventsList.SelectedItem;

            calEvent.start.day = (DayOfWeek)Enum.Parse(typeof(DayOfWeek), (string)weekdayStart.SelectedItem);
            // Refresh widget
            this.eventsList.RefreshItem(eventsList.SelectedIndex);

            this.saveConfig.Enabled = true;
        }
コード例 #20
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        private void durationSecondChanged(object sender, EventArgs e)
        {
            if (eventsList.SelectedIndex == -1)
            {
                return;
            }
            CalendarEventType calEvent = (CalendarEventType)this.eventsList.SelectedItem;

            calEvent.duration.seconds = (ushort)secondsDuration.Value;
            // Refresh widget
            this.eventsList.RefreshItem(eventsList.SelectedIndex);
            this.alwaysAvailableCheckBox.Checked = calEvent.isAlwaysAvailable();

            this.saveConfig.Enabled = true;
        }
コード例 #21
0
        public async Task <ActionResult> Detail(Guid id)
        {
            if (id == Guid.Empty)
            {
                return(NotFound());
            }

            CalendarEventType calendarEventType = await _db.CalendarEventTypes.FirstOrDefaultAsync(c => c.Id == id);

            if (calendarEventType == null)
            {
                return(NotFound());
            }

            return(View(calendarEventType));
        }
コード例 #22
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        //-- END LISTENERS

        //--Behaviour of the "Always" Checkbox
        private void alwaysAvailableCheckBox_CheckStateChanged(object sender, EventArgs e)
        {
            if (alwaysAvailableCheckBox.Checked)
            {
                // Always available means 1 event which start Monday at midnight and lasting 6 days, 23 hours, 59 minutes and 59 seconds

                // 1. Check if there are user defined events and ask the user to save them
                //    into a sperate file
                if (this.eventsList.Items.Count > 0)
                {
                    // Ask the user to to save before setting always available
                    DialogResult res = MessageBox.Show("Always available will remove all plans, do you want to save your current planning ?", "Save Current Planning", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (res == DialogResult.Yes)
                    {
                        this.saveConfigAs_Click(sender, e);
                    }
                }

                // 2. Remove all events
                this.eventsList.Items.Clear();

                // 3. Add a single event to the configuration
                this.configuration.events = new CalendarEventType[] { CalendarEventType.makeAlwaysAvailableDate() };

                // 4. Load values for the process priority and the max cpu usage
                this.processPriorityComboBox.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), configuration.config.processPriority);
                this.maxCpuUsageNumericUpDown.Value       = configuration.config.maxCpuUsage;

                // Disable buttons and group boxes
                this.eventEditorGroup.Enabled  = false;
                this.eventsList.Enabled        = false;
                this.createEventButton.Enabled = false;
                this.deleteEventButton.Enabled = false;
            }
            else
            {
                //--Enabled buttons
                if (this.eventsList.SelectedIndex != -1)
                {
                    this.eventEditorGroup.Enabled = true;
                }
                eventsList.Enabled        = true;
                createEventButton.Enabled = true;
                deleteEventButton.Enabled = true;
            }
            saveConfig.Enabled = true;
        }
コード例 #23
0
        public ActionResult PutCalendarEventType(int id, [FromBody] CalendarEventType calendarEventType)
        {
            try
            {
                if (id != calendarEventType.Id)
                {
                    return(BadRequest());
                }

                calendarEventTypeRepository.Update(calendarEventType);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
コード例 #24
0
        public async Task <IActionResult> AddOrEdit([Bind("Id,Name,Color")] CalendarEventType calendarEventType)
        {
            if (ModelState.IsValid)
            {
                if (calendarEventType.Id == Guid.Empty)
                {
                    _db.Add(calendarEventType);
                }
                else
                {
                    _db.Update(calendarEventType);
                }

                await _db.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(calendarEventType));
        }
コード例 #25
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        private void internalCopyEventsList()
        {
            if (this.eventsList.Items.Count == 0)
            {
                return;
            }
            List <CalendarEventType> list = new List <CalendarEventType>();

            foreach (object item in this.eventsList.Items)
            {
                CalendarEventType evt = (CalendarEventType)item;
                if (evt.isAlwaysAvailable())
                {
                    evt.config.portRange = null;
                }
                list.Add((CalendarEventType)item);
            }
            this.configuration.events = list.ToArray();
        }
コード例 #26
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
 private void processPriorityComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (this.alwaysAvailableCheckBox.Checked)
     {
         this.configuration.config.processPriority = (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), (string)this.processPriorityComboBox.SelectedItem);
     }
     else
     {
         if (eventsList.SelectedIndex == -1)
         {
             return;
         }
         else
         {
             CalendarEventType calEvent = (CalendarEventType)this.eventsList.SelectedItem;
             calEvent.config.processPriority = (ProcessPriorityClass)Enum.Parse(typeof(ProcessPriorityClass), (string)this.processPriorityComboBox.SelectedItem);
         }
     }
     this.saveConfig.Enabled = true;
 }
コード例 #27
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
 private void maxCpuUsageNumericUpDown_ValueChanged(object sender, EventArgs e)
 {
     if (this.alwaysAvailableCheckBox.Checked)
     {
         this.configuration.config.maxCpuUsage = Convert.ToUInt16(this.maxCpuUsageNumericUpDown.Value);
     }
     else
     {
         if (eventsList.SelectedIndex == -1)
         {
             return;
         }
         else
         {
             CalendarEventType calEvent = (CalendarEventType)this.eventsList.SelectedItem;
             calEvent.config.maxCpuUsage = Convert.ToUInt16(this.maxCpuUsageNumericUpDown.Value);
         }
     }
     this.saveConfig.Enabled = true;
 }
コード例 #28
0
ファイル: ConfigEditor.cs プロジェクト: paraita/agent-windows
        /**************************************************************
        * EVENTS                                                      *
        * ************************************************************/

        //--Fill the fields with the values of the selected event
        private void eventsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            CalendarEventType cEv = (CalendarEventType)this.eventsList.SelectedItem;

            if (cEv == null)
            {
                return;
            }
            this.weekdayStart.SelectedIndex           = cEv.resolveDay();
            this.hourStart.Value                      = cEv.start.hour;
            this.minuteStart.Value                    = cEv.start.minute;
            this.secondStart.Value                    = cEv.start.second;
            this.dayDuration.Value                    = cEv.duration.days;
            this.hoursDuration.Value                  = cEv.duration.hours;
            this.minutesDuration.Value                = cEv.duration.minutes;
            this.secondsDuration.Value                = cEv.duration.seconds;
            this.processPriorityComboBox.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), cEv.config.processPriority);
            this.maxCpuUsageNumericUpDown.Value       = cEv.config.maxCpuUsage;
            this.eventEditorGroup.Enabled             = true;
        }
コード例 #29
0
        /// <summary>
        /// Creates or updates resources based on the natural key values of the supplied resource. The POST operation can be used to create or update resources. In database terms, this is often referred to as an &quot;upsert&quot; operation (insert + update).  Clients should NOT include the resource &quot;id&quot; in the JSON body because it will result in an error (you must use a PUT operation to update a resource by &quot;id&quot;). The web service will identify whether the resource already exists based on the natural key values provided, and update or create the resource appropriately.
        /// </summary>
        /// <param name="body">The JSON representation of the &quot;calendarEventType&quot; resource to be created or updated.</param>
        /// <returns>A RestSharp <see cref="IRestResponse"/> instance containing the API response details.</returns>
        public IRestResponse PostCalendarEventTypes(CalendarEventType body)
        {
            var request = new RestRequest("/calendarEventTypes", Method.POST);

            request.RequestFormat = DataFormat.Json;

            // verify required params are set
            if (body == null)
            {
                throw new ArgumentException("API method call is missing required parameters");
            }
            request.AddBody(body);
            var response = client.Execute(request);

            var location = response.Headers.FirstOrDefault(x => x.Name == "Location");

            if (location != null && !string.IsNullOrWhiteSpace(location.Value.ToString()))
            {
                body.id = location.Value.ToString().Split('/').Last();
            }
            return(response);
        }
コード例 #30
0
ファイル: EventProviderHelper.cs プロジェクト: 0anion0/IBN
 /// <summary>
 /// Checks the event beulong.
 /// </summary>
 /// <param name="eventType">Type of the event.</param>
 /// <param name="eventId">The event id.</param>
 /// <returns></returns>
 public static bool CheckEventBelong(CalendarEventType eventType, ulong eventId)
 {
     return CheckEventBelong((ulong)eventType, eventId);
 }
コード例 #31
0
        public void LoadFromDB()
        {
            uint count = 0;

            _maxEventId  = 0;
            _maxInviteId = 0;

            //                                              0        1      2      3            4          5          6     7      8
            SQLResult result = DB.Characters.Query("SELECT EventID, Owner, Title, Description, EventType, TextureID, Date, Flags, LockDate FROM calendar_events");

            if (!result.IsEmpty())
            {
                do
                {
                    ulong             eventID     = result.Read <ulong>(0);
                    ObjectGuid        ownerGUID   = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(1));
                    string            title       = result.Read <string>(2);
                    string            description = result.Read <string>(3);
                    CalendarEventType type        = (CalendarEventType)result.Read <byte>(4);
                    int           textureID       = result.Read <int>(5);
                    uint          date            = result.Read <uint>(6);
                    CalendarFlags flags           = (CalendarFlags)result.Read <uint>(7);
                    uint          lockDate        = result.Read <uint>(8);
                    ulong         guildID         = 0;

                    if (flags.HasAnyFlag(CalendarFlags.GuildEvent) || flags.HasAnyFlag(CalendarFlags.WithoutInvites))
                    {
                        guildID = Global.CharacterCacheStorage.GetCharacterGuildIdByGuid(ownerGUID);
                    }

                    CalendarEvent calendarEvent = new CalendarEvent(eventID, ownerGUID, guildID, type, textureID, date, flags, title, description, lockDate);
                    _events.Add(calendarEvent);

                    _maxEventId = Math.Max(_maxEventId, eventID);

                    ++count;
                }while (result.NextRow());
            }

            Log.outInfo(LogFilter.ServerLoading, "Loaded {0} calendar events", count);
            count = 0;

            //                                    0         1        2        3       4       5             6               7
            result = DB.Characters.Query("SELECT InviteID, EventID, Invitee, Sender, Status, ResponseTime, ModerationRank, Note FROM calendar_invites");
            if (!result.IsEmpty())
            {
                do
                {
                    ulong                inviteId   = result.Read <ulong>(0);
                    ulong                eventId    = result.Read <ulong>(1);
                    ObjectGuid           invitee    = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(2));
                    ObjectGuid           senderGUID = ObjectGuid.Create(HighGuid.Player, result.Read <ulong>(3));
                    CalendarInviteStatus status     = (CalendarInviteStatus)result.Read <byte>(4);
                    uint responseTime           = result.Read <uint>(5);
                    CalendarModerationRank rank = (CalendarModerationRank)result.Read <byte>(6);
                    string note = result.Read <string>(7);

                    CalendarInvite invite = new CalendarInvite(inviteId, eventId, invitee, senderGUID, responseTime, status, rank, note);
                    _invites.Add(eventId, invite);

                    _maxInviteId = Math.Max(_maxInviteId, inviteId);

                    ++count;
                }while (result.NextRow());
            }

            Log.outInfo(LogFilter.ServerLoading, "Loaded {0} calendar invites", count);

            for (ulong i = 1; i < _maxEventId; ++i)
            {
                if (GetEvent(i) == null)
                {
                    _freeEventIds.Add(i);
                }
            }

            for (ulong i = 1; i < _maxInviteId; ++i)
            {
                if (GetInvite(i) == null)
                {
                    _freeInviteIds.Add(i);
                }
            }
        }
コード例 #32
0
 public static CalendarEventType CreateCalendarEventType(int calendarEventTypeID)
 {
     CalendarEventType calendarEventType = new CalendarEventType();
     calendarEventType.CalendarEventTypeID = calendarEventTypeID;
     return calendarEventType;
 }
コード例 #33
0
 public void AddToCalendarEventTypes(CalendarEventType calendarEventType)
 {
     base.AddObject("CalendarEventTypes", calendarEventType);
 }
コード例 #34
0
ファイル: EventProviderHelper.cs プロジェクト: 0anion0/IBN
 /// <summary>
 /// Makes the event id.
 /// </summary>
 /// <param name="eventType">Type of the event.</param>
 /// <param name="eventId">The event id.</param>
 /// <returns></returns>
 public static ulong MakeEventId(CalendarEventType eventType, ulong eventId)
 {
     return MakeEventId((ulong)eventType, eventId);
 }