diff --git a/web/ApiControllers/NightFlash/Model/NFEvent.cs b/web/ApiControllers/NightFlash/Model/NFEvent.cs new file mode 100644 index 00000000..8f7b0bc3 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/NFEvent.cs @@ -0,0 +1,80 @@ +// +// NFEvent.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + + /// + /// NF event. + /// + public class NFEvent + { + /// + /// The title. + /// + [Required] public string Title { get; set; } + /// + /// The description. + /// + [Required] public string Description { get; set; } + /// + /// The type of the event. + /// + [Required] public string EventType { get; set; } + /// + /// The location. + /// + [Required] public Position Location { get; set; } + /// + /// The start date. + /// + [Required] public DateTime StartDate { get; set; } + /// + /// The name of the NF provider. + /// + [Required] public string NFProviderName { get; set; } + /// + /// The NF provider identifier. + /// + [Required] public string NFProviderId { get; set; } + /// + /// The type of the location. + /// + [Required] public string LocationType { get; set; } + /// + /// The promotion code. + /// + public string PromotionCode { get; set; } + /// + /// The event web page. + /// + public string EventWebPage { get; set; } + /// + /// The image locator. + /// + public string ImgLocator { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/OpenDay.cs b/web/ApiControllers/NightFlash/Model/OpenDay.cs new file mode 100644 index 00000000..5236183a --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/OpenDay.cs @@ -0,0 +1,56 @@ +// +// OpenDay.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + + /// + /// Open day. + /// + public class OpenDay { + /// + /// The day. + /// + [Required] + public WeekDay Day; + public TimeSpan S { get; set; } + + // ASSERT Start <= End + /// + /// Gets or sets the start hour. + /// + /// The start. + [Required] + public TimeSpan Start { get; set; } + /// + /// Gets or sets the end hour + /// (from the next day if lower than the Start). + /// + /// The end. + [Required] + public TimeSpan End { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/Period.cs b/web/ApiControllers/NightFlash/Model/Period.cs new file mode 100644 index 00000000..826d8260 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/Period.cs @@ -0,0 +1,38 @@ +// +// Period.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Hollydays. + /// + public class Period { + [Required] + public DateTime Start { get; set; } + [Required] + public DateTime End { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/Periodicity.cs b/web/ApiControllers/NightFlash/Model/Periodicity.cs new file mode 100644 index 00000000..f35fd823 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/Periodicity.cs @@ -0,0 +1,43 @@ +// +// Periodicity.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Periodicity. + /// + public enum Periodicity { + /// + /// The daily. + /// + Daily, + Weekly, + Monthly, + ThreeM, + SixM, + Yearly + } + +} diff --git a/web/ApiControllers/NightFlash/Model/Position.cs b/web/ApiControllers/NightFlash/Model/Position.cs new file mode 100644 index 00000000..fb1679f9 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/Position.cs @@ -0,0 +1,43 @@ +// +// Position.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Position. + /// + public class Position + { + /// + /// The longitude. + /// + public double Longitude { get; set; } + /// + /// The latitude. + /// + public double Latitude { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/PositionAndKeyphrase.cs b/web/ApiControllers/NightFlash/Model/PositionAndKeyphrase.cs new file mode 100644 index 00000000..025eef21 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/PositionAndKeyphrase.cs @@ -0,0 +1,42 @@ +// +// PositionAndKeyphrase.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Position and keyphrase. + /// + public class PositionAndKeyphrase { + /// + /// The phrase. + /// + public string phrase; + /// + /// The position. + /// + public Position pos; + } + +} diff --git a/web/ApiControllers/NightFlash/Model/ProvidedEvent.cs b/web/ApiControllers/NightFlash/Model/ProvidedEvent.cs new file mode 100644 index 00000000..d01b9dfe --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/ProvidedEvent.cs @@ -0,0 +1,40 @@ +// +// ProvidedEvent.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + + /// + /// Provided event. + /// + public class ProvidedEvent : NFEvent { + /// + /// The privacy. + /// + [Required] + public Publishing Privacy; + } + +} diff --git a/web/ApiControllers/NightFlash/Model/ProviderPublicInfo.cs b/web/ApiControllers/NightFlash/Model/ProviderPublicInfo.cs new file mode 100644 index 00000000..50f2339b --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/ProviderPublicInfo.cs @@ -0,0 +1,73 @@ +// +// ProviderPublicInfo.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Provider public info. + /// + public class ProviderPublicInfo { + /// + /// Gets or sets the display name. + /// + /// The display name. + [Required] + public string DisplayName { get; set; } + /// + /// Gets or sets the type of the location. + /// + /// The type of the location. + [Required] + public string LocationType { get; set; } + /// + /// Gets or sets the location. + /// + /// The location. + [Required] + public Position Location { get; set; } + /// + /// Gets or sets the logo image locator. + /// + /// The logo image locator. + public string LogoImgLocator { get; set; } + /// + /// Gets or sets the description. + /// + /// The description. + [Required] + public string Description { get; set;} + /// + /// Gets or sets the web page. + /// + /// The web page. + public string WebPage { get; set; } + /// + /// Gets or sets the calendar. + /// + /// The calendar. + public Schedule Calendar { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/Publishing.cs b/web/ApiControllers/NightFlash/Model/Publishing.cs new file mode 100644 index 00000000..b70d7e3d --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/Publishing.cs @@ -0,0 +1,43 @@ +// +// Publishing.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + + /// + /// Publishing. + /// + public enum Publishing { + /// + /// The private. + /// + Private, + /// + /// The public. + /// + Public + } + +} diff --git a/web/ApiControllers/NightFlash/Model/Schedule.cs b/web/ApiControllers/NightFlash/Model/Schedule.cs new file mode 100644 index 00000000..34455e70 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/Schedule.cs @@ -0,0 +1,48 @@ +// +// Schedule.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Schedule. + /// + public class Schedule { + public Periodicity Period { get; set; } + + /// + /// Gets or sets the schedule of an open week. + /// One item by bay in the week, + /// + /// The weekly workdays. + public OpenDay [] WeekDays { get; set; } + /// + /// Gets or sets the hollydays. + /// + /// The hollydays. + [Required] + public Period [] Validity { get; set; } + } + +} diff --git a/web/ApiControllers/NightFlash/Model/WeekDay.cs b/web/ApiControllers/NightFlash/Model/WeekDay.cs new file mode 100644 index 00000000..31435df4 --- /dev/null +++ b/web/ApiControllers/NightFlash/Model/WeekDay.cs @@ -0,0 +1,62 @@ +// +// WeekDay.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . + +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; + +namespace Yavsc.ApiControllers.NightFlash.Model +{ + /// + /// Week day. + /// + public enum WeekDay:int { + /// + /// The monday (0). + /// + Monday=0, + /// + /// The tuesday. + /// + Tuesday, + /// + /// The wednesday. + /// + Wednesday, + /// + /// The thursday. + /// + Thursday, + /// + /// The friday. + /// + Friday, + /// + /// The saturday. + /// + Saturday, + /// + /// The sunday. + /// + Sunday + } + +} diff --git a/web/ApiControllers/NightFlash/NightFlashController.cs b/web/ApiControllers/NightFlash/NightFlashController.cs new file mode 100644 index 00000000..87390129 --- /dev/null +++ b/web/ApiControllers/NightFlash/NightFlashController.cs @@ -0,0 +1,129 @@ +// +// NightFlashController.cs +// +// Author: +// Paul Schneider +// +// Copyright (c) 2015 Paul Schneider +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public License +// along with this program. If not, see . +using System; +using System.Web.Http; +using System.ComponentModel.DataAnnotations; +using Yavsc.ApiControllers.NightFlash.Model; + +namespace Yavsc.ApiControllers.NightFlash +{ + /// + /// Night flash controller. + /// + public class NightFlashController: ApiController + { + /// + /// List events according the specified search arguments. + /// + /// Arguments. + [ValidateAjaxAttribute] + [HttpGet] + public NFEvent[] List ([FromUri] PositionAndKeyphrase args) + { + return new NFEvent[] { + new NFEvent () { + Title = "Test", + Description = "Test Descr", + EventType = "Night club special bubble party", + Location = new Position() { + Longitude = 0, + Latitude = 0 + } + }, + new NFEvent () { + Title = "Test2", + ImgLocator = "http://bla/im.png", + Location = new Position() { + Longitude = 0, + Latitude = 0 + } + }, + new NFEvent () { + Title = "Test", + Description = "Test Descr", + EventType = "Night club special bubble party", + Location = new Position() { + Longitude = 0, + Latitude = 0 + } + }, + new NFEvent () { + Title = "Test2", + ImgLocator = "http://bla/im.png", + Location = new Position() { + Longitude = 0, + Latitude = 0 + } + } + }; + } + + /// + /// Provider the specified ProviderId. + /// + /// Provider identifier. + [HttpGet] + public ProviderPublicInfo Provider ([FromUri] string ProviderId) + { + return new ProviderPublicInfo () { + DisplayName = "Yavsc clubing", + WebPage = "http://yavsc.pschneider.fr/", + Calendar = new Schedule () { + Period = Periodicity.ThreeM, + WeekDays = new OpenDay[] { new OpenDay () { Day = WeekDay.Saturday, + Start = new TimeSpan(18,00,00), + End = new TimeSpan(2,00,00) + } }, + Validity = new Period[] { new Period() { + Start = new DateTime(2015,5,29), + End = new DateTime(2015,5,30)} } + }, + Description = "Yavsc Entertainment Production, Yet another private party", + LogoImgLocator = "http://yavsc.pschneider.fr/favicon.png", + Location = new Position () { Longitude = 0, Latitude = 0 }, + LocationType = "Salle des fêtes" + + }; + } + + /// + /// Posts the image. + /// + /// The image. + /// NF prov identifier. + public string PostImage([FromUri] string NFProvId) + { + return null; + } + + /// + /// Posts the event. + /// + /// The event identifier. + /// Ev. + public int PostEvent ([FromBody] ProvidedEvent ev) + { + return -1; + } + } +} + +